Skip to content

Commit dc4bfd5

Browse files
author
Stefanie Mrozinski
committed
fix code-checker errors and warnings
1 parent 08136eb commit dc4bfd5

4 files changed

Lines changed: 38 additions & 34 deletions

File tree

‎PWGEM/PhotonMeson/DataModel/gammaTables.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ DECLARE_SOA_COLUMN(Z, z, float); //! z (cm), TPC-only legs after
301301
DECLARE_SOA_COLUMN(Snp, snp, float); //! sin(phi) in the local frame
302302
DECLARE_SOA_COLUMN(Tgl, tgl, float); //! tan(lambda)
303303
DECLARE_SOA_COLUMN(Signed1Pt, signed1Pt, float); //! q/pT (c/GeV)
304-
DECLARE_SOA_COLUMN(Cov, cov, float[15]); //! covariance matrix, o2::track::TrackParCov order
304+
DECLARE_SOA_COLUMN(Cov, cov, float[15]); // NOLINT(modernize-avoid-c-arrays) //! covariance matrix, o2::track::TrackParCov order
305305
} // namespace v0legcov
306306

307307
// leg track parameters as used in the V0 fit, one row per V0Legs row (optional builder output, joinable with V0Legs)

‎PWGEM/PhotonMeson/TableProducer/photonMixedEventProducer.cxx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ struct PhotonMixedEventProducer {
303303
c.snp = legCov.snp();
304304
c.tgl = legCov.tgl();
305305
c.signed1Pt = legCov.signed1Pt();
306-
const auto* cov = legCov.cov();
306+
const auto& cov = legCov.cov();
307307
for (size_t i = 0; i < c.cov.size(); ++i) {
308308
c.cov[i] = cov[i];
309309
}
@@ -391,8 +391,8 @@ struct PhotonMixedEventProducer {
391391
registry.fill(HIST("Mix/hPhotonPtEta"), type, std::hypot(p->px, p->py), std::asinh(p->pz / std::hypot(p->px, p->py)));
392392
}
393393
for (const auto& l : p->legs) {
394-
const bool hasITS = l.detectorMap & o2::aod::track::ITS;
395-
const bool hasTPC = l.detectorMap & o2::aod::track::TPC;
394+
const bool hasITS = (l.detectorMap & o2::aod::track::ITS) != 0;
395+
const bool hasTPC = (l.detectorMap & o2::aod::track::TPC) != 0;
396396
registry.fill(HIST("Mix/hLegTypes"), type, hasITS && hasTPC ? 0.f : (hasTPC ? 1.f : (hasITS ? 2.f : 3.f)));
397397
writeLeg(l, *p);
398398
}

‎PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.h‎

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
#include <MathUtils/Primitive2D.h>
6565
#include <ReconstructionDataFormats/HelixHelper.h>
6666
#include <ReconstructionDataFormats/PID.h>
67-
#include <ReconstructionDataFormats/TrackParametrization.h>
67+
#include <ReconstructionDataFormats/Track.h>
6868

6969
#include <Math/Vector4D.h> // IWYU pragma: keep (do not replace with Math/Vector4Dfwd.h)
7070
#include <Math/Vector4Dfwd.h>
@@ -87,6 +87,7 @@
8787
#include <map>
8888
#include <numeric>
8989
#include <optional>
90+
#include <ratio>
9091
#include <set>
9192
#include <string>
9293
#include <tuple>
@@ -201,17 +202,17 @@ struct PairFit {
201202
struct SourcePV {
202203
float x = 0.f, y = 0.f, z = 0.f, cXX = 0.f, cXY = 0.f, cXZ = 0.f, cYY = 0.f, cYZ = 0.f, cZZ = 0.f, c2 = 0.f;
203204
uint16_t nContrib = 0;
204-
float posX() const { return x; }
205-
float posY() const { return y; }
206-
float posZ() const { return z; }
207-
float covXX() const { return cXX; }
208-
float covXY() const { return cXY; }
209-
float covXZ() const { return cXZ; }
210-
float covYY() const { return cYY; }
211-
float covYZ() const { return cYZ; }
212-
float covZZ() const { return cZZ; }
213-
float chi2() const { return c2; }
214-
uint16_t numContrib() const { return nContrib; }
205+
[[nodiscard]] float posX() const { return x; }
206+
[[nodiscard]] float posY() const { return y; }
207+
[[nodiscard]] float posZ() const { return z; }
208+
[[nodiscard]] float covXX() const { return cXX; }
209+
[[nodiscard]] float covXY() const { return cXY; }
210+
[[nodiscard]] float covXZ() const { return cXZ; }
211+
[[nodiscard]] float covYY() const { return cYY; }
212+
[[nodiscard]] float covYZ() const { return cYZ; }
213+
[[nodiscard]] float covZZ() const { return cZZ; }
214+
[[nodiscard]] float chi2() const { return c2; }
215+
[[nodiscard]] uint16_t numContrib() const { return nContrib; }
215216
};
216217

217218
struct LegDcaKey {
@@ -1853,7 +1854,7 @@ struct PhotonConversionBuilder {
18531854
};
18541855
const auto tglLess = [](const FinderLeg& c, float v) { return c.tgl < v; };
18551856
// time-binning of the negative legs: the time window of a positive leg is intersected with the time windows of the negative legs in the same bin. Reason for implementation: faster than checking all negative legs for each positive leg
1856-
const bool timeBinned = !(isMC && mDiag != nullptr) && !eleLegs.empty();
1857+
const bool timeBinned = (!isMC || mDiag == nullptr) && !eleLegs.empty();
18571858
std::vector<std::vector<uint32_t>> eleInBin;
18581859
double tBin0 = 0.;
18591860
const double binWidth = 5000.; // ns
@@ -2975,7 +2976,7 @@ struct PhotonConversionBuilder {
29752976
if (q >= 0.2f) { // o2-linter: disable=magic-number (diagnostic range)
29762977
continue;
29772978
}
2978-
const float nIts = static_cast<float>(a.posMC.its + a.eleMC.its + b.posMC.its + b.eleMC.its);
2979+
const auto nIts = static_cast<float>(a.posMC.its + a.eleMC.its + b.posMC.its + b.eleMC.its);
29792980
const float amb = (candLegs.contains({colId, a.posRow, b.eleRow}) || candLegs.contains({colId, b.posRow, a.eleRow})) ? 1.f : 0.f;
29802981
const float cls = mixPairClass(a, b);
29812982
registry.fill(HIST("Mixed/Pairs/hFakeClass"), type, stage, 0.f, q, nIts, amb);
@@ -3082,7 +3083,7 @@ struct PhotonConversionBuilder {
30823083
continue;
30833084
}
30843085
const float q = qInv(a.px, a.py, a.pz, b.px, b.py, b.pz);
3085-
const float truth = static_cast<float>(mixPairTruth(a, b));
3086+
const auto truth = static_cast<float>(mixPairTruth(a, b));
30863087
if constexpr (after) {
30873088
registry.fill(HIST("Mixed/Pairs/hQAfter"), type, 0.f, q);
30883089
registry.fill(HIST("Mixed/Pairs/hQAfter"), type, truth, q);
@@ -3295,7 +3296,7 @@ struct PhotonConversionBuilder {
32953296
setMixPairLegs(p1, legs.rawIteratorAt(t1.posID), legs.rawIteratorAt(t1.eleID));
32963297
setMixPairLegs(p2, legs.rawIteratorAt(t2.posID), legs.rawIteratorAt(t2.eleID));
32973298
const int relKind = mixRelKind(p1, p2);
3298-
const float rel = static_cast<float>(relKind);
3299+
const auto rel = static_cast<float>(relKind);
32993300
const float rel2 = relKind > 0 ? 1.f : 0.f;
33003301
const float s0 = dedup.groupMatchingScoreThreshold.value;
33013302
const float qTrue = qInv(t1.pxAtPV, t1.pyAtPV, t1.pzAtPV, t2.pxAtPV, t2.pyAtPV, t2.pzAtPV);
@@ -3664,7 +3665,7 @@ struct PhotonConversionBuilder {
36643665
(pos.sourceEventUid() != ele.sourceEventUid() || pos.mcMotherId() != ele.mcMotherId());
36653666
const float qTwo = twoPhotons ? qInv(pos.mcMotherPx(), pos.mcMotherPy(), pos.mcMotherPz(), ele.mcMotherPx(), ele.mcMotherPy(), ele.mcMotherPz()) : 1.f;
36663667
const float genuineClose = (twoPhotons && qTwo < 0.05f) ? 1.f : 0.f; // o2-linter: disable=magic-number (diagnostic range)
3667-
const float nITSx = static_cast<float>((pos.hasITS() ? 1 : 0) + (ele.hasITS() ? 1 : 0));
3668+
const auto nITSx = static_cast<float>((pos.hasITS() ? 1 : 0) + (ele.hasITS() ? 1 : 0));
36683669
if (mixed.prefilterCrossed && !crossedPrefilterCached(ip, ie)) {
36693670
if (mixed.mixedDiagnostics) {
36703671
registry.fill(HIST("Mixed/Decision/hCrossedFit"), type, genuineClose, 1.f, nITSx, std::min(qTwo, 0.0499f));
@@ -3692,7 +3693,7 @@ struct PhotonConversionBuilder {
36923693
};
36933694
const int lenient = trial(FitOptions{.relaxAP = mixed.crossedRelaxAP.value});
36943695
const int run1 = trial(FitOptions{.nonSVertexer = finderLike, .purityGate = finderLike && recovery.runFinder.value});
3695-
const float nFree = static_cast<float>((pos.sourceV0Id() == -2 ? 1 : 0) + (ele.sourceV0Id() == -2 ? 1 : 0)); // o2-linter: disable=magic-number (pooled free leg)
3696+
const auto nFree = static_cast<float>((pos.sourceV0Id() == -2 ? 1 : 0) + (ele.sourceV0Id() == -2 ? 1 : 0)); // o2-linter: disable=magic-number (pooled free leg)
36963697
registry.fill(HIST("Mixed/Decision/hFreeLegFit"), type, genuineClose > 0.5f ? 0.f : 1.f, static_cast<float>(std::min(lenient, 1999)), static_cast<float>(std::min(run1, 1999)), nITSx, nFree);
36973698
}
36983699
const int mask = mixed.freeLegRuleMask.value;
@@ -4544,7 +4545,7 @@ struct PhotonConversionBuilder {
45444545
if (pairFate == 3 || pairFate == 4) { // o2-linter: disable=magic-number (swap, one crossed stored)
45454546
auto o = crossedOriginOfPair.at(std::minmax(mids[a], mids[b]));
45464547
const int o1 = std::min(o[0], o.size() > 1 ? o[1] : o[0]), o2 = std::max(o[0], o.size() > 1 ? o[1] : o[0]);
4547-
static constexpr int OriginCode[3][3] = {{0, 1, 3}, {1, 2, 4}, {3, 4, 5}};
4548+
static constexpr std::array<std::array<int, 3>, 3> OriginCode{{{0, 1, 3}, {1, 2, 4}, {3, 4, 5}}};
45484549
if (hA < hB) {
45494550
std::swap(hA, hB);
45504551
}

‎PWGEM/PhotonMeson/Tasks/photonhbt.cxx‎

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4558,7 +4558,7 @@ struct Photonhbt {
45584558
return;
45594559
}
45604560
const float clean = std::max({a.pos.sharedFrac, a.ele.sharedFrac, b.pos.sharedFrac, b.ele.sharedFrac}) < qaflags.cfgPairClassMaxSharedFrac.value ? 1.f : 0.f;
4561-
const float cls = static_cast<float>(pcPairClass(a, b));
4561+
const auto cls = static_cast<float>(pcPairClass(a, b));
45624562
fRegistryPairMC.fill(HIST("PairClass/Pairs/hPairClass"), sample, cls, q, static_cast<float>(pcPairOrigin(a, b)), clean);
45634563
fRegistryPairMC.fill(HIST("PairClass/Pairs/hKtQ"), sample, cls, q, 0.5f * std::hypot(a.px + b.px, a.py + b.py));
45644564
if (cls == 4.f) { // o2-linter: disable=magic-number (half swap)
@@ -4567,7 +4567,7 @@ struct Photonhbt {
45674567
if (x->mpdg == kPcGamma && pcSameMother(*x, *y)) {
45684568
const float src = (x->free && y->free) ? 0.f : (x->free || y->free) ? 3.f
45694569
: (x->srcPhoton == y->srcPhoton ? 1.f : 2.f);
4570-
fRegistryPairMC.fill(HIST("PairClass/Pairs/hHalfSwapLegs"), sample, q, src, static_cast<float>((a.nFree > 0) + (b.nFree > 0)));
4570+
fRegistryPairMC.fill(HIST("PairClass/Pairs/hHalfSwapLegs"), sample, q, src, static_cast<float>((a.nFree > 0 ? 1 : 0) + (b.nFree > 0 ? 1 : 0)));
45714571
}
45724572
}
45734573
}
@@ -4576,7 +4576,7 @@ struct Photonhbt {
45764576
const float eA = std::sqrt(a.px * a.px + a.py * a.py + a.pz * a.pz), eB = std::sqrt(b.px * b.px + b.py * b.py + b.pz * b.pz);
45774577
fRegistryPairMC.fill(HIST("PairClass/Pairs/hDEQinv"), sample, cls, q, std::fabs(eA - eB), 0.5f * std::hypot(a.px + b.px, a.py + b.py));
45784578
}
4579-
fRegistryPairMC.fill(HIST("PairClass/Pairs/hFreeLegPair"), sample, cls, q, static_cast<float>((a.nFree > 0) + (b.nFree > 0)), static_cast<float>(!a.original + !b.original));
4579+
fRegistryPairMC.fill(HIST("PairClass/Pairs/hFreeLegPair"), sample, cls, q, static_cast<float>((a.nFree > 0 ? 1 : 0) + (b.nFree > 0 ? 1 : 0)), static_cast<float>((a.original ? 0 : 1) + (b.original ? 0 : 1)));
45804580
{
45814581
const ROOT::Math::PxPyPzMVector v1(a.px, a.py, a.pz, 0.f), v2(b.px, b.py, b.pz, 0.f);
45824582
const auto sum = v1 + v2;
@@ -4612,7 +4612,7 @@ struct Photonhbt {
46124612
}
46134613
fRegistryPairMC.fill(HIST("PairClass/Pairs/hPairDist"), sample, cls, q, std::hypot(a.vx - b.vx, a.vy - b.vy, a.vz - b.vz), pcTrueDist({&a.pos, &a.ele, &b.pos, &b.ele}));
46144614
ROOT::Math::PxPyPzMVector sum4;
4615-
const PcLeg* legs4[4] = {&a.pos, &a.ele, &b.pos, &b.ele};
4615+
const std::array<const PcLeg*, 4> legs4{&a.pos, &a.ele, &b.pos, &b.ele};
46164616
for (const auto* l : legs4) {
46174617
sum4 += ROOT::Math::PxPyPzMVector(l->px, l->py, l->pz, o2::constants::physics::MassElectron);
46184618
}
@@ -4639,7 +4639,7 @@ struct Photonhbt {
46394639
if (q < 0.1f) {
46404640
auto dtgl = [](PcPhoton const& p) { const float ptp = std::hypot(p.pos.px, p.pos.py), pte = std::hypot(p.ele.px, p.ele.py); return (ptp > 0.f && pte > 0.f) ? std::fabs(p.pos.pz / ptp - p.ele.pz / pte) : 0.3f; };
46414641
const float pmin = std::min({std::hypot(a.pos.px, a.pos.py, a.pos.pz), std::hypot(a.ele.px, a.ele.py, a.ele.pz), std::hypot(b.pos.px, b.pos.py, b.pos.pz), std::hypot(b.ele.px, b.ele.py, b.ele.pz)});
4642-
const float nIts = static_cast<float>((a.pos.its ? 1 : 0) + (a.ele.its ? 1 : 0) + (b.pos.its ? 1 : 0) + (b.ele.its ? 1 : 0));
4642+
const auto nIts = static_cast<float>((a.pos.its ? 1 : 0) + (a.ele.its ? 1 : 0) + (b.pos.its ? 1 : 0) + (b.ele.its ? 1 : 0));
46434643
fRegistryPairMC.fill(HIST("PairClass/Pairs/hPairLegs"), sample, cls, q, std::min(std::max(dtgl(a), dtgl(b)), 0.299f), std::min(pmin, 0.999f), nIts, static_cast<float>(pcPairOrigin(a, b)));
46444644
constexpr float kTpcRin = 85.f, kTpcRout = 247.f; // o2-linter: disable=magic-number (TPC drift volume, diagnostic)
46454645
auto crossesCE = [&](PcLeg const& l) {
@@ -4753,12 +4753,15 @@ struct Photonhbt {
47534753
default:
47544754
break;
47554755
}
4756-
if (pdg == 11 || pdg == 13 || pdg == 22)
4756+
if (pdg == 11 || pdg == 13 || pdg == 22) {
47574757
return 8.f; // o2-linter: disable=magic-number (leptons, photon: other)
4758-
if (pdg > 1000)
4758+
}
4759+
if (pdg > 1000) {
47594760
return 6.f; // o2-linter: disable=magic-number (baryons)
4760-
if (pdg < 100)
4761+
}
4762+
if (pdg < 100) {
47614763
return 7.f; // o2-linter: disable=magic-number (no hadron mother: quark, gluon, string, cluster, none)
4764+
}
47624765
return 8.f;
47634766
};
47644767
fRegistryPairMC.fill(HIST("PairClass/Pairs/hBremsAncestry"), sample, cls == 16.f ? 0.f : 1.f, q, ancClass(y->gpdg), ancClass(y->ggpdg), ancClass(y->rootPdg)); // o2-linter: disable=magic-number (class)
@@ -4838,7 +4841,7 @@ struct Photonhbt {
48384841
p.pos = pos;
48394842
p.ele = ele;
48404843
p.svertexer = p.original && posV0 >= 0;
4841-
p.nFree = (posV0 == -2) + (eleV0 == -2); // o2-linter: disable=magic-number (free-leg stub v0Id of the mixer)
4844+
p.nFree = (posV0 == -2 ? 1 : 0) + (eleV0 == -2 ? 1 : 0); // o2-linter: disable=magic-number (free-leg stub v0Id of the mixer)
48424845
p.chi2 = photon.chiSquareNDF();
48434846
p.dcaxy = photon.dcaXYtopv();
48444847
p.dcaz = photon.dcaZtopv();
@@ -5298,7 +5301,7 @@ struct Photonhbt {
52985301
fRegistryCF.fill(HIST("Pair/mix/hPhi_lowerPtV0"), (g1.pt() < g2.pt()) ? g1.phi() : g2.phi());
52995302
}
53005303
ndiphoton++;
5301-
const float origin = static_cast<float>(pcPairOrigin(a, b));
5304+
const auto origin = static_cast<float>(pcPairOrigin(a, b));
53025305
const float sameSign = pcAlpha(a) * pcAlpha(b) > 0.f ? 1.f : 0.f;
53035306
fRegistry.fill(HIST("CoReco/hPairOrigin"), kSample, origin, obs.qinv, obs.kt, sameSign);
53045307

@@ -5308,7 +5311,7 @@ struct Photonhbt {
53085311
} else {
53095312
fillMixTruth(collision, pwl1.fIsTruePhoton, pwl2.fIsTruePhoton, obs);
53105313
}
5311-
const float cls = static_cast<float>(pcPairClass(a, b));
5314+
const auto cls = static_cast<float>(pcPairClass(a, b));
53125315
const auto q3 = lcmsQ(obs.v1, obs.v2);
53135316
fRegistryPairMC.fill(HIST("CoReco/MC/hClass3D"), kSample, cls, q3[0], q3[1], q3[2], obs.kt);
53145317
fRegistryPairMC.fill(HIST("CoReco/MC/hClassQ"), kSample, cls, obs.qinv, pcTrueQ(a, b), obs.kt);

0 commit comments

Comments
 (0)