Skip to content

Commit 57b99fc

Browse files
committed
Adding histograms for accepted pi0 and eta into gamma gamma decay channel with a function
1 parent f1345fe commit 57b99fc

1 file changed

Lines changed: 25 additions & 14 deletions

File tree

PWGEM/PhotonMeson/TableProducer/associateMCinfoPhoton.cxx

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ struct AssociateMCInfoPhoton {
6666
Configurable<float> max_rxy_gen{"max_rxy_gen", 100, "max rxy to store generated information"};
6767
Configurable<bool> requireGammaGammaDecay{"requireGammaGammaDecay", false, "require gamma gamma decay for generated pi0 and eta meson"};
6868
Configurable<float> cfg_max_eta_photon{"cfg_max_eta_gamma", 0.8, "max eta for photons at PV"};
69-
69+
7070
HistogramRegistry registry{"EMMCEvent"};
7171

7272
void init(o2::framework::InitContext&)
@@ -172,19 +172,15 @@ struct AssociateMCInfoPhoton {
172172
for (const auto& mcParticle : groupedMcParticles) { // store necessary information for denominator of efficiency
173173
if ((mcParticle.isPhysicalPrimary() || mcParticle.producedByGenerator()) && std::fabs(mcParticle.y()) < 0.9f && mcParticle.pt() < 20.f) {
174174
auto binNumber = hBinFinder->FindBin(mcParticle.pt(), std::fabs(mcParticle.y())); // caution: pack
175-
size_t lNDaughters = 0;
176-
size_t mesonAccepted = 0;
175+
176+
bool isMesonAccepted = false;
177177
if (mcParticle.has_daughters()) {
178178
auto lDaughters = mcParticle.daughters_as<aod::McParticles>();
179-
lNDaughters = lDaughters.size();
180-
auto lDaughter0 = lDaughters.begin();
181-
if (lNDaughters == 2) {
182-
auto lDaughter1 = lDaughters.iteratorAt(1);
183-
if ( std::fabs(lDaughter0.eta())< cfg_max_eta_photon && std::fabs(lDaughter1.eta()) < cfg_max_eta_photon){
184-
mesonAccepted = 1;
185-
}
186-
}
187-
}
179+
180+
if (areTwoPhotonDaughtersAccepted(lDaughters, cfg_max_eta_photon)) {
181+
isMesonAccepted = true;
182+
}
183+
}
188184
switch (std::abs(mcParticle.pdgCode())) {
189185
case PDG_t::kGamma:
190186
registry.fill(HIST("Generated/h2PtY_Gamma"), mcParticle.pt(), std::fabs(mcParticle.y()));
@@ -195,7 +191,7 @@ struct AssociateMCInfoPhoton {
195191
continue;
196192
registry.fill(HIST("Generated/h2PtY_Pi0"), mcParticle.pt(), std::fabs(mcParticle.y()));
197193
genPi0[binNumber]++;
198-
if (mesonAccepted == 1){
194+
if (isMesonAccepted) {
199195
registry.fill(HIST("Generated/h2PtY_Accepted_Pi0"), mcParticle.pt(), std::fabs(mcParticle.y()));
200196
}
201197
break;
@@ -204,7 +200,7 @@ struct AssociateMCInfoPhoton {
204200
continue;
205201
registry.fill(HIST("Generated/h2PtY_Eta"), mcParticle.pt(), std::fabs(mcParticle.y()));
206202
genEta[binNumber]++;
207-
if (mesonAccepted == 1){
203+
if (isMesonAccepted) {
208204
registry.fill(HIST("Generated/h2PtY_Accepted_Eta"), mcParticle.pt(), std::fabs(mcParticle.y()));
209205
}
210206
break;
@@ -513,6 +509,21 @@ struct AssociateMCInfoPhoton {
513509
fCounters[1] = 0;
514510
} // end of skimmingMC
515511

512+
template <typename Daughters>
513+
inline bool areTwoPhotonDaughtersAccepted(const Daughters& lDaughters, float maxEta)
514+
{
515+
if (lDaughters.size() != 2) {
516+
return false;
517+
}
518+
519+
auto it0 = lDaughters.begin();
520+
auto it1 = it0;
521+
++it1;
522+
523+
return (std::fabs(it0.eta()) < maxEta &&
524+
std::fabs(it1.eta()) < maxEta);
525+
}
526+
516527
void processMC_PCM(MyCollisionsMC const& collisions, aod::BCs const& bcs, aod::McCollisions const& mccollisions, aod::McParticles const& mcParticles, TracksMC const& o2tracks, aod::V0PhotonsKF const& v0photons, aod::V0Legs const& v0legs)
517528
{
518529
skimmingMC<kPCM>(collisions, bcs, mccollisions, mcParticles, o2tracks, nullptr, v0photons, v0legs, nullptr, nullptr, nullptr);

0 commit comments

Comments
 (0)