Skip to content

Commit a006141

Browse files
authored
PWGHF, RecoDecay: Add gen. level pT of matched D0 candidates. (#5201)
* Fix tabs. * RecoDecay: getMother: Enforce matching type of the MC particle. * PWGHF: MC D0: Add gen. level pT of matched candidates.
1 parent 2ca2bfb commit a006141

4 files changed

Lines changed: 20 additions & 15 deletions

File tree

Analysis/Core/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ o2_add_library(AnalysisCore
1212
SOURCES src/CorrelationContainer.cxx
1313
src/TrackSelection.cxx
1414
src/TriggerAliases.cxx
15-
src/HFConfigurables.cxx
15+
src/HFConfigurables.cxx
1616
PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel)
1717

1818
o2_target_root_dictionary(AnalysisCore
@@ -21,7 +21,7 @@ o2_target_root_dictionary(AnalysisCore
2121
include/AnalysisCore/TrackSelectionDefaults.h
2222
include/AnalysisCore/TriggerAliases.h
2323
include/AnalysisCore/MC.h
24-
include/AnalysisCore/HFConfigurables.h
24+
include/AnalysisCore/HFConfigurables.h
2525
LINKDEF src/AnalysisCoreLinkDef.h)
2626

2727
if(FastJet_FOUND)

Analysis/Core/include/AnalysisCore/RecoDecay.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,8 +513,8 @@ class RecoDecay
513513
/// \param acceptAntiParticles switch to accept the antiparticle of the expected mother
514514
/// \param sign antiparticle indicator of the found mother w.r.t. PDGMother; 1 if particle, -1 if antiparticle, 0 if mother not found
515515
/// \return index of the mother particle if found, -1 otherwise
516-
template <typename T, typename U>
517-
static int getMother(const T& particlesMC, const U& particle, int PDGMother, bool acceptAntiParticles = false, int8_t* sign = nullptr)
516+
template <typename T>
517+
static int getMother(const T& particlesMC, const typename T::iterator& particle, int PDGMother, bool acceptAntiParticles = false, int8_t* sign = nullptr)
518518
{
519519
int8_t sgn = 0; // 1 if the expected mother is particle, -1 if antiparticle (w.r.t. PDGMother)
520520
int indexMother = -1; // index of the final matched mother, if found

Analysis/Tasks/PWGHF/HFTrackIndexSkimsCreator.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ struct HFTrackIndexSkimsCreator {
209209
/*
210210
if (nCollsMax > -1){
211211
if (nColls == nCollMax){
212-
return;
212+
return;
213213
//can be added to run over limited collisions per file - for tesing purposes
214214
}
215215
nColls++;

Analysis/Tasks/PWGHF/taskD0.cxx

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,15 @@ struct TaskD0 {
102102
struct 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

Comments
 (0)