From 6d4f7dbbfe2decd7096c34826c882c73593af959 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Wed, 22 Oct 2025 13:37:53 +0200 Subject: [PATCH 1/2] PWGEM/Dilepton: remove sign check of HFll in MC --- PWGEM/Dilepton/Core/DileptonMC.h | 38 +++++------- PWGEM/Dilepton/Utils/MCUtilities.h | 92 +++++++++++++++--------------- 2 files changed, 58 insertions(+), 72 deletions(-) diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index bbbdaaca444..fa1816c143c 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -1639,7 +1639,7 @@ struct DileptonMC { } } break; - case 443: { + case 443: if (IsFromBeauty(mcmother, mcparticles) > 0) { fillRecHistograms<9>(t1.sign(), t2.sign(), 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // non-prompt J/psi if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { @@ -1670,15 +1670,13 @@ struct DileptonMC { } } break; - } - case 100443: { + case 100443: if (IsFromBeauty(mcmother, mcparticles) > 0) { fillRecHistograms<11>(t1.sign(), t2.sign(), 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // non-prompt psi2S } else { fillRecHistograms<10>(t1.sign(), t2.sign(), 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // prompt psi2S } break; - } default: break; } @@ -1702,23 +1700,19 @@ struct DileptonMC { auto mp1 = mcparticles.iteratorAt(t1mc.mothersIds()[0]); auto mp2 = mcparticles.iteratorAt(t2mc.mothersIds()[0]); switch (hfee_type) { - case static_cast(EM_HFeeType::kCe_Ce): { // ULS + case static_cast(EM_HFeeType::kCe_Ce): fillRecHistograms<15>(t1.sign(), t2.sign(), mp1.pdgCode(), mp2.pdgCode(), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // c2l_c2l break; - } - case static_cast(EM_HFeeType::kBe_Be): { // ULS + case static_cast(EM_HFeeType::kBe_Be): fillRecHistograms<16>(t1.sign(), t2.sign(), 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // b2l_b2l break; - } - case static_cast(EM_HFeeType::kBCe_BCe): { // ULS + case static_cast(EM_HFeeType::kBCe_BCe): fillRecHistograms<17>(t1.sign(), t2.sign(), 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // b2c2l_b2c2l break; - } - case static_cast(EM_HFeeType::kBCe_Be_SameB): { // ULS + case static_cast(EM_HFeeType::kBCe_Be_SameB): fillRecHistograms<18>(t1.sign(), t2.sign(), 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // b2c2l_b2l_sameb break; - } - case static_cast(EM_HFeeType::kBCe_Be_DiffB): // LS + case static_cast(EM_HFeeType::kBCe_Be_DiffB): fillRecHistograms<19>(t1.sign(), t2.sign(), 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // b2c2l_b2l_diffb break; default: @@ -1869,22 +1863,20 @@ struct DileptonMC { fRegistry.fill(HIST("Generated/sm/Phi2ll/uls/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); // phi->ee } break; - case 443: { + case 443: if (IsFromBeauty(mcmother, mcparticles) > 0) { fillGenHistograms<9>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // non-prompt J/psi } else { fillGenHistograms<8>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // prompt J/psi } break; - } - case 100443: { + case 100443: if (IsFromBeauty(mcmother, mcparticles) > 0) { fillGenHistograms<11>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // non-prompt psi2S } else { fillGenHistograms<10>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // prompt psi2S } break; - } default: break; } @@ -1893,22 +1885,18 @@ struct DileptonMC { auto mp1 = mcparticles.iteratorAt(t1.mothersIds()[0]); auto mp2 = mcparticles.iteratorAt(t2.mothersIds()[0]); switch (hfee_type) { - case static_cast(EM_HFeeType::kCe_Ce): { + case static_cast(EM_HFeeType::kCe_Ce): fillGenHistograms<15>(sign1, sign2, mp1.pdgCode(), mp2.pdgCode(), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // c2l_c2l break; - } - case static_cast(EM_HFeeType::kBe_Be): { + case static_cast(EM_HFeeType::kBe_Be): fillGenHistograms<16>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // b2l_b2l break; - } - case static_cast(EM_HFeeType::kBCe_BCe): { + case static_cast(EM_HFeeType::kBCe_BCe): fillGenHistograms<17>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // b2c2l_b2c2l break; - } - case static_cast(EM_HFeeType::kBCe_Be_SameB): { // ULS + case static_cast(EM_HFeeType::kBCe_Be_SameB): fillGenHistograms<18>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // b2c2l_b2l_sameb break; - } case static_cast(EM_HFeeType::kBCe_Be_DiffB): // LS fillGenHistograms<19>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // b2c2l_b2l_diffb break; diff --git a/PWGEM/Dilepton/Utils/MCUtilities.h b/PWGEM/Dilepton/Utils/MCUtilities.h index 27ee530e4f1..ca4c095a628 100644 --- a/PWGEM/Dilepton/Utils/MCUtilities.h +++ b/PWGEM/Dilepton/Utils/MCUtilities.h @@ -355,7 +355,7 @@ int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcp bool is_c_from_b1 = IsFromBeauty(p1, mcparticles) > 0 && IsFromCharm(p1, mcparticles) > 0; bool is_c_from_b2 = IsFromBeauty(p2, mcparticles) > 0 && IsFromCharm(p2, mcparticles) > 0; - if (is_direct_from_b1 && is_direct_from_b2 && p1.pdgCode() * p2.pdgCode() < 0) { + if (is_direct_from_b1 && is_direct_from_b2) { mothers_id1.clear(); mothers_pdg1.clear(); mothers_id2.clear(); @@ -366,7 +366,7 @@ int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcp mothers_pdg2.shrink_to_fit(); return static_cast(EM_HFeeType::kBe_Be); // bb->ee, decay type = 2 } - if (is_prompt_c1 && is_prompt_c2 && p1.pdgCode() * p2.pdgCode() < 0) { + if (is_prompt_c1 && is_prompt_c2) { mothers_id1.clear(); mothers_pdg1.clear(); mothers_id2.clear(); @@ -377,7 +377,7 @@ int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcp mothers_pdg2.shrink_to_fit(); return static_cast(EM_HFeeType::kCe_Ce); // cc->ee, decay type = 0 } - if (is_c_from_b1 && is_c_from_b2 && p1.pdgCode() * p2.pdgCode() < 0) { + if (is_c_from_b1 && is_c_from_b2) { mothers_id1.clear(); mothers_pdg1.clear(); mothers_id2.clear(); @@ -389,52 +389,50 @@ int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcp return static_cast(EM_HFeeType::kBCe_BCe); // b->c->e and b->c->e, decay type = 1 } if ((is_direct_from_b1 && is_c_from_b2) || (is_direct_from_b2 && is_c_from_b1)) { - if (p1.pdgCode() * p2.pdgCode() < 0) { // ULS - for (auto& mid1 : mothers_id1) { - for (auto& mid2 : mothers_id2) { - if (mid1 == mid2) { - auto common_mp = mcparticles.iteratorAt(mid1); - int mp_pdg = common_mp.pdgCode(); - bool is_mp_diquark = (1100 < std::abs(mp_pdg) && std::abs(mp_pdg) < 5600) && std::to_string(mp_pdg)[std::to_string(mp_pdg).length() - 2] == '0'; - if (!is_mp_diquark && std::abs(mp_pdg) < 1e+9 && (std::to_string(std::abs(mp_pdg))[std::to_string(std::abs(mp_pdg)).length() - 3] == '5' || std::to_string(std::abs(mp_pdg))[std::to_string(std::abs(mp_pdg)).length() - 4] == '5')) { - mothers_id1.clear(); - mothers_pdg1.clear(); - mothers_id2.clear(); - mothers_pdg2.clear(); - mothers_id1.shrink_to_fit(); - mothers_pdg1.shrink_to_fit(); - mothers_id2.shrink_to_fit(); - mothers_pdg2.shrink_to_fit(); - return static_cast(EM_HFeeType::kBCe_Be_SameB); // b->c->e and b->e, decay type = 3. this should happen only in ULS. - } + for (const auto& mid1 : mothers_id1) { + for (const auto& mid2 : mothers_id2) { + if (mid1 == mid2) { + auto common_mp = mcparticles.iteratorAt(mid1); + int mp_pdg = common_mp.pdgCode(); + bool is_mp_diquark = (1100 < std::abs(mp_pdg) && std::abs(mp_pdg) < 5600) && std::to_string(mp_pdg)[std::to_string(mp_pdg).length() - 2] == '0'; + if (!is_mp_diquark && std::abs(mp_pdg) < 1e+9 && (std::to_string(std::abs(mp_pdg))[std::to_string(std::abs(mp_pdg)).length() - 3] == '5' || std::to_string(std::abs(mp_pdg))[std::to_string(std::abs(mp_pdg)).length() - 4] == '5')) { + mothers_id1.clear(); + mothers_pdg1.clear(); + mothers_id2.clear(); + mothers_pdg2.clear(); + mothers_id1.shrink_to_fit(); + mothers_pdg1.shrink_to_fit(); + mothers_id2.shrink_to_fit(); + mothers_pdg2.shrink_to_fit(); + return static_cast(EM_HFeeType::kBCe_Be_SameB); // b->c->e and b->e, decay type = 3. this should happen only in ULS. } - } // end of motherid2 - } // end of motherid1 - } else { // LS - bool is_same_mother_found = false; - for (auto& mid1 : mothers_id1) { - for (auto& mid2 : mothers_id2) { - if (mid1 == mid2) { - auto common_mp = mcparticles.iteratorAt(mid1); - int mp_pdg = common_mp.pdgCode(); - bool is_mp_diquark = (1100 < std::abs(mp_pdg) && std::abs(mp_pdg) < 5600) && std::to_string(mp_pdg)[std::to_string(mp_pdg).length() - 2] == '0'; - if (!is_mp_diquark && std::abs(mp_pdg) < 1e+9 && (std::to_string(std::abs(mp_pdg))[std::to_string(std::abs(mp_pdg)).length() - 3] == '5' || std::to_string(std::abs(mp_pdg))[std::to_string(std::abs(mp_pdg)).length() - 4] == '5')) { - is_same_mother_found = true; - } + } + } // end of motherid2 + } // end of motherid1 + + bool is_same_mother_found = false; + for (const auto& mid1 : mothers_id1) { + for (const auto& mid2 : mothers_id2) { + if (mid1 == mid2) { + auto common_mp = mcparticles.iteratorAt(mid1); + int mp_pdg = common_mp.pdgCode(); + bool is_mp_diquark = (1100 < std::abs(mp_pdg) && std::abs(mp_pdg) < 5600) && std::to_string(mp_pdg)[std::to_string(mp_pdg).length() - 2] == '0'; + if (!is_mp_diquark && std::abs(mp_pdg) < 1e+9 && (std::to_string(std::abs(mp_pdg))[std::to_string(std::abs(mp_pdg)).length() - 3] == '5' || std::to_string(std::abs(mp_pdg))[std::to_string(std::abs(mp_pdg)).length() - 4] == '5')) { + is_same_mother_found = true; } - } // end of motherid2 - } // end of motherid1 - if (!is_same_mother_found) { - mothers_id1.clear(); - mothers_pdg1.clear(); - mothers_id2.clear(); - mothers_pdg2.clear(); - mothers_id1.shrink_to_fit(); - mothers_pdg1.shrink_to_fit(); - mothers_id2.shrink_to_fit(); - mothers_pdg2.shrink_to_fit(); - return static_cast(EM_HFeeType::kBCe_Be_DiffB); // b->c->e and b->e, decay type = 4. this should happen only in LS. But, this may happen, when ele/pos is reconstructed as pos/ele wrongly. and create LS pair - } + } + } // end of motherid2 + } // end of motherid1 + if (!is_same_mother_found) { + mothers_id1.clear(); + mothers_pdg1.clear(); + mothers_id2.clear(); + mothers_pdg2.clear(); + mothers_id1.shrink_to_fit(); + mothers_pdg1.shrink_to_fit(); + mothers_id2.shrink_to_fit(); + mothers_pdg2.shrink_to_fit(); + return static_cast(EM_HFeeType::kBCe_Be_DiffB); // b->c->e and b->e, decay type = 4. this should happen only in LS. But, this may happen, when ele/pos is reconstructed as pos/ele wrongly. and create LS pair } } From 9d719af3d19ce2ae4ad179ac61bb46306ae20797 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Wed, 22 Oct 2025 11:39:07 +0000 Subject: [PATCH 2/2] Please consider the following formatting changes --- PWGEM/Dilepton/Core/DileptonMC.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index fa1816c143c..5e27d02e4ba 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -1639,7 +1639,7 @@ struct DileptonMC { } } break; - case 443: + case 443: if (IsFromBeauty(mcmother, mcparticles) > 0) { fillRecHistograms<9>(t1.sign(), t2.sign(), 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // non-prompt J/psi if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) {