Skip to content

Commit 3c185dc

Browse files
authored
[ALICE3] Add xi injector for pp and PbPb (#1939)
* Add xi injector for pp and PbPb * Change to DPG_MC_CONFIG_ROOT * Add simple test for the external generator
1 parent 87d3001 commit 3c185dc

File tree

4 files changed

+104
-0
lines changed

4 files changed

+104
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
int External()
2+
{
3+
std::string path{"o2sim_Kine.root"};
4+
int pdgToCheck = 3312;
5+
6+
TFile file(path.c_str(), "read");
7+
if (file.IsZombie()) {
8+
std::cerr << "Cannot open ROOT file " << path << std::endl;
9+
return 1;
10+
}
11+
12+
int nInjectedParticles = 0;
13+
TTree* tree = (TTree*)file.Get("o2sim");
14+
15+
if (!tree) {
16+
std::cerr << "Cannot find tree o2sim in file " << path << std::endl;
17+
return 1;
18+
}
19+
20+
std::vector<o2::MCTrack> *tracks{};
21+
tree->SetBranchAddress("MCTrack", &tracks);
22+
23+
int nEvents = tree->GetEntries();
24+
for (int i = 0; i < nEvents; i++) {
25+
tree->GetEntry(i);
26+
for (auto& track : *tracks) {
27+
auto pdgCode = track.GetPdgCode();
28+
if (pdgCode == pdgToCheck) {
29+
// not injecting anti-particle
30+
nInjectedParticles++;
31+
}
32+
}
33+
}
34+
35+
if (nInjectedParticles < nEvents) {
36+
// Check that we are correctly injecting 15
37+
// particle per event
38+
return 1;
39+
}
40+
41+
return 0;
42+
}
43+
44+
45+
46+

MC/config/ALICE3/ini/tests/xi_pp.C

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
int External()
2+
{
3+
std::string path{"o2sim_Kine.root"};
4+
int pdgToCheck = 3312;
5+
6+
TFile file(path.c_str(), "read");
7+
if (file.IsZombie()) {
8+
std::cerr << "Cannot open ROOT file " << path << std::endl;
9+
return 1;
10+
}
11+
12+
int nInjectedParticles = 0;
13+
TTree* tree = (TTree*)file.Get("o2sim");
14+
15+
if (!tree) {
16+
std::cerr << "Cannot find tree o2sim in file " << path << "\n";
17+
return 1;
18+
}
19+
20+
std::vector<o2::MCTrack> *tracks{};
21+
tree->SetBranchAddress("MCTrack", &tracks);
22+
23+
int nEvents = tree->GetEntries();
24+
for (int i = 0; i < nEvents; i++) {
25+
tree->GetEntry(i);
26+
for (auto& track : *tracks) {
27+
auto pdgCode = track.GetPdgCode();
28+
if (pdgCode == pdgToCheck) {
29+
// not injecting anti-particle
30+
nInjectedParticles++;
31+
}
32+
}
33+
}
34+
35+
if (nInjectedParticles < nEvents) {
36+
// Check that we are correctly injecting one
37+
// particle per event
38+
return 1;
39+
}
40+
41+
return 0;
42+
}
43+
44+
45+
46+

MC/config/ALICE3/ini/xi_PbPb.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[GeneratorExternal]
2+
fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/ALICE3/pythia8/generator_pythia8_gun_PbPb.C
3+
funcName=generateNativeXi()
4+
5+
[GeneratorPythia8]
6+
config=${O2DPG_MC_CONFIG_ROOT}/MC/config/ALICE3/pythia8/generator/config_custom_xicc.cfg

MC/config/ALICE3/ini/xi_pp.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[GeneratorExternal]
2+
fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/ALICE3/pythia8/generator_pythia8_gun_pp.C
3+
funcName=generateNativeXi()
4+
5+
[GeneratorPythia8]
6+
config=${O2DPG_MC_CONFIG_ROOT}/MC/config/ALICE3/pythia8/generator/config_custom_xicc.cfg

0 commit comments

Comments
 (0)