diff --git a/PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx index f40cf7d279a..32d269cc4de 100644 --- a/PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx @@ -138,8 +138,21 @@ struct HfCorrelatorHfeHadrons { registry.add("hMCgenInclusiveEHCorrl", "Sparse for Delta phi and Delta eta for McGen Electron pair with Hadron;p_{T}^{e} (GeV#it{/c});p_{T}^{h} (GeV#it{/c});#Delta#varphi;#Delta#eta;", {HistType::kTHnSparseF, {{axisPt}, {axisPt}, {axisDeltaPhi}, {axisDeltaEta}}}); registry.add("hptElectron", "hptElectron", {HistType::kTH1D, {axisPt}}); registry.add("hptHadron", "hptHadron", {HistType::kTH1D, {axisPt}}); + registry.add("hptHadronMcRec", "hptHadronMcRec", {HistType::kTH1D, {axisPt}}); + registry.add("hptHadronMcRecPrimary", "hptHadronMcRecPrimary", {HistType::kTH1D, {axisPt}}); + registry.add("hMCRecptEleHadron", "hMCRecptEleHadron", {HistType::kTH1D, {axisPt}}); + registry.add("hMCRecptMuonHadron", "hMCRecptMuonHadron", {HistType::kTH1D, {axisPt}}); + registry.add("hMCRecptPionHadron", "hMCRecptPionHadron", {HistType::kTH1D, {axisPt}}); + registry.add("hMCRecptKaonHadron", "hMCRecptKaonHadron", {HistType::kTH1D, {axisPt}}); + registry.add("hMCRecptProtonHadron", "hMCRecptProtonHadron", {HistType::kTH1D, {axisPt}}); + registry.add("hMCgenptHadron", "hMCgenptHadron", {HistType::kTH1D, {axisPt}}); registry.add("hMCgenptHadronprimary", "hMCgenptHadronprimary", {HistType::kTH1D, {axisPt}}); + registry.add("hMCgenptEleHadron", "hMCgenptEleHadron", {HistType::kTH1D, {axisPt}}); + registry.add("hMCgenptMuonHadron", "hMCgenptMuonHadron", {HistType::kTH1D, {axisPt}}); + registry.add("hMCgenptPionHadron", "hMCgenptPionHadron", {HistType::kTH1D, {axisPt}}); + registry.add("hMCgenptKaonHadron", "hMCgenptKaonHadron", {HistType::kTH1D, {axisPt}}); + registry.add("hMCgenptProtonHadron", "hMCgenptProtonHadron", {HistType::kTH1D, {axisPt}}); registry.add("hMixEventInclusiveEHCorrl", "Sparse for mix event Delta phi and Delta eta Inclusive Electron with Hadron;p_{T}^{e} (GeV#it{/c});p_{T}^{h} (GeV#it{/c});#Delta#varphi;#Delta#eta;", {HistType::kTHnSparseF, {{axisPt}, {axisPt}, {axisDeltaPhi}, {axisDeltaEta}}}); registry.add("hMixEventLSEHCorrel", "Sparse for mix event Delta phi and Delta eta Like sign Electron pair with Hadron;p_{T}^{e} (GeV#it{/c});p_{T}^{h} (GeV#it{/c});#Delta#varphi;#Delta#eta;", {HistType::kTHnSparseF, {{axisPt}, {axisPt}, {axisDeltaPhi}, {axisDeltaEta}}}); @@ -173,8 +186,8 @@ struct HfCorrelatorHfeHadrons { } // Electron-hadron Correlation - template - void fillCorrelation(CollisionType const& collision, ElectronType const& electrons, TracksType const& tracks, BcType const&) + template + void fillCorrelation(CollisionType const& collision, ElectronType const& electrons, TracksType const& tracks, BcType const&, McParticles const&) { if (!(isRun3 ? collision.sel8() : (collision.sel7() && collision.alias_bit(kINT7)))) { return; @@ -192,6 +205,7 @@ struct HfCorrelatorHfeHadrons { } registry.fill(HIST("hNevents"), 1); + // Add hadron Table For Mix Event Electron Hadron correlation if (!skipEventTableFilling) { registry.fill(HIST("hZvertex"), collision.posZ()); @@ -199,8 +213,42 @@ struct HfCorrelatorHfeHadrons { if (!selAssoHadron(hTrack)) { continue; } + + // Mc rec hadron efficiency + if constexpr (isMc) { + if (hTrack.has_mcParticle()) { + auto mcParticle = hTrack.template mcParticle_as(); + if ((std::abs(mcParticle.pdgCode()) != kElectron) && (std::abs(mcParticle.pdgCode()) != kMuonMinus) && (std::abs(mcParticle.pdgCode()) != kPiPlus) && (std::abs(mcParticle.pdgCode()) != kKPlus) && (std::abs(mcParticle.pdgCode()) != kProton)) { + continue; + } + + registry.fill(HIST("hptHadronMcRec"), hTrack.pt()); + if (mcParticle.isPhysicalPrimary()) { + + registry.fill(HIST("hptHadronMcRecPrimary"), hTrack.pt()); + + if (std::abs(mcParticle.pdgCode()) != kElectron) { + registry.fill(HIST("hMCRecptEleHadron"), hTrack.pt()); + } + if (std::abs(mcParticle.pdgCode()) != kMuonMinus) { + registry.fill(HIST("hMCRecptMuonHadron"), hTrack.pt()); + } + if (std::abs(mcParticle.pdgCode()) != kPiPlus) { + registry.fill(HIST("hMCRecptPionHadron"), hTrack.pt()); + } + if (std::abs(mcParticle.pdgCode()) != kKPlus) { + registry.fill(HIST("hMCRecptKaonHadron"), hTrack.pt()); + } + if (std::abs(mcParticle.pdgCode()) != kProton) { + registry.fill(HIST("hMCRecptProtonHadron"), hTrack.pt()); + } + } + } + } registry.fill(HIST("hTracksBin"), poolBin); + registry.fill(HIST("hptHadron"), hTrack.pt()); + entryHadron(hTrack.phi(), hTrack.eta(), hTrack.pt(), poolBin, gCollisionId, timeStamp); } } @@ -381,22 +429,22 @@ struct HfCorrelatorHfeHadrons { TableTracks const& tracks, aod::BCsWithTimestamps const& bcs) { - fillCorrelation(collision, electrons, tracks, bcs); + fillCorrelation(collision, electrons, tracks, bcs, 0); } - PROCESS_SWITCH(HfCorrelatorHfeHadrons, processData, "Process for Data", true); + PROCESS_SWITCH(HfCorrelatorHfeHadrons, processData, "Process for Data", false); // ======= Process starts for McRec, Same event ============ void processMcRec(McTableCollision const& mcCollision, aod::HfCorrSelEl const& mcElectrons, McTableTracks const& mcTracks, - aod::BCsWithTimestamps const& bcs) + aod::BCsWithTimestamps const& bcs, aod::McParticles const& mcParticle) { - fillCorrelation(mcCollision, mcElectrons, mcTracks, bcs); + fillCorrelation(mcCollision, mcElectrons, mcTracks, bcs, mcParticle); } - PROCESS_SWITCH(HfCorrelatorHfeHadrons, processMcRec, "Process MC Reco mode", false); + PROCESS_SWITCH(HfCorrelatorHfeHadrons, processMcRec, "Process MC Reco mode", true); void processMcGen(McGenTableCollision const& mcCollision, aod::McParticles const& mcParticles, aod::HfMcGenSelEl const& electrons) { @@ -411,11 +459,29 @@ struct HfCorrelatorHfeHadrons { if (particleMc.pt() < ptTrackMin) { continue; } - + if ((std::abs(particleMc.pdgCode()) != kElectron) && (std::abs(particleMc.pdgCode()) != kMuonMinus) && (std::abs(particleMc.pdgCode()) != kPiPlus) && (std::abs(particleMc.pdgCode()) != kKPlus) && (std::abs(particleMc.pdgCode()) != kProton)) { + continue; + } registry.fill(HIST("hMCgenptHadron"), particleMc.pt()); if (particleMc.isPhysicalPrimary()) { registry.fill(HIST("hMCgenptHadronprimary"), particleMc.pt()); + + if (std::abs(particleMc.pdgCode()) != kElectron) { + registry.fill(HIST("hMCgenptEleHadron"), particleMc.pt()); + } + if (std::abs(particleMc.pdgCode()) != kMuonMinus) { + registry.fill(HIST("hMCgenptMuonHadron"), particleMc.pt()); + } + if (std::abs(particleMc.pdgCode()) != kPiPlus) { + registry.fill(HIST("hMCgenptPionHadron"), particleMc.pt()); + } + if (std::abs(particleMc.pdgCode()) != kKPlus) { + registry.fill(HIST("hMCgenptKaonHadron"), particleMc.pt()); + } + if (std::abs(particleMc.pdgCode()) != kProton) { + registry.fill(HIST("hMCgenptProtonHadron"), particleMc.pt()); + } } } diff --git a/PWGHF/HFL/TableProducer/electronSelectionWithTpcEmcal.cxx b/PWGHF/HFL/TableProducer/electronSelectionWithTpcEmcal.cxx index 65896cb5a10..c2beed39aca 100644 --- a/PWGHF/HFL/TableProducer/electronSelectionWithTpcEmcal.cxx +++ b/PWGHF/HFL/TableProducer/electronSelectionWithTpcEmcal.cxx @@ -194,6 +194,9 @@ struct HfElectronSelectionWithTpcEmcal { registry.add("hLikeSignPt", "Like sign Momentum ", {HistType::kTH1D, {{axisPt}}}); registry.add("hUnLikeSignPt", "UnLike sign Momentum", {HistType::kTH1D, {{axisPt}}}); registry.add("hMcgenInElectron", "Mc Gen Inclusive Electron", {HistType::kTH1D, {{axisPt}}}); + registry.add("hMcRecInElectron", "Mc Rec Inclusive Electron", {HistType::kTH1D, {{axisPt}}}); + registry.add("hMcRecwithoutEMCalInElectron", "Mc Rec Inclusive Electron without Emcal", {HistType::kTH1D, {{axisPt}}}); + registry.add("hMcgenAllNonHfeElectron", "Mc Gen All NonHf Electron", {HistType::kTH1D, {{axisPt}}}); registry.add("hMcgenNonHfeElectron", "Mc Gen NonHf Electron with mother", {HistType::kTH1D, {{axisPt}}}); registry.add("hPi0eEmbTrkPt", "Mc Gen Pi0 mother NonHf Electron", {HistType::kTH1D, {{axisPt}}}); @@ -386,7 +389,7 @@ struct HfElectronSelectionWithTpcEmcal { } // Electron Identification template - void fillElectronTrack(CollisionType const& collision, TracksType const& tracks, EmcClusterType const& emcClusters, MatchType const& matchedTracks, ParticleType const& /*particlemc*/) + void fillElectronTrack(CollisionType const& collision, TracksType const& tracks, EmcClusterType const& emcClusters, MatchType const& matchedTracks, ParticleType const&) { if (!(isRun3 ? collision.sel8() : (collision.sel7() && collision.alias_bit(kINT7)))) { return; @@ -529,7 +532,103 @@ struct HfElectronSelectionWithTpcEmcal { } ///////////////// NonHf electron Selection with Emcal //////////////////////// + if constexpr (IsMc) { + if (matchTrack.has_mcParticle()) { + auto mcParticle = matchTrack.template mcParticle_as(); + if (std::abs(mcParticle.pdgCode()) == kElectron) { + + registry.fill(HIST("hMcRecInElectron"), mcParticle.pt()); + bool isEmbEta = false; + bool isEmbPi0 = false; + + // Check first mother + if (mcParticle.has_mothers()) { + auto const& mother = mcParticle.template mothers_first_as(); + + if (std::abs(mother.pdgCode()) == kEtaLocal || std::abs(mother.pdgCode()) == kPi0 || std::abs(mother.pdgCode()) == kGamma) { + + auto const& gmother = mother.template mothers_first_as(); + // cases to consider: eta->e, eta->pi0->e, eta->gamma->e, eta->pi0->gamma->e, pi0->e, pi0->gamma->e + + //================= eta->e ====================================== + if (std::abs(mother.pdgCode()) == kEtaLocal) { + + if (mother.isPhysicalPrimary()) { + if ((std::abs(gmother.pdgCode()) >= pdgCodeCharmMin && std::abs(gmother.pdgCode()) < pdgCodeCharmMax) || + (std::abs(gmother.pdgCode()) >= pdgCodeBeautyMin && std::abs(gmother.pdgCode()) < pdgCodeBeautyMax)) { + continue; + } + isEmbEta = true; + } + } + + //================= eta->pi0->e ====================================== + if (std::abs(mother.pdgCode()) == kPi0) { + if (mother.isPhysicalPrimary()) { + if ((std::abs(gmother.pdgCode()) >= pdgCodeCharmMin && std::abs(gmother.pdgCode()) < pdgCodeCharmMax) || + (std::abs(gmother.pdgCode()) >= pdgCodeBeautyMin && std::abs(gmother.pdgCode()) < pdgCodeBeautyMax)) { + continue; + } + isEmbPi0 = true; // pi0 -> e + } + if (std::abs(gmother.pdgCode()) == kEtaLocal) { + if (gmother.isPhysicalPrimary() || gmother.has_mothers()) { + auto const& ggmother = gmother.template mothers_first_as(); + if ((std::abs(ggmother.pdgCode()) >= pdgCodeCharmMin && std::abs(ggmother.pdgCode()) < pdgCodeCharmMax) || + (std::abs(ggmother.pdgCode()) >= pdgCodeBeautyMin && std::abs(ggmother.pdgCode()) < pdgCodeBeautyMax)) { + continue; + } + isEmbEta = true; // eta->pi0-> e + } + } + } + + /// ==================================== eta->gamma->e and eta->pi0->gamma->e============ + if (std::abs(mother.pdgCode()) == kGamma) { + + if (std::abs(gmother.pdgCode()) == kEtaLocal) { + if (gmother.isPhysicalPrimary() || gmother.has_mothers()) { + auto const& ggmother = gmother.template mothers_first_as(); + if ((std::abs(ggmother.pdgCode()) >= pdgCodeCharmMin && std::abs(ggmother.pdgCode()) < pdgCodeCharmMax) || + (std::abs(ggmother.pdgCode()) >= pdgCodeBeautyMin && std::abs(ggmother.pdgCode()) < pdgCodeBeautyMax)) { + continue; + } + isEmbEta = true; // eta->gamma-> e + } + } + if (std::abs(gmother.pdgCode()) == kPi0) { + if (gmother.isPhysicalPrimary() || gmother.has_mothers()) { + auto const& ggmother = gmother.template mothers_first_as(); + if ((std::abs(ggmother.pdgCode()) >= pdgCodeCharmMin && std::abs(ggmother.pdgCode()) < pdgCodeCharmMax) || + (std::abs(ggmother.pdgCode()) >= pdgCodeBeautyMin && std::abs(ggmother.pdgCode()) < pdgCodeBeautyMax)) { + continue; + } + isEmbPi0 = true; // pi0-> gamma-> e + } + if (gmother.has_mothers()) { + auto const& ggmother = gmother.template mothers_first_as(); + if (std::abs(ggmother.pdgCode()) == kEtaLocal) { + if (ggmother.isPhysicalPrimary() || ggmother.has_mothers()) { + auto const& gggmother = ggmother.template mothers_first_as(); + if ((std::abs(gggmother.pdgCode()) >= pdgCodeCharmMin && std::abs(gggmother.pdgCode()) < pdgCodeCharmMax) || + (std::abs(gggmother.pdgCode()) >= pdgCodeBeautyMin && std::abs(gggmother.pdgCode()) < pdgCodeBeautyMax)) { + continue; + } + isEmbEta = true; // eta->pi0->gamma-> e + } + } + } + } + } + if (!(isEmbPi0 && isEmbEta)) { + continue; + } + } + } + } + } + } nonHfe(matchTrack, tracks, true); ///////////////// NonHf electron Selection without Emcal //////////////////////// @@ -547,7 +646,103 @@ struct HfElectronSelectionWithTpcEmcal { if ((track.tpcNSigmaEl() < tpcNsigmaElectronMin || track.tpcNSigmaEl() > tpcNsigmaElectronMax)) continue; + if constexpr (IsMc) { + if (track.has_mcParticle()) { + auto mcParticle = track.template mcParticle_as(); + if (std::abs(mcParticle.pdgCode()) == kElectron) { + + registry.fill(HIST("hMcRecwithoutEMCalInElectron"), mcParticle.pt()); + bool isEmbEta = false; + bool isEmbPi0 = false; + + // Check first mother + if (mcParticle.has_mothers()) { + auto const& mother = mcParticle.template mothers_first_as(); + + if (std::abs(mother.pdgCode()) == kEtaLocal || std::abs(mother.pdgCode()) == kPi0 || std::abs(mother.pdgCode()) == kGamma) { + auto const& gmother = mother.template mothers_first_as(); + // cases to consider: eta->e, eta->pi0->e, eta->gamma->e, eta->pi0->gamma->e, pi0->e, pi0->gamma->e + + //================= eta->e ====================================== + if (std::abs(mother.pdgCode()) == kEtaLocal) { + + if (mother.isPhysicalPrimary()) { + if ((std::abs(gmother.pdgCode()) >= pdgCodeCharmMin && std::abs(gmother.pdgCode()) < pdgCodeCharmMax) || + (std::abs(gmother.pdgCode()) >= pdgCodeBeautyMin && std::abs(gmother.pdgCode()) < pdgCodeBeautyMax)) { + continue; + } + isEmbEta = true; + } + } + + //================= eta->pi0->e ====================================== + + if (std::abs(mother.pdgCode()) == kPi0) { + if (mother.isPhysicalPrimary()) { + if ((std::abs(gmother.pdgCode()) >= pdgCodeCharmMin && std::abs(gmother.pdgCode()) < pdgCodeCharmMax) || + (std::abs(gmother.pdgCode()) >= pdgCodeBeautyMin && std::abs(gmother.pdgCode()) < pdgCodeBeautyMax)) { + continue; + } + isEmbPi0 = true; // pi0 -> e + } + if (std::abs(gmother.pdgCode()) == kEtaLocal) { + if (gmother.isPhysicalPrimary() || gmother.has_mothers()) { + auto const& ggmother = gmother.template mothers_first_as(); + if ((std::abs(ggmother.pdgCode()) >= pdgCodeCharmMin && std::abs(ggmother.pdgCode()) < pdgCodeCharmMax) || + (std::abs(ggmother.pdgCode()) >= pdgCodeBeautyMin && std::abs(ggmother.pdgCode()) < pdgCodeBeautyMax)) { + continue; + } + isEmbEta = true; // eta->pi0-> e + } + } + } + + /// ==================================== eta->gamma->e and eta->pi0->gamma->e============ + if (std::abs(mother.pdgCode()) == kGamma) { + + if (std::abs(gmother.pdgCode()) == kEtaLocal) { + if (gmother.isPhysicalPrimary() || gmother.has_mothers()) { + auto const& ggmother = gmother.template mothers_first_as(); + if ((std::abs(ggmother.pdgCode()) >= pdgCodeCharmMin && std::abs(ggmother.pdgCode()) < pdgCodeCharmMax) || + (std::abs(ggmother.pdgCode()) >= pdgCodeBeautyMin && std::abs(ggmother.pdgCode()) < pdgCodeBeautyMax)) { + continue; + } + isEmbEta = true; // eta->gamma-> e + } + } + if (std::abs(gmother.pdgCode()) == kPi0) { + if (gmother.isPhysicalPrimary() || gmother.has_mothers()) { + auto const& ggmother = gmother.template mothers_first_as(); + if ((std::abs(ggmother.pdgCode()) >= pdgCodeCharmMin && std::abs(ggmother.pdgCode()) < pdgCodeCharmMax) || + (std::abs(ggmother.pdgCode()) >= pdgCodeBeautyMin && std::abs(ggmother.pdgCode()) < pdgCodeBeautyMax)) { + continue; + } + isEmbPi0 = true; // pi0-> gamma-> e + } + if (gmother.has_mothers()) { + auto const& ggmother = gmother.template mothers_first_as(); + if (std::abs(ggmother.pdgCode()) == kEtaLocal) { + if (ggmother.isPhysicalPrimary() || ggmother.has_mothers()) { + auto const& gggmother = ggmother.template mothers_first_as(); + if ((std::abs(gggmother.pdgCode()) >= pdgCodeCharmMin && std::abs(gggmother.pdgCode()) < pdgCodeCharmMax) || + (std::abs(gggmother.pdgCode()) >= pdgCodeBeautyMin && std::abs(gggmother.pdgCode()) < pdgCodeBeautyMax)) { + continue; + } + isEmbEta = true; // eta->pi0->gamma-> e + } + } + } + } + } + if (!(isEmbPi0 && isEmbEta)) { + continue; + } + } + } + } + } + } nonHfe(track, tracks, false); ///////////////// NonHf electron Selection without Emcal //////////////////////// electronSel(track.collisionId(), track.globalIndex(), etaTrack, phiTrack, ptTrack, pTrack, trackRapidity, dcaxyTrack, dcazTrack, track.tpcNSigmaEl(), track.tofNSigmaEl(),