Skip to content

Commit 9b9af19

Browse files
committed
implement evaluateDecayLengthGenerated(), add namespace mc_match
1 parent 167ddd3 commit 9b9af19

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

‎PWGHF/TableProducer/treeCreatorXicToXiPiPi.cxx‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ DECLARE_SOA_COLUMN(MlScorePrompt, mlScorePrompt, float);
9696
DECLARE_SOA_COLUMN(MlScoreNonPrompt, mlScoreNonPrompt, float); //! ML score for non-prompt signal class (3-class model only, -1 otherwise)
9797
} // namespace full
9898

99+
namespace mc_match
100+
{
101+
DECLARE_SOA_COLUMN(PGen, pGen, float); //! momentum of matched generated particle
102+
DECLARE_SOA_COLUMN(DecayLengthGen, decayLengthGen, float); //! decay length of matched generated particle
103+
} // namespace mc_match
104+
99105
DECLARE_SOA_TABLE(HfCandXicToXiPiPiLites, "AOD", "HFXICXI2PILITE",
100106
full::ParticleFlag,
101107
hf_cand_mc_flag::OriginMcRec,
@@ -805,6 +811,23 @@ struct HfTreeCreatorXicToXiPiPi {
805811
return particleMother;
806812
}
807813

814+
template <typename CandType>
815+
float evaluateDecayLengthGenerated(CandType const& candidate, MatchedGenXicToXiPiPi::iterator const& particle)
816+
{
817+
const auto mcParticlePi0 = candidate.template pi0_as<o2::aod::TracksWMc>().template mcParticle_as<MatchedGenXicToXiPiPi>();
818+
const auto decayVertexX = mcParticlePi0.vx();
819+
const auto decayVertexY = mcParticlePi0.vy();
820+
const auto decayVertexZ = mcParticlePi0.vz();
821+
822+
const auto mcCollision = particle.template mcCollision_as<aod::McCollisions>();
823+
const auto primaryVertexX = mcCollision.posX();
824+
const auto primaryVertexY = mcCollision.posY();
825+
const auto primaryVertexZ = mcCollision.posZ();
826+
827+
const auto decayLendth = RecoDecay::distance(std::array<float, 3>{primaryVertexX, primaryVertexY, primaryVertexZ}, std::array<float, 3>{decayVertexX, decayVertexY, decayVertexZ});
828+
return decayLendth;
829+
}
830+
808831
void processData(SelectedCandidates const& candidates)
809832
{
810833
// Filling candidate properties

0 commit comments

Comments
 (0)