Skip to content

Commit eee1bc6

Browse files
NucleiTask - Add mothers pT
1 parent d3c2e47 commit eee1bc6

File tree

1 file changed

+64
-37
lines changed

1 file changed

+64
-37
lines changed

PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx

Lines changed: 64 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ struct LFNucleiBATask {
7171
Configurable<bool> enableAl{"enableAl", true, "Flag to enable alpha analysis."};
7272

7373
Configurable<bool> enableTrackingEff{"enableTrackingEff", 0, "Flag to enable tracking efficiency hitos."};
74-
Configurable<std::string> ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
74+
Configurable<std::string> ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; // NOLINT
7575

7676
// Set the triggered events skimming scheme
7777
struct : ConfigurableGroup {
@@ -214,6 +214,9 @@ struct LFNucleiBATask {
214214

215215
Configurable<bool> enableCentrality{"enableCentrality", true, "Flag to enable centrality 3D histos)"};
216216

217+
// Weak-decay flag
218+
static constexpr int kProcessWeakDecay = 4;
219+
217220
// PDG codes and masses used in this analysis
218221
static constexpr int PDGPion = PDG_t::kPiPlus;
219222
static constexpr int PDGKaon = PDG_t::kKPlus;
@@ -231,19 +234,32 @@ struct LFNucleiBATask {
231234

232235
// PDG of Mothers
233236
static constexpr int kPdgMotherlist[] = {
234-
PDGProton, // proton
235-
PDGPion, // pi+
236-
PDGKaon, // K+
237-
311, // K0
238-
PDGDeuteron, // deuteron
239-
PDGTriton, // triton
240-
PDGHelium, // He-3
241-
PDGAlpha, // Alpha
242-
1000130270, // Aluminium
243-
1000140280, // Silicon
244-
1000260560 // Iron
245-
};
237+
PDGPion,
238+
PDGKaon,
239+
311,
240+
PDGProton,
241+
PDGDeuteron,
242+
PDGTriton,
243+
PDGHelium,
244+
PDGAlpha,
245+
1000130270,
246+
1000140280,
247+
1000260560};
246248
static constexpr int kNumMotherlist = sizeof(kPdgMotherlist) / sizeof(kPdgMotherlist[0]);
249+
250+
static constexpr const char* kMomtherNames[kNumMotherlist] = {
251+
"#pi",
252+
"K+",
253+
"K0",
254+
"p",
255+
"d",
256+
"t",
257+
"He3",
258+
"#alpha",
259+
"Al",
260+
"Si",
261+
"Fe"};
262+
247263
static constexpr int kMaxNumMom = 4; // X: 0..4, overflow=5
248264

249265
template <typename TrackType>
@@ -1146,20 +1162,22 @@ struct LFNucleiBATask {
11461162
histos.add<TH2>("tracks/helium/dca/before/hDCAxyVsPtHeliumTrueSec", "DCAxy vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}});
11471163
histos.add<TH2>("tracks/helium/dca/before/hDCAxyVsPtHeliumTrueMaterial", "DCAxy vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}});
11481164

1149-
histos.add<TH2>("tracks/helium/dca/before/hMomTrueMaterial", "MC mothers;mother index;mother PDG", HistType::kTH2I, {{kMaxNumMom + 2, -0.5, static_cast<double>(kMaxNumMom) + 1.5}, {kNumMotherlist + 2, -1.5, static_cast<double>(kNumMotherlist) + 0.5}});
1165+
histos.add<TH1>("tracks/helium/dca/before/hNumMothers", "N mothers per particle; N mothers;counts", HistType::kTH1I, {{7, 1.0, 8.0}});
1166+
histos.add<TH3>("tracks/helium/dca/before/hMomTrueMaterial", "MC mothers;mother index;mother type; mother #it{p}_{T}", HistType::kTH3F, {{kMaxNumMom + 2, -0.5, static_cast<double>(kMaxNumMom) + 1.5}, {kNumMotherlist + 2, -1.5, static_cast<double>(kNumMotherlist) + 0.5}, {200, 0.0, 8.0}});
11501167

1151-
// Fix for getting TH2 pointer
1152-
std::shared_ptr<TH2> hTemp = histos.get<TH2>(HIST("tracks/helium/dca/before/hMomTrueMaterial"));
1153-
TH2* hPDG = hTemp.get();
1168+
// Fix for getting TH3 pointer
1169+
std::shared_ptr<TH3> hTemp = histos.get<TH3>(HIST("tracks/helium/dca/before/hMomTrueMaterial"));
1170+
TH3* hPDG = hTemp.get();
11541171

11551172
TAxis* axPDG = hPDG->GetXaxis();
11561173
for (int i = 0; i <= kMaxNumMom; ++i) {
11571174
axPDG->SetBinLabel(i + 1, Form("%d", i));
11581175
}
11591176
axPDG->SetBinLabel(kMaxNumMom + 2, ">=5");
1177+
11601178
TAxis* ayPDG = hPDG->GetYaxis();
1161-
ayPDG->SetBinLabel(1, "-1"); // undefined
1162-
ayPDG->SetBinLabel(2, "0"); // other
1179+
ayPDG->SetBinLabel(1, "undef.");
1180+
ayPDG->SetBinLabel(2, "other");
11631181
for (int i = 0; i < kNumMotherlist; ++i) {
11641182
ayPDG->SetBinLabel(i + 3, Form("%d", kPdgMotherlist[i]));
11651183
}
@@ -2655,15 +2673,15 @@ struct LFNucleiBATask {
26552673
if constexpr (IsFilteredData) {
26562674
isPhysPrim = track.isPhysicalPrimary();
26572675
isProdByGen = track.producedByGenerator();
2658-
isWeakDecay = track.getProcess() == 4; // NOLINT
2676+
isWeakDecay = (track.getProcess() == kProcessWeakDecay);
26592677
pdgCode = track.pdgCode();
26602678
} else {
26612679
if (!track.has_mcParticle()) {
26622680
continue;
26632681
}
26642682
isPhysPrim = track.mcParticle().isPhysicalPrimary();
26652683
isProdByGen = track.mcParticle().producedByGenerator();
2666-
isWeakDecay = track.mcParticle().getProcess() == 4; // NOLINT
2684+
isWeakDecay = (track.mcParticle().getProcess() == kProcessWeakDecay);
26672685
pdgCode = track.mcParticle().pdgCode();
26682686
}
26692687

@@ -3158,16 +3176,19 @@ struct LFNucleiBATask {
31583176
int pdgMom = 0;
31593177
// gen Pt
31603178
float genPt = 0;
3179+
float ptMom = 0;
31613180
// Mothers variables
31623181
[[maybe_unused]] int firstMotherId = -1;
31633182
[[maybe_unused]] int firstMotherPdg = -1;
3164-
[[maybe_unused]] int pdgList[8];
3183+
[[maybe_unused]] float firstMotherPt = -1.f;
3184+
[[maybe_unused]] int pdgMomList[8];
3185+
[[maybe_unused]] float ptMomList[8];
31653186
[[maybe_unused]] int nSaved = 0;
31663187

31673188
if constexpr (IsFilteredData) {
31683189
isPhysPrim = track.isPhysicalPrimary();
31693190
isProdByGen = track.producedByGenerator();
3170-
isWeakDecay = track.getProcess() == 4; // NOLINT
3191+
isWeakDecay = (track.getProcess() == kProcessWeakDecay);
31713192
pdgCode = track.pdgCode();
31723193
genPt = std::sqrt(std::pow(track.px(), 2) + std::pow(track.py(), 2));
31733194

@@ -3177,7 +3198,7 @@ struct LFNucleiBATask {
31773198
}
31783199
isPhysPrim = track.mcParticle().isPhysicalPrimary();
31793200
isProdByGen = track.mcParticle().producedByGenerator();
3180-
isWeakDecay = track.mcParticle().getProcess() == 4; // NOLINT
3201+
isWeakDecay = (track.mcParticle().getProcess() == kProcessWeakDecay);
31813202
pdgCode = track.mcParticle().pdgCode();
31823203

31833204
// Access to MC particles mother
@@ -3186,7 +3207,7 @@ struct LFNucleiBATask {
31863207
const int nMothers = static_cast<int>(motherIds.size());
31873208
firstMotherId = -1;
31883209
firstMotherPdg = -1;
3189-
3210+
firstMotherPt = -1.f;
31903211
nSaved = 0;
31913212

31923213
for (int iMom = 0; iMom < nMothers; ++iMom) {
@@ -3196,13 +3217,17 @@ struct LFNucleiBATask {
31963217
}
31973218
o2::aod::McParticles::iterator mother = particles.iteratorAt(motherId);
31983219
pdgMom = mother.pdgCode();
3220+
ptMom = mother.pt();
31993221

32003222
if (iMom == 0) {
32013223
firstMotherId = motherId;
32023224
firstMotherPdg = pdgMom;
3225+
firstMotherPt = ptMom;
32033226
}
32043227
if (nSaved < 8) {
3205-
pdgList[nSaved++] = pdgMom;
3228+
pdgMomList[nSaved] = pdgMom;
3229+
ptMomList[nSaved] = ptMom;
3230+
++nSaved;
32063231
}
32073232
}
32083233

@@ -3472,21 +3497,23 @@ struct LFNucleiBATask {
34723497
} else {
34733498
histos.fill(HIST("tracks/helium/dca/before/hDCAxyVsPtHeliumTrueMaterial"), hePt, track.dcaXY());
34743499
if (!IsFilteredData) {
3500+
histos.fill(HIST("tracks/helium/dca/before/hNumMothers"), nSaved);
34753501
if (nSaved > 0) {
3476-
for (int i = 0; i < nSaved; ++i) {
3477-
int idxComp = (i <= kMaxNumMom) ? i : (kMaxNumMom + 1);
3478-
int pdgMom = pdgList[i];
3479-
int yVal = -1;
3502+
for (int iMom = 0; iMom < nSaved; iMom++) {
3503+
int motherIndexBin = (iMom <= kMaxNumMom) ? iMom : (kMaxNumMom + 1);
3504+
int pdgMom = pdgMomList[iMom];
3505+
float ptMom = ptMomList[iMom];
3506+
int motherSpeciesBin = -1;
34803507
if (pdgMom != -1) {
3481-
yVal = 0;
3482-
for (int j = 0; j < kNumMotherlist; ++j) {
3508+
motherSpeciesBin = 0;
3509+
for (int j = 0; j < kNumMotherlist; j++) {
34833510
if (kPdgMotherlist[j] == pdgMom) {
3484-
yVal = j + 1;
3511+
motherSpeciesBin = j + 1;
34853512
break;
34863513
}
34873514
}
34883515
}
3489-
histos.fill(HIST("tracks/helium/dca/before/hMomTrueMaterial"), idxComp, yVal);
3516+
histos.fill(HIST("tracks/helium/dca/before/hMomTrueMaterial"), motherIndexBin, motherSpeciesBin, ptMom);
34903517
}
34913518
}
34923519
}
@@ -4908,7 +4935,7 @@ struct LFNucleiBATask {
49084935
if constexpr (IsFilteredData) {
49094936
isPhysPrim = track.isPhysicalPrimary();
49104937
isProdByGen = track.producedByGenerator();
4911-
isWeakDecay = track.getProcess() == 4;
4938+
isWeakDecay = (track.getProcess() == kProcessWeakDecay);
49124939
pdgCode = track.pdgCode();
49134940
isItsPassed = track.itsPassed();
49144941
isTpcPassed = track.tpcPassed();
@@ -4920,7 +4947,7 @@ struct LFNucleiBATask {
49204947
}
49214948
isPhysPrim = track.mcParticle().isPhysicalPrimary();
49224949
isProdByGen = track.mcParticle().producedByGenerator();
4923-
isWeakDecay = track.mcParticle().getProcess() == 4;
4950+
isWeakDecay = (track.mcParticle().getProcess() == kProcessWeakDecay);
49244951
pdgCode = track.mcParticle().pdgCode();
49254952
isItsPassed = track.passedITSNCls() &&
49264953
track.passedITSChi2NDF() &&
@@ -6066,7 +6093,7 @@ struct LFNucleiBATask {
60666093

60676094
bool isPhysPrim = mcParticleGen.isPhysicalPrimary();
60686095
bool isProdByGen = mcParticleGen.producedByGenerator();
6069-
bool isWeakDecay = mcParticleGen.getProcess() == 4;
6096+
bool isWeakDecay = (mcParticleGen.getProcess() == kProcessWeakDecay);
60706097

60716098
if (mcParticleGen.pdgCode() == PDGPion) {
60726099
spectraGen.fill(HIST("pion/histGenPtPion"), mcParticleGen.pt());

0 commit comments

Comments
 (0)