Skip to content

Commit a2caee7

Browse files
authored
PWGHF: adding particle origin MC information to LcToK0sP tree creator (#2657)
1 parent 0960805 commit a2caee7

3 files changed

Lines changed: 41 additions & 15 deletions

File tree

PWGHF/DataModel/CandidateReconstructionTables.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,8 @@ DECLARE_SOA_DYNAMIC_COLUMN(PtV0Neg, ptV0Neg, //!
535535
[](float px, float py) { return RecoDecay::pt(px, py); });
536536
DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); //! reconstruction level
537537
DECLARE_SOA_COLUMN(FlagMcMatchGen, flagMcMatchGen, int8_t); //! generator level
538+
DECLARE_SOA_COLUMN(OriginMcRec, originMcRec, int8_t); //! particle origin, reconstruction level
539+
DECLARE_SOA_COLUMN(OriginMcGen, originMcGen, int8_t); //! particle origin, generator level
538540
DECLARE_SOA_COLUMN(V0X, v0x, float);
539541
DECLARE_SOA_COLUMN(V0Y, v0y, float);
540542
DECLARE_SOA_COLUMN(V0Z, v0z, float);
@@ -614,11 +616,13 @@ using HfCandCascade = HfCandCascExt;
614616

615617
// table with results of reconstruction level MC matching for Cascade
616618
DECLARE_SOA_TABLE(HfCandCascadeMcRec, "AOD", "HFCANDCASCMCREC", //!
617-
hf_cand_casc::FlagMcMatchRec);
619+
hf_cand_casc::FlagMcMatchRec,
620+
hf_cand_casc::OriginMcRec);
618621

619622
// table with results of generator level MC matching
620623
DECLARE_SOA_TABLE(HfCandCascadeMcGen, "AOD", "HFCANDCASCMCGEN", //!
621-
hf_cand_casc::FlagMcMatchGen);
624+
hf_cand_casc::FlagMcMatchGen,
625+
hf_cand_casc::OriginMcGen);
622626

623627
// specific BPlus candidate properties
624628
namespace hf_cand_bplus

PWGHF/TableProducer/candidateCreatorCascade.cxx

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,13 +264,17 @@ struct HfCandidateCreatorCascadeMc {
264264
aod::McParticles const& particlesMC)
265265
{
266266
int8_t sign = 0;
267+
int8_t origin = 0;
268+
int indexRec = -1;
267269
std::vector<int> arrDaughLcIndex;
268270
std::array<int, 3> arrDaughLcPDG;
269271
std::array<int, 3> arrDaughLcPDGRef = {2212, 211, -211};
270272

271273
// Match reconstructed candidates.
272274
rowCandidateCasc->bindExternalIndices(&tracks);
273-
for (auto& candidate : *rowCandidateCasc) {
275+
for (const auto& candidate : *rowCandidateCasc) {
276+
277+
origin = 0;
274278

275279
const auto& bach = candidate.prong0_as<aod::BigTracksMC>();
276280
const auto& trackV0DaughPos = candidate.posTrack_as<aod::BigTracksMC>();
@@ -299,16 +303,23 @@ struct HfCandidateCreatorCascadeMc {
299303
// then we check the Lc
300304
MY_DEBUG_MSG(sign, LOG(info) << "K0S was correct! now we check the Lc");
301305
MY_DEBUG_MSG(sign, LOG(info) << "index proton = " << indexBach);
302-
RecoDecay::getMatchedMCRec(particlesMC, arrayDaughtersLc, pdg::Code::kLambdaCPlus, array{+kProton, +kPiPlus, -kPiPlus}, true, &sign, 3); // 3-levels Lc --> p + K0 --> p + K0s --> p + pi+ pi-
306+
indexRec = RecoDecay::getMatchedMCRec(particlesMC, arrayDaughtersLc, pdg::Code::kLambdaCPlus, array{+kProton, +kPiPlus, -kPiPlus}, true, &sign, 3); // 3-levels Lc --> p + K0 --> p + K0s --> p + pi+ pi-
303307
MY_DEBUG_MSG(sign, LOG(info) << "Lc found with sign " << sign; printf("\n"));
304308
}
305309

306-
rowMcMatchRec(sign);
310+
// Check whether the particle is non-prompt (from a b quark).
311+
if (sign != 0) {
312+
auto particle = particlesMC.rawIteratorAt(indexRec);
313+
origin = RecoDecay::getCharmHadronOrigin(particlesMC, particle);
314+
}
315+
316+
rowMcMatchRec(sign, origin);
307317
}
308318
//}
309319

310320
// Match generated particles.
311-
for (auto& particle : particlesMC) {
321+
for (const auto& particle : particlesMC) {
322+
origin = 0;
312323
// checking if I have a Lc --> K0S + p
313324
RecoDecay::isMatchedMCGen(particlesMC, particle, pdg::Code::kLambdaCPlus, array{+kProton, +kK0Short}, true, &sign, 2);
314325
if (sign != 0) {
@@ -329,7 +340,11 @@ struct HfCandidateCreatorCascadeMc {
329340
MY_DEBUG_MSG(sign == 0, LOG(info) << "Pity, the three final daughters are not p, pi+, pi-, but " << arrDaughLcPDG[0] << ", " << arrDaughLcPDG[1] << ", " << arrDaughLcPDG[2]);
330341
}
331342
}
332-
rowMcMatchGen(sign);
343+
// Check whether the particle is non-prompt (from a b quark).
344+
if (sign != 0) {
345+
origin = RecoDecay::getCharmHadronOrigin(particlesMC, particle);
346+
}
347+
rowMcMatchGen(sign, origin);
333348
}
334349
}
335350

PWGHF/TableProducer/treeCreatorLcToK0sP.cxx

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ DECLARE_SOA_COLUMN(V0MAntiLambda, v0MAntiLambda, float);
6666
DECLARE_SOA_COLUMN(V0MK0Short, v0MK0Short, float);
6767
DECLARE_SOA_COLUMN(V0MGamma, v0MGamma, float);
6868
DECLARE_SOA_COLUMN(FlagMc, flagMc, int8_t);
69+
DECLARE_SOA_COLUMN(OriginMcRec, originMcRec, int8_t);
70+
DECLARE_SOA_COLUMN(OriginMcGen, originMcGen, int8_t);
6971
// Events
7072
DECLARE_SOA_COLUMN(IsEventReject, isEventReject, int);
7173
DECLARE_SOA_COLUMN(RunNumber, runNumber, int);
@@ -136,7 +138,8 @@ DECLARE_SOA_TABLE(HfCandCascFull, "AOD", "HFCANDCASCFull",
136138
full::Phi,
137139
full::Y,
138140
full::E,
139-
full::FlagMc);
141+
full::FlagMc,
142+
full::OriginMcRec);
140143

141144
DECLARE_SOA_TABLE(HfCandCascFullEvents, "AOD", "HFCANDCASCFullE",
142145
collision::BCId,
@@ -151,7 +154,8 @@ DECLARE_SOA_TABLE(HfCandCascFullParticles, "AOD", "HFCANDCASCFullP",
151154
full::Eta,
152155
full::Phi,
153156
full::Y,
154-
full::FlagMc);
157+
full::FlagMc,
158+
full::OriginMcGen);
155159

156160
} // namespace o2::aod
157161

@@ -168,7 +172,7 @@ struct HfTreeCreatorLcToK0sP {
168172
}
169173

170174
template <typename T, typename U>
171-
void fillCandidate(const T& candidate, const U& bach, int8_t flagMc)
175+
void fillCandidate(const T& candidate, const U& bach, int8_t flagMc, int8_t originMcRec)
172176
{
173177
rowCandidateFull(
174178
bach.collision().bcId(),
@@ -235,7 +239,8 @@ struct HfTreeCreatorLcToK0sP {
235239
candidate.phi(),
236240
o2::aod::hf_cand_3prong::yLc(candidate),
237241
o2::aod::hf_cand_3prong::eLc(candidate),
238-
flagMc);
242+
flagMc,
243+
originMcRec);
239244
}
240245

241246
template <typename T>
@@ -268,7 +273,7 @@ struct HfTreeCreatorLcToK0sP {
268273
auto bach = candidate.prong0_as<aod::BigTracksPID>(); // bachelor
269274
double pseudoRndm = bach.pt() * 1000. - (int16_t)(bach.pt() * 1000);
270275
if (candidate.isSelLcToK0sP() >= 1 && pseudoRndm < downSampleBkgFactor) {
271-
fillCandidate(candidate, bach, candidate.flagMcMatchRec());
276+
fillCandidate(candidate, bach, candidate.flagMcMatchRec(), candidate.originMcRec());
272277
}
273278
}
274279

@@ -281,8 +286,10 @@ struct HfTreeCreatorLcToK0sP {
281286
particle.pt(),
282287
particle.eta(),
283288
particle.phi(),
284-
RecoDecay::y(array{particle.px(), particle.py(), particle.pz()}, RecoDecay::getMassPDG(particle.pdgCode())),
285-
particle.flagMcMatchGen());
289+
RecoDecay::y(array{particle.px(), particle.py(), particle.pz()},
290+
RecoDecay::getMassPDG(particle.pdgCode())),
291+
particle.flagMcMatchGen(),
292+
particle.originMcGen());
286293
}
287294
}
288295
}
@@ -305,7 +312,7 @@ struct HfTreeCreatorLcToK0sP {
305312
auto bach = candidate.prong0_as<aod::BigTracksPID>(); // bachelor
306313
double pseudoRndm = bach.pt() * 1000. - (int16_t)(bach.pt() * 1000);
307314
if (candidate.isSelLcToK0sP() >= 1 && pseudoRndm < downSampleBkgFactor) {
308-
fillCandidate(candidate, bach, 0);
315+
fillCandidate(candidate, bach, 0, 0);
309316
}
310317
}
311318
}

0 commit comments

Comments
 (0)