Skip to content

Commit bc3cd60

Browse files
NucleiTask - Add mothers for Deuteron
1 parent 495365e commit bc3cd60

File tree

1 file changed

+76
-29
lines changed

1 file changed

+76
-29
lines changed

PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx

Lines changed: 76 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,11 @@ struct LFNucleiBATask {
214214

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

217+
// ITS to TPC - Fake hit loop
218+
static constexpr int kFakeLoop = 10; // Fixed O2Linter error
219+
// TPC low/high momentum range
220+
static constexpr float cfgTpcClasses[] = {0.5f, 0.1f};
221+
217222
// Weak-decay flag
218223
static constexpr int kProcessWeakDecay = 4;
219224

@@ -247,7 +252,7 @@ struct LFNucleiBATask {
247252
1000260560};
248253
static constexpr int kNumMotherlist = sizeof(kPdgMotherlist) / sizeof(kPdgMotherlist[0]);
249254

250-
static constexpr const char* kMomtherNames[kNumMotherlist] = {
255+
static constexpr const char* kMotherNames[kNumMotherlist] = {
251256
"#pi",
252257
"K+",
253258
"K0",
@@ -965,6 +970,26 @@ struct LFNucleiBATask {
965970
histos.add<TH2>("tracks/deuteron/dca/before/hDCAxyVsPtDeuteronTruePrim", "DCAxy vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}});
966971
histos.add<TH2>("tracks/deuteron/dca/before/hDCAxyVsPtDeuteronTrueSec", "DCAxy vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}});
967972
histos.add<TH2>("tracks/deuteron/dca/before/hDCAxyVsPtDeuteronTrueMaterial", "DCAxy vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}});
973+
974+
histos.add<TH1>("tracks/deuteron/dca/before/hNumMothers", "N mothers per particle; N mothers;counts", HistType::kTH1I, {{7, 1.0, 8.0}});
975+
histos.add<TH3>("tracks/deuteron/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}, {250, 0.0, 10.0}});
976+
977+
std::shared_ptr<TH3> hTemp_De = histos.get<TH3>(HIST("tracks/deuteron/dca/before/hMomTrueMaterial"));
978+
TH3* hPDG_De = hTemp_De.get();
979+
980+
TAxis* axPDG_De = hPDG_De->GetXaxis();
981+
for (int i = 0; i <= kMaxNumMom; i++) {
982+
axPDG_De->SetBinLabel(i + 1, Form("%d", i));
983+
}
984+
axPDG_De->SetBinLabel(kMaxNumMom + 2, ">=5");
985+
986+
TAxis* ayPDG_De = hPDG_De->GetYaxis();
987+
ayPDG_De->SetBinLabel(1, "undef.");
988+
ayPDG_De->SetBinLabel(2, "other");
989+
for (int i = 0; i < kNumMotherlist; i++) {
990+
ayPDG_De->SetBinLabel(i + 3, kMotherNames[i]);
991+
}
992+
968993
histos.add<TH2>("tracks/deuteron/dca/before/hDCAxyVsPtDeuteronTrueTransport", "DCAxy vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}});
969994

970995
histos.add<TH2>("tracks/deuteron/dca/before/hDCAxyVsPtantiDeuteronTrue", "DCAxy vs Pt (#bar{d}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}});
@@ -1163,23 +1188,23 @@ struct LFNucleiBATask {
11631188
histos.add<TH2>("tracks/helium/dca/before/hDCAxyVsPtHeliumTrueMaterial", "DCAxy vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}});
11641189

11651190
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}});
1191+
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}, {250, 0.0, 10.0}});
11671192

11681193
// 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();
1194+
std::shared_ptr<TH3> hTemp_He = histos.get<TH3>(HIST("tracks/helium/dca/before/hMomTrueMaterial"));
1195+
TH3* hPDG_He = hTemp_He.get();
11711196

1172-
TAxis* axPDG = hPDG->GetXaxis();
1173-
for (int i = 0; i <= kMaxNumMom; ++i) {
1174-
axPDG->SetBinLabel(i + 1, Form("%d", i));
1197+
TAxis* axPDG_He = hPDG_He->GetXaxis();
1198+
for (int i = 0; i <= kMaxNumMom; i++) {
1199+
axPDG_He->SetBinLabel(i + 1, Form("%d", i));
11751200
}
1176-
axPDG->SetBinLabel(kMaxNumMom + 2, ">=5");
1201+
axPDG_He->SetBinLabel(kMaxNumMom + 2, ">=5");
11771202

1178-
TAxis* ayPDG = hPDG->GetYaxis();
1179-
ayPDG->SetBinLabel(1, "undef.");
1180-
ayPDG->SetBinLabel(2, "other");
1181-
for (int i = 0; i < kNumMotherlist; ++i) {
1182-
ayPDG->SetBinLabel(i + 3, Form("%d", kPdgMotherlist[i]));
1203+
TAxis* ayPDG_He = hPDG_He->GetYaxis();
1204+
ayPDG_He->SetBinLabel(1, "undef.");
1205+
ayPDG_He->SetBinLabel(2, "other");
1206+
for (int i = 0; i < kNumMotherlist; i++) {
1207+
ayPDG_He->SetBinLabel(i + 3, kMotherNames[i]);
11831208
}
11841209

11851210
histos.add<TH2>("tracks/helium/dca/before/hDCAxyVsPtHeliumTrueTransport", "DCAxy vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}});
@@ -3181,8 +3206,8 @@ struct LFNucleiBATask {
31813206
[[maybe_unused]] int firstMotherId = -1;
31823207
[[maybe_unused]] int firstMotherPdg = -1;
31833208
[[maybe_unused]] float firstMotherPt = -1.f;
3184-
[[maybe_unused]] int pdgMomList[8];
3185-
[[maybe_unused]] float ptMomList[8];
3209+
[[maybe_unused]] int pdgMomList[kMaxNumMom];
3210+
[[maybe_unused]] float ptMomList[kMaxNumMom];
31863211
[[maybe_unused]] int nSaved = 0;
31873212

31883213
if constexpr (IsFilteredData) {
@@ -3210,7 +3235,7 @@ struct LFNucleiBATask {
32103235
firstMotherPt = -1.f;
32113236
nSaved = 0;
32123237

3213-
for (int iMom = 0; iMom < nMothers; ++iMom) {
3238+
for (int iMom = 0; iMom < nMothers; iMom++) {
32143239
int motherId = motherIds[iMom];
32153240
if (motherId < 0 || motherId >= particles.size()) {
32163241
continue; // added check on mother
@@ -3224,15 +3249,15 @@ struct LFNucleiBATask {
32243249
firstMotherPdg = pdgMom;
32253250
firstMotherPt = ptMom;
32263251
}
3227-
if (nSaved < 8) {
3252+
if (nSaved < kMaxNumMom) {
32283253
pdgMomList[nSaved] = pdgMom;
32293254
ptMomList[nSaved] = ptMom;
3230-
++nSaved;
3255+
nSaved++;
32313256
}
32323257
}
32333258

32343259
genPt = track.mcParticle().pt();
3235-
for (int i = 0; i < 10; i++) { // From ITS to TPC
3260+
for (int i = 0; i < kFakeLoop; i++) { // From ITS to TPC
32363261
if (track.mcMask() & 1 << i) {
32373262
hasFakeHit = true;
32383263
break;
@@ -3333,10 +3358,32 @@ struct LFNucleiBATask {
33333358
if (!isPhysPrim && !isProdByGen) {
33343359
if (outFlagOptions.makeDCABeforeCutPlots) {
33353360
histos.fill(HIST("tracks/deuteron/dca/before/hDCAxyVsPtDeuteronTrueTransport"), DPt, track.dcaXY());
3336-
if (isWeakDecay)
3361+
if (isWeakDecay) {
33373362
histos.fill(HIST("tracks/deuteron/dca/before/hDCAxyVsPtDeuteronTrueSec"), DPt, track.dcaXY());
3338-
else
3363+
} else {
33393364
histos.fill(HIST("tracks/deuteron/dca/before/hDCAxyVsPtDeuteronTrueMaterial"), DPt, track.dcaXY());
3365+
if constexpr (!IsFilteredData) {
3366+
histos.fill(HIST("tracks/deuteron/dca/before/hNumMothers"), nSaved);
3367+
if (nSaved > 0) {
3368+
for (int iMom = 0; iMom < nSaved; iMom++) {
3369+
int motherIndexBin = (iMom <= kMaxNumMom) ? iMom : (kMaxNumMom + 1);
3370+
int pdgMom = pdgMomList[iMom];
3371+
float ptMom = ptMomList[iMom];
3372+
int motherSpeciesBin = -1;
3373+
if (pdgMom != -1) {
3374+
motherSpeciesBin = 0;
3375+
for (int j = 0; j < kNumMotherlist; j++) {
3376+
if (kPdgMotherlist[j] == pdgMom) {
3377+
motherSpeciesBin = j + 1;
3378+
break;
3379+
}
3380+
}
3381+
}
3382+
histos.fill(HIST("tracks/deuteron/dca/before/hMomTrueMaterial"), motherIndexBin, motherSpeciesBin, ptMom);
3383+
}
3384+
}
3385+
}
3386+
}
33403387
if (track.hasTOF() && outFlagOptions.doTOFplots) {
33413388
histos.fill(HIST("tracks/deuteron/dca/before/TOF/hDCAxyVsPtDeuteronTrueTransport"), DPt, track.dcaXY());
33423389
if (isWeakDecay)
@@ -3929,26 +3976,26 @@ struct LFNucleiBATask {
39293976
debugHistos.fill(HIST("debug/qa/h2TPCncrVsPtPos"), track.tpcInnerParam(), track.tpcNClsCrossedRows());
39303977
debugHistos.fill(HIST("debug/qa/h2TPCncrVsTPCsignalPos"), track.tpcSignal(), track.tpcNClsCrossedRows());
39313978

3932-
if (track.tpcInnerParam() < 0.5f) {
3979+
if (track.tpcInnerParam() < cfgTpcClasses[0]) {
39333980
debugHistos.fill(HIST("debug/qa/h1TPCncrLowPPos"), track.tpcNClsCrossedRows());
39343981
}
3935-
if ((track.tpcInnerParam() >= 0.5f) && (track.tpcInnerParam() < 1.f)) {
3982+
if ((track.tpcInnerParam() >= cfgTpcClasses[0]) && (track.tpcInnerParam() < cfgTpcClasses[1])) {
39363983
debugHistos.fill(HIST("debug/qa/h1TPCncrMidPPos"), track.tpcNClsCrossedRows());
39373984
}
3938-
if (track.tpcInnerParam() >= 1.f) {
3985+
if (track.tpcInnerParam() >= cfgTpcClasses[1]) {
39393986
debugHistos.fill(HIST("debug/qa/h1TPCncrHighPPos"), track.tpcNClsCrossedRows());
39403987
}
39413988
} else {
39423989
debugHistos.fill(HIST("debug/qa/h2TPCncrVsPtNeg"), track.tpcInnerParam(), track.tpcNClsCrossedRows());
39433990
debugHistos.fill(HIST("debug/qa/h2TPCncrVsTPCsignalNeg"), track.tpcSignal(), track.tpcNClsCrossedRows());
39443991

3945-
if (track.tpcInnerParam() < 0.5f) {
3992+
if (track.tpcInnerParam() < cfgTpcClasses[0]) {
39463993
debugHistos.fill(HIST("debug/qa/h1TPCncrLowPNeg"), track.tpcNClsCrossedRows());
39473994
}
3948-
if ((track.tpcInnerParam() >= 0.5f) && (track.tpcInnerParam() < 1.f)) {
3995+
if ((track.tpcInnerParam() >= cfgTpcClasses[0]) && (track.tpcInnerParam() < cfgTpcClasses[1])) {
39493996
debugHistos.fill(HIST("debug/qa/h1TPCncrMidPNeg"), track.tpcNClsCrossedRows());
39503997
}
3951-
if (track.tpcInnerParam() >= 1.f) {
3998+
if (track.tpcInnerParam() >= cfgTpcClasses[1]) {
39523999
debugHistos.fill(HIST("debug/qa/h1TPCncrHighPNeg"), track.tpcNClsCrossedRows());
39534000
}
39544001
}
@@ -4961,7 +5008,7 @@ struct LFNucleiBATask {
49615008
track.passedTPCRefit() &&
49625009
track.hasTPC();
49635010

4964-
for (int i = 0; i < 10; i++) { // From ITS to TPC
5011+
for (int i = 0; i < kFakeLoop; i++) { // From ITS to TPC
49655012
if (track.mcMask() & 1 << i) {
49665013
hasFakeHit = true;
49675014
break;
@@ -6086,7 +6133,7 @@ struct LFNucleiBATask {
60866133
spectraGen.fill(HIST("histGenVetxZ"), mcCollision.posZ());
60876134
if (mcCollision.centFT0M() < cfgMultCutLow || mcCollision.centFT0M() > cfgMultCutHigh)
60886135
return;
6089-
for (auto& mcParticleGen : mcParticles) { // NOLINT
6136+
for (auto const& mcParticleGen : mcParticles) { // NOLINT
60906137
if (mcParticleGen.y() > kinemOptions.cfgRapidityCutHigh || mcParticleGen.y() < kinemOptions.cfgRapidityCutLow) {
60916138
continue;
60926139
}

0 commit comments

Comments
 (0)