Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions MC/config/ALICE3/ini/tests/xic_PbPb.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
int External()
{
std::string path{"o2sim_Kine.root"};
int pdgToCheck = 4232;

TFile file(path.c_str(), "read");
if (file.IsZombie()) {
std::cerr << "Cannot open ROOT file " << path << std::endl;
return 1;
}

int nInjectedParticles = 0;
TTree* tree = (TTree*)file.Get("o2sim");

if (!tree) {
std::cerr << "Cannot find tree o2sim in file " << path << std::endl;
return 1;
}

std::vector<o2::MCTrack> *tracks{};
tree->SetBranchAddress("MCTrack", &tracks);

int nEvents = tree->GetEntries();
for (int i = 0; i < nEvents; i++) {
tree->GetEntry(i);
for (auto& track : *tracks) {
auto pdgCode = track.GetPdgCode();
if (pdgCode == pdgToCheck) {
// not injecting anti-particle
nInjectedParticles++;
}
}
}

if (nInjectedParticles < nEvents) {
// Check that we are correctly injecting 15
// particle per event
return 1;
}

return 0;
}




46 changes: 46 additions & 0 deletions MC/config/ALICE3/ini/tests/xic_pp.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
int External()
{
std::string path{"o2sim_Kine.root"};
int pdgToCheck = 4232;

TFile file(path.c_str(), "read");
if (file.IsZombie()) {
std::cerr << "Cannot open ROOT file " << path << std::endl;
return 1;
}

int nInjectedParticles = 0;
TTree* tree = (TTree*)file.Get("o2sim");

if (!tree) {
std::cerr << "Cannot find tree o2sim in file " << path << "\n";
return 1;
}

std::vector<o2::MCTrack> *tracks{};
tree->SetBranchAddress("MCTrack", &tracks);

int nEvents = tree->GetEntries();
for (int i = 0; i < nEvents; i++) {
tree->GetEntry(i);
for (auto& track : *tracks) {
auto pdgCode = track.GetPdgCode();
if (pdgCode == pdgToCheck) {
// not injecting anti-particle
nInjectedParticles++;
}
}
}

if (nInjectedParticles < nEvents) {
// Check that we are correctly injecting one
// particle per event
return 1;
}

return 0;
}




6 changes: 6 additions & 0 deletions MC/config/ALICE3/ini/xic_PbPb.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[GeneratorExternal]
fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/ALICE3/pythia8/generator_pythia8_gun_PbPb.C
funcName=generateNativeXiC()

[GeneratorPythia8]
config=${O2DPG_MC_CONFIG_ROOT}/MC/config/ALICE3/pythia8/generator/config_custom_xicc.cfg
6 changes: 6 additions & 0 deletions MC/config/ALICE3/ini/xic_pp.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[GeneratorExternal]
fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/ALICE3/pythia8/generator_pythia8_gun_pp.C
funcName=generateNativeXiC()

[GeneratorPythia8]
config=${O2DPG_MC_CONFIG_ROOT}/MC/config/ALICE3/pythia8/generator/config_custom_xicc.cfg