Skip to content

Commit

Permalink
PWGHF, RecoDecay: Add gen. level pT of matched D0 candidates. (#5201)
Browse files Browse the repository at this point in the history
* Fix tabs.

* RecoDecay: getMother: Enforce matching type of the MC particle.

* PWGHF: MC D0: Add gen. level pT of matched candidates.
  • Loading branch information
vkucera committed Jan 20, 2021
1 parent 2ca2bfb commit a006141
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
4 changes: 2 additions & 2 deletions Analysis/Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ o2_add_library(AnalysisCore
SOURCES src/CorrelationContainer.cxx
src/TrackSelection.cxx
src/TriggerAliases.cxx
src/HFConfigurables.cxx
src/HFConfigurables.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel)

o2_target_root_dictionary(AnalysisCore
Expand All @@ -21,7 +21,7 @@ o2_target_root_dictionary(AnalysisCore
include/AnalysisCore/TrackSelectionDefaults.h
include/AnalysisCore/TriggerAliases.h
include/AnalysisCore/MC.h
include/AnalysisCore/HFConfigurables.h
include/AnalysisCore/HFConfigurables.h
LINKDEF src/AnalysisCoreLinkDef.h)

if(FastJet_FOUND)
Expand Down
4 changes: 2 additions & 2 deletions Analysis/Core/include/AnalysisCore/RecoDecay.h
Original file line number Diff line number Diff line change
Expand Up @@ -513,8 +513,8 @@ class RecoDecay
/// \param acceptAntiParticles switch to accept the antiparticle of the expected mother
/// \param sign antiparticle indicator of the found mother w.r.t. PDGMother; 1 if particle, -1 if antiparticle, 0 if mother not found
/// \return index of the mother particle if found, -1 otherwise
template <typename T, typename U>
static int getMother(const T& particlesMC, const U& particle, int PDGMother, bool acceptAntiParticles = false, int8_t* sign = nullptr)
template <typename T>
static int getMother(const T& particlesMC, const typename T::iterator& particle, int PDGMother, bool acceptAntiParticles = false, int8_t* sign = nullptr)
{
int8_t sgn = 0; // 1 if the expected mother is particle, -1 if antiparticle (w.r.t. PDGMother)
int indexMother = -1; // index of the final matched mother, if found
Expand Down
2 changes: 1 addition & 1 deletion Analysis/Tasks/PWGHF/HFTrackIndexSkimsCreator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ struct HFTrackIndexSkimsCreator {
/*
if (nCollsMax > -1){
if (nColls == nCollMax){
return;
return;
//can be added to run over limited collisions per file - for tesing purposes
}
nColls++;
Expand Down
25 changes: 15 additions & 10 deletions Analysis/Tasks/PWGHF/taskD0.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,15 @@ struct TaskD0 {
struct TaskD0MC {
HistogramRegistry registry{
"registry",
{{"hPtRecSig", "2-prong candidates (rec. matched);#it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}},
{"hPtRecBg", "2-prong candidates (rec. unmatched);#it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}},
{"hPtGen", "2-prong candidates (gen. matched);#it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}},
{"hCPARecSig", "2-prong candidates (rec. matched);cosine of pointing angle;entries", {HistType::kTH1F, {{110, -1.1, 1.1}}}},
{"hCPARecBg", "2-prong candidates (rec. unmatched);cosine of pointing angle;entries", {HistType::kTH1F, {{110, -1.1, 1.1}}}},
{"hEtaRecSig", "2-prong candidates (rec. matched);#it{#eta};entries", {HistType::kTH1F, {{100, -2., 2.}}}},
{"hEtaRecBg", "2-prong candidates (rec. unmatched);#it{#eta};entries", {HistType::kTH1F, {{100, -2., 2.}}}},
{"hEtaGen", "2-prong candidates (gen. matched);#it{#eta};entries", {HistType::kTH1F, {{100, -2., 2.}}}}}};
{{"hPtRecSig", "2-prong candidates (matched);#it{p}_{T}^{rec.} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}},
{"hPtRecBg", "2-prong candidates (unmatched);#it{p}_{T}^{rec.} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}},
{"hPtGen", "MC particles (matched);#it{p}_{T}^{gen.} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}},
{"hPtGenSig", "2-prong candidates (matched);#it{p}_{T}^{gen.} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}},
{"hCPARecSig", "2-prong candidates (matched);cosine of pointing angle;entries", {HistType::kTH1F, {{110, -1.1, 1.1}}}},
{"hCPARecBg", "2-prong candidates (unmatched);cosine of pointing angle;entries", {HistType::kTH1F, {{110, -1.1, 1.1}}}},
{"hEtaRecSig", "2-prong candidates (matched);#it{#eta};entries", {HistType::kTH1F, {{100, -2., 2.}}}},
{"hEtaRecBg", "2-prong candidates (unmatched);#it{#eta};entries", {HistType::kTH1F, {{100, -2., 2.}}}},
{"hEtaGen", "MC particles (matched);#it{#eta};entries", {HistType::kTH1F, {{100, -2., 2.}}}}}};

Configurable<int> d_selectionFlagD0{"d_selectionFlagD0", 1, "Selection Flag for D0"};
Configurable<int> d_selectionFlagD0bar{"d_selectionFlagD0bar", 1, "Selection Flag for D0bar"};
Expand All @@ -118,7 +119,7 @@ struct TaskD0MC {
Filter filterSelectCandidates = (aod::hf_selcandidate_d0::isSelD0 >= d_selectionFlagD0 || aod::hf_selcandidate_d0::isSelD0bar >= d_selectionFlagD0bar);

void process(soa::Filtered<soa::Join<aod::HfCandProng2, aod::HFSelD0Candidate, aod::HfCandProng2MCRec>> const& candidates,
soa::Join<aod::McParticles, aod::HfCandProng2MCGen> const& particlesMC)
soa::Join<aod::McParticles, aod::HfCandProng2MCGen> const& particlesMC, aod::BigTracksMC const& tracks)
{
// MC rec.
//Printf("MC Candidates: %d", candidates.size());
Expand All @@ -131,7 +132,11 @@ struct TaskD0MC {
continue;
}
if (std::abs(candidate.flagMCMatchRec()) == D0ToPiK) {
registry.fill(HIST("hPtRecSig"), candidate.pt());
// Get the corresponding MC particle.
auto indexMother = RecoDecay::getMother(particlesMC, candidate.index0_as<aod::BigTracksMC>().label_as<soa::Join<aod::McParticles, aod::HfCandProng2MCGen>>(), 421, true);
auto particleMother = particlesMC.iteratorAt(indexMother);
registry.fill(HIST("hPtGenSig"), particleMother.pt()); // gen. level pT
registry.fill(HIST("hPtRecSig"), candidate.pt()); // rec. level pT
registry.fill(HIST("hCPARecSig"), candidate.cpa());
registry.fill(HIST("hEtaRecSig"), candidate.eta());
} else {
Expand Down

0 comments on commit a006141

Please sign in to comment.