5151#include " Framework/runDataProcessing.h"
5252#include " ReconstructionDataFormats/Track.h"
5353
54- #include " Math/Vector4D.h"
55- #include " TRandom3.h"
54+ #include < Math/Vector4D.h>
5655#include < TMCProcess.h>
56+ #include < TPDGCode.h> // for PDG codes
57+ #include < TRandom3.h>
5758
5859#include < algorithm>
5960#include < cmath>
@@ -331,7 +332,7 @@ struct nucleiSpectra {
331332 // CCDB options
332333 Configurable<int > cfgMaterialCorrection{" cfgMaterialCorrection" , static_cast <int >(o2::base::Propagator::MatCorrType::USEMatCorrLUT), " Type of material correction" };
333334 Configurable<std::string> cfgCCDBurl{" ccdb-url" , " http://alice-ccdb.cern.ch" , " url of the ccdb repository" };
334- Configurable<std::string> cfgZorroCCDBpath{" cfgZorroCCDBpath" , " /Users/m/mpuccio/ EventFiltering/OTS /" , " path to the zorro ccdb objects" };
335+ Configurable<std::string> cfgZorroCCDBpath{" cfgZorroCCDBpath" , " EventFiltering/Zorro /" , " path to the zorro ccdb objects" };
335336 int mRunNumber = 0 ;
336337 float mBz = 0 .f;
337338
@@ -356,7 +357,7 @@ struct nucleiSpectra {
356357 float dauVtx[3 ]{0 .f , 0 .f , 0 .f };
357358 auto daughters = particle.daughters_as <aod::McParticles>();
358359 for (const auto & dau : daughters) {
359- if (abs (dau.pdgCode ()) != 22 && abs (dau.pdgCode ()) != 11 ) {
360+ if (std:: abs (dau.pdgCode ()) != PDG_t:: kGamma && std:: abs (dau.pdgCode ()) != PDG_t:: kElectron ) {
360361 dauVtx[0 ] = dau.vx ();
361362 dauVtx[1 ] = dau.vy ();
362363 dauVtx[2 ] = dau.vz ();
@@ -510,14 +511,14 @@ struct nucleiSpectra {
510511 spectra.add (" hTpcSignalDataSelected" , " Specific energy loss for selected particles" , HistType::kTH2F , {{600 , -6 ., 6 ., " #it{p} (GeV/#it{c})" }, {1400 , 0 , 1400 , " d#it{E} / d#it{X} (a. u.)" }});
511512 spectra.add (" hTofSignalData" , " TOF beta" , HistType::kTH2F , {{500 , 0 ., 5 ., " #it{p} (GeV/#it{c})" }, {750 , 0 , 1.5 , " TOF #beta" }});
512513
513- for (int iC{0 }; iC < 2 ; ++iC) {
514+ for (unsigned int iC{0 }; iC < nuclei::matter. size () ; ++iC) {
514515 nuclei::hGloTOFtracks[iC] = spectra.add <TH2>(fmt::format (" hTPCTOFtracks{}" , nuclei::matter[iC]).data (), fmt::format (" Global vs TOF matched {} tracks in a collision" , nuclei::chargeLabelNames[iC]).data (), HistType::kTH2D , {{300 , -0.5 , 300.5 , " Number of global tracks" }, {300 , -0.5 , 300.5 , " Number of TOF matched tracks" }});
515516
516517 for (int iS{0 }; iS < nuclei::species; ++iS) {
517518 nuclei::hNsigma[0 ][iS][iC] = spectra.add <TH3>(fmt::format (" h{}nsigma{}_{}" , nuclei::pidName[0 ], nuclei::matter[iC], nuclei::names[iS]).data (), fmt::format (" n#sigma_{{}} {} {}" , nuclei::pidName[0 ], nuclei::matter[iC], nuclei::names[iS]).data (), HistType::kTH3D , {centAxis, ptAxes[iS], nSigmaAxes[0 ]});
518519 nuclei::hNsigmaEta[0 ][iS][iC] = spectra.add <TH3>(fmt::format (" h{}nsigmaEta{}_{}" , nuclei::pidName[0 ], nuclei::matter[iC], nuclei::names[iS]).data (), fmt::format (" n#sigma_{{}} {} {} vs #eta" , nuclei::pidName[0 ], nuclei::matter[iC], nuclei::names[iS]).data (), HistType::kTH3D , {etaAxis, ptAxes[iS], nSigmaAxes[0 ]});
519520
520- for (int iPID{0 }; iPID < 2 ; ++iPID) {
521+ for (unsigned int iPID{0 }; iPID < nuclei::matter. size () ; ++iPID) {
521522 nuclei::hDCAxy[iPID][iS][iC] = spectra.add <TH3>(fmt::format (" hDCAxy{}_{}_{}" , nuclei::pidName[iPID], nuclei::matter[iC], nuclei::names[iS]).data (), fmt::format (" DCAxy {} {} {}" , nuclei::pidName[iPID], nuclei::matter[iC], nuclei::names[iS]).data (), HistType::kTH3D , {centAxis, ptAxes[iS], dcaxyAxes[iS]});
522523 nuclei::hDCAz[iPID][iS][iC] = spectra.add <TH3>(fmt::format (" hDCAz{}_{}_{}" , nuclei::pidName[iPID], nuclei::matter[iC], nuclei::names[iS]).data (), fmt::format (" DCAz {} {} {}" , nuclei::pidName[iPID], nuclei::matter[iC], nuclei::names[iS]).data (), HistType::kTH3D , {centAxis, ptAxes[iS], dcazAxes[iS]});
523524 }
@@ -540,15 +541,15 @@ struct nucleiSpectra {
540541 }
541542
542543 for (int iS{0 }; iS < nuclei::species; ++iS) {
543- for (int iMax{0 }; iMax < 2 ; ++iMax) {
544+ for (unsigned int iMax{0 }; iMax < nuclei::pidName. size () ; ++iMax) {
544545 nuclei::pidCuts[0 ][iS][iMax] = cfgNsigmaTPC->get (iS, iMax);
545546 }
546547 }
547548
548549 if (doprocessMatching) {
549550 std::vector<double > occBins{-0.5 , 499.5 , 999.5 , 1999.5 , 2999.5 , 3999.5 , 4999.5 , 10000 ., 50000 .};
550551 AxisSpec occAxis{occBins, " Occupancy" };
551- for (int iC{0 }; iC < 2 ; ++iC) {
552+ for (unsigned int iC{0 }; iC < nuclei::matter. size () ; ++iC) {
552553 nuclei::hMatchingStudy[iC] = spectra.add <THnSparse>(fmt::format (" hMatchingStudy{}" , nuclei::matter[iC]).data (), " ;#it{p}_{T};#phi;#eta;n#sigma_{ITS};n#sigma{TPC};n#sigma_{TOF};Centrality" , HistType::kTHnSparseF , {{20 , 1 ., 9 .}, {10 , 0 ., o2::constants::math::TwoPI}, {10 , -1 ., 1 .}, {50 , -5 ., 5 .}, {50 , -5 ., 5 .}, {50 , 0 ., 1 .}, {8 , 0 ., 80 .}});
553554 nuclei::hMatchingStudyHadrons[iC] = spectra.add <THn>(fmt::format (" hMatchingStudyHadrons{}" , nuclei::matter[iC]).data (), " ;#it{p}_{T};#phi;#eta;Centrality;Track type; Occupancy" , HistType::kTHnF , {{23 , 0.4 , 5 .}, {20 , 0 ., o2::constants::math::TwoPI}, {10 , -1 ., 1 .}, {8 , 0 ., 80 .}, {2 , -0.5 , 1.5 }, occAxis});
554555 }
@@ -605,7 +606,7 @@ struct nucleiSpectra {
605606 {nuclei::charges[4 ] * cfgMomentumScalingBetheBloch->get (3u , 0u ) / nuclei::masses[4 ], nuclei::charges[4 ] * cfgMomentumScalingBetheBloch->get (3u , 1u ) / nuclei::masses[4 ]}};
606607
607608 int nGloTracks[2 ]{0 , 0 }, nTOFTracks[2 ]{0 , 0 };
608- for (auto & track : tracks) { // start loop over tracks
609+ for (const auto & track : tracks) { // start loop over tracks
609610 if (std::abs (track.eta ()) > cfgCutEta ||
610611 track.tpcInnerParam () < cfgCutTpcMom ||
611612 track.itsNCls () < cfgCutNclusITS ||
@@ -683,7 +684,7 @@ struct nucleiSpectra {
683684 }
684685 ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<float >> fvector{mTrackParCov .getPt () * nuclei::charges[iS], mTrackParCov .getEta (), mTrackParCov .getPhi (), nuclei::masses[iS]};
685686 float y{fvector.Rapidity () + cfgCMrapidity};
686- for (int iPID{0 }; iPID < 2 ; ++iPID) { // / 0 TPC, 1 TOF
687+ for (unsigned int iPID{0 }; iPID < nuclei::pidName. size () ; ++iPID) { // / 0 TPC, 1 TOF
687688 if (selectedTPC[iS]) {
688689 if (iPID && !track.hasTOF ()) {
689690 continue ;
@@ -857,7 +858,7 @@ struct nucleiSpectra {
857858 }
858859 }
859860 }
860- for (auto & c : nuclei::candidates_flow) {
861+ for (const auto & c : nuclei::candidates_flow) {
861862 nucleiTableFlow (c.centFV0A , c.centFT0M , c.centFT0A , c.centFT0C , c.psiFT0A , c.psiFT0C , c.psiTPC , c.psiTPCl , c.psiTPCr , c.qFT0A , c.qFT0C , c.qTPC , c.qTPCl , c.qTPCr );
862863 }
863864 }
@@ -874,7 +875,7 @@ struct nucleiSpectra {
874875 return ;
875876 }
876877 fillDataInfo (collision, tracks);
877- for (auto & c : nuclei::candidates) {
878+ for (const auto & c : nuclei::candidates) {
878879 if (c.fillTree ) {
879880 nucleiTable (c.pt , c.eta , c.phi , c.tpcInnerParam , c.beta , c.zVertex , c.nContrib , c.DCAxy , c.DCAz , c.TPCsignal , c.ITSchi2 , c.TPCchi2 , c.TOFchi2 , c.flags , c.TPCfindableCls , c.TPCcrossedRows , c.ITSclsMap , c.TPCnCls , c.TPCnClsShared , c.clusterSizesITS );
880881 }
@@ -886,7 +887,7 @@ struct nucleiSpectra {
886887 }
887888 }
888889 }
889- for (auto & c : nuclei::candidates_flow) {
890+ for (const auto & c : nuclei::candidates_flow) {
890891 nucleiTableFlow (c.centFV0A , c.centFT0M , c.centFT0A , c.centFT0C , c.psiFT0A , c.psiFT0C , c.psiTPC , c.psiTPCl , c.psiTPCr , c.qFT0A , c.qFT0C , c.qTPC , c.qTPCl , c.qTPCr );
891892 }
892893 }
@@ -896,11 +897,11 @@ struct nucleiSpectra {
896897 void processMC (soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels> const & collisions, aod::McCollisions const & mcCollisions, soa::Join<TrackCandidates, aod::McTrackLabels> const & tracks, aod::McParticles const & particlesMC, aod::BCsWithTimestamps const &)
897898 {
898899 nuclei::candidates.clear ();
899- for (auto & c : mcCollisions) {
900+ for (const auto & c : mcCollisions) {
900901 spectra.fill (HIST (" hGenVtxZ" ), c.posZ ());
901902 }
902903 std::vector<bool > goodCollisions (mcCollisions.size (), false );
903- for (auto & collision : collisions) {
904+ for (const auto & collision : collisions) {
904905 if (!eventSelection (collision)) {
905906 continue ;
906907 }
@@ -948,7 +949,7 @@ struct nucleiSpectra {
948949 if (particle.isPhysicalPrimary ()) {
949950 c.flags |= kIsPhysicalPrimary ;
950951 if (particle.has_mothers ()) {
951- for (auto & motherparticle : particle.mothers_as <aod::McParticles>()) {
952+ for (const auto & motherparticle : particle.mothers_as <aod::McParticles>()) {
952953 if (std::find (nuclei::hfMothCodes.begin (), nuclei::hfMothCodes.end (), std::abs (motherparticle.pdgCode ())) != nuclei::hfMothCodes.end ()) {
953954 c.flags |= kIsSecondaryFromWeakDecay ;
954955 motherPdgCode = motherparticle.pdgCode ();
@@ -959,7 +960,7 @@ struct nucleiSpectra {
959960 }
960961 } else if (particle.has_mothers ()) {
961962 c.flags |= kIsSecondaryFromWeakDecay ;
962- for (auto & motherparticle : particle.mothers_as <aod::McParticles>()) {
963+ for (const auto & motherparticle : particle.mothers_as <aod::McParticles>()) {
963964 motherPdgCode = motherparticle.pdgCode ();
964965 motherDecRadius = std::hypot (particle.vx () - motherparticle.vx (), particle.vy () - motherparticle.vy ());
965966 }
@@ -973,7 +974,7 @@ struct nucleiSpectra {
973974 }
974975
975976 int index{0 };
976- for (auto & particle : particlesMC) {
977+ for (const auto & particle : particlesMC) {
977978 int pdg{std::abs (particle.pdgCode ())};
978979 for (int iS{0 }; iS < nuclei::species; ++iS) {
979980 if (pdg != nuclei::codes[iS]) {
@@ -1005,7 +1006,7 @@ struct nucleiSpectra {
10051006 continue ; // skip secondaries from weak decay without mothers
10061007 }
10071008 flags |= kIsSecondaryFromWeakDecay ;
1008- for (auto & motherparticle : particle.mothers_as <aod::McParticles>()) {
1009+ for (const auto & motherparticle : particle.mothers_as <aod::McParticles>()) {
10091010 motherPdgCode = motherparticle.pdgCode ();
10101011 motherDecRadius = std::hypot (particle.vx () - motherparticle.vx (), particle.vy () - motherparticle.vy ());
10111012 }
@@ -1062,7 +1063,7 @@ struct nucleiSpectra {
10621063 {
10631064 nuclei::candidates.clear ();
10641065 std::vector<bool > goodCollisions (mcCollisions.size (), false );
1065- for (auto & collision : collisions) {
1066+ for (const auto & collision : collisions) {
10661067 if (!eventSelection (collision)) {
10671068 continue ;
10681069 }
@@ -1085,7 +1086,7 @@ struct nucleiSpectra {
10851086 if (particle.isPhysicalPrimary ()) {
10861087 c.flags |= kIsPhysicalPrimary ;
10871088 if (particle.has_mothers ()) {
1088- for (auto & motherparticle : particle.mothers_as <aod::McParticles>()) {
1089+ for (const auto & motherparticle : particle.mothers_as <aod::McParticles>()) {
10891090 if (std::find (nuclei::hfMothCodes.begin (), nuclei::hfMothCodes.end (), std::abs (motherparticle.pdgCode ())) != nuclei::hfMothCodes.end ()) {
10901091 c.flags |= kIsSecondaryFromWeakDecay ;
10911092 motherPdgCode = motherparticle.pdgCode ();
@@ -1096,7 +1097,7 @@ struct nucleiSpectra {
10961097 }
10971098 } else if (particle.has_mothers ()) {
10981099 c.flags |= kIsSecondaryFromWeakDecay ;
1099- for (auto & motherparticle : particle.mothers_as <aod::McParticles>()) {
1100+ for (const auto & motherparticle : particle.mothers_as <aod::McParticles>()) {
11001101 motherPdgCode = motherparticle.pdgCode ();
11011102 motherDecRadius = std::hypot (particle.vx () - motherparticle.vx (), particle.vy () - motherparticle.vy ());
11021103 }
0 commit comments