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
106 changes: 58 additions & 48 deletions PWGLF/TableProducer/Nuspex/nucleiSpectra.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/TableProducer/Nuspex/nucleiSpectra.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/workflow-file]

Name of a workflow file must match the name of the main struct in it (without the PWG prefix). (Class implementation files should be in "Core" directories.)

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

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-task]

Specify task name only when it cannot be derived from the struct name. Only append to the default name.
// 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 @@ -51,9 +51,10 @@
#include "Framework/runDataProcessing.h"
#include "ReconstructionDataFormats/Track.h"

#include "Math/Vector4D.h"
#include "TRandom3.h"
#include <Math/Vector4D.h>
#include <TMCProcess.h>
#include <TPDGCode.h> // for PDG codes
#include <TRandom3.h>

#include <algorithm>
#include <cmath>
Expand Down Expand Up @@ -118,6 +119,7 @@

namespace nuclei
{
constexpr int nITSlayers = 7;
constexpr double bbMomScalingDefault[5][2]{
{1., 1.},
{1., 1.},
Expand Down Expand Up @@ -272,25 +274,33 @@

Configurable<bool> cfgCompensatePIDinTracking{"cfgCompensatePIDinTracking", false, "If true, divide tpcInnerParam by the electric charge"};

struct : o2::framework::ConfigurableGroup {
std::string prefix{"cfgTrackCut"};
Configurable<LabeledArray<double>> DcaMax{"DcaMax", {nuclei::DCAcutDefault[0], 5, 2, nuclei::names, nuclei::nDCAConfigName}, "Max DCAxy and DCAz for light nuclei"};

Check failure on line 279 in PWGLF/TableProducer/Nuspex/nucleiSpectra.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.)
Configurable<float> EtaMax{"EtaMax", 0.8f, "Max Eta for tracks"};

Check failure on line 280 in PWGLF/TableProducer/Nuspex/nucleiSpectra.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.)
Configurable<int> ITSnClusMin{"ITSnClsMin", 5, "Minimum number of ITS clusters"};
Configurable<float> ITSchi2ClusMax{"ITSchi2ClusMax", 36.f, "Max ITS Chi2 per cluster"};
Configurable<float> RapidityMax{"RapidityMax", 1.f, "Maximum rapidity for tracks"};
Configurable<float> RapidityMin{"RapidityMin", -1.f, "Minimum rapidity for tracks"};
Configurable<bool> RapidityToggle{"RapidityToggle", false, "If true, use rapidity cuts"};
Configurable<float> TPCchi2ClusMax{"TPCchi2ClusMax", 4.f, "Max TPC Chi2 per cluster"};
Configurable<int> TPCnCrossedRowsMin{"TPCnCrossedRowsMin", 70, "Minimum number of TPC crossed rows"};
Configurable<float> TPCnCrossedRowsOverFindableMin{"TPCnCrossedRowsOverFindableMin", 0.8f, "Minimum ratio of crossed rows over findable clusters"};
Configurable<int> TPCnClsMin{"TPCnClsMin", 80, "Minimum number of TPC clusters"};
Configurable<float> TPCrigidityMin{"TPCrigidityMin", 0.5f, "Minimum TPC rigidity for tracks"};
Configurable<LabeledArray<double>> TPCnSigmaMax{"TPCnSigmaMax", {nuclei::nSigmaTPCdefault[0], 5, 2, nuclei::names, nuclei::nSigmaConfigName}, "TPC nsigma selection for light nuclei"};

} cfgTrackCut;
Configurable<int> cfgCentralityEstimator{"cfgCentralityEstimator", 0, "Centrality estimator (FV0A: 0, FT0M: 1, FT0A: 2, FT0C: 3)"};
Configurable<float> cfgCMrapidity{"cfgCMrapidity", 0.f, "Rapidity of the center of mass (only for p-Pb)"};
Configurable<float> cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"};
Configurable<float> cfgCutEta{"cfgCutEta", 0.8f, "Eta range for tracks"};
Configurable<float> cfgCutTpcMom{"cfgCutTpcMom", 0.2f, "Minimum TPC momentum for tracks"};
Configurable<float> cfgCutRapidityMin{"cfgCutRapidityMin", -1., "Minimum rapidity for tracks"};
Configurable<float> cfgCutRapidityMax{"cfgCutRapidityMax", 1., "Maximum rapidity for tracks"};
Configurable<bool> cfgCutOnReconstructedRapidity{"cfgCutOnReconstructedRapidity", false, "Cut on reconstructed rapidity"};
Configurable<float> cfgCutNclusITS{"cfgCutNclusITS", 5, "Minimum number of ITS clusters"};
Configurable<float> cfgCutNclusTPC{"cfgCutNclusTPC", 70, "Minimum number of TPC clusters"};
Configurable<float> cfgCutPtMinTree{"cfgCutPtMinTree", 0.2f, "Minimum track transverse momentum for tree saving"};
Configurable<float> cfgCutPtMaxTree{"cfgCutPtMaxTree", 15.0f, "Maximum track transverse momentum for tree saving"};

Configurable<LabeledArray<int>> cfgEventSelections{"cfgEventSelections", {nuclei::EvSelDefault[0], 8, 1, nuclei::eventSelectionLabels, nuclei::eventSelectionTitle}, "Event selections"};

Configurable<LabeledArray<double>> cfgMomentumScalingBetheBloch{"cfgMomentumScalingBetheBloch", {nuclei::bbMomScalingDefault[0], 5, 2, nuclei::names, nuclei::chargeLabelNames}, "TPC Bethe-Bloch momentum scaling for light nuclei"};
Configurable<LabeledArray<double>> cfgBetheBlochParams{"cfgBetheBlochParams", {nuclei::betheBlochDefault[0], 5, 6, nuclei::names, nuclei::betheBlochParNames}, "TPC Bethe-Bloch parameterisation for light nuclei"};
Configurable<LabeledArray<double>> cfgNsigmaTPC{"cfgNsigmaTPC", {nuclei::nSigmaTPCdefault[0], 5, 2, nuclei::names, nuclei::nSigmaConfigName}, "TPC nsigma selection for light nuclei"};
Configurable<LabeledArray<double>> cfgDCAcut{"cfgDCAcut", {nuclei::DCAcutDefault[0], 5, 2, nuclei::names, nuclei::nDCAConfigName}, "Max DCAxy and DCAz for light nuclei"};
Configurable<LabeledArray<double>> cfgDownscaling{"cfgDownscaling", {nuclei::DownscalingDefault[0], 5, 1, nuclei::names, nuclei::DownscalingConfigName}, "Fraction of kept candidates for light nuclei"};
Configurable<LabeledArray<int>> cfgTreeConfig{"cfgTreeConfig", {nuclei::TreeConfigDefault[0], 5, 2, nuclei::names, nuclei::treeConfigNames}, "Filtered trees configuration"};
Configurable<bool> cfgFillPairTree{"cfgFillPairTree", true, "Fill trees for pairs of light nuclei"};
Expand Down Expand Up @@ -331,7 +341,7 @@
// CCDB options
Configurable<int> cfgMaterialCorrection{"cfgMaterialCorrection", static_cast<int>(o2::base::Propagator::MatCorrType::USEMatCorrLUT), "Type of material correction"};
Configurable<std::string> cfgCCDBurl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
Configurable<std::string> cfgZorroCCDBpath{"cfgZorroCCDBpath", "/Users/m/mpuccio/EventFiltering/OTS/", "path to the zorro ccdb objects"};
Configurable<std::string> cfgZorroCCDBpath{"cfgZorroCCDBpath", "EventFiltering/Zorro/", "path to the zorro ccdb objects"};
int mRunNumber = 0;
float mBz = 0.f;

Expand All @@ -356,7 +366,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) {
if (std::abs(dau.pdgCode()) != PDG_t::kGamma && std::abs(dau.pdgCode()) != PDG_t::kElectron) {
dauVtx[0] = dau.vx();
dauVtx[1] = dau.vy();
dauVtx[2] = dau.vz();
Expand Down Expand Up @@ -510,14 +520,14 @@
spectra.add("hTpcSignalDataSelected", "Specific energy loss for selected particles", HistType::kTH2F, {{600, -6., 6., "#it{p} (GeV/#it{c})"}, {1400, 0, 1400, "d#it{E} / d#it{X} (a. u.)"}});
spectra.add("hTofSignalData", "TOF beta", HistType::kTH2F, {{500, 0., 5., "#it{p} (GeV/#it{c})"}, {750, 0, 1.5, "TOF #beta"}});

for (int iC{0}; iC < 2; ++iC) {
for (unsigned int iC{0}; iC < nuclei::matter.size(); ++iC) {
nuclei::hGloTOFtracks[iC] = spectra.add<TH2>(fmt::format("hTPCTOFtracks{}", nuclei::matter[iC]).data(), fmt::format("Global vs TOF matched {} tracks in a collision", nuclei::chargeLabelNames[iC]).data(), HistType::kTH2D, {{300, -0.5, 300.5, "Number of global tracks"}, {300, -0.5, 300.5, "Number of TOF matched tracks"}});

for (int iS{0}; iS < nuclei::species; ++iS) {
nuclei::hNsigma[0][iS][iC] = spectra.add<TH3>(fmt::format("h{}nsigma{}_{}", nuclei::pidName[0], nuclei::matter[iC], nuclei::names[iS]).data(), fmt::format("n#sigma_{{}} {} {}", nuclei::pidName[0], nuclei::matter[iC], nuclei::names[iS]).data(), HistType::kTH3D, {centAxis, ptAxes[iS], nSigmaAxes[0]});
nuclei::hNsigmaEta[0][iS][iC] = spectra.add<TH3>(fmt::format("h{}nsigmaEta{}_{}", nuclei::pidName[0], nuclei::matter[iC], nuclei::names[iS]).data(), fmt::format("n#sigma_{{}} {} {} vs #eta", nuclei::pidName[0], nuclei::matter[iC], nuclei::names[iS]).data(), HistType::kTH3D, {etaAxis, ptAxes[iS], nSigmaAxes[0]});

for (int iPID{0}; iPID < 2; ++iPID) {
for (unsigned int iPID{0}; iPID < nuclei::matter.size(); ++iPID) {
nuclei::hDCAxy[iPID][iS][iC] = spectra.add<TH3>(fmt::format("hDCAxy{}_{}_{}", nuclei::pidName[iPID], nuclei::matter[iC], nuclei::names[iS]).data(), fmt::format("DCAxy {} {} {}", nuclei::pidName[iPID], nuclei::matter[iC], nuclei::names[iS]).data(), HistType::kTH3D, {centAxis, ptAxes[iS], dcaxyAxes[iS]});
nuclei::hDCAz[iPID][iS][iC] = spectra.add<TH3>(fmt::format("hDCAz{}_{}_{}", nuclei::pidName[iPID], nuclei::matter[iC], nuclei::names[iS]).data(), fmt::format("DCAz {} {} {}", nuclei::pidName[iPID], nuclei::matter[iC], nuclei::names[iS]).data(), HistType::kTH3D, {centAxis, ptAxes[iS], dcazAxes[iS]});
}
Expand All @@ -540,15 +550,15 @@
}

for (int iS{0}; iS < nuclei::species; ++iS) {
for (int iMax{0}; iMax < 2; ++iMax) {
nuclei::pidCuts[0][iS][iMax] = cfgNsigmaTPC->get(iS, iMax);
for (unsigned int iMax{0}; iMax < nuclei::pidName.size(); ++iMax) {
nuclei::pidCuts[0][iS][iMax] = cfgTrackCut.TPCnSigmaMax->get(iS, iMax);
}
}

if (doprocessMatching) {
std::vector<double> occBins{-0.5, 499.5, 999.5, 1999.5, 2999.5, 3999.5, 4999.5, 10000., 50000.};
AxisSpec occAxis{occBins, "Occupancy"};
for (int iC{0}; iC < 2; ++iC) {
for (unsigned int iC{0}; iC < nuclei::matter.size(); ++iC) {
nuclei::hMatchingStudy[iC] = spectra.add<THnSparse>(fmt::format("hMatchingStudy{}", nuclei::matter[iC]).data(), ";#it{p}_{T};#phi;#eta;n#sigma_{ITS};n#sigma{TPC};n#sigma_{TOF};Centrality", HistType::kTHnSparseF, {{20, 1., 9.}, {10, 0., o2::constants::math::TwoPI}, {10, -1., 1.}, {50, -5., 5.}, {50, -5., 5.}, {50, 0., 1.}, {8, 0., 80.}});
nuclei::hMatchingStudyHadrons[iC] = spectra.add<THn>(fmt::format("hMatchingStudyHadrons{}", nuclei::matter[iC]).data(), ";#it{p}_{T};#phi;#eta;Centrality;Track type; Occupancy", HistType::kTHnF, {{23, 0.4, 5.}, {20, 0., o2::constants::math::TwoPI}, {10, -1., 1.}, {8, 0., 80.}, {2, -0.5, 1.5}, occAxis});
}
Expand Down Expand Up @@ -605,15 +615,15 @@
{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
if (std::abs(track.eta()) > cfgCutEta ||
track.tpcInnerParam() < cfgCutTpcMom ||
track.itsNCls() < cfgCutNclusITS ||
track.tpcNClsFound() < cfgCutNclusTPC ||
track.tpcNClsCrossedRows() < 70 ||
track.tpcNClsCrossedRows() < 0.8 * track.tpcNClsFindable() ||
track.tpcChi2NCl() > 4.f ||
track.itsChi2NCl() > 36.f) {
for (const auto& track : tracks) { // start loop over tracks
if (std::abs(track.eta()) > cfgTrackCut.EtaMax ||
track.tpcInnerParam() < cfgTrackCut.TPCrigidityMin ||
track.itsNCls() < cfgTrackCut.ITSnClusMin ||
track.tpcNClsFound() < cfgTrackCut.TPCnClsMin ||
track.tpcNClsCrossedRows() < cfgTrackCut.TPCnCrossedRowsMin ||
track.tpcNClsCrossedRows() < cfgTrackCut.TPCnCrossedRowsOverFindableMin * track.tpcNClsFindable() ||
track.tpcChi2NCl() > cfgTrackCut.TPCchi2ClusMax ||
track.itsChi2NCl() > cfgTrackCut.ITSchi2ClusMax) {
continue;
}
// temporary fix: tpcInnerParam() returns the momentum in all the software tags before
Expand Down Expand Up @@ -641,7 +651,7 @@
nSigmaTPC[iS] = nSigma[0][iS];
selectedTPC[iS] = (nSigma[0][iS] > nuclei::pidCuts[0][iS][0] && nSigma[0][iS] < nuclei::pidCuts[0][iS][1]);
goodToAnalyse = goodToAnalyse || selectedTPC[iS];
if (selectedTPC[iS] && track.p() > 0.2) {

Check failure on line 654 in PWGLF/TableProducer/Nuspex/nucleiSpectra.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.
nuclei::hDeltaP[iC][iS]->Fill(track.p(), 1 - correctedTpcInnerParam / track.p());
}
}
Expand Down Expand Up @@ -678,26 +688,26 @@
}
for (int iS{0}; iS < nuclei::species; ++iS) {
bool selectedTOF{false};
if (std::abs(dcaInfo[1]) > cfgDCAcut->get(iS, 1)) {
if (std::abs(dcaInfo[1]) > cfgTrackCut.DcaMax->get(iS, 1)) {
continue;
}
ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<float>> fvector{mTrackParCov.getPt() * nuclei::charges[iS], mTrackParCov.getEta(), mTrackParCov.getPhi(), nuclei::masses[iS]};
float y{fvector.Rapidity() + cfgCMrapidity};
for (int iPID{0}; iPID < 2; ++iPID) { /// 0 TPC, 1 TOF
for (unsigned int iPID{0}; iPID < nuclei::pidName.size(); ++iPID) { /// 0 TPC, 1 TOF
if (selectedTPC[iS]) {
if (iPID && !track.hasTOF()) {
continue;
} else if (iPID) {
selectedTOF = true; /// temporarly skipped
float charge{1.f + static_cast<float>(iS == 3 || iS == 4)};

Check failure on line 702 in PWGLF/TableProducer/Nuspex/nucleiSpectra.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.
tofMasses[iS] = correctedTpcInnerParam * charge * std::sqrt(1.f / (beta * beta) - 1.f) - nuclei::masses[iS];
}
if (!cfgCutOnReconstructedRapidity || (y > cfgCutRapidityMin && y < cfgCutRapidityMax)) {
if (!cfgTrackCut.RapidityToggle || (y > cfgTrackCut.RapidityMin && y < cfgTrackCut.RapidityMax)) {
if (std::abs(nSigmaTPC[iS]) < cfgNsigmaTPCcutDCAhists && (!iPID || std::abs(tofMasses[iS]) < cfgDeltaTOFmassCutDCAhists)) {
nuclei::hDCAxy[iPID][iS][iC]->Fill(centrality, fvector.pt(), dcaInfo[0]);
nuclei::hDCAz[iPID][iS][iC]->Fill(centrality, fvector.pt(), dcaInfo[1]);
}
if (std::abs(dcaInfo[0]) < cfgDCAcut->get(iS, 0u)) {
if (std::abs(dcaInfo[0]) < cfgTrackCut.DcaMax->get(iS, 0u)) {
if (!iPID) { /// temporary exclusion of the TOF nsigma PID for the He3 and Alpha
nuclei::hNsigma[iPID][iS][iC]->Fill(centrality, fvector.pt(), nSigma[iPID][iS]);
nuclei::hNsigmaEta[iPID][iS][iC]->Fill(fvector.eta(), fvector.pt(), nSigma[iPID][iS]);
Expand Down Expand Up @@ -845,7 +855,7 @@
return;
}
fillDataInfo(collision, tracks);
for (auto& c : nuclei::candidates) {

Check failure on line 858 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 @@ -857,7 +867,7 @@
}
}
}
for (auto& c : nuclei::candidates_flow) {
for (const auto& c : nuclei::candidates_flow) {
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 @@ -874,7 +884,7 @@
return;
}
fillDataInfo(collision, tracks);
for (auto& c : nuclei::candidates) {
for (const auto& c : nuclei::candidates) {
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 @@ -886,7 +896,7 @@
}
}
}
for (auto& c : nuclei::candidates_flow) {
for (const auto& c : nuclei::candidates_flow) {
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 @@ -896,11 +906,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) {
for (const auto& c : mcCollisions) {
spectra.fill(HIST("hGenVtxZ"), c.posZ());
}
std::vector<bool> goodCollisions(mcCollisions.size(), false);
for (auto& collision : collisions) {
for (const auto& collision : collisions) {
if (!eventSelection(collision)) {
continue;
}
Expand All @@ -909,7 +919,7 @@
fillDataInfo(collision, slicedTracks);
}
std::vector<bool> isReconstructed(particlesMC.size(), false);
for (auto& c : nuclei::candidates) {

Check failure on line 922 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 @@ -938,7 +948,7 @@
if (!storeIt) {
continue;
}
if (particle.y() < cfgCutRapidityMin || particle.y() > cfgCutRapidityMax) {
if (particle.y() < cfgTrackCut.RapidityMin || particle.y() > cfgTrackCut.RapidityMax) {
continue;
}

Expand All @@ -948,7 +958,7 @@
if (particle.isPhysicalPrimary()) {
c.flags |= kIsPhysicalPrimary;
if (particle.has_mothers()) {
for (auto& motherparticle : particle.mothers_as<aod::McParticles>()) {
for (const 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();
Expand All @@ -959,7 +969,7 @@
}
} else if (particle.has_mothers()) {
c.flags |= kIsSecondaryFromWeakDecay;
for (auto& motherparticle : particle.mothers_as<aod::McParticles>()) {
for (const auto& motherparticle : particle.mothers_as<aod::McParticles>()) {
motherPdgCode = motherparticle.pdgCode();
motherDecRadius = std::hypot(particle.vx() - motherparticle.vx(), particle.vy() - motherparticle.vy());
}
Expand All @@ -973,13 +983,13 @@
}

int index{0};
for (auto& particle : particlesMC) {
for (const auto& particle : particlesMC) {
int pdg{std::abs(particle.pdgCode())};
for (int iS{0}; iS < nuclei::species; ++iS) {
if (pdg != nuclei::codes[iS]) {
continue;
}
if (particle.y() < cfgCutRapidityMin || particle.y() > cfgCutRapidityMax) {
if (particle.y() < cfgTrackCut.RapidityMin || particle.y() > cfgTrackCut.RapidityMax) {
continue;
}

Expand All @@ -991,7 +1001,7 @@
nuclei::hGenNuclei[iS][particle.pdgCode() < 0]->Fill(1., particle.pt());
// antinuclei from B hadrons are classified as physical primaries
if (particle.has_mothers()) {
for (auto& motherparticle : particle.mothers_as<aod::McParticles>()) {

Check failure on line 1004 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::find(nuclei::hfMothCodes.begin(), nuclei::hfMothCodes.end(), std::abs(motherparticle.pdgCode())) != nuclei::hfMothCodes.end()) {
flags |= kIsSecondaryFromWeakDecay;
motherPdgCode = motherparticle.pdgCode();
Expand All @@ -1005,7 +1015,7 @@
continue; // skip secondaries from weak decay without mothers
}
flags |= kIsSecondaryFromWeakDecay;
for (auto& motherparticle : particle.mothers_as<aod::McParticles>()) {
for (const auto& motherparticle : particle.mothers_as<aod::McParticles>()) {
motherPdgCode = motherparticle.pdgCode();
motherDecRadius = std::hypot(particle.vx() - motherparticle.vx(), particle.vy() - motherparticle.vy());
}
Expand Down Expand Up @@ -1038,9 +1048,9 @@
const float centrality = collision.centFT0C();
o2::aod::ITSResponse itsResponse;
for (const auto& track : tracks) {
if (std::abs(track.eta()) > cfgCutEta ||
track.itsNCls() < 7 ||
track.itsChi2NCl() > 36.f) {
if (std::abs(track.eta()) > cfgTrackCut.EtaMax ||
track.itsNCls() < nuclei::nITSlayers ||
track.itsChi2NCl() > cfgTrackCut.ITSchi2ClusMax) {
continue;
}
double expBethe{tpc::BetheBlochAleph(static_cast<double>(track.tpcInnerParam() * 2. / o2::constants::physics::MassHelium3), cfgBetheBlochParams->get(4, 0u), cfgBetheBlochParams->get(4, 1u), cfgBetheBlochParams->get(4, 2u), cfgBetheBlochParams->get(4, 3u), cfgBetheBlochParams->get(4, 4u))};
Expand All @@ -1062,7 +1072,7 @@
{
nuclei::candidates.clear();
std::vector<bool> goodCollisions(mcCollisions.size(), false);
for (auto& collision : collisions) {
for (const auto& collision : collisions) {
if (!eventSelection(collision)) {
continue;
}
Expand All @@ -1085,7 +1095,7 @@
if (particle.isPhysicalPrimary()) {
c.flags |= kIsPhysicalPrimary;
if (particle.has_mothers()) {
for (auto& motherparticle : particle.mothers_as<aod::McParticles>()) {
for (const 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();
Expand All @@ -1096,7 +1106,7 @@
}
} else if (particle.has_mothers()) {
c.flags |= kIsSecondaryFromWeakDecay;
for (auto& motherparticle : particle.mothers_as<aod::McParticles>()) {
for (const auto& motherparticle : particle.mothers_as<aod::McParticles>()) {
motherPdgCode = motherparticle.pdgCode();
motherDecRadius = std::hypot(particle.vx() - motherparticle.vx(), particle.vy() - motherparticle.vy());
}
Expand All @@ -1117,5 +1127,5 @@
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
{
return WorkflowSpec{
adaptAnalysisTask<nucleiSpectra>(cfgc, TaskName{"nuclei-spectra"})};

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

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-task]

Specified task name nuclei-spectra and the struct name nucleiSpectra produce the same device name nuclei-spectra. TaskName is redundant.
}
Loading