Skip to content

Commit cf8b32d

Browse files
authored
[PWGHF] XicToXiPiPi: Add DecayLengthMcGen column (#12627)
1 parent a5a5073 commit cf8b32d

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

PWGHF/DataModel/CandidateReconstructionTables.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1918,6 +1918,7 @@ DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); // reconstruction le
19181918
DECLARE_SOA_COLUMN(FlagMcMatchGen, flagMcMatchGen, int8_t); // generator level
19191919
DECLARE_SOA_COLUMN(OriginMcRec, originMcRec, int8_t);
19201920
DECLARE_SOA_COLUMN(OriginMcGen, originMcGen, int8_t);
1921+
DECLARE_SOA_COLUMN(DecayLengthMcGen, decayLengthMcGen, float);
19211922
// Residuals and pulls
19221923
DECLARE_SOA_COLUMN(PtResidual, ptResidual, float);
19231924
DECLARE_SOA_COLUMN(PResidual, pResidual, float);
@@ -2025,7 +2026,8 @@ DECLARE_SOA_TABLE(HfCandXicMcRec, "AOD", "HFCANDXICMCREC",
20252026
DECLARE_SOA_TABLE(HfCandXicMcGen, "AOD", "HFCANDXICMCGEN",
20262027
hf_cand_xic_to_xi_pi_pi::FlagMcMatchGen,
20272028
hf_cand_xic_to_xi_pi_pi::OriginMcGen,
2028-
hf_cand::PdgBhadMotherPart);
2029+
hf_cand::PdgBhadMotherPart,
2030+
hf_cand_xic_to_xi_pi_pi::DecayLengthMcGen);
20292031

20302032
// table with residuals and pulls of PV
20312033
DECLARE_SOA_TABLE(HfCandXicResid, "AOD", "HFCANDXICRESID",

PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -912,6 +912,7 @@ struct HfCandidateCreatorXicToXiPiPiExpressions {
912912
int8_t sign = 0;
913913
int8_t flag = 0;
914914
int8_t origin = RecoDecay::OriginType::None;
915+
float decayLengthGen = -999.f;
915916
int8_t nPionsDecayed = 0;
916917
int8_t nInteractionsWithMaterial = 0;
917918
// for resonance matching
@@ -1088,7 +1089,7 @@ struct HfCandidateCreatorXicToXiPiPiExpressions {
10881089
if (rejectionMask != 0) {
10891090
// at least one event selection not satisfied --> reject all particles from this collision
10901091
for (unsigned int i = 0; i < mcParticlesPerMcColl.size(); ++i) {
1091-
rowMcMatchGen(-99, -99, -99);
1092+
rowMcMatchGen(-99, -99, -99, decayLengthGen);
10921093
}
10931094
continue;
10941095
}
@@ -1134,13 +1135,18 @@ struct HfCandidateCreatorXicToXiPiPiExpressions {
11341135
// Check whether the charm baryon is non-prompt (from a b quark).
11351136
if (flag != 0) {
11361137
origin = RecoDecay::getCharmHadronOrigin(mcParticles, particle, false, &idxBhadMothers);
1138+
// Calculate the decay length of the generated particle
1139+
auto dau0 = particle.template daughters_as<aod::McParticles>().begin();
1140+
const std::array vtxDau{dau0.vx(), dau0.vy(), dau0.vz()};
1141+
const std::array vtxPV{mcCollision.posX(), mcCollision.posY(), mcCollision.posZ()};
1142+
decayLengthGen = RecoDecay::distance(vtxPV, vtxDau);
11371143
}
11381144
// Fill table
11391145
if (origin == RecoDecay::OriginType::NonPrompt) {
11401146
auto bHadMother = mcParticles.rawIteratorAt(idxBhadMothers[0]);
1141-
rowMcMatchGen(flag, origin, bHadMother.pdgCode());
1147+
rowMcMatchGen(flag, origin, bHadMother.pdgCode(), decayLengthGen);
11421148
} else {
1143-
rowMcMatchGen(flag, origin, 0);
1149+
rowMcMatchGen(flag, origin, 0, decayLengthGen);
11441150
}
11451151
} // close loop over generated particles
11461152
} // close loop over McCollisions

PWGHF/TableProducer/treeCreatorXicToXiPiPi.cxx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,8 @@ DECLARE_SOA_TABLE(HfCandXicToXiPiPiFullPs, "AOD", "HFXICXI2PIFULLP",
334334
full::Pt,
335335
full::Eta,
336336
full::Phi,
337-
full::Y);
337+
full::Y,
338+
hf_cand_xic_to_xi_pi_pi::DecayLengthMcGen);
338339
} // namespace o2::aod
339340

340341
/// Writes the full information in an output TTree
@@ -723,7 +724,8 @@ struct HfTreeCreatorXicToXiPiPi {
723724
particle.pt(),
724725
particle.eta(),
725726
particle.phi(),
726-
RecoDecay::y(particle.pVector(), o2::constants::physics::MassXiCPlus));
727+
RecoDecay::y(particle.pVector(), o2::constants::physics::MassXiCPlus),
728+
particle.decayLengthMcGen());
727729
}
728730
}
729731
}
@@ -776,7 +778,8 @@ struct HfTreeCreatorXicToXiPiPi {
776778
particle.pt(),
777779
particle.eta(),
778780
particle.phi(),
779-
RecoDecay::y(particle.pVector(), o2::constants::physics::MassXiCPlus));
781+
RecoDecay::y(particle.pVector(), o2::constants::physics::MassXiCPlus),
782+
particle.decayLengthMcGen());
780783
}
781784
}
782785
}

0 commit comments

Comments
 (0)