Skip to content

Commit 732c81f

Browse files
Adding chiC (#2384)
* Update generator_pythia8_HadronTriggered_withGap.C * Create Generator_InjectedInclusiveJpsiMidy_Pythia8_TriggerGap.C * Update Generator_InjectedInclusiveJpsiPsi2SMidy_2026_Pythia8_TriggerGap.ini
1 parent c8dda3c commit 732c81f

3 files changed

Lines changed: 142 additions & 2 deletions

File tree

MC/config/PWGDQ/external/generator/generator_pythia8_HadronTriggered_withGap.C

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,4 +211,42 @@ FairGenerator*
211211
// gen->PrintDebug();
212212

213213
return gen;
214-
}
214+
}
215+
FairGenerator *
216+
GeneratorInclusiveJpsiPsi2SChiC_EvtGenMidY(int triggerGap, double rapidityMin = -1.5, double rapidityMax = 1.5, bool verbose = false)
217+
{
218+
auto gen = new o2::eventgen::GeneratorEvtGen<o2::eventgen::GeneratorPythia8HadronTriggeredWithGap>();
219+
gen->setTriggerGap(triggerGap);
220+
gen->setRapidityRange(rapidityMin, rapidityMax);
221+
gen->addHadronPDGs(443);
222+
gen->addHadronPDGs(100443);
223+
gen->addHadronPDGs(445);
224+
gen->addHadronPDGs(200443);
225+
gen->setVerbose(verbose);
226+
227+
TString pathO2table = gSystem->ExpandPathName("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/pythia8/decayer/switchOffJpsi.cfg");
228+
gen->readFile(pathO2table.Data());
229+
gen->setConfigMBdecays(pathO2table);
230+
gen->PrintDebug(true);
231+
232+
gen->SetSizePdg(4);
233+
gen->AddPdg(443, 0);
234+
gen->AddPdg(100443, 1);
235+
gen->AddPdg(443, 2);
236+
gen->AddPdg(100443, 3);
237+
238+
gen->SetForceDecay(kEvtDiElectron);
239+
240+
// set random seed
241+
gen->readString("Random:setSeed on");
242+
uint random_seed;
243+
unsigned long long int random_value = 0;
244+
ifstream urandom("/dev/urandom", ios::in | ios::binary);
245+
urandom.read(reinterpret_cast<char *>(&random_value), sizeof(random_seed));
246+
gen->readString(Form("Random:seed = %llu", random_value % 900000001));
247+
248+
// print debug
249+
// gen->PrintDebug();
250+
251+
return gen;
252+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
### The external generator derives from GeneratorPythia8.
22
[GeneratorExternal]
33
fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/external/generator/generator_pythia8_HadronTriggered_withGap.C
4-
funcName=GeneratorInclusiveJpsiPsi2S_EvtGenMidY(5,-1.5,1.5)
4+
funcName=GeneratorInclusiveJpsiPsi2SChiC_EvtGenMidY(5,-1.5,1.5)
55

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

0 commit comments

Comments
 (0)