Skip to content

Commit 3752381

Browse files
committed
Add const
1 parent 5053cdc commit 3752381

16 files changed

+558
-558
lines changed

PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx

Lines changed: 45 additions & 45 deletions
Large diffs are not rendered by default.

PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ struct HfDataCreatorCharmResoReduced {
350350
doprocessDstarV0MC || doprocessDstarTrackMC || doprocessDstarV0AndTrackMC || doprocessDstarV0MCWithMl || doprocessDstarTrackMCWithMl || doprocessDstarV0AndTrackMCWithMl ||
351351
doprocessDplusV0MC || doprocessDplusTrackMC || doprocessDplusV0AndTrackMC || doprocessDplusV0MCWithMl || doprocessDplusTrackMCWithMl || doprocessDplusV0AndTrackMCWithMl) {
352352
// MC Rec
353-
int nChannels = hf_decay::hf_cand_reso::DecayChannelMain::NChannelsMain;
353+
int const nChannels = hf_decay::hf_cand_reso::DecayChannelMain::NChannelsMain;
354354
registry.add("hMCRecCounter", "Number of Reconstructed MC Matched candidates per channel", {HistType::kTH1D, {{2 * nChannels + 1, -(nChannels + 0.5), nChannels + 0.5}}});
355355
registry.add("hMCRecDebug", "Debug of MC Reco", {HistType::kTH1D, {{551, -0.5, 550.5}}});
356356
registry.add("hMCRecOrigin", "Origin of Matched particles", {HistType::kTH1D, {{3, -0.5, 2.5}}});
@@ -425,9 +425,9 @@ struct HfDataCreatorCharmResoReduced {
425425
// Utility to find which v0 daughter carries the largest fraction of the mother longitudinal momentum
426426
float alphaAP(std::array<float, 3> const& momA, std::array<float, 3> const& momB, std::array<float, 3> const& momC)
427427
{
428-
float momTot = std::sqrt(std::pow(momA[0], 2.) + std::pow(momA[1], 2.) + std::pow(momA[2], 2.));
429-
float lQlPos = (momB[0] * momA[0] + momB[1] * momA[1] + momB[2] * momA[2]) / momTot;
430-
float lQlNeg = (momC[0] * momA[0] + momC[1] * momA[1] + momC[2] * momA[2]) / momTot;
428+
float const momTot = std::sqrt(std::pow(momA[0], 2.) + std::pow(momA[1], 2.) + std::pow(momA[2], 2.));
429+
float const lQlPos = (momB[0] * momA[0] + momB[1] * momA[1] + momB[2] * momA[2]) / momTot;
430+
float const lQlNeg = (momC[0] * momA[0] + momC[1] * momA[1] + momC[2] * momA[2]) / momTot;
431431
return (lQlPos - lQlNeg) / (lQlPos + lQlNeg);
432432
}
433433
// Utility to find DCA of V0 to Primary vertex
@@ -510,7 +510,7 @@ struct HfDataCreatorCharmResoReduced {
510510
return false;
511511
}
512512
// v0 cosine of pointing angle
513-
std::array<float, 3> primVtx = {collision.posX(), collision.posY(), collision.posZ()};
513+
std::array<float, 3> const primVtx = {collision.posX(), collision.posY(), collision.posZ()};
514514
candidateV0.cosPA = RecoDecay::cpa(primVtx, vtx, candidateV0.mom);
515515
if (candidateV0.cosPA < cfgV0Cuts.cosPa) {
516516
return false;
@@ -519,7 +519,7 @@ struct HfDataCreatorCharmResoReduced {
519519
candidateV0.v0Type = {BIT(BachelorType::K0s) | BIT(BachelorType::Lambda) | BIT(BachelorType::AntiLambda)};
520520
// for lambda hypotesys define if its lambda or anti-lambda
521521
candidateV0.alpha = alphaAP(candidateV0.mom, candidateV0.momPos, candidateV0.momNeg);
522-
bool matter = candidateV0.alpha > 0;
522+
bool const matter = candidateV0.alpha > 0;
523523
CLRBIT(candidateV0.v0Type, matter ? BachelorType::AntiLambda : BachelorType::Lambda);
524524
auto massPos = matter ? o2::constants::physics::MassProton : o2::constants::physics::MassPionCharged;
525525
auto massNeg = matter ? o2::constants::physics::MassPionCharged : o2::constants::physics::MassProton;
@@ -593,9 +593,9 @@ struct HfDataCreatorCharmResoReduced {
593593
if (!track.hasTPC()) {
594594
return false;
595595
}
596-
bool isPion = std::abs(track.tpcNSigmaPi()) < cfgSingleTrackCuts.maxNsigmaTpcPi;
597-
bool isKaon = std::abs(track.tpcNSigmaKa()) < cfgSingleTrackCuts.maxNsigmaTpcKa;
598-
bool isProton = std::abs(track.tpcNSigmaPr()) < cfgSingleTrackCuts.maxNsigmaTpcPr;
596+
bool const isPion = std::abs(track.tpcNSigmaPi()) < cfgSingleTrackCuts.maxNsigmaTpcPi;
597+
bool const isKaon = std::abs(track.tpcNSigmaKa()) < cfgSingleTrackCuts.maxNsigmaTpcKa;
598+
bool const isProton = std::abs(track.tpcNSigmaPr()) < cfgSingleTrackCuts.maxNsigmaTpcPr;
599599
if (!isPion && !isKaon && !isProton) { // we keep the track if is it compatible with at least one of the PID hypotheses selected
600600
return false;
601601
}
@@ -664,7 +664,7 @@ struct HfDataCreatorCharmResoReduced {
664664
}
665665
// If both D* and K0s are matched, try to match resonance
666666
if (flagCharmBach != 0 && flagV0 == hf_decay::hf_cand_reso::PartialMatchMc::K0Matched) {
667-
std::array<int, 5> pdgCodesDaughters = {+kPiPlus, -kKPlus, +kPiPlus, +kPiPlus, -kPiPlus};
667+
std::array<int, 5> const pdgCodesDaughters = {+kPiPlus, -kKPlus, +kPiPlus, +kPiPlus, -kPiPlus};
668668
auto arrDaughtersReso = std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2], vecDaughtersReso[3], vecDaughtersReso[4]};
669669
for (const auto& [decayChannelFlag, pdgCodeReso] : hf_decay::hf_cand_reso::particlesToDstarK0s) {
670670
indexRec = RecoDecay::getMatchedMCRec<false, true, true, true, true>(particlesMc, arrDaughtersReso, pdgCodeReso, pdgCodesDaughters, true, &sign, 3, &nKinkedTracks);
@@ -674,7 +674,7 @@ struct HfDataCreatorCharmResoReduced {
674674
}
675675
}
676676
} else if (flagCharmBachInterm != 0 && flagV0 == hf_decay::hf_cand_reso::PartialMatchMc::K0Matched) {
677-
std::array<int, 4> pdgCodesDaughters = {+kPiPlus, -kKPlus, +kPiPlus, -kPiPlus};
677+
std::array<int, 4> const pdgCodesDaughters = {+kPiPlus, -kKPlus, +kPiPlus, -kPiPlus};
678678
auto arrDaughtersReso = std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[3], vecDaughtersReso[4]};
679679
// Peaking background of D0K0s <- Ds* with spurious soft pion
680680
for (const auto& [decayChannelFlag, pdgCodeReso] : hf_decay::hf_cand_reso::particlesToDstarK0s) {
@@ -830,8 +830,8 @@ struct HfDataCreatorCharmResoReduced {
830830
CCand const& candCharmBach,
831831
BBachTr const& bachelorTrack,
832832
Tr const& tracks,
833-
int& indexHfCandCharm,
834-
int64_t& indexCandTrBach)
833+
const int64_t indexHfCandCharm,
834+
const int64_t indexCandTrBach)
835835
{
836836
std::vector<typename Tr::iterator> vecDaughtersReso{};
837837
int8_t sign{0}, nKinkedTracks{0}, origin{0}, flagCharmBach{0}, flagCharmBachInterm{0}, flagTrack{0}, flagReso{0};
@@ -996,7 +996,7 @@ struct HfDataCreatorCharmResoReduced {
996996
if (rejectCollisionsWithBadEvSel && hfRejMap != 0) {
997997
return;
998998
}
999-
int indexHfReducedCollision = hfReducedCollision.lastIndex() + 1;
999+
int const indexHfReducedCollision = hfReducedCollision.lastIndex() + 1;
10001000
// std::map where the key is the V0.globalIndex() and
10011001
// the value is the V0 index in the table of the selected v0s
10021002
std::map<int64_t, int64_t> selectedV0s;
@@ -1140,7 +1140,7 @@ struct HfDataCreatorCharmResoReduced {
11401140
}
11411141
// propagate V0 to primary vertex (if enabled)
11421142
if (propagateV0toPV) {
1143-
std::array<float, 3> pVecV0Orig = {candidateV0.mom[0], candidateV0.mom[1], candidateV0.mom[2]};
1143+
std::array<float, 3> const pVecV0Orig = {candidateV0.mom[0], candidateV0.mom[1], candidateV0.mom[2]};
11441144
std::array<float, 2> dcaInfo;
11451145
auto trackParK0 = o2::track::TrackPar(candidateV0.pos, pVecV0Orig, 0, true);
11461146
trackParK0.setPID(o2::track::PID::K0);
@@ -1182,8 +1182,8 @@ struct HfDataCreatorCharmResoReduced {
11821182
break; // no other D meson types expected
11831183
} // end of dType switch
11841184
} // matched with K0s
1185-
bool isLambda = TESTBIT(candidateV0.v0Type, BachelorType::Lambda);
1186-
bool isAntiLambda = TESTBIT(candidateV0.v0Type, BachelorType::AntiLambda);
1185+
bool const isLambda = TESTBIT(candidateV0.v0Type, BachelorType::Lambda);
1186+
bool const isAntiLambda = TESTBIT(candidateV0.v0Type, BachelorType::AntiLambda);
11871187
if (isLambda || isAntiLambda) {
11881188
registry.fill(HIST("hMassVsPtLambda"), candidateV0.pT, candidateV0.mLambda);
11891189
switch (dType) {
@@ -1539,15 +1539,15 @@ struct HfDataCreatorCharmResoReduced {
15391539
McCollisions const& mcCollisions,
15401540
BCsInfo const&)
15411541
{
1542-
bool doV0s = (pairingType == PairingType::V0Only || pairingType == PairingType::V0AndTrack);
1543-
bool doTracks = (pairingType == PairingType::TrackOnly || pairingType == PairingType::V0AndTrack);
1542+
bool const doV0s = (pairingType == PairingType::V0Only || pairingType == PairingType::V0AndTrack);
1543+
bool const doTracks = (pairingType == PairingType::TrackOnly || pairingType == PairingType::V0AndTrack);
15441544
for (const auto& mcCollision : mcCollisions) {
15451545
// Slice the particles table to get the particles for the current MC collision
15461546
const auto mcParticlesPerMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, mcCollision.globalIndex());
15471547
// Slice the collisions table to get the collision info for the current MC collision
15481548
float centrality{-1.f};
15491549
o2::hf_evsel::HfCollisionRejectionMask rejectionMask{};
1550-
int nSplitColl = 0;
1550+
int const nSplitColl = 0;
15511551
const auto collSlice = collInfos.sliceBy(colPerMcCollision, mcCollision.globalIndex());
15521552
rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask<BCsInfo, o2::hf_centrality::CentralityEstimator::None>(mcCollision, collSlice, centrality);
15531553
hfEvSelMc.fillHistograms<o2::hf_centrality::CentralityEstimator::None>(mcCollision, rejectionMask, nSplitColl);

PWGHF/D2H/TableProducer/dataCreatorJpsiHadReduced.cxx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -511,10 +511,10 @@ struct HfDataCreatorJpsiHadReduced {
511511
/// \param indexHfCandJpsi is the index of the Jpsi candidate
512512
/// \param selectedTracksBach is the map with the indices of selected bachelor pion tracks
513513
template <uint8_t decChannel, typename CColl, typename PParticles, typename TTrack>
514-
void fillMcRecoInfo(const CColl& collision,
515-
const PParticles& particlesMc,
516-
const std::vector<TTrack>& vecDaughtersB,
517-
int& indexHfCandJpsi,
514+
void fillMcRecoInfo(CColl const& collision,
515+
PParticles const& particlesMc,
516+
std::vector<TTrack> const& vecDaughtersB,
517+
const int indexHfCandJpsi,
518518
std::array<std::map<int64_t, int64_t>, 2> selectedTracksBach,
519519
const int64_t indexCollisionMaxNumContrib)
520520
{
@@ -734,7 +734,7 @@ struct HfDataCreatorJpsiHadReduced {
734734
}
735735

736736
// helpers for ReducedTables filling
737-
int indexHfReducedCollision = hfReducedCollision.lastIndex() + 1;
737+
int const indexHfReducedCollision = hfReducedCollision.lastIndex() + 1;
738738
// std::map where the key is the track.globalIndex() and
739739
// the value is the track index in the table of the selected tracks
740740
std::map<int64_t, int64_t> selectedTracksBach;
@@ -797,8 +797,8 @@ struct HfDataCreatorJpsiHadReduced {
797797

798798
// ---------------------------------
799799
// reconstruct J/Psi candidate secondary vertex
800-
o2::track::TrackParCov trackParCovJpsi{};
801-
std::array<float, 3> pVecJpsi{};
800+
o2::track::TrackParCov trackParCovJpsi{}; // FIXME: unused
801+
std::array<float, 3> pVecJpsi{}; // FIXME: unused
802802
registry.fill(HIST("hFitCandidatesJpsi"), SVFitting::BeforeFit);
803803
try {
804804
if (df2.process(trackPosParCov, trackNegParCov) == 0) {
@@ -823,8 +823,8 @@ struct HfDataCreatorJpsiHadReduced {
823823
}
824824
registry.fill(HIST("hSelectionsJpsi"), 2 + aod::SelectionStep::RecoPID, candidate.pt());
825825

826-
int indexHfCandJpsi = hfJpsi.lastIndex() + 1;
827-
float invMassJpsi = runJpsiToee ? hfHelper.invMassJpsiToEE(candidate) : hfHelper.invMassJpsiToMuMu(candidate);
826+
int const indexHfCandJpsi = hfJpsi.lastIndex() + 1;
827+
float const invMassJpsi = runJpsiToee ? hfHelper.invMassJpsiToEE(candidate) : hfHelper.invMassJpsiToMuMu(candidate);
828828
registry.fill(HIST("hMassJpsi"), invMassJpsi);
829829
registry.fill(HIST("hPtJpsi"), candidate.pt());
830830
registry.fill(HIST("hCpaJpsi"), candidate.cpa());
@@ -1189,7 +1189,7 @@ struct HfDataCreatorJpsiHadReduced {
11891189
auto candsJpsiThisColl = candsJpsi.sliceBy(candsJpsiPerCollision, thisCollId);
11901190
auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId);
11911191
auto collsSameMcCollision = collisions.sliceBy(colPerMcCollision, collision.mcCollisionId());
1192-
int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision);
1192+
int64_t const indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision);
11931193
runDataCreation<true, DecayChannel::BplusToJpsiK>(collision, candsJpsiThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs);
11941194
}
11951195
// handle normalization by the right number of collisions
@@ -1226,7 +1226,7 @@ struct HfDataCreatorJpsiHadReduced {
12261226
auto candsJpsiThisColl = candsJpsi.sliceBy(candsJpsiPerCollision, thisCollId);
12271227
auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId);
12281228
auto collsSameMcCollision = collisions.sliceBy(colPerMcCollision, collision.mcCollisionId());
1229-
int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision);
1229+
int64_t const indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision);
12301230
runDataCreation<true, DecayChannel::BsToJpsiPhi>(collision, candsJpsiThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs);
12311231
}
12321232
// handle normalization by the right number of collisions

PWGHF/D2H/Tasks/taskD0.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,8 @@ struct HfTaskD0 {
397397

398398
auto trackPos = candidate.template prong0_as<o2::aod::TracksWExtra>(); // positive daughter
399399
auto trackNeg = candidate.template prong1_as<o2::aod::TracksWExtra>(); // negative daughter
400-
int minItsClustersOfProngs = std::min(trackPos.itsNCls(), trackNeg.itsNCls());
401-
int minTpcCrossedRowsOfProngs = std::min(trackPos.tpcNClsCrossedRows(), trackNeg.tpcNClsCrossedRows());
400+
int const minItsClustersOfProngs = std::min(trackPos.itsNCls(), trackNeg.itsNCls());
401+
int const minTpcCrossedRowsOfProngs = std::min(trackPos.tpcNClsCrossedRows(), trackNeg.tpcNClsCrossedRows());
402402
if constexpr (applyMl) {
403403
if (storeCentrality && storeOccupancy) {
404404
if (candidate.isSelD0() >= selectionFlagD0) {
@@ -660,8 +660,8 @@ struct HfTaskD0 {
660660
auto ctCandidate = hfHelper.ctD0(candidate);
661661
auto cpaCandidate = candidate.cpa();
662662
auto cpaxyCandidate = candidate.cpaXY();
663-
int minItsClustersOfProngs = std::min(trackPos.itsNCls(), trackNeg.itsNCls());
664-
int minTpcCrossedRowsOfProngs = std::min(trackPos.tpcNClsCrossedRows(), trackNeg.tpcNClsCrossedRows());
663+
int const minItsClustersOfProngs = std::min(trackPos.itsNCls(), trackNeg.itsNCls());
664+
int const minTpcCrossedRowsOfProngs = std::min(trackPos.tpcNClsCrossedRows(), trackNeg.tpcNClsCrossedRows());
665665
if (candidate.isSelD0() >= selectionFlagD0) {
666666
registry.fill(HIST("hMassSigBkgD0"), massD0, ptCandidate, rapidityCandidate);
667667
if (candidate.flagMcMatchRec() == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) {

PWGHF/D2H/Tasks/taskDplus.cxx

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -130,17 +130,17 @@ struct HfTaskDplus {
130130
LOGP(fatal, "Only one process function should be enabled! Please check your configuration!");
131131
}
132132
auto vbins = static_cast<std::vector<double>>(binsPt);
133-
AxisSpec thnAxisPt = {vbins, "#it{p}_{T} (GeV/#it{c})"};
134-
AxisSpec thnAxisMass = {600, 1.67, 2.27, "inv. mass (K#pi#pi) (GeV/#it{c}^{2})"};
135-
AxisSpec thnAxisY = {thnConfigAxisY, "y"};
136-
AxisSpec thnAxisMlScore0 = {thnConfigAxisMlScore0, "Score 0"};
137-
AxisSpec thnAxisMlScore1 = {thnConfigAxisMlScore1, "Score 1"};
138-
AxisSpec thnAxisMlScore2 = {thnConfigAxisMlScore2, "Score 2"};
139-
AxisSpec thnAxisPtBHad{thnConfigAxisPtBHad, "#it{p}_{T,B} (GeV/#it{c})"};
140-
AxisSpec thnAxisFlagBHad{thnConfigAxisFlagBHad, "B Hadron flag"};
141-
AxisSpec thnAxisCent{thnConfigAxisCent, "Centrality"};
142-
AxisSpec thnAxisOccupancy{thnConfigAxisOccupancy, "Occupancy"};
143-
AxisSpec thnAxisPvContributors{thnConfigAxisPvContributors, "PV contributors"};
133+
AxisSpec const thnAxisPt = {vbins, "#it{p}_{T} (GeV/#it{c})"};
134+
AxisSpec const thnAxisMass = {600, 1.67, 2.27, "inv. mass (K#pi#pi) (GeV/#it{c}^{2})"};
135+
AxisSpec const thnAxisY = {thnConfigAxisY, "y"};
136+
AxisSpec const thnAxisMlScore0 = {thnConfigAxisMlScore0, "Score 0"};
137+
AxisSpec const thnAxisMlScore1 = {thnConfigAxisMlScore1, "Score 1"};
138+
AxisSpec const thnAxisMlScore2 = {thnConfigAxisMlScore2, "Score 2"};
139+
AxisSpec const thnAxisPtBHad{thnConfigAxisPtBHad, "#it{p}_{T,B} (GeV/#it{c})"};
140+
AxisSpec const thnAxisFlagBHad{thnConfigAxisFlagBHad, "B Hadron flag"};
141+
AxisSpec const thnAxisCent{thnConfigAxisCent, "Centrality"};
142+
AxisSpec const thnAxisOccupancy{thnConfigAxisOccupancy, "Occupancy"};
143+
AxisSpec const thnAxisPvContributors{thnConfigAxisPvContributors, "PV contributors"};
144144

145145
registry.add("hMass", "3-prong candidates;inv. mass (#pi K #pi) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{350, 1.7, 2.05}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}});
146146
registry.add("hEta", "3-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}});
@@ -247,7 +247,7 @@ struct HfTaskDplus {
247247
template <typename T1>
248248
void fillHisto(const T1& candidate)
249249
{
250-
float pt = candidate.pt();
250+
float const pt = candidate.pt();
251251
registry.fill(HIST("hMass"), hfHelper.invMassDplusToPiKPi(candidate), pt);
252252
registry.fill(HIST("hPt"), pt);
253253
registry.fill(HIST("hEta"), candidate.eta(), pt);
@@ -485,8 +485,8 @@ struct HfTaskDplus {
485485
float cent{-1.f};
486486
float occ{-1.f};
487487
float numPvContr{-1.f};
488-
float ptBhad{-1.f};
489-
int flagBHad{-1};
488+
float const ptBhad{-1.f};
489+
int const flagBHad{-1};
490490
if constexpr (!fillMl) {
491491
for (const auto& candidate : selectedDPlusCandidates) {
492492
if ((yCandRecoMax >= 0. && std::abs(hfHelper.yDplus(candidate)) > yCandRecoMax)) {
@@ -525,10 +525,10 @@ struct HfTaskDplus {
525525
template <bool fillMl>
526526
void runAnalysisMcRec(McRecoCollisionsCent const& /*recoColls*/)
527527
{
528-
float cent{-1};
529-
float occ{-1};
530-
float numPvContr{-1};
531-
float ptBhad{-1};
528+
float cent{-1.f};
529+
float occ{-1.f};
530+
float numPvContr{-1.f};
531+
float ptBhad{-1.f};
532532
int flagBHad{-1};
533533

534534
// MC rec. w/o Ml

0 commit comments

Comments
 (0)