Skip to content

Commit 8def6bc

Browse files
committed
[PWGLF] Add hybrid generator for strangeness in jets
1 parent 6d85da1 commit 8def6bc

File tree

3 files changed

+102
-0
lines changed

3 files changed

+102
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[GeneratorHybrid]
2+
configFile=${O2DPG_MC_CONFIG_ROOT}/MC/config/common/external/generator/pythia8_inel_plus_jets_ropes_13p6TeV.json
3+
4+
[DecayerPythia8]
5+
config[0]=${O2DPG_MC_CONFIG_ROOT}/MC/config/common/pythia8/decayer/base.cfg
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
int Hybrid()
2+
{
3+
std::string path{"o2sim_Kine.root"};
4+
5+
TFile file(path.c_str(), "READ");
6+
if (file.IsZombie()) {
7+
std::cerr << "Cannot open ROOT file " << path << "\n";
8+
return 1;
9+
}
10+
11+
auto tree = (TTree*)file.Get("o2sim");
12+
if (!tree) {
13+
std::cerr << "Cannot find tree o2sim in file " << path << "\n";
14+
return 1;
15+
}
16+
17+
std::vector<o2::MCTrack>* tracks{};
18+
o2::MCEventHeader* header{};
19+
20+
tree->SetBranchAddress("MCTrack", &tracks);
21+
tree->SetBranchAddress("MCEventHeader.", &header);
22+
23+
int nEvents = tree->GetEntries();
24+
25+
int nMB = 0;
26+
int nHard = 0;
27+
28+
long long multMB = 0;
29+
long long multHard = 0;
30+
31+
for (int i = 0; i < nEvents; ++i) {
32+
tree->GetEntry(i);
33+
34+
int genId = header->getGeneratorId();
35+
int mult = tracks->size();
36+
37+
if (genId == 0) {
38+
nMB++;
39+
multMB += mult;
40+
} else if (genId == 1) {
41+
nHard++;
42+
multHard += mult;
43+
}
44+
}
45+
46+
std::cout << "--------------------------------\n";
47+
std::cout << "# Events total: " << nEvents << "\n";
48+
std::cout << "# MB events : " << nMB << "\n";
49+
std::cout << "# Hard events : " << nHard << "\n";
50+
51+
if (nHard == 0 || nMB == 0) {
52+
std::cerr << "One of the generators was never used\n";
53+
return 1;
54+
}
55+
56+
std::cout << "Avg multiplicity MB : "
57+
<< double(multMB) / nMB << "\n";
58+
std::cout << "Avg multiplicity Hard : "
59+
<< double(multHard) / nHard << "\n";
60+
61+
if (multHard <= multMB) {
62+
std::cerr << "Hard events not harder than MB ones\n";
63+
return 1;
64+
}
65+
66+
return 0;
67+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"generators": [
3+
{
4+
"name": "pythia8",
5+
"config": {
6+
"config": "${O2_ROOT}/share/Generators/egconfig/pythia8_inel.cfg",
7+
"hooksFileName": "",
8+
"hooksFuncName": "",
9+
"includePartonEvent": false,
10+
"particleFilter": "",
11+
"verbose": 0
12+
}
13+
},
14+
{
15+
"name": "pythia8",
16+
"config": {
17+
"config": "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_jet_ropes_136tev.cfg",
18+
"hooksFileName": "",
19+
"hooksFuncName": "",
20+
"includePartonEvent": false,
21+
"particleFilter": "",
22+
"verbose": 0
23+
}
24+
}
25+
],
26+
"fractions": [
27+
4,
28+
1
29+
]
30+
}

0 commit comments

Comments
 (0)