diff --git a/MC/config/common/ini/GeneratorHGPythia8OO536TeV.ini b/MC/config/common/ini/GeneratorHGPythia8OO536TeV.ini new file mode 100644 index 000000000..3056c77a2 --- /dev/null +++ b/MC/config/common/ini/GeneratorHGPythia8OO536TeV.ini @@ -0,0 +1,8 @@ +#NEV_TEST> 5 +# HG-PYTHIA (Glauber + PYTHIA 8 pp collisions) OO at sqrt(s_NN) = 5.36 TeV, minimum bias +[GeneratorExternal] +fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/common/external/generator/GeneratorHGPythia8.C +funcName=generateHGPythia8(16, 16) + +[GeneratorPythia8] +config=${O2DPG_MC_CONFIG_ROOT}/MC/config/common/pythia8/generator/pythia8_inel_536.cfg diff --git a/MC/config/common/ini/tests/GeneratorHGPythia8OO536TeV.C b/MC/config/common/ini/tests/GeneratorHGPythia8OO536TeV.C new file mode 100644 index 000000000..a1fa0c959 --- /dev/null +++ b/MC/config/common/ini/tests/GeneratorHGPythia8OO536TeV.C @@ -0,0 +1,56 @@ +int External() +{ + const int A = 16; // mass number of both nuclei + std::string path{"o2sim_Kine.root"}; + TFile file(path.c_str(), "READ"); + if (file.IsZombie()) { + std::cerr << "Cannot open ROOT file " << path << "\n"; + return 1; + } + auto tree = (TTree*)file.Get("o2sim"); + if (!tree) { + std::cerr << "Cannot find tree o2sim in file " << path << "\n"; + return 1; + } + std::vector* tracks{}; + tree->SetBranchAddress("MCTrack", &tracks); + o2::dataformats::MCEventHeader* header = nullptr; + tree->SetBranchAddress("MCEventHeader.", &header); + + using Key = o2::dataformats::MCInfoKeys; + const auto nEvents = tree->GetEntries(); + if (nEvents == 0) { + std::cerr << "No events found\n"; + return 1; + } + for (Long64_t i = 0; i < nEvents; ++i) { + tree->GetEntry(i); + bool valid = false; + const int nColl = header->getInfo(Key::nColl, valid); + if (!valid || nColl < 1 || nColl > A * A) { + std::cerr << "Missing or invalid Ncoll in event " << i << "\n"; + return 1; + } + const int nPart = header->getInfo(Key::nPart, valid); + if (!valid || nPart < 2 || nPart > 2 * A) { + std::cerr << "Missing or invalid Npart in event " << i << "\n"; + return 1; + } + // each NN collision is a PYTHIA pp event: two beam protons with half of sqrt(s_NN) each + int nBeams = 0; + for (const auto& track : *tracks) { + if (o2::mcgenstatus::getHepMCStatusCode(track.getStatusCode()) == 4) { + if (track.GetPdgCode() != 2212 || std::abs(track.GetEnergy() - 2680.) > 1e-3) { + std::cerr << "Unexpected beam particle " << track.GetPdgCode() << " with energy " << track.GetEnergy() << " in event " << i << "\n"; + return 1; + } + nBeams++; + } + } + if (nBeams != 2 * nColl) { + std::cerr << "Found " << nBeams << " beam protons for " << nColl << " NN collisions in event " << i << "\n"; + return 1; + } + } + return 0; +}