Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@

#include <CCDB/BasicCCDBManager.h>
#include <Framework/AnalysisTask.h>
#include <Framework/HistogramRegistry.h>
#include <Framework/runDataProcessing.h>

#include <map>
#include <string>
#include <vector>

struct OnTheFlyDetectorGeometryProvider {

o2::framework::HistogramRegistry histos{"Histos", {}, o2::framework::OutputObjHandlingPolicy::AnalysisObject};
o2::framework::Configurable<std::vector<std::string>> detectorConfiguration{"detectorConfiguration",
std::vector<std::string>{"$O2PHYSICS_ROOT/share/alice3/a3geometry_v3.ini"},
"Paths of the detector geometry configuration files"};
Expand All @@ -43,8 +44,9 @@
return;
}
int idx = 0;
for (auto& configFile : detectorConfiguration.value) {

Check failure on line 47 in ALICE3/TableProducer/OTF/onTheFlyDetectorGeometryProvider.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
LOG(info) << "Loading detector geometry from configuration file: " << configFile;
histos.add<TH1>(Form("GeometryConfigFile_%d", idx), configFile.c_str(), o2::framework::HistType::kTH1D, {{1, 0, 1}})->Fill(0.5);
// If the filename starts with ccdb: then take the file from the ccdb
if (configFile.rfind("ccdb:", 0) == 0) {
std::string ccdbPath = configFile.substr(5); // remove "ccdb:" prefix
Expand All @@ -71,14 +73,16 @@
const float mMagneticField = geometryContainer.getFloatValue(0, "global", "magneticfield");
for (int icfg = 0; icfg < nGeometries; ++icfg) {
const float cfgBfield = geometryContainer.getFloatValue(icfg, "global", "magneticfield");
if (std::abs(cfgBfield - mMagneticField) > 1e-3) {

Check failure on line 76 in ALICE3/TableProducer/OTF/onTheFlyDetectorGeometryProvider.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
LOG(fatal) << "Inconsistent magnetic field values between configurations 0 and " << icfg << ": " << mMagneticField << " vs " << cfgBfield;
}
}
LOG(info) << "Initialization completed";
}

void process(o2::aod::McCollisions const&)
void process(o2::aod::McCollisions const& mcCollisions, o2::aod::McParticles const& mcParticles)
{
LOG(info) << "On-the-fly detector geometry provider processing " << mcCollisions.size() << " collisions and " << mcParticles.size() << " particles.";
}
};

Expand Down
Loading