@@ -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