Skip to content

Commit d0a4f32

Browse files
authored
[PWGHF] Add gen. particles in Sigmac tree. (#15295)
1 parent 6fef78d commit d0a4f32

File tree

1 file changed

+41
-5
lines changed

1 file changed

+41
-5
lines changed

PWGHF/TableProducer/treeCreatorSigmacCorrBkg.cxx

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ DECLARE_SOA_COLUMN(DecayLambdac, decayLambdac, int8_t);
6969
DECLARE_SOA_COLUMN(MlScoreFirstClass, mlScoreFirstClass, float); /// background score Λc
7070
DECLARE_SOA_COLUMN(MlScoreThirdClass, mlScoreThirdClass, float); /// non-prompt score Λc
7171
DECLARE_SOA_COLUMN(IsReflected, isReflected, int8_t);
72+
DECLARE_SOA_COLUMN(Origin, origin, int8_t);
7273
} // namespace hf_sigmac_bkg
7374
DECLARE_SOA_TABLE(HfCorrBkgSc, "AOD", "HFCORRBKGSC",
7475
hf_sigmac_bkg::Y,
@@ -83,11 +84,17 @@ DECLARE_SOA_TABLE(HfCorrBkgSc, "AOD", "HFCORRBKGSC",
8384
hf_sigmac_bkg::MlScoreFirstClass,
8485
hf_sigmac_bkg::MlScoreThirdClass,
8586
hf_sigmac_bkg::IsReflected);
87+
DECLARE_SOA_TABLE(HfGenBkgSc, "AOD", "HFGENBKGSC",
88+
hf_sigmac_bkg::Y,
89+
hf_sigmac_bkg::Pt,
90+
hf_sigmac_bkg::MotherPdg,
91+
hf_sigmac_bkg::Origin);
8692
} // namespace o2::aod
8793

8894
struct HfTreeCreatorSigmacCorrBkg {
8995

9096
Produces<o2::aod::HfCorrBkgSc> rowCorrBkgSc;
97+
Produces<o2::aod::HfGenBkgSc> rowGenBkgSc;
9198

9299
/// Selection of candidates Λc+
93100
Configurable<int> selectionFlagLc{"selectionFlagLc", 1, "Selection Flag for Lc"};
@@ -99,7 +106,13 @@ struct HfTreeCreatorSigmacCorrBkg {
99106
using ParticlesLcSigmac = soa::Join<aod::McParticles, aod::HfCand3ProngMcGen, aod::HfCandScMcGen>;
100107

101108
/// @brief init function
102-
void init(InitContext&) {}
109+
void init(InitContext&)
110+
{
111+
std::array<bool, 2> doprocesses{doprocessReco, doprocessGen};
112+
if (std::accumulate(doprocesses.begin(), doprocesses.end(), 0) == 0) {
113+
LOGP(fatal, "No process function enabled. Aborting...");
114+
}
115+
}
103116

104117
///
105118
void fillTable(RecoScMc::iterator candidateSc, RecoLcMc::iterator candLcDauSc, int motherPdg, int motherDecay = -1)
@@ -166,10 +179,10 @@ struct HfTreeCreatorSigmacCorrBkg {
166179
}
167180

168181
/// @brief process function to loop over the Σc reconstructed candidates and match them to corr. background sources in MC
169-
void process(RecoScMc const& candidatesSc,
170-
ParticlesLcSigmac const& particles,
171-
RecoLcMc const&,
172-
aod::TracksWMc const&)
182+
void processReco(RecoScMc const& candidatesSc,
183+
ParticlesLcSigmac const& particles,
184+
RecoLcMc const&,
185+
aod::TracksWMc const&)
173186
{
174187
/// loop over reconstructed Σc candidates
175188
for (auto const& candidateSc : candidatesSc) {
@@ -335,6 +348,29 @@ struct HfTreeCreatorSigmacCorrBkg {
335348

336349
} /// end loop over reconstructed Σc candidates
337350
}
351+
PROCESS_SWITCH(HfTreeCreatorSigmacCorrBkg, processReco, "Process Reco MC", false);
352+
353+
/// @brief process function to look for generated Σc and Λc±(2595, 2625) (needed to properly normalize the bkg templates)
354+
void processGen(aod::McParticles const& particles)
355+
{
356+
/// loop over particles
357+
for (auto const& particle : particles) {
358+
int pdgCodeAbs = std::abs(particle.pdgCode());
359+
360+
/// keep only Σc and Λc±(2595, 2625)
361+
if (pdgCodeAbs != o2::constants::physics::Pdg::kSigmaC0 && pdgCodeAbs != o2::constants::physics::Pdg::kSigmaCPlusPlus && pdgCodeAbs != o2::constants::physics::Pdg::kSigmaCStar0 && pdgCodeAbs != o2::constants::physics::Pdg::kSigmaCStarPlusPlus && pdgCodeAbs != aod::hf_sigmac_bkg::pdgCodeLambdac2595 && pdgCodeAbs != aod::hf_sigmac_bkg::pdgCodeLambdac2625) {
362+
continue;
363+
}
364+
365+
/// if we arrive here, it means that the particle is either a Σc or Λc±(2595, 2625)
366+
/// let's check the origin (prompt, non-prompt)
367+
int8_t origin = static_cast<int8_t>(RecoDecay::getCharmHadronOrigin(particles, particle, false));
368+
369+
/// let's fill the table
370+
rowGenBkgSc(particle.y(), particle.pt(), pdgCodeAbs, origin);
371+
} /// end loop over particles
372+
}
373+
PROCESS_SWITCH(HfTreeCreatorSigmacCorrBkg, processGen, "Process generated MC", false);
338374
};
339375

340376
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)

0 commit comments

Comments
 (0)