Skip to content

Commit 8998841

Browse files
committed
address clang-tidy issues
1 parent a671bcb commit 8998841

File tree

3 files changed

+89
-89
lines changed

3 files changed

+89
-89
lines changed

PWGHF/TableProducer/candidateCreator3Prong.cxx

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@ struct HfCandidateCreator3Prong {
111111
Configurable<bool> propagateToPCA{"propagateToPCA", true, "create tracks version propagated to PCA"};
112112
Configurable<bool> useAbsDCA{"useAbsDCA", false, "Minimise abs. distance rather than chi2"};
113113
Configurable<bool> useWeightedFinalPCA{"useWeightedFinalPCA", false, "Recalculate vertex position using track covariances, effective only if useAbsDCA is true"};
114-
Configurable<double> maxR{"maxR", 200., "reject PCA's above this radius"};
115-
Configurable<double> maxDZIni{"maxDZIni", 4., "reject (if>0) PCA candidate if tracks DZ exceeds threshold"};
116-
Configurable<double> minParamChange{"minParamChange", 1.e-3, "stop iterations if largest change of any X is smaller than this"};
117-
Configurable<double> minRelChi2Change{"minRelChi2Change", 0.9, "stop iterations is chi2/chi2old > this"};
114+
Configurable<float> maxR{"maxR", 200., "reject PCA's above this radius"};
115+
Configurable<float> maxDZIni{"maxDZIni", 4., "reject (if>0) PCA candidate if tracks DZ exceeds threshold"};
116+
Configurable<float> minParamChange{"minParamChange", 1.e-3, "stop iterations if largest change of any X is smaller than this"};
117+
Configurable<float> minRelChi2Change{"minRelChi2Change", 0.9, "stop iterations is chi2/chi2old > this"};
118118
Configurable<bool> fillHistograms{"fillHistograms", true, "do validation plots"};
119119
// magnetic field setting from CCDB
120120
Configurable<bool> isRun2{"isRun2", false, "enable Run 2 or Run 3 GRP objects for magnetic field"};
@@ -138,7 +138,7 @@ struct HfCandidateCreator3Prong {
138138
int runNumber{0};
139139
double bz{0.};
140140

141-
const float toMicrometers = 10000.; // from cm to µm
141+
constexpr static float CentiToMicro{10000.f}; // from cm to µm
142142
constexpr static float UndefValueFloat{-999.f};
143143

144144
using FilteredHf3Prongs = soa::Filtered<aod::Hf3Prongs>;
@@ -307,7 +307,7 @@ struct HfCandidateCreator3Prong {
307307
// df.setBz(bz); /// put it outside the 'if'! Otherwise we have a difference wrt bz Configurable (< 1 permille) in Run2 conv. data
308308
// df.print();
309309
}
310-
df.setBz(bz);
310+
df.setBz(static_cast<float>(bz));
311311

312312
// reconstruct the 3-prong secondary vertex
313313
hCandidates->Fill(SVFitting::BeforeFit);
@@ -371,15 +371,15 @@ struct HfCandidateCreator3Prong {
371371
trackParVar0.propagateToDCA(primaryVertex, bz, &impactParameter0);
372372
trackParVar1.propagateToDCA(primaryVertex, bz, &impactParameter1);
373373
trackParVar2.propagateToDCA(primaryVertex, bz, &impactParameter2);
374-
registry.fill(HIST("hDcaXYProngs"), track0.pt(), impactParameter0.getY() * toMicrometers);
375-
registry.fill(HIST("hDcaXYProngs"), track1.pt(), impactParameter1.getY() * toMicrometers);
376-
registry.fill(HIST("hDcaXYProngs"), track2.pt(), impactParameter2.getY() * toMicrometers);
377-
registry.fill(HIST("hDcaZProngs"), track0.pt(), impactParameter0.getZ() * toMicrometers);
378-
registry.fill(HIST("hDcaZProngs"), track1.pt(), impactParameter1.getZ() * toMicrometers);
379-
registry.fill(HIST("hDcaZProngs"), track2.pt(), impactParameter2.getZ() * toMicrometers);
374+
registry.fill(HIST("hDcaXYProngs"), track0.pt(), impactParameter0.getY() * CentiToMicro);
375+
registry.fill(HIST("hDcaXYProngs"), track1.pt(), impactParameter1.getY() * CentiToMicro);
376+
registry.fill(HIST("hDcaXYProngs"), track2.pt(), impactParameter2.getY() * CentiToMicro);
377+
registry.fill(HIST("hDcaZProngs"), track0.pt(), impactParameter0.getZ() * CentiToMicro);
378+
registry.fill(HIST("hDcaZProngs"), track1.pt(), impactParameter1.getZ() * CentiToMicro);
379+
registry.fill(HIST("hDcaZProngs"), track2.pt(), impactParameter2.getZ() * CentiToMicro);
380380

381381
// get uncertainty of the decay length
382-
double phi, theta;
382+
double phi{}, theta{};
383383
getPointDirection(std::array{primaryVertex.getX(), primaryVertex.getY(), primaryVertex.getZ()}, secondaryVertex, phi, theta);
384384
auto errorDecayLength = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phi, theta) + getRotatedCovMatrixXX(covMatrixPCA, phi, theta));
385385
auto errorDecayLengthXY = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phi, 0.) + getRotatedCovMatrixXX(covMatrixPCA, phi, 0.));
@@ -481,7 +481,7 @@ struct HfCandidateCreator3Prong {
481481
}
482482
float covMatrixPV[6];
483483

484-
KFParticle::SetField(bz);
484+
KFParticle::SetField(static_cast<float>(bz));
485485
KFPVertex kfpVertex = createKFPVertexFromCollision(collision);
486486

487487
if constexpr (DoPvRefit) {
@@ -513,22 +513,22 @@ struct HfCandidateCreator3Prong {
513513

514514
float impactParameter0XY = 0., errImpactParameter0XY = 0., impactParameter1XY = 0., errImpactParameter1XY = 0., impactParameter2XY = 0., errImpactParameter2XY = 0.;
515515
if (!kfFirstProton.GetDistanceFromVertexXY(kfpV, impactParameter0XY, errImpactParameter0XY)) {
516-
registry.fill(HIST("hDcaXYProngs"), track0.pt(), impactParameter0XY * toMicrometers);
517-
registry.fill(HIST("hDcaZProngs"), track0.pt(), std::sqrt(kfFirstProton.GetDistanceFromVertex(kfpV) * kfFirstProton.GetDistanceFromVertex(kfpV) - impactParameter0XY * impactParameter0XY) * toMicrometers);
516+
registry.fill(HIST("hDcaXYProngs"), track0.pt(), impactParameter0XY * CentiToMicro);
517+
registry.fill(HIST("hDcaZProngs"), track0.pt(), std::sqrt(kfFirstProton.GetDistanceFromVertex(kfpV) * kfFirstProton.GetDistanceFromVertex(kfpV) - impactParameter0XY * impactParameter0XY) * CentiToMicro);
518518
} else {
519519
registry.fill(HIST("hDcaXYProngs"), track0.pt(), UndefValueFloat);
520520
registry.fill(HIST("hDcaZProngs"), track0.pt(), UndefValueFloat);
521521
}
522522
if (!kfSecondKaon.GetDistanceFromVertexXY(kfpV, impactParameter1XY, errImpactParameter1XY)) {
523-
registry.fill(HIST("hDcaXYProngs"), track1.pt(), impactParameter1XY * toMicrometers);
524-
registry.fill(HIST("hDcaZProngs"), track1.pt(), std::sqrt(kfSecondKaon.GetDistanceFromVertex(kfpV) * kfSecondKaon.GetDistanceFromVertex(kfpV) - impactParameter1XY * impactParameter1XY) * toMicrometers);
523+
registry.fill(HIST("hDcaXYProngs"), track1.pt(), impactParameter1XY * CentiToMicro);
524+
registry.fill(HIST("hDcaZProngs"), track1.pt(), std::sqrt(kfSecondKaon.GetDistanceFromVertex(kfpV) * kfSecondKaon.GetDistanceFromVertex(kfpV) - impactParameter1XY * impactParameter1XY) * CentiToMicro);
525525
} else {
526526
registry.fill(HIST("hDcaXYProngs"), track1.pt(), UndefValueFloat);
527527
registry.fill(HIST("hDcaZProngs"), track1.pt(), UndefValueFloat);
528528
}
529529
if (!kfThirdProton.GetDistanceFromVertexXY(kfpV, impactParameter2XY, errImpactParameter2XY)) {
530-
registry.fill(HIST("hDcaXYProngs"), track2.pt(), impactParameter2XY * toMicrometers);
531-
registry.fill(HIST("hDcaZProngs"), track2.pt(), std::sqrt(kfThirdProton.GetDistanceFromVertex(kfpV) * kfThirdProton.GetDistanceFromVertex(kfpV) - impactParameter2XY * impactParameter2XY) * toMicrometers);
530+
registry.fill(HIST("hDcaXYProngs"), track2.pt(), impactParameter2XY * CentiToMicro);
531+
registry.fill(HIST("hDcaZProngs"), track2.pt(), std::sqrt(kfThirdProton.GetDistanceFromVertex(kfpV) * kfThirdProton.GetDistanceFromVertex(kfpV) - impactParameter2XY * impactParameter2XY) * CentiToMicro);
532532
} else {
533533
registry.fill(HIST("hDcaXYProngs"), track2.pt(), UndefValueFloat);
534534
registry.fill(HIST("hDcaZProngs"), track2.pt(), UndefValueFloat);
@@ -604,14 +604,14 @@ struct HfCandidateCreator3Prong {
604604
const float massPiK = kfPairPiK.GetMass();
605605

606606
if (applyInvMassConstraint) { // constraints applied after minv getters - to preserve unbiased values of minv
607-
kfCandPKPi.SetNonlinearMassConstraint(createLc ? MassLambdaCPlus : MassXiCPlus);
608-
kfCandPiKP.SetNonlinearMassConstraint(createLc ? MassLambdaCPlus : MassXiCPlus);
607+
kfCandPKPi.SetNonlinearMassConstraint(createLc ? static_cast<float>(MassLambdaCPlus) : static_cast<float>(MassXiCPlus));
608+
kfCandPiKP.SetNonlinearMassConstraint(createLc ? static_cast<float>(MassLambdaCPlus) : static_cast<float>(MassXiCPlus));
609609
kfCandPiKPi.SetNonlinearMassConstraint(MassDPlus);
610610
kfCandKKPi.SetNonlinearMassConstraint(MassDS);
611611
kfCandPiKK.SetNonlinearMassConstraint(MassDS);
612612
}
613613

614-
const float chi2geo = kfCandPKPi.Chi2() / kfCandPKPi.NDF();
614+
const float chi2geo = kfCandPKPi.Chi2() / static_cast<float>(kfCandPKPi.NDF());
615615
const std::pair<float, float> ldl = kfCalculateLdL(kfCandPKPi, kfpV);
616616

617617
std::array<float, 3> pProng0 = kfCalculateProngMomentumInSecondaryVertex(kfFirstProton, kfCandPiKP);
@@ -624,7 +624,7 @@ struct HfCandidateCreator3Prong {
624624
registry.fill(HIST("hCovSVZZ"), kfCandPKPi.Covariance(2, 2));
625625

626626
auto* covMatrixSV = kfCandPKPi.CovarianceMatrix();
627-
double phi, theta;
627+
double phi{}, theta{};
628628
getPointDirection(std::array{kfpV.GetX(), kfpV.GetY(), kfpV.GetZ()}, std::array{kfCandPKPi.GetX(), kfCandPKPi.GetY(), kfCandPKPi.GetZ()}, phi, theta);
629629
auto errorDecayLength = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phi, theta) + getRotatedCovMatrixXX(covMatrixSV, phi, theta));
630630
auto errorDecayLengthXY = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phi, 0.) + getRotatedCovMatrixXX(covMatrixSV, phi, 0.));
@@ -647,7 +647,7 @@ struct HfCandidateCreator3Prong {
647647
kfpV.GetX(), kfpV.GetY(), kfpV.GetZ(),
648648
kfCandPKPi.GetX(), kfCandPKPi.GetY(), kfCandPKPi.GetZ(),
649649
errorDecayLength, errorDecayLengthXY,
650-
kfCandPKPi.GetChi2() / kfCandPKPi.GetNDF(),
650+
kfCandPKPi.GetChi2() / static_cast<float>(kfCandPKPi.GetNDF()),
651651
pProng0.at(0), pProng0.at(1), pProng0.at(2),
652652
pProng1.at(0), pProng1.at(1), pProng1.at(2),
653653
pProng2.at(0), pProng2.at(1), pProng2.at(2),
@@ -904,7 +904,7 @@ struct HfCandidateCreator3Prong {
904904
const auto bc = collision.template foundBC_as<aod::BCsWithTimestamps>();
905905
const auto ir = hfEvSel.getInteractionRate(bc, ccdb); // Hz
906906
/// monitor the satisfied event selections
907-
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy, ir);
907+
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy, static_cast<float>(ir));
908908

909909
} /// end loop over collisions
910910
}
@@ -923,7 +923,7 @@ struct HfCandidateCreator3Prong {
923923
const auto bc = collision.template foundBC_as<aod::BCsWithTimestamps>();
924924
const auto ir = hfEvSel.getInteractionRate(bc, ccdb); // Hz
925925
/// monitor the satisfied event selections
926-
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy, ir);
926+
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy, static_cast<float>(ir));
927927

928928
} /// end loop over collisions
929929
}
@@ -942,7 +942,7 @@ struct HfCandidateCreator3Prong {
942942
const auto bc = collision.template foundBC_as<aod::BCsWithTimestamps>();
943943
const auto ir = hfEvSel.getInteractionRate(bc, ccdb); // Hz
944944
/// monitor the satisfied event selections
945-
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy, ir);
945+
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy, static_cast<float>(ir));
946946

947947
} /// end loop over collisions
948948
}
@@ -966,7 +966,7 @@ struct HfCandidateCreator3Prong {
966966
const auto bc = collision.template foundBC_as<aod::BcFullInfos>();
967967
const auto ir = hfEvSel.getInteractionRate(bc, ccdb); // Hz
968968
/// monitor the satisfied event selections
969-
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy, ir);
969+
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy, static_cast<float>(ir));
970970

971971
} /// end loop over collisions
972972
}
@@ -1132,7 +1132,7 @@ struct HfCandidateCreator3ProngExpressions {
11321132
return;
11331133
}
11341134
if (indexRec > -1) {
1135-
flagChannelMain = sign * channelMain;
1135+
flagChannelMain = sign * static_cast<int8_t>(channelMain);
11361136

11371137
/// swapping for D+, Ds->Kpipi; Lc, Xic->pKpi
11381138
if (std::abs(flagChannelMain) == DecayChannelMain::DplusToPiKK || std::abs(flagChannelMain) == DecayChannelMain::DsToPiKK || std::abs(flagChannelMain) == DecayChannelMain::LcToPKPi || std::abs(flagChannelMain) == DecayChannelMain::XicToPKPi) {
@@ -1185,7 +1185,7 @@ struct HfCandidateCreator3ProngExpressions {
11851185
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kDPlus, arrPdgDaughtersDplusToPiKPi, true, &sign, 2);
11861186
}
11871187
if (indexRec > -1) {
1188-
flagChannelMain = sign * DecayChannelMain::DplusToPiKPi;
1188+
flagChannelMain = sign * static_cast<int8_t>(DecayChannelMain::DplusToPiKPi);
11891189
}
11901190
}
11911191

@@ -1215,7 +1215,7 @@ struct HfCandidateCreator3ProngExpressions {
12151215
}
12161216
}
12171217
if (indexRec > -1) {
1218-
flagChannelMain = sign * (isDplus ? DecayChannelMain::DplusToPiKK : DecayChannelMain::DsToPiKK);
1218+
flagChannelMain = sign * (isDplus ? static_cast<int8_t>(DecayChannelMain::DplusToPiKK) : static_cast<int8_t>(DecayChannelMain::DsToPiKK));
12191219
if (arrayDaughters[0].has_mcParticle()) {
12201220
swapping = static_cast<int8_t>(std::abs(arrayDaughters[0].mcParticle().pdgCode()) == kPiPlus);
12211221
}
@@ -1243,7 +1243,7 @@ struct HfCandidateCreator3ProngExpressions {
12431243
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kDStar, arrPdgDaughtersDstarToPiKPi, true, &sign, 2);
12441244
}
12451245
if (indexRec > -1) {
1246-
flagChannelMain = sign * DecayChannelMain::DstarToPiKPi;
1246+
flagChannelMain = sign * static_cast<int8_t>(DecayChannelMain::DstarToPiKPi);
12471247
flagChannelResonant = 0;
12481248
}
12491249
}
@@ -1261,7 +1261,7 @@ struct HfCandidateCreator3ProngExpressions {
12611261
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kLambdaCPlus, arrPdgDaughtersLcToPKPi, true, &sign, 2);
12621262
}
12631263
if (indexRec > -1) {
1264-
flagChannelMain = sign * DecayChannelMain::LcToPKPi;
1264+
flagChannelMain = sign * static_cast<int8_t>(DecayChannelMain::LcToPKPi);
12651265

12661266
// Flagging the different Λc± → p± K∓ π± decay channels
12671267
if (arrayDaughters[0].has_mcParticle()) {
@@ -1297,7 +1297,7 @@ struct HfCandidateCreator3ProngExpressions {
12971297
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kXiCPlus, arrPdgDaughtersXicToPKPi, true, &sign, 2);
12981298
}
12991299
if (indexRec > -1) {
1300-
flagChannelMain = sign * DecayChannelMain::XicToPKPi;
1300+
flagChannelMain = sign * static_cast<int8_t>(DecayChannelMain::XicToPKPi);
13011301
flagChannelResonant = 0; // TODO
13021302
if (arrayDaughters[0].has_mcParticle()) {
13031303
swapping = static_cast<int8_t>(std::abs(arrayDaughters[0].mcParticle().pdgCode()) == kPiPlus);
@@ -1309,7 +1309,7 @@ struct HfCandidateCreator3ProngExpressions {
13091309
// Check whether the particle is non-prompt (from a b quark).
13101310
if (flagChannelMain != 0) {
13111311
auto particle = mcParticles.rawIteratorAt(indexRec);
1312-
origin = RecoDecay::getCharmHadronOrigin(mcParticles, particle, false, &idxBhadMothers);
1312+
origin = static_cast<int8_t>(RecoDecay::getCharmHadronOrigin(mcParticles, particle, false, &idxBhadMothers));
13131313
}
13141314
if (origin == RecoDecay::OriginType::NonPrompt) {
13151315
auto bHadMother = mcParticles.rawIteratorAt(idxBhadMothers[0]);

PWGHF/TableProducer/candidateSelectorLc.cxx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,18 @@ struct HfCandidateSelectorLc {
6262
Configurable<double> ptCandMax{"ptCandMax", 36., "Upper bound of candidate pT"};
6363
Configurable<bool> usePid{"usePid", true, "Bool to use or not the PID based on nSigma cut at filtering level"};
6464
// TPC PID
65-
Configurable<double> ptPidTpcMin{"ptPidTpcMin", 0.1, "Lower bound of track pT for TPC PID"};
66-
Configurable<double> ptPidTpcMax{"ptPidTpcMax", 1., "Upper bound of track pT for TPC PID"};
67-
Configurable<double> nSigmaTpcMax{"nSigmaTpcMax", 3., "Nsigma cut on TPC only"};
68-
Configurable<double> nSigmaTpcCombinedMax{"nSigmaTpcCombinedMax", 5., "Nsigma cut on TPC combined with TOF"};
65+
Configurable<float> ptPidTpcMin{"ptPidTpcMin", 0.1, "Lower bound of track pT for TPC PID"};
66+
Configurable<float> ptPidTpcMax{"ptPidTpcMax", 1., "Upper bound of track pT for TPC PID"};
67+
Configurable<float> nSigmaTpcMax{"nSigmaTpcMax", 3., "Nsigma cut on TPC only"};
68+
Configurable<float> nSigmaTpcCombinedMax{"nSigmaTpcCombinedMax", 5., "Nsigma cut on TPC combined with TOF"};
6969
// TOF PID
70-
Configurable<double> ptPidTofMin{"ptPidTofMin", 0.5, "Lower bound of track pT for TOF PID"};
71-
Configurable<double> ptPidTofMax{"ptPidTofMax", 2.5, "Upper bound of track pT for TOF PID"};
72-
Configurable<double> nSigmaTofMax{"nSigmaTofMax", 3., "Nsigma cut on TOF only"};
73-
Configurable<double> nSigmaTofCombinedMax{"nSigmaTofCombinedMax", 5., "Nsigma cut on TOF combined with TPC"};
70+
Configurable<float> ptPidTofMin{"ptPidTofMin", 0.5, "Lower bound of track pT for TOF PID"};
71+
Configurable<float> ptPidTofMax{"ptPidTofMax", 2.5, "Upper bound of track pT for TOF PID"};
72+
Configurable<float> nSigmaTofMax{"nSigmaTofMax", 3., "Nsigma cut on TOF only"};
73+
Configurable<float> nSigmaTofCombinedMax{"nSigmaTofCombinedMax", 5., "Nsigma cut on TOF combined with TPC"};
7474
// Bayesian PID
75-
Configurable<double> ptPidBayesMin{"ptPidBayesMin", 0., "Lower bound of track pT for Bayesian PID"};
76-
Configurable<double> ptPidBayesMax{"ptPidBayesMax", 100, "Upper bound of track pT for Bayesian PID"};
75+
Configurable<float> ptPidBayesMin{"ptPidBayesMin", 0., "Lower bound of track pT for Bayesian PID"};
76+
Configurable<float> ptPidBayesMax{"ptPidBayesMax", 100, "Upper bound of track pT for Bayesian PID"};
7777
// Combined PID options
7878
Configurable<bool> usePidTpcAndTof{"usePidTpcAndTof", false, "Bool to decide how to combine TPC and TOF PID: true = both (if present, only one otherwise); false = one is enough"};
7979
// TPC quality track cuts
@@ -518,11 +518,11 @@ struct HfCandidateSelectorLc {
518518

519519
if (usePid) {
520520
// track-level PID selection
521-
TrackSelectorPID::Status pidTrackPos1Proton;
522-
TrackSelectorPID::Status pidTrackPos2Proton;
523-
TrackSelectorPID::Status pidTrackPos1Pion;
524-
TrackSelectorPID::Status pidTrackPos2Pion;
525-
TrackSelectorPID::Status pidTrackNegKaon;
521+
TrackSelectorPID::Status pidTrackPos1Proton{};
522+
TrackSelectorPID::Status pidTrackPos2Proton{};
523+
TrackSelectorPID::Status pidTrackPos1Pion{};
524+
TrackSelectorPID::Status pidTrackPos2Pion{};
525+
TrackSelectorPID::Status pidTrackNegKaon{};
526526
if (usePidTpcAndTof) {
527527
pidTrackPos1Proton = selectorProton.statusTpcAndTof(trackPos1, candidate.nSigTpcPr0(), candidate.nSigTofPr0());
528528
pidTrackPos2Proton = selectorProton.statusTpcAndTof(trackPos2, candidate.nSigTpcPr2(), candidate.nSigTofPr2());

0 commit comments

Comments
 (0)