diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc_direct.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc_direct.cxx index 745e0833de4..0b704a56616 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc_direct.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc_direct.cxx @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -1151,6 +1152,8 @@ struct AnalysisSameEventPairing { } fConfigCCDB; Service fCCDB; + // PDG database + Service pdgDB; HistogramManager* fHistMan; @@ -2076,6 +2079,16 @@ struct AnalysisSameEventPairing { mcDecision |= (static_cast(1) << isig); VarManager::FillPairMC(t1_raw, t2_raw); // cout << " Filled VarManager for the pair." << endl; + // check if t1_raw and t2_raw have same mother to compute decay length related variables + if (t1_raw.has_mothers() && t2_raw.has_mothers()) { + auto motherMCParticle_t1 = t1_raw.template mothers_first_as(); + auto motherMCParticle_t2 = t2_raw.template mothers_first_as(); + if (motherMCParticle_t1 == motherMCParticle_t2) { + auto mcEvent = mcEvents.rawIteratorAt(motherMCParticle_t1.mcCollisionId()); + std::array collVtxPos = {mcEvent.posX(), mcEvent.posY(), mcEvent.posZ()}; + VarManager::FillTrackCollisionMC(motherMCParticle_t1, collVtxPos, pdgDB->Mass(motherMCParticle_t1.pdgCode())); + } + } if (fUseMCGenAccCut) { if (!fMCGenAccCut.IsSelected(VarManager::fgValues)) { continue;