@@ -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
0 commit comments