Skip to content

Commit 90fba2c

Browse files
committed
add consts
1 parent 147847b commit 90fba2c

1 file changed

Lines changed: 25 additions & 25 deletions

File tree

‎PWGHF/TableProducer/candidateCreator3Prong.cxx‎

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -170,22 +170,22 @@ struct HfCandidateCreator3Prong {
170170

171171
void init(InitContext const&)
172172
{
173-
std::array<bool, 8> doprocessDF{doprocessPvRefitWithDCAFitterN, doprocessNoPvRefitWithDCAFitterN,
174-
doprocessPvRefitWithDCAFitterNCentFT0C, doprocessNoPvRefitWithDCAFitterNCentFT0C,
175-
doprocessPvRefitWithDCAFitterNCentFT0M, doprocessNoPvRefitWithDCAFitterNCentFT0M, doprocessPvRefitWithDCAFitterNUpc, doprocessNoPvRefitWithDCAFitterNUpc};
176-
std::array<bool, 8> doprocessKF{doprocessPvRefitWithKFParticle, doprocessNoPvRefitWithKFParticle,
177-
doprocessPvRefitWithKFParticleCentFT0C, doprocessNoPvRefitWithKFParticleCentFT0C,
178-
doprocessPvRefitWithKFParticleCentFT0M, doprocessNoPvRefitWithKFParticleCentFT0M, doprocessPvRefitWithKFParticleUpc, doprocessNoPvRefitWithKFParticleUpc};
173+
const std::array<bool, 8> doprocessDF{doprocessPvRefitWithDCAFitterN, doprocessNoPvRefitWithDCAFitterN,
174+
doprocessPvRefitWithDCAFitterNCentFT0C, doprocessNoPvRefitWithDCAFitterNCentFT0C,
175+
doprocessPvRefitWithDCAFitterNCentFT0M, doprocessNoPvRefitWithDCAFitterNCentFT0M, doprocessPvRefitWithDCAFitterNUpc, doprocessNoPvRefitWithDCAFitterNUpc};
176+
const std::array<bool, 8> doprocessKF{doprocessPvRefitWithKFParticle, doprocessNoPvRefitWithKFParticle,
177+
doprocessPvRefitWithKFParticleCentFT0C, doprocessNoPvRefitWithKFParticleCentFT0C,
178+
doprocessPvRefitWithKFParticleCentFT0M, doprocessNoPvRefitWithKFParticleCentFT0M, doprocessPvRefitWithKFParticleUpc, doprocessNoPvRefitWithKFParticleUpc};
179179
if ((std::accumulate(doprocessDF.begin(), doprocessDF.end(), 0) + std::accumulate(doprocessKF.begin(), doprocessKF.end(), 0)) != 1) {
180180
LOGP(fatal, "One and only one process function must be enabled at a time.");
181181
}
182182
if (std::accumulate(doprocessKF.begin(), doprocessKF.end(), 0) == 1 && createCharmNuclei == true) {
183183
LOGP(fatal, "KF based reconstruction of charm nuclei is not impemented yet.");
184184
}
185-
std::array<bool, 4> processesCollisions = {doprocessCollisions, doprocessCollisionsCentFT0C, doprocessCollisionsCentFT0M, doprocessCollisionsUpc};
185+
const std::array<bool, 4> processesCollisions = {doprocessCollisions, doprocessCollisionsCentFT0C, doprocessCollisionsCentFT0M, doprocessCollisionsUpc};
186186
const int nProcessesCollisions = std::accumulate(processesCollisions.begin(), processesCollisions.end(), 0);
187187

188-
std::array<bool, 5> processesUpc = {doprocessPvRefitWithDCAFitterNUpc, doprocessNoPvRefitWithDCAFitterNUpc, doprocessPvRefitWithKFParticleUpc, doprocessNoPvRefitWithKFParticleUpc, doprocessCollisionsUpc};
188+
const std::array<bool, 5> processesUpc = {doprocessPvRefitWithDCAFitterNUpc, doprocessNoPvRefitWithDCAFitterNUpc, doprocessPvRefitWithKFParticleUpc, doprocessNoPvRefitWithKFParticleUpc, doprocessCollisionsUpc};
189189
const int nProcessesUpc = std::accumulate(processesUpc.begin(), processesUpc.end(), 0);
190190

191191
if (nProcessesCollisions > 1) {
@@ -208,7 +208,7 @@ struct HfCandidateCreator3Prong {
208208
if (nProcessesUpc > 0 && isRun2) {
209209
LOGP(fatal, "Process function for UPC is only available in Run 3!");
210210
}
211-
std::array<bool, 5> creationFlags = {createDplus, createDs, createLc, createXic, createCharmNuclei};
211+
const std::array<bool, 5> creationFlags = {createDplus, createDs, createLc, createXic, createCharmNuclei};
212212
const int nParticlesToCreate = std::accumulate(creationFlags.begin(), creationFlags.end(), 0);
213213
if (nParticlesToCreate == 0) {
214214
LOGP(fatal, "At least one particle specie should be enabled for the creation.");
@@ -480,7 +480,7 @@ struct HfCandidateCreator3Prong {
480480

481481
for (const auto& rowTrackIndexProng3 : rowsTrackIndexProng3) {
482482
/// reject candidates in collisions not satisfying the event selections
483-
auto collision = rowTrackIndexProng3.template collision_as<Coll>();
483+
const auto collision = rowTrackIndexProng3.template collision_as<Coll>();
484484
float centrality{-1.f};
485485
o2::hf_evsel::HfCollisionRejectionMask rejectionMask{};
486486
if constexpr (ApplyUpcSel) {
@@ -493,14 +493,14 @@ struct HfCandidateCreator3Prong {
493493
continue;
494494
}
495495

496-
auto track0 = rowTrackIndexProng3.template prong0_as<TracksWCovExtraPidPiKaPrLightNuclei>();
497-
auto track1 = rowTrackIndexProng3.template prong1_as<TracksWCovExtraPidPiKaPrLightNuclei>();
498-
auto track2 = rowTrackIndexProng3.template prong2_as<TracksWCovExtraPidPiKaPrLightNuclei>();
496+
const auto track0 = rowTrackIndexProng3.template prong0_as<TracksWCovExtraPidPiKaPrLightNuclei>();
497+
const auto track1 = rowTrackIndexProng3.template prong1_as<TracksWCovExtraPidPiKaPrLightNuclei>();
498+
const auto track2 = rowTrackIndexProng3.template prong2_as<TracksWCovExtraPidPiKaPrLightNuclei>();
499499

500500
/// Set the magnetic field from ccdb.
501501
/// The static instance of the propagator was already modified in the HFTrackIndexSkimCreator,
502502
/// but this is not true when running on Run2 data/MC already converted into AO2Ds.
503-
auto bc = collision.template bc_as<aod::BCsWithTimestamps>();
503+
const auto bc = collision.template bc_as<aod::BCsWithTimestamps>();
504504
if (runNumber != bc.runNumber()) {
505505
LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber;
506506
initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, nullptr, isRun2);
@@ -523,7 +523,7 @@ struct HfCandidateCreator3Prong {
523523
kfpVertex.SetCovarianceMatrix(rowTrackIndexProng3.pvRefitSigmaX2(), rowTrackIndexProng3.pvRefitSigmaXY(), rowTrackIndexProng3.pvRefitSigmaY2(), rowTrackIndexProng3.pvRefitSigmaXZ(), rowTrackIndexProng3.pvRefitSigmaYZ(), rowTrackIndexProng3.pvRefitSigmaZ2());
524524
}
525525
kfpVertex.GetCovarianceMatrix(covMatrixPV);
526-
KFParticle kfpV(kfpVertex);
526+
const KFParticle kfpV(kfpVertex);
527527
registry.fill(HIST("hCovPVXX"), covMatrixPV[0]);
528528
registry.fill(HIST("hCovPVYY"), covMatrixPV[2]);
529529
registry.fill(HIST("hCovPVXZ"), covMatrixPV[3]);
@@ -564,9 +564,9 @@ struct HfCandidateCreator3Prong {
564564
registry.fill(HIST("hDcaZProngs"), track2.pt(), UndefValueFloat);
565565
}
566566

567-
auto [impactParameter0Z, errImpactParameter0Z] = kfCalculateImpactParameterZ(kfFirstProton, kfpV);
568-
auto [impactParameter1Z, errImpactParameter1Z] = kfCalculateImpactParameterZ(kfSecondKaon, kfpV);
569-
auto [impactParameter2Z, errImpactParameter2Z] = kfCalculateImpactParameterZ(kfThirdProton, kfpV);
567+
const auto [impactParameter0Z, errImpactParameter0Z] = kfCalculateImpactParameterZ(kfFirstProton, kfpV);
568+
const auto [impactParameter1Z, errImpactParameter1Z] = kfCalculateImpactParameterZ(kfSecondKaon, kfpV);
569+
const auto [impactParameter2Z, errImpactParameter2Z] = kfCalculateImpactParameterZ(kfThirdProton, kfpV);
570570

571571
const float chi2primFirst = kfCalculateChi2ToPrimaryVertex(kfFirstProton, kfpV);
572572
const float chi2primSecond = kfCalculateChi2ToPrimaryVertex(kfSecondKaon, kfpV);
@@ -668,22 +668,22 @@ struct HfCandidateCreator3Prong {
668668
const float chi2geo = kfCandGeneric->Chi2() / static_cast<float>(kfCandGeneric->NDF());
669669
const std::pair<float, float> ldl = kfCalculateLdL(*kfCandGeneric, kfpV);
670670

671-
std::array<float, 3> pProng0 = kfCalculateProngMomentumInSecondaryVertex(kfFirstProton, *kfCandGeneric);
672-
std::array<float, 3> pProng1 = kfCalculateProngMomentumInSecondaryVertex(kfSecondKaon, *kfCandGeneric);
673-
std::array<float, 3> pProng2 = kfCalculateProngMomentumInSecondaryVertex(kfThirdPion, *kfCandGeneric);
671+
const std::array<float, 3> pProng0 = kfCalculateProngMomentumInSecondaryVertex(kfFirstProton, *kfCandGeneric);
672+
const std::array<float, 3> pProng1 = kfCalculateProngMomentumInSecondaryVertex(kfSecondKaon, *kfCandGeneric);
673+
const std::array<float, 3> pProng2 = kfCalculateProngMomentumInSecondaryVertex(kfThirdPion, *kfCandGeneric);
674674

675675
registry.fill(HIST("hCovSVXX"), kfCandGeneric->GetCovariance(0, 0));
676676
registry.fill(HIST("hCovSVYY"), kfCandGeneric->GetCovariance(1, 1));
677677
registry.fill(HIST("hCovSVXZ"), kfCandGeneric->GetCovariance(2, 0));
678678
registry.fill(HIST("hCovSVZZ"), kfCandGeneric->GetCovariance(2, 2));
679679

680-
auto* covMatrixSV = kfCandGeneric->CovarianceMatrix();
680+
const auto* const covMatrixSV = kfCandGeneric->CovarianceMatrix();
681681
double phi{}, theta{};
682682
getPointDirection(std::array{kfpV.GetX(), kfpV.GetY(), kfpV.GetZ()}, std::array{kfCandGeneric->GetX(), kfCandGeneric->GetY(), kfCandGeneric->GetZ()}, phi, theta);
683-
auto errorDecayLength = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phi, theta) + getRotatedCovMatrixXX(covMatrixSV, phi, theta));
684-
auto errorDecayLengthXY = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phi, 0.) + getRotatedCovMatrixXX(covMatrixSV, phi, 0.));
683+
const auto errorDecayLength = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phi, theta) + getRotatedCovMatrixXX(covMatrixSV, phi, theta));
684+
const auto errorDecayLengthXY = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phi, 0.) + getRotatedCovMatrixXX(covMatrixSV, phi, 0.));
685685

686-
auto indexCollision = collision.globalIndex();
686+
const auto indexCollision = collision.globalIndex();
687687
uint8_t bitmapProngsContributorsPV = 0;
688688
if (indexCollision == track0.collisionId() && track0.isPVContributor()) {
689689
SETBIT(bitmapProngsContributorsPV, 0);

0 commit comments

Comments
 (0)