Skip to content

Commit 4471828

Browse files
committed
Fix o2 linter
1 parent fb9de45 commit 4471828

1 file changed

Lines changed: 9 additions & 13 deletions

File tree

PWGEM/PhotonMeson/Tasks/emcalPhotonMcTask.cxx

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,10 @@ struct EmcalPhotonMcTask {
203203
static constexpr float PhiVUndefined = -999.f;
204204
static constexpr float Epsilon = 1.e-6f;
205205

206-
static constexpr uint32_t kMlModelRow = 0;
207-
static constexpr uint32_t kMlPositiveClassCol = 1;
206+
static constexpr uint32_t MlModelRow = 0;
207+
static constexpr uint32_t MlPositiveClassCol = 1;
208208

209-
static constexpr std::array<std::array<double, 2>, 1> defaultCutsMl{{{0.0, 0.25}}};
209+
static constexpr std::array<std::array<double, 2>, 1> DefaultCutsMl{{{0.0, 0.25}}};
210210

211211
static constexpr std::array<const char*, static_cast<size_t>(TruthClass::NClasses)> kTruthClassNames = {
212212
"Conversion", "GammaGammaSamePi0", "GammaGammaAnnihilation", "BSPhotonElectron",
@@ -310,16 +310,12 @@ struct EmcalPhotonMcTask {
310310
Configurable<bool> enableOptimization{"enableOptimization", false, "enable the MlResponse optimizations."};
311311
Configurable<int> nThreads{"nThreads", 1, "number of threads for the ML model"};
312312
Configurable<std::size_t> mlBatchFlushSize{"mlBatchFlushSize", 20000, "Flush ML batch after this many pending pairs."};
313-
Configurable<std::vector<std::string>> mlInputFeatures{
314-
"mlInputFeatures",
315-
{"minv", "deltaEta", "deltaR", "phiv", "rConv", "totE", "e2", "e1", "deltaPhi", "harmonicEt",
316-
"m021", "m022", "time1", "time2", "ncell1", "ncell2"},
317-
"input feature names -- content and order must match the Python training FEATURES list"};
313+
Configurable<std::vector<std::string>> mlInputFeatures{"mlInputFeatures", {"minv", "deltaEta", "deltaR", "phiv", "rConv", "totE", "e2", "e1", "deltaPhi", "harmonicEt", "m021", "m022", "time1", "time2", "ncell1", "ncell2"}, "input feature names -- content and order must match the Python training FEATURES list"};
318314
Configurable<std::string> mlModelPathLocal{"mlModelPathLocal", "/data/mhemmer/O2ML/code/conversion_tagging_bdt_conversion_splits_brems.onnx", "local ONNX model path"};
319315
Configurable<std::vector<std::string>> modelPathsCCDB{"modelPathsCCDB", std::vector<std::string>{"Users/m/mhemmer/EM/ML/"}, "Paths of models on CCDB"};
320316
Configurable<std::vector<std::string>> onnxFileNames{"onnxFileNames", std::vector<std::string>{"conversion_tagging_bdt_conversion_splits_brems.onnx"}, "ONNX file names for each pT bin (if not from CCDB full path)"};
321317
Configurable<float> mlThreshold{"mlThreshold", 0.5f, "positive-class score threshold for tagging"};
322-
Configurable<LabeledArray<double>> cutsMl{"cutsMl", {defaultCutsMl[0].data(), 1, 2, {"pT bin 0"}, {
318+
Configurable<LabeledArray<double>> cutsMl{"cutsMl", {DefaultCutsMl[0].data(), 1, 2, {"pT bin 0"}, {
323319
"score photon pairs",
324320
"score conversion pairs",
325321
}},
@@ -638,15 +634,15 @@ struct EmcalPhotonMcTask {
638634
const float negScore = scores[i * 2 + 0];
639635
const float posScore = scores[i * 2 + 1];
640636

641-
for (auto idx : {pp.idx1, pp.idx2}) {
637+
for (const auto& idx : {pp.idx1, pp.idx2}) {
642638
if (posScore > bestPositiveScore[idx]) {
643639
bestPositiveScore[idx] = posScore;
644640
}
645641
if (negScore > bestNegativeScore[idx]) {
646642
bestNegativeScore[idx] = negScore;
647643
}
648644
}
649-
const bool isTagged = posScore >= mlConfig.cutsMl->get(kMlModelRow, kMlPositiveClassCol); // mirrors the CutSmaller-on-class-1 logic
645+
const bool isTagged = posScore >= mlConfig.cutsMl->get(MlModelRow, MlPositiveClassCol); // mirrors the CutSmaller-on-class-1 logic
650646
if (isTagged) {
651647
emcFlagsMlTagging.set(pp.idx1);
652648
emcFlagsMlTagging.set(pp.idx2);
@@ -821,9 +817,9 @@ struct EmcalPhotonMcTask {
821817
bTruthLabel = static_cast<int8_t>(TruthClass::PhotonComptonElectronPair);
822818
} else if (c1.leptonOrigin == LeptonOrigin::DirectMesonDecay && c2.leptonOrigin == LeptonOrigin::DirectMesonDecay && mcCluster1.mothersIds()[0] == mcCluster2.mothersIds()[0]) { // both cluster are leptons that come from the same meson decay
823819
mcMother.setCursor(mcCluster1.mothersIds()[0]);
824-
if (mcMother.daughtersIds().size() == 2) {
820+
if (mcMother.daughtersIds().size() == 2) { // o2-linter: disable=magic-number (number of daughters)
825821
bTruthLabel = static_cast<int8_t>(TruthClass::ElectronPairSamePi0);
826-
} else if (mcMother.daughtersIds().size() == 3) {
822+
} else if (mcMother.daughtersIds().size() == 3) { // o2-linter: disable=magic-number (number of daughters)
827823
bTruthLabel = static_cast<int8_t>(TruthClass::DalitzDecaySiblings);
828824
}
829825
} else if (c1.leptonOrigin == LeptonOrigin::Conversion && c2.leptonOrigin == LeptonOrigin::Conversion && mcCluster1.mothersIds()[0] != mcCluster2.mothersIds()[0] && areFromSamePi0) { // both cluster are leptons that come from different conversions that come from the same meson

0 commit comments

Comments
 (0)