Skip to content

Commit 43acb5b

Browse files
committed
[PWGLF] Fix resonance module initializer lint issues
1 parent f5f17e3 commit 43acb5b

1 file changed

Lines changed: 75 additions & 44 deletions

File tree

PWGLF/TableProducer/Resonances/resonanceModuleInitializer.cxx

Lines changed: 75 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,39 @@ struct ResonanceModuleInitializer {
9292
static constexpr int DetailedQARCTStage = o2::analysis::CollisonCuts::kAllpassed + 1;
9393
static constexpr int DetailedQAStages = DetailedQARCTStage + 1;
9494
static constexpr float MCVertexZMax = 10.f;
95-
96-
int mRunNumber = 0; ///< Run number for the current data
97-
int multEstimator = CentralityFT0M; ///< Centrality estimator type
98-
float dBz = 0.f; ///< Magnetic field value
99-
float centrality = 0.f; ///< Centrality value for the event
100-
Service<o2::ccdb::BasicCCDBManager> ccdb; ///< CCDB manager service
95+
// PDG codes used by the persistent resonance-parent selection. Named O2/ROOT
96+
// values are preferred where available; the remaining resonances are kept as
97+
// local named constants because neither PDG_t nor PhysicsConstants defines them.
98+
static constexpr int PdgKStar0 = o2::constants::physics::Pdg::kK0Star892;
99+
static constexpr int PdgKStarCharged = o2::constants::physics::Pdg::kKPlusStar892;
100+
static constexpr int PdgPhi = o2::constants::physics::Pdg::kPhi;
101+
static constexpr int F0Code980 = 9010221;
102+
static constexpr int F0Code1370 = 10221;
103+
static constexpr int F0Code1500 = 9030221;
104+
static constexpr int F0Code1710 = 10331;
105+
static constexpr int F1Code1285 = 20223;
106+
static constexpr int F1Code1420 = 20333;
107+
static constexpr int F2PrimeCode1525 = 335;
108+
static constexpr int PdgRho0 = PDG_t::kRho770_0;
109+
static constexpr int PdgRhoCharged = PDG_t::kRho770Plus;
110+
static constexpr int SigmaStarPlusCode = 3224;
111+
static constexpr int PdgLambda1520 = o2::constants::physics::Pdg::kLambda1520_Py;
112+
static constexpr int Xi1530Code = 3324;
113+
static constexpr int PdgK1Plus1270 = o2::constants::physics::Pdg::kK1_1270Plus;
114+
static constexpr int Xi1820NeutralCode = 123314;
115+
static constexpr int Xi1820MinusCode = 123324;
116+
static constexpr int Omega2012MinusCode = 123334;
117+
static constexpr int PdgProton = PDG_t::kProton;
118+
static constexpr int PdgLambda0 = PDG_t::kLambda0;
119+
static constexpr int PdgXiMinus = PDG_t::kXiMinus;
120+
static constexpr int PdgXi0 = o2::constants::physics::Pdg::kXi0;
121+
static constexpr int PdgOmegaMinus = PDG_t::kOmegaMinus;
122+
123+
int mRunNumber = 0; ///< Run number for the current data
124+
int multEstimator = CentralityFT0M; ///< Centrality estimator type
125+
float dBz = 0.f; ///< Magnetic field value
126+
float centrality = 0.f; ///< Centrality value for the event
127+
Service<o2::ccdb::BasicCCDBManager> ccdb; ///< CCDB manager service
101128

102129
Produces<aod::ResoCollisions_001> resoCollisions; ///< Output table for resonance collisions
103130
Produces<aod::ResoCollisionColls> resoCollisionColls; ///< Optional source collision soft links
@@ -124,9 +151,8 @@ struct ResonanceModuleInitializer {
124151
Configurable<bool> cfgFillDetailedQA{"cfgFillDetailedQA", true, "Fill the Run 3 event-selection stage vs vertex-z vs centrality vs multiplicity THnSparse"};
125152
Configurable<bool> cfgBypassCCDB{"cfgBypassCCDB", true, "Bypass loading CCDB part to save CPU time and memory"}; // will be affected to b_z value.
126153
Configurable<std::string> cfgMultName{"cfgMultName", "FT0M", "Centrality estimator: FT0M, FT0C, FT0A, or FV0A"};
127-
Configurable<int> cfgMultiplicityEstimator{
128-
"cfgMultiplicityEstimator", 3,
129-
"Stored multiplicity (NOT percentile): 0 -> NTracksPV, 1 -> NTracksPVeta1, 2 -> NTracksPVetaHalf, 3 -> FT0M, 4 -> FT0A, 5 -> FT0C, 6 -> FV0A"};
154+
Configurable<int> cfgMultiplicityEstimator{"cfgMultiplicityEstimator", 3,
155+
"Stored multiplicity (NOT percentile): 0 -> NTracksPV, 1 -> NTracksPVeta1, 2 -> NTracksPVetaHalf, 3 -> FT0M, 4 -> FT0A, 5 -> FT0C, 6 -> FV0A"};
130156
ConfigurableAxis binsCent{"binsCent", {VARIABLE_WIDTH, 0., 0.01, 0.1, 1., 5., 10., 15., 20., 30., 40., 50., 60., 70., 80., 90., 100., 105.}, "Binning of the centrality axis"};
131157
ConfigurableAxis binsMultiplicity{"binsMultiplicity", {500, 0.f, 5000.f}, "Binning of the reconstructed multiplicity axis for detailed collision QA"};
132158
ConfigurableAxis cfgVtxBins{"cfgVtxBins", {400, -20.f, 20.f}, "Binning of the collision vertex-z axis for detailed QA"};
@@ -181,40 +207,40 @@ struct ResonanceModuleInitializer {
181207
Configurable<bool> isDaughterCheck{"isDaughterCheck", true, "Require the configured two-body decay"};
182208
Configurable<float> cfgRapidityCutMinGen{"cfgRapidityCutMinGen", -0.5f, "Minimum generated-particle rapidity"};
183209
Configurable<float> cfgRapidityCutMaxGen{"cfgRapidityCutMaxGen", 0.5f, "Maximum generated-particle rapidity"};
184-
Configurable<int> pdgTruthMother{"pdgTruthMother", 3324, "Absolute PDG code of the generated mother"};
185-
Configurable<int> pdgTruthDaughter1{"pdgTruthDaughter1", 3312, "Absolute PDG code of the first daughter"};
186-
Configurable<int> pdgTruthDaughter2{"pdgTruthDaughter2", 211, "Absolute PDG code of the second daughter"};
210+
Configurable<int> pdgTruthMother{"pdgTruthMother", static_cast<int>(Xi1530Code), "Absolute PDG code of the generated mother"};
211+
Configurable<int> pdgTruthDaughter1{"pdgTruthDaughter1", static_cast<int>(PdgXiMinus), "Absolute PDG code of the first daughter"};
212+
Configurable<int> pdgTruthDaughter2{"pdgTruthDaughter2", PDG_t::kPiPlus, "Absolute PDG code of the second daughter"};
187213
Configurable<bool> cfgDoSignalLoss{"cfgDoSignalLoss", false, "Save reference particles for mT-scaling signal-loss studies"};
188214
} GenCuts;
189215
RCTFlagsChecker genRCTChecker;
190216

191217
// Keep the established ResoMCParents content compatible with the legacy
192218
// initializer. The additional stable-particle species are written only for
193219
// signal-loss studies and are filtered in fillMCParents.
194-
Partition<aod::McParticles> selectedMCParticles = (nabs(aod::mcparticle::pdgCode) == 313) // K*
195-
|| (nabs(aod::mcparticle::pdgCode) == 323) // K*pm
196-
|| (nabs(aod::mcparticle::pdgCode) == 333) // phi
197-
|| (nabs(aod::mcparticle::pdgCode) == 9010221) // f0(980)
198-
|| (nabs(aod::mcparticle::pdgCode) == 10221) // f0(1370)
199-
|| (nabs(aod::mcparticle::pdgCode) == 9030221) // f0(1500)
200-
|| (nabs(aod::mcparticle::pdgCode) == 10331) // f0(1710)
201-
|| (nabs(aod::mcparticle::pdgCode) == 20223) // f1(1285)
202-
|| (nabs(aod::mcparticle::pdgCode) == 20333) // f1(1420)
203-
|| (nabs(aod::mcparticle::pdgCode) == 335) // f1(1525)
204-
|| (nabs(aod::mcparticle::pdgCode) == 113) // rho(770)
205-
|| (nabs(aod::mcparticle::pdgCode) == 213) // rho(770)pm
206-
|| (nabs(aod::mcparticle::pdgCode) == 3224) // Sigma(1385)+
207-
|| (nabs(aod::mcparticle::pdgCode) == 102134) // Lambda(1520)
208-
|| (nabs(aod::mcparticle::pdgCode) == 3324) // Xi(1530)0
209-
|| (nabs(aod::mcparticle::pdgCode) == 10323) // K1(1270)+
210-
|| (nabs(aod::mcparticle::pdgCode) == 123314) // Xi(1820)0
211-
|| (nabs(aod::mcparticle::pdgCode) == 123324) // Xi(1820)-
212-
|| (nabs(aod::mcparticle::pdgCode) == 123334) // Omega(2012)-
213-
|| (nabs(aod::mcparticle::pdgCode) == 2212) // proton
214-
|| (nabs(aod::mcparticle::pdgCode) == 3122) // Lambda0
215-
|| (nabs(aod::mcparticle::pdgCode) == 3312) // Xi-
216-
|| (nabs(aod::mcparticle::pdgCode) == 3322) // Xi0
217-
|| (nabs(aod::mcparticle::pdgCode) == 3334); // Omega-
220+
Partition<aod::McParticles> selectedMCParticles = (nabs(aod::mcparticle::pdgCode) == PdgKStar0) // K*(892)0
221+
|| (nabs(aod::mcparticle::pdgCode) == PdgKStarCharged) // K*(892)+
222+
|| (nabs(aod::mcparticle::pdgCode) == PdgPhi) // phi(1020)
223+
|| (nabs(aod::mcparticle::pdgCode) == F0Code980) // f0(980)
224+
|| (nabs(aod::mcparticle::pdgCode) == F0Code1370) // f0(1370)
225+
|| (nabs(aod::mcparticle::pdgCode) == F0Code1500) // f0(1500)
226+
|| (nabs(aod::mcparticle::pdgCode) == F0Code1710) // f0(1710)
227+
|| (nabs(aod::mcparticle::pdgCode) == F1Code1285) // f1(1285)
228+
|| (nabs(aod::mcparticle::pdgCode) == F1Code1420) // f1(1420)
229+
|| (nabs(aod::mcparticle::pdgCode) == F2PrimeCode1525) // f2'(1525)
230+
|| (nabs(aod::mcparticle::pdgCode) == PdgRho0) // rho(770)0
231+
|| (nabs(aod::mcparticle::pdgCode) == PdgRhoCharged) // rho(770)+
232+
|| (nabs(aod::mcparticle::pdgCode) == SigmaStarPlusCode) // Sigma(1385)+
233+
|| (nabs(aod::mcparticle::pdgCode) == PdgLambda1520) // Lambda(1520)
234+
|| (nabs(aod::mcparticle::pdgCode) == Xi1530Code) // Xi(1530)0
235+
|| (nabs(aod::mcparticle::pdgCode) == PdgK1Plus1270) // K1(1270)+
236+
|| (nabs(aod::mcparticle::pdgCode) == Xi1820NeutralCode) // Xi(1820)0
237+
|| (nabs(aod::mcparticle::pdgCode) == Xi1820MinusCode) // Xi(1820)-
238+
|| (nabs(aod::mcparticle::pdgCode) == Omega2012MinusCode) // Omega(2012)-
239+
|| (nabs(aod::mcparticle::pdgCode) == PdgProton) // proton
240+
|| (nabs(aod::mcparticle::pdgCode) == PdgLambda0) // Lambda0
241+
|| (nabs(aod::mcparticle::pdgCode) == PdgXiMinus) // Xi-
242+
|| (nabs(aod::mcparticle::pdgCode) == PdgXi0) // Xi0
243+
|| (nabs(aod::mcparticle::pdgCode) == PdgOmegaMinus); // Omega-
218244
Preslice<aod::McParticles> mcParticlesPerMcCollision = aod::mcparticle::mcCollisionId;
219245

220246
HistogramRegistry qaRegistry{"QAHistos", {}, OutputObjHandlingPolicy::AnalysisObject};
@@ -554,14 +580,14 @@ struct ResonanceModuleInitializer {
554580
*
555581
* @tparam MCParticlesType Type of MC-particle group
556582
* @param mcParticles MC particles grouped by generator collision
557-
* @param centrality Generator or representative reconstructed centrality
583+
* @param generatorCentrality Generator or representative reconstructed centrality
558584
* @param multiplicity Generator-level charged-particle multiplicity
559585
* @param impactParameter Generator collision impact parameter
560586
* @param eventType INEL/INEL>0 category
561587
*/
562588
template <typename MCParticlesType>
563589
void fillMCGenParticles(MCParticlesType const& mcParticles,
564-
float centrality,
590+
float generatorCentrality,
565591
float multiplicity,
566592
float impactParameter,
567593
int eventType)
@@ -599,9 +625,9 @@ struct ResonanceModuleInitializer {
599625
}
600626

601627
if (mcPart.pdgCode() > 0) {
602-
qaRegistry.fill(HIST("EventGen/h5ResonanceTruth"), eventType, mcPart.pt(), centrality, multiplicity, impactParameter);
628+
qaRegistry.fill(HIST("EventGen/h5ResonanceTruth"), eventType, mcPart.pt(), generatorCentrality, multiplicity, impactParameter);
603629
} else {
604-
qaRegistry.fill(HIST("EventGen/h5ResonanceTruthAnti"), eventType, mcPart.pt(), centrality, multiplicity, impactParameter);
630+
qaRegistry.fill(HIST("EventGen/h5ResonanceTruthAnti"), eventType, mcPart.pt(), generatorCentrality, multiplicity, impactParameter);
605631
}
606632
}
607633
}
@@ -626,7 +652,7 @@ struct ResonanceModuleInitializer {
626652
for (auto const& mcPart : selectedParents) {
627653
if (!GenCuts.cfgDoSignalLoss) {
628654
const int absPdg = std::abs(mcPart.pdgCode());
629-
if (absPdg == 2212 || absPdg == 3122 || absPdg == 3312 || absPdg == 3322 || absPdg == 3334) {
655+
if (absPdg == PdgProton || absPdg == PdgLambda0 || absPdg == PdgXiMinus || absPdg == PdgXi0 || absPdg == PdgOmegaMinus) {
630656
continue;
631657
}
632658
}
@@ -981,6 +1007,7 @@ struct ResonanceDaughterInitializer {
9811007
static constexpr int PairGateModeEither = 1;
9821008
static constexpr float MomentumQuantizationScale = 1000.f;
9831009
static constexpr std::size_t StoredMCRelationCount = 2;
1010+
static constexpr std::size_t MaxCandidateDaughters = 3;
9841011

9851012
/// Selected-candidate state and the optional global daughter-ID veto set.
9861013
/// By default only candidate existence is recorded and daughter reuse is
@@ -1003,7 +1030,7 @@ struct ResonanceDaughterInitializer {
10031030
template <std::size_t DaughterCount>
10041031
void addCandidate(std::array<int64_t, DaughterCount> const& daughterIds)
10051032
{
1006-
static_assert(DaughterCount <= 3);
1033+
static_assert(DaughterCount <= MaxCandidateDaughters);
10071034
allDaughterIds.insert(allDaughterIds.end(), daughterIds.begin(), daughterIds.end());
10081035
hasSelectedCandidate = true;
10091036
}
@@ -1359,7 +1386,9 @@ struct ResonanceDaughterInitializer {
13591386
const std::array tpcPidMeans{TrackCuts.pidnSigmaPreSelectionMeanPion.value,
13601387
TrackCuts.pidnSigmaPreSelectionMeanKaon.value,
13611388
TrackCuts.pidnSigmaPreSelectionMeanProton.value};
1362-
if (!std::all_of(tpcPidMeans.begin(), tpcPidMeans.end(), [](float mean) { return std::isfinite(mean); })) {
1389+
if (!std::all_of(tpcPidMeans.begin(), tpcPidMeans.end(), [](float mean) {
1390+
return std::isfinite(mean);
1391+
})) {
13631392
LOGF(fatal, "All TPC PID preselection means must be finite");
13641393
}
13651394
if (TrackCuts.cfgUseTOFPIDPreSelection.value) {
@@ -1370,7 +1399,9 @@ struct ResonanceDaughterInitializer {
13701399
const std::array tofPidMeans{TrackCuts.pidnSigmaPreSelectionMeanTOFPion.value,
13711400
TrackCuts.pidnSigmaPreSelectionMeanTOFKaon.value,
13721401
TrackCuts.pidnSigmaPreSelectionMeanTOFProton.value};
1373-
if (!std::all_of(tofPidMeans.begin(), tofPidMeans.end(), [](float mean) { return std::isfinite(mean); })) {
1402+
if (!std::all_of(tofPidMeans.begin(), tofPidMeans.end(), [](float mean) {
1403+
return std::isfinite(mean);
1404+
})) {
13741405
LOGF(fatal, "All TOF PID preselection means must be finite when TOF PID selection is enabled");
13751406
}
13761407
}

0 commit comments

Comments
 (0)