@@ -73,6 +73,8 @@ const float dEdxAxisMax = 160.;
7373struct HfElectronSelectionWithTpcEmcal {
7474
7575 Produces<aod::HfSelEl> electronSel;
76+ Produces<aod::HfCorrSelEl> HfElectronSelection;
77+ Produces<aod::HfGenSelEl> HfGenElectronSel;
7678 // Configurables
7779 // EMCal Cluster information
7880 KFParticle KFNonHfe;
@@ -171,6 +173,12 @@ struct HfElectronSelectionWithTpcEmcal {
171173 {" hZvertex" , " z vertex" , {HistType::kTH1F , {{100 , -100 , 100 }}}},
172174 {" hLikeMass" , " Like mass" , {HistType::kTH1F , {{1000 , 0 , 2.0 }}}},
173175 {" hUnLikeMass" , " unLike mass" , {HistType::kTH1F , {{1000 , 0 , 1.0 }}}},
176+ {" hMcgenInElectron" , " Mc Gen Inclusive Electron" , {HistType::kTH1F , {{pAxisBins, pAxisMin, pAxisMax}}}},
177+ {" hMcgenAllNonHfeElectron" , " Mc Gen All NonHf Electron" , {HistType::kTH1F , {{pAxisBins, pAxisMin, pAxisMax}}}},
178+ {" hMcgenNonHfeElectron" , " Mc Gen NonHf Electron with mother" , {HistType::kTH1F , {{pAxisBins, pAxisMin, pAxisMax}}}},
179+ {" hPi0eEmbTrkPt" , " Mc Gen Pi0 mother NonHf Electron" , {HistType::kTH1F , {{pAxisBins, pAxisMin, pAxisMax}}}},
180+
181+ {" hEtaeEmbTrkPt" , " Mc Gen Eta mother NonHf Electron" , {HistType::kTH1F , {{pAxisBins, pAxisMin, pAxisMax}}}},
174182 {" hEmcClusterM02" , " m02" , {HistType::kTH1F , {{m02AxisBins, m02AxisMin, m02AxisMax}}}},
175183 {" hEmcClusterM20" , " m20" , {HistType::kTH1F , {{m20AxisBins, m20AxisMin, m20AxisMax}}}},
176184 {" hTrackEtaPhi" , " TPC EtaPhi Info; #eta;#varphi;passEMcal;" , {HistType::kTH3F , {{etaAxisBins, trackEtaAxisMin, trackEtaAxisMax}, {phiAxisBins, trackPhiAxisMin, trackPhiAxisMax}, {passEMCalBins, passEMCalAxisMin, passEMCalAxisMax}}}},
@@ -248,6 +256,23 @@ struct HfElectronSelectionWithTpcEmcal {
248256
249257 return true ;
250258 }
259+
260+ // mc gen particle selection cut
261+ template <typename T>
262+ bool mcGensel (T const & track)
263+ {
264+ if (track.eta () < etaTrackMin || track.eta () > etaTrackMax) {
265+ return false ;
266+ }
267+ if ((track.phi () < phiTrackEMCalMin || track.phi () > phiTrackEMCalMax) && (track.phi () < phiTrackDCalMin || track.phi () > phiTrackDCalMax)) {
268+ return false ;
269+ }
270+ if (track.pt () < ptTrackMin) {
271+ return false ;
272+ }
273+ return true ;
274+ }
275+
251276 // Electron Identification
252277 template <bool isMc, typename TracksType, typename EmcClusterType, typename MatchType, typename CollisionType, typename ParticleType>
253278 void fillElectronTrack (CollisionType const & collision, TracksType const & tracks, EmcClusterType const & emcClusters, MatchType const & matchedTracks, ParticleType const & /* particlemc*/ )
@@ -423,12 +448,16 @@ struct HfElectronSelectionWithTpcEmcal {
423448 if (!selAssoTracks (pTrack)) {
424449 continue ;
425450 }
426- Int_t PDGe1 = kElectron ;
427- Int_t PDGe2 = kElectron ;
428- if (matchTrack.sign () > 0 )
451+ int PDGe1 = kElectron ;
452+ int PDGe2 = kElectron ;
453+ if (matchTrack.sign () > 0 ) {
429454 PDGe1 = kPositron ;
430- if (pTrack.sign () > 0 )
455+ }
456+
457+ if (pTrack.sign () > 0 ) {
431458 PDGe2 = kPositron ;
459+ }
460+
432461 KFPTrack kfpTrack = createKFPTrackFromTrack (matchTrack);
433462 KFPTrack kfpAssociatedTrack = createKFPTrackFromTrack (pTrack);
434463 KFParticle KFTrack (kfpTrack, PDGe1);
@@ -437,7 +466,7 @@ struct HfElectronSelectionWithTpcEmcal {
437466 KFNonHfe.SetConstructMethod (2 );
438467 KFNonHfe.Construct (LcDaughters, 2 );
439468
440- Int_t ndf = KFNonHfe.GetNDF ();
469+ int ndf = KFNonHfe.GetNDF ();
441470 Double_t chi2recg = KFNonHfe.GetChi2 () / ndf;
442471 if (ndf < 1.0 ) {
443472 continue ;
@@ -473,6 +502,8 @@ struct HfElectronSelectionWithTpcEmcal {
473502 isULSElectronFound = 1 ;
474503 }
475504 }
505+ HfElectronSelection (track.collisionId (), matchTrack.globalIndex (), etaMatchTrack, phiMatchTrack, ptMatchTrack, isLSElectronFound, isULSElectronFound);
506+
476507 electronSel (track.collisionId (), matchTrack.globalIndex (), etaMatchTrack, phiMatchTrack, ptMatchTrack, pMatchTrack, trackRapidity, matchTrack.dcaXY (), matchTrack.dcaZ (), matchTrack.tpcNSigmaEl (), matchTrack.tofNSigmaEl (),
477508 eMatchEmcCluster, etaMatchEmcCluster, phiMatchEmcCluster, m02MatchEmcCluster, m20MatchEmcCluster, cellEmcCluster, timeEmcCluster, deltaEtaMatch, deltaPhiMatch, isEMcal, isLSElectronFound, isULSElectronFound);
478509 }
@@ -481,6 +512,7 @@ struct HfElectronSelectionWithTpcEmcal {
481512 if (isEMcal) {
482513 continue ;
483514 }
515+
484516 electronSel (track.collisionId (), track.globalIndex (), etaTrack, phiTrack, ptTrack, pTrack, trackRapidity, dcaxyTrack, dcazTrack, track.tpcNSigmaEl (), track.tofNSigmaEl (),
485517 eMatchEmcCluster, etaMatchEmcCluster, phiMatchEmcCluster, m02MatchEmcCluster, m20MatchEmcCluster, cellEmcCluster, timeEmcCluster, deltaEtaMatch, deltaPhiMatch, isEMcal, isLSElectronFound, isULSElectronFound);
486518 }
@@ -494,7 +526,7 @@ struct HfElectronSelectionWithTpcEmcal {
494526 {
495527 fillElectronTrack<false >(collision, tracks, emcClusters, matchedTracks, 0 );
496528 }
497- PROCESS_SWITCH (HfElectronSelectionWithTpcEmcal, processData, " process Data info only" , true );
529+ PROCESS_SWITCH (HfElectronSelectionWithTpcEmcal, processData, " process Data info only" , false );
498530
499531 // / Electron selection - for MC reco-level analysis
500532 void processMcRec (McTableCollision const & mcCollision,
@@ -505,7 +537,93 @@ struct HfElectronSelectionWithTpcEmcal {
505537 {
506538 fillElectronTrack<true >(mcCollision, mcTracks, mcEmcClusters, matchedTracks, mcParticles);
507539 }
508- PROCESS_SWITCH (HfElectronSelectionWithTpcEmcal, processMcRec, " Process MC Reco mode" , false );
540+ PROCESS_SWITCH (HfElectronSelectionWithTpcEmcal, processMcRec, " Process MC Reco mode" , true );
541+
542+ void processMcGen (aod::McParticles const & mcCollision, aod::McParticles const & mcParticles)
543+ {
544+
545+ // /// electron identification
546+ double ptMcGen = -999 ;
547+ double etaMcGen = -999 ;
548+ double phiMcGen = -999 ;
549+ double pMcGen = -999 ;
550+ bool isNonHfe = false ;
551+ for (const auto & particleMc : mcParticles) {
552+ ptMcGen = particleMc.pt ();
553+ etaMcGen = particleMc.eta ();
554+ phiMcGen = particleMc.phi ();
555+ pMcGen = particleMc.p ();
556+ if (!particleMc.isPhysicalPrimary ())
557+ continue ;
558+ if (!mcGensel (particleMc)) {
559+ continue ;
560+ }
561+ if (abs (particleMc.pdgCode ()) == 11 ) {
562+
563+ registry.fill (HIST (" hMcgenInElectron" ), ptMcGen, phiMcGen, etaMcGen);
564+ bool isEmbEta = false ;
565+ bool isEmbPi0 = false ;
566+
567+ if (particleMc.has_mothers ()) {
568+
569+ // Check first mother
570+ auto const & mother = particleMc.mothers_first_as <aod::McParticles>();
571+ auto const & gmother = mother.mothers_first_as <aod::McParticles>();
572+ auto const & ggmother = gmother.mothers_first_as <aod::McParticles>();
573+
574+ if (abs (mother.pdgCode ()) == 221 || abs (mother.pdgCode ()) == 111 || abs (mother.pdgCode ()) == 22 ) {
575+ registry.fill (HIST (" hMcgenAllNonHfeElectron" ), particleMc.pt ());
576+
577+ // cases to consider: eta->e, eta->pi0->e, eta->gamma->e, eta->pi0->gamma->e, pi0->e, pi0->gamma->e
578+
579+ // ================= eta->e ======================================
580+ if (abs (mother.pdgCode ()) == 221 ) {
581+ isEmbEta = true ;
582+ }
583+ // ================= eta->pi0->e ======================================
584+
585+ if (abs (mother.pdgCode ()) == 111 ) {
586+ isEmbPi0 = kTRUE ; // pi0 -> e
587+
588+ if (abs (gmother.pdgCode ()) == 221 ) {
589+ isEmbEta = kTRUE ; // eta->pi0-> e
590+ }
591+ }
592+
593+ // / ==================================== eta->gamma->e and eta->pi0->gamma->e============
594+ if (abs (mother.pdgCode ()) == 22 ) {
595+ if (abs (gmother.pdgCode ()) == 221 ) {
596+ isEmbEta = kTRUE ; // eta->gamma-> e
597+ }
598+
599+ if (abs (gmother.pdgCode ()) == 111 ) {
600+ isEmbPi0 = kTRUE ; // pi0-> gamma-> e
601+
602+ if (abs (ggmother.pdgCode ()) == 221 ) {
603+
604+ isEmbEta = kTRUE ; // eta->pi0->gamma-> e
605+ }
606+ }
607+ }
608+ }
609+ }
610+ if (isEmbPi0 || isEmbEta) {
611+ registry.fill (HIST (" hMcgenNonHfeElectron" ), particleMc.pt ());
612+ isNonHfe = true ;
613+ if (isEmbPi0) {
614+
615+ registry.fill (HIST (" hPi0eEmbTrkPt" ), particleMc.pt ());
616+ }
617+ if (isEmbEta) {
618+ registry.fill (HIST (" hEtaeEmbTrkPt" ), particleMc.pt ());
619+ }
620+
621+ HfGenElectronSel (particleMc.index (), particleMc.eta (), particleMc.phi (), particleMc.pt (), isNonHfe);
622+ }
623+ }
624+ }
625+ }
626+ PROCESS_SWITCH (HfElectronSelectionWithTpcEmcal, processMcGen, " Process MC Gen mode" , false );
509627};
510628
511629WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
0 commit comments