diff --git a/PWGHF/DataModel/CandidateReconstructionTables.h b/PWGHF/DataModel/CandidateReconstructionTables.h index d4b6a74a867..36bfe383f3b 100644 --- a/PWGHF/DataModel/CandidateReconstructionTables.h +++ b/PWGHF/DataModel/CandidateReconstructionTables.h @@ -1905,6 +1905,7 @@ DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); // reconstruction le DECLARE_SOA_COLUMN(FlagMcMatchGen, flagMcMatchGen, int8_t); // generator level DECLARE_SOA_COLUMN(OriginMcRec, originMcRec, int8_t); DECLARE_SOA_COLUMN(OriginMcGen, originMcGen, int8_t); +DECLARE_SOA_COLUMN(DecayLengthMcGen, decayLengthMcGen, float); // Residuals and pulls DECLARE_SOA_COLUMN(PtResidual, ptResidual, float); DECLARE_SOA_COLUMN(PResidual, pResidual, float); @@ -2012,7 +2013,8 @@ DECLARE_SOA_TABLE(HfCandXicMcRec, "AOD", "HFCANDXICMCREC", DECLARE_SOA_TABLE(HfCandXicMcGen, "AOD", "HFCANDXICMCGEN", hf_cand_xic_to_xi_pi_pi::FlagMcMatchGen, hf_cand_xic_to_xi_pi_pi::OriginMcGen, - hf_cand::PdgBhadMotherPart); + hf_cand::PdgBhadMotherPart, + hf_cand_xic_to_xi_pi_pi::DecayLengthMcGen); // table with residuals and pulls of PV DECLARE_SOA_TABLE(HfCandXicResid, "AOD", "HFCANDXICRESID", diff --git a/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx b/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx index 192465b5e33..f88a6d573c9 100644 --- a/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx +++ b/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx @@ -912,6 +912,7 @@ struct HfCandidateCreatorXicToXiPiPiExpressions { int8_t sign = 0; int8_t flag = 0; int8_t origin = RecoDecay::OriginType::None; + float decayLengthGen = -999.f; int8_t nPionsDecayed = 0; int8_t nInteractionsWithMaterial = 0; // for resonance matching @@ -1088,7 +1089,7 @@ struct HfCandidateCreatorXicToXiPiPiExpressions { if (rejectionMask != 0) { // at least one event selection not satisfied --> reject all particles from this collision for (unsigned int i = 0; i < mcParticlesPerMcColl.size(); ++i) { - rowMcMatchGen(-99, -99, -99); + rowMcMatchGen(-99, -99, -99, decayLengthGen); } continue; } @@ -1134,13 +1135,18 @@ struct HfCandidateCreatorXicToXiPiPiExpressions { // Check whether the charm baryon is non-prompt (from a b quark). if (flag != 0) { origin = RecoDecay::getCharmHadronOrigin(mcParticles, particle, false, &idxBhadMothers); + // Calculate the decay length of the generated particle + auto dau0 = particle.template daughters_as().begin(); + const std::array vtxDau{dau0.vx(), dau0.vy(), dau0.vz()}; + const std::array vtxPV{mcCollision.posX(), mcCollision.posY(), mcCollision.posZ()}; + decayLengthGen = RecoDecay::distance(vtxPV, vtxDau); } // Fill table if (origin == RecoDecay::OriginType::NonPrompt) { auto bHadMother = mcParticles.rawIteratorAt(idxBhadMothers[0]); - rowMcMatchGen(flag, origin, bHadMother.pdgCode()); + rowMcMatchGen(flag, origin, bHadMother.pdgCode(), decayLengthGen); } else { - rowMcMatchGen(flag, origin, 0); + rowMcMatchGen(flag, origin, 0, decayLengthGen); } } // close loop over generated particles } // close loop over McCollisions diff --git a/PWGHF/TableProducer/treeCreatorXicToXiPiPi.cxx b/PWGHF/TableProducer/treeCreatorXicToXiPiPi.cxx index 52a12a02b91..ca2f34ae5d3 100644 --- a/PWGHF/TableProducer/treeCreatorXicToXiPiPi.cxx +++ b/PWGHF/TableProducer/treeCreatorXicToXiPiPi.cxx @@ -334,7 +334,8 @@ DECLARE_SOA_TABLE(HfCandXicToXiPiPiFullPs, "AOD", "HFXICXI2PIFULLP", full::Pt, full::Eta, full::Phi, - full::Y); + full::Y, + hf_cand_xic_to_xi_pi_pi::DecayLengthMcGen); } // namespace o2::aod /// Writes the full information in an output TTree @@ -723,7 +724,8 @@ struct HfTreeCreatorXicToXiPiPi { particle.pt(), particle.eta(), particle.phi(), - RecoDecay::y(particle.pVector(), o2::constants::physics::MassXiCPlus)); + RecoDecay::y(particle.pVector(), o2::constants::physics::MassXiCPlus), + particle.decayLengthMcGen()); } } } @@ -776,7 +778,8 @@ struct HfTreeCreatorXicToXiPiPi { particle.pt(), particle.eta(), particle.phi(), - RecoDecay::y(particle.pVector(), o2::constants::physics::MassXiCPlus)); + RecoDecay::y(particle.pVector(), o2::constants::physics::MassXiCPlus), + particle.decayLengthMcGen()); } } }