Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion PWGEM/PhotonMeson/TableProducer/associateMCinfoPhoton.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
Configurable<float> margin_z_gen{"margin_z_gen", 15.f, "margin for Z of true photon conversion point to store generated information"};
Configurable<float> max_rxy_gen{"max_rxy_gen", 100, "max rxy to store generated information"};
Configurable<bool> requireGammaGammaDecay{"requireGammaGammaDecay", false, "require gamma gamma decay for generated pi0 and eta meson"};

Configurable<float> cfg_max_eta_photon{"cfg_max_eta_gamma", 0.8, "max eta for photons at PV"};

Check failure on line 69 in PWGEM/PhotonMeson/TableProducer/associateMCinfoPhoton.cxx

View workflow job for this annotation

GitHub Actions / PR formatting / whitespace

Trailing spaces

Remove the trailing spaces at the end of the line.
HistogramRegistry registry{"EMMCEvent"};

void init(o2::framework::InitContext&)
Expand Down Expand Up @@ -98,6 +99,7 @@

for (uint i = 0; i < NParticleNames; i++) {
registry.add<TH2>(Form("Generated/h2PtY_%s", ParticleNames[i].data()), Form("Generated %s", ParticleNames[i].data()), kTH2F, {axisPt, axisRapidity}, true);
registry.add<TH2>(Form("Generated/h2PtY_Accepted_%s", ParticleNames[i].data()), Form("Generated %s", ParticleNames[i].data()), kTH2F, {axisPt, axisRapidity}, true);
}

// reserve space for generated vectors if that process enabled
Expand Down Expand Up @@ -170,6 +172,19 @@
for (const auto& mcParticle : groupedMcParticles) { // store necessary information for denominator of efficiency
if ((mcParticle.isPhysicalPrimary() || mcParticle.producedByGenerator()) && std::fabs(mcParticle.y()) < 0.9f && mcParticle.pt() < 20.f) {
auto binNumber = hBinFinder->FindBin(mcParticle.pt(), std::fabs(mcParticle.y())); // caution: pack
size_t lNDaughters = 0;

Check failure on line 175 in PWGEM/PhotonMeson/TableProducer/associateMCinfoPhoton.cxx

View workflow job for this annotation

GitHub Actions / PR formatting / whitespace

Trailing spaces

Remove the trailing spaces at the end of the line.
size_t mesonAccepted = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is currently used as a bool, please check if this is the intended use. If so, might be best to rename it to isMesonAccepted and make it a bool for clarity.

if (mcParticle.has_daughters()) {
auto lDaughters = mcParticle.daughters_as<aod::McParticles>();
lNDaughters = lDaughters.size();
auto lDaughter0 = lDaughters.begin();
if (lNDaughters == 2) {
auto lDaughter1 = lDaughters.iteratorAt(1);
Comment on lines +180 to +182
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spawning iterators all the time in the loop is very expensive. One should create two iterators once before the loop and use setCursor(index) instead to move the iterator to the correct position.

if ( std::fabs(lDaughter0.eta())< cfg_max_eta_photon && std::fabs(lDaughter1.eta()) < cfg_max_eta_photon){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can add a proper function to make the acceptance checks to allow the check for the different photon detection methods? So we can have comparable acceptance between Run2 and Run3

mesonAccepted = 1;
}
}

Check failure on line 186 in PWGEM/PhotonMeson/TableProducer/associateMCinfoPhoton.cxx

View workflow job for this annotation

GitHub Actions / PR formatting / whitespace

Trailing spaces

Remove the trailing spaces at the end of the line.
}

Check failure on line 187 in PWGEM/PhotonMeson/TableProducer/associateMCinfoPhoton.cxx

View workflow job for this annotation

GitHub Actions / PR formatting / whitespace

Trailing spaces

Remove the trailing spaces at the end of the line.
switch (std::abs(mcParticle.pdgCode())) {
case PDG_t::kGamma:
registry.fill(HIST("Generated/h2PtY_Gamma"), mcParticle.pt(), std::fabs(mcParticle.y()));
Expand All @@ -180,12 +195,18 @@
continue;
registry.fill(HIST("Generated/h2PtY_Pi0"), mcParticle.pt(), std::fabs(mcParticle.y()));
genPi0[binNumber]++;
if (mesonAccepted == 1){
registry.fill(HIST("Generated/h2PtY_Accepted_Pi0"), mcParticle.pt(), std::fabs(mcParticle.y()));
}
break;
case Pdg::kEta:
if (requireGammaGammaDecay && !isGammaGammaDecay(mcParticle, mcParticles))
continue;
registry.fill(HIST("Generated/h2PtY_Eta"), mcParticle.pt(), std::fabs(mcParticle.y()));
genEta[binNumber]++;
if (mesonAccepted == 1){
registry.fill(HIST("Generated/h2PtY_Accepted_Eta"), mcParticle.pt(), std::fabs(mcParticle.y()));
}
break;
default:
break;
Expand Down
Loading