|
7 | 7 | #include "CCDB/CcdbApi.h" |
8 | 8 | #include "DetectorsRaw/HBFUtils.h" |
9 | 9 |
|
| 10 | +//** This external generator is now used for development purposes only. |
| 11 | +//** Fast simulated TPC loopers are automatically integrated as detector effect in O2 |
| 12 | +//** starting from the O2PDPSuite::MC-prod-2026-v3-1 official release (05/02/2026) |
| 13 | +//** Previous cocktails configurations using this generator must not be used anymore for recent tags, |
| 14 | +//** as they will increase the default TPC loopers contribution. |
| 15 | +//** For support: Marco Giacalone <marco.giacalone@cern.ch>. |
| 16 | + |
10 | 17 | // Static Ort::Env instance for multiple onnx model loading |
11 | 18 | static Ort::Env global_env(ORT_LOGGING_LEVEL_WARNING, "GlobalEnv"); |
12 | 19 |
|
13 | 20 | // This class is responsible for loading the scaler parameters from a JSON file |
14 | 21 | // and applying the inverse transformation to the generated data. |
15 | | -struct Scaler |
| 22 | +struct Scaler_debug |
16 | 23 | { |
17 | 24 | std::vector<double> normal_min; |
18 | 25 | std::vector<double> normal_max; |
@@ -71,10 +78,10 @@ private: |
71 | 78 | }; |
72 | 79 |
|
73 | 80 | // This class loads the ONNX model and generates samples using it. |
74 | | -class ONNXGenerator |
| 81 | +class ONNXGenerator_debug |
75 | 82 | { |
76 | 83 | public: |
77 | | - ONNXGenerator(Ort::Env &shared_env, const std::string &model_path) |
| 84 | + ONNXGenerator_debug(Ort::Env &shared_env, const std::string &model_path) |
78 | 85 | : env(shared_env), session(env, model_path.c_str(), Ort::SessionOptions{}) |
79 | 86 | { |
80 | 87 | // Create session options |
@@ -129,12 +136,12 @@ namespace o2 |
129 | 136 | namespace eventgen |
130 | 137 | { |
131 | 138 |
|
132 | | -class GenTPCLoopers : public Generator |
| 139 | +class GenTPCLoopers_debug : public Generator |
133 | 140 | { |
134 | 141 | public: |
135 | | - GenTPCLoopers(std::string model_pairs = "tpcloopmodel.onnx", std::string model_compton = "tpcloopmodelcompton.onnx", |
136 | | - std::string poisson = "poisson.csv", std::string gauss = "gauss.csv", std::string scaler_pair = "scaler_pair.json", |
137 | | - std::string scaler_compton = "scaler_compton.json") |
| 142 | + GenTPCLoopers_debug(std::string model_pairs = "tpcloopmodel.onnx", std::string model_compton = "tpcloopmodelcompton.onnx", |
| 143 | + std::string poisson = "poisson.csv", std::string gauss = "gauss.csv", std::string scaler_pair = "scaler_pair.json", |
| 144 | + std::string scaler_compton = "scaler_compton.json") |
138 | 145 | { |
139 | 146 | // Checking if the model files exist and are not empty |
140 | 147 | std::ifstream model_file[2]; |
@@ -200,11 +207,11 @@ class GenTPCLoopers : public Generator |
200 | 207 | mGaussSet = true; |
201 | 208 | } |
202 | 209 | } |
203 | | - mONNX_pair = std::make_unique<ONNXGenerator>(global_env, model_pairs); |
204 | | - mScaler_pair = std::make_unique<Scaler>(); |
| 210 | + mONNX_pair = std::make_unique<ONNXGenerator_debug>(global_env, model_pairs); |
| 211 | + mScaler_pair = std::make_unique<Scaler_debug>(); |
205 | 212 | mScaler_pair->load(scaler_pair); |
206 | | - mONNX_compton = std::make_unique<ONNXGenerator>(global_env, model_compton); |
207 | | - mScaler_compton = std::make_unique<Scaler>(); |
| 213 | + mONNX_compton = std::make_unique<ONNXGenerator_debug>(global_env, model_compton); |
| 214 | + mScaler_compton = std::make_unique<Scaler_debug>(); |
208 | 215 | mScaler_compton->load(scaler_compton); |
209 | 216 | Generator::setTimeUnit(1.0); |
210 | 217 | Generator::setPositionUnit(1.0); |
@@ -525,10 +532,10 @@ class GenTPCLoopers : public Generator |
525 | 532 | } |
526 | 533 |
|
527 | 534 | private: |
528 | | - std::unique_ptr<ONNXGenerator> mONNX_pair = nullptr; |
529 | | - std::unique_ptr<ONNXGenerator> mONNX_compton = nullptr; |
530 | | - std::unique_ptr<Scaler> mScaler_pair = nullptr; |
531 | | - std::unique_ptr<Scaler> mScaler_compton = nullptr; |
| 535 | + std::unique_ptr<ONNXGenerator_debug> mONNX_pair = nullptr; |
| 536 | + std::unique_ptr<ONNXGenerator_debug> mONNX_compton = nullptr; |
| 537 | + std::unique_ptr<Scaler_debug> mScaler_pair = nullptr; |
| 538 | + std::unique_ptr<Scaler_debug> mScaler_compton = nullptr; |
532 | 539 | double mPoisson[3] = {0.0, 0.0, 0.0}; // Mu, Min and Max of Poissonian |
533 | 540 | double mGauss[4] = {0.0, 0.0, 0.0, 0.0}; // Mean, Std, Min, Max |
534 | 541 | std::vector<std::vector<double>> mGenPairs; |
@@ -629,7 +636,7 @@ FairGenerator * |
629 | 636 | } |
630 | 637 | model_pairs = isAlien[0] || isCCDB[0] ? local_names[0] : model_pairs; |
631 | 638 | model_compton = isAlien[1] || isCCDB[1] ? local_names[1] : model_compton; |
632 | | - auto generator = new o2::eventgen::GenTPCLoopers(model_pairs, model_compton, poisson, gauss, scaler_pair, scaler_compton); |
| 639 | + auto generator = new o2::eventgen::GenTPCLoopers_debug(model_pairs, model_compton, poisson, gauss, scaler_pair, scaler_compton); |
633 | 640 | generator->SetNLoopers(nloopers_pairs, nloopers_compton); |
634 | 641 | generator->SetMultiplier(mult); |
635 | 642 | return generator; |
@@ -700,7 +707,7 @@ Generator_TPCLoopersFlat(std::string model_pairs = "tpcloopmodel.onnx", std::str |
700 | 707 | } |
701 | 708 | model_pairs = isAlien[0] || isCCDB[0] ? local_names[0] : model_pairs; |
702 | 709 | model_compton = isAlien[1] || isCCDB[1] ? local_names[1] : model_compton; |
703 | | - auto generator = new o2::eventgen::GenTPCLoopers(model_pairs, model_compton, "", "", scaler_pair, scaler_compton); |
| 710 | + auto generator = new o2::eventgen::GenTPCLoopers_debug(model_pairs, model_compton, "", "", scaler_pair, scaler_compton); |
704 | 711 | generator->setFractionPairs(fraction_pairs); |
705 | 712 | generator->setFlatGas(flat_gas, loops_num, nloopers_orbit); |
706 | 713 | return generator; |
@@ -772,7 +779,7 @@ Generator_TPCLoopersOrbitRef(std::string model_pairs = "tpcloopmodel.onnx", std: |
772 | 779 | model_pairs = isAlien[0] || isCCDB[0] ? local_names[0] : model_pairs; |
773 | 780 | model_compton = isAlien[1] || isCCDB[1] ? local_names[1] : model_compton; |
774 | 781 | nclxrate = isAlien[2] || isCCDB[2] ? local_names[2] : nclxrate; |
775 | | - auto generator = new o2::eventgen::GenTPCLoopers(model_pairs, model_compton, "", "", scaler_pair, scaler_compton); |
| 782 | + auto generator = new o2::eventgen::GenTPCLoopers_debug(model_pairs, model_compton, "", "", scaler_pair, scaler_compton); |
776 | 783 | generator->SetRate(nclxrate, isPbPb, intrate); |
777 | 784 | // Adjust can be negative (-1 maximum) or positive to decrease or increase the number of loopers per orbit |
778 | 785 | generator->SetAdjust(adjust); |
|
0 commit comments