Skip to content

Commit 4404ffa

Browse files
NucleiTask - Fix compilation and MegaLinter errors
1 parent cbc1c4f commit 4404ffa

1 file changed

Lines changed: 20 additions & 13 deletions

File tree

PWGLF/Tasks/Nuspex/lfNucleiBATask.cxx

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
#include <TMCProcess.h>
5555
#include <TPDGCode.h>
5656

57+
#include <array>
5758
#include <bitset>
5859
#include <cmath>
5960
#include <cstdint>
@@ -68,8 +69,8 @@ using namespace o2::framework;
6869
using namespace o2::framework::expressions;
6970

7071
struct lfNucleiBATask {
71-
Service<o2::ccdb::BasicCCDBManager> ccdb;
72-
Service<o2::framework::O2DatabasePDG> pdgDB;
72+
Service<o2::ccdb::BasicCCDBManager> ccdb{};
73+
Service<o2::framework::O2DatabasePDG> pdgDB{};
7374

7475
Zorro zorro;
7576
OutputObj<ZorroSummary> zorroSummary{"zorroSummary"};
@@ -259,19 +260,19 @@ struct lfNucleiBATask {
259260
static constexpr int PDGTriton = o2::constants::physics::Pdg::kTriton;
260261
static constexpr int PDGHelium = o2::constants::physics::Pdg::kHelium3;
261262
static constexpr int PDGAlpha = o2::constants::physics::Pdg::kAlpha;
262-
static constexpr int PDGHyperTriton = o2::constants::physics::Pdg::kHyperTriton;
263+
// static constexpr int PDGHyperTriton = o2::constants::physics::Pdg::kHyperTriton; // not used
263264
static constexpr float MassProtonVal = o2::constants::physics::MassProton;
264265
static constexpr float MassDeuteronVal = o2::constants::physics::MassDeuteron;
265266
static constexpr float MassTritonVal = o2::constants::physics::MassTriton;
266267
static constexpr float MassHeliumVal = o2::constants::physics::MassHelium3;
267268
static constexpr float MassAlphaVal = o2::constants::physics::MassAlpha;
268269

269270
// PDG of Mothers
270-
static constexpr int PdgMotherList[] = {PDG_t::kPiPlus, PDG_t::kKPlus, PDG_t::kK0Short, PDG_t::kNeutron, PDG_t::kProton, PDG_t::kLambda0, o2::constants::physics::Pdg::kDeuteron, o2::constants::physics::Pdg::kHelium3, o2::constants::physics::Pdg::kTriton, o2::constants::physics::Pdg::kHyperTriton, o2::constants::physics::Pdg::kAlpha};
271+
static constexpr std::array<int, 11> PdgMotherList = {PDG_t::kPiPlus, PDG_t::kKPlus, PDG_t::kK0Short, PDG_t::kNeutron, PDG_t::kProton, PDG_t::kLambda0, o2::constants::physics::Pdg::kDeuteron, o2::constants::physics::Pdg::kHelium3, o2::constants::physics::Pdg::kTriton, o2::constants::physics::Pdg::kHyperTriton, o2::constants::physics::Pdg::kAlpha};
271272

272-
static constexpr int NumMotherList = sizeof(PdgMotherList) / sizeof(PdgMotherList[0]);
273+
static constexpr int NumMotherList = PdgMotherList.size();
273274

274-
static constexpr const char* MotherNames[NumMotherList] = {"#pi^{+}", "K^{+}", "K^{0}_{S}", "n", "p", "#Lambda", "d", "He3", "t", "^{3}_{#Lambda}H", "He4"};
275+
static constexpr std::array<const char*, NumMotherList> MotherNames = {"#pi^{+}", "K^{+}", "K^{0}_{S}", "n", "p", "#Lambda", "d", "He3", "t", "^{3}_{#Lambda}H", "He4"};
275276

276277
static constexpr int MaxNumMom = 2; // X: 0..4, overflow=5
277278

@@ -527,10 +528,11 @@ struct lfNucleiBATask {
527528
if (enableCentrality) {
528529
histos.add<TH2>("event/eventSelection", "eventSelection", HistType::kTH2D, {{11, -0.5, 10.5}, {binsPercentile, "Centrality FT0M"}});
529530
auto h2d = histos.get<TH2>(HIST("event/eventSelection"));
530-
if (skimmingOptions.applySkimming)
531+
if (skimmingOptions.applySkimming) {
531532
h2d->GetXaxis()->SetBinLabel(1, "Skimmed events");
532-
else
533+
} else {
533534
h2d->GetXaxis()->SetBinLabel(1, "Total");
535+
}
534536

535537
h2d->GetXaxis()->SetBinLabel(2, "TVX trigger cut");
536538
h2d->GetXaxis()->SetBinLabel(3, "TF border cut");
@@ -545,10 +547,11 @@ struct lfNucleiBATask {
545547
} else {
546548
histos.add<TH1>("event/eventSelection", "eventSelection", HistType::kTH1D, {{11, -0.5, 10.5}});
547549
auto h1d = histos.get<TH1>(HIST("event/eventSelection"));
548-
if (skimmingOptions.applySkimming)
550+
if (skimmingOptions.applySkimming) {
549551
h1d->GetXaxis()->SetBinLabel(1, "Skimmed events");
550-
else
552+
} else {
551553
h1d->GetXaxis()->SetBinLabel(1, "Total");
554+
}
552555

553556
h1d->GetXaxis()->SetBinLabel(2, "TVX trigger cut");
554557
h1d->GetXaxis()->SetBinLabel(3, "TF border cut");
@@ -3490,8 +3493,8 @@ struct lfNucleiBATask {
34903493
[[maybe_unused]] int firstMotherId = -1;
34913494
[[maybe_unused]] int firstMotherPdg = -1;
34923495
[[maybe_unused]] float firstMotherPt = -1.f;
3493-
[[maybe_unused]] int pdgMomList[MaxNumMom];
3494-
[[maybe_unused]] float ptMomList[MaxNumMom];
3496+
[[maybe_unused]] std::array<int, MaxNumMom> pdgMomList{};
3497+
[[maybe_unused]] std::array<float, MaxNumMom> ptMomList{};
34953498
[[maybe_unused]] int nSaved = 0;
34963499

34973500
if constexpr (IsFilteredData) {
@@ -4370,6 +4373,8 @@ struct lfNucleiBATask {
43704373
histos.fill(HIST("tracks/proton/h2ProtonVspTNSigmaTOF"), track.pt(), track.tofNSigmaPr());
43714374
}
43724375
break;
4376+
default:
4377+
break;
43734378
}
43744379
if (outFlagOptions.enableExpSignalTOF)
43754380
histos.fill(HIST("tracks/proton/h2ProtonTOFExpSignalDiffVsPt"), track.pt(), track.tofExpSignalDiffPr());
@@ -4703,6 +4708,8 @@ struct lfNucleiBATask {
47034708
histos.fill(HIST("tracks/deuteron/h2antiDeuteronVspTNSigmaTPC"), antiDPt, track.tpcNSigmaDe());
47044709
}
47054710
break;
4711+
default:
4712+
break;
47064713
}
47074714
}
47084715

@@ -6512,7 +6519,7 @@ struct lfNucleiBATask {
65126519
if (enableEffEvtSet) {
65136520
if (!effEvtSetReady)
65146521
return;
6515-
if (!effEvtSet.count(mcIdx))
6522+
if (!effEvtSet.contains(mcIdx))
65166523
return;
65176524
}
65186525

0 commit comments

Comments
 (0)