Skip to content

Commit bcbb58a

Browse files
Prompt charmonia in OO midrapidity with traigger gap 2 (default was 5) (#2169)
* Create Generator_InjectedPromptCharmoniaMidy_TriggerGap_2_OO5TeV.ini * Create Create Generator_InjectedPromptCharmoniaMidy_TriggerGap_2_OO5TeV.C * Rename Create Generator_InjectedPromptCharmoniaMidy_TriggerGap_2_OO5TeV.C to Generator_InjectedPromptCharmoniaMidy_TriggerGap_2_OO5TeV.C
1 parent c6c80f9 commit bcbb58a

File tree

2 files changed

+91
-0
lines changed

2 files changed

+91
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
### The external generator derives from GeneratorPythia8.
2+
[GeneratorExternal]
3+
fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/external/generator/generator_pythia8_withInjectedPromptSignals_gaptriggered_dq.C
4+
funcName=GeneratorPythia8InjectedPromptCharmoniaGapTriggered(2,12)
5+
6+
[GeneratorPythia8]
7+
config=${O2DPG_MC_CONFIG_ROOT}/MC/config/common/pythia8/generator/pythia8_OO_536.cfg
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
int External()
2+
{
3+
int checkPdgSignal[] = {443,100443};
4+
int checkPdgDecay = 11;
5+
std::string path{"o2sim_Kine.root"};
6+
std::cout << "Check for\nsignal PDG " << checkPdgSignal << "\ndecay PDG " << checkPdgDecay << "\n";
7+
TFile file(path.c_str(), "READ");
8+
if (file.IsZombie()) {
9+
std::cerr << "Cannot open ROOT file " << path << "\n";
10+
return 1;
11+
}
12+
13+
auto tree = (TTree*)file.Get("o2sim");
14+
std::vector<o2::MCTrack>* tracks{};
15+
tree->SetBranchAddress("MCTrack", &tracks);
16+
17+
int nLeptons{};
18+
int nAntileptons{};
19+
int nLeptonPairs{};
20+
int nLeptonPairsToBeDone{};
21+
int nSignalJpsi{};
22+
int nSignalPsi2S{};
23+
int nSignalJpsiWithinAcc{};
24+
int nSignalPsi2SWithinAcc{};
25+
auto nEvents = tree->GetEntries();
26+
o2::steer::MCKinematicsReader mcreader("o2sim", o2::steer::MCKinematicsReader::Mode::kMCKine);
27+
Bool_t isInjected = kFALSE;
28+
29+
for (int i = 0; i < nEvents; i++) {
30+
tree->GetEntry(i);
31+
for (auto& track : *tracks) {
32+
auto pdg = track.GetPdgCode();
33+
auto rapidity = track.GetRapidity();
34+
auto idMoth = track.getMotherTrackId();
35+
if (pdg == checkPdgDecay) {
36+
// count leptons
37+
nLeptons++;
38+
} else if(pdg == -checkPdgDecay) {
39+
// count anti-leptons
40+
nAntileptons++;
41+
} else if (pdg == checkPdgSignal[0] || pdg == checkPdgSignal[1]) {
42+
if(idMoth < 0){
43+
// count signal PDG
44+
pdg == checkPdgSignal[0] ? nSignalJpsi++ : nSignalPsi2S++;
45+
// count signal PDG within acceptance
46+
if(std::abs(rapidity) < 1.0) { pdg == checkPdgSignal[0] ? nSignalJpsiWithinAcc++ : nSignalPsi2SWithinAcc++;}
47+
}
48+
auto child0 = o2::mcutils::MCTrackNavigator::getDaughter0(track, *tracks);
49+
auto child1 = o2::mcutils::MCTrackNavigator::getDaughter1(track, *tracks);
50+
if (child0 != nullptr && child1 != nullptr) {
51+
// check for parent-child relations
52+
auto pdg0 = child0->GetPdgCode();
53+
auto pdg1 = child1->GetPdgCode();
54+
std::cout << "First and last children of parent " << checkPdgSignal << " are PDG0: " << pdg0 << " PDG1: " << pdg1 << "\n";
55+
if (std::abs(pdg0) == checkPdgDecay && std::abs(pdg1) == checkPdgDecay && pdg0 == -pdg1) {
56+
nLeptonPairs++;
57+
if (child0->getToBeDone() && child1->getToBeDone()) {
58+
nLeptonPairsToBeDone++;
59+
}
60+
}
61+
}
62+
}
63+
}
64+
}
65+
std::cout << "#events: " << nEvents << "\n"
66+
<< "#leptons: " << nLeptons << "\n"
67+
<< "#antileptons: " << nAntileptons << "\n"
68+
<< "#signal (prompt Jpsi): " << nSignalJpsi << "; within acceptance (|y| < 1): " << nSignalJpsiWithinAcc << "\n"
69+
<< "#signal (prompt Psi(2S)): " << nSignalPsi2S << "; within acceptance (|y| < 1): " << nSignalPsi2SWithinAcc << "\n"
70+
<< "#lepton pairs: " << nLeptonPairs << "\n"
71+
<< "#lepton pairs to be done: " << nLeptonPairs << "\n";
72+
73+
74+
if (nLeptonPairs == 0 || nLeptons == 0 || nAntileptons == 0) {
75+
std::cerr << "Number of leptons, number of anti-leptons as well as number of lepton pairs should all be greater than 1.\n";
76+
return 1;
77+
}
78+
if (nLeptonPairs != nLeptonPairsToBeDone) {
79+
std::cerr << "The number of lepton pairs should be the same as the number of lepton pairs which should be transported.\n";
80+
return 1;
81+
}
82+
83+
return 0;
84+
}

0 commit comments

Comments
 (0)