Skip to content

Commit 65b9e06

Browse files
Update taskFlowCharmHadrons.cxx based on Vit's comments
1 parent d028201 commit 65b9e06

File tree

1 file changed

+29
-24
lines changed

1 file changed

+29
-24
lines changed

PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -439,41 +439,46 @@ struct HfTaskFlowCharmHadrons {
439439
const o2::hf_evsel::HfCollisionRejectionMask hfevselflag)
440440
{
441441
auto hSparse = registry.get<THnSparse>(HIST("hSparseFlowCharm"));
442+
const int ndim = hSparse->GetNdimensions();
442443

443-
std::array<double, 32> values{};
444-
int n = 0;
444+
std::vector<double> values;
445+
values.reserve(ndim);
445446

446-
values[n++] = mass;
447-
values[n++] = pt;
448-
values[n++] = cent;
449-
values[n++] = sp;
447+
values.push_back(mass);
448+
values.push_back(pt);
449+
values.push_back(cent);
450+
values.push_back(sp);
450451

451452
if (storeEP) {
452-
values[n++] = cosNPhi;
453-
values[n++] = sinNPhi;
454-
values[n++] = cosDeltaPhi;
453+
values.push_back(cosNPhi);
454+
values.push_back(sinNPhi);
455+
values.push_back(cosDeltaPhi);
455456
}
456-
if (storeMl) {
457-
values[n++] = outputMl[0];
458-
values[n++] = outputMl[1];
457+
458+
if (storeMl && outputMl.size() >= 2) {
459+
values.push_back(outputMl[0]);
460+
values.push_back(outputMl[1]);
459461
}
462+
460463
if (storeCandEta) {
461-
values[n++] = eta;
464+
values.push_back(eta);
462465
}
466+
463467
if (occEstimator != 0) {
464-
std::vector<int> evtSelFlags = getEventSelectionFlags(hfevselflag);
465-
values[n++] = occupancy;
466-
values[n++] = evtSelFlags[0];
467-
values[n++] = evtSelFlags[1];
468-
values[n++] = evtSelFlags[2];
469-
values[n++] = evtSelFlags[3];
470-
values[n++] = evtSelFlags[4];
468+
auto evtSelFlags = getEventSelectionFlags(hfevselflag);
469+
values.push_back(occupancy);
470+
values.push_back(evtSelFlags[0]);
471+
values.push_back(evtSelFlags[1]);
472+
values.push_back(evtSelFlags[2]);
473+
values.push_back(evtSelFlags[3]);
474+
values.push_back(evtSelFlags[4]);
471475
}
472476

473-
const int ndim = hSparse->GetNdimensions();
474-
if (n != ndim) {
475-
LOGF(error, "hSparseFlowCharm: filled %d dims but THn has %d dims", n, ndim);
476-
return;
477+
if (static_cast<int>(values.size()) != ndim) {
478+
LOGF(fatal,
479+
"hSparseFlowCharm: number of filled dimensions (%d) "
480+
"does not match THnSparse dimensionality (%d).",
481+
static_cast<int>(values.size()), ndim);
477482
}
478483

479484
hSparse->Fill(values.data());

0 commit comments

Comments
 (0)