Skip to content

Commit aff6886

Browse files
author
Changhwan Choi
committed
o2linter issues resolved
1 parent 8cc90f8 commit aff6886

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

PWGJE/Tasks/bjetTaggingGnn.cxx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include <cmath>
4646
#include <cstdint>
4747
#include <string>
48+
#include <unordered_set>
4849
#include <vector>
4950

5051
#include <math.h>
@@ -202,7 +203,7 @@ struct BjetTaggingGnn {
202203
registry.add("h_event_counter_mcp", ";analysis collision matched MC collision counter", {HistType::kTH1F, {{1, 0.0, 1.0}}}, callSumw2);
203204
registry.add("h_vertexZ", "Vertex Z;#it{Z} (cm)", {HistType::kTH1F, {{100, -20.0, 20.0}}}, callSumw2);
204205
registry.add("hCollCounter", ";collision counter", {HistType::kTH1F, {{12, 1.0, 13.0}}}, callSumw2);
205-
auto& hCollCounter = registry.get<TH1>(HIST("hCollCounter"));
206+
auto hCollCounter = registry.get<TH1>(HIST("hCollCounter"));
206207
hCollCounter->GetXaxis()->SetBinLabel(1, "_1");
207208
hCollCounter->GetXaxis()->SetBinLabel(2, "_2");
208209
hCollCounter->GetXaxis()->SetBinLabel(3, "Coll");
@@ -216,7 +217,7 @@ struct BjetTaggingGnn {
216217
hCollCounter->GetXaxis()->SetBinLabel(11, "_11");
217218
hCollCounter->GetXaxis()->SetBinLabel(12, "INELgt0+Zvtx(rec)"); // sel8
218219
registry.add("hMcCollCounter", ";MC collision counter", {HistType::kTH1F, {{12, 1.0, 13.0}}}, callSumw2);
219-
auto& hMcCollCounter = registry.get<TH1>(HIST("hMcCollCounter"));
220+
auto hMcCollCounter = registry.get<TH1>(HIST("hMcCollCounter"));
220221
hMcCollCounter->GetXaxis()->SetBinLabel(1, "McColl(INEL)");
221222
hMcCollCounter->GetXaxis()->SetBinLabel(2, "McColl+Zvtx");
222223
hMcCollCounter->GetXaxis()->SetBinLabel(3, "McColl(-> Coll)");
@@ -518,17 +519,20 @@ struct BjetTaggingGnn {
518519
return nTracks;
519520
}
520521

522+
const float largeNegativeNumber = -98.0f;
523+
const float largePositiveNumber = 9999.0f;
524+
521525
template <typename AnyTracks, typename AnalysisJet>
522526
bool isAcceptedJet(AnalysisJet const& jet)
523527
{
524-
if (jetAreaFractionMin > -98.0) { // o2-linter: disable=magic-number (arbitrary large negative number)
528+
if (jetAreaFractionMin > largeNegativeNumber) {
525529
if (jet.area() < jetAreaFractionMin * M_PI * (jet.r() / 100.0) * (jet.r() / 100.0)) {
526530
return false;
527531
}
528532
}
529533
bool checkConstituentPt = true;
530-
bool checkConstituentMinPt = (leadingConstituentPtMin > -98.0); // o2-linter: disable=magic-number (arbitrary large negative number)
531-
bool checkConstituentMaxPt = (leadingConstituentPtMax < 9998.0); // o2-linter: disable=magic-number (arbitrary large number)
534+
bool checkConstituentMinPt = (leadingConstituentPtMin > largeNegativeNumber);
535+
bool checkConstituentMaxPt = (leadingConstituentPtMax < largePositiveNumber);
532536
if (!checkConstituentMinPt && !checkConstituentMaxPt) {
533537
checkConstituentPt = false;
534538
}
@@ -695,6 +699,7 @@ struct BjetTaggingGnn {
695699
}
696700

697701
// Check if the collision is INEL>0
702+
const int nPartInel0 = 3;
698703
template <typename MCColl, typename MCPart>
699704
bool isTrueINEL0(MCColl const& /*mccoll*/, MCPart const& mcparts)
700705
{
@@ -703,7 +708,7 @@ struct BjetTaggingGnn {
703708
continue;
704709
const auto p = pdg->GetParticle(mcparticle.pdgCode());
705710
if (p != nullptr) {
706-
if (std::abs(p->Charge()) >= 3) { // o2-linter: disable=magic-number (constant number of particles)
711+
if (std::abs(p->Charge()) >= nPartInel0) {
707712
if (std::abs(mcparticle.eta()) < 1)
708713
return true;
709714
}
@@ -936,7 +941,7 @@ struct BjetTaggingGnn {
936941
const auto& mcpjetspermcpcollision = MCPjets.sliceBy(mcpjetsPerMCPCollision, collision.mcCollisionId());
937942
for (const auto& mcpjet : mcpjetspermcpcollision) {
938943
registry.fill(HIST("h_jetpT_particle"), mcpjet.pt(), weightEvt);
939-
944+
940945
// Fill h3_pthat_jetpT only for unmatched particle jets (reco pT = -1)
941946
if (matchedMcpJetIndices.find(mcpjet.globalIndex()) == matchedMcpJetIndices.end()) {
942947
registry.fill(HIST("h3_pthat_jetpT"), collision.template mcCollision_as<AnalysisCollisionsMCP>().ptHard(), -1.f, mcpjet.pt(), weightEvt); // Missing jets, overflow-pTreco jets

0 commit comments

Comments
 (0)