Skip to content

Commit 16c422e

Browse files
victor-gonzalezVictor
andauthored
[PWGCF] DptDpt - Improving QC data layout for HL execution (#10526)
Co-authored-by: Victor <victor@cern.ch>
1 parent 8a94005 commit 16c422e

File tree

1 file changed

+45
-43
lines changed

1 file changed

+45
-43
lines changed

PWGCF/TwoParticleCorrelations/Tasks/dptDptEfficiencyAndQc.cxx

Lines changed: 45 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include <TH2F.h>
1717
#include <TProfile2D.h>
18+
#include <THnSparse.h>
1819
#include <TPDGCode.h>
1920
#include <CCDB/BasicCCDBManager.h>
2021
#include <vector>
@@ -93,6 +94,9 @@ float maxNSigma = 4.05f;
9394
float widthNSigmaBin = 0.1f;
9495
int noOfNSigmaBins = static_cast<int>((maxNSigma - minNSigma) / widthNSigmaBin);
9596

97+
/* the pT bins of interest for the relative separation within TPC sectors data collection */
98+
std::vector<int> ptBinsOfInterest{1, 2, 3};
99+
96100
/* the PID selector object to help with the configuration and the id of the selected particles */
97101
o2::analysis::dptdptfilter::PIDSpeciesSelection pidselector;
98102

@@ -584,9 +588,8 @@ struct QAExtraDataCollectingEngine {
584588
std::vector<std::vector<std::vector<std::shared_ptr<TH2>>>> fhPhiPhiA{2, {nsp, {nsp, nullptr}}};
585589
std::vector<std::vector<std::vector<std::shared_ptr<TH2>>>> fhEtaEtaA{2, {nsp, {nsp, nullptr}}};
586590
TAxis ptAxis{analysis::dptdptfilter::ptbins, analysis::dptdptfilter::ptlow, analysis::dptdptfilter::ptup};
587-
Configurable<std::vector<int>> cfgPtBinsOfInterest{"cfgPtBinsOfInterest", {1, 2, 3}, "The pt bins of interest"};
588-
std::vector<std::vector<std::vector<std::vector<std::vector<std::shared_ptr<TH3>>>>>> fhInSectorDeltaPhiVsPhiPhiPerPtBinA{2, {nsp, {nsp, {cfgPtBinsOfInterest->size(), {cfgPtBinsOfInterest->size(), nullptr}}}}};
589-
std::vector<std::vector<std::vector<std::vector<std::vector<std::shared_ptr<TH3>>>>>> fhInSectorDeltaPhiVsEtaEtaPerPtBinA{2, {nsp, {nsp, {cfgPtBinsOfInterest->size(), {cfgPtBinsOfInterest->size(), nullptr}}}}};
591+
std::vector<std::vector<std::vector<std::shared_ptr<THnSparse>>>> fhInSectorDeltaPhiVsPhiPhiPerPtBinA{2, {nsp, {nsp, nullptr}}};
592+
std::vector<std::vector<std::vector<std::shared_ptr<THnSparse>>>> fhInSectorDeltaPhiVsEtaEtaPerPtBinA{2, {nsp, {nsp, nullptr}}};
590593

591594
template <efficiencyandqatask::KindOfData kindOfData>
592595
void init(HistogramRegistry& registry, const char* dirname)
@@ -595,10 +598,11 @@ struct QAExtraDataCollectingEngine {
595598
using namespace analysis::dptdptfilter;
596599

597600
AxisSpec phiAxis = {phibins, 0.0f, constants::math::TwoPI, "#varphi"};
598-
AxisSpec phiSectorAxis = {144, 0.0f, kTpcPhiSectorWidth, "#varphi (mod(2#pi/18)) (rad)"};
601+
AxisSpec phiSectorAxis = {72, 0.0f, kTpcPhiSectorWidth, "#varphi (mod(2#pi/18)) (rad)"};
599602
AxisSpec deltaPhiAxis = {phibins, 0.0f, constants::math::TwoPI, "#Delta#varphi (rad)"};
600-
AxisSpec deltaPhiInSectorAxis = {288, -kTpcPhiSectorWidth, kTpcPhiSectorWidth, "#Delta#varphi (rad)"};
603+
AxisSpec deltaPhiInSectorAxis = {144, -kTpcPhiSectorWidth, kTpcPhiSectorWidth, "#Delta#varphi (rad)"};
601604
AxisSpec etaAxis = {etabins, etalow, etaup, "#eta"};
605+
AxisSpec ptOfInterestAxis = {static_cast<int>(ptBinsOfInterest.size()), 0.5f, static_cast<float>(ptBinsOfInterest.size()) + 0.5f, "#it{p}_{T} (GeV/#it{c})"};
602606

603607
/* the reconstructed and generated levels histograms */
604608
std::string recogen = (kindOfData == kReco) ? "Reco" : "Gen";
@@ -609,17 +613,11 @@ struct QAExtraDataCollectingEngine {
609613
fhEtaEtaA[kindOfData][isp][jsp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, recogen.c_str(), "After"), HNAMESTRING("EtaEta_%s%s", tnames[isp].c_str(), tnames[jsp].c_str()),
610614
HTITLESTRING("%s%s pairs", tnames[isp].c_str(), tnames[jsp].c_str()), kTH2F, {etaAxis, etaAxis});
611615
/* first resize them to the actual configured size */
612-
fhInSectorDeltaPhiVsPhiPhiPerPtBinA[kindOfData][isp][jsp].resize(cfgPtBinsOfInterest->size());
613-
for (uint ipt = 0; ipt < cfgPtBinsOfInterest->size(); ++ipt) {
614-
/* first resize them to the actual configured size */
615-
fhInSectorDeltaPhiVsPhiPhiPerPtBinA[kindOfData][isp][jsp][ipt].resize(cfgPtBinsOfInterest->size(), nullptr);
616-
for (uint jpt = 0; jpt < cfgPtBinsOfInterest->size(); ++jpt) {
617-
fhInSectorDeltaPhiVsPhiPhiPerPtBinA[kindOfData][isp][jsp][ipt][jpt] = ADDHISTOGRAM(TH3, DIRECTORYSTRING("%s/%s/%s", dirname, recogen.c_str(), "After"), HNAMESTRING("DeltaPhiVsPhiPhiPt%02d%02d_%s%s", ipt, jpt, tnames[isp].c_str(), tnames[jsp].c_str()),
618-
HTITLESTRING("%s%s pairs", tnames[isp].c_str(), tnames[jsp].c_str()), kTH3F, {phiSectorAxis, phiSectorAxis, deltaPhiInSectorAxis});
619-
fhInSectorDeltaPhiVsEtaEtaPerPtBinA[kindOfData][isp][jsp][ipt][jpt] = ADDHISTOGRAM(TH3, DIRECTORYSTRING("%s/%s/%s", dirname, recogen.c_str(), "After"), HNAMESTRING("DeltaPhiVsEtaEtaPt%02d%02d_%s%s", ipt, jpt, tnames[isp].c_str(), tnames[jsp].c_str()),
620-
HTITLESTRING("%s%s pairs", tnames[isp].c_str(), tnames[jsp].c_str()), kTH3F, {etaAxis, etaAxis, deltaPhiInSectorAxis});
621-
}
622-
}
616+
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});
623621
}
624622
}
625623
}
@@ -632,39 +630,39 @@ struct QAExtraDataCollectingEngine {
632630

633631
/* we should only receive accepted tracks */
634632
for (auto const& track1 : tracks1) {
635-
auto indexForPt = [&](auto const& track) {
633+
auto binForPt = [&](auto const& track) {
636634
int ptBin = ptAxis.FindFixBin(track.pt());
637-
if (std::find(cfgPtBinsOfInterest->begin(), cfgPtBinsOfInterest->end(), ptBin) != cfgPtBinsOfInterest->end()) {
635+
if (std::find(ptBinsOfInterest.begin(), ptBinsOfInterest.end(), ptBin) != ptBinsOfInterest.end()) {
638636
/* of interest */
639-
return ptBin - 1;
637+
return ptBin;
640638
} else {
641639
return -1;
642640
}
643641
};
644-
int ptBinIx1 = indexForPt(track1);
645-
if (ptBinIx1 < 0) {
646-
continue;
647-
}
648-
float inTpcSectorPhi1 = std::fmod(track1.phi(), kTpcPhiSectorWidth);
649-
for (auto const& track2 : tracks2) {
650-
/* checking the same track id condition */
651-
if (track1 == track2) {
652-
/* exclude autocorrelations */
653-
continue;
654-
}
655-
int ptBinIx2 = indexForPt(track2);
656-
if (ptBinIx2 < 0) {
657-
continue;
658-
}
659-
fhPhiPhiA[kindOfData][track1.trackacceptedid()][track2.trackacceptedid()]->Fill(track1.phi(), track2.phi());
660-
fhEtaEtaA[kindOfData][track1.trackacceptedid()][track2.trackacceptedid()]->Fill(track1.eta(), track2.eta());
661-
if (static_cast<int>(track1.phi() / kTpcPhiSectorWidth) == static_cast<int>(track2.phi() / kTpcPhiSectorWidth)) {
662-
/* only if, for sure, both tracks are within the same sector */
663-
float inTpcSectorPhi2 = std::fmod(track2.phi(), kTpcPhiSectorWidth);
664-
float deltaPhi = inTpcSectorPhi1 - inTpcSectorPhi2;
665-
666-
fhInSectorDeltaPhiVsPhiPhiPerPtBinA[kindOfData][track1.trackacceptedid()][track2.trackacceptedid()][ptBinIx1][ptBinIx2]->Fill(track1.phi(), track2.phi(), deltaPhi);
667-
fhInSectorDeltaPhiVsEtaEtaPerPtBinA[kindOfData][track1.trackacceptedid()][track2.trackacceptedid()][ptBinIx1][ptBinIx2]->Fill(track1.eta(), track2.eta(), deltaPhi);
642+
int ptBin1 = binForPt(track1);
643+
if (ptBin1 > 0) {
644+
float inTpcSectorPhi1 = std::fmod(track1.phi(), kTpcPhiSectorWidth);
645+
for (auto const& track2 : tracks2) {
646+
/* checking the same track id condition */
647+
if (track1 == track2) {
648+
/* exclude autocorrelations */
649+
continue;
650+
}
651+
int ptBin2 = binForPt(track2);
652+
if (ptBin2 > 0) {
653+
fhPhiPhiA[kindOfData][track1.trackacceptedid()][track2.trackacceptedid()]->Fill(track1.phi(), track2.phi());
654+
fhEtaEtaA[kindOfData][track1.trackacceptedid()][track2.trackacceptedid()]->Fill(track1.eta(), track2.eta());
655+
if (static_cast<int>(track1.phi() / kTpcPhiSectorWidth) == static_cast<int>(track2.phi() / kTpcPhiSectorWidth)) {
656+
/* only if, for sure, both tracks are within the same sector */
657+
float inTpcSectorPhi2 = std::fmod(track2.phi(), kTpcPhiSectorWidth);
658+
float deltaPhi = inTpcSectorPhi1 - inTpcSectorPhi2;
659+
double values[] = {inTpcSectorPhi1, inTpcSectorPhi2, deltaPhi, static_cast<float>(ptBin1), static_cast<float>(ptBin2)};
660+
661+
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);
664+
}
665+
}
668666
}
669667
}
670668
}
@@ -999,6 +997,7 @@ struct DptDptEfficiencyAndQc {
999997
Configurable<float> cfgMinNSigma{"cfgMinNSigma", -4.05f, "nsigma axes lowest value. Default: -4.05"};
1000998
Configurable<float> cfgMaxNSigma{"cfgMaxNSigma", 4.05f, "nsigma axes highest value. Default: 4.05"};
1001999
Configurable<float> cfgWidthNSigmaBin{"cfgWidthNSigmaBin", 0.1, "nsigma axes bin width. Deafault: 0.1"};
1000+
Configurable<std::vector<int>> cfgPtBinsOfInterest{"cfgPtBinsOfInterest", {1, 2, 3}, "The pt bins of interest"};
10021001

10031002
void init(o2::framework::InitContext& initContext)
10041003
{
@@ -1100,6 +1099,9 @@ struct DptDptEfficiencyAndQc {
11001099
widthNSigmaBin = cfgWidthNSigmaBin.value;
11011100
noOfNSigmaBins = static_cast<int>((maxNSigma - minNSigma) / widthNSigmaBin);
11021101

1102+
/* configure the pT bins of interest */
1103+
ptBinsOfInterest = cfgPtBinsOfInterest.value;
1104+
11031105
bool doBasicAnalysis = doprocessDetectorLevelNotStored || doprocessReconstructedNotStored || doprocessGeneratorLevelNotStored;
11041106
bool doExtraAnalysis = doprocessExtraDetectorLevelNotStored || doprocessExtraReconstructedNotStored || doprocessExtraGeneratorLevelNotStored;
11051107
bool doPidAnalysis = doprocessDetectorLevelNotStoredPID || doprocessDetectorLevelNotStoredTunedOnDataPID || doprocessReconstructedNotStoredPID;

0 commit comments

Comments
 (0)