Skip to content

Commit 5d9beac

Browse files
committed
Fix magic-number errors
1 parent 9e8fc28 commit 5d9beac

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

PWGHF/TableProducer/trackIndexSkimCreator.cxx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2252,7 +2252,7 @@ struct HfTrackIndexSkimCreator {
22522252
nCandContr--;
22532253
isTrackSecondContr = false;
22542254
}
2255-
if (nCandContr == 2) {
2255+
if (nCandContr == 2) { // o2-linter: disable="magic-number" (see comment below)
22562256
/// Both the daughter tracks were used for the original PV refit, let's refit it after excluding them
22572257
if (config.debugPvRefit) {
22582258
LOG(info) << "### [2 Prong] Calling performPvRefitCandProngs for HF 2 prong candidate";
@@ -2377,7 +2377,7 @@ struct HfTrackIndexSkimCreator {
23772377
}
23782378

23792379
// if the cut on the decay length of 3-prongs computed with the first two tracks is enabled and the vertex was not computed for the D0, we compute it now
2380-
if (config.do3Prong && is2ProngCandidateGoodFor3Prong && (config.minTwoTrackDecayLengthFor3Prongs > 0.f || config.maxTwoTrackChi2PcaFor3Prongs < 1.e9f) && nVtxFrom2ProngFitter == 0) {
2380+
if (config.do3Prong && is2ProngCandidateGoodFor3Prong && (config.minTwoTrackDecayLengthFor3Prongs > 0.f || config.maxTwoTrackChi2PcaFor3Prongs < 1.e9f) && nVtxFrom2ProngFitter == 0) { // o2-linter: disable="magic-number" (default maxTwoTrackChi2PcaFor3Prongs is 1.e10)
23812381
try {
23822382
nVtxFrom2ProngFitter = df2.process(trackParVarPos1, trackParVarNeg1);
23832383
} catch (...) {
@@ -2492,7 +2492,7 @@ struct HfTrackIndexSkimCreator {
24922492
vecCandPvContributorGlobId.push_back(trackPos2.globalIndex());
24932493
}
24942494

2495-
if (nCandContr == 3 || nCandContr == 2) {
2495+
if (nCandContr == 3 || nCandContr == 2) { // o2-linter: disable="magic-number" (see comment below)
24962496
/// At least two of the daughter tracks were used for the original PV refit, let's refit it after excluding them
24972497
if (config.debugPvRefit) {
24982498
LOG(info) << "### [3 prong] Calling performPvRefitCandProngs for HF 3 prong candidate, removing " << nCandContr << " daughters";
@@ -2744,7 +2744,7 @@ struct HfTrackIndexSkimCreator {
27442744
vecCandPvContributorGlobId.push_back(trackNeg2.globalIndex());
27452745
}
27462746

2747-
if (nCandContr == 3 || nCandContr == 2) {
2747+
if (nCandContr == 3 || nCandContr == 2) { // o2-linter: disable="magic-number" (see comment below)
27482748
/// At least two of the daughter tracks were used for the original PV refit, let's refit it after excluding them
27492749
if (config.debugPvRefit) {
27502750
LOG(info) << "### [3 prong] Calling performPvRefitCandProngs for HF 3 prong candidate, removing " << nCandContr << " daughters";
@@ -2898,7 +2898,8 @@ struct HfTrackIndexSkimCreator {
28982898
}
28992899
}
29002900

2901-
if (config.doDstar && TESTBIT(isSelected2ProngCand, hf_cand_2prong::DecayType::D0ToPiK) && (pt2Prong + config.ptTolerance) * 1.2 > config.binsPtDstarToD0Pi->at(0) && whichHypo2Prong[kN2ProngDecays] != 0) { // if D* enabled and pt of the D0 is larger than the minimum of the D* one within 20% (D* and D0 momenta are very similar, always within 20% according to PYTHIA8)
2901+
if (config.doDstar && TESTBIT(isSelected2ProngCand, hf_cand_2prong::DecayType::D0ToPiK) && (pt2Prong + config.ptTolerance) * 1.2 > config.binsPtDstarToD0Pi->at(0) && whichHypo2Prong[kN2ProngDecays] != 0) { // o2-linter: disable="magic-number" (see comment below)
2902+
// if D* enabled and pt of the D0 is larger than the minimum of the D* one within 20% (D* and D0 momenta are very similar, always within 20% according to PYTHIA8)
29022903
// second loop over positive tracks
29032904
if (TESTBIT(whichHypo2Prong[kN2ProngDecays], 0) && (!config.applyKaonPidIn3Prongs || TESTBIT(trackIndexNeg1.isIdentifiedPid(), ChannelKaonPid))) { // only for D0 candidates; moreover if kaon PID enabled, apply to the negative track
29042905
auto groupedTrackIndicesSoftPionsPos = positiveSoftPions->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache);
@@ -3227,8 +3228,9 @@ struct HfTrackIndexSkimCreatorCascades {
32273228
const std::array vertexV0{v0.x(), v0.y(), v0.z()};
32283229
// we build the neutral track to then build the cascade
32293230
std::array<float, 21> covV{};
3230-
constexpr int MomInd[6] = {9, 13, 14, 18, 19, 20}; // cov matrix elements for momentum component
3231-
for (int i = 0; i < 6; i++) {
3231+
constexpr std::size_t NIndicesMom{6u};
3232+
constexpr std::size_t MomInd[NIndicesMom] = {9, 13, 14, 18, 19, 20}; // cov matrix elements for momentum component
3233+
for (std::size_t i = 0; i < NIndicesMom; i++) {
32323234
covV[MomInd[i]] = v0.momentumCovMat()[i];
32333235
covV[i] = v0.positionCovMat()[i];
32343236
}
@@ -3263,7 +3265,7 @@ struct HfTrackIndexSkimCreatorCascades {
32633265
std::array posCasc{0., 0., 0.};
32643266
if (config.useDCAFitter) {
32653267
const auto& cascVtx = df2.getPCACandidate();
3266-
for (int iCoord{0}; iCoord < 3; ++iCoord) {
3268+
for (int iCoord{0}; iCoord < 3; ++iCoord) { // o2-linter: disable="magic-number" ({x, y, z} coordinates})
32673269
posCasc[iCoord] = cascVtx[iCoord];
32683270
}
32693271
}
@@ -3623,8 +3625,9 @@ struct HfTrackIndexSkimCreatorLfCascades {
36233625
const std::array vertexCasc{casc.x(), casc.y(), casc.z()};
36243626
const std::array pVecCasc{casc.px(), casc.py(), casc.pz()};
36253627
std::array<float, 21> covCasc{};
3626-
constexpr int MomInd[6] = {9, 13, 14, 18, 19, 20}; // cov matrix elements for momentum component
3627-
for (int i = 0; i < 6; i++) {
3628+
constexpr std::size_t NIndicesMom{6u};
3629+
constexpr std::size_t MomInd[NIndicesMom] = {9, 13, 14, 18, 19, 20}; // cov matrix elements for momentum component
3630+
for (std::size_t i = 0; i < NIndicesMom; i++) {
36283631
covCasc[MomInd[i]] = casc.momentumCovMat()[i];
36293632
covCasc[i] = casc.positionCovMat()[i];
36303633
}

0 commit comments

Comments
 (0)