@@ -589,14 +589,32 @@ struct QAExtraDataCollectingEngine {
589589 // The QA output objects
590590 // ===================================================
591591 /* pairs histograms */
592+ constexpr static size_t kNoOfOverflowBins = 2 ;
593+ constexpr static int kBinNotTracked = -1 ;
592594 std::vector<std::vector<std::vector<std::shared_ptr<TH2>>>> fhPhiPhiA{2 , {nsp, {nsp, nullptr }}};
593595 std::vector<std::vector<std::vector<std::shared_ptr<TH2>>>> fhEtaEtaA{2 , {nsp, {nsp, nullptr }}};
594596 std::vector<std::vector<std::vector<std::shared_ptr<TH2>>>> fhN2VsDeltaEtaVsDeltaPhi{2 , {nsp, {nsp, nullptr }}};
595597 TAxis ptAxis{analysis::dptdptfilter::ptbins, analysis::dptdptfilter::ptlow, analysis::dptdptfilter::ptup};
596- std::vector<int > ptOfInterestBinMap{analysis::dptdptfilter::ptbins + 1 , - 1 } ;
598+ std::vector<int > ptOfInterestBinMap;
597599 std::vector<std::vector<std::vector<std::shared_ptr<THnSparse>>>> fhInSectorDeltaPhiVsPhiPhiPerPtBinA{2 , {nsp, {nsp, nullptr }}};
598600 std::vector<std::vector<std::vector<std::shared_ptr<THnSparse>>>> fhInSectorDeltaPhiVsEtaEtaPerPtBinA{2 , {nsp, {nsp, nullptr }}};
599601
602+ QAExtraDataCollectingEngine ()
603+ {
604+ using namespace efficiencyandqatask ;
605+ using namespace analysis ::dptdptfilter;
606+
607+ /* the mapping between pT bins of interest and internal representation, and histogram title to keep track of them offline */
608+ /* it is done once for both reco and gen */
609+ ptOfInterestBinMap = std::vector (static_cast <size_t >(ptbins + kNoOfOverflowBins ), kBinNotTracked );
610+ LOGF (info, " Configuring the pT bins of interest on a map of length %d" , ptOfInterestBinMap.size ());
611+ for (size_t ix = 0 ; ix < ptBinsOfInterest.size (); ++ix) {
612+ /* remember our internal axis starts in 0.5 value, i.e. its first central value is 1 */
613+ ptOfInterestBinMap[ptBinsOfInterest[ix]] = ix + 1 ;
614+ LOGF (info, " Added pT bin %d as internal axis value %d" , ptBinsOfInterest[ix], ptOfInterestBinMap[ptBinsOfInterest[ix]]);
615+ }
616+ }
617+
600618 template <efficiencyandqatask::KindOfData kindOfData>
601619 void init (HistogramRegistry& registry, const char * dirname)
602620 {
@@ -611,20 +629,23 @@ struct QAExtraDataCollectingEngine {
611629 AxisSpec etaAxis = {etabins, etalow, etaup, " #eta" };
612630 AxisSpec ptOfInterestAxis = {static_cast <int >(ptBinsOfInterest.size ()), 0 .5f , static_cast <float >(ptBinsOfInterest.size ()) + 0 .5f , " #it{p}_{T} (GeV/#it{c})" };
613631
632+ /* the reconstructed and generated levels histograms */
633+ std::string recogen = (kindOfData == kReco ) ? " Reco" : " Gen" ;
634+
614635 /* the mapping between pT bins of interest and internal representation, and histogram title to keep track of them offline */
615- LOGF (info, " Configuring the pT bins of interest" );
636+ LOGF (info, " Configured at %s level the pT bins of interest on a map of length %d " , recogen. c_str (), ptOfInterestBinMap. size () );
616637 std::string hPtRangesOfInterestTitle;
617- for (size_t ix = 0 ; ix < ptBinsOfInterest.size (); ++ix) {
618- TString ptRange = TString::Format (" %s%.2f-%.2f" , ix == 0 ? " " : " ," , ptAxis.GetBinLowEdge (ptBinsOfInterest[ix]), ptAxis.GetBinUpEdge (ptBinsOfInterest[ix]));
619- /* remember our internal axis starts in 0.5 value, i.e. its first central value is 1 */
620- ptOfInterestBinMap[ptBinsOfInterest[ix]] = ix + 1 ;
621- hPtRangesOfInterestTitle += ptRange.Data ();
622- LOGF (info, " Added pT bin %d as internal axis value %d" , ptBinsOfInterest[ix], ix + 1 );
638+ bool firstRange = true ;
639+ for (size_t ix = 0 ; ix < ptOfInterestBinMap.size (); ++ix) {
640+ if (ptOfInterestBinMap[ix] != kBinNotTracked ) {
641+ TString ptRange = TString::Format (" %s%.2f-%.2f" , firstRange ? " " : " ," , ptAxis.GetBinLowEdge (ix), ptAxis.GetBinUpEdge (ix));
642+ hPtRangesOfInterestTitle += ptRange.Data ();
643+ LOGF (info, " Tracking pT bin %d as internal axis value %d" , ix, ptOfInterestBinMap[ix]);
644+ firstRange = false ;
645+ }
623646 }
624647 LOGF (info, " Final pT bins tilte: %s" , hPtRangesOfInterestTitle.c_str ());
625648
626- /* the reconstructed and generated levels histograms */
627- std::string recogen = (kindOfData == kReco ) ? " Reco" : " Gen" ;
628649 for (uint isp = 0 ; isp < nsp; ++isp) {
629650 for (uint jsp = 0 ; jsp < nsp; ++jsp) {
630651 fhPhiPhiA[kindOfData][isp][jsp] = ADDHISTOGRAM (TH2, DIRECTORYSTRING (" %s/%s/%s" , dirname, recogen.c_str (), " After" ), HNAMESTRING (" PhiPhi_%s%s" , tnames[isp].c_str (), tnames[jsp].c_str ()),
@@ -656,7 +677,7 @@ struct QAExtraDataCollectingEngine {
656677 return ptOfInterestBinMap[ptAxis.FindFixBin (track.pt ())];
657678 };
658679 int ptBin1 = binForPt (track1);
659- if (ptBin1 > 0 ) {
680+ if (ptBin1 != kBinNotTracked ) {
660681 float inTpcSectorPhi1 = std::fmod (track1.phi (), kTpcPhiSectorWidth );
661682 for (auto const & track2 : tracks2) {
662683 /* checking the same track id condition */
@@ -665,7 +686,7 @@ struct QAExtraDataCollectingEngine {
665686 continue ;
666687 }
667688 int ptBin2 = binForPt (track2);
668- if (ptBin2 > 0 ) {
689+ if (ptBin2 != kBinNotTracked ) {
669690 float deltaPhi = RecoDecay::constrainAngle (track1.phi () - track2.phi ());
670691 float deltaEta = track1.eta () - track2.eta ();
671692 float preWeight = 1 - std::abs (deltaEta) / deltaEtaSpan;
@@ -862,6 +883,7 @@ struct PidExtraDataCollectingEngine {
862883 const AxisSpec dEdxAxis{200 , 0.0 , 200.0 , " dE/dx (au)" };
863884 AxisSpec pidPAxis{150 , 0.1 , 5.0 , " #it{p} (GeV/#it{c})" };
864885 pidPAxis.makeLogarithmic ();
886+ constexpr int kEvenOddBase = 2 ;
865887
866888 if constexpr (kindOfData == kReco ) {
867889 /* PID histograms */
@@ -884,7 +906,7 @@ struct PidExtraDataCollectingEngine {
884906 kTProfile2D , {pidPAxis, {200 , 0.0 , 1.1 , " #beta" }});
885907 for (uint imainsp = 0 ; imainsp < nallmainsp; ++imainsp) {
886908 /* only the same charge makes any sense */
887- if (isp % 2 == imainsp % 2 ) {
909+ if (isp % kEvenOddBase == imainsp % kEvenOddBase ) {
888910 fhIdTPCnSigmasVsP[isp][imainsp] = ADDHISTOGRAM (TH2, DIRECTORYSTRING (" %s/%s/%s" , dirname, " PID" , " Selected" ),
889911 HNAMESTRING (" tpcNSigmasVsPSelected_%s_to%s" , tnames[isp].c_str (), allmainspnames[imainsp].c_str ()),
890912 HTITLESTRING (" TPC n#sigma for selected %s to the %s line" , tnames[isp].c_str (), allmainsptitles[imainsp].c_str ()),
@@ -1152,32 +1174,38 @@ struct DptDptEfficiencyAndQc {
11521174 }
11531175 /* in reverse order for proper order in results file */
11541176 for (uint i = 0 ; i < ncmranges; ++i) {
1155- auto initializeCEInstance = [&](auto dce, auto name, auto & registry, bool genlevel) {
1177+ auto initializeCEInstance = [&](auto dce, auto name, auto & registry, bool reclevel, bool genlevel) {
11561178 /* crete the output list for the passed centrality/multiplicity range */
11571179 /* init the data collection instance */
1158- dce->template init <kReco >(registry, name.Data ());
1180+ if (reclevel) {
1181+ dce->template init <kReco >(registry, name.Data ());
1182+ }
11591183 if (genlevel) {
11601184 dce->template init <kGen >(registry, name.Data ());
11611185 }
11621186 };
11631187 auto buildQACEInstance = [&](float min, float max) {
11641188 auto * dce = new QADataCollectingEngine ();
1165- initializeCEInstance (dce, TString::Format (" EfficiencyAndQaData-%d-%d" , static_cast <int >(min), static_cast <int >(max)), *registryBank[i], doprocessGeneratorLevelNotStored);
1189+ initializeCEInstance (dce, TString::Format (" EfficiencyAndQaData-%d-%d" , static_cast <int >(min), static_cast <int >(max)), *registryBank[i],
1190+ doprocessReconstructedNotStored || doprocessDetectorLevelNotStored, doprocessGeneratorLevelNotStored);
11661191 return dce;
11671192 };
11681193 auto buildQACEExtraInstance = [&](float min, float max) {
11691194 auto * dce = new QAExtraDataCollectingEngine ();
1170- initializeCEInstance (dce, TString::Format (" EfficiencyAndQaExtraData-%d-%d" , static_cast <int >(min), static_cast <int >(max)), *extraRegistryBank[i], doprocessExtraGeneratorLevelNotStored);
1195+ initializeCEInstance (dce, TString::Format (" EfficiencyAndQaExtraData-%d-%d" , static_cast <int >(min), static_cast <int >(max)), *extraRegistryBank[i],
1196+ doprocessExtraReconstructedNotStored || doprocessExtraDetectorLevelNotStored, doprocessExtraGeneratorLevelNotStored);
11711197 return dce;
11721198 };
11731199 auto buildPidCEInstance = [&](float min, float max) {
11741200 auto * dce = new PidDataCollectingEngine ();
1175- initializeCEInstance (dce, TString::Format (" EfficiencyAndPidData-%d-%d" , static_cast <int >(min), static_cast <int >(max)), *pidRegistryBank[i], doprocessGeneratorLevelNotStored);
1201+ initializeCEInstance (dce, TString::Format (" EfficiencyAndPidData-%d-%d" , static_cast <int >(min), static_cast <int >(max)), *pidRegistryBank[i],
1202+ doprocessReconstructedNotStoredPID || doprocessDetectorLevelNotStoredPID || doprocessDetectorLevelNotStoredTunedOnDataPID, doprocessGeneratorLevelNotStored);
11761203 return dce;
11771204 };
11781205 auto buildPidExtraCEInstance = [&](float min, float max) {
11791206 auto * dce = new PidExtraDataCollectingEngine ();
1180- initializeCEInstance (dce, TString::Format (" EfficiencyAndPidData-%d-%d" , static_cast <int >(min), static_cast <int >(max)), *pidRegistryBank[i], doprocessGeneratorLevelNotStored);
1207+ initializeCEInstance (dce, TString::Format (" EfficiencyAndPidData-%d-%d" , static_cast <int >(min), static_cast <int >(max)), *pidRegistryBank[i],
1208+ doprocessReconstructedNotStoredPIDExtra || doprocessDetectorLevelNotStoredPIDExtra || doprocessDetectorLevelNotStoredTunedOnDataPIDExtra, doprocessGeneratorLevelNotStored);
11811209 return dce;
11821210 };
11831211 /* in reverse order for proper order in results file */
0 commit comments