Skip to content
Merged
Changes from all 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
83 changes: 59 additions & 24 deletions PWGLF/Tasks/Nuspex/nucleiFromHypertritonMap.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <TRandom.h>
#include <TVector2.h>
#include <TVector3.h>
#include <TDatabasePDG.h>

Check warning on line 21 in PWGLF/Tasks/Nuspex/nucleiFromHypertritonMap.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/database]

Do not use TDatabasePDG directly. Use o2::constants::physics::Mass... or Service<o2::framework::O2DatabasePDG> instead.
#include "Framework/runDataProcessing.h"
#include "Framework/AnalysisTask.h"
#include "Framework/AnalysisDataModel.h"
Expand Down Expand Up @@ -72,10 +72,10 @@
Configurable<int> nbin_dca = {"nbin_dca", 50, "number of DCA bins"};
Configurable<bool> saveHelium{"saveHelium", false, "Save helium candidates"};

int AntideuteronPDG = -1000010020;

Check warning on line 75 in PWGLF/Tasks/Nuspex/nucleiFromHypertritonMap.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid using hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
int AntihePDG = -1000020030;

Check warning on line 76 in PWGLF/Tasks/Nuspex/nucleiFromHypertritonMap.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid using hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
int AntiHypertritonPDG = -1010010030;

Check warning on line 77 in PWGLF/Tasks/Nuspex/nucleiFromHypertritonMap.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid using hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
int AntiHyperHelium4PDG = -1010020040;

Check warning on line 78 in PWGLF/Tasks/Nuspex/nucleiFromHypertritonMap.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid using hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.

void init(InitContext const&)
{
Expand All @@ -84,53 +84,88 @@
registryMC.add("he3SecPtRec_from_hypertriton", "he3SecPtRec_from_hypertriton", HistType::kTH1F, {{nbin_pt, min_pt, max_pt, "p_{T} (GeV/c)"}});
registryMC.add("hyperHe4Ptgen", "hyperHe4PtGen", HistType::kTH1F, {{nbin_pt, min_pt, max_pt, "p_{T} (GeV/c)"}});
registryMC.add("he3SecPtRec_from_hyperHe4", "he3SecPtRec_from_hyperHe4", HistType::kTH1F, {{nbin_pt, min_pt, max_pt, "p_{T} (GeV/c)"}});
registryMC.add("he3PtRec", "he3PtRec", HistType::kTH1F, {{nbin_pt, min_pt, max_pt, "p_{T} (GeV/c)"}});
registryMC.add("he3PtGen", "he3PtGen", HistType::kTH1F, {{nbin_pt, min_pt, max_pt, "p_{T} (GeV/c)"}});
} else {
registryMC.add("deutSecPtRec_from_hypertriton", "deutSecPtRec_from_hypertriton", HistType::kTH1F, {{nbin_pt, min_pt, max_pt, "p_{T} (GeV/c)"}});
registryMC.add("deutPtRec", "deutPtRec", HistType::kTH1F, {{nbin_pt, min_pt, max_pt, "p_{T} (GeV/c)"}});
registryMC.add("deutPtgen", "deutPtGen", HistType::kTH1F, {{nbin_pt, min_pt, max_pt, "p_{T} (GeV/c)"}});
}
}

void processMC(aod::McParticles const& /*mcParticles*/, const MCTracks& tracks)
void processMC(const aod::McParticles& mcParticles, const MCTracks& tracks)
{
int selectedPDG = 0;
if (saveHelium) {
selectedPDG = AntihePDG;
} else {
selectedPDG = AntideuteronPDG;
}

for (const auto& mcparticle : mcParticles) {
if (((mcparticle.pdgCode() == AntiHypertritonPDG || mcparticle.pdgCode() == AntiHyperHelium4PDG) && mcparticle.has_daughters()) || mcparticle.pdgCode() == selectedPDG) {
if (mcparticle.pdgCode() == AntiHypertritonPDG) {
for (auto& daughter : mcparticle.daughters_as<aod::McParticles>()) {

Check warning on line 108 in PWGLF/Tasks/Nuspex/nucleiFromHypertritonMap.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
if (daughter.pdgCode() == selectedPDG) {
registryMC.fill(HIST("hypertritonPtgen"), mcparticle.pt());
}
}
}
if (mcparticle.pdgCode() == AntiHyperHelium4PDG) {
for (auto& daughter : mcparticle.daughters_as<aod::McParticles>()) {

Check warning on line 115 in PWGLF/Tasks/Nuspex/nucleiFromHypertritonMap.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
if (daughter.pdgCode() == selectedPDG) {
registryMC.fill(HIST("hyperHe4Ptgen"), mcparticle.pt());
}
}
}
if (mcparticle.pdgCode() == AntihePDG) {
registryMC.fill(HIST("he3PtGen"), mcparticle.pt());
}
if (mcparticle.pdgCode() == AntideuteronPDG) {
registryMC.fill(HIST("deutPtGen"), mcparticle.pt());
}
}
}

for (const auto& track : tracks) {
if (!track.has_mcParticle()) {
continue;
}
auto mcparticle = track.mcParticle();
if (saveHelium) {
if (mcparticle.pdgCode() != AntihePDG || mcparticle.isPhysicalPrimary()) {
continue;
}
} else {
if (mcparticle.pdgCode() != AntideuteronPDG || mcparticle.isPhysicalPrimary()) {
continue;
}
if (mcparticle.pdgCode() != selectedPDG) {
continue;
}

if (track.itsNCls() < min_ITS_nClusters ||
track.tpcNClsFound() < min_TPC_nClusters ||
track.tpcNClsCrossedRows() < min_TPC_nCrossedRows ||
track.tpcNClsCrossedRows() < 0.8 * track.tpcNClsFindable() ||

Check warning on line 142 in PWGLF/Tasks/Nuspex/nucleiFromHypertritonMap.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
track.tpcChi2NCl() > 4.f ||

Check warning on line 143 in PWGLF/Tasks/Nuspex/nucleiFromHypertritonMap.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
track.tpcChi2NCl() < min_chi2_TPC ||
track.eta() < min_eta || track.eta() > max_eta ||
track.dcaXY() > max_dcaxy || track.dcaXY() < -max_dcaxy ||
track.dcaZ() > max_dcaz || track.dcaZ() < -max_dcaz ||
track.itsChi2NCl() > 36.f) {
continue;
}
if (mcparticle.pdgCode() == AntideuteronPDG) {
registryMC.fill(HIST("deutPtRec"), track.pt());
}
if (mcparticle.pdgCode() == AntihePDG) {
registryMC.fill(HIST("he3PtRec"), 2 * track.pt());
}

for (auto& motherparticle : mcparticle.mothers_as<aod::McParticles>()) {

Check warning on line 158 in PWGLF/Tasks/Nuspex/nucleiFromHypertritonMap.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
if (motherparticle.pdgCode() == AntiHypertritonPDG || motherparticle.pdgCode() == AntiHyperHelium4PDG) {
if (track.itsNCls() < min_ITS_nClusters ||
track.tpcNClsFound() < min_TPC_nClusters ||
track.tpcNClsCrossedRows() < min_TPC_nCrossedRows ||
track.tpcNClsCrossedRows() < 0.8 * track.tpcNClsFindable() ||
track.tpcChi2NCl() > 4.f ||
track.tpcChi2NCl() < min_chi2_TPC ||
track.eta() < min_eta || track.eta() > max_eta ||
track.dcaXY() > max_dcaxy || track.dcaXY() < -max_dcaxy ||
track.dcaZ() > max_dcaz || track.dcaZ() < -max_dcaz ||
track.itsChi2NCl() > 36.f) {
continue;
}
if (motherparticle.pdgCode() == AntiHypertritonPDG) {
registryMC.fill(HIST("hypertritonPtgen"), motherparticle.pt());
if (saveHelium) {
if (mcparticle.pdgCode() == AntihePDG) {
registryMC.fill(HIST("he3SecPtRec_from_hypertriton"), 2 * track.pt());
} else {
registryMC.fill(HIST("deutSecPtRec_from_hypertriton"), track.pt());
}
}
if (motherparticle.pdgCode() == AntiHyperHelium4PDG) {
registryMC.fill(HIST("he3SecPtRec_from_hyperHe4"), 2 * track.pt());
registryMC.fill(HIST("hyperHe4Ptgen"), motherparticle.pt());
}
}
}
Expand Down
Loading