From d9df3b45cb5208c36d84b30ca8a6a42ed8cfdaa4 Mon Sep 17 00:00:00 2001 From: Marco Giacalone Date: Mon, 31 Aug 2026 16:41:49 +0200 Subject: [PATCH] Example Pythia8 for HY --- MC/config/examples/hybrid/examplehyp8.json | 79 +++++++++++++++++++ MC/config/examples/ini/GeneratorHYPythia8.ini | 4 + .../examples/ini/tests/GeneratorHYPythia8.C | 38 +++++++++ 3 files changed, 121 insertions(+) create mode 100644 MC/config/examples/hybrid/examplehyp8.json create mode 100644 MC/config/examples/ini/GeneratorHYPythia8.ini create mode 100644 MC/config/examples/ini/tests/GeneratorHYPythia8.C diff --git a/MC/config/examples/hybrid/examplehyp8.json b/MC/config/examples/hybrid/examplehyp8.json new file mode 100644 index 000000000..b7d66de30 --- /dev/null +++ b/MC/config/examples/hybrid/examplehyp8.json @@ -0,0 +1,79 @@ +{ + "mode": "parallel", + "generators": [ + { + "name": "external", + "config": { + "fileName": "", + "funcName": "", + "iniFile": "${O2DPG_MC_CONFIG_ROOT}/MC/config/ALICE3/ini/pythia8_pp_136tev.ini" + } + }, + { + "name": "external", + "config": { + "fileName": "", + "funcName": "", + "iniFile": "${O2DPG_MC_CONFIG_ROOT}/MC/config/ALICE3/ini/pythia8_pp_136tev.ini" + } + }, + { + "name": "external", + "config": { + "fileName": "", + "funcName": "", + "iniFile": "${O2DPG_MC_CONFIG_ROOT}/MC/config/ALICE3/ini/pythia8_pp_136tev.ini" + } + }, + { + "name": "external", + "config": { + "fileName": "", + "funcName": "", + "iniFile": "${O2DPG_MC_CONFIG_ROOT}/MC/config/ALICE3/ini/pythia8_pp_136tev.ini" + } + }, + { + "name": "external", + "config": { + "fileName": "", + "funcName": "", + "iniFile": "${O2DPG_MC_CONFIG_ROOT}/MC/config/ALICE3/ini/pythia8_pp_136tev.ini" + } + }, + { + "name": "external", + "config": { + "fileName": "", + "funcName": "", + "iniFile": "${O2DPG_MC_CONFIG_ROOT}/MC/config/ALICE3/ini/pythia8_pp_136tev.ini" + } + }, + { + "name": "external", + "config": { + "fileName": "", + "funcName": "", + "iniFile": "${O2DPG_MC_CONFIG_ROOT}/MC/config/ALICE3/ini/pythia8_pp_136tev.ini" + } + }, + { + "name": "external", + "config": { + "fileName": "", + "funcName": "", + "iniFile": "${O2DPG_MC_CONFIG_ROOT}/MC/config/ALICE3/ini/pythia8_pp_136tev.ini" + } + } + ], + "fractions": [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ] +} \ No newline at end of file diff --git a/MC/config/examples/ini/GeneratorHYPythia8.ini b/MC/config/examples/ini/GeneratorHYPythia8.ini new file mode 100644 index 000000000..da82b263d --- /dev/null +++ b/MC/config/examples/ini/GeneratorHYPythia8.ini @@ -0,0 +1,4 @@ +[GeneratorHybrid] +configFile = ${O2DPG_MC_CONFIG_ROOT}/MC/config/examples/hybrid/examplehyp8.json +switchExtToHybrid = true +num_workers = 8 diff --git a/MC/config/examples/ini/tests/GeneratorHYPythia8.C b/MC/config/examples/ini/tests/GeneratorHYPythia8.C new file mode 100644 index 000000000..2694d57e4 --- /dev/null +++ b/MC/config/examples/ini/tests/GeneratorHYPythia8.C @@ -0,0 +1,38 @@ +int Hybrid() +{ + std::string path{"o2sim_Kine.root"}; + // Check that file exists, can be opened and has the correct tree + 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); + + // Check if all events are filled + auto nEvents = tree->GetEntries(); + for (Long64_t i = 0; i < nEvents; ++i) + { + tree->GetEntry(i); + if (tracks->empty()) + { + std::cerr << "Empty entry found at event " << i << "\n"; + return 1; + } + } + // Check if there are 100 events, as simulated in the o2dpg-test + if (nEvents != 100) + { + std::cerr << "Expected 100 events, got " << nEvents << "\n"; + return 1; + } + return 0; +}