Skip to content

Commit 7de0b01

Browse files
victor-gonzalezVictor Gonzalez
andauthored
[PWGCF] DptDpt - More ancestor identification flexibility (#15724)
Co-authored-by: Victor Gonzalez <victor@cern.ch>
1 parent f762349 commit 7de0b01

File tree

1 file changed

+13
-106
lines changed

1 file changed

+13
-106
lines changed

PWGCF/TwoParticleCorrelations/Tasks/particleOriginAnalysis.cxx

Lines changed: 13 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -54,97 +54,13 @@ namespace particleorigintask
5454
{
5555
using namespace o2::analysis::dptdptfilter;
5656

57-
// ============================================================================
58-
// Compact encoding of the mother resonance identity
59-
// ============================================================================
60-
enum MotherSpecies {
61-
kMothPrompt = 0, ///< not from decay (prompt from hadronization)
62-
kMothRho0, ///< rho0(770) - PDG 113
63-
kMothRhoCharged, ///< rho+/-(770) - PDG 213
64-
kMothOmega782, ///< omega(782) - PDG 223
65-
kMothEta, ///< eta - PDG 221
66-
kMothEtaPrime, ///< eta'(958) - PDG 331
67-
kMothKStar892Ch, ///< K*(892)+/- - PDG 323
68-
kMothKStar892_0, ///< K*(892)0 - PDG 313
69-
kMothPhi1020, ///< phi(1020) - PDG 333
70-
kMothDelta, ///< Delta(1232) all - PDG 1114,2114,2214,2224
71-
kMothSigmaStar, ///< Sigma*(1385) - PDG 3114,3214,3224
72-
kMothLambda1520, ///< Lambda(1520) - PDG 3124
73-
kMothF0_980, ///< f0(980) - PDG 9010221
74-
kMothOtherMeson, ///< other meson mothers
75-
kMothOtherBaryon, ///< other baryon mothers
76-
kNMotherSpecies
77-
};
78-
79-
static const char* motherLabel[kNMotherSpecies] = {
80-
"prompt", "#rho^{0}", "#rho^{#pm}", "#omega", "#eta", "#eta'",
81-
"K*^{#pm}", "K*^{0}", "#phi",
82-
"#Delta", "#Sigma*", "#Lambda(1520)",
83-
"f_{0}(980)", "other meson", "other baryon"};
84-
85-
// PDG codes used from TPDGCode.h (ROOT):
86-
// kRho770_0 (113), kRho770Plus (213), kLambda1520 (3124),
87-
// kPiPlus (211), kKPlus (321), kProton (2212)
88-
// PDG codes used from CommonConstants/PhysicsConstants.h (O2):
89-
// o2::constants::physics::Pdg::kEta (221), kOmega (223), kEtaPrime (331),
90-
// kK0Star892 (313), kKPlusStar892 (323), kPhi (333)
91-
// PDG codes NOT in either header - defined here:
92-
static constexpr int KPdgDeltaMinusMinus = 1114; // o2-linter: disable=pdg/explicit-code(not existing)
93-
static constexpr int KPdgDelta0 = 2114; // o2-linter: disable=pdg/explicit-code(not existing)
94-
static constexpr int KPdgDeltaPlus = 2214; // o2-linter: disable=pdg/explicit-code(not existing)
95-
static constexpr int KPdgDeltaPlusPlus = 2224; // o2-linter: disable=pdg/explicit-code(not existing)
96-
static constexpr int KPdgSigmaStarMinus = 3114; // o2-linter: disable=pdg/explicit-code(not existing)
97-
static constexpr int KPdgSigmaStar0 = 3214; // o2-linter: disable=pdg/explicit-code(not existing)
98-
static constexpr int KPdgSigmaStarPlus = 3224; // o2-linter: disable=pdg/explicit-code(not existing)
99-
static constexpr int KPdgF0_980 = 9010221; // o2-linter: disable=pdg/explicit-code(not existing),name/function-variable(clashes with f0),name/constexpr-constant(clashes with f0)
100-
101-
/// PDG codes below this threshold are mesons; at or above are baryons
102-
static constexpr int KPdgBaryonThreshold = 1000; // o2-linter: disable=pdg/explicit-code(not a PDG code)
103-
104-
/// \brief Encode absolute PDG code of a mother into compact bin index
105-
inline int encodeMotherPDG(int absPdg)
106-
{
107-
using namespace o2::constants::physics;
108-
switch (absPdg) {
109-
case kRho770_0:
110-
return kMothRho0;
111-
case kRho770Plus: /* kRho770Minus is just -213, we use abs */
112-
return kMothRhoCharged;
113-
case Pdg::kOmega:
114-
return kMothOmega782;
115-
case Pdg::kEta:
116-
return kMothEta;
117-
case Pdg::kEtaPrime:
118-
return kMothEtaPrime;
119-
case Pdg::kKPlusStar892:
120-
return kMothKStar892Ch;
121-
case Pdg::kK0Star892:
122-
return kMothKStar892_0;
123-
case Pdg::kPhi:
124-
return kMothPhi1020;
125-
case KPdgDeltaMinusMinus:
126-
case KPdgDelta0:
127-
case KPdgDeltaPlus:
128-
case KPdgDeltaPlusPlus:
129-
return kMothDelta;
130-
case KPdgSigmaStarMinus:
131-
case KPdgSigmaStar0:
132-
case KPdgSigmaStarPlus:
133-
return kMothSigmaStar;
134-
case kLambda1520:
135-
return kMothLambda1520;
136-
case KPdgF0_980:
137-
return kMothF0_980;
138-
default:
139-
return (absPdg < KPdgBaryonThreshold) ? kMothOtherMeson : kMothOtherBaryon;
140-
}
141-
}
142-
14357
/// PDG codes above this threshold correspond to hadrons (mesons and baryons).
14458
/// Below are quarks (1-6), leptons (11-16), gauge bosons (21-25), and
14559
/// special/internal generator codes.
146-
static constexpr int KPdgHadronThreshold = 100; // o2-linter: disable=pdg/explicit-code(not a PDG code)
60+
static constexpr int KPdgHadronThreshold = 100; // o2-linter: disable=pdg/explicit-code (not a PDG code)
14761

62+
/// the prompt origin label
63+
static constexpr std::string PromptStr = "prompt";
14864
// ============================================================================
14965
// Classification utilities
15066
// ============================================================================
@@ -226,8 +142,6 @@ struct ParticleOriginAnalysis {
226142

227143
/* histogram pointers for direct access */
228144
/* per track id histograms: indexed by trackacceptedid */
229-
static constexpr int KNMo = particleorigintask::kNMotherSpecies;
230-
231145
std::vector<std::shared_ptr<TH1>> fhPromptVsPt; ///< prompt counts vs pT, per track id
232146
std::vector<std::shared_ptr<TH1>> fhDecayVsPt; ///< from-decay counts vs pT, per track id
233147
std::vector<std::shared_ptr<TH2>> fhPromptVsCentVsPt; ///< prompt counts vs (cent, pT), per track id
@@ -316,7 +230,6 @@ struct ParticleOriginAnalysis {
316230
/* build the centrality axis with variable bin edges */
317231
const AxisSpec centAxis{centBinEdges, "centrality (%)"};
318232
const AxisSpec ptAxis{ptbins, ptlow, ptup, "#it{p}_{T} (GeV/#it{c})"};
319-
const AxisSpec motherAxis{KNMo, -0.5f, KNMo - 0.5f, "mother species"};
320233
const AxisSpec pdgAxis{100, 0.5f, 100.5f, "species"};
321234
const AxisSpec zvtxAxis{zvtxbins, zvtxlow, zvtxup, "#it{z}_{vtx}"};
322235

@@ -357,18 +270,12 @@ struct ParticleOriginAnalysis {
357270
fhMotherVsPtVsCent[i] = registry.add<TH3>(
358271
FORMATSTRING("MotherVsPtVsCent_%s", tname),
359272
FORMATSTRING("Immediate mother of %s;mother;#it{p}_{T} (GeV/#it{c});centrality (%%)", tname),
360-
kTH3D, {motherAxis, ptAxis, centAxis});
273+
kTH3D, {pdgAxis, ptAxis, centAxis});
361274

362275
fhAncestorVsPtVsCent[i] = registry.add<TH3>(
363276
FORMATSTRING("AncestorVsPtVsCent_%s", tname),
364277
FORMATSTRING("Earliest ancestor of %s;ancestor;#it{p}_{T} (GeV/#it{c});centrality (%%)", tname),
365-
kTH3D, {motherAxis, ptAxis, centAxis});
366-
367-
/* label the encoded mother/ancestor axis */
368-
for (int im = 0; im < KNMo; ++im) {
369-
fhMotherVsPtVsCent[i]->GetXaxis()->SetBinLabel(im + 1, motherLabel[im]);
370-
fhAncestorVsPtVsCent[i]->GetXaxis()->SetBinLabel(im + 1, motherLabel[im]);
371-
}
278+
kTH3D, {pdgAxis, ptAxis, centAxis});
372279

373280
fhMotherPDG[i] = registry.add<TH1>(
374281
FORMATSTRING("MotherPDG_%s", tname),
@@ -399,20 +306,20 @@ struct ParticleOriginAnalysis {
399306
if (isFromDecay) {
400307
fhDecayVsPt[tid]->Fill(pt);
401308
fhDecayVsCentVsPt[tid]->Fill(centmult, pt);
402-
int encodedMother = encodeMotherPDG(std::abs(immediatePdg));
403-
fhMotherVsPtVsCent[tid]->Fill(static_cast<float>(encodedMother), pt, centmult);
404-
fhMotherPDG[tid]->Fill(TString::Format("%d", immediatePdg).Data(), 1.0);
309+
TString strMother = TString::Format("%d", immediatePdg);
310+
fhMotherVsPtVsCent[tid]->Fill(strMother.Data(), pt, centmult, 1.0);
311+
fhMotherPDG[tid]->Fill(strMother.Data(), 1.0);
405312
} else {
406313
fhPromptVsPt[tid]->Fill(pt);
407314
fhPromptVsCentVsPt[tid]->Fill(centmult, pt);
408-
fhMotherVsPtVsCent[tid]->Fill(static_cast<float>(kMothPrompt), pt, centmult);
315+
fhMotherVsPtVsCent[tid]->Fill(PromptStr.c_str(), pt, centmult, 1.0);
409316
}
410317
if (isFromDecayFull) {
411-
int encodedAncestor = encodeMotherPDG(std::abs(ancestorPdg));
412-
fhAncestorVsPtVsCent[tid]->Fill(static_cast<float>(encodedAncestor), pt, centmult);
413-
fhAncestorPDG[tid]->Fill(TString::Format("%d", ancestorPdg).Data(), 1.0);
318+
TString strAncestor = TString::Format("%d", ancestorPdg);
319+
fhAncestorVsPtVsCent[tid]->Fill(strAncestor.Data(), pt, centmult, 1.0);
320+
fhAncestorPDG[tid]->Fill(strAncestor.Data(), 1.0);
414321
} else {
415-
fhAncestorVsPtVsCent[tid]->Fill(static_cast<float>(kMothPrompt), pt, centmult);
322+
fhAncestorVsPtVsCent[tid]->Fill(PromptStr.c_str(), pt, centmult, 1.0);
416323
}
417324
}
418325

0 commit comments

Comments
 (0)