Skip to content

Commit

Permalink
[PWGDQ] add option to exclude MC signal which share common ancestor (#…
Browse files Browse the repository at this point in the history
…7505)

* [PWGEM]: efficiency task, add hisots for SubGenID, adjust runRecTrackMore

* [PWGEM]: adding histograms and cuts to check subGenerators

* [PWGDQ] add option to exclude MC signal which share common ancestor
  • Loading branch information
feisenhu authored Aug 30, 2024
1 parent 48f5770 commit a3dd25f
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 17 deletions.
6 changes: 5 additions & 1 deletion PWGDQ/Core/MCProng.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,11 @@ void MCProng::Print() const
for (int i = 0; i < fNGenerations; i++) {
std::cout << "Generation #" << i << " PDGcode(" << fPDGcodes[i] << ") CheckBothCharges(" << fCheckBothCharges[i]
<< ") ExcludePDG(" << fExcludePDG[i] << ") SourceBits(" << fSourceBits[i] << ") ExcludeSource(" << fExcludeSource[i]
<< ") UseANDonSource(" << fUseANDonSourceBitMap[i] << ") CheckGenerationsInTime(" << fCheckGenerationsInTime << ") PDGInHistory(" << fPDGInHistory[i] << ") ExcludePDGInHistory(" << fExcludePDGInHistory[i] << ")" << std::endl;
<< ") UseANDonSource(" << fUseANDonSourceBitMap[i] << ") CheckGenerationsInTime(" << fCheckGenerationsInTime << ")";
for (int j = 0; j < fPDGInHistory.size(); j++) {
std::cout << " #" << j << " PDGInHistory(" << fPDGInHistory[j] << ") ExcludePDGInHistory(" << fExcludePDGInHistory[j] << ")";
}
std::cout << std::endl;
}
}

Expand Down
16 changes: 10 additions & 6 deletions PWGDQ/Core/MCSignal.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ MCSignal::MCSignal() : TNamed("", ""),
fProngs({}),
fNProngs(0),
fCommonAncestorIdxs({}),
fExcludeCommonAncestor(false),
fTempAncestorLabel(-1)
{
}
Expand All @@ -30,17 +31,19 @@ MCSignal::MCSignal(int nProngs, const char* name /*= ""*/, const char* title /*=
fProngs({}),
fNProngs(nProngs),
fCommonAncestorIdxs({}),
fExcludeCommonAncestor(false),
fTempAncestorLabel(-1)
{
fProngs.reserve(nProngs);
}

//________________________________________________________________________________________________
MCSignal::MCSignal(const char* name, const char* title, std::vector<MCProng> prongs, std::vector<short> commonAncestors) : TNamed(name, title),
fProngs(prongs),
fNProngs(prongs.size()),
fCommonAncestorIdxs(commonAncestors),
fTempAncestorLabel(-1)
MCSignal::MCSignal(const char* name, const char* title, std::vector<MCProng> prongs, std::vector<short> commonAncestors, bool excludeCommonAncestor) : TNamed(name, title),
fProngs(prongs),
fNProngs(prongs.size()),
fCommonAncestorIdxs(commonAncestors),
fExcludeCommonAncestor(excludeCommonAncestor),
fTempAncestorLabel(-1)
{
}

Expand All @@ -67,10 +70,11 @@ void MCSignal::AddProng(MCProng prong, short commonAncestor)
void MCSignal::PrintConfig()
{
cout << "Name/Title: " << fName << " / " << fTitle << endl;
cout << "Exclude common ancestor combinations: " << fExcludeCommonAncestor << endl;
cout << "Printing " << fNProngs << "/" << fProngs.size() << " prongs:" << endl;
int i = 0;
for (auto& pr : fProngs) {
cout << "Prong #" << i << " commonAncestor" << fCommonAncestorIdxs[i] << " ================ " << endl;
cout << "Prong #" << i << " commonAncestor: " << fCommonAncestorIdxs[i] << " ================ " << endl;
i++;
pr.Print();
}
Expand Down
10 changes: 6 additions & 4 deletions PWGDQ/Core/MCSignal.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class MCSignal : public TNamed
public:
MCSignal();
MCSignal(int nProngs, const char* name = "", const char* title = "");
MCSignal(const char* name, const char* title, std::vector<MCProng> prongs, std::vector<short> commonAncestors);
MCSignal(const char* name, const char* title, std::vector<MCProng> prongs, std::vector<short> commonAncestors, bool excludeCommonAncestor = false);
MCSignal(const MCSignal& c) = default;
~MCSignal() override = default;

Expand Down Expand Up @@ -100,6 +100,7 @@ class MCSignal : public TNamed
std::vector<MCProng> fProngs;
unsigned int fNProngs;
std::vector<short> fCommonAncestorIdxs;
bool fExcludeCommonAncestor;
int fTempAncestorLabel;

template <typename T>
Expand Down Expand Up @@ -139,14 +140,15 @@ bool MCSignal::CheckProng(int i, bool checkSources, const T& track)
if (i == 0) {
fTempAncestorLabel = currentMCParticle.globalIndex();
} else {
if (currentMCParticle.globalIndex() != fTempAncestorLabel) {
if (currentMCParticle.globalIndex() != fTempAncestorLabel && !fExcludeCommonAncestor)
return false;
else if (currentMCParticle.globalIndex() == fTempAncestorLabel && fExcludeCommonAncestor)
return false;
}
}
}

// Update the currentMCParticle by moving either back in time (towards mothers, grandmothers, etc)
// or in time (towards daughters) depending on how this was configured in the MSignal
// or in time (towards daughters) depending on how this was configured in the MC Signal
if (!fProngs[i].fCheckGenerationsInTime) {
// make sure that a mother exists in the stack before moving one generation further in history
if (!currentMCParticle.has_mothers() && j < fProngs[i].fNGenerations - 1) {
Expand Down
78 changes: 72 additions & 6 deletions PWGDQ/Core/MCSignalLibrary.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -911,26 +911,92 @@ MCSignal* o2::aod::dqmcsignals::GetMCSignal(const char* name)
return signal;
}

// Any b->e and Any b->c->e
if (!nameStr.compare("eeFromBandBtoC")) {
MCProng prongB(2, {11, 502}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}); // check if mother pdg code is in history
// Any b->e and Any b->X->c->e
// Looking at such decays: B -> (e) D -> (e)e and bar{B} -> e
// Signal allows combinations of ee from the same B meson
// + the combination of e fom B and e from bar{B}
if (!nameStr.compare("eeFromBandAnyBtoC")) {
MCProng prongB(2, {11, 502}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false});
prongB.SetSourceBit(0, MCProng::kPhysicalPrimary);
MCProng prongBtoC(2, {11, 402}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}, false, {502}, {false}); // check if mother pdg code is in history
prongBtoC.SetSourceBit(0, MCProng::kPhysicalPrimary);
signal = new MCSignal(name, "ee pairs from b->e and b->c->e", {prongB, prongBtoC}, {-1, -1}); // signal at pair level
signal = new MCSignal(name, "ee pairs from b->e and b->X->c->e", {prongB, prongBtoC}, {-1, -1}); // signal at pair level
return signal;
}

// Any b->e and Any b->X->c->e
if (!nameStr.compare("eeFromBandAnyBtoCBis")) {
MCProng prongB(2, {11, 502}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false});
prongB.SetSourceBit(0, MCProng::kPhysicalPrimary);
MCProng prongBtoC(2, {11, 402}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}, false, {502}, {false}); // check if mother pdg code is in history
prongBtoC.SetSourceBit(0, MCProng::kPhysicalPrimary);
signal = new MCSignal(name, "ee pairs from b->X->c->e and b->e", {prongBtoC, prongB}, {-1, -1}); // signal at pair level
return signal;
}

if (!nameStr.compare("eeFromBandBtoC")) {
MCProng prongB(2, {11, 502}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false});
prongB.SetSourceBit(0, MCProng::kPhysicalPrimary);
MCProng prongBtoC(3, {11, 402, 502}, {true, true, true}, {false, false, false}, {0, 0, 0}, {0, 0, 0}, {false, false, false}, false); // check if mother pdg code is in history
prongBtoC.SetSourceBit(0, MCProng::kPhysicalPrimary);
signal = new MCSignal(name, "direkt ee pairs from b->e and b->c->e", {prongB, prongBtoC}, {-1, -1}); // signal at pair level
return signal;
}

// Any b->e and Any b->c->e
if (!nameStr.compare("eeFromBandBtoCBis")) {
MCProng prongB(2, {11, 502}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}); // check if mother pdg code is in history
MCProng prongB(2, {11, 502}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false});
prongB.SetSourceBit(0, MCProng::kPhysicalPrimary);
MCProng prongBtoC(2, {11, 402}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}, false, {502}, {false}); // check if mother pdg code is in history
MCProng prongBtoC(3, {11, 402, 502}, {true, true, true}, {false, false, false}, {0, 0, 0}, {0, 0, 0}, {false, false, false}, false); // check if mother pdg code is in history
prongBtoC.SetSourceBit(0, MCProng::kPhysicalPrimary);
signal = new MCSignal(name, "ee pairs from b->c->e and b->e", {prongBtoC, prongB}, {-1, -1}); // signal at pair level
return signal;
}

// Any b->e and Any b->c->e (same mother/grandmother)
// require that the mother is the grandmother of the other electron
if (!nameStr.compare("eeFromBandBtoCsameGM")) {
MCProng prongB(2, {11, 502}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false});
prongB.SetSourceBit(0, MCProng::kPhysicalPrimary);
MCProng prongBtoC(3, {11, 402, 502}, {true, true, true}, {false, false, false}, {0, 0, 0}, {0, 0, 0}, {false, false, false}, false); // check if mother pdg code is in history
prongBtoC.SetSourceBit(0, MCProng::kPhysicalPrimary);
signal = new MCSignal(name, "ee pairs from b->e and b->c->e, mother = grandmother", {prongB, prongBtoC}, {1, 2}, false); // signal at pair level, accept commonAncestor Pairs
return signal;
}

// Any b->e and Any b->c->e (same mother/grandmother)
// require that the mother is the grandmother of the other electron
if (!nameStr.compare("eeFromBandBtoCsameGMBis")) {
MCProng prongB(2, {11, 502}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false});
prongB.SetSourceBit(0, MCProng::kPhysicalPrimary);
MCProng prongBtoC(3, {11, 402, 502}, {true, true, true}, {false, false, false}, {0, 0, 0}, {0, 0, 0}, {false, false, false}, false); // check if mother pdg code is in history
prongBtoC.SetSourceBit(0, MCProng::kPhysicalPrimary);
signal = new MCSignal(name, "ee pairs from b->c->e and b->e, mother = grandmother", {prongBtoC, prongB}, {2, 1}, false); // signal at pair level, accept commonAncestor Pairs
return signal;
}

// Any b->e and Any b->c->e (different mother/grandmother)
// require that the mother is not the grandmother of the other electron
if (!nameStr.compare("eeFromBandBtoCdiffGM")) {
MCProng prongB(2, {11, 502}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false});
prongB.SetSourceBit(0, MCProng::kPhysicalPrimary);
MCProng prongBtoC(3, {11, 402, 502}, {true, true, true}, {false, false, false}, {0, 0, 0}, {0, 0, 0}, {false, false, false}, false); // check if mother pdg code is in history
prongBtoC.SetSourceBit(0, MCProng::kPhysicalPrimary);
signal = new MCSignal(name, "ee pairs from b->e and b->c->e, mother != grandmother", {prongB, prongBtoC}, {1, 2}, true); // signal at pair level, exclude commonAncestor Pairs
return signal;
}

// Any b->e and Any b->c->e (different mother/grandmother)
// require that the mother is not the grandmother of the other electron
if (!nameStr.compare("eeFromBandBtoCdiffGMBis")) {
MCProng prongB(2, {11, 502}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false});
prongB.SetSourceBit(0, MCProng::kPhysicalPrimary);
MCProng prongBtoC(3, {11, 402, 502}, {true, true, true}, {false, false, false}, {0, 0, 0}, {0, 0, 0}, {false, false, false}, false); // check if mother pdg code is in history
prongBtoC.SetSourceBit(0, MCProng::kPhysicalPrimary);
signal = new MCSignal(name, "ee pairs from b->c->e and b->e, mother != grandmother", {prongBtoC, prongB}, {2, 1}, true); // signal at pair level, exclude commonAncestor Pairs
return signal;
}

// b->e and b->e
if (!nameStr.compare("eeFromBB")) {
MCProng prong(2, {11, 502}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false});
Expand Down

0 comments on commit a3dd25f

Please sign in to comment.