1010// or submit itself to any jurisdiction.
1111
1212// / \file propagationServiceV2.cxx
13- // / \brief V2: GRPMagField and MeanVertexObject sourced from aod::GloCCDBObjects declarative CCDB table .
13+ // / \brief V2: GRPMagField, MeanVertexObject and the material LUT sourced from declarative CCDB tables .
1414// / \author ALICE
1515
1616// ===============================================================
2828#include " Common/DataModel/EventSelection.h"
2929#include " Common/DataModel/GloCCDBObjects.h"
3030#include " Common/DataModel/PIDResponseTPC.h"
31- #include " Common/Tools/StandardCCDBLoader.h"
31+ #include " Common/DataModel/TpcCCDBObjects.h"
32+ #include " Common/DataModel/TrackTunerCCDBObjects.h"
3233#include " Common/Tools/TrackPropagationModule.h"
3334#include " Common/Tools/TrackTuner.h"
3435
35- #include < CCDB/BasicCCDBManager.h>
36- #include < DetectorsBase/MatLayerCylSet.h>
3736#include < DetectorsBase/Propagator.h>
3837#include < Framework/ASoA.h>
3938#include < Framework/AnalysisDataModel.h>
@@ -66,15 +65,27 @@ using TracksWithExtra = soa::Join<aod::Tracks, aod::TracksExtra>;
6665using TracksExtraWithPID = soa::Join<aod::TracksExtra, aod::pidTPCFullEl, aod::pidTPCFullPi, aod::pidTPCFullPr, aod::pidTPCFullKa, aod::pidTPCFullHe>;
6766
6867struct propagationServiceV2 {
69- // Service<BasicCCDBManager> kept for MatLUT (rectifyPtrFromFile) and
70- // strangenessBuilderModule (V-drift via ccdb->instance()).
71- // GRPMagField and MeanVertex are sourced from CCDB columns instead.
72- o2::framework::Configurable<std::string> ccdburl{" ccdburl" , " http://alice-ccdb.cern.ch" , " url of the ccdb repository" };
73- Service<o2::ccdb::BasicCCDBManager> ccdb;
74-
75- // propagation stuff — ccdbLoader used only for lut + mMeanVtx (set from column) + runNumber
76- o2::common::StandardCCDBLoaderConfigurables standardCCDBLoaderConfigurables;
77- o2::common::StandardCCDBLoader ccdbLoader;
68+ // No CCDB client of any kind: GRPMagField, MeanVertex, the material LUT and the TPC
69+ // drift correction all arrive as declarative CCDB columns.
70+ // NB: TrackTuner still holds its own CcdbApi for the DCA calibration files when
71+ // useTrackTuner is enabled; its path is derived from the run number, which a CCDB
72+ // column cannot express today.
73+
74+ // Keep every CCDB path user-overridable, as ccdb.lutPath / ccdb.grpmagPath /
75+ // ccdb.mVtxPath were before the migration. The option name and default are derived
76+ // from the column itself ("ccdb:fMatLUT" and friends), so they cannot drift from the
77+ // declaration the way the old per-task Configurables did. Declaring them is enough —
78+ // the accessors stay bc.matLUT() / bc.grpMagField() / bc.meanVertex().
79+ o2::framework::ConfigurableCCDBPath<aod::ccdbGlo::MatLUT> matLUTPath;
80+ o2::framework::ConfigurableCCDBPath<aod::ccdbGlo::GRPMagField> grpMagFieldPath;
81+ o2::framework::ConfigurableCCDBPath<aod::ccdbGlo::MeanVertex> meanVertexPath;
82+
83+ // Everything this task needs is read straight off the CCDB columns at the point of
84+ // use; no StandardCCDBLoader, and no CCDB query of its own. The single piece of
85+ // retained state is the run number, needed only to avoid re-installing the magnetic
86+ // field: that one is not a lookup but global state in the Propagator /
87+ // TGeoGlobalMagField singletons, and installing it rebuilds or rescales the field map.
88+ int mRunNumber = -1 ;
7889
7990 // boilerplate: strangeness builder stuff
8091 o2::pwglf::strangenessbuilder::products products;
@@ -93,86 +104,76 @@ struct propagationServiceV2 {
93104 o2::common::TrackPropagationConfigurables trackPropagationConfigurables;
94105 o2::common::TrackPropagationModule trackPropagation;
95106
96- using BCsWithCCDB = soa::Join<aod::BCsWithTimestamps, aod::GloCCDBObjects>;
107+ using BCsWithCCDB = soa::Join<aod::BCsWithTimestamps, aod::GloCCDBObjects, aod::GeomCCDBObjects, aod::TpcCalibCCDBObjects, aod::TrackTunerCCDBObjects >;
97108
98109 // registry
99110 HistogramRegistry histos{" histos" };
100111
101112 void init (o2::framework::InitContext& initContext)
102113 {
103- // Only needed for MatLUT fetch and strangenessBuilderModule V-drift
104- ccdb->setCaching (true );
105- ccdb->setLocalObjectValidityChecking ();
106- ccdb->setURL (ccdburl.value );
107-
108114 // task-specific
109- trackPropagation.init (trackPropagationConfigurables, trackTunerObj, histos, initContext);
115+ trackPropagation.init (trackPropagationConfigurables, trackTunerObj, histos, initContext, /* calibFromCCDBColumns= */ true );
110116 strangenessBuilderModule.init (baseOpts, v0BuilderOpts, cascadeBuilderOpts, preSelectOpts, eventSelectOpts, histos, initContext);
111117 }
112118
113- // Load MatLUT once (needs rectifyPtrFromFile, kept manual), set B-field and mean vertex
114- // once per run from GRPMagField/MeanVertex CCDB columns .
119+ // / Install into the Propagator the two things which are global state rather than
120+ // / values: the magnetic field and the material LUT .
115121 template <typename TBC >
116- void initCCDB (TBC const & bc0)
122+ void initPropagator (TBC const & bc0)
117123 {
118- if (ccdbLoader. runNumber != bc0.runNumber ()) {
124+ if (mRunNumber != bc0.runNumber ()) {
119125 LOG (info) << " Setting B-field to current " << bc0.grpMagField ().getL3Current () << " A for run " << bc0.runNumber () << " from GRPMagField CCDB column" ;
120126 o2::base::Propagator::initFieldFromGRP (&bc0.grpMagField ());
121- ccdbLoader.mMeanVtx = &bc0.meanVertex ();
122- ccdbLoader.runNumber = bc0.runNumber ();
123- } else {
124- // Verify the CCDB column buffer has not been replaced mid-run.
125- // The deserialised pointer must be stable for the lifetime of a run.
126- if (&bc0.meanVertex () != ccdbLoader.mMeanVtx ) {
127- LOG (fatal) << " MeanVertex CCDB column pointer changed within run " << bc0.runNumber () << " — unexpected buffer replacement" ;
128- }
129- }
130- if (!ccdbLoader.lut ) {
131- LOG (info) << " Loading material look-up table for run: " << bc0.runNumber ();
132- ccdbLoader.lut = o2::base::MatLayerCylSet::rectifyPtrFromFile (
133- ccdb->template getForRun <o2::base::MatLayerCylSet>(standardCCDBLoaderConfigurables.lutPath .value , bc0.runNumber ()));
134- o2::base::Propagator::Instance ()->setMatLUT (ccdbLoader.lut );
127+ mRunNumber = bc0.runNumber ();
135128 }
129+ // A pointer store, so it costs nothing to redo every timeframe — and doing so
130+ // means a relocated column buffer is picked up for free instead of dangling.
131+ // The column's finaliser has already run MatLayerCylSet::rectifyPtrFromFile.
132+ o2::base::Propagator::Instance ()->setMatLUT (&bc0.matLUT ());
136133 }
137134
138135 void processRealData (soa::Join<aod::Collisions, aod::EvSels> const & collisions, aod::V0s const & v0s, aod::Cascades const & cascades, aod::TrackedCascades const & trackedCascades, FullTracksExtIU const & tracks, BCsWithCCDB const & bcs)
139136 {
140137 if (bcs.size () == 0 ) {
141138 return ;
142139 }
143- initCCDB (bcs.begin ());
144- trackPropagation.fillTrackTables <false >(trackPropagationConfigurables, trackTunerObj, ccdbLoader, collisions, tracks, trackPropagationProducts, histos);
145- strangenessBuilderModule.dataProcess (ccdb, histos, collisions, static_cast <TObject*>(nullptr ), v0s, cascades, trackedCascades, tracks, bcs, static_cast <TObject*>(nullptr ), products);
140+ auto bc0 = bcs.begin ();
141+ initPropagator (bc0);
142+ trackPropagation.fillTrackTables <false >(trackPropagationConfigurables, trackTunerObj, bc0.runNumber (), &bc0.meanVertex (), &bc0.trackTunerDca (), &bc0.trackTunerQOverPt (), collisions, tracks, trackPropagationProducts, histos);
143+ strangenessBuilderModule.dataProcess (histos, collisions, static_cast <TObject*>(nullptr ), v0s, cascades, trackedCascades, tracks, bcs, static_cast <TObject*>(nullptr ), products);
146144 }
147145
148146 void processMonteCarlo (soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels> const & collisions, aod::McCollisions const & mccollisions, aod::V0s const & v0s, aod::Cascades const & cascades, aod::TrackedCascades const & trackedCascades, FullTracksExtLabeledIU const & tracks, BCsWithCCDB const & bcs, aod::McParticles const & mcParticles)
149147 {
150148 if (bcs.size () == 0 ) {
151149 return ;
152150 }
153- initCCDB (bcs.begin ());
154- trackPropagation.fillTrackTables <true >(trackPropagationConfigurables, trackTunerObj, ccdbLoader, collisions, tracks, trackPropagationProducts, histos);
155- strangenessBuilderModule.dataProcess (ccdb, histos, collisions, mccollisions, v0s, cascades, trackedCascades, tracks, bcs, mcParticles, products);
151+ auto bc0 = bcs.begin ();
152+ initPropagator (bc0);
153+ trackPropagation.fillTrackTables <true >(trackPropagationConfigurables, trackTunerObj, bc0.runNumber (), &bc0.meanVertex (), &bc0.trackTunerDca (), &bc0.trackTunerQOverPt (), collisions, tracks, trackPropagationProducts, histos);
154+ strangenessBuilderModule.dataProcess (histos, collisions, mccollisions, v0s, cascades, trackedCascades, tracks, bcs, mcParticles, products);
156155 }
157156
158157 void processRealDataWithPID (soa::Join<aod::Collisions, aod::EvSels> const & collisions, aod::V0s const & v0s, aod::Cascades const & cascades, aod::TrackedCascades const & trackedCascades, FullTracksExtIUWithPID const & tracks, BCsWithCCDB const & bcs)
159158 {
160159 if (bcs.size () == 0 ) {
161160 return ;
162161 }
163- initCCDB (bcs.begin ());
164- trackPropagation.fillTrackTables <false >(trackPropagationConfigurables, trackTunerObj, ccdbLoader, collisions, tracks, trackPropagationProducts, histos);
165- strangenessBuilderModule.dataProcess (ccdb, histos, collisions, static_cast <TObject*>(nullptr ), v0s, cascades, trackedCascades, tracks, bcs, static_cast <TObject*>(nullptr ), products);
162+ auto bc0 = bcs.begin ();
163+ initPropagator (bc0);
164+ trackPropagation.fillTrackTables <false >(trackPropagationConfigurables, trackTunerObj, bc0.runNumber (), &bc0.meanVertex (), &bc0.trackTunerDca (), &bc0.trackTunerQOverPt (), collisions, tracks, trackPropagationProducts, histos);
165+ strangenessBuilderModule.dataProcess (histos, collisions, static_cast <TObject*>(nullptr ), v0s, cascades, trackedCascades, tracks, bcs, static_cast <TObject*>(nullptr ), products);
166166 }
167167
168168 void processMonteCarloWithPID (soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels> const & collisions, aod::McCollisions const & mccollisions, aod::V0s const & v0s, aod::Cascades const & cascades, aod::TrackedCascades const & trackedCascades, FullTracksExtLabeledIUWithPID const & tracks, BCsWithCCDB const & bcs, aod::McParticles const & mcParticles)
169169 {
170170 if (bcs.size () == 0 ) {
171171 return ;
172172 }
173- initCCDB (bcs.begin ());
174- trackPropagation.fillTrackTables <true >(trackPropagationConfigurables, trackTunerObj, ccdbLoader, collisions, tracks, trackPropagationProducts, histos);
175- strangenessBuilderModule.dataProcess (ccdb, histos, collisions, mccollisions, v0s, cascades, trackedCascades, tracks, bcs, mcParticles, products);
173+ auto bc0 = bcs.begin ();
174+ initPropagator (bc0);
175+ trackPropagation.fillTrackTables <true >(trackPropagationConfigurables, trackTunerObj, bc0.runNumber (), &bc0.meanVertex (), &bc0.trackTunerDca (), &bc0.trackTunerQOverPt (), collisions, tracks, trackPropagationProducts, histos);
176+ strangenessBuilderModule.dataProcess (histos, collisions, mccollisions, v0s, cascades, trackedCascades, tracks, bcs, mcParticles, products);
176177 }
177178
178179 PROCESS_SWITCH (propagationServiceV2, processRealData, " process real data" , true );
0 commit comments