Skip to content

Commit 0cd576f

Browse files
author
Mattia Faggin
committed
Try to fix O2 linter issues (chapter 3).
1 parent 1d529c2 commit 0cd576f

File tree

3 files changed

+34
-37
lines changed

3 files changed

+34
-37
lines changed

PWGHF/D2H/Tasks/taskSigmac.cxx

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,6 @@ using namespace o2;
3030
using namespace o2::analysis;
3131
using namespace o2::framework;
3232

33-
namespace o2::hf_sigmactask
34-
{
35-
enum Species : int { Sc2455 = 0,
36-
Sc2520,
37-
NSpecies };
38-
enum Decays : int { PKPi = 0,
39-
PiKP,
40-
NDecays };
41-
const int chargeNull = 0;
42-
const int chargePlusPlus = 2;
43-
}; // namespace o2::hf_sigmactask
44-
4533
struct HfTaskSigmac {
4634
/// One value of rapidity only
4735
/// Remember that in Run2 the distinction among GenLimAcc, GenAccMother, GenAcc was done, where:
@@ -88,7 +76,7 @@ struct HfTaskSigmac {
8876
const AxisSpec thnAxisGenPtSigmaC{thnConfigAxisGenPt, "#it{p}_{T}^{gen}(#Sigma_{c}^{0,++}) (GeV/#it{c})"};
8977
const AxisSpec thnAxisGenPtLambdaCBMother{thnConfigAxisGenPtB, "#it{p}_{T}^{gen}(#Lambda_{c}^{+} B mother) (GeV/#it{c})"};
9078
const AxisSpec thnAxisGenPtSigmaCBMother{thnConfigAxisGenPtB, "#it{p}_{T}^{gen}(#Sigma_{c}^{0,++} B mother) (GeV/#it{c})"};
91-
const AxisSpec thnAxisGenSigmaCSpecies = {o2::hf_sigmactask::Species::NSpecies, -0.5f, +o2::hf_sigmactask::Species::NSpecies - 0.5f, "bin 1: #Sigma_{c}(2455), bin 2: #Sigma_{c}(2520)"};
79+
const AxisSpec thnAxisGenSigmaCSpecies = {o2::aod::hf_cand_sigmac::Species::NSpecies, -0.5f, +o2::aod::hf_cand_sigmac::Species::NSpecies - 0.5f, "bin 1: #Sigma_{c}(2455), bin 2: #Sigma_{c}(2520)"};
9280

9381
/// analysis histograms
9482
HistogramRegistry registry{
@@ -321,11 +309,11 @@ struct HfTaskSigmac {
321309
int8_t channel = 0;
322310
if ((candidateLc.isSelLcToPKPi() >= 1) && candSc.statusSpreadLcMinvPKPiFromPDG()) {
323311
// Λc+ → pK-π+ and within the requested mass to build the Σc0,++
324-
SETBIT(channel, o2::hf_sigmactask::Decays::PKPi);
312+
SETBIT(channel, o2::aod::hf_cand_sigmac::Decays::PKPi);
325313
}
326314
if ((candidateLc.isSelLcToPiKP() >= 1) && candSc.statusSpreadLcMinvPiKPFromPDG()) {
327315
// Λc+ → π+K-p and within the requested mass to build the Σc0,++
328-
SETBIT(channel, o2::hf_sigmactask::Decays::PiKP);
316+
SETBIT(channel, o2::aod::hf_cand_sigmac::Decays::PiKP);
329317
}
330318
return channel; /// 0: none; 1: pK-π+ only; 2: π+K-p only; 3: both possible
331319
}
@@ -364,12 +352,12 @@ struct HfTaskSigmac {
364352
double decLengthLc(candidateLc.decayLength()), decLengthXYLc(candidateLc.decayLengthXY());
365353
double cpaLc(candidateLc.cpa()), cpaXYLc(candidateLc.cpaXY());
366354
/// candidate Λc+ → pK-π+ (and charge conjugate) within the range of M(pK-π+) chosen in the Σc0,++ builder
367-
if (TESTBIT(isCandPKPiPiKP, o2::hf_sigmactask::Decays::PKPi)) {
355+
if (TESTBIT(isCandPKPiPiKP, o2::aod::hf_cand_sigmac::Decays::PKPi)) {
368356
massSc = hfHelper.invMassScRecoLcToPKPi(candSc, candidateLc);
369357
massLc = hfHelper.invMassLcToPKPi(candidateLc);
370358
deltaMass = massSc - massLc;
371359
/// fill the histograms
372-
if (chargeSc == o2::hf_sigmactask::chargeNull) {
360+
if (chargeSc == o2::aod::hf_cand_sigmac::chargeNull) {
373361
registry.fill(HIST("Data/hPtSc0"), ptSc);
374362
registry.fill(HIST("Data/hEtaSc0"), etaSc);
375363
registry.fill(HIST("Data/hPhiSc0"), phiSc);
@@ -437,12 +425,12 @@ struct HfTaskSigmac {
437425
}
438426
} /// end candidate Λc+ → pK-π+ (and charge conjugate)
439427
/// candidate Λc+ → π+K-p (and charge conjugate) within the range of M(π+K-p) chosen in the Σc0,++ builder
440-
if (TESTBIT(isCandPKPiPiKP, o2::hf_sigmactask::Decays::PiKP)) {
428+
if (TESTBIT(isCandPKPiPiKP, o2::aod::hf_cand_sigmac::Decays::PiKP)) {
441429
massSc = hfHelper.invMassScRecoLcToPiKP(candSc, candidateLc);
442430
massLc = hfHelper.invMassLcToPiKP(candidateLc);
443431
deltaMass = massSc - massLc;
444432
/// fill the histograms
445-
if (chargeSc == o2::hf_sigmactask::chargeNull) {
433+
if (chargeSc == o2::aod::hf_cand_sigmac::chargeNull) {
446434
registry.fill(HIST("Data/hPtSc0"), ptSc);
447435
registry.fill(HIST("Data/hEtaSc0"), etaSc);
448436
registry.fill(HIST("Data/hPhiSc0"), phiSc);
@@ -656,9 +644,9 @@ struct HfTaskSigmac {
656644
/// Fill histograms
657645
int sigmacSpecies = -1;
658646
if (isSc0Gen || isScPlusPlusGen) {
659-
sigmacSpecies = o2::hf_sigmactask::Sc2455;
647+
sigmacSpecies = o2::aod::hf_cand_sigmac::Sc2455;
660648
} else if (isScStar0Gen || isScStarPlusPlusGen) {
661-
sigmacSpecies = o2::hf_sigmactask::Sc2520;
649+
sigmacSpecies = o2::aod::hf_cand_sigmac::Sc2520;
662650
}
663651
if (isSc0Gen || isScStar0Gen) {
664652
/// Generated Σc0 and Λc+ ← Σc0 signals
@@ -779,18 +767,18 @@ struct HfTaskSigmac {
779767
bool isTrueScPlusPlusReco = std::abs(candSc.flagMcMatchRec()) == 1 << aod::hf_cand_sigmac::DecayType::ScplusplusToPKPiPi;
780768
bool isTrueScStarPlusPlusReco = std::abs(candSc.flagMcMatchRec()) == 1 << aod::hf_cand_sigmac::DecayType::ScStarPlusPlusToPKPiPi;
781769
int sigmacSpecies = -1;
782-
if ((isTrueSc0Reco || isTrueScStar0Reco) && (chargeSc == o2::hf_sigmactask::chargeNull)) {
770+
if ((isTrueSc0Reco || isTrueScStar0Reco) && (chargeSc == o2::aod::hf_cand_sigmac::chargeNull)) {
783771
/// Reconstructed Σc0 signal
784772
// Get the corresponding MC particle for Sc, found as the mother of the soft pion
785773
int indexMcScRec = -1;
786774
if (isTrueSc0Reco) {
787775
// Σc0(2455)
788776
indexMcScRec = RecoDecay::getMother(mcParticles, candSc.prong1_as<aod::TracksWMc>().mcParticle(), o2::constants::physics::Pdg::kSigmaC0, true);
789-
sigmacSpecies = o2::hf_sigmactask::Sc2455;
777+
sigmacSpecies = o2::aod::hf_cand_sigmac::Sc2455;
790778
} else if (isTrueScStar0Reco) {
791779
// Σc0(2520)
792780
indexMcScRec = RecoDecay::getMother(mcParticles, candSc.prong1_as<aod::TracksWMc>().mcParticle(), o2::constants::physics::Pdg::kSigmaCStar0, true);
793-
sigmacSpecies = o2::hf_sigmactask::Sc2520;
781+
sigmacSpecies = o2::aod::hf_cand_sigmac::Sc2520;
794782
}
795783
auto particleSc = mcParticles.rawIteratorAt(indexMcScRec);
796784
// Get the corresponding MC particle for Lc
@@ -815,7 +803,7 @@ struct HfTaskSigmac {
815803
auto channel = candidateLc.flagMcDecayChanRec(); /// 0: direct; 1: Λc± → p± K*; 2: Λc± → Δ(1232)±± K∓; 3: Λc± → Λ(1520) π±
816804

817805
/// candidate Λc+ → pK-π+ (and charge conjugate) within the range of M(pK-π+) chosen in the Σc0,++ builder
818-
if ((TESTBIT(isCandPKPiPiKP, o2::hf_sigmactask::Decays::PKPi)) && std::abs(candidateLc.template prong0_as<aod::TracksWMc>().mcParticle().pdgCode()) == kProton) {
806+
if ((TESTBIT(isCandPKPiPiKP, o2::aod::hf_cand_sigmac::Decays::PKPi)) && std::abs(candidateLc.template prong0_as<aod::TracksWMc>().mcParticle().pdgCode()) == kProton) {
819807
massSc = hfHelper.invMassScRecoLcToPKPi(candSc, candidateLc);
820808
massLc = hfHelper.invMassLcToPKPi(candidateLc);
821809
deltaMass = massSc - massLc;
@@ -889,7 +877,7 @@ struct HfTaskSigmac {
889877

890878
} /// end candidate Λc+ → pK-π+ (and charge conjugate)
891879
/// candidate Λc+ → π+K-p (and charge conjugate) within the range of M(π+K-p) chosen in the Σc0,++ builder
892-
if ((TESTBIT(isCandPKPiPiKP, o2::hf_sigmactask::Decays::PiKP)) && std::abs(candidateLc.template prong0_as<aod::TracksWMc>().mcParticle().pdgCode()) == kPiPlus) {
880+
if ((TESTBIT(isCandPKPiPiKP, o2::aod::hf_cand_sigmac::Decays::PiKP)) && std::abs(candidateLc.template prong0_as<aod::TracksWMc>().mcParticle().pdgCode()) == kPiPlus) {
893881
massSc = hfHelper.invMassScRecoLcToPiKP(candSc, candidateLc);
894882
massLc = hfHelper.invMassLcToPiKP(candidateLc);
895883
deltaMass = massSc - massLc;
@@ -963,18 +951,18 @@ struct HfTaskSigmac {
963951

964952
} /// end candidate Λc+ → π+K-p (and charge conjugate)
965953
/// end reconstructed Σc0 signal
966-
} else if ((isTrueScPlusPlusReco || isTrueScStarPlusPlusReco) && (std::abs(chargeSc) == o2::hf_sigmactask::chargePlusPlus)) {
954+
} else if ((isTrueScPlusPlusReco || isTrueScStarPlusPlusReco) && (std::abs(chargeSc) == o2::aod::hf_cand_sigmac::chargePlusPlus)) {
967955
/// Reconstructed Σc++ signal
968956
// Get the corresponding MC particle for Sc, found as the mother of the soft pion
969957
int indexMcScRec = -1;
970958
if (isTrueScPlusPlusReco) {
971959
// Σc0(2455)
972960
indexMcScRec = RecoDecay::getMother(mcParticles, candSc.prong1_as<aod::TracksWMc>().mcParticle(), o2::constants::physics::Pdg::kSigmaCPlusPlus, true);
973-
sigmacSpecies = o2::hf_sigmactask::Sc2455;
961+
sigmacSpecies = o2::aod::hf_cand_sigmac::Sc2455;
974962
} else if (isTrueScStarPlusPlusReco) {
975963
// Σc0(2520)
976964
indexMcScRec = RecoDecay::getMother(mcParticles, candSc.prong1_as<aod::TracksWMc>().mcParticle(), o2::constants::physics::Pdg::kSigmaCStarPlusPlus, true);
977-
sigmacSpecies = o2::hf_sigmactask::Sc2520;
965+
sigmacSpecies = o2::aod::hf_cand_sigmac::Sc2520;
978966
}
979967
auto particleSc = mcParticles.rawIteratorAt(indexMcScRec);
980968
// Get the corresponding MC particle for Lc
@@ -999,7 +987,7 @@ struct HfTaskSigmac {
999987
auto channel = candidateLc.flagMcDecayChanRec(); /// 0: direct; 1: Λc± → p± K*; 2: Λc± → Δ(1232)±± K∓; 3: Λc± → Λ(1520) π±
1000988

1001989
/// candidate Λc+ → pK-π+ (and charge conjugate) within the range of M(pK-π+) chosen in the Σc0,++ builder
1002-
if ((TESTBIT(isCandPKPiPiKP, o2::hf_sigmactask::Decays::PKPi)) && std::abs(candidateLc.template prong0_as<aod::TracksWMc>().mcParticle().pdgCode()) == kProton) {
990+
if ((TESTBIT(isCandPKPiPiKP, o2::aod::hf_cand_sigmac::Decays::PKPi)) && std::abs(candidateLc.template prong0_as<aod::TracksWMc>().mcParticle().pdgCode()) == kProton) {
1003991
massSc = hfHelper.invMassScRecoLcToPKPi(candSc, candidateLc);
1004992
massLc = hfHelper.invMassLcToPKPi(candidateLc);
1005993
deltaMass = massSc - massLc;
@@ -1073,7 +1061,7 @@ struct HfTaskSigmac {
10731061

10741062
} /// end candidate Λc+ → pK-π+ (and charge conjugate)
10751063
/// candidate Λc+ → π+K-p (and charge conjugate) within the range of M(π+K-p) chosen in the Σc0,++ builder
1076-
if ((TESTBIT(isCandPKPiPiKP, o2::hf_sigmactask::Decays::PiKP)) && std::abs(candidateLc.template prong0_as<aod::TracksWMc>().mcParticle().pdgCode()) == kPiPlus) {
1064+
if ((TESTBIT(isCandPKPiPiKP, o2::aod::hf_cand_sigmac::Decays::PiKP)) && std::abs(candidateLc.template prong0_as<aod::TracksWMc>().mcParticle().pdgCode()) == kPiPlus) {
10771065
massSc = hfHelper.invMassScRecoLcToPiKP(candSc, candidateLc);
10781066
massLc = hfHelper.invMassLcToPiKP(candidateLc);
10791067
deltaMass = massSc - massLc;

PWGHF/DataModel/CandidateReconstructionTables.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2067,6 +2067,14 @@ enum DecayType { Sc0ToPKPiPi = 0,
20672067
ScplusplusToPKPiPi,
20682068
ScStar0ToPKPiPi,
20692069
ScStarPlusPlusToPKPiPi };
2070+
enum Species : int { Sc2455 = 0,
2071+
Sc2520,
2072+
NSpecies };
2073+
enum Decays : int { PKPi = 0,
2074+
PiKP,
2075+
NDecays };
2076+
const int chargeNull = 0;
2077+
const int chargePlusPlus = 2;
20702078
} // namespace hf_cand_sigmac
20712079

20722080
// declare dedicated Σc0,++ decay candidate table
@@ -2295,8 +2303,8 @@ DECLARE_SOA_DYNAMIC_COLUMN(PtSoftPi, ptSoftPi, [](float pxSoftPi, float pySoftPi
22952303
DECLARE_SOA_DYNAMIC_COLUMN(PVecSoftPi, pVecSoftPi, [](float px, float py, float pz) -> std::array<float, 3> { return std::array{px, py, pz}; });
22962304

22972305
// MC matching result:
2298-
DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); //! reconstruction level
2299-
DECLARE_SOA_COLUMN(FlagMcMatchGen, flagMcMatchGen, int8_t); //! generator level
2306+
DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); //! reconstruction level
2307+
DECLARE_SOA_COLUMN(FlagMcMatchGen, flagMcMatchGen, int8_t); //! generator level
23002308
DECLARE_SOA_COLUMN(FlagMcMatchRecD0, flagMcMatchRecD0, int8_t); //! reconstruction level
23012309
DECLARE_SOA_COLUMN(FlagMcMatchGenD0, flagMcMatchGenD0, int8_t); //! generator level
23022310

PWGHF/TableProducer/candidateCreatorSigmac0plusplus.cxx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ struct HfCandidateCreatorSigmac0plusplus {
143143
softPiCuts.SetMaxChi2PerClusterITS(softPiChi2Max);
144144
// ITS hitmap
145145
std::set<uint8_t> setSoftPiItsHitMap; // = {};
146-
for (int idItsLayer = 0; idItsLayer < 7; idItsLayer++) {
146+
const int itsLayers = 7;
147+
for (int idItsLayer = 0; idItsLayer < itsLayers; idItsLayer++) {
147148
if (TESTBIT(softPiItsHitMap, idItsLayer)) {
148149
setSoftPiItsHitMap.insert(static_cast<uint8_t>(idItsLayer));
149150
}
@@ -235,7 +236,7 @@ struct HfCandidateCreatorSigmac0plusplus {
235236
int chargeLc = candLc.template prong0_as<aod::TracksWDcaExtra>().sign() + candLc.template prong1_as<aod::TracksWDcaExtra>().sign() + candLc.template prong2_as<aod::TracksWDcaExtra>().sign();
236237
int chargeSoftPi = trackSoftPi.sign();
237238
int8_t chargeSigmac = chargeLc + chargeSoftPi;
238-
if (std::abs(chargeSigmac) != 0 && std::abs(chargeSigmac) != 2) {
239+
if (std::abs(chargeSigmac) != o2::aod::hf_cand_sigmac::chargeNull && std::abs(chargeSigmac) != o2::aod::hf_cand_sigmac::chargePlusPlus) {
239240
/// this shall never happen
240241
LOG(fatal) << ">>> Sc candidate with charge +1 built, not possible! Charge Lc: " << chargeLc << ", charge soft pion: " << chargeSoftPi;
241242
}
@@ -461,7 +462,7 @@ struct HfCandidateSigmac0plusplusMc {
461462
candLc.prong2_as<aod::TracksWMc>(),
462463
candSigmac.prong1_as<aod::TracksWMc>()};
463464
chargeSigmac = candSigmac.charge();
464-
if (chargeSigmac == 0) {
465+
if (chargeSigmac == o2::aod::hf_cand_sigmac::chargeNull) {
465466
/// candidate Σc0
466467
/// 3 levels:
467468
/// 1. Σc0 → Λc+ π-,+
@@ -482,7 +483,7 @@ struct HfCandidateSigmac0plusplusMc {
482483
}
483484
}
484485

485-
} else if (std::abs(chargeSigmac) == 2) {
486+
} else if (std::abs(chargeSigmac) == o2::aod::hf_cand_sigmac::chargePlusPlus) {
486487
/// candidate Σc++
487488
/// 3 levels:
488489
/// 1. Σc0 → Λc+ π-,+

0 commit comments

Comments
 (0)