@@ -102,14 +102,15 @@ struct TaskD0 {
102102struct TaskD0MC {
103103 HistogramRegistry registry{
104104 " registry" ,
105- {{" hPtRecSig" , " 2-prong candidates (rec. matched);#it{p}_{T} (GeV/#it{c});entries" , {HistType::kTH1F , {{100 , 0 ., 10 .}}}},
106- {" hPtRecBg" , " 2-prong candidates (rec. unmatched);#it{p}_{T} (GeV/#it{c});entries" , {HistType::kTH1F , {{100 , 0 ., 10 .}}}},
107- {" hPtGen" , " 2-prong candidates (gen. matched);#it{p}_{T} (GeV/#it{c});entries" , {HistType::kTH1F , {{100 , 0 ., 10 .}}}},
108- {" hCPARecSig" , " 2-prong candidates (rec. matched);cosine of pointing angle;entries" , {HistType::kTH1F , {{110 , -1.1 , 1.1 }}}},
109- {" hCPARecBg" , " 2-prong candidates (rec. unmatched);cosine of pointing angle;entries" , {HistType::kTH1F , {{110 , -1.1 , 1.1 }}}},
110- {" hEtaRecSig" , " 2-prong candidates (rec. matched);#it{#eta};entries" , {HistType::kTH1F , {{100 , -2 ., 2 .}}}},
111- {" hEtaRecBg" , " 2-prong candidates (rec. unmatched);#it{#eta};entries" , {HistType::kTH1F , {{100 , -2 ., 2 .}}}},
112- {" hEtaGen" , " 2-prong candidates (gen. matched);#it{#eta};entries" , {HistType::kTH1F , {{100 , -2 ., 2 .}}}}}};
105+ {{" hPtRecSig" , " 2-prong candidates (matched);#it{p}_{T}^{rec.} (GeV/#it{c});entries" , {HistType::kTH1F , {{100 , 0 ., 10 .}}}},
106+ {" hPtRecBg" , " 2-prong candidates (unmatched);#it{p}_{T}^{rec.} (GeV/#it{c});entries" , {HistType::kTH1F , {{100 , 0 ., 10 .}}}},
107+ {" hPtGen" , " MC particles (matched);#it{p}_{T}^{gen.} (GeV/#it{c});entries" , {HistType::kTH1F , {{100 , 0 ., 10 .}}}},
108+ {" hPtGenSig" , " 2-prong candidates (matched);#it{p}_{T}^{gen.} (GeV/#it{c});entries" , {HistType::kTH1F , {{100 , 0 ., 10 .}}}},
109+ {" hCPARecSig" , " 2-prong candidates (matched);cosine of pointing angle;entries" , {HistType::kTH1F , {{110 , -1.1 , 1.1 }}}},
110+ {" hCPARecBg" , " 2-prong candidates (unmatched);cosine of pointing angle;entries" , {HistType::kTH1F , {{110 , -1.1 , 1.1 }}}},
111+ {" hEtaRecSig" , " 2-prong candidates (matched);#it{#eta};entries" , {HistType::kTH1F , {{100 , -2 ., 2 .}}}},
112+ {" hEtaRecBg" , " 2-prong candidates (unmatched);#it{#eta};entries" , {HistType::kTH1F , {{100 , -2 ., 2 .}}}},
113+ {" hEtaGen" , " MC particles (matched);#it{#eta};entries" , {HistType::kTH1F , {{100 , -2 ., 2 .}}}}}};
113114
114115 Configurable<int > d_selectionFlagD0{" d_selectionFlagD0" , 1 , " Selection Flag for D0" };
115116 Configurable<int > d_selectionFlagD0bar{" d_selectionFlagD0bar" , 1 , " Selection Flag for D0bar" };
@@ -118,7 +119,7 @@ struct TaskD0MC {
118119 Filter filterSelectCandidates = (aod::hf_selcandidate_d0::isSelD0 >= d_selectionFlagD0 || aod::hf_selcandidate_d0::isSelD0bar >= d_selectionFlagD0bar);
119120
120121 void process (soa::Filtered<soa::Join<aod::HfCandProng2, aod::HFSelD0Candidate, aod::HfCandProng2MCRec>> const & candidates,
121- soa::Join<aod::McParticles, aod::HfCandProng2MCGen> const & particlesMC)
122+ soa::Join<aod::McParticles, aod::HfCandProng2MCGen> const & particlesMC, aod::BigTracksMC const & tracks )
122123 {
123124 // MC rec.
124125 // Printf("MC Candidates: %d", candidates.size());
@@ -131,7 +132,11 @@ struct TaskD0MC {
131132 continue ;
132133 }
133134 if (std::abs (candidate.flagMCMatchRec ()) == D0ToPiK) {
134- registry.fill (HIST (" hPtRecSig" ), candidate.pt ());
135+ // Get the corresponding MC particle.
136+ auto indexMother = RecoDecay::getMother (particlesMC, candidate.index0_as <aod::BigTracksMC>().label_as <soa::Join<aod::McParticles, aod::HfCandProng2MCGen>>(), 421 , true );
137+ auto particleMother = particlesMC.iteratorAt (indexMother);
138+ registry.fill (HIST (" hPtGenSig" ), particleMother.pt ()); // gen. level pT
139+ registry.fill (HIST (" hPtRecSig" ), candidate.pt ()); // rec. level pT
135140 registry.fill (HIST (" hCPARecSig" ), candidate.cpa ());
136141 registry.fill (HIST (" hEtaRecSig" ), candidate.eta ());
137142 } else {
0 commit comments