Skip to content

Commit a256ed4

Browse files
committed
Fix magic numbers
1 parent 0aa0979 commit a256ed4

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

PWGLF/Tasks/Resonances/lambda1405analysis.cxx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ struct lambda1405candidate {
122122
};
123123

124124
struct lambda1405analysis {
125-
int lambda1405PdgCode = 102132; // PDG code for Lambda(1405)
125+
int lambda1405PdgCode = 102132; // PDG code for Lambda(1405); o2-linter: disable=pdg/explicit-code
126126
Produces<aod::Lambda1405Cands> outputDataTable; // Output table for Lambda(1405) candidates
127127
Produces<aod::Lambda1405Flow> outputDataFlowTable; // Output table for Lambda(1405) flow analysis
128128
Produces<aod::Lambda1405CandsMC> outputDataTableMC; // Output table for Lambda(1405) candidates in MC
@@ -568,7 +568,8 @@ struct lambda1405analysis {
568568
double massSigma = isSigmaMinus ? o2::constants::physics::MassSigmaMinus : o2::constants::physics::MassSigmaPlus;
569569

570570
double pMother = std::sqrt(sigmaPx * sigmaPx + sigmaPy * sigmaPy + sigmaPz * sigmaPz);
571-
if (pMother < 1e-12f) {
571+
float zeroValTolerance{1e-12f};
572+
if (pMother < zeroValTolerance) {
572573
LOG(debug) << "Recalculation of Sigma momentum failed: mother momentum is zero " << sigmaPx << ", " << sigmaPy << ", " << sigmaPz;
573574
return -999.f;
574575
}
@@ -588,7 +589,7 @@ struct lambda1405analysis {
588589
double B = -4.0 * a * K;
589590
double C = 4.0 * eChDau * eChDau * massSigma * massSigma - K * K;
590591

591-
if (std::abs(A) < 1e-6f) {
592+
if (std::abs(A) < zeroValTolerance) {
592593
LOG(debug) << "Recalculation of Sigma momentum failed: A is zero " << sigmaPx << ", " << sigmaPy << ", " << sigmaPz << ", A = " << A << ", B = " << B << ", C = " << C;
593594
return -999.f;
594595
}
@@ -598,20 +599,20 @@ struct lambda1405analysis {
598599
rSelections.fill(HIST("hRecalcSigmaPlusMom"), 2); // Non-zero A
599600
}
600601

601-
double D = B * B - 4.0 * A * C;
602-
if (D < 0.0) {
603-
LOG(debug) << "Recalculation of Sigma momentum failed: D is negative " << sigmaPx << ", " << sigmaPy << ", " << sigmaPz << ", A = " << A << ", B = " << B << ", C = " << C << ", D = " << D;
602+
double det = B * B - 4.0 * A * C;
603+
if (det < 0.0) {
604+
LOG(debug) << "Recalculation of Sigma momentum failed: determinant is negative " << sigmaPx << ", " << sigmaPy << ", " << sigmaPz << ", A = " << A << ", B = " << B << ", C = " << C << ", determinant = " << det;
604605
return -999.f;
605606
}
606607
if (isSigmaMinus) {
607-
rSelections.fill(HIST("hRecalcSigmaMinusMom"), 3); // Positive D
608+
rSelections.fill(HIST("hRecalcSigmaMinusMom"), 3); // Positive determinant
608609
} else {
609-
rSelections.fill(HIST("hRecalcSigmaPlusMom"), 3); // Positive D
610+
rSelections.fill(HIST("hRecalcSigmaPlusMom"), 3); // Positive determinant
610611
}
611612

612-
double sqrtD = std::sqrt(D);
613-
double p1 = (-B + sqrtD) / (2.0 * A);
614-
double p2 = (-B - sqrtD) / (2.0 * A);
613+
double sqrtDet = std::sqrt(det);
614+
double p1 = (-B + sqrtDet) / (2.0 * A);
615+
double p2 = (-B - sqrtDet) / (2.0 * A);
615616
if (p2 < 0.0 && p1 < 0.0) {
616617
LOG(debug) << "Recalculation of Sigma momentum failed: both solutions are negative " << sigmaPx << ", " << sigmaPy << ", " << sigmaPz << ", p1: " << p1 << ", p2: " << p2;
617618
return -999.f;

0 commit comments

Comments
 (0)