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
55 changes: 55 additions & 0 deletions PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@
float dauVtx[3]{0.f, 0.f, 0.f};
auto daughters = particle.daughters_as<aod::McParticles>();
for (const auto& dau : daughters) {
if (abs(dau.pdgCode()) != 22 && abs(dau.pdgCode()) != 11) {

Check failure on line 358 in PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

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

Check failure on line 358 in PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
dauVtx[0] = dau.vx();
dauVtx[1] = dau.vy();
dauVtx[2] = dau.vz();
Expand Down Expand Up @@ -604,7 +604,7 @@
{nuclei::charges[4] * cfgMomentumScalingBetheBloch->get(3u, 0u) / nuclei::masses[4], nuclei::charges[4] * cfgMomentumScalingBetheBloch->get(3u, 1u) / nuclei::masses[4]}};

int nGloTracks[2]{0, 0}, nTOFTracks[2]{0, 0};
for (auto& track : tracks) { // start loop over tracks

Check failure on line 607 in PWGLF/TableProducer/Nuspex/nucleiSpectra.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 (std::abs(track.eta()) > cfgCutEta ||
track.tpcInnerParam() < cfgCutTpcMom ||
track.itsNCls() < cfgCutNclusITS ||
Expand Down Expand Up @@ -844,7 +844,7 @@
return;
}
fillDataInfo(collision, tracks);
for (auto& c : nuclei::candidates) {

Check failure on line 847 in PWGLF/TableProducer/Nuspex/nucleiSpectra.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 (c.fillTree) {
nucleiTable(c.pt, c.eta, c.phi, c.tpcInnerParam, c.beta, c.zVertex, c.nContrib, c.DCAxy, c.DCAz, c.TPCsignal, c.ITSchi2, c.TPCchi2, c.TOFchi2, c.flags, c.TPCfindableCls, c.TPCcrossedRows, c.ITSclsMap, c.TPCnCls, c.TPCnClsShared, c.clusterSizesITS);
}
Expand All @@ -856,7 +856,7 @@
}
}
}
for (auto& c : nuclei::candidates_flow) {

Check failure on line 859 in PWGLF/TableProducer/Nuspex/nucleiSpectra.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.
nucleiTableFlow(c.centFV0A, c.centFT0M, c.centFT0A, c.centFT0C, c.psiFT0A, c.psiFT0C, c.psiTPC, c.psiTPCl, c.psiTPCr, c.qFT0A, c.qFT0C, c.qTPC, c.qTPCl, c.qTPCr);
}
}
Expand All @@ -873,7 +873,7 @@
return;
}
fillDataInfo(collision, tracks);
for (auto& c : nuclei::candidates) {

Check failure on line 876 in PWGLF/TableProducer/Nuspex/nucleiSpectra.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 (c.fillTree) {
nucleiTable(c.pt, c.eta, c.phi, c.tpcInnerParam, c.beta, c.zVertex, c.nContrib, c.DCAxy, c.DCAz, c.TPCsignal, c.ITSchi2, c.TPCchi2, c.TOFchi2, c.flags, c.TPCfindableCls, c.TPCcrossedRows, c.ITSclsMap, c.TPCnCls, c.TPCnClsShared, c.clusterSizesITS);
}
Expand All @@ -885,7 +885,7 @@
}
}
}
for (auto& c : nuclei::candidates_flow) {

Check failure on line 888 in PWGLF/TableProducer/Nuspex/nucleiSpectra.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.
nucleiTableFlow(c.centFV0A, c.centFT0M, c.centFT0A, c.centFT0C, c.psiFT0A, c.psiFT0C, c.psiTPC, c.psiTPCl, c.psiTPCr, c.qFT0A, c.qFT0C, c.qTPC, c.qTPCl, c.qTPCr);
}
}
Expand All @@ -895,11 +895,11 @@
void processMC(soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels> const& collisions, aod::McCollisions const& mcCollisions, soa::Join<TrackCandidates, aod::McTrackLabels> const& tracks, aod::McParticles const& particlesMC, aod::BCsWithTimestamps const&)
{
nuclei::candidates.clear();
for (auto& c : mcCollisions) {

Check failure on line 898 in PWGLF/TableProducer/Nuspex/nucleiSpectra.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.
spectra.fill(HIST("hGenVtxZ"), c.posZ());
}
std::vector<bool> goodCollisions(mcCollisions.size(), false);
for (auto& collision : collisions) {

Check failure on line 902 in PWGLF/TableProducer/Nuspex/nucleiSpectra.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 (!eventSelection(collision)) {
continue;
}
Expand All @@ -908,7 +908,7 @@
fillDataInfo(collision, slicedTracks);
}
std::vector<bool> isReconstructed(particlesMC.size(), false);
for (auto& c : nuclei::candidates) {

Check failure on line 911 in PWGLF/TableProducer/Nuspex/nucleiSpectra.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.
auto label = tracks.iteratorAt(c.globalIndex);
if (label.mcParticleId() < -1 || label.mcParticleId() >= particlesMC.size()) {
continue;
Expand Down Expand Up @@ -1052,6 +1052,61 @@
}

PROCESS_SWITCH(nucleiSpectra, processMatching, "Matching analysis", false);

void processMCasData(soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels> const& collisions, aod::McCollisions const& mcCollisions, soa::Join<TrackCandidates, aod::McTrackLabels> const& tracks, aod::McParticles const& particlesMC, aod::BCsWithTimestamps const&)
{
nuclei::candidates.clear();
std::vector<bool> goodCollisions(mcCollisions.size(), false);
for (auto& collision : collisions) {
if (!eventSelection(collision)) {
continue;
}
goodCollisions[collision.mcCollisionId()] = true;
const auto& slicedTracks = tracks.sliceBy(tracksPerCollisions, collision.globalIndex());
fillDataInfo(collision, slicedTracks);
}
std::vector<bool> isReconstructed(particlesMC.size(), false);
for (size_t i{0}; i < nuclei::candidates.size(); ++i) {
auto& c = nuclei::candidates[i];
if (c.fillTree) {
auto label = tracks.iteratorAt(c.globalIndex);
if (label.mcParticleId() < -1 || label.mcParticleId() >= particlesMC.size()) {
continue;
}
auto particle = particlesMC.iteratorAt(label.mcParticleId());
int motherPdgCode = 0;
float motherDecRadius = -1;
isReconstructed[particle.globalIndex()] = true;
if (particle.isPhysicalPrimary()) {
c.flags |= kIsPhysicalPrimary;
if (particle.has_mothers()) {
for (auto& motherparticle : particle.mothers_as<aod::McParticles>()) {
if (std::find(nuclei::hfMothCodes.begin(), nuclei::hfMothCodes.end(), std::abs(motherparticle.pdgCode())) != nuclei::hfMothCodes.end()) {
c.flags |= kIsSecondaryFromWeakDecay;
motherPdgCode = motherparticle.pdgCode();
motherDecRadius = std::hypot(particle.vx() - motherparticle.vx(), particle.vy() - motherparticle.vy());
break;
}
}
}
} else if (particle.has_mothers()) {
c.flags |= kIsSecondaryFromWeakDecay;
for (auto& motherparticle : particle.mothers_as<aod::McParticles>()) {
motherPdgCode = motherparticle.pdgCode();
motherDecRadius = std::hypot(particle.vx() - motherparticle.vx(), particle.vy() - motherparticle.vy());
}
} else {
c.flags |= kIsSecondaryFromMaterial;
}

isReconstructed[particle.globalIndex()] = true;
float absoDecL = computeAbsoDecL(particle);

nucleiTableMC(c.pt, c.eta, c.phi, c.tpcInnerParam, c.beta, c.zVertex, c.nContrib, c.DCAxy, c.DCAz, c.TPCsignal, c.ITSchi2, c.TPCchi2, c.TOFchi2, c.flags, c.TPCfindableCls, c.TPCcrossedRows, c.ITSclsMap, c.TPCnCls, c.TPCnClsShared, c.clusterSizesITS, goodCollisions[particle.mcCollisionId()], particle.pt(), particle.eta(), particle.phi(), particle.pdgCode(), motherPdgCode, motherDecRadius, absoDecL);
}
}
}
PROCESS_SWITCH(nucleiSpectra, processMCasData, "MC as data analysis", false);
};

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
Expand Down
Loading