Skip to content

Commit 857fe9f

Browse files
authored
[PWGCF] fix mAcceptance pointer issue (AliceO2Group#10422)
1 parent 88cb5c5 commit 857fe9f

File tree

1 file changed

+40
-6
lines changed

1 file changed

+40
-6
lines changed

PWGCF/Flow/Tasks/flowPbpbPikp.cxx

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ struct FlowPbpbPikp {
133133
histos.add("hMult", "", {HistType::kTH1D, {{3000, 0.5, 3000.5}}});
134134
histos.add("hCent", "", {HistType::kTH1D, {{90, 0, 90}}});
135135
histos.add("hPhi", "", {HistType::kTH1D, {axisPhi}});
136+
histos.add("hPhiWeighted", "", {HistType::kTH1D, {axisPhi}});
136137
histos.add("hEta", "", {HistType::kTH1D, {axisEta}});
137138
histos.add("hPt", "", {HistType::kTH1D, {axisPt}});
138139
histos.add("c22_gap08", "", {HistType::kTProfile, {axisMultiplicity}});
@@ -385,11 +386,35 @@ struct FlowPbpbPikp {
385386
uint64_t timestamp = bc.timestamp();
386387
mAcceptance.clear();
387388
mAcceptance.resize(kCount_OutputSpecies);
388-
mAcceptance.push_back(ccdb->getForTimeStamp<GFWWeights>(cfgAcceptance.value + "_ref", timestamp));
389-
mAcceptance.push_back(ccdb->getForTimeStamp<GFWWeights>(cfgAcceptance.value + "_ch", timestamp));
390-
mAcceptance.push_back(ccdb->getForTimeStamp<GFWWeights>(cfgAcceptance.value + "_pi", timestamp));
391-
mAcceptance.push_back(ccdb->getForTimeStamp<GFWWeights>(cfgAcceptance.value + "_ka", timestamp));
392-
mAcceptance.push_back(ccdb->getForTimeStamp<GFWWeights>(cfgAcceptance.value + "_pr", timestamp));
389+
mAcceptance[hRef] = ccdb->getForTimeStamp<GFWWeights>(cfgAcceptance.value + "_ref", timestamp);
390+
if (mAcceptance[hRef])
391+
LOGF(info, "Loaded acceptance weights from %s_ref (%p)", cfgAcceptance.value.c_str(), (void*)mAcceptance[hRef]);
392+
else
393+
LOGF(fatal, "Could not load acceptance weights from %s_ref (%p)", cfgAcceptance.value.c_str(), (void*)mAcceptance[hRef]);
394+
395+
mAcceptance[hCharge] = ccdb->getForTimeStamp<GFWWeights>(cfgAcceptance.value + "_ch", timestamp);
396+
if (mAcceptance[hCharge])
397+
LOGF(info, "Loaded acceptance weights from %s_ch (%p)", cfgAcceptance.value.c_str(), (void*)mAcceptance[hCharge]);
398+
else
399+
LOGF(fatal, "Could not load acceptance weights from %s_ch (%p)", cfgAcceptance.value.c_str(), (void*)mAcceptance[hCharge]);
400+
401+
mAcceptance[hPion] = ccdb->getForTimeStamp<GFWWeights>(cfgAcceptance.value + "_pi", timestamp);
402+
if (mAcceptance[hPion])
403+
LOGF(info, "Loaded acceptance weights from %s_pi (%p)", cfgAcceptance.value.c_str(), (void*)mAcceptance[hPion]);
404+
else
405+
LOGF(fatal, "Could not load acceptance weights from %s_pi (%p)", cfgAcceptance.value.c_str(), (void*)mAcceptance[hPion]);
406+
407+
mAcceptance[hKaon] = ccdb->getForTimeStamp<GFWWeights>(cfgAcceptance.value + "_ka", timestamp);
408+
if (mAcceptance[hKaon])
409+
LOGF(info, "Loaded acceptance weights from %s_ka (%p)", cfgAcceptance.value.c_str(), (void*)mAcceptance[hKaon]);
410+
else
411+
LOGF(fatal, "Could not load acceptance weights from %s_ka (%p)", cfgAcceptance.value.c_str(), (void*)mAcceptance[hKaon]);
412+
413+
mAcceptance[hProton] = ccdb->getForTimeStamp<GFWWeights>(cfgAcceptance.value + "_pr", timestamp);
414+
if (mAcceptance[hProton])
415+
LOGF(info, "Loaded acceptance weights from %s_pr (%p)", cfgAcceptance.value.c_str(), (void*)mAcceptance[hProton]);
416+
else
417+
LOGF(fatal, "Could not load acceptance weights from %s_pr (%p)", cfgAcceptance.value.c_str(), (void*)mAcceptance[hProton]);
393418
}
394419

395420
correctionsLoaded = true;
@@ -398,9 +423,17 @@ struct FlowPbpbPikp {
398423
template <typename TTrack>
399424
double getAcceptance(TTrack track, const double& vtxz, int index)
400425
{ // 0 ref, 1 ch, 2 pi, 3 ka, 4 pr
426+
if (index < 0 || index >= kCount_OutputSpecies) {
427+
return 1;
428+
}
401429
double wacc = 1;
402-
if (!mAcceptance.empty())
430+
if (!mAcceptance.empty() && correctionsLoaded) {
431+
if (!mAcceptance[index]) {
432+
LOGF(fatal, "Acceptance weights not loaded for index %d", index);
433+
return 1;
434+
}
403435
wacc = mAcceptance[index]->getNUA(track.phi(), track.eta(), vtxz);
436+
}
404437
return wacc;
405438
}
406439

@@ -495,6 +528,7 @@ struct FlowPbpbPikp {
495528
waccRef = waccPOI; // if particle is both (then it's overlap), override ref with POI
496529

497530
if (withinPtRef) {
531+
histos.fill(HIST("hPhiWeighted"), track.phi(), waccRef);
498532
fGFW->Fill(track.eta(), fPtAxis->FindBin(pt) - 1, track.phi(), waccRef * weff, 1);
499533
fGFW->Fill(track.eta(), 1, track.phi(), waccRef * weff, 512);
500534
}

0 commit comments

Comments
 (0)