@@ -196,15 +196,15 @@ struct OnTheFlyTracker {
196196 ~TrackAlice3 () = default ;
197197 TrackAlice3 (const TrackAlice3& src) = default ;
198198 TrackAlice3 (const o2::track::TrackParCov& src, const int64_t label,
199- const float t = 0 ,
200- const float te = 1 ,
199+ const float time = 0 ,
200+ const float timeError = 1 ,
201201 bool decayDauInput = false ,
202202 bool weakDecayDauInput = false ,
203203 int isUsedInCascadingInput = 0 ,
204204 int nSiliconHitsInput = 0 ,
205205 int nTPCHitsInput = 0 ) : o2::track::TrackParCov(src),
206206 mcLabel{label},
207- timeEst{t, te },
207+ timeEst{time, timeError },
208208 isDecayDau (decayDauInput),
209209 isWeakDecayDau (weakDecayDauInput),
210210 isUsedInCascading (isUsedInCascadingInput),
@@ -272,7 +272,7 @@ struct OnTheFlyTracker {
272272
273273 o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE;
274274
275- // Track smearer
275+ // Track smearer array, one per geometry
276276 std::vector<std::unique_ptr<o2::delphes::DelphesO2TrackSmearer>> mSmearer ;
277277
278278 // For processing and vertexing
@@ -539,6 +539,7 @@ struct OnTheFlyTracker {
539539
540540 // Set seed for TGenPhaseSpace
541541 rand.SetSeed (seed);
542+ gRandom ->SetSeed (seed);
542543
543544 // Configure FastTracker for primaries
544545 if (fastPrimaryTrackerSettings.fastTrackPrimaries ) {
@@ -669,7 +670,7 @@ struct OnTheFlyTracker {
669670
670671 // generate collision time
671672 auto ir = irSampler.generateCollisionTime ();
672- const float eventCollisionTime = ir.timeInBCNS ;
673+ const float eventCollisionTimeNS = ir.timeInBCNS ;
673674
674675 constexpr std::array<int , 5 > longLivedHandledPDGs = {kElectron ,
675676 kMuonMinus ,
@@ -716,15 +717,21 @@ struct OnTheFlyTracker {
716717 uint32_t multiplicityCounter = 0 ;
717718 getHist (TH1, histPath + " hLUTMultiplicity" )->Fill (dNdEta);
718719
719- gRandom ->SetSeed (seed);
720-
720+ // Now that the multiplicity is known, we can process the particles to smear them
721+ double xiDecayRadius2D = 0 ;
722+ double laDecayRadius2D = 0 ;
723+ double v0DecayRadius2D = 0 ;
724+ std::vector<TLorentzVector> decayProducts;
725+ std::vector<TLorentzVector> v0DecayProducts;
726+ std::vector<double > xiDecayVertex, laDecayVertex, v0DecayVertex;
721727 for (const auto & mcParticle : mcParticles) {
722- double xiDecayRadius2D = 0 ;
723- double laDecayRadius2D = 0 ;
724- double v0DecayRadius2D = 0 ;
725- std::vector<TLorentzVector> decayProducts;
726- std::vector<TLorentzVector> v0DecayProducts;
727- std::vector<double > xiDecayVertex, laDecayVertex, v0DecayVertex;
728+ xiDecayRadius2D = 0 ;
729+ laDecayRadius2D = 0 ;
730+ v0DecayRadius2D = 0 ;
731+ xiDecayVertex.clear ();
732+ laDecayVertex.clear ();
733+ v0DecayVertex.clear ();
734+
728735 if (cascadeDecaySettings.decayXi ) {
729736 if (mcParticle.pdgCode () == kXiMinus ) {
730737 o2::track::TrackParCov xiTrackParCov;
@@ -762,14 +769,16 @@ struct OnTheFlyTracker {
762769 if (enablePrimarySmearing) {
763770 getHist (TH1, histPath + " hPtGenerated" )->Fill (mcParticle.pt ());
764771 getHist (TH1, histPath + " hPhiGenerated" )->Fill (mcParticle.phi ());
765- if (std::abs (mcParticle.pdgCode ()) == kElectron )
766- getHist (TH1, histPath + " hPtGeneratedEl" )->Fill (mcParticle.pt ());
767- if (std::abs (mcParticle.pdgCode ()) == kPiPlus )
768- getHist (TH1, histPath + " hPtGeneratedPi" )->Fill (mcParticle.pt ());
769- if (std::abs (mcParticle.pdgCode ()) == kKPlus )
770- getHist (TH1, histPath + " hPtGeneratedKa" )->Fill (mcParticle.pt ());
771- if (std::abs (mcParticle.pdgCode ()) == kProton )
772- getHist (TH1, histPath + " hPtGeneratedPr" )->Fill (mcParticle.pt ());
772+ switch (std::abs (mcParticle.pdgCode ())) {
773+ case kElectron :
774+ getHist (TH1, histPath + " hPtGeneratedEl" )->Fill (mcParticle.pt ());
775+ case kPiPlus :
776+ getHist (TH1, histPath + " hPtGeneratedPi" )->Fill (mcParticle.pt ());
777+ case kKPlus :
778+ getHist (TH1, histPath + " hPtGeneratedKa" )->Fill (mcParticle.pt ());
779+ case kProton :
780+ getHist (TH1, histPath + " hPtGeneratedPr" )->Fill (mcParticle.pt ());
781+ }
773782 }
774783 if (cascadeDecaySettings.doXiQA && mcParticle.pdgCode () == kXiMinus ) {
775784 histos.fill (HIST (" hGenXi" ), xiDecayRadius2D, mcParticle.pt ());
@@ -795,12 +804,13 @@ struct OnTheFlyTracker {
795804 o2::track::TrackParCov trackParCov;
796805 o2::upgrade::convertMCParticleToO2Track (mcParticle, trackParCov, pdgDB);
797806
798- bool isDecayDaughter = false ;
799- if (mcParticle.getProcess () == TMCProcess::kPDecay )
800- isDecayDaughter = true ;
807+ const bool isDecayDaughter = (mcParticle.getProcess () == TMCProcess::kPDecay );
801808
802809 multiplicityCounter++;
803- const float t = (eventCollisionTime + gRandom ->Gaus (0 ., 100 .)) * 1e-3 ;
810+ const float timeResolutionNs = 100 .f ; // ns
811+ const float timeResolutionUs = timeResolutionNs * 1e-3f ; // us
812+ const float nsToMus = 1e-3f ;
813+ const float time = (eventCollisionTimeNS + gRandom ->Gaus (0 ., timeResolutionNs)) * nsToMus;
804814 static constexpr int kCascProngs = 3 ;
805815 std::vector<o2::track::TrackParCov> xiDaughterTrackParCovsPerfect (3 );
806816 std::vector<o2::track::TrackParCov> xiDaughterTrackParCovsTracked (3 );
@@ -850,9 +860,9 @@ struct OnTheFlyTracker {
850860 histos.fill (HIST (" hNaNBookkeeping" ), i + 1 , 1 .0f );
851861 }
852862 if (isReco[i]) {
853- tracksAlice3.push_back (TrackAlice3{xiDaughterTrackParCovsTracked[i], mcParticle.globalIndex (), t, 100 . f * 1e-3 , true , true , i + 2 , nSiliconHits[i], nTPCHits[i]});
863+ tracksAlice3.push_back (TrackAlice3{xiDaughterTrackParCovsTracked[i], mcParticle.globalIndex (), time, timeResolutionUs , true , true , i + 2 , nSiliconHits[i], nTPCHits[i]});
854864 } else {
855- ghostTracksAlice3.push_back (TrackAlice3{xiDaughterTrackParCovsTracked[i], mcParticle.globalIndex (), t, 100 . f * 1e-3 , true , true , i + 2 });
865+ ghostTracksAlice3.push_back (TrackAlice3{xiDaughterTrackParCovsTracked[i], mcParticle.globalIndex (), time, timeResolutionUs , true , true , i + 2 });
856866 }
857867 }
858868
@@ -1047,7 +1057,7 @@ struct OnTheFlyTracker {
10471057
10481058 // add cascade track
10491059 thisCascade.cascadeTrackId = lastTrackIndex + tracksAlice3.size (); // this is the next index to be filled -> should be it
1050- tracksAlice3.push_back (TrackAlice3{cascadeTrack, mcParticle.globalIndex (), t, 100 . f * 1e-3 , false , false , 1 , thisCascade.foundClusters });
1060+ tracksAlice3.push_back (TrackAlice3{cascadeTrack, mcParticle.globalIndex (), time, timeResolutionUs , false , false , 1 , thisCascade.foundClusters });
10511061
10521062 if (cascadeDecaySettings.doXiQA ) {
10531063 histos.fill (HIST (" hXiBuilding" ), 6 .0f );
@@ -1137,9 +1147,9 @@ struct OnTheFlyTracker {
11371147 // histos.fill(HIST("hNaNBookkeeping"), i + 1, 1.0f);
11381148 // }
11391149 if (isReco[i]) {
1140- tracksAlice3.push_back (TrackAlice3{v0DaughterTrackParCovsTracked[i], mcParticle.globalIndex (), t, 100 . f * 1e-3 , true , true , i + 2 , nSiliconHits[i], nTPCHits[i]});
1150+ tracksAlice3.push_back (TrackAlice3{v0DaughterTrackParCovsTracked[i], mcParticle.globalIndex (), time, timeResolutionUs , true , true , i + 2 , nSiliconHits[i], nTPCHits[i]});
11411151 } else {
1142- ghostTracksAlice3.push_back (TrackAlice3{v0DaughterTrackParCovsTracked[i], mcParticle.globalIndex (), t, 100 . f * 1e-3 , true , true , i + 2 });
1152+ ghostTracksAlice3.push_back (TrackAlice3{v0DaughterTrackParCovsTracked[i], mcParticle.globalIndex (), time, timeResolutionUs , true , true , i + 2 });
11431153 }
11441154 }
11451155 if (v0DecaySettings.doV0QA ) {
@@ -1222,10 +1232,6 @@ struct OnTheFlyTracker {
12221232 thisV0.v0radius = std::hypot (pos[0 ], pos[1 ]);
12231233 thisV0.pt = std::hypot (std::cos (v0DaughterTrackParCovsTracked[0 ].getPhi ()) * v0DaughterTrackParCovsTracked[0 ].getPt () + std::cos (v0DaughterTrackParCovsTracked[1 ].getPhi ()) * v0DaughterTrackParCovsTracked[1 ].getPt (),
12241234 std::sin (v0DaughterTrackParCovsTracked[0 ].getPhi ()) * v0DaughterTrackParCovsTracked[0 ].getPt () + std::sin (v0DaughterTrackParCovsTracked[1 ].getPhi ()) * v0DaughterTrackParCovsTracked[1 ].getPt ());
1225- // thisV0.mLambda = RecoDecay::m(std::array{std::array{posP[0], posP[1], posP[2]},
1226- // std::array{negP[0], negP[1], negP[2]}},
1227- // std::array{o2::constants::physics::MassProton,
1228- // o2::constants::physics::MassPionCharged});
12291235 if (isK0) {
12301236 thisV0.mK0 = RecoDecay::m (std::array{std::array{posP[0 ], posP[1 ], posP[2 ]},
12311237 std::array{negP[0 ], negP[1 ], negP[2 ]}},
@@ -1317,9 +1323,9 @@ struct OnTheFlyTracker {
13171323
13181324 // populate vector with track if we reco-ed it
13191325 if (reconstructed) {
1320- tracksAlice3.push_back (TrackAlice3{trackParCov, mcParticle.globalIndex (), t, 100 . f * 1e-3 , isDecayDaughter});
1326+ tracksAlice3.push_back (TrackAlice3{trackParCov, mcParticle.globalIndex (), time, timeResolutionUs , isDecayDaughter});
13211327 } else {
1322- ghostTracksAlice3.push_back (TrackAlice3{trackParCov, mcParticle.globalIndex (), t, 100 . f * 1e-3 , isDecayDaughter});
1328+ ghostTracksAlice3.push_back (TrackAlice3{trackParCov, mcParticle.globalIndex (), time, timeResolutionUs , isDecayDaughter});
13231329 }
13241330 }
13251331
@@ -1388,9 +1394,10 @@ struct OnTheFlyTracker {
13881394 primaryVertex.getSigmaX2 (), primaryVertex.getSigmaXY (), primaryVertex.getSigmaY2 (),
13891395 primaryVertex.getSigmaXZ (), primaryVertex.getSigmaYZ (), primaryVertex.getSigmaZ2 (),
13901396 0 , primaryVertex.getChi2 (), primaryVertex.getNContributors (),
1391- eventCollisionTime , 0 .f ); // For the moment the event collision time is taken as the "GEANT" time, the computation of the event time is done a posteriori from the tracks in the OTF TOF PID task
1397+ eventCollisionTimeNS , 0 .f ); // For the moment the event collision time is taken as the "GEANT" time, the computation of the event time is done a posteriori from the tracks in the OTF TOF PID task
13921398 tableMcCollisionLabels (mcCollision.globalIndex (), 0 );
13931399 tableCollisionsAlice3 (dNdEta);
1400+ tableOTFLUTConfigId (icfg); // Populate OTF LUT configuration ID
13941401 // *+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*
13951402
13961403 // *+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*
@@ -1434,7 +1441,6 @@ struct OnTheFlyTracker {
14341441 tableTracksDCACov (dcaInfo.getSigmaY2 (), dcaInfo.getSigmaZ2 ());
14351442 }
14361443 }
1437- tableOTFLUTConfigId (icfg);
14381444 tableStoredTracks (tableCollisions.lastIndex (), trackType, trackParCov.getX (), trackParCov.getAlpha (), trackParCov.getY (), trackParCov.getZ (), trackParCov.getSnp (), trackParCov.getTgl (), trackParCov.getQ2Pt ());
14391445 tableTracksExtension (trackParCov.getPt (), trackParCov.getP (), trackParCov.getEta (), trackParCov.getPhi ());
14401446
@@ -1461,6 +1467,7 @@ struct OnTheFlyTracker {
14611467 }
14621468 tableTracksAlice3 (true );
14631469 }
1470+
14641471 // populate ghost tracks
14651472 for (const auto & trackParCov : ghostTracksAlice3) {
14661473 // Fixme: collision index could be changeable
@@ -1511,6 +1518,7 @@ struct OnTheFlyTracker {
15111518 tableTracksAlice3 (false );
15121519 }
15131520
1521+ // populate Cascades
15141522 for (const auto & cascade : cascadesAlice3) {
15151523 tableUpgradeCascades (tableCollisions.lastIndex (), // now we know the collision index -> populate table
15161524 cascade.cascadeTrackId ,
@@ -1527,6 +1535,8 @@ struct OnTheFlyTracker {
15271535 cascade.findableClusters ,
15281536 cascade.foundClusters );
15291537 }
1538+
1539+ // populate V0s
15301540 for (const auto & v0 : v0sAlice3) {
15311541 tableUpgradeV0s (tableCollisions.lastIndex (), // now we know the collision index -> populate table
15321542 v0.positiveId ,
0 commit comments