@@ -234,7 +234,7 @@ struct GammaJetTreeProducer {
234234
235235 // if the track type is aod::JetTracks, we need to build the kd tree for the tracks
236236 if constexpr (std::is_same_v<typename std::decay_t <T>, aod::JetTracks>) {
237- for (auto track : objects) {
237+ for (const auto & track : objects) {
238238 if (!isTrackSelected (track)) {
239239 continue ;
240240 }
@@ -252,7 +252,7 @@ struct GammaJetTreeProducer {
252252 }
253253 // if the track type is aod::JetParticles, we need to build the kd tree for the mc particles
254254 if constexpr (std::is_same_v<typename std::decay_t <T>, aod::JetParticles>) {
255- for (auto particle : objects) {
255+ for (const auto & particle : objects) {
256256 if (!particle.isPhysicalPrimary ()) {
257257 continue ;
258258 }
@@ -395,8 +395,8 @@ struct GammaJetTreeProducer {
395395 double cPhi = TVector2::Phi_0_2pi (object.phi ());
396396
397397 // rotate cone left by 90 degrees
398- float cPhiLeft = cPhi - o2::constants::math::PI / 2 ;
399- float cPhiRight = cPhi + o2::constants::math::PI / 2 ;
398+ float cPhiLeft = cPhi - o2::constants::math::PIHalf ;
399+ float cPhiRight = cPhi + o2::constants::math::PIHalf ;
400400
401401 float pointLeft[2 ] = {object.eta (), cPhiLeft};
402402 float pointRight[2 ] = {object.eta (), cPhiRight};
@@ -530,7 +530,7 @@ struct GammaJetTreeProducer {
530530 if (particle.pdgCode () == PDG_t::kGamma && particle.isPhysicalPrimary () && std::abs (particle.getGenStatusCode ()) >= 90 ) {
531531 // check if it has mothers that are pi0s
532532 const auto & mothers = particle.template mothers_as <aod::JMcParticles>();
533- for (auto mother : mothers) {
533+ for (const auto & mother : mothers) {
534534 if (mother.pdgCode () == PDG_t::kPi0 ) {
535535 return true ;
536536 }
@@ -547,7 +547,7 @@ struct GammaJetTreeProducer {
547547 if (particle.pdgCode () == PDG_t::kGamma && particle.isPhysicalPrimary () && std::abs (particle.getGenStatusCode ()) >= 90 ) {
548548 // check if it has mothers that are etas
549549 const auto & mothers = particle.template mothers_as <aod::JMcParticles>();
550- for (auto mother : mothers) {
550+ for (const auto & mother : mothers) {
551551 if (mother.pdgCode () == 221 ) {
552552 return true ;
553553 }
@@ -564,7 +564,7 @@ struct GammaJetTreeProducer {
564564 if (particle.pdgCode () == PDG_t::kGamma && particle.isPhysicalPrimary () && std::abs (particle.getGenStatusCode ()) >= 90 ) {
565565 // check if you find a pi0 mother or a eta mother
566566 const auto & mothers = particle.template mothers_as <aod::JMcParticles>();
567- for (auto mother : mothers) {
567+ for (const auto & mother : mothers) {
568568 if (mother.pdgCode () == PDG_t::kPi0 || mother.pdgCode () == 221 ) {
569569 return false ;
570570 }
@@ -630,7 +630,7 @@ struct GammaJetTreeProducer {
630630 return -1 ;
631631 }
632632 const auto & mothers = particle.template mothers_as <aod::JMcParticles>();
633- for (auto mother : mothers) {
633+ for (const auto & mother : mothers) {
634634 if (mother.pdgCode () == pdgCode) {
635635 return mother.globalIndex ();
636636 } else {
@@ -654,7 +654,7 @@ struct GammaJetTreeProducer {
654654 T currentParticle = particle;
655655 while (currentParticle.has_daughters ()) {
656656 const auto & daughtersIDs = currentParticle.template daughters_as <aod::JMcParticles>();
657- for (auto daughter : daughtersIDs) {
657+ for (const auto & daughter : daughtersIDs) {
658658 daughters.push_back (daughter.globalIndex ());
659659 }
660660 currentParticle = daughtersIDs.iteratorAt (0 );
@@ -691,7 +691,7 @@ struct GammaJetTreeProducer {
691691 return -1 ;
692692
693693 // get first mother
694- for (auto mother : mothers) {
694+ for (const auto & mother : mothers) {
695695 int primaryIndex = findPhysicalPrimaryInChain (mother, depth + 1 );
696696 if (primaryIndex >= 0 ) {
697697 return primaryIndex;
@@ -734,12 +734,12 @@ struct GammaJetTreeProducer {
734734 bool photon2Found = false ;
735735
736736 // check if any of the particles in the fullDecayChain are leading or subleading in the cluster
737- for (auto particleID : fullDecayChain1) {
737+ for (const auto & particleID : fullDecayChain1) {
738738 if (particleID == inducerIDs[0 ] || particleID == inducerIDs[1 ]) {
739739 photon1Found = true ;
740740 }
741741 }
742- for (auto particleID : fullDecayChain2) {
742+ for (const auto & particleID : fullDecayChain2) {
743743 if (particleID == inducerIDs[0 ] || particleID == inducerIDs[1 ]) {
744744 photon2Found = true ;
745745 }
@@ -772,7 +772,7 @@ struct GammaJetTreeProducer {
772772 LOG (debug) << " Cluster with energy: " << cluster.energy () << " and nInducers: " << inducerIDs.size ();
773773 LOG (debug) << " Number of stored amplitudes: " << cluster.amplitudeA ().size ();
774774 int aCounter = 0 ;
775- for (auto inducerID : inducerIDs) {
775+ for (const auto & inducerID : inducerIDs) {
776776 const auto & inducer = mcParticles.iteratorAt (inducerID);
777777 int motherPDG = -1 ;
778778 if (inducer.has_mothers ()) {
@@ -925,7 +925,7 @@ struct GammaJetTreeProducer {
925925 if (!particle.isPhysicalPrimary ()) {
926926 continue ;
927927 }
928- if (particle.pdgCode () != 22 ) {
928+ if (particle.pdgCode () != PDG_t:: kGamma ) {
929929 continue ;
930930 }
931931 mHistograms .fill (HIST (" numberRecCollisionsVsPhotonPt" ), nRecCollisions, particle.pt ());
@@ -1016,7 +1016,7 @@ struct GammaJetTreeProducer {
10161016 buildKdTree (tracks);
10171017
10181018 // loop over clusters
1019- for (auto cluster : clusters) {
1019+ for (const auto & cluster : clusters) {
10201020
10211021 // fill histograms
10221022 mHistograms .fill (HIST (" clusterE" ), cluster.energy ());
@@ -1070,7 +1070,7 @@ struct GammaJetTreeProducer {
10701070 return ;
10711071 // loop over mcClusters
10721072 // TODO: add weights
1073- for (auto mcCluster : mcClusters) {
1073+ for (const auto & mcCluster : mcClusters) {
10741074 mHistograms .fill (HIST (" clusterMC_E_All" ), mcCluster.energy ());
10751075 uint16_t origin = getClusterOrigin (mcCluster, mcParticles);
10761076 float leadingEnergyFraction = mcCluster.amplitudeA ()[0 ] / mcCluster.energy ();
@@ -1133,7 +1133,7 @@ struct GammaJetTreeProducer {
11331133 }
11341134 ushort nconst = 0 ;
11351135 float leadingTrackPt = 0 ;
1136- for (auto & constituent : jet.template tracks_as <aod::JetTracks>()) {
1136+ for (const auto & constituent : jet.template tracks_as <aod::JetTracks>()) {
11371137 mHistograms .fill (HIST (" chjetpt_vs_constpt" ), jet.pt (), constituent.pt ());
11381138 nconst++;
11391139 if (constituent.pt () > leadingTrackPt) {
@@ -1186,7 +1186,7 @@ struct GammaJetTreeProducer {
11861186 buildKdTree (particlesPerMcCollision);
11871187
11881188 // Now we want to store every pi0 and every prompt photon that we find on generator level
1189- for (auto particle : particlesPerMcCollision) {
1189+ for (const auto & particle : particlesPerMcCollision) {
11901190 // only store particles above a given threshold
11911191 if (particle.pt () < minMCGenPt) {
11921192 continue ;
@@ -1259,7 +1259,7 @@ struct GammaJetTreeProducer {
12591259 }
12601260 int localIndex = 0 ;
12611261 auto pjetsPerMcCollision = chargedJets.sliceBy (PJetsPerMCCollisions, collision.mcCollisionId ());
1262- for (auto pjet : pjetsPerMcCollision) {
1262+ for (const auto & pjet : pjetsPerMcCollision) {
12631263 // fill MC particle level jet table
12641264 float perpconerho = ch_perp_cone_rho (pjet, perpConeJetR, true );
12651265 mcJetsTable (storedColIndex, pjet.pt (), pjet.eta (), pjet.phi (), pjet.r (), pjet.energy (), pjet.mass (), pjet.area (), perpconerho);
0 commit comments