Skip to content

Commit 9255537

Browse files
author
Koushik Barai
committed
Add PbPb gap-trigger injected bottomonia generator test config
1 parent ca78f1c commit 9255537

1 file changed

Lines changed: 103 additions & 0 deletions

File tree

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
int External()
2+
{
3+
int checkPdgSignal[] = {553,100553,200553};
4+
int checkPdgDecay = 13;
5+
double rapiditymin = -4.3; double rapiditymax = -2.3;
6+
std::string path{"o2sim_Kine.root"};
7+
std::cout << "Check for\nsignal PDG " << checkPdgSignal << "\ndecay PDG " << checkPdgDecay << "\n";
8+
TFile file(path.c_str(), "READ");
9+
if (file.IsZombie()) {
10+
std::cerr << "Cannot open ROOT file " << path << "\n";
11+
return 1;
12+
}
13+
14+
auto tree = (TTree*)file.Get("o2sim");
15+
std::vector<o2::MCTrack>* tracks{};
16+
tree->SetBranchAddress("MCTrack", &tracks);
17+
18+
int nLeptons{};
19+
int nAntileptons{};
20+
int nLeptonPairs{};
21+
int nLeptonPairsToBeDone{};
22+
int nSignalUpsilon1S{};
23+
int nSignalUpsilon2S{};
24+
int nSignalUpsilon3S{};
25+
int nSignalUpsilon1SWithinAcc{};
26+
int nSignalUpsilon2SWithinAcc{};
27+
int nSignalUpsilon3SWithinAcc{};
28+
auto nEvents = tree->GetEntries();
29+
o2::steer::MCKinematicsReader mcreader("o2sim", o2::steer::MCKinematicsReader::Mode::kMCKine);
30+
Bool_t isInjected = kFALSE;
31+
32+
for (int i = 0; i < nEvents; i++) {
33+
tree->GetEntry(i);
34+
for (auto& track : *tracks) {
35+
auto pdg = track.GetPdgCode();
36+
auto rapidity = track.GetRapidity();
37+
auto idMoth = track.getMotherTrackId();
38+
if (pdg == checkPdgDecay) {
39+
// count leptons
40+
nLeptons++;
41+
} else if(pdg == -checkPdgDecay) {
42+
// count anti-leptons
43+
nAntileptons++;
44+
} else if (pdg == checkPdgSignal[0] || pdg == checkPdgSignal[1] || pdg == checkPdgSignal[2]) {
45+
if(idMoth < 0){
46+
// count signal PDG
47+
if (pdg == checkPdgSignal[0]) {
48+
nSignalUpsilon1S++;
49+
} else if (pdg == checkPdgSignal[1]) {
50+
nSignalUpsilon2S++;
51+
} else {
52+
nSignalUpsilon3S++;
53+
}
54+
55+
// count signal PDG within acceptance
56+
if (rapidity > rapiditymin && rapidity < rapiditymax) {
57+
if (pdg == checkPdgSignal[0]) {
58+
nSignalUpsilon1SWithinAcc++;
59+
} else if (pdg == checkPdgSignal[1]) {
60+
nSignalUpsilon2SWithinAcc++;
61+
} else {
62+
nSignalUpsilon3SWithinAcc++;
63+
}
64+
}
65+
}
66+
auto child0 = o2::mcutils::MCTrackNavigator::getDaughter0(track, *tracks);
67+
auto child1 = o2::mcutils::MCTrackNavigator::getDaughter1(track, *tracks);
68+
if (child0 != nullptr && child1 != nullptr) {
69+
// check for parent-child relations
70+
auto pdg0 = child0->GetPdgCode();
71+
auto pdg1 = child1->GetPdgCode();
72+
std::cout << "First and last children of parent " << checkPdgSignal << " are PDG0: " << pdg0 << " PDG1: " << pdg1 << "\n";
73+
if (std::abs(pdg0) == checkPdgDecay && std::abs(pdg1) == checkPdgDecay && pdg0 == -pdg1) {
74+
nLeptonPairs++;
75+
if (child0->getToBeDone() && child1->getToBeDone()) {
76+
nLeptonPairsToBeDone++;
77+
}
78+
}
79+
}
80+
}
81+
}
82+
}
83+
std::cout << "#events: " << nEvents << "\n"
84+
<< "#leptons: " << nLeptons << "\n"
85+
<< "#antileptons: " << nAntileptons << "\n"
86+
<< "#signal (Upsilon(1S)): " << nSignalUpsilon1S << "; within acceptance " << rapiditymin << " < y < " << rapiditymax << " : " << nSignalUpsilon1SWithinAcc << "\n"
87+
<< "#signal (Upsilon(2S)): " << nSignalUpsilon2S << "; within acceptance " << rapiditymin << " < y < " << rapiditymax << " : " << nSignalUpsilon2SWithinAcc << "\n"
88+
<< "#signal (Upsilon(2S)): " << nSignalUpsilon3S << "; within acceptance " << rapiditymin << " < y < " << rapiditymax << " : " << nSignalUpsilon3SWithinAcc << "\n"
89+
<< "#lepton pairs: " << nLeptonPairs << "\n"
90+
<< "#lepton pairs to be done: " << nLeptonPairs << "\n";
91+
92+
93+
if (nLeptonPairs == 0 || nLeptons == 0 || nAntileptons == 0) {
94+
std::cerr << "Number of leptons, number of anti-leptons as well as number of lepton pairs should all be greater than 1.\n";
95+
return 1;
96+
}
97+
if (nLeptonPairs != nLeptonPairsToBeDone) {
98+
std::cerr << "The number of lepton pairs should be the same as the number of lepton pairs which should be transported.\n";
99+
return 1;
100+
}
101+
102+
return 0;
103+
}

0 commit comments

Comments
 (0)