@@ -567,100 +567,107 @@ struct HfElectronSelectionWithTpcEmcal {
567567 bool isEmbPi0 = false ;
568568
569569 // Check first mother
570- auto const & mother = particleMc.mothers_first_as <aod::McParticles>();
571-
572- if (std::abs (mother.pdgCode ()) == kEta || std::abs (mother.pdgCode ()) == kPi0 || std::abs (mother.pdgCode ()) == kGamma ) {
573- registry.fill (HIST (" hMcgenAllNonHfeElectron" ), particleMc.pt ());
574- auto const & gmother = mother.mothers_first_as <aod::McParticles>();
575- auto const & ggmother = gmother.mothers_first_as <aod::McParticles>();
576- auto const & gggmother = ggmother.mothers_first_as <aod::McParticles>();
577-
578- // cases to consider: eta->e, eta->pi0->e, eta->gamma->e, eta->pi0->gamma->e, pi0->e, pi0->gamma->e
579-
580- // ================= eta->e ======================================
581- if (std::abs (mother.pdgCode ()) == kEta ) {
582- if (mother.isPhysicalPrimary ()) {
583- if ((std::abs (gmother.pdgCode ()) >= pdgCodeCharmMin && std::abs (gmother.pdgCode ()) < pdgCodeCharmMax) ||
584- (std::abs (gmother.pdgCode ()) >= pdgCodeBeautyMin && std::abs (gmother.pdgCode ()) < pdgCodeBeautyMax)) {
585- continue ;
586- }
587- isEmbEta = true ;
588- }
589- }
590- // ================= eta->pi0->e ======================================
570+ if (particleMc.has_mothers ()) {
571+ auto const & mother = particleMc.mothers_first_as <aod::McParticles>();
591572
592- if (std::abs (mother.pdgCode ()) == kPi0 ) {
593- if (mother.isPhysicalPrimary ()) {
594- if ((std::abs (gmother.pdgCode ()) >= pdgCodeCharmMin && std::abs (gmother.pdgCode ()) < pdgCodeCharmMax) ||
595- (std::abs (gmother.pdgCode ()) >= pdgCodeBeautyMin && std::abs (gmother.pdgCode ()) < pdgCodeBeautyMax)) {
596- continue ;
597- }
598- isEmbPi0 = true ; // pi0 -> e
599- }
573+ if (std::abs (mother.pdgCode ()) == kEta || std::abs (mother.pdgCode ()) == kPi0 || std::abs (mother.pdgCode ()) == kGamma ) {
574+
575+ registry.fill (HIST (" hMcgenAllNonHfeElectron" ), particleMc.pt ());
576+
577+ auto const & gmother = mother.mothers_first_as <aod::McParticles>();
578+ // cases to consider: eta->e, eta->pi0->e, eta->gamma->e, eta->pi0->gamma->e, pi0->e, pi0->gamma->e
600579
601- if (std::abs (gmother.pdgCode ()) == kEta ) {
602- if (gmother.isPhysicalPrimary ()) {
603- if ((std::abs (ggmother.pdgCode ()) >= pdgCodeCharmMin && std::abs (ggmother.pdgCode ()) < pdgCodeCharmMax) ||
604- (std::abs (ggmother.pdgCode ()) >= pdgCodeBeautyMin && std::abs (ggmother.pdgCode ()) < pdgCodeBeautyMax)) {
580+ // ================= eta->e ======================================
581+ if (std::abs (mother.pdgCode ()) == kEta ) {
582+
583+ if (mother.isPhysicalPrimary ()) {
584+ if ((std::abs (gmother.pdgCode ()) >= pdgCodeCharmMin && std::abs (gmother.pdgCode ()) < pdgCodeCharmMax) ||
585+ (std::abs (gmother.pdgCode ()) >= pdgCodeBeautyMin && std::abs (gmother.pdgCode ()) < pdgCodeBeautyMax)) {
605586 continue ;
606587 }
607- isEmbEta = true ; // eta->pi0-> e
588+ isEmbEta = true ;
608589 }
609590 }
610- }
611591
612- // / ==================================== eta->gamma->e and eta->pi0->gamma->e ============
613- if ( std::abs (mother. pdgCode ()) == kGamma ) {
614- if (std::abs (gmother .pdgCode ()) == kEta ) {
615- if (gmother .isPhysicalPrimary ()) {
616- if ((std::abs (ggmother .pdgCode ()) >= pdgCodeCharmMin && std::abs (ggmother .pdgCode ()) < pdgCodeCharmMax) ||
617- (std::abs (ggmother .pdgCode ()) >= pdgCodeBeautyMin && std::abs (ggmother .pdgCode ()) < pdgCodeBeautyMax)) {
592+ // ================= eta->pi0->e ========================== ============
593+
594+ if (std::abs (mother .pdgCode ()) == kPi0 ) {
595+ if (mother .isPhysicalPrimary ()) {
596+ if ((std::abs (gmother .pdgCode ()) >= pdgCodeCharmMin && std::abs (gmother .pdgCode ()) < pdgCodeCharmMax) ||
597+ (std::abs (gmother .pdgCode ()) >= pdgCodeBeautyMin && std::abs (gmother .pdgCode ()) < pdgCodeBeautyMax)) {
618598 continue ;
619599 }
620- isEmbEta = true ; // eta->gamma-> e
600+ isEmbPi0 = true ; // pi0 -> e
601+ }
602+ if (std::abs (gmother.pdgCode ()) == kEta ) {
603+ if (gmother.isPhysicalPrimary () || gmother.has_mothers ()) {
604+ auto const & ggmother = gmother.mothers_first_as <aod::McParticles>();
605+ if ((std::abs (ggmother.pdgCode ()) >= pdgCodeCharmMin && std::abs (ggmother.pdgCode ()) < pdgCodeCharmMax) ||
606+ (std::abs (ggmother.pdgCode ()) >= pdgCodeBeautyMin && std::abs (ggmother.pdgCode ()) < pdgCodeBeautyMax)) {
607+ continue ;
608+ }
609+ isEmbEta = true ; // eta->pi0-> e
610+ }
621611 }
622612 }
623613
624- if (std::abs (gmother.pdgCode ()) == kPi0 ) {
625- if (gmother.isPhysicalPrimary ()) {
626- if ((std::abs (ggmother.pdgCode ()) >= pdgCodeCharmMin && std::abs (ggmother.pdgCode ()) < pdgCodeCharmMax) ||
627- (std::abs (ggmother.pdgCode ()) >= pdgCodeBeautyMin && std::abs (ggmother.pdgCode ()) < pdgCodeBeautyMax)) {
628- continue ;
614+ // / ==================================== eta->gamma->e and eta->pi0->gamma->e============
615+ if (std::abs (mother.pdgCode ()) == kGamma ) {
616+
617+ if (std::abs (gmother.pdgCode ()) == kEta ) {
618+ if (gmother.isPhysicalPrimary () || gmother.has_mothers ()) {
619+ auto const & ggmother = gmother.mothers_first_as <aod::McParticles>();
620+ if ((std::abs (ggmother.pdgCode ()) >= pdgCodeCharmMin && std::abs (ggmother.pdgCode ()) < pdgCodeCharmMax) ||
621+ (std::abs (ggmother.pdgCode ()) >= pdgCodeBeautyMin && std::abs (ggmother.pdgCode ()) < pdgCodeBeautyMax)) {
622+ continue ;
623+ }
624+ isEmbEta = true ; // eta->gamma-> e
629625 }
630- isEmbPi0 = true ; // pi0-> gamma-> e
631626 }
632-
633- if (std::abs (ggmother. pdgCode ()) == kEta ) {
634- if ( ggmother. isPhysicalPrimary ()) {
635- if ((std::abs (gggmother .pdgCode ()) >= pdgCodeCharmMin && std::abs (gggmother .pdgCode ()) < pdgCodeCharmMax) ||
636- (std::abs (gggmother .pdgCode ()) >= pdgCodeBeautyMin && std::abs (gggmother .pdgCode ()) < pdgCodeBeautyMax)) {
627+ if ( std::abs (gmother. pdgCode ()) == kPi0 ) {
628+ if (gmother. isPhysicalPrimary () || gmother. has_mothers () ) {
629+ auto const & ggmother = gmother. mothers_first_as <aod::McParticles>();
630+ if ((std::abs (ggmother .pdgCode ()) >= pdgCodeCharmMin && std::abs (ggmother .pdgCode ()) < pdgCodeCharmMax) ||
631+ (std::abs (ggmother .pdgCode ()) >= pdgCodeBeautyMin && std::abs (ggmother .pdgCode ()) < pdgCodeBeautyMax)) {
637632 continue ;
638633 }
639- isEmbEta = true ; // eta->pi0->gamma-> e
634+ isEmbPi0 = true ; // pi0-> gamma-> e
635+ }
636+ if (gmother.has_mothers ()) {
637+ auto const & ggmother = gmother.mothers_first_as <aod::McParticles>();
638+ if (std::abs (ggmother.pdgCode ()) == kEta ) {
639+ if (ggmother.isPhysicalPrimary () || ggmother.has_mothers ()) {
640+ auto const & gggmother = ggmother.mothers_first_as <aod::McParticles>();
641+ if ((std::abs (gggmother.pdgCode ()) >= pdgCodeCharmMin && std::abs (gggmother.pdgCode ()) < pdgCodeCharmMax) ||
642+ (std::abs (gggmother.pdgCode ()) >= pdgCodeBeautyMin && std::abs (gggmother.pdgCode ()) < pdgCodeBeautyMax)) {
643+ continue ;
644+ }
645+ isEmbEta = true ; // eta->pi0->gamma-> e
646+ }
647+ }
640648 }
641649 }
642650 }
643- }
644- if (isEmbPi0 || isEmbEta) {
645- registry.fill (HIST (" hMcgenNonHfeElectron" ), particleMc.pt ());
646- isNonHfe = true ;
647- if (isEmbPi0) {
651+ if (isEmbPi0 || isEmbEta) {
652+ registry.fill (HIST (" hMcgenNonHfeElectron" ), particleMc.pt ());
653+ isNonHfe = true ;
654+ if (isEmbPi0) {
648655
649- registry.fill (HIST (" hPi0eEmbTrkPt" ), particleMc.pt ());
650- }
651- if (isEmbEta) {
652- registry.fill (HIST (" hEtaeEmbTrkPt" ), particleMc.pt ());
656+ registry.fill (HIST (" hPi0eEmbTrkPt" ), particleMc.pt ());
657+ }
658+ if (isEmbEta) {
659+ registry.fill (HIST (" hEtaeEmbTrkPt" ), particleMc.pt ());
660+ }
653661 }
654662 }
655663 }
656-
657664 hfGenElectronSel (mcCollision.globalIndex (), particleMc.globalIndex (), particleMc.eta (), particleMc.phi (), particleMc.pt (), isNonHfe);
658665 }
659666 }
660667 }
661-
662668 PROCESS_SWITCH (HfElectronSelectionWithTpcEmcal, processMcGen, " Process MC Gen mode" , false );
663669};
670+
664671WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
665672{
666673 return WorkflowSpec{adaptAnalysisTask<HfElectronSelectionWithTpcEmcal>(cfgc)};
0 commit comments