@@ -52,6 +52,9 @@ using Run3Cols = aod::Collisions;
5252using Run3TrksWtof = soa::Join<Run3Trks, aod::TOFSignal>;
5353using Run3TrksWtofWevTime = soa::Join<Run3TrksWtof, aod::TOFEvTime, aod::pidEvTimeFlags>;
5454
55+ using EvTimeCollisions = soa::Join<Run3Cols, aod::EvSels>;
56+ using EvTimeCollisionsFT0 = soa::Join<EvTimeCollisions, aod::FT0sCorrected>;
57+
5558using Run2Trks = o2::soa::Join<aod::Tracks, aod::TracksExtra>;
5659using Run2TrksWtofWevTime = soa::Join<Run2Trks, aod::TOFSignal, aod::TOFEvTime, aod::pidEvTimeFlags>;
5760
@@ -146,45 +149,35 @@ struct TOFCalibConfig : ConfigurableGroup {
146149 }
147150 }
148151
149- template <typename CCDBObject, typename TrackType >
152+ template <typename CCDBObject, typename BcType >
150153 void processSetup (o2::pid::tof::TOFResoParamsV3& mRespParamsV3 ,
151154 CCDBObject ccdb,
152- const TrackType& tracks )
155+ const BcType& bc )
153156 {
154- for (auto const & track : tracks) { // Loop on all tracks
155- if (!track.has_collision ()) { // Skipping tracks without collisions
156- continue ;
157- }
158- const auto & coll = track.collision ();
159- if (!coll.has_bc ()) {
160- continue ;
161- }
162- const auto & bc = coll.template bc_as <aod::BCsWithTimestamps>();
163-
164- // First we check if this run number was already processed
165- if (mLastRunNumber == bc.runNumber ()) {
166- return ;
167- }
168- mLastRunNumber = bc.runNumber ();
169- mTimestamp .value = bc.timestamp ();
157+ // First we check if this run number was already processed
158+ if (mLastRunNumber == bc.runNumber ()) {
159+ return ;
160+ }
161+ mLastRunNumber = bc.runNumber ();
162+ mTimestamp .value = bc.timestamp ();
170163
171- // Check the beam type
172- o2::parameters::GRPLHCIFData* grpo = ccdb->template getForTimeStamp <o2::parameters::GRPLHCIFData>(mPathGrpLhcIf .value , mTimestamp .value );
173- mCollisionSystem .value = CollisionSystemType::getCollisionTypeFromGrp (grpo);
164+ // Check the beam type
165+ o2::parameters::GRPLHCIFData* grpo = ccdb->template getForTimeStamp <o2::parameters::GRPLHCIFData>(mPathGrpLhcIf .value ,
166+ mTimestamp .value );
167+ mCollisionSystem .value = CollisionSystemType::getCollisionTypeFromGrp (grpo);
174168
175- if (!mEnableTimeDependentResponse ) {
176- return ;
177- }
178- LOG (debug) << " Updating parametrization from path '" << mParametrizationPath .value << " ' and timestamp " << mTimestamp .value ;
179- if (!ccdb->template getForTimeStamp <o2::tof::ParameterCollection>(mParametrizationPath .value , mTimestamp .value )->retrieveParameters (mRespParamsV3 , mReconstructionPass .value )) {
180- if (mFatalOnPassNotAvailable ) {
181- LOGF (fatal, " Pass '%s' not available in the retrieved CCDB object" , mReconstructionPass .value .data ());
182- } else {
183- LOGF (warning, " Pass '%s' not available in the retrieved CCDB object" , mReconstructionPass .value .data ());
184- }
185- }
169+ if (!mEnableTimeDependentResponse ) {
186170 return ;
187171 }
172+ LOG (debug) << " Updating parametrization from path '" << mParametrizationPath .value << " ' and timestamp " << mTimestamp .value ;
173+ if (!ccdb->template getForTimeStamp <o2::tof::ParameterCollection>(mParametrizationPath .value , mTimestamp .value )->retrieveParameters (mRespParamsV3 , mReconstructionPass .value )) {
174+ if (mFatalOnPassNotAvailable ) {
175+ LOGF (fatal, " Pass '%s' not available in the retrieved CCDB object" , mReconstructionPass .value .data ());
176+ } else {
177+ LOGF (warning, " Pass '%s' not available in the retrieved CCDB object" , mReconstructionPass .value .data ());
178+ }
179+ }
180+ return ;
188181 }
189182
190183 private:
@@ -473,11 +466,10 @@ struct tofEventTime {
473466 Preslice<Run3TrksWtof> perCollision = aod::track::collisionId;
474467 template <o2::track::PID ::ID pid>
475468 using ResponseImplementationEvTime = o2::pid::tof::ExpTimes<Run3TrksWtof::iterator, pid>;
476- using EvTimeCollisions = soa::Join<Run3Cols, aod::EvSels>;
477- using EvTimeCollisionsFT0 = soa::Join<EvTimeCollisions, aod::FT0sCorrected>;
478469 void processRun3 (Run3TrksWtof& tracks,
479470 aod::FT0s const &,
480- EvTimeCollisionsFT0 const &)
471+ EvTimeCollisionsFT0 const &,
472+ aod::BCsWithTimestamps const &)
481473 {
482474 if (!enableTableTOFEvTime) {
483475 return ;
@@ -489,7 +481,17 @@ struct tofEventTime {
489481 tableEvTimeTOFOnly.reserve (tracks.size ());
490482 }
491483
492- mTOFCalibConfig .processSetup (mRespParamsV3 , ccdb, tracks); // Update the calibration parameters
484+ for (auto const & track : tracks) { // Loop on all tracks
485+ if (!track.has_collision ()) { // Skipping tracks without collisions
486+ continue ;
487+ }
488+ const auto & coll = track.collision_as <EvTimeCollisionsFT0>();
489+ if (!coll.has_bc ()) {
490+ continue ;
491+ }
492+ mTOFCalibConfig .processSetup (mRespParamsV3 , ccdb, coll.bc_as <aod::BCsWithTimestamps>()); // Update the calibration parameters
493+ return ;
494+ }
493495
494496 // Autoset the processing mode for the event time computation
495497 switch (mTOFCalibConfig .mCollisionSystem .value ) {
@@ -940,7 +942,9 @@ struct tofPidMerge {
940942
941943 template <o2::track::PID ::ID pid>
942944 using ResponseImplementation = o2::pid::tof::ExpTimes<Run3TrksWtofWevTime::iterator, pid>;
943- void processData (Run3TrksWtofWevTime const & tracks, Run3Cols const &, aod::BCsWithTimestamps const &)
945+ void processData (Run3TrksWtofWevTime const & tracks,
946+ Run3Cols const &,
947+ aod::BCsWithTimestamps const &)
944948 {
945949 constexpr auto responseEl = ResponseImplementation<PID ::Electron>();
946950 constexpr auto responseMu = ResponseImplementation<PID ::Muon>();
@@ -952,7 +956,17 @@ struct tofPidMerge {
952956 constexpr auto responseHe = ResponseImplementation<PID ::Helium3>();
953957 constexpr auto responseAl = ResponseImplementation<PID ::Alpha>();
954958
955- mTOFCalibConfig .processSetup (mRespParamsV3 , ccdb, tracks);
959+ for (auto const & track : tracks) { // Loop on all tracks
960+ if (!track.has_collision ()) { // Skipping tracks without collisions
961+ continue ;
962+ }
963+ const auto & coll = track.collision ();
964+ if (!coll.has_bc ()) {
965+ continue ;
966+ }
967+ mTOFCalibConfig .processSetup (mRespParamsV3 , ccdb, coll.bc_as <aod::BCsWithTimestamps>()); // Update the calibration parameters
968+ return ;
969+ }
956970
957971 for (auto const & pidId : mEnabledParticles ) {
958972 reserveTable (pidId, tracks.size (), false );
0 commit comments