|
28 | 28 | #include <string> |
29 | 29 | #include <vector> |
30 | 30 |
|
| 31 | +using namespace o2::framework; |
| 32 | + |
31 | 33 | struct OnTheFlyDetectorGeometryProvider { |
32 | | - o2::framework::HistogramRegistry histos{"Histos", {}, o2::framework::OutputObjHandlingPolicy::AnalysisObject}; |
33 | | - o2::framework::Configurable<bool> cleanLutWhenLoaded{"cleanLutWhenLoaded", true, "clean LUTs after being loaded to save disk space"}; |
34 | | - o2::framework::Configurable<std::vector<std::string>> detectorConfiguration{"detectorConfiguration", |
| 34 | + HistogramRegistry histos{"Histos", {}, o2::framework::OutputObjHandlingPolicy::AnalysisObject}; |
| 35 | + Configurable<bool> cleanLutWhenLoaded{"cleanLutWhenLoaded", true, "clean LUTs after being loaded to save disk space"}; |
| 36 | + Configurable<std::vector<std::string>> detectorConfiguration{"detectorConfiguration", |
35 | 37 | std::vector<std::string>{"$O2PHYSICS_ROOT/share/alice3/a3geometry_v3.ini"}, |
36 | 38 | "Paths of the detector geometry configuration files"}; |
37 | | - o2::framework::Produces<o2::aod::Timestamps> tableTimestamps; |
38 | | - o2::framework::Service<o2::ccdb::BasicCCDBManager> ccdb; |
39 | | - |
40 | | - bool ccdbIsInitialized = false; |
41 | | - void init(o2::framework::InitContext&) |
42 | | - { |
43 | | - // o2::fastsim::GeometryContainer geometryContainer; // Checking that the geometry files can be accessed and loaded |
44 | | - // geometryContainer.setCcdbManager(ccdb.operator->()); |
45 | | - // LOG(info) << "On-the-fly detector geometry provider running."; |
46 | | - // if (detectorConfiguration.value.empty()) { |
47 | | - // LOG(fatal) << "No detector configuration files provided."; |
48 | | - // return; |
49 | | - // } |
50 | | - // int idx = 0; |
51 | | - // for (std::string& configFile : detectorConfiguration.value) { |
52 | | - // LOG(info) << "Loading detector geometry from configuration file: " << configFile; |
53 | | - // histos.add<TH1>(Form("GeometryConfigFile_%d", idx++), configFile.c_str(), o2::framework::HistType::kTH1D, {{1, 0, 1}})->Fill(0.5); |
54 | | - // geometryContainer.addEntry(configFile); |
55 | | - // } |
56 | | - |
57 | | - // // First we check that the magnetic field is consistent |
58 | | - // const int nGeometries = geometryContainer.getNumberOfConfigurations(); |
59 | | - // const float mMagneticField = geometryContainer.getFloatValue(0, "global", "magneticfield"); |
60 | | - // for (int icfg = 0; icfg < nGeometries; ++icfg) { |
61 | | - // const float cfgBfield = geometryContainer.getFloatValue(icfg, "global", "magneticfield"); |
62 | | - // if (std::abs(cfgBfield - mMagneticField) > 1e-3) { |
63 | | - // LOG(fatal) << "Inconsistent magnetic field values between configurations 0 and " << icfg << ": " << mMagneticField << " vs " << cfgBfield; |
64 | | - // } |
65 | | - // } |
66 | | - LOG(info) << "Initialization completed"; |
67 | | - } |
| 39 | + Produces<o2::aod::Timestamps> tableTimestamps; |
| 40 | + Service<o2::ccdb::BasicCCDBManager> ccdb; |
68 | 41 |
|
69 | | - void initCCDB() |
| 42 | + void process(o2::aod::McCollisions const&, o2::aod::McParticles const&) |
70 | 43 | { |
71 | | - if (!ccdbIsInitialized) { |
72 | | - tableTimestamps(o2::upgrade::TimestampLUT); // c2b3d801393540b7bddb949d600b199f, ecacb915-3d70-11f0-ac6f-808de0f5250c |
73 | | - ccdbIsInitialized = true; |
74 | | - LOG(info) << "CCDB initialization completed"; |
75 | | - } |
76 | | - } |
77 | | - |
78 | | - void process(o2::aod::McCollisions const& mcCollisions, o2::aod::McParticles const& mcParticles) |
79 | | - { |
80 | | - initCCDB(); |
81 | | - for (const auto& mcCollision : mcCollisions) { |
82 | | - LOG(debug)<< "On-the-fly detector geometry provider processing " << mcCollision.size() << " collisions and " << mcParticles.size() << " particles."; |
83 | | - } |
84 | | - |
85 | | - LOG(debug)<< "On-the-fly detector geometry provider processing " << mcCollisions.size() << " collisions and " << mcParticles.size() << " particles."; |
| 44 | + tableTimestamps(o2::upgrade::TimestampLUT); // needs to be done for each timeframe - no extra fetches will happen! |
86 | 45 | } |
87 | 46 | }; |
88 | 47 |
|
|
0 commit comments