Skip to content

Commit 34b4d0b

Browse files
committed
Feat: add rapidity histogram for mother
1 parent 879b767 commit 34b4d0b

3 files changed

Lines changed: 17 additions & 6 deletions

File tree

‎PWGCF/Femto/Core/mcParticleHistManager.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#ifndef PWGCF_FEMTO_CORE_MCPARTICLEHISTMANAGER_H_
1717
#define PWGCF_FEMTO_CORE_MCPARTICLEHISTMANAGER_H_
1818

19+
#include "PWGCF/Femto/Core/femtoUtils.h"
1920
#include "PWGCF/Femto/Core/histManager.h"
2021
#include "PWGCF/Femto/Core/modes.h"
2122

@@ -52,6 +53,7 @@ enum McParticleHist {
5253
kMotherEta,
5354
kMotherPhi,
5455
kMotherSign,
56+
kMotherY,
5557
// origin (kept in sync with TrackHist, even though some categories
5658
// are not expected to be populated for pure MC truth particles)
5759
kOrigin,
@@ -105,6 +107,7 @@ constexpr std::array<histmanager::HistInfo<McParticleHist>, kMcParticleHistLast>
105107
{kMotherEta, o2::framework::HistType::kTH1F, "hMotherEta", "Mother pseudorapidity; #eta; Entries"},
106108
{kMotherPhi, o2::framework::HistType::kTH1F, "hMotherPhi", "Mother azimuthal angle; #varphi; Entries"},
107109
{kMotherSign, o2::framework::HistType::kTH1F, "hMotherSign", "Sign of mother charge; Sign; Entries"},
110+
{kMotherY, o2::framework::HistType::kTH1F, "hMotherY", "Mother rapidity; Y; Entries"},
108111
{kOrigin, o2::framework::HistType::kTH1F, "hOrigin", "Status Codes (=Origin); Status Code; Entries"},
109112
{kNoMcParticle, o2::framework::HistType::kTH1F, "hNoMcParticle", "Particles with no associated MC information; p_{T} (GeV/#it{c}); Entries"},
110113
{kPrimary, o2::framework::HistType::kTH1F, "hPrimary", "Primary particles; p_{T} (GeV/#it{c}); Entries"},
@@ -132,6 +135,7 @@ auto makeMcParticleHistSpecMap(const T& confBinning)
132135
{kMotherEta, {confBinning.eta}},
133136
{kMotherPhi, {confBinning.phi}},
134137
{kMotherSign, {confBinning.sign}},
138+
{kMotherY, {confBinning.eta}},
135139
{kNoMcParticle, {confBinning.pt}},
136140
{kPrimary, {confBinning.pt}},
137141
{kFromWrongCollision, {confBinning.pt}},
@@ -182,6 +186,7 @@ class McParticleHistManager
182186
mHistogramRegistry->add(mcDir + getHistNameV2(kMotherEta, HistTable), getHistDesc(kMotherEta, HistTable), getHistType(kMotherEta, HistTable), {Specs.at(kMotherEta)});
183187
mHistogramRegistry->add(mcDir + getHistNameV2(kMotherPhi, HistTable), getHistDesc(kMotherPhi, HistTable), getHistType(kMotherPhi, HistTable), {Specs.at(kMotherPhi)});
184188
mHistogramRegistry->add(mcDir + getHistNameV2(kMotherSign, HistTable), getHistDesc(kMotherSign, HistTable), getHistType(kMotherSign, HistTable), {Specs.at(kMotherSign)});
189+
mHistogramRegistry->add(mcDir + getHistNameV2(kMotherY, HistTable), getHistDesc(kMotherY, HistTable), getHistType(kMotherY, HistTable), {Specs.at(kMotherY)});
185190

186191
this->enableOptionalHistograms(confBinning);
187192
this->initOrigin(Specs);
@@ -204,6 +209,7 @@ class McParticleHistManager
204209
mHistogramRegistry->fill(HIST(prefix) + HIST(McDir) + HIST(getHistName(kMotherEta, HistTable)), mother.eta());
205210
mHistogramRegistry->fill(HIST(prefix) + HIST(McDir) + HIST(getHistName(kMotherPhi, HistTable)), mother.phi());
206211
mHistogramRegistry->fill(HIST(prefix) + HIST(McDir) + HIST(getHistName(kMotherSign, HistTable)), mother.sign());
212+
mHistogramRegistry->fill(HIST(prefix) + HIST(McDir) + HIST(getHistName(kMotherY, HistTable)), mother.y(utils::getPdgMass(mother.pdgCode())));
207213
} else {
208214
mHistogramRegistry->fill(HIST(prefix) + HIST(McDir) + HIST(getHistName(kPdgMother, HistTable)), 0);
209215
}

‎PWGCF/Femto/Core/particleCleaner.h‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818

1919
#include "PWGCF/Femto/Core/femtoUtils.h"
2020

21-
#include "Common/Core/RecoDecay.h"
22-
2321
#include <CommonConstants/MathConstants.h>
2422
#include <Framework/Configurable.h>
2523

@@ -251,10 +249,11 @@ class ParticleCleaner
251249
motherKinematicsOk = false;
252250
}
253251

254-
// rapidity needs the mother's mass, which FMcMothers does not store directly -- look it up
255-
// from its pdg code (same mechanism as the kstar/Q3 mass lookup in pairHistManager.h)
252+
// rapidity needs the mother's mass, which FMcMothers does not store directly -- its Y()
253+
// dynamic column takes mass as a free argument, looked up from the pdg code (same mechanism
254+
// as the kstar/Q3 mass lookup in pairHistManager.h)
256255
if (mMotherRapidityMin > -1e6f || mMotherRapidityMax < 1e6f) {
257-
double motherRapidity = RecoDecay::y(mother.pt(), mother.eta(), utils::getPdgMass(mother.pdgCode()));
256+
double motherRapidity = mother.y(utils::getPdgMass(mother.pdgCode()));
258257
if (!(motherRapidity > mMotherRapidityMin && motherRapidity < mMotherRapidityMax)) {
259258
motherKinematicsOk = false;
260259
}

‎PWGCF/Femto/DataModel/FemtoTables.h‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,11 @@ DECLARE_SOA_DYNAMIC_COLUMN(Theta, theta, //! theta
246246
[](float eta) -> float {
247247
return 2.f * std::atan(std::exp(-eta));
248248
});
249+
DECLARE_SOA_DYNAMIC_COLUMN(Y, y, //! rapidity -- mass is not a stored column, so it is passed in as an
250+
//! extra free argument at the call site, e.g. mother.y(mass)
251+
[](float signedPt, float eta, float mass) -> float {
252+
return RecoDecay::y(std::fabs(signedPt), eta, mass);
253+
});
249254
} // namespace dynamic
250255

251256
namespace lite
@@ -1761,7 +1766,8 @@ DECLARE_SOA_TABLE_STAGED_VERSIONED(FMcMothers_001, "FMCMOTHER", 1, //! first dir
17611766
femtobase::dynamic::Px<femtobase::stored::SignedPt, femtobase::stored::Phi>,
17621767
femtobase::dynamic::Py<femtobase::stored::SignedPt, femtobase::stored::Phi>,
17631768
femtobase::dynamic::Pz<femtobase::stored::SignedPt, femtobase::stored::Eta>,
1764-
femtobase::dynamic::Theta<femtobase::stored::Eta>);
1769+
femtobase::dynamic::Theta<femtobase::stored::Eta>,
1770+
femtobase::dynamic::Y<femtobase::stored::SignedPt, femtobase::stored::Eta>); // mass is a free argument, e.g. mother.y(mass)
17651771

17661772
using FMcMothers = FMcMothers_001;
17671773
using FMcMother = FMcMothers::iterator;

0 commit comments

Comments
 (0)