Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 13 additions & 25 deletions PWGEM/Dilepton/Core/DileptonMC.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@
#include <utility>
#include <vector>

using namespace o2;

Check failure on line 58 in PWGEM/Dilepton/Core/DileptonMC.h

View workflow job for this annotation

GitHub Actions / O2 linter

[using-directive]

Do not put using directives at global scope in headers.
using namespace o2::aod;

Check failure on line 59 in PWGEM/Dilepton/Core/DileptonMC.h

View workflow job for this annotation

GitHub Actions / O2 linter

[using-directive]

Do not put using directives at global scope in headers.
using namespace o2::framework;

Check failure on line 60 in PWGEM/Dilepton/Core/DileptonMC.h

View workflow job for this annotation

GitHub Actions / O2 linter

[using-directive]

Do not put using directives at global scope in headers.
using namespace o2::framework::expressions;

Check failure on line 61 in PWGEM/Dilepton/Core/DileptonMC.h

View workflow job for this annotation

GitHub Actions / O2 linter

[using-directive]

Do not put using directives at global scope in headers.
using namespace o2::soa;

Check failure on line 62 in PWGEM/Dilepton/Core/DileptonMC.h

View workflow job for this annotation

GitHub Actions / O2 linter

[using-directive]

Do not put using directives at global scope in headers.
using namespace o2::aod::pwgem::dilepton::utils::mcutil;

Check failure on line 63 in PWGEM/Dilepton/Core/DileptonMC.h

View workflow job for this annotation

GitHub Actions / O2 linter

[using-directive]

Do not put using directives at global scope in headers.
using namespace o2::aod::pwgem::dilepton::utils::emtrackutil;

Check failure on line 64 in PWGEM/Dilepton/Core/DileptonMC.h

View workflow job for this annotation

GitHub Actions / O2 linter

[using-directive]

Do not put using directives at global scope in headers.
using namespace o2::aod::pwgem::dilepton::utils::pairutil;

Check failure on line 65 in PWGEM/Dilepton/Core/DileptonMC.h

View workflow job for this annotation

GitHub Actions / O2 linter

[using-directive]

Do not put using directives at global scope in headers.

using MyCollisions = soa::Join<aod::EMEvents, aod::EMEventsMult, aod::EMEventsCent, aod::EMMCEventLabels>;
using MyCollision = MyCollisions::iterator;
Expand Down Expand Up @@ -590,12 +590,12 @@
DefineDielectronCut();
leptonM1 = o2::constants::physics::MassElectron;
leptonM2 = o2::constants::physics::MassElectron;
pdg_lepton = 11;

Check failure on line 593 in PWGEM/Dilepton/Core/DileptonMC.h

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
} else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) {
DefineDimuonCut();
leptonM1 = o2::constants::physics::MassMuon;
leptonM2 = o2::constants::physics::MassMuon;
pdg_lepton = 13;

Check failure on line 598 in PWGEM/Dilepton/Core/DileptonMC.h

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
}
if (doprocessNorm) {
fRegistry.addClone("Event/before/hCollisionCounter", "Event/norm/hCollisionCounter");
Expand Down Expand Up @@ -1639,7 +1639,7 @@
}
}
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) {
Expand Down Expand Up @@ -1670,15 +1670,13 @@
}
}
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;
}
Expand All @@ -1702,23 +1700,19 @@
auto mp1 = mcparticles.iteratorAt(t1mc.mothersIds()[0]);
auto mp2 = mcparticles.iteratorAt(t2mc.mothersIds()[0]);
switch (hfee_type) {
case static_cast<int>(EM_HFeeType::kCe_Ce): { // ULS
case static_cast<int>(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<int>(EM_HFeeType::kBe_Be): { // ULS
case static_cast<int>(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<int>(EM_HFeeType::kBCe_BCe): { // ULS
case static_cast<int>(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<int>(EM_HFeeType::kBCe_Be_SameB): { // ULS
case static_cast<int>(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<int>(EM_HFeeType::kBCe_Be_DiffB): // LS
case static_cast<int>(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:
Expand Down Expand Up @@ -1869,22 +1863,20 @@
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;
}
Expand All @@ -1893,22 +1885,18 @@
auto mp1 = mcparticles.iteratorAt(t1.mothersIds()[0]);
auto mp2 = mcparticles.iteratorAt(t2.mothersIds()[0]);
switch (hfee_type) {
case static_cast<int>(EM_HFeeType::kCe_Ce): {
case static_cast<int>(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<int>(EM_HFeeType::kBe_Be): {
case static_cast<int>(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<int>(EM_HFeeType::kBCe_BCe): {
case static_cast<int>(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<int>(EM_HFeeType::kBCe_Be_SameB): { // ULS
case static_cast<int>(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<int>(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;
Expand Down
92 changes: 45 additions & 47 deletions PWGEM/Dilepton/Utils/MCUtilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -366,7 +366,7 @@ int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcp
mothers_pdg2.shrink_to_fit();
return static_cast<int>(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();
Expand All @@ -377,7 +377,7 @@ int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcp
mothers_pdg2.shrink_to_fit();
return static_cast<int>(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();
Expand All @@ -389,52 +389,50 @@ int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcp
return static_cast<int>(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<int>(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<int>(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<int>(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<int>(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
}
}

Expand Down
Loading