Skip to content

Commit 4b741a3

Browse files
corrected the calculation of mass of generated delta particle
1 parent c61676e commit 4b741a3

1 file changed

Lines changed: 27 additions & 13 deletions

File tree

PWGLF/Tasks/Resonances/deltaAnalysis.cxx

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -319,10 +319,11 @@ struct DeltaAnalysis {
319319
histos.add("THnSparse/hAntiDeltaPlusPlusMC", "THnSparse #bar{#Delta}^{++} MC reconstructed", kTHnSparseF, {massAxis, ptAxis, centAxis, rapAxis});
320320
histos.add("THnSparse/hDeltaZeroMC", "THnSparse #Delta^{0} MC reconstructed", kTHnSparseF, {massAxis, ptAxis, centAxis, rapAxis});
321321
histos.add("THnSparse/hAntiDeltaZeroMC", "THnSparse #bar{#Delta}^{0} MC reconstructed", kTHnSparseF, {massAxis, ptAxis, centAxis, rapAxis});
322-
histos.add("THnSparse/hDeltaPlusPlusGen", "THnSparse #Delta^{++} generated", kTHnSparseF, {ptAxis, centAxis, rapAxis});
323-
histos.add("THnSparse/hAntiDeltaPlusPlusGen", "THnSparse #bar{#Delta}^{++} generated", kTHnSparseF, {ptAxis, centAxis, rapAxis});
324-
histos.add("THnSparse/hDeltaZeroGen", "THnSparse #Delta^{0} generated", kTHnSparseF, {ptAxis, centAxis, rapAxis});
325-
histos.add("THnSparse/hAntiDeltaZeroGen", "THnSparse #bar{#Delta}^{0} generated", kTHnSparseF, {ptAxis, centAxis, rapAxis});
322+
// CHANGED: generated-particle THnSparse now carries mass at axis 0, followed by pt, cent, rap
323+
histos.add("THnSparse/hDeltaPlusPlusGen", "THnSparse #Delta^{++} generated", kTHnSparseF, {massAxis, ptAxis, centAxis, rapAxis});
324+
histos.add("THnSparse/hAntiDeltaPlusPlusGen", "THnSparse #bar{#Delta}^{++} generated", kTHnSparseF, {massAxis, ptAxis, centAxis, rapAxis});
325+
histos.add("THnSparse/hDeltaZeroGen", "THnSparse #Delta^{0} generated", kTHnSparseF, {massAxis, ptAxis, centAxis, rapAxis});
326+
histos.add("THnSparse/hAntiDeltaZeroGen", "THnSparse #bar{#Delta}^{0} generated", kTHnSparseF, {massAxis, ptAxis, centAxis, rapAxis});
326327

327328
histos.add("Analysis/hDeltaPlusPlusInvMassMC", "#Delta^{++} invariant mass (MC truth-matched)", kTH2F, {ptAxis, massAxis});
328329
histos.add("Analysis/hAntiDeltaPlusPlusInvMassMC", "#bar{#Delta}^{++} invariant mass (MC truth-matched)", kTH2F, {ptAxis, massAxis});
@@ -1250,44 +1251,57 @@ struct DeltaAnalysis {
12501251
if (mcParticle.y() < cfgMinY || mcParticle.y() > cfgMaxY)
12511252
continue;
12521253
const auto daughters = mcParticle.daughters_as<aod::McParticles>();
1254+
// CHANGED: daughter loop is now used only for decay-channel validation / QA
1255+
// (hasPr, hasPi, ptPr, ptPi). It no longer accumulates daughter energy for
1256+
// the mass calculation.
12531257
bool hasPr = false, hasPi = false;
12541258
float ptPr = -999.f, ptPi = -999.f;
1255-
double eTotal = 0.;
12561259
for (const auto& d : daughters) {
12571260
if (std::abs(d.pdgCode()) == delta_analysis::PdgProton) {
12581261
hasPr = true;
12591262
ptPr = d.pt();
1260-
eTotal += d.e();
12611263
} else if (std::abs(d.pdgCode()) == delta_analysis::PdgPion) {
12621264
hasPi = true;
12631265
ptPi = d.pt();
1264-
eTotal += d.e();
12651266
}
12661267
}
12671268
if (!hasPr || !hasPi)
12681269
continue;
1269-
const float pSq = mcParticle.p() * mcParticle.p();
1270-
const float genMass = std::sqrt(std::max(0., eTotal * eTotal - static_cast<double>(pSq)));
1270+
// CHANGED: genMass is now computed directly from the mother particle's
1271+
// own four-momentum (E, px, py, pz), instead of being reconstructed
1272+
// from the sum of daughter energies/momenta. mcParticle.m() is not
1273+
// available for this particle type, so the mass is built explicitly
1274+
// from mcParticle.e()/px()/py()/pz(), which are the standard AOD
1275+
// McParticles accessors. mass2 is clamped to zero before the sqrt to
1276+
// guard against small negative values from floating-point roundoff.
1277+
const float eMother = mcParticle.e();
1278+
const float pxMother = mcParticle.px();
1279+
const float pyMother = mcParticle.py();
1280+
const float pzMother = mcParticle.pz();
1281+
const float mass2 = eMother * eMother - pxMother * pxMother - pyMother * pyMother - pzMother * pzMother;
1282+
const float genMass = std::sqrt(std::max(0.f, mass2));
12711283
const float genPt = mcParticle.pt();
12721284
const float genY = mcParticle.y();
12731285
if (pdg == delta_analysis::PdgDeltaPlusPlus) {
12741286
histos.fill(HIST("Analysis/hDeltaPlusPlusInvMassGen"), genPt, genMass);
1275-
histos.fill(HIST("THnSparse/hDeltaPlusPlusGen"), genPt, kGenCentrality, genY);
1287+
// CHANGED: THnSparse Gen fill now carries genMass as the first argument,
1288+
// matching the new {massAxis, ptAxis, centAxis, rapAxis} axis order.
1289+
histos.fill(HIST("THnSparse/hDeltaPlusPlusGen"), genMass, genPt, kGenCentrality, genY);
12761290
histos.fill(HIST("QAChecks/hGenProtonDeltaPlusPlus"), ptPr);
12771291
histos.fill(HIST("QAChecks/hGenPionDeltaPlusPlus"), ptPi);
12781292
} else if (pdg == -delta_analysis::PdgDeltaPlusPlus) {
12791293
histos.fill(HIST("Analysis/hAntiDeltaPlusPlusInvMassGen"), genPt, genMass);
1280-
histos.fill(HIST("THnSparse/hAntiDeltaPlusPlusGen"), genPt, kGenCentrality, genY);
1294+
histos.fill(HIST("THnSparse/hAntiDeltaPlusPlusGen"), genMass, genPt, kGenCentrality, genY);
12811295
histos.fill(HIST("QAChecks/hGenProtonAntiDeltaPlusPlus"), ptPr);
12821296
histos.fill(HIST("QAChecks/hGenPionAntiDeltaPlusPlus"), ptPi);
12831297
} else if (pdg == delta_analysis::PdgDeltaZero) {
12841298
histos.fill(HIST("Analysis/hDeltaZeroInvMassGen"), genPt, genMass);
1285-
histos.fill(HIST("THnSparse/hDeltaZeroGen"), genPt, kGenCentrality, genY);
1299+
histos.fill(HIST("THnSparse/hDeltaZeroGen"), genMass, genPt, kGenCentrality, genY);
12861300
histos.fill(HIST("QAChecks/hGenProtonDeltaZero"), ptPr);
12871301
histos.fill(HIST("QAChecks/hGenPionDeltaZero"), ptPi);
12881302
} else if (pdg == -delta_analysis::PdgDeltaZero) {
12891303
histos.fill(HIST("Analysis/hAntiDeltaZeroInvMassGen"), genPt, genMass);
1290-
histos.fill(HIST("THnSparse/hAntiDeltaZeroGen"), genPt, kGenCentrality, genY);
1304+
histos.fill(HIST("THnSparse/hAntiDeltaZeroGen"), genMass, genPt, kGenCentrality, genY);
12911305
histos.fill(HIST("QAChecks/hGenProtonAntiDeltaZero"), ptPr);
12921306
histos.fill(HIST("QAChecks/hGenPionAntiDeltaZero"), ptPi);
12931307
}

0 commit comments

Comments
 (0)