Skip to content

Commit 116f23d

Browse files
author
Bong-Hwi Lim
committed
[PWGLF] Fix clang-tidy findings in Omega2012 and K1 tables
Mark MC-only callback parameters as maybe_unused and remove redundant integer casts. Bind fixed-size daughter index arrays by reference. Keep the persistent K1 feature column format and document its narrow exception to modernize-avoid-c-arrays.
1 parent 132b8b8 commit 116f23d

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

‎PWGLF/DataModel/LFK1MlTables.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ DECLARE_SOA_COLUMN(K1Charge, k1Charge, int8_t);
6363
// 16 = candidate cuts.
6464
// Candidates written at the "selected" export stage carry 31.
6565
DECLARE_SOA_COLUMN(K1BaselinePassBits, k1BaselinePassBits, uint16_t);
66+
// NOLINTNEXTLINE(modernize-avoid-c-arrays) -- persistent fixed-size AOD column
6667
DECLARE_SOA_COLUMN(K1MasterFeatures, k1MasterFeatures, float[125]); //! 125 master features of the K1 ML feature contract (PWGLF/Core/K1MlFeatures.h)
6768
DECLARE_SOA_COLUMN(K1FeatureStatus, k1FeatureStatus, uint8_t); //! o2::analysis::k1ml::BuildStatus; only Ok (0) rows are written
6869
DECLARE_SOA_COLUMN(K1TruthStatus, k1TruthStatus, uint8_t); //! 0 data, 1 matched, 2 unmatched

‎PWGLF/Tasks/Resonances/omega2012Analysis.cxx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ struct Omega2012Analysis {
698698
};
699699

700700
const bool fillWrongSign = core.fillWrongSign();
701-
auto onCandidate = [&](auto const& xi, auto const& pion, auto const& kaon, Xi1530KCandidateValues const& c) {
701+
auto onCandidate = [&]([[maybe_unused]] auto const& xi, [[maybe_unused]] auto const& pion, [[maybe_unused]] auto const& kaon, Xi1530KCandidateValues const& c) {
702702
if (c.chargePattern != o2::analysis::omega2012ml::kSignalPattern) {
703703
// Charge-pattern controls: same event only, never in the signal histograms
704704
if constexpr (!IsMix) {

‎PWGLF/Tasks/Resonances/omega2012TrainingTable.cxx‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ struct Omega2012TrainingTable {
274274
return -1;
275275
}
276276
const auto row = trackId - static_cast<int64_t>(mcTrackLabelsDf->offset());
277-
if (row < 0 || row >= static_cast<int64_t>(mcTrackLabelsDf->size())) {
277+
if (row < 0 || row >= mcTrackLabelsDf->size()) {
278278
return -1;
279279
}
280280
return mcTrackLabelsDf->rawIteratorAt(row).mcParticleId();
@@ -289,7 +289,7 @@ struct Omega2012TrainingTable {
289289
int64_t row = label;
290290
for (int step = 0; step <= MaxAncestorSteps; ++step) {
291291
const auto local = row - static_cast<int64_t>(mcParticlesDf->offset());
292-
if (row < 0 || local < 0 || local >= static_cast<int64_t>(mcParticlesDf->size())) {
292+
if (row < 0 || local < 0 || local >= mcParticlesDf->size()) {
293293
return;
294294
}
295295
const auto particle = mcParticlesDf->rawIteratorAt(local);
@@ -311,7 +311,7 @@ struct Omega2012TrainingTable {
311311
if (auto it = mlCascadeRows.find(id); it != mlCascadeRows.end()) {
312312
return it->second;
313313
}
314-
const auto indices = xi.cascadeIndices();
314+
const auto& indices = xi.cascadeIndices();
315315
const std::array<int, 3> daughterIds{indices[0], indices[1], indices[2]};
316316
mlCascades(mlEventRow, id, xi.px(), xi.py(), xi.pz(), static_cast<int8_t>(xi.sign()), xi.mXi(), xi.mLambda(),
317317
xi.v0CosPA(), xi.cascCosPA(), xi.daughDCA(), xi.cascDaughDCA(),
@@ -344,7 +344,7 @@ struct Omega2012TrainingTable {
344344
if (auto it = mlV0Rows.find(id); it != mlV0Rows.end()) {
345345
return it->second;
346346
}
347-
const auto indices = v0.indices();
347+
const auto& indices = v0.indices();
348348
const std::array<int, 2> daughterIds{indices[0], indices[1]};
349349
mlV0s(mlEventRow, id, v0.px(), v0.py(), v0.pz(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(),
350350
v0.v0CosPA(), v0.daughDCA(), v0.dcapostopv(), v0.dcanegtopv(), v0.dcav0topv(), v0.transRadius(),
@@ -557,14 +557,14 @@ struct Omega2012TrainingTable {
557557
{
558558
mlAncestryRows.clear();
559559
const auto offset = static_cast<int64_t>(mcParticles.offset());
560-
const auto nRows = static_cast<int64_t>(mcParticles.size());
560+
const auto nRows = mcParticles.size();
561561
std::unordered_set<int64_t> treeRows;
562562
std::vector<std::pair<int64_t, int>> stack;
563563
for (const auto& parent : mcParticles) {
564564
if (std::abs(parent.pdgCode()) != o2::constants::physics::Pdg::kOmega2012Minus) {
565565
continue;
566566
}
567-
stack.assign(1, {static_cast<int64_t>(parent.globalIndex()), 0});
567+
stack.assign(1, {parent.globalIndex(), 0});
568568
while (!stack.empty()) {
569569
const auto [row, depth] = stack.back();
570570
stack.pop_back();

0 commit comments

Comments
 (0)