Skip to content

Commit 472afe5

Browse files
victor-gonzalezVictor
andauthored
[PWGCF] DptDpt - Efficient access to the pT ranges of interest (#10544)
Co-authored-by: Victor <victor@cern.ch>
1 parent cb92fd5 commit 472afe5

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

PWGCF/TwoParticleCorrelations/Tasks/dptDptEfficiencyAndQc.cxx

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,7 @@ struct QAExtraDataCollectingEngine {
588588
std::vector<std::vector<std::vector<std::shared_ptr<TH2>>>> fhPhiPhiA{2, {nsp, {nsp, nullptr}}};
589589
std::vector<std::vector<std::vector<std::shared_ptr<TH2>>>> fhEtaEtaA{2, {nsp, {nsp, nullptr}}};
590590
TAxis ptAxis{analysis::dptdptfilter::ptbins, analysis::dptdptfilter::ptlow, analysis::dptdptfilter::ptup};
591+
std::vector<int> ptOfInterestBinMap{analysis::dptdptfilter::ptbins + 1, -1};
591592
std::vector<std::vector<std::vector<std::shared_ptr<THnSparse>>>> fhInSectorDeltaPhiVsPhiPhiPerPtBinA{2, {nsp, {nsp, nullptr}}};
592593
std::vector<std::vector<std::vector<std::shared_ptr<THnSparse>>>> fhInSectorDeltaPhiVsEtaEtaPerPtBinA{2, {nsp, {nsp, nullptr}}};
593594

@@ -604,6 +605,15 @@ struct QAExtraDataCollectingEngine {
604605
AxisSpec etaAxis = {etabins, etalow, etaup, "#eta"};
605606
AxisSpec ptOfInterestAxis = {static_cast<int>(ptBinsOfInterest.size()), 0.5f, static_cast<float>(ptBinsOfInterest.size()) + 0.5f, "#it{p}_{T} (GeV/#it{c})"};
606607

608+
/* the mapping between pT bins of interest and internal representation, and histogram title to keep track of them offline */
609+
std::string hPtRangesOfInterestTitle;
610+
for (size_t ix = 0; ix < ptBinsOfInterest.size(); ++ix) {
611+
TString ptRange = TString::Format("%s%.2f-%.2f", ix == 0 ? "" : ",", ptAxis.GetBinLowEdge(ptBinsOfInterest[ix]), ptAxis.GetBinUpEdge(ptBinsOfInterest[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+
hPtRangesOfInterestTitle += ptRange.Data();
615+
}
616+
607617
/* the reconstructed and generated levels histograms */
608618
std::string recogen = (kindOfData == kReco) ? "Reco" : "Gen";
609619
for (uint isp = 0; isp < nsp; ++isp) {
@@ -614,10 +624,11 @@ struct QAExtraDataCollectingEngine {
614624
HTITLESTRING("%s%s pairs", tnames[isp].c_str(), tnames[jsp].c_str()), kTH2F, {etaAxis, etaAxis});
615625
/* first resize them to the actual configured size */
616626
fhInSectorDeltaPhiVsPhiPhiPerPtBinA[kindOfData][isp][jsp] = ADDHISTOGRAM(THnSparse, DIRECTORYSTRING("%s/%s/%s", dirname, recogen.c_str(), "After"), HNAMESTRING("DeltaPhiVsPhiPhiPt_%s%s", tnames[isp].c_str(), tnames[jsp].c_str()),
617-
HTITLESTRING("%s%s pairs", tnames[isp].c_str(), tnames[jsp].c_str()), kTHnSparseF, {phiSectorAxis, phiSectorAxis, deltaPhiInSectorAxis, ptOfInterestAxis, ptOfInterestAxis});
618-
// TODO: after checking the consumed execution memory
619-
// fhInSectorDeltaPhiVsEtaEtaPerPtBinA[kindOfData][isp][jsp] = ADDHISTOGRAM(THnSparse, DIRECTORYSTRING("%s/%s/%s", dirname, recogen.c_str(), "After"), HNAMESTRING("DeltaPhiVsEtaEtaPt_%s%s", tnames[isp].c_str(), tnames[jsp].c_str()),
620-
// HTITLESTRING("%s%s pairs", tnames[isp].c_str(), tnames[jsp].c_str()), kTHnSparseF, {etaAxis, etaAxis, deltaPhiInSectorAxis, ptOfInterestAxis, ptOfInterestAxis});
627+
HTITLESTRING("%s%s pairs, #it{p}_{T}: %s", tnames[isp].c_str(), tnames[jsp].c_str(), hPtRangesOfInterestTitle.c_str()),
628+
kTHnSparseF, {phiSectorAxis, phiSectorAxis, deltaPhiInSectorAxis, ptOfInterestAxis, ptOfInterestAxis});
629+
fhInSectorDeltaPhiVsEtaEtaPerPtBinA[kindOfData][isp][jsp] = ADDHISTOGRAM(THnSparse, DIRECTORYSTRING("%s/%s/%s", dirname, recogen.c_str(), "After"), HNAMESTRING("DeltaPhiVsEtaEtaPt_%s%s", tnames[isp].c_str(), tnames[jsp].c_str()),
630+
HTITLESTRING("%s%s pairs, #it{p}_{T}: %s", tnames[isp].c_str(), tnames[jsp].c_str(), hPtRangesOfInterestTitle.c_str()),
631+
kTHnSparseF, {etaAxis, etaAxis, deltaPhiInSectorAxis, ptOfInterestAxis, ptOfInterestAxis});
621632
}
622633
}
623634
}
@@ -631,13 +642,7 @@ struct QAExtraDataCollectingEngine {
631642
/* we should only receive accepted tracks */
632643
for (auto const& track1 : tracks1) {
633644
auto binForPt = [&](auto const& track) {
634-
int ptBin = ptAxis.FindFixBin(track.pt());
635-
if (std::find(ptBinsOfInterest.begin(), ptBinsOfInterest.end(), ptBin) != ptBinsOfInterest.end()) {
636-
/* of interest */
637-
return ptBin;
638-
} else {
639-
return -1;
640-
}
645+
return ptOfInterestBinMap[ptAxis.FindFixBin(track.pt())];
641646
};
642647
int ptBin1 = binForPt(track1);
643648
if (ptBin1 > 0) {
@@ -657,10 +662,9 @@ struct QAExtraDataCollectingEngine {
657662
float inTpcSectorPhi2 = std::fmod(track2.phi(), kTpcPhiSectorWidth);
658663
float deltaPhi = inTpcSectorPhi1 - inTpcSectorPhi2;
659664
double values[] = {inTpcSectorPhi1, inTpcSectorPhi2, deltaPhi, static_cast<float>(ptBin1), static_cast<float>(ptBin2)};
660-
661665
fhInSectorDeltaPhiVsPhiPhiPerPtBinA[kindOfData][track1.trackacceptedid()][track2.trackacceptedid()]->Fill(values);
662-
// TODO: after checking the consumed execution memory
663-
// fhInSectorDeltaPhiVsEtaEtaPerPtBinA[kindOfData][track1.trackacceptedid()][track2.trackacceptedid()]->Fill(track1.eta(), track2.eta(), deltaPhi);
666+
values[0] = track1.eta(), values[1] = track2.eta();
667+
fhInSectorDeltaPhiVsEtaEtaPerPtBinA[kindOfData][track1.trackacceptedid()][track2.trackacceptedid()]->Fill(values);
664668
}
665669
}
666670
}
@@ -1014,6 +1018,7 @@ struct DptDptEfficiencyAndQc {
10141018
!doprocessGeneratorLevelNotStored &&
10151019
!doprocessExtraGeneratorLevelNotStored &&
10161020
!doprocessReconstructedNotStored &&
1021+
!doprocessExtraReconstructedNotStored &&
10171022
!doprocessReconstructedNotStoredPID &&
10181023
!doprocessReconstructedNotStoredPIDExtra) {
10191024
return;

0 commit comments

Comments
 (0)