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
63 changes: 62 additions & 1 deletion PWGEM/Dilepton/Tasks/checkMCPairTemplate.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ struct checkMCPairTemplate {
HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false};
static constexpr std::string_view event_cut_types[2] = {"before/", "after/"};
static constexpr std::string_view pair_sign_types[3] = {"uls/", "lspp/", "lsmm/"};
static constexpr std::string_view dilepton_source_types[22] = {
static constexpr std::string_view dilepton_source_types[23] = {
"sm/Photon/", // 0
"sm/PromptPi0/", // 1
"sm/NonPromptPi0/", // 2
Expand All @@ -332,6 +332,7 @@ struct checkMCPairTemplate {
"bbbar/b2c2l_b2l_diffb/", // 19
"bbbar/b2cc2l_b2c2l/", // 20
"bbbar/b2cc2l_b2cc2l/", // 21
"bbbar/b2cc2ll/", // 22
}; // unordered_map is better, but cannot be constexpr.
static constexpr std::string_view unfolding_dilepton_source_types[3] = {"sm/", "ccbar/", "bbbar/"};

Expand Down Expand Up @@ -568,6 +569,7 @@ struct checkMCPairTemplate {
fRegistry.addClone("Pair/ccbar/c2l_c2l/", "Pair/bbbar/b2c2l_b2l_diffb/"); // LS
fRegistry.addClone("Pair/ccbar/c2l_c2l/", "Pair/bbbar/b2cc2l_b2c2l/");
fRegistry.addClone("Pair/ccbar/c2l_c2l/", "Pair/bbbar/b2cc2l_b2cc2l/");
fRegistry.addClone("Pair/ccbar/c2l_c2l/", "Pair/bbbar/b2cc2ll/");

if (cfgFillSeparateCharmHadronPairs) {
for (int im = 0; im < nm_c; im++) {
Expand Down Expand Up @@ -641,6 +643,12 @@ struct checkMCPairTemplate {
fRegistry.addClone("Pair/ccbar/c2l_c2l/", "Pair/bbbar/b2cc2l_b2cc2l/Hc_ctau50_ctau130/");
fRegistry.addClone("Pair/ccbar/c2l_c2l/", "Pair/bbbar/b2cc2l_b2cc2l/Hc_ctau50_ctau300/");
fRegistry.addClone("Pair/ccbar/c2l_c2l/", "Pair/bbbar/b2cc2l_b2cc2l/Hc_ctau130_ctau300/");
fRegistry.addClone("Pair/ccbar/c2l_c2l/", "Pair/bbbar/b2cc2ll/Hc_ctau50/");
fRegistry.addClone("Pair/ccbar/c2l_c2l/", "Pair/bbbar/b2cc2ll/Hc_ctau130/");
fRegistry.addClone("Pair/ccbar/c2l_c2l/", "Pair/bbbar/b2cc2ll/Hc_ctau300/");
fRegistry.addClone("Pair/ccbar/c2l_c2l/", "Pair/bbbar/b2cc2ll/Hc_ctau50_ctau130/");
fRegistry.addClone("Pair/ccbar/c2l_c2l/", "Pair/bbbar/b2cc2ll/Hc_ctau50_ctau300/");
fRegistry.addClone("Pair/ccbar/c2l_c2l/", "Pair/bbbar/b2cc2ll/Hc_ctau130_ctau300/");
}

// for correlated bkg due to mis-identified hadrons, and true combinatorial bkg
Expand Down Expand Up @@ -1908,6 +1916,56 @@ struct checkMCPairTemplate {
fRegistry.fill(HIST("Pair/bbbar/b2cc2l_b2cc2l/Hc_ctau130_ctau300/lsmm/hs"), mass, pt, pair_dca, weight);
}
}
} else if (sourceId == 22) { // (Hb->Hc+Hc->l) (Hb->Hc+Hc->l) combinations categorized by Hc lifetime
if ((std::abs(pdgMotherC1) == kLambdaCPlus || std::abs(pdgMotherC1) == kXiC0) && (std::abs(pdgMotherC2) == kLambdaCPlus || std::abs(pdgMotherC2) == kXiC0)) {
if (sign1 * sign2 < 0) { // ULS
fRegistry.fill(HIST("Pair/bbbar/b2cc2ll/Hc_ctau50/uls/hs"), mass, pt, pair_dca, weight);
} else if (sign1 > 0 && sign2 > 0) { // LS++
fRegistry.fill(HIST("Pair/bbbar/b2cc2ll/Hc_ctau50/lspp/hs"), mass, pt, pair_dca, weight);
} else if (sign1 < 0 && sign2 < 0) { // LS--
fRegistry.fill(HIST("Pair/bbbar/b2cc2ll/Hc_ctau50/lsmm/hs"), mass, pt, pair_dca, weight);
}
} else if ((std::abs(pdgMotherC1) == kD0 || std::abs(pdgMotherC1) == kDS || std::abs(pdgMotherC1) == kXiCPlus) && (std::abs(pdgMotherC2) == kD0 || std::abs(pdgMotherC2) == kDS || std::abs(pdgMotherC2) == kXiCPlus)) {
if (sign1 * sign2 < 0) { // ULS
fRegistry.fill(HIST("Pair/bbbar/b2cc2ll/Hc_ctau130/uls/hs"), mass, pt, pair_dca, weight);
} else if (sign1 > 0 && sign2 > 0) { // LS++
fRegistry.fill(HIST("Pair/bbbar/b2cc2ll/Hc_ctau130/lspp/hs"), mass, pt, pair_dca, weight);
} else if (sign1 < 0 && sign2 < 0) { // LS--
fRegistry.fill(HIST("Pair/bbbar/b2cc2ll/Hc_ctau130/lsmm/hs"), mass, pt, pair_dca, weight);
}
} else if (std::abs(pdgMotherC1) == kDPlus && std::abs(pdgMotherC2) == kDPlus) {
if (sign1 * sign2 < 0) { // ULS
fRegistry.fill(HIST("Pair/bbbar/b2cc2ll/Hc_ctau300/uls/hs"), mass, pt, pair_dca, weight);
} else if (sign1 > 0 && sign2 > 0) { // LS++
fRegistry.fill(HIST("Pair/bbbar/b2cc2ll/Hc_ctau300/lspp/hs"), mass, pt, pair_dca, weight);
} else if (sign1 < 0 && sign2 < 0) { // LS--
fRegistry.fill(HIST("Pair/bbbar/b2cc2ll/Hc_ctau300/lsmm/hs"), mass, pt, pair_dca, weight);
}
} else if (((std::abs(pdgMotherC1) == kLambdaCPlus || std::abs(pdgMotherC1) == kXiC0) && (std::abs(pdgMotherC2) == kD0 || std::abs(pdgMotherC2) == kDS || std::abs(pdgMotherC2) == kXiCPlus)) || ((std::abs(pdgMotherC2) == kLambdaCPlus || std::abs(pdgMotherC2) == kXiC0) && (std::abs(pdgMotherC1) == kD0 || std::abs(pdgMotherC1) == kDS || std::abs(pdgMotherC1) == kXiCPlus))) {
if (sign1 * sign2 < 0) { // ULS
fRegistry.fill(HIST("Pair/bbbar/b2cc2ll/Hc_ctau50_ctau130/uls/hs"), mass, pt, pair_dca, weight);
} else if (sign1 > 0 && sign2 > 0) { // LS++
fRegistry.fill(HIST("Pair/bbbar/b2cc2ll/Hc_ctau50_ctau130/lspp/hs"), mass, pt, pair_dca, weight);
} else if (sign1 < 0 && sign2 < 0) { // LS--
fRegistry.fill(HIST("Pair/bbbar/b2cc2ll/Hc_ctau50_ctau130/lsmm/hs"), mass, pt, pair_dca, weight);
}
} else if (((std::abs(pdgMotherC1) == kLambdaCPlus || std::abs(pdgMotherC1) == kXiC0) && (std::abs(pdgMotherC2) == kDPlus)) || ((std::abs(pdgMotherC2) == kLambdaCPlus || std::abs(pdgMotherC2) == kXiC0) && (std::abs(pdgMotherC1) == kDPlus))) {
if (sign1 * sign2 < 0) { // ULS
fRegistry.fill(HIST("Pair/bbbar/b2cc2ll/Hc_ctau50_ctau300/uls/hs"), mass, pt, pair_dca, weight);
} else if (sign1 > 0 && sign2 > 0) { // LS++
fRegistry.fill(HIST("Pair/bbbar/b2cc2ll/Hc_ctau50_ctau300/lspp/hs"), mass, pt, pair_dca, weight);
} else if (sign1 < 0 && sign2 < 0) { // LS--
fRegistry.fill(HIST("Pair/bbbar/b2cc2ll/Hc_ctau50_ctau300/lsmm/hs"), mass, pt, pair_dca, weight);
}
} else if (((std::abs(pdgMotherC1) == kD0 || std::abs(pdgMotherC1) == kDS || std::abs(pdgMotherC1) == kXiCPlus) && (std::abs(pdgMotherC2) == kDPlus)) || ((std::abs(pdgMotherC2) == kD0 || std::abs(pdgMotherC2) == kDS || std::abs(pdgMotherC2) == kXiCPlus) && (std::abs(pdgMotherC1) == kDPlus))) {
if (sign1 * sign2 < 0) { // ULS
fRegistry.fill(HIST("Pair/bbbar/b2cc2ll/Hc_ctau130_ctau300/uls/hs"), mass, pt, pair_dca, weight);
} else if (sign1 > 0 && sign2 > 0) { // LS++
fRegistry.fill(HIST("Pair/bbbar/b2cc2ll/Hc_ctau130_ctau300/lspp/hs"), mass, pt, pair_dca, weight);
} else if (sign1 < 0 && sign2 < 0) { // LS--
fRegistry.fill(HIST("Pair/bbbar/b2cc2ll/Hc_ctau130_ctau300/lsmm/hs"), mass, pt, pair_dca, weight);
}
}
}
}
}
Expand Down Expand Up @@ -2266,6 +2324,9 @@ struct checkMCPairTemplate {
case static_cast<int>(EM_HFeeType::kBCCe_BCCe):
fillRecHistograms<21>(t1.sign(), t2.sign(), mp1.pdgCode(), mp2.pdgCode(), v12.M(), v12.Pt(), pair_dca, weight); // b2cc2l_b2cc2l
break;
case static_cast<int>(EM_HFeeType::kBCCee):
fillRecHistograms<22>(t1.sign(), t2.sign(), mp1.pdgCode(), mp2.pdgCode(), v12.M(), v12.Pt(), pair_dca, weight); // b2cc2ll
break;
default:
break;
}
Expand Down
30 changes: 19 additions & 11 deletions PWGEM/Dilepton/Utils/MCUtilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include <algorithm>
#include <string>
#include <utility>
#include <vector>

//_______________________________________________________________________
Expand All @@ -34,6 +35,7 @@ enum class EM_HFeeType : int {
kBCe_Be_DiffB = 4, // LS
kBCCe_BCe = 5, // ULS
kBCCe_BCCe = 6, // ULS
kBCCee = 7, // ULS
};

//_______________________________________________________________________
Expand Down Expand Up @@ -464,19 +466,18 @@ int IsFromCharm(TMCParticle const& p, TMCParticles const& mcparticles)
}
//_______________________________________________________________________
template <typename T, typename U>
int hasNCharmHadronsInBeautyDecay(T const& mcParticle, U const& mcParticles)
std::pair<int, int> getBeautyHadronIDandNCharmHadronDaughters(T const& mcParticle, U const& mcParticles)
{
// require that the direct mother is beauty hadron via semileptonice decay. e.g. hb->e, not hb->X->pi0->eegamma
if (!mcParticle.has_mothers()) {
return -999;
return {-999, -999};
}
if (!IsFromBeauty(mcParticle, mcParticles)) {
return -999;
return {-999, -999};
}

auto mp = mcParticles.iteratorAt(mcParticle.mothersIds()[0]);
if (!isCharmMeson(mp) && !isCharmBaryon(mp)) {
return -999;
return {-999, -999};
}

int motherid = mcParticle.mothersIds()[0]; // first mother index
Expand All @@ -496,21 +497,22 @@ int hasNCharmHadronsInBeautyDecay(T const& mcParticle, U const& mcParticles)
}
}
}
return count_charm_hadron;
return {motherid, count_charm_hadron};
} else {
LOGF(debug, "Something went wrong: Did not find any daughter for the current mother! Can't be a mother if there are no daughters\n");
}
return {-999, -999};
}
if (mp.has_mothers()) {
motherid = mp.mothersIds()[0];
} else {
return -999;
return {-999, -999};
}
} else {
LOGF(info, "Mother label(%d) exceeds the McParticles size(%d)", motherid, mcParticles.size());
}
}
return -999;
return {-999, -999};
}
//_______________________________________________________________________
template <typename TMCParticle>
Expand Down Expand Up @@ -717,12 +719,18 @@ int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcp
if constexpr (!doMoreDifferentially) {
return static_cast<int>(EM_HFeeType::kBCe_BCe); // default to b->c->e and b->c->e, decay type = 1
} else {
int n_c_from_b1 = hasNCharmHadronsInBeautyDecay(p1, mcparticles);
int n_c_from_b2 = hasNCharmHadronsInBeautyDecay(p2, mcparticles);
int beauty_motherid1 = getBeautyHadronIDandNCharmHadronDaughters(p1, mcparticles).first;
int beauty_motherid2 = getBeautyHadronIDandNCharmHadronDaughters(p2, mcparticles).first;
int n_c_from_b1 = getBeautyHadronIDandNCharmHadronDaughters(p1, mcparticles).second;
int n_c_from_b2 = getBeautyHadronIDandNCharmHadronDaughters(p2, mcparticles).second;
if (n_c_from_b1 == 1 && n_c_from_b2 == 1) {
return static_cast<int>(EM_HFeeType::kBCe_BCe); // b->c->e and b->c->e, decay type = 1
} else if (n_c_from_b1 == 2 && n_c_from_b2 == 2) {
return static_cast<int>(EM_HFeeType::kBCCe_BCCe); // b->cc->e and b->cc->e, decay type = 6
if (beauty_motherid1 == beauty_motherid2) { // same beauty hadron decays into 2 charm hadrons which then decay semileptonically
return static_cast<int>(EM_HFeeType::kBCCee); // b->cc->ee, decay type = 7
} else {
return static_cast<int>(EM_HFeeType::kBCCe_BCCe); // b->cc->e and b->cc->e, decay type = 6
}
} else if ((n_c_from_b1 == 1 && n_c_from_b2 == 2) || (n_c_from_b1 == 2 && n_c_from_b2 == 1)) {
return static_cast<int>(EM_HFeeType::kBCCe_BCe); // b->cc->e and b->c->e, decay type = 5
} else {
Expand Down
Loading