Skip to content

Commit 1fe8ae7

Browse files
victor-gonzalezVictor
andauthored
[PWGCF] DptDpt - NUA&NUE corrections with configurable dimensions (#8758)
Co-authored-by: Victor <victor@cern.ch>
1 parent f4b2efd commit 1fe8ae7

File tree

1 file changed

+37
-18
lines changed

1 file changed

+37
-18
lines changed

PWGCF/Tasks/dptdptcorrelations.cxx

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ struct DptDptCorrelationsTask {
100100
std::vector<TH2F*> fhSum1Pt_vsEtaPhi{nch, nullptr}; //!<! accumulated sum of weighted \f$p_T\f$ vs \f$\eta,\;\phi\f$, for the different species
101101
std::vector<TH3F*> fhN1_vsZEtaPhiPt{nch, nullptr}; //!<! single particle distribution vs \f$\mbox{vtx}_z,\; \eta,\;\phi,\;p_T\f$, for the different species
102102
std::vector<TH3F*> fhSum1Pt_vsZEtaPhiPt{nch, nullptr}; //!<! accumulated sum of weighted \f$p_T\f$ vs \f$\mbox{vtx}_z,\; \eta,\;\phi,\;p_T\f$, for the different species
103-
std::vector<TH3*> fhNuaNue_vsZEtaPhiPt{nch, nullptr}; //!<! NUA+NUE correction vs \f$\mbox{vtx}_z,\; \eta,\;\phi,\;p_T\f$, for the differents species
103+
std::vector<TH1*> fhNuaNue{nch, nullptr}; //!<! NUA+NUE correction for the differents species
104104
std::vector<TH2*> fhPtAvg_vsEtaPhi{nch, nullptr}; //!<! average \f$p_T\f$ vs \f$\eta,\;\phi\f$, for the different species
105105
std::vector<std::vector<TH2F*>> fhN2_vsPtPt{nch, {nch, nullptr}}; //!<! weighted two particle distribution vs \f${p_T}_1, {p_T}_2\f$ for the different species combinations
106106
std::vector<std::vector<TH2F*>> fhN2_vsDEtaDPhi{nch, {nch, nullptr}}; //!<! two-particle distribution vs \f$\Delta\eta,\;\Delta\phi\f$ for the different species combinations
@@ -293,20 +293,32 @@ struct DptDptCorrelationsTask {
293293
return mass2;
294294
}
295295

296-
void storeTrackCorrections(std::vector<TH3*> corrs)
296+
void storeTrackCorrections(std::vector<TH1*> corrs)
297297
{
298298
LOGF(info, "Stored NUA&NUE corrections for %d track ids", corrs.size());
299299
for (uint i = 0; i < corrs.size(); ++i) {
300-
LOGF(info, " Stored NUA&NUE corrections %s for track id %d %s", corrs[i] != nullptr ? corrs[i]->GetName() : "nullptr", i, corrs[i] != nullptr ? "yes" : "no");
301-
fhNuaNue_vsZEtaPhiPt[i] = corrs[i];
302-
if (fhNuaNue_vsZEtaPhiPt[i] != nullptr) {
300+
int nDimensions = corrs[i] != nullptr ? corrs[i]->GetDimension() : 0;
301+
LOGF(info, " Stored NUA&NUE corrections %s for track id %d with %d dimensions %s",
302+
corrs[i] != nullptr ? corrs[i]->GetName() : "nullptr", i, nDimensions, corrs[i] != nullptr ? "yes" : "no");
303+
fhNuaNue[i] = corrs[i];
304+
if (fhNuaNue[i] != nullptr) {
303305
int nbins = 0;
304306
double avg = 0.0;
305-
for (int ix = 0; ix < fhNuaNue_vsZEtaPhiPt[i]->GetNbinsX(); ++ix) {
306-
for (int iy = 0; iy < fhNuaNue_vsZEtaPhiPt[i]->GetNbinsY(); ++iy) {
307-
for (int iz = 0; iz < fhNuaNue_vsZEtaPhiPt[i]->GetNbinsZ(); ++iz) {
308-
nbins++;
309-
avg += fhNuaNue_vsZEtaPhiPt[i]->GetBinContent(ix + 1, iy + 1, iz + 1);
307+
for (int ix = 0; ix < fhNuaNue[i]->GetNbinsX(); ++ix) {
308+
if (nDimensions == 1) {
309+
nbins++;
310+
avg += fhNuaNue[i]->GetBinContent(ix + 1);
311+
} else {
312+
for (int iy = 0; iy < fhNuaNue[i]->GetNbinsY(); ++iy) {
313+
if (nDimensions == 2) {
314+
nbins++;
315+
avg += fhNuaNue[i]->GetBinContent(ix + 1, iy + 1);
316+
} else {
317+
for (int iz = 0; iz < fhNuaNue[i]->GetNbinsZ(); ++iz) {
318+
nbins++;
319+
avg += fhNuaNue[i]->GetBinContent(ix + 1, iy + 1, iz + 1);
320+
}
321+
}
310322
}
311323
}
312324
}
@@ -332,8 +344,15 @@ struct DptDptCorrelationsTask {
332344
std::vector<float>* corr = new std::vector<float>(tracks.size(), 1.0f);
333345
int index = 0;
334346
for (auto& t : tracks) {
335-
if (fhNuaNue_vsZEtaPhiPt[t.trackacceptedid()] != nullptr) {
336-
(*corr)[index] = fhNuaNue_vsZEtaPhiPt[t.trackacceptedid()]->GetBinContent(fhNuaNue_vsZEtaPhiPt[t.trackacceptedid()]->FindFixBin(zvtx, GetEtaPhiIndex(t) + 0.5, t.pt()));
347+
if (fhNuaNue[t.trackacceptedid()] != nullptr) {
348+
int nDimensions = fhNuaNue[t.trackacceptedid()]->GetDimension();
349+
if (nDimensions == 1) {
350+
(*corr)[index] = fhNuaNue[t.trackacceptedid()]->GetBinContent(fhNuaNue[t.trackacceptedid()]->FindFixBin(t.pt()));
351+
} else if (nDimensions == 2) {
352+
(*corr)[index] = fhNuaNue[t.trackacceptedid()]->GetBinContent(fhNuaNue[t.trackacceptedid()]->FindFixBin(t.eta(), t.pt()));
353+
} else {
354+
(*corr)[index] = fhNuaNue[t.trackacceptedid()]->GetBinContent(fhNuaNue[t.trackacceptedid()]->FindFixBin(zvtx, GetEtaPhiIndex(t) + 0.5, t.pt()));
355+
}
337356
}
338357
index++;
339358
}
@@ -690,7 +709,7 @@ struct DptDptCorrelationsTask {
690709
fhSum1Pt_vsZEtaPhiPt[i]->SetBit(TH1::kIsNotW);
691710
fhSum1Pt_vsZEtaPhiPt[i]->Sumw2(false);
692711
}
693-
fhNuaNue_vsZEtaPhiPt[i] = nullptr;
712+
fhNuaNue[i] = nullptr;
694713
fhPtAvg_vsEtaPhi[i] = nullptr;
695714

696715
fOutputList->Add(fhN1_vsPt[i]);
@@ -724,7 +743,7 @@ struct DptDptCorrelationsTask {
724743
100, 0.0, 100.0);
725744
fhSum1Ptnw_vsC[i] = new TProfile(TString::Format("sumPtNw_%s_vsM", tnames[i].c_str()).Data(),
726745
TString::Format("#LT #Sigma p_{t,%s} #GT;Centrality/Multiplicity (%%);#LT #Sigma p_{t,%s} #GT (GeV/c)", tnames[i].c_str(), tnames[i].c_str()).Data(), 100, 0.0, 100.0);
727-
fhNuaNue_vsZEtaPhiPt[i] = nullptr;
746+
fhNuaNue[i] = nullptr;
728747
fhPtAvg_vsEtaPhi[i] = nullptr;
729748
fOutputList->Add(fhN1_vsEtaPhi[i]);
730749
fOutputList->Add(fhSum1Pt_vsEtaPhi[i]);
@@ -1200,9 +1219,9 @@ struct DptDptCorrelationsTask {
12001219
}
12011220
storePtAverages(ptavgs);
12021221
} else {
1203-
std::vector<TH3*> corrs{tnames.size(), nullptr};
1222+
std::vector<TH1*> corrs{tnames.size(), nullptr};
12041223
for (uint isp = 0; isp < tnames.size(); ++isp) {
1205-
corrs[isp] = reinterpret_cast<TH3*>(ccdblst->FindObject(
1224+
corrs[isp] = reinterpret_cast<TH1*>(ccdblst->FindObject(
12061225
TString::Format("correction_%02d-%02d_%s",
12071226
static_cast<int>(fCentMultMin[ixDCE]),
12081227
static_cast<int>(fCentMultMax[ixDCE]),
@@ -1274,9 +1293,9 @@ struct DptDptCorrelationsTask {
12741293
}
12751294
dataCEME[ixDCE]->storePtAverages(ptavgs);
12761295
} else {
1277-
std::vector<TH3*> corrs{tnames.size(), nullptr};
1296+
std::vector<TH1*> corrs{tnames.size(), nullptr};
12781297
for (uint isp = 0; isp < tnames.size(); ++isp) {
1279-
corrs[isp] = reinterpret_cast<TH3*>(ccdblst->FindObject(
1298+
corrs[isp] = reinterpret_cast<TH1*>(ccdblst->FindObject(
12801299
TString::Format("correction_%02d-%02d_%s",
12811300
static_cast<int>(fCentMultMin[ixDCE]),
12821301
static_cast<int>(fCentMultMax[ixDCE]),

0 commit comments

Comments
 (0)