2424#include " Common/DataModel/PIDResponseTPC.h"
2525#include " Common/DataModel/TrackSelectionTables.h"
2626
27- #include < CCDB/BasicCCDBManager.h>
2827#include < CommonConstants/PhysicsConstants.h>
2928#include < Framework/AnalysisDataModel.h>
3029#include < Framework/AnalysisHelpers.h>
4039#include < TH1.h>
4140#include < TPDGCode.h>
4241
42+ #include < array>
43+ #include < cstddef>
4344#include < string>
4445#include < string_view>
4546#include < vector>
@@ -84,6 +85,7 @@ struct MeanPtFlucId {
8485 Configurable<float > cfgP1corr{" cfgP1corr" , 0.0001 , " p_{1} for corrected N_{TPC} " };
8586 Configurable<float > cfgP2corr{" cfgP2corr" , 0.0001 , " p_{2} for corrected N_{TPC} " };
8687 Configurable<bool > cfgSel8{" cfgSel8" , true , " Sel8 trigger" };
88+ Configurable<bool > cfgNtpcEventCut{" cfgNtpcEventCut" , true , " N_{TPC} Event Cut for reco" };
8789 Configurable<bool > cfgNoSameBunchPileup{" cfgNoSameBunchPileup" , true , " kNoSameBunchPileup" };
8890 Configurable<bool > cfgIsVertexITSTPC{" cfgIsVertexITSTPC" , true , " kIsVertexITSTPC" };
8991 Configurable<bool > cfgLightIonCuts{" cfgLightIonCuts" , false , " Light Ion Cuts" };
@@ -105,7 +107,7 @@ struct MeanPtFlucId {
105107 Configurable<std::vector<double >> ptBinsKa{" ptBinsKa" , {0.30 , 0.325 , 0.35 , 0.375 , 0.40 , 0.425 , 0.45 , 0.475 , 0.50 , 0.55 , 0.60 , 0.65 , 0.70 , 0.75 , 0.8 , 0.85 , 0.90 , 0.95 , 1.0 , 1.05 , 1.1 , 1.15 , 1.2 , 1.25 , 1.3 , 1.35 , 1.4 , 1.45 , 1.5 , 1.55 , 1.6 , 1.70 , 1.80 , 1.90 , 2.00 }, " p_{T} bins for kaons" };
106108 Configurable<std::vector<double >> ptBinsPr{" ptBinsPr" , {0.40 , 0.425 , 0.45 , 0.475 , 0.5 , 0.525 , 0.55 , 0.575 , 0.60 , 0.625 , 0.65 , 0.675 , 0.70 , 0.725 , 0.75 , 0.775 , 0.80 , 0.825 , 0.85 , 0.875 , 0.90 , 0.925 , 0.95 , 1.0 , 1.025 , 1.05 , 1.075 , 1.1 , 1.15 , 1.2 , 1.4 , 1.6 , 1.8 , 2.0 }, " p_{T} bins for protons" };
107109
108- Service<o2::framework::O2DatabasePDG> pdg;
110+ Service<o2::framework::O2DatabasePDG> pdg{} ;
109111
110112 HistogramRegistry hist{" hist" , {}, OutputObjHandlingPolicy::AnalysisObject};
111113
@@ -152,7 +154,7 @@ struct MeanPtFlucId {
152154 Gen_Proton
153155 };
154156
155- static constexpr std::string_view Dire[] = {
157+ static constexpr std::array<std:: string_view, 12 > Dire = {
156158 " QA/after/" ,
157159 " QA/Pion/" ,
158160 " QA/Kaon/" ,
@@ -538,26 +540,33 @@ struct MeanPtFlucId {
538540 template <typename T>
539541 bool selTrack (T const & track)
540542 {
541- if (!track.isGlobalTrack ())
543+ if (!track.isGlobalTrack ()) {
542544 return false ;
545+ }
543546
544- if (track.pt () < cfgCutPtMin)
547+ if (track.pt () < cfgCutPtMin) {
545548 return false ;
549+ }
546550
547- if (track.pt () >= cfgCutPtMax)
551+ if (track.pt () >= cfgCutPtMax) {
548552 return false ;
553+ }
549554
550- if (track.sign () == 0 )
555+ if (track.sign () == 0 ) {
551556 return false ;
557+ }
552558
553- if (std::fabs (track.dcaZ ()) > cfgCutDcaZ)
559+ if (std::fabs (track.dcaZ ()) > cfgCutDcaZ) {
554560 return false ;
561+ }
555562
556- if (std::fabs (track.dcaZ ()) > (0.0105 + 0.035 / std::pow (track.p (), 1.1 )))
563+ if (std::fabs (track.dcaZ ()) > (0.0105 + 0.035 / std::pow (track.p (), 1.1 ))) {
557564 return false ;
565+ }
558566
559- if (std::abs (track.eta ()) >= cfgCutEta)
567+ if (std::abs (track.eta ()) >= cfgCutEta) {
560568 return false ;
569+ }
561570
562571 return true ;
563572 }
@@ -566,15 +575,11 @@ struct MeanPtFlucId {
566575 template <typename T>
567576 bool rejectTracks (T const & track)
568577 {
569- if (((track.tpcNSigmaEl ()) > -cfgCutNSig3 &&
570- (track.tpcNSigmaEl ()) < cfgCutNSig5) &&
571- (std::fabs (track.tpcNSigmaPi ()) > cfgCutNSig3 &&
572- std::fabs (track.tpcNSigmaKa ()) > cfgCutNSig3 &&
573- std::fabs (track.tpcNSigmaPr ()) > cfgCutNSig3)) {
574- return true ;
575- }
576-
577- return false ;
578+ return (((track.tpcNSigmaEl ()) > -cfgCutNSig3 &&
579+ (track.tpcNSigmaEl ()) < cfgCutNSig5) &&
580+ (std::fabs (track.tpcNSigmaPi ()) > cfgCutNSig3 &&
581+ std::fabs (track.tpcNSigmaKa ()) > cfgCutNSig3 &&
582+ std::fabs (track.tpcNSigmaPr ()) > cfgCutNSig3));
578583 }
579584
580585 // PID cuts for identified particles
@@ -680,7 +685,7 @@ struct MeanPtFlucId {
680685
681686 // Fill Charged particles QA histograms after selection cuts:
682687 template <typename T>
683- void fillChargedQAHistos (T const & track)
688+ void fillChargedQAHistos (T const & track, float centFT0M )
684689 {
685690 hist.fill (HIST (" QA/Charged/h_Eta" ), track.eta ());
686691 hist.fill (HIST (" QA/Charged/h_Phi" ), track.phi ());
@@ -707,26 +712,32 @@ struct MeanPtFlucId {
707712 hist.fill (HIST (" QA/before/h2_pvsm2" ), track.mass () * track.mass (), track.p ());
708713
709714 hist.fill (HIST (" QA/Pion/before/h2_TPCNsigma" ), track.p (), track.tpcNSigmaPi ());
710- if (!track.hasTOF ())
715+ if (!track.hasTOF ()) {
711716 hist.fill (HIST (" QA/Pion/before/h2_TPCNsigma_nottof" ), track.p (), track.tpcNSigmaPi ());
712- if (track.hasTOF ())
717+ }
718+ if (track.hasTOF ()) {
713719 hist.fill (HIST (" QA/Pion/before/h2_TPCNsigma_tof" ), track.p (), track.tpcNSigmaPi ());
720+ }
714721 hist.fill (HIST (" QA/Pion/before/h2_TOFNsigma" ), track.p (), track.tofNSigmaPi ());
715722 hist.fill (HIST (" QA/Pion/before/h2_TpcTofNsigma" ), track.tpcNSigmaPi (), track.tofNSigmaPi ());
716723
717724 hist.fill (HIST (" QA/Kaon/before/h2_TPCNsigma" ), track.p (), track.tpcNSigmaKa ());
718- if (!track.hasTOF ())
725+ if (!track.hasTOF ()) {
719726 hist.fill (HIST (" QA/Kaon/before/h2_TPCNsigma_nottof" ), track.p (), track.tpcNSigmaKa ());
720- if (track.hasTOF ())
727+ }
728+ if (track.hasTOF ()) {
721729 hist.fill (HIST (" QA/Kaon/before/h2_TPCNsigma_tof" ), track.p (), track.tpcNSigmaKa ());
730+ }
722731 hist.fill (HIST (" QA/Kaon/before/h2_TOFNsigma" ), track.p (), track.tofNSigmaKa ());
723732 hist.fill (HIST (" QA/Kaon/before/h2_TpcTofNsigma" ), track.tpcNSigmaKa (), track.tofNSigmaKa ());
724733
725734 hist.fill (HIST (" QA/Proton/before/h2_TPCNsigma" ), track.p (), track.tpcNSigmaPr ());
726- if (!track.hasTOF ())
735+ if (!track.hasTOF ()) {
727736 hist.fill (HIST (" QA/Proton/before/h2_TPCNsigma_nottof" ), track.p (), track.tpcNSigmaPr ());
728- if (track.hasTOF ())
737+ }
738+ if (track.hasTOF ()) {
729739 hist.fill (HIST (" QA/Proton/before/h2_TPCNsigma_tof" ), track.p (), track.tpcNSigmaPr ());
740+ }
730741 hist.fill (HIST (" QA/Proton/before/h2_TOFNsigma" ), track.p (), track.tofNSigmaPr ());
731742 hist.fill (HIST (" QA/Proton/before/h2_TpcTofNsigma" ), track.tpcNSigmaPr (), track.tofNSigmaPr ());
732743 }
@@ -804,10 +815,10 @@ struct MeanPtFlucId {
804815 }
805816 }
806817
807- int getPtBin (double pt, const std::vector<double >& ptB )
818+ int getPtBin (double pt, const std::vector<double >& ptBins )
808819 {
809- for (size_t i = 0 ; i < ptB .size () - 1 ; ++i) {
810- if (pt >= ptB [i] && pt < ptB [i + 1 ]) {
820+ for (std:: size_t i = 0 ; i < ptBins .size () - 1 ; ++i) {
821+ if (pt >= ptBins [i] && pt < ptBins [i + 1 ]) {
811822 return i;
812823 }
813824 }
@@ -816,7 +827,7 @@ struct MeanPtFlucId {
816827
817828 int getEtaBin (double eta)
818829 {
819- for (size_t i = 0 ; i < etaBins->size () - 1 ; ++i) {
830+ for (std:: size_t i = 0 ; i < etaBins->size () - 1 ; ++i) {
820831 if (eta >= etaBins->at (i) && eta < etaBins->at (i + 1 )) {
821832 return i;
822833 }
@@ -838,30 +849,33 @@ struct MeanPtFlucId {
838849 int ipt = getPtBin (trk.pt , ptB);
839850 int ieta = getEtaBin (trk.eta );
840851
841- if (ipt < 0 || ieta < 0 )
852+ if (ipt < 0 || ieta < 0 ) {
842853 continue ;
854+ }
843855
844856 int k = getK (ipt, ieta);
845857
846858 hist.fill (HIST (Dire[Mode]) + HIST (" hN1Matrix" ), centFT0M, k, 1.0 );
847859 hist.fill (HIST (Dire[Mode]) + HIST (" hPt1Matrix" ), centFT0M, k, trk.pt );
848860 }
849861
850- for (size_t i = 0 ; i < tracks.size (); ++i) {
862+ for (std:: size_t i = 0 ; i < tracks.size (); ++i) {
851863 int ipt1 = getPtBin (tracks[i].pt , ptB);
852864 int ieta1 = getEtaBin (tracks[i].eta );
853865
854- if (ipt1 < 0 || ieta1 < 0 )
866+ if (ipt1 < 0 || ieta1 < 0 ) {
855867 continue ;
868+ }
856869
857870 int k1 = getK (ipt1, ieta1);
858871
859- for (size_t j = i + 1 ; j < tracks.size (); ++j) {
872+ for (std:: size_t j = i + 1 ; j < tracks.size (); ++j) {
860873 int ipt2 = getPtBin (tracks[j].pt , ptB);
861874 int ieta2 = getEtaBin (tracks[j].eta );
862875
863- if (ipt2 < 0 || ieta2 < 0 )
876+ if (ipt2 < 0 || ieta2 < 0 ) {
864877 continue ;
878+ }
865879
866880 int k2 = getK (ipt2, ieta2);
867881
@@ -946,10 +960,9 @@ struct MeanPtFlucId {
946960 }
947961
948962 if constexpr (RecoFlag) {
949- // float lower1 = cfgP1L1 * nSim + cfgP0L1;
950- float lower2 = cfgP2L * nSim * nSim + cfgP1L * nSim - cfgP0L;
963+ float lower = cfgP2L * nSim * nSim + cfgP1L * nSim - cfgP0L;
951964 float upper = cfgP2U * nSim * nSim + cfgP1U * nSim + cfgP0U;
952- if (nTPC < lower2 || nTPC > upper) {
965+ if (cfgNtpcEventCut && ( nTPC < lower || nTPC > upper) ) {
953966 return ; // Reject event
954967 }
955968 }
@@ -1020,7 +1033,7 @@ struct MeanPtFlucId {
10201033 hist.fill (HIST (" QA/Charged/h2_Pt_EtaMC" ), etaMC, ptMC);
10211034 hist.fill (HIST (" QA/Charged/h3_Pt_EtaMC_centFT0M" ), etaMC, ptMC, centFT0M);
10221035
1023- fillChargedQAHistos (track);
1036+ fillChargedQAHistos (track, centFT0M );
10241037
10251038 fillBeforePIDQAHistos (track);
10261039
@@ -1099,22 +1112,26 @@ struct MeanPtFlucId {
10991112 pionTracksGen.clear ();
11001113 kaonTracksGen.clear ();
11011114 protonTracksGen.clear ();
1115+
11021116 nSim = 0 ;
11031117 int nChSim = 0 , nPiSim = 0 , nKaSim = 0 , nPrSim = 0 ;
11041118 float pt = 0 ., eta = 0 , phi = 0 ., rap = 0 .;
11051119 double q1Ch = 0 ., q2Ch = 0 ., q1Pi = 0 ., q2Pi = 0 ., q1Ka = 0 ., q2Ka = 0 ., q1Pr = 0 ., q2Pr = 0 .;
1120+
11061121 for (auto const & mcPart : mcParticles) {
11071122 if (!mcPart.isPhysicalPrimary ()) {
11081123 continue ;
11091124 }
11101125
11111126 auto * particle = pdg->GetParticle (mcPart.pdgCode ());
11121127
1113- if (!particle)
1128+ if (!particle) {
11141129 continue ;
1130+ }
11151131
1116- if (particle->Charge () == 0 )
1132+ if (particle->Charge () == 0 ) {
11171133 continue ;
1134+ }
11181135
11191136 pt = mcPart.pt ();
11201137 eta = mcPart.eta ();
0 commit comments