Skip to content

Commit cc232c4

Browse files
authored
PWGEM/PhotonMeson: improve MC primary selection in tagging (#5440)
1 parent 3bb4d37 commit cc232c4

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

PWGEM/PhotonMeson/Tasks/TaggingPi0MC.cxx

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -356,23 +356,27 @@ struct TaggingPi0MC {
356356
auto ele1mc = ele1.template emmcparticle_as<aod::EMMCParticles>();
357357

358358
int photonid1 = FindCommonMotherFrom2Prongs(pos1mc, ele1mc, -11, 11, 22, mcparticles);
359-
// if (photonid1 < 0) { // check swap, true electron is reconstructed as positron and vice versa.
360-
// photonid1 = FindCommonMotherFrom2Prongs(pos1mc, ele1mc, 11, -11, 22, mcparticles);
361-
// }
362-
363-
if (photonid1 > 0) {
364-
auto mcphoton1 = mcparticles.iteratorAt(photonid1);
365-
int pi0id1 = IsXFromY(mcphoton1, mcparticles, 22, 111);
366-
if (pi0id1 > 0) {
367-
auto mcpi01 = mcparticles.iteratorAt(pi0id1);
368-
if (mcpi01.isPhysicalPrimary() || mcpi01.producedByGenerator()) {
369-
reinterpret_cast<TH1F*>(list_pcm->FindObject(Form("%s", cut1.GetName()))->FindObject("hPt_v0photon_Pi0_Primary"))->Fill(g1.pt());
370-
} else if (IsFromWD(mcpi01.emmcevent(), mcpi01, mcparticles)) {
371-
reinterpret_cast<TH1F*>(list_pcm->FindObject(Form("%s", cut1.GetName()))->FindObject("hPt_v0photon_Pi0_FromWD"))->Fill(g1.pt());
372-
} else {
373-
reinterpret_cast<TH1F*>(list_pcm->FindObject(Form("%s", cut1.GetName()))->FindObject("hPt_v0photon_Pi0_hs"))->Fill(g1.pt());
374-
}
375-
}
359+
if (photonid1 < 0) {
360+
continue;
361+
}
362+
auto mcphoton1 = mcparticles.iteratorAt(photonid1);
363+
364+
int pi0id1 = IsXFromY(mcphoton1, mcparticles, 22, 111);
365+
if (pi0id1 < 0) { // photon from pi0 decay
366+
continue;
367+
}
368+
auto mcpi01 = mcparticles.iteratorAt(pi0id1);
369+
370+
// // check if pi0 is physical primary or produced by generator, photon should be physical primary or produced by generator.
371+
// LOGF(info, "mcphoton1.isPhysicalPrimary() = %d, mcphoton1.producedByGenerator() = %d, mcpi01.isPhysicalPrimary() = %d, mcpi01.producedByGenerator() = %d",
372+
// mcphoton1.isPhysicalPrimary(), mcphoton1.producedByGenerator(), mcpi01.isPhysicalPrimary(), mcpi01.producedByGenerator());
373+
374+
if (mcpi01.isPhysicalPrimary() || mcpi01.producedByGenerator()) {
375+
reinterpret_cast<TH1F*>(list_pcm->FindObject(cut1.GetName())->FindObject("hPt_v0photon_Pi0_Primary"))->Fill(g1.pt());
376+
} else if (IsFromWD(mcpi01.emmcevent(), mcpi01, mcparticles)) {
377+
reinterpret_cast<TH1F*>(list_pcm->FindObject(cut1.GetName())->FindObject("hPt_v0photon_Pi0_FromWD"))->Fill(g1.pt());
378+
} else {
379+
reinterpret_cast<TH1F*>(list_pcm->FindObject(cut1.GetName())->FindObject("hPt_v0photon_Pi0_hs"))->Fill(g1.pt());
376380
}
377381

378382
} // end of pcm photon loop

0 commit comments

Comments
 (0)