Skip to content

Commit 18bd37c

Browse files
victor-gonzalezVictor
andauthored
Proper handling of NUA&NUE corrections (#3257)
Co-authored-by: Victor <victor@cern.ch>
1 parent 728bfdc commit 18bd37c

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

PWGCF/Tasks/dptdptcorrelations.cxx

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,19 @@ struct DptDptCorrelationsTask {
195195
{
196196
LOGF(info, "Stored NUA&NUE corrections for %d track ids", corrs.size());
197197
for (uint i = 0; i < corrs.size(); ++i) {
198-
LOGF(info, " Stored NUA&NUE corrections for track id %d %s", i, corrs[i] != nullptr ? "yes" : "no");
198+
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");
199199
fhNuaNue_vsZEtaPhiPt[i] = corrs[i];
200+
int nbins = 0;
201+
double avg = 0.0;
202+
for (int ix = 0; ix < fhNuaNue_vsZEtaPhiPt[i]->GetNbinsX(); ++ix) {
203+
for (int iy = 0; iy < fhNuaNue_vsZEtaPhiPt[i]->GetNbinsY(); ++iy) {
204+
for (int iz = 0; iz < fhNuaNue_vsZEtaPhiPt[i]->GetNbinsZ(); ++iz) {
205+
nbins++;
206+
avg += fhNuaNue_vsZEtaPhiPt[i]->GetBinContent(ix + 1, iy + 1, iz + 1);
207+
}
208+
}
209+
}
210+
LOGF(info, "Average NUA&NUE correction for track id %d: %f", i, avg / nbins);
200211
}
201212
ccdbstored = true;
202213
}
@@ -216,9 +227,9 @@ struct DptDptCorrelationsTask {
216227
{
217228
std::vector<float>* corr = new std::vector<float>(tracks.size(), 1.0f);
218229
int index = 0;
219-
for (auto t : tracks) {
230+
for (auto& t : tracks) {
220231
if (fhNuaNue_vsZEtaPhiPt[t.trackacceptedid()] != nullptr) {
221-
(*corr)[index] = fhNuaNue_vsZEtaPhiPt[t.trackacceptedid()]->GetBinContent(zvtx, GetEtaPhiIndex(t) + 0.5, t.pt());
232+
(*corr)[index] = fhNuaNue_vsZEtaPhiPt[t.trackacceptedid()]->GetBinContent(fhNuaNue_vsZEtaPhiPt[t.trackacceptedid()]->FindFixBin(zvtx, GetEtaPhiIndex(t) + 0.5, t.pt()));
222233
}
223234
index++;
224235
}
@@ -230,9 +241,9 @@ struct DptDptCorrelationsTask {
230241
{
231242
std::vector<float>* ptavg = new std::vector<float>(tracks.size(), 0.0f);
232243
int index = 0;
233-
for (auto t : tracks) {
244+
for (auto& t : tracks) {
234245
if (fhPtAvg_vsEtaPhi[t.trackacceptedid()] != nullptr) {
235-
(*ptavg)[index] = fhPtAvg_vsEtaPhi[t.trackacceptedid()]->GetBinContent(fhPtAvg_vsEtaPhi[t.trackacceptedid()]->FindBin(t.eta(), t.phi()));
246+
(*ptavg)[index] = fhPtAvg_vsEtaPhi[t.trackacceptedid()]->GetBinContent(fhPtAvg_vsEtaPhi[t.trackacceptedid()]->FindFixBin(t.eta(), t.phi()));
236247
index++;
237248
}
238249
}
@@ -362,7 +373,9 @@ struct DptDptCorrelationsTask {
362373
fhSum2PtPt_vsDEtaDPhi[track1.trackacceptedid()][track2.trackacceptedid()]->AddBinContent(globalbin, track1.pt() * track2.pt() * corr);
363374
}
364375
fhN2_vsPtPt[track1.trackacceptedid()][track2.trackacceptedid()]->Fill(track1.pt(), track2.pt(), corr);
376+
index2++;
365377
}
378+
index1++;
366379
}
367380
for (uint pid1 = 0; pid1 < nch; ++pid1) {
368381
for (uint pid2 = 0; pid2 < nch; ++pid2) {

0 commit comments

Comments
 (0)