Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
193 changes: 134 additions & 59 deletions PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.

Check failure on line 1 in PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/file-cpp]

Use lowerCamelCase or UpperCamelCase for names of C++ files. See the O2 naming conventions for details.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand Down Expand Up @@ -71,7 +71,7 @@
Configurable<bool> enableAl{"enableAl", true, "Flag to enable alpha analysis."};

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

Check failure on line 74 in PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

  • This will not work.
  • Silencing is not well justified here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vkucera I have seen that ccdburl variable is usually written all lowercase in most of the analyses and I don't want to change it

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you prefer, but majority by copy-pasting does not make things correct.
Regardless, your directive is silencing cpplint, not O2 linter.


// Set the triggered events skimming scheme
struct : ConfigurableGroup {
Expand Down Expand Up @@ -214,6 +214,15 @@

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

// ITS to TPC - Fake hit loop
static constexpr int kFakeLoop = 10; // Fixed O2Linter error
// TPC low/high momentum range
static constexpr float kCfgTpcClasses[] = {0.5f, 0.1f};
static constexpr float kCfgKaonCut = 5.f;

// Weak-decay flag
static constexpr int kProcessWeakDecay = 4;
Comment thread
vkucera marked this conversation as resolved.
Outdated

// PDG codes and masses used in this analysis
static constexpr int PDGPion = PDG_t::kPiPlus;
static constexpr int PDGKaon = PDG_t::kKPlus;
Expand All @@ -231,19 +240,32 @@

// PDG of Mothers
static constexpr int kPdgMotherlist[] = {
PDGProton, // proton
PDGPion, // pi+
PDGKaon, // K+
311, // K0
PDGDeuteron, // deuteron
PDGTriton, // triton
PDGHelium, // He-3
PDGAlpha, // Alpha
1000130270, // Aluminium
1000140280, // Silicon
1000260560 // Iron
};
PDGPion,
PDGKaon,
311,
PDGProton,
PDGDeuteron,
PDGTriton,
PDGHelium,
PDGAlpha,
1000130270,
1000140280,
1000260560};
Comment thread
vkucera marked this conversation as resolved.
Outdated
static constexpr int kNumMotherlist = sizeof(kPdgMotherlist) / sizeof(kPdgMotherlist[0]);

static constexpr const char* kMotherNames[kNumMotherlist] = {
"#pi",
"K+",
"K0",
"p",
"d",
"t",
"He3",
"#alpha",
"Al",
"Si",
"Fe"};

static constexpr int kMaxNumMom = 4; // X: 0..4, overflow=5

template <typename TrackType>
Expand Down Expand Up @@ -949,6 +971,26 @@
histos.add<TH2>("tracks/deuteron/dca/before/hDCAxyVsPtDeuteronTruePrim", "DCAxy vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}});
histos.add<TH2>("tracks/deuteron/dca/before/hDCAxyVsPtDeuteronTrueSec", "DCAxy vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}});
histos.add<TH2>("tracks/deuteron/dca/before/hDCAxyVsPtDeuteronTrueMaterial", "DCAxy vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}});

histos.add<TH1>("tracks/deuteron/dca/before/hNumMothers", "N mothers per particle; N mothers;counts", HistType::kTH1I, {{7, 1.0, 8.0}});
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}});

std::shared_ptr<TH3> hTempDe = histos.get<TH3>(HIST("tracks/deuteron/dca/before/hMomTrueMaterial"));
TH3* hPdgDe = hTempDe.get();

TAxis* axPdgDe = hPdgDe->GetXaxis();
for (int i = 0; i <= kMaxNumMom; i++) {
axPdgDe->SetBinLabel(i + 1, Form("%d", i));
}
axPdgDe->SetBinLabel(kMaxNumMom + 2, ">=5");

TAxis* ayPdgDe = hPdgDe->GetYaxis();
ayPdgDe->SetBinLabel(1, "undef.");
ayPdgDe->SetBinLabel(2, "other");
for (int i = 0; i < kNumMotherlist; i++) {
ayPdgDe->SetBinLabel(i + 3, kMotherNames[i]);
}

histos.add<TH2>("tracks/deuteron/dca/before/hDCAxyVsPtDeuteronTrueTransport", "DCAxy vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}});

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}});
Expand Down Expand Up @@ -1146,22 +1188,24 @@
histos.add<TH2>("tracks/helium/dca/before/hDCAxyVsPtHeliumTrueSec", "DCAxy vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}});
histos.add<TH2>("tracks/helium/dca/before/hDCAxyVsPtHeliumTrueMaterial", "DCAxy vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}});

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}});
histos.add<TH1>("tracks/helium/dca/before/hNumMothers", "N mothers per particle; N mothers;counts", HistType::kTH1I, {{7, 1.0, 8.0}});
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}});

// Fix for getting TH2 pointer
std::shared_ptr<TH2> hTemp = histos.get<TH2>(HIST("tracks/helium/dca/before/hMomTrueMaterial"));
TH2* hPDG = hTemp.get();
// Fix for getting TH3 pointer
std::shared_ptr<TH3> hTempHe = histos.get<TH3>(HIST("tracks/helium/dca/before/hMomTrueMaterial"));
TH3* hPdgHe = hTempHe.get();

TAxis* axPDG = hPDG->GetXaxis();
for (int i = 0; i <= kMaxNumMom; ++i) {
axPDG->SetBinLabel(i + 1, Form("%d", i));
TAxis* axPdgHe = hPdgHe->GetXaxis();
for (int i = 0; i <= kMaxNumMom; i++) {
axPdgHe->SetBinLabel(i + 1, Form("%d", i));
}
axPDG->SetBinLabel(kMaxNumMom + 2, ">=5");
TAxis* ayPDG = hPDG->GetYaxis();
ayPDG->SetBinLabel(1, "-1"); // undefined
ayPDG->SetBinLabel(2, "0"); // other
for (int i = 0; i < kNumMotherlist; ++i) {
ayPDG->SetBinLabel(i + 3, Form("%d", kPdgMotherlist[i]));
axPdgHe->SetBinLabel(kMaxNumMom + 2, ">=5");

TAxis* ayPdgHe = hPdgHe->GetYaxis();
ayPdgHe->SetBinLabel(1, "undef.");
ayPdgHe->SetBinLabel(2, "other");
for (int i = 0; i < kNumMotherlist; i++) {
ayPdgHe->SetBinLabel(i + 3, kMotherNames[i]);
}

histos.add<TH2>("tracks/helium/dca/before/hDCAxyVsPtHeliumTrueTransport", "DCAxy vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}});
Expand Down Expand Up @@ -2655,15 +2699,15 @@
if constexpr (IsFilteredData) {
isPhysPrim = track.isPhysicalPrimary();
isProdByGen = track.producedByGenerator();
isWeakDecay = track.getProcess() == 4; // NOLINT
isWeakDecay = (track.getProcess() == kProcessWeakDecay);
pdgCode = track.pdgCode();
} else {
if (!track.has_mcParticle()) {
continue;
}
isPhysPrim = track.mcParticle().isPhysicalPrimary();
isProdByGen = track.mcParticle().producedByGenerator();
isWeakDecay = track.mcParticle().getProcess() == 4; // NOLINT
isWeakDecay = (track.mcParticle().getProcess() == kProcessWeakDecay);
pdgCode = track.mcParticle().pdgCode();
}

Expand Down Expand Up @@ -3158,16 +3202,19 @@
int pdgMom = 0;
// gen Pt
float genPt = 0;
float ptMom = 0;
// Mothers variables
[[maybe_unused]] int firstMotherId = -1;
[[maybe_unused]] int firstMotherPdg = -1;
[[maybe_unused]] int pdgList[8];
[[maybe_unused]] float firstMotherPt = -1.f;
[[maybe_unused]] int pdgMomList[kMaxNumMom];
[[maybe_unused]] float ptMomList[kMaxNumMom];
[[maybe_unused]] int nSaved = 0;

if constexpr (IsFilteredData) {
isPhysPrim = track.isPhysicalPrimary();
isProdByGen = track.producedByGenerator();
isWeakDecay = track.getProcess() == 4; // NOLINT
isWeakDecay = (track.getProcess() == kProcessWeakDecay);
pdgCode = track.pdgCode();
genPt = std::sqrt(std::pow(track.px(), 2) + std::pow(track.py(), 2));

Expand All @@ -3177,7 +3224,7 @@
}
isPhysPrim = track.mcParticle().isPhysicalPrimary();
isProdByGen = track.mcParticle().producedByGenerator();
isWeakDecay = track.mcParticle().getProcess() == 4; // NOLINT
isWeakDecay = (track.mcParticle().getProcess() == kProcessWeakDecay);
pdgCode = track.mcParticle().pdgCode();

// Access to MC particles mother
Expand All @@ -3186,28 +3233,32 @@
const int nMothers = static_cast<int>(motherIds.size());
firstMotherId = -1;
firstMotherPdg = -1;

firstMotherPt = -1.f;
nSaved = 0;

for (int iMom = 0; iMom < nMothers; ++iMom) {
for (int iMom = 0; iMom < nMothers; iMom++) {
int motherId = motherIds[iMom];
if (motherId < 0 || motherId >= particles.size()) {
continue; // added check on mother
}
o2::aod::McParticles::iterator mother = particles.iteratorAt(motherId);
pdgMom = mother.pdgCode();
ptMom = mother.pt();

if (iMom == 0) {
firstMotherId = motherId;
firstMotherPdg = pdgMom;
firstMotherPt = ptMom;
}
if (nSaved < 8) {
pdgList[nSaved++] = pdgMom;
if (nSaved < kMaxNumMom) {
pdgMomList[nSaved] = pdgMom;
ptMomList[nSaved] = ptMom;
nSaved++;
}
}

genPt = track.mcParticle().pt();
for (int i = 0; i < 10; i++) { // From ITS to TPC
for (int i = 0; i < kFakeLoop; i++) { // From ITS to TPC
if (track.mcMask() & 1 << i) {
hasFakeHit = true;
break;
Expand Down Expand Up @@ -3308,10 +3359,32 @@
if (!isPhysPrim && !isProdByGen) {
if (outFlagOptions.makeDCABeforeCutPlots) {
histos.fill(HIST("tracks/deuteron/dca/before/hDCAxyVsPtDeuteronTrueTransport"), DPt, track.dcaXY());
if (isWeakDecay)
if (isWeakDecay) {
histos.fill(HIST("tracks/deuteron/dca/before/hDCAxyVsPtDeuteronTrueSec"), DPt, track.dcaXY());
else
} else {
histos.fill(HIST("tracks/deuteron/dca/before/hDCAxyVsPtDeuteronTrueMaterial"), DPt, track.dcaXY());
if constexpr (!IsFilteredData) {
histos.fill(HIST("tracks/deuteron/dca/before/hNumMothers"), nSaved);
if (nSaved > 0) {
for (int iMom = 0; iMom < nSaved; iMom++) {
int motherIndexBin = (iMom <= kMaxNumMom) ? iMom : (kMaxNumMom + 1);
int pdgMom = pdgMomList[iMom];
float ptMom = ptMomList[iMom];
int motherSpeciesBin = -1;
if (pdgMom != -1) {
motherSpeciesBin = 0;
for (int j = 0; j < kNumMotherlist; j++) {
if (kPdgMotherlist[j] == pdgMom) {
motherSpeciesBin = j + 1;
break;
}
}
}
histos.fill(HIST("tracks/deuteron/dca/before/hMomTrueMaterial"), motherIndexBin, motherSpeciesBin, ptMom);
}
}
}
}
if (track.hasTOF() && outFlagOptions.doTOFplots) {
histos.fill(HIST("tracks/deuteron/dca/before/TOF/hDCAxyVsPtDeuteronTrueTransport"), DPt, track.dcaXY());
if (isWeakDecay)
Expand Down Expand Up @@ -3472,21 +3545,23 @@
} else {
histos.fill(HIST("tracks/helium/dca/before/hDCAxyVsPtHeliumTrueMaterial"), hePt, track.dcaXY());
if (!IsFilteredData) {
histos.fill(HIST("tracks/helium/dca/before/hNumMothers"), nSaved);
if (nSaved > 0) {
for (int i = 0; i < nSaved; ++i) {
int idxComp = (i <= kMaxNumMom) ? i : (kMaxNumMom + 1);
int pdgMom = pdgList[i];
int yVal = -1;
for (int iMom = 0; iMom < nSaved; iMom++) {
int motherIndexBin = (iMom <= kMaxNumMom) ? iMom : (kMaxNumMom + 1);
int pdgMom = pdgMomList[iMom];
float ptMom = ptMomList[iMom];
int motherSpeciesBin = -1;
if (pdgMom != -1) {
yVal = 0;
for (int j = 0; j < kNumMotherlist; ++j) {
motherSpeciesBin = 0;
for (int j = 0; j < kNumMotherlist; j++) {
if (kPdgMotherlist[j] == pdgMom) {
yVal = j + 1;
motherSpeciesBin = j + 1;
break;
}
}
}
histos.fill(HIST("tracks/helium/dca/before/hMomTrueMaterial"), idxComp, yVal);
histos.fill(HIST("tracks/helium/dca/before/hMomTrueMaterial"), motherIndexBin, motherSpeciesBin, ptMom);
}
}
}
Expand Down Expand Up @@ -3902,26 +3977,26 @@
debugHistos.fill(HIST("debug/qa/h2TPCncrVsPtPos"), track.tpcInnerParam(), track.tpcNClsCrossedRows());
debugHistos.fill(HIST("debug/qa/h2TPCncrVsTPCsignalPos"), track.tpcSignal(), track.tpcNClsCrossedRows());

if (track.tpcInnerParam() < 0.5f) {
if (track.tpcInnerParam() < kCfgTpcClasses[0]) {
debugHistos.fill(HIST("debug/qa/h1TPCncrLowPPos"), track.tpcNClsCrossedRows());
}
if ((track.tpcInnerParam() >= 0.5f) && (track.tpcInnerParam() < 1.f)) {
if ((track.tpcInnerParam() >= kCfgTpcClasses[0]) && (track.tpcInnerParam() < kCfgTpcClasses[1])) {
debugHistos.fill(HIST("debug/qa/h1TPCncrMidPPos"), track.tpcNClsCrossedRows());
}
if (track.tpcInnerParam() >= 1.f) {
if (track.tpcInnerParam() >= kCfgTpcClasses[1]) {
debugHistos.fill(HIST("debug/qa/h1TPCncrHighPPos"), track.tpcNClsCrossedRows());
}
} else {
debugHistos.fill(HIST("debug/qa/h2TPCncrVsPtNeg"), track.tpcInnerParam(), track.tpcNClsCrossedRows());
debugHistos.fill(HIST("debug/qa/h2TPCncrVsTPCsignalNeg"), track.tpcSignal(), track.tpcNClsCrossedRows());

if (track.tpcInnerParam() < 0.5f) {
if (track.tpcInnerParam() < kCfgTpcClasses[0]) {
debugHistos.fill(HIST("debug/qa/h1TPCncrLowPNeg"), track.tpcNClsCrossedRows());
}
if ((track.tpcInnerParam() >= 0.5f) && (track.tpcInnerParam() < 1.f)) {
if ((track.tpcInnerParam() >= kCfgTpcClasses[0]) && (track.tpcInnerParam() < kCfgTpcClasses[1])) {
debugHistos.fill(HIST("debug/qa/h1TPCncrMidPNeg"), track.tpcNClsCrossedRows());
}
if (track.tpcInnerParam() >= 1.f) {
if (track.tpcInnerParam() >= kCfgTpcClasses[1]) {
debugHistos.fill(HIST("debug/qa/h1TPCncrHighPNeg"), track.tpcNClsCrossedRows());
}
}
Expand All @@ -3934,7 +4009,7 @@
histos.fill(HIST("tracks/eff/h2pVsTPCmomentum"), track.tpcInnerParam(), track.p());

if (filterOptions.enableFiltering) {
if (track.tpcNSigmaKa() < 5)
if (track.tpcNSigmaKa() < kCfgKaonCut)
continue;
}

Expand Down Expand Up @@ -4908,7 +4983,7 @@
if constexpr (IsFilteredData) {
isPhysPrim = track.isPhysicalPrimary();
isProdByGen = track.producedByGenerator();
isWeakDecay = track.getProcess() == 4;
isWeakDecay = (track.getProcess() == kProcessWeakDecay);
pdgCode = track.pdgCode();
isItsPassed = track.itsPassed();
isTpcPassed = track.tpcPassed();
Expand All @@ -4920,7 +4995,7 @@
}
isPhysPrim = track.mcParticle().isPhysicalPrimary();
isProdByGen = track.mcParticle().producedByGenerator();
isWeakDecay = track.mcParticle().getProcess() == 4;
isWeakDecay = (track.mcParticle().getProcess() == kProcessWeakDecay);
pdgCode = track.mcParticle().pdgCode();
isItsPassed = track.passedITSNCls() &&
track.passedITSChi2NDF() &&
Expand All @@ -4934,7 +5009,7 @@
track.passedTPCRefit() &&
track.hasTPC();

for (int i = 0; i < 10; i++) { // From ITS to TPC
for (int i = 0; i < kFakeLoop; i++) { // From ITS to TPC
if (track.mcMask() & 1 << i) {
hasFakeHit = true;
break;
Expand Down Expand Up @@ -6059,14 +6134,14 @@
spectraGen.fill(HIST("histGenVetxZ"), mcCollision.posZ());
if (mcCollision.centFT0M() < cfgMultCutLow || mcCollision.centFT0M() > cfgMultCutHigh)
return;
for (auto& mcParticleGen : mcParticles) { // NOLINT
for (auto const& mcParticleGen : mcParticles) { // NOLINT
if (mcParticleGen.y() > kinemOptions.cfgRapidityCutHigh || mcParticleGen.y() < kinemOptions.cfgRapidityCutLow) {
continue;
}

bool isPhysPrim = mcParticleGen.isPhysicalPrimary();
bool isProdByGen = mcParticleGen.producedByGenerator();
bool isWeakDecay = mcParticleGen.getProcess() == 4;
bool isWeakDecay = (mcParticleGen.getProcess() == kProcessWeakDecay);

if (mcParticleGen.pdgCode() == PDGPion) {
spectraGen.fill(HIST("pion/histGenPtPion"), mcParticleGen.pt());
Expand Down Expand Up @@ -6324,7 +6399,7 @@
for (const auto& mcPart : mcParticles) {
if (!mcPart.isPhysicalPrimary())
continue;
if (std::abs(mcPart.y()) >= 0.5)
if (std::abs(mcPart.y()) >= kCfgTpcClasses[0])
continue;
if (mcPart.pdgCode() == PDGDeuteron) {
evLossHistos.fill(HIST("evLoss/pt/hDeuteronGen"), mcPart.pt());
Expand Down
Loading