Skip to content

Commit 42d1c38

Browse files
authored
[PWGHF] Add the number of tracks into the charm-bulk thnsparse in taskPtFlucCharmHadrons.cxx (#16434)
1 parent 1c1de43 commit 42d1c38

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

PWGHF/D2H/Tasks/taskPtFlucCharmHadrons.cxx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ struct HfTaskPtFlucCharmHadrons {
186186

187187
// charm-bulk correlations (optional)
188188
if (saveCharmBulkCorrelations) {
189-
registry.add("hCharmBulkCorrelations", "Charm-bulk correlations", HistType::kTHnSparseF, {aInvMass, aCent, aPt, aSign, aMlOne, aMlTwo, aCandEta, aMPtTrkA, aMPtTrkB, aPtCandProduct}, true);
189+
registry.add("hCharmBulkCorrelations", "Charm-bulk correlations", HistType::kTHnSparseF, {aInvMass, aCent, aPt, aSign, aMlOne, aMlTwo, aCandEta, aMPtTrkA, aMPtTrkB, aPtCandProduct, aNTrkA, aNTrkB}, true);
190190
registry.add("hMeanPtTrkAllColls", "Mean pT of charged hadrons for all collisions", HistType::kTHnSparseF, {aCent, aMPtTrkA, aMPtTrkB, aPtTrkProduct, aNTrkA, aNTrkB}, true);
191191
}
192192

@@ -250,7 +250,7 @@ struct HfTaskPtFlucCharmHadrons {
250250

251251
/// remove candidate daughters from the mean pT of tracks in A and B (if they are in the respective subevent)
252252
template <DecayChannel Channel, typename CandT>
253-
float removeDaughtersFromMeanPt(const CandT& cand, float rawMeanPt, int n, const std::vector<int>& trkIDs)
253+
std::pair<float, int> removeDaughtersFromMeanPt(const CandT& cand, float rawMeanPt, int n, const std::vector<int>& trkIDs)
254254
{
255255
int removedCount = 0;
256256
float removedSumPt = 0.f;
@@ -270,9 +270,9 @@ struct HfTaskPtFlucCharmHadrons {
270270
}
271271
if (removedCount > 0) {
272272
double totalSum = static_cast<double>(rawMeanPt) * n;
273-
return static_cast<float>((totalSum - removedSumPt) / (n - removedCount));
273+
return {static_cast<float>((totalSum - removedSumPt) / (n - removedCount)), n - removedCount};
274274
}
275-
return rawMeanPt;
275+
return {rawMeanPt, n};
276276
}
277277

278278
// ---------------------------------------------------------------------------
@@ -420,12 +420,14 @@ struct HfTaskPtFlucCharmHadrons {
420420
float candPtProduct{0.f};
421421
float meanPtA{0.f};
422422
float meanPtB{0.f};
423+
int nATrk{nA};
424+
int nBTrk{nB};
423425
if (eta > etaAMin.value && eta < etaAMax.value) {
424-
meanPtB = removeDaughtersFromMeanPt<Channel, decltype(cand)>(cand, RawMeanPtB, nB, trkIDB);
426+
std::tie(meanPtB, nBTrk) = removeDaughtersFromMeanPt<Channel, decltype(cand)>(cand, RawMeanPtB, nB, trkIDB);
425427
meanPtA = RawMeanPtA; // no need to remove daughters from A if candidate is in A
426428
candPtProduct = pt * meanPtB;
427429
} else if (eta > etaBMin.value && eta < etaBMax.value) {
428-
meanPtA = removeDaughtersFromMeanPt<Channel, decltype(cand)>(cand, RawMeanPtA, nA, trkIDA);
430+
std::tie(meanPtA, nATrk) = removeDaughtersFromMeanPt<Channel, decltype(cand)>(cand, RawMeanPtA, nA, trkIDA);
429431
meanPtB = RawMeanPtB; // no need to remove daughters from B if candidate is in B
430432
candPtProduct = pt * meanPtA;
431433
}
@@ -434,7 +436,7 @@ struct HfTaskPtFlucCharmHadrons {
434436
auto [invMass, sign] = getCandMassAndSign<Channel, decltype(cand), T1, Trk>(cand);
435437

436438
// fill charm-bulk correlation thnsparse
437-
registry.fill(HIST("hCharmBulkCorrelations"), invMass, cent, pt, sign, ml1, ml2, eta, meanPtA, meanPtB, candPtProduct);
439+
registry.fill(HIST("hCharmBulkCorrelations"), invMass, cent, pt, sign, ml1, ml2, eta, meanPtA, meanPtB, candPtProduct, nATrk, nBTrk);
438440
}
439441
} else {
440442
int nDcandTotA = 0;

0 commit comments

Comments
 (0)