Skip to content

Commit 3302581

Browse files
author
Changhwan Choi
committed
Resolved code checker issues
1 parent 07ae072 commit 3302581

2 files changed

Lines changed: 29 additions & 30 deletions

File tree

PWGJE/Tasks/bjetTaggingGnn.cxx

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "PWGJE/Core/JetTaggingUtilities.h"
1919
#include "PWGJE/DataModel/Jet.h"
2020
#include "PWGJE/DataModel/JetReducedData.h"
21+
#include "PWGJE/DataModel/JetSubtraction.h"
2122
#include "PWGJE/DataModel/JetTagging.h"
2223

2324
#include "Common/CCDB/EventSelectionParams.h"
@@ -39,6 +40,7 @@
3940
#include <Framework/O2DatabasePDGPlugin.h>
4041
#include <Framework/runDataProcessing.h>
4142

43+
#include <TAxis.h>
4244
#include <TH1.h>
4345
#include <TH2.h>
4446
#include <TH3.h>
@@ -47,13 +49,10 @@
4749
#include <cmath>
4850
#include <cstdint>
4951
#include <string>
50-
#include <type_traits>
5152
#include <unordered_set>
5253
#include <utility>
5354
#include <vector>
5455

55-
#include <math.h>
56-
5756
using namespace o2;
5857
using namespace o2::framework;
5958
using namespace o2::framework::expressions;
@@ -142,20 +141,20 @@ struct EvtSelStage {
142141
EvtSelFlag flag;
143142
const char* label;
144143
};
145-
constexpr std::array<EvtSelStage, 14> kEvtSelStages{{{EvtSelFlag::INEL, "INEL"},
146-
{EvtSelFlag::INELZvtx, "INEL+Zvtx"},
147-
{EvtSelFlag::Coll, "Coll"},
148-
{EvtSelFlag::CollZvtx, "Coll+Zvtx"},
149-
{EvtSelFlag::TVX, "TVX"},
150-
{EvtSelFlag::TVXZvtx, "TVX+Zvtx"},
151-
{EvtSelFlag::SelMC, "SelMC"},
152-
{EvtSelFlag::SelMCZvtx, "SelMC+Zvtx"},
153-
{EvtSelFlag::Sel8, "Sel8"},
154-
{EvtSelFlag::Sel8Zvtx, "Sel8+Zvtx"},
155-
{EvtSelFlag::Sel8Full, "Sel8Full"},
156-
{EvtSelFlag::Sel8FullZvtx, "Sel8Full+Zvtx"},
157-
{EvtSelFlag::Sel8FullGood, "Sel8FullGood"},
158-
{EvtSelFlag::Sel8FullGoodZvtx, "Sel8FullGood+Zvtx"}}};
144+
constexpr std::array<EvtSelStage, 14> kEvtSelStages{{{.flag = EvtSelFlag::INEL, .label = "INEL"},
145+
{.flag = EvtSelFlag::INELZvtx, .label = "INEL+Zvtx"},
146+
{.flag = EvtSelFlag::Coll, .label = "Coll"},
147+
{.flag = EvtSelFlag::CollZvtx, .label = "Coll+Zvtx"},
148+
{.flag = EvtSelFlag::TVX, .label = "TVX"},
149+
{.flag = EvtSelFlag::TVXZvtx, .label = "TVX+Zvtx"},
150+
{.flag = EvtSelFlag::SelMC, .label = "SelMC"},
151+
{.flag = EvtSelFlag::SelMCZvtx, .label = "SelMC+Zvtx"},
152+
{.flag = EvtSelFlag::Sel8, .label = "Sel8"},
153+
{.flag = EvtSelFlag::Sel8Zvtx, .label = "Sel8+Zvtx"},
154+
{.flag = EvtSelFlag::Sel8Full, .label = "Sel8Full"},
155+
{.flag = EvtSelFlag::Sel8FullZvtx, .label = "Sel8Full+Zvtx"},
156+
{.flag = EvtSelFlag::Sel8FullGood, .label = "Sel8FullGood"},
157+
{.flag = EvtSelFlag::Sel8FullGoodZvtx, .label = "Sel8FullGood+Zvtx"}}};
159158
constexpr int kEvtSelStageRecoFirst = 2; // Coll
160159
constexpr int kEvtSelStageRecoLast = 13; // Sel8FullGood+Zvtx
161160

@@ -227,8 +226,8 @@ struct BjetTaggingGnn {
227226
OutputObj<ZorroSummary> zorroSummary{"zorroSummary"};
228227

229228
// Service
230-
Service<o2::framework::O2DatabasePDG> pdg;
231-
Service<o2::ccdb::BasicCCDBManager> ccdb;
229+
Service<o2::framework::O2DatabasePDG> pdg{};
230+
Service<o2::ccdb::BasicCCDBManager> ccdb{};
232231

233232
// Event selection bits
234233
std::vector<int> eventSelectionBits;
@@ -697,8 +696,8 @@ struct BjetTaggingGnn {
697696
return nTracks;
698697
}
699698

700-
const float largeNegativeNumber = -98.0f;
701-
const float largePositiveNumber = 9999.0f;
699+
static constexpr float largeNegativeNumber = -98.0f;
700+
static constexpr float largePositiveNumber = 9999.0f;
702701

703702
template <typename AnyTracks, typename AnalysisJet>
704703
bool isAcceptedJet(AnalysisJet const& jet)
@@ -1081,18 +1080,20 @@ struct BjetTaggingGnn {
10811080
}
10821081

10831082
// Check if the collision is INEL>0
1084-
const int nPartInel0 = 3;
1083+
static constexpr int nPartInel0 = 3;
10851084
template <typename MCColl, typename MCPart>
10861085
bool isTrueINEL0(MCColl const& /*mccoll*/, MCPart const& mcparts)
10871086
{
10881087
for (const auto& mcparticle : mcparts) {
1089-
if (!mcparticle.isPhysicalPrimary())
1088+
if (!mcparticle.isPhysicalPrimary()) {
10901089
continue;
1090+
}
10911091
const auto p = pdg->GetParticle(mcparticle.pdgCode());
10921092
if (p != nullptr) {
10931093
if (std::abs(p->Charge()) >= nPartInel0) {
1094-
if (std::abs(mcparticle.eta()) < 1)
1094+
if (std::abs(mcparticle.eta()) < 1) {
10951095
return true;
1096+
}
10961097
}
10971098
}
10981099
}
@@ -1453,7 +1454,7 @@ struct BjetTaggingGnn {
14531454
continue;
14541455
}
14551456

1456-
int8_t jetFlavor;
1457+
int8_t jetFlavor = 0;
14571458
if constexpr (withSV) {
14581459
jetFlavor = fillMCDJetHistogramsSV<withSub>(analysisJet, allTracks, *allSVs, rho, weightEvt);
14591460
} else {
@@ -1530,7 +1531,7 @@ struct BjetTaggingGnn {
15301531
if constexpr (withSub) {
15311532
registry.fill(HIST("h_jetpT_particle_sub"), mcpJetpT, weightEvt);
15321533
// Fill hSparse_pthat_jetpT only for unmatched particle jets (reco pT = -1)
1533-
if (matchedMcpJetIndices.find(mcpjet.globalIndex()) == matchedMcpJetIndices.end()) {
1534+
if (!matchedMcpJetIndices.contains(mcpjet.globalIndex())) {
15341535
registry.fill(HIST("hSparse_pthat_jetpT_sub"), collision.template mcCollision_as<AnalysisCollisionsMCP>().ptHard(), -1.f, mcpJetpT, weightEvt); // Missing jets, overflow-pTreco jets
15351536
if (jetFlavor == JetTaggingSpecies::beauty) {
15361537
registry.fill(HIST("hSparse_pthat_jetpT_b_sub"), collision.template mcCollision_as<AnalysisCollisionsMCP>().ptHard(), -1.f, mcpJetpT, weightEvt); // Missing b-jets, overflow-pTpart b-jets
@@ -1542,7 +1543,7 @@ struct BjetTaggingGnn {
15421543
} else {
15431544
registry.fill(HIST("h_jetpT_particle"), mcpJetpT, weightEvt);
15441545
// Fill hSparse_pthat_jetpT only for unmatched particle jets (reco pT = -1)
1545-
if (matchedMcpJetIndices.find(mcpjet.globalIndex()) == matchedMcpJetIndices.end()) {
1546+
if (!matchedMcpJetIndices.contains(mcpjet.globalIndex())) {
15461547
registry.fill(HIST("hSparse_pthat_jetpT"), collision.template mcCollision_as<AnalysisCollisionsMCP>().ptHard(), -1.f, mcpJetpT, weightEvt); // Missing jets, overflow-pTreco jets
15471548
if (jetFlavor == JetTaggingSpecies::beauty) {
15481549
registry.fill(HIST("hSparse_pthat_jetpT_b"), collision.template mcCollision_as<AnalysisCollisionsMCP>().ptHard(), -1.f, mcpJetpT, weightEvt); // Missing b-jets, overflow-pTpart b-jets

PWGJE/Tasks/bjetTreeCreator.cxx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@
4949
#include <unordered_map>
5050
#include <vector>
5151

52-
#include <math.h>
53-
5452
using namespace o2;
5553
using namespace o2::framework;
5654
using namespace o2::framework::expressions;
@@ -811,7 +809,7 @@ struct BJetTreeCreator {
811809
}
812810

813811
// Uses only collisionId % trainingDatasetRaioParam == 0 for training dataset
814-
if (trainingDatasetRatioParam && collision.collisionId() % trainingDatasetRatioParam != 0) {
812+
if (trainingDatasetRatioParam != 0 && collision.collisionId() % trainingDatasetRatioParam != 0) {
815813
return;
816814
}
817815

0 commit comments

Comments
 (0)