@@ -166,12 +166,12 @@ struct OnTheFlyTofPid {
166166 std::array<std::array<std::shared_ptr<TH2 >, NParticles>, NParticles> h2dOuterDeltaTrue;
167167
168168 struct ParticleInfo {
169- const std::string_view texName;
170- const std::string_view name;
171- const ParticleId type;
172- const int pdgCode;
173- const double mass;
174- const float charge;
169+ std::string_view texName;
170+ std::string_view name;
171+ ParticleId type;
172+ int pdgCode;
173+ double mass;
174+ float charge;
175175 };
176176
177177 static constexpr ParticleInfo particleEl{.texName = " #it{e}" , .name = " Elec" , .type = El, .pdgCode = PDG_t::kElectron , .mass = o2::constants::physics::MassElectron, .charge = 1 .f };
@@ -567,7 +567,7 @@ struct OnTheFlyTofPid {
567567
568568 // Todo: check the different mass hypothesis iteratively
569569 for (const auto & track : tracks) {
570- auto pdgInfo = pdgDatabase->GetParticle (track.mPdgCode );
570+ const auto & pdgInfo = pdgDatabase->GetParticle (track.mPdgCode );
571571 if (pdgInfo == nullptr ) {
572572 continue ;
573573 }
@@ -694,7 +694,7 @@ struct OnTheFlyTofPid {
694694 LOG (debug) << " Track without mcParticle found!" ;
695695
696696 const auto & mcParticle = track.mcParticle ();
697- o2::track::TrackParCov o2track = o2::upgrade::convertMCParticleToO2Track (mcParticle, pdg );
697+ o2::track::TrackParCov o2track = o2::upgrade::convertMCParticleToO2Track (mcParticle, pdgDatabase );
698698
699699 float xPv = -100 .f ;
700700 static constexpr float TrkXThreshold = -99 .f ; // Threshold to consider a good propagation of the track
@@ -731,7 +731,7 @@ struct OnTheFlyTofPid {
731731 }
732732
733733 // get mass to calculate velocity
734- auto pdgInfo = pdg ->GetParticle (mcParticle.pdgCode ());
734+ const auto & pdgInfo = pdgDatabase ->GetParticle (mcParticle.pdgCode ());
735735 if (pdgInfo == nullptr ) {
736736 LOG (error) << " PDG code " << mcParticle.pdgCode () << " not found in the database" ;
737737 upgradeTofMC (-999 .f , -999 .f , -999 .f , -999 .f );
@@ -818,7 +818,7 @@ struct OnTheFlyTofPid {
818818 static std::array<float , NParticles> deltaTimeInnerTOF, deltaTimeOuterTOF;
819819 static std::array<float , NParticles> nSigmaInnerTOF, nSigmaOuterTOF;
820820 std::array<float , NParticles> momentumHypotheses{}; // Store momentum hypothesis for each particle
821- auto truePdgInfo = pdg ->GetParticle (mcParticle.pdgCode ());
821+ const auto & truePdgInfo = pdgDatabase ->GetParticle (mcParticle.pdgCode ());
822822 float rigidity = momentum; // fallback to momentum if charge unknown
823823
824824 // Use MC truth charge for rigidity calculation
@@ -874,8 +874,8 @@ struct OnTheFlyTofPid {
874874 double etaResolution = std::fabs (std::sin (2.0 * std::atan (std::exp (-pseudorapidity)))) * std::sqrt (trkWithTime.mPseudorapidity .second );
875875 if (simConfig.flagTOFLoadDelphesLUTs ) {
876876 if (mSmearer [collision.lutConfigId ()]->hasTable (Particles[ii].pdgCode )) { // Only if the LUT for this particle was loaded
877- ptResolution = mSmearer [collision.lutConfigId ()]->getAbsPtRes (Particles[ii].pdgCode , pseudorapidity, dNdEta , transverseMomentum);
878- etaResolution = mSmearer [collision.lutConfigId ()]->getAbsEtaRes (Particles[ii].pdgCode , pseudorapidity, dNdEta , transverseMomentum);
877+ ptResolution = mSmearer [collision.lutConfigId ()]->getAbsPtRes (Particles[ii].pdgCode , dNdEta, pseudorapidity , transverseMomentum);
878+ etaResolution = mSmearer [collision.lutConfigId ()]->getAbsEtaRes (Particles[ii].pdgCode , dNdEta, pseudorapidity , transverseMomentum);
879879 }
880880 }
881881 const float innerTrackTimeReso = calculateTrackTimeResolutionAdvanced (transverseMomentum, pseudorapidity, ptResolution, etaResolution, Particles[ii].mass , simConfig.innerTOFRadius , mMagneticField );
@@ -914,7 +914,7 @@ struct OnTheFlyTofPid {
914914
915915 if (plotsConfig.doQAplots ) {
916916 for (int ii = 0 ; ii < NParticles; ii++) {
917- if (!doQaForParticle (Particles[ii].pdgCode ) || std::fabs (mcParticle.pdgCode ()) != pdg ->GetParticle (Particles[ii].pdgCode )->PdgCode ()) {
917+ if (!doQaForParticle (Particles[ii].pdgCode ) || std::fabs (mcParticle.pdgCode ()) != pdgDatabase ->GetParticle (Particles[ii].pdgCode )->PdgCode ()) {
918918 continue ;
919919 }
920920 if (trackLengthRecoInnerTOF > 0 ) {
0 commit comments