From 9000e5d5519a1363cc6baab3e709a43f6ac9a145 Mon Sep 17 00:00:00 2001 From: Marco Giacalone Date: Tue, 25 Nov 2025 12:55:13 +0100 Subject: [PATCH 1/2] Corrected include folder --- Generators/CMakeLists.txt | 19 ++--- Generators/include/Generators/Generator.h | 5 +- .../include/{ => Generators}/TPCLoopers.h | 44 ++++++----- .../include/Generators/TPCLoopersParam.h | 35 ++++---- Generators/share/TPCLoopers/README.md | 79 +++++++++++++++++++ .../ScalerComptonParams.json | 0 .../ScalerPairParams.json | 0 .../gaussian_params.csv | 0 .../poisson_params.csv | 0 Generators/src/Generator.cxx | 28 ++++--- Generators/src/TPCLoopers.cxx | 40 +++++++--- 11 files changed, 172 insertions(+), 78 deletions(-) rename Generators/include/{ => Generators}/TPCLoopers.h (71%) create mode 100644 Generators/share/TPCLoopers/README.md rename Generators/share/{egconfig => TPCLoopers}/ScalerComptonParams.json (100%) rename Generators/share/{egconfig => TPCLoopers}/ScalerPairParams.json (100%) rename Generators/share/{egconfig => TPCLoopers}/gaussian_params.csv (100%) rename Generators/share/{egconfig => TPCLoopers}/poisson_params.csv (100%) diff --git a/Generators/CMakeLists.txt b/Generators/CMakeLists.txt index f1921b8d8d72a..287536ff118f7 100644 --- a/Generators/CMakeLists.txt +++ b/Generators/CMakeLists.txt @@ -41,8 +41,8 @@ o2_add_library(Generators src/GeneratorTParticleParam.cxx src/GeneratorService.cxx src/FlowMapper.cxx - $<$:src/TPCLoopers.cxx> - $<$:src/TPCLoopersParam.cxx> + src/TPCLoopers.cxx + src/TPCLoopersParam.cxx $<$:src/GeneratorPythia8.cxx> $<$:src/DecayerPythia8.cxx> $<$:src/GeneratorPythia8Param.cxx> @@ -55,7 +55,7 @@ o2_add_library(Generators PUBLIC_LINK_LIBRARIES FairRoot::Base O2::SimConfig O2::CommonUtils O2::DetectorsBase O2::ZDCBase O2::SimulationDataFormat ${pythiaTarget} ${hepmcTarget} FairRoot::Gen - $<$:onnxruntime::onnxruntime> + onnxruntime::onnxruntime TARGETVARNAME targetName) if(pythia_FOUND) @@ -66,9 +66,7 @@ if(HepMC3_FOUND) target_compile_definitions(${targetName} PUBLIC GENERATORS_WITH_HEPMC3) endif() -if(onnxruntime_FOUND) - target_compile_definitions(${targetName} PUBLIC GENERATORS_WITH_TPCLOOPERS) -endif() +target_compile_definitions(${targetName} PUBLIC GENERATORS_WITH_TPCLOOPERS) set(headers include/Generators/Generator.h @@ -95,11 +93,9 @@ set(headers include/Generators/FlowMapper.h ) -if(onnxruntime_FOUND) - list(APPEND headers - include/Generators/TPCLoopers.h - include/Generators/TPCLoopersParam.h) -endif() +list(APPEND headers + include/Generators/TPCLoopers.h + include/Generators/TPCLoopersParam.h) if(pythia_FOUND) list(APPEND headers @@ -171,4 +167,5 @@ endif() o2_data_file(COPY share/external DESTINATION Generators) o2_data_file(COPY share/egconfig DESTINATION Generators) +o2_data_file(COPY share/TPCLoopers DESTINATION Generators) o2_data_file(COPY share/pythia8 DESTINATION Generators) diff --git a/Generators/include/Generators/Generator.h b/Generators/include/Generators/Generator.h index 5a4921e036ca3..3484601aa42bb 100644 --- a/Generators/include/Generators/Generator.h +++ b/Generators/include/Generators/Generator.h @@ -17,7 +17,6 @@ #include "FairGenerator.h" #include "TParticle.h" #include "Generators/Trigger.h" -#include "CCDB/BasicCCDBManager.h" #ifdef GENERATORS_WITH_TPCLOOPERS #include "Generators/TPCLoopers.h" #include "Generators/TPCLoopersParam.h" @@ -172,8 +171,8 @@ class Generator : public FairGenerator #ifdef GENERATORS_WITH_TPCLOOPERS // Loopers generator instance - std::unique_ptr mLoopersGen = nullptr; - bool initLoopersGen(); + std::unique_ptr mTPCLoopersGen = nullptr; + bool initTPCLoopersGen(); #endif ClassDefOverride(Generator, 2); diff --git a/Generators/include/TPCLoopers.h b/Generators/include/Generators/TPCLoopers.h similarity index 71% rename from Generators/include/TPCLoopers.h rename to Generators/include/Generators/TPCLoopers.h index 57d178667b497..6a1d3ef262e22 100644 --- a/Generators/include/TPCLoopers.h +++ b/Generators/include/Generators/TPCLoopers.h @@ -17,21 +17,11 @@ #ifdef GENERATORS_WITH_TPCLOOPERS #include #endif -#include #include -#include #include -#include "CCDB/CCDBTimeStampUtils.h" -#include "CCDB/CcdbApi.h" -#include "DetectorsRaw/HBFUtils.h" #include "TRandom3.h" -#include "TDatabasePDG.h" #include -#include -#include "SimulationDataFormat/MCGenProperties.h" #include "TParticle.h" -#include "TF1.h" -#include #ifdef GENERATORS_WITH_TPCLOOPERS // Static Ort::Env instance for multiple onnx model loading @@ -39,6 +29,8 @@ extern Ort::Env global_env; // This class is responsible for loading the scaler parameters from a JSON file // and applying the inverse transformation to the generated data. +// Inferenced output is scaled (min-max normalization or robust scaling for outlier features) during training, +// so we need to revert this transformation to get physical values. struct Scaler { std::vector normal_min; std::vector normal_max; @@ -74,6 +66,20 @@ namespace eventgen { #ifdef GENERATORS_WITH_TPCLOOPERS +/** + * Generator for TPC Loopers based on pre-trained ONNX models. + * Currently it generates loopers as electron-positron pairs and Compton electrons + * according to specified distributions and parameters. + * This can be extended to other types of background processes in the future (e.g. slow neutron spallation products, saturation tail). + * Multiple configuration options are available: + * - Flat gas: loopers are generated uniformly per event taking a reference value which can be either the LHC orbit time or the average interaction time record interval from the collision context. + * ==> Current automatic setup (default) sets the interaction rate automatically from the collision context and the reference value per orbit is calculated from an external file. + * ==> Number of loopers per orbit can be adjusted via a specific parameter. + * - Poisson + Gaussian sampling: number of loopers are sampled from Poissonian (for pairs) and Gaussian (for Compton electrons) distributions based on provided parameters. + * ==> flat gas must be disabled to use this option. + * - Fixed number of loopers per event + * ==> flat gas must be disabled to use this option and Poissonian/Gaussian parameters file should be set to None + */ class GenTPCLoopers { public: @@ -83,7 +89,7 @@ class GenTPCLoopers Bool_t generateEvent(); - Bool_t generateEvent(double& time_limit); + Bool_t generateEvent(double time_limit); std::vector importParticles(); @@ -91,17 +97,17 @@ class GenTPCLoopers unsigned int GaussianElectrons(); - void SetNLoopers(unsigned int& nsig_pair, unsigned int& nsig_compton); + void SetNLoopers(unsigned int nsig_pair, unsigned int nsig_compton); - void SetMultiplier(std::array& mult); + void SetMultiplier(const std::array& mult); - void setFlatGas(Bool_t& flat, const Int_t& number, const Int_t& nloopers_orbit); + void setFlatGas(Bool_t flat, Int_t number = -1, Int_t nloopers_orbit = -1); - void setFractionPairs(float& fractionPairs); + void setFractionPairs(float fractionPairs); - void SetRate(const std::string& rateFile, const bool& isPbPb, const int& intRate); + void SetRate(const std::string& rateFile, bool isPbPb, int intRate = 50000); - void SetAdjust(const float& adjust); + void SetAdjust(float adjust = 0.f); unsigned int getNLoopers() const { return (mNLoopersPairs + mNLoopersCompton); } @@ -121,10 +127,6 @@ class GenTPCLoopers bool mGaussSet = false; // Random number generator TRandom3 mRandGen; - // Masses of the electrons and positrons - TDatabasePDG* mPDG = TDatabasePDG::Instance(); - double mMass_e = mPDG->GetParticle(11)->Mass(); - double mMass_p = mPDG->GetParticle(-11)->Mass(); int mCurrentEvent = 0; // Current event number, used for adaptive loopers TFile* mContextFile = nullptr; // Input collision context file o2::steer::DigitizationContext* mCollisionContext = nullptr; // Pointer to the digitization context diff --git a/Generators/include/Generators/TPCLoopersParam.h b/Generators/include/Generators/TPCLoopersParam.h index 49c8e5f5927b6..89d77e0a745ad 100644 --- a/Generators/include/Generators/TPCLoopersParam.h +++ b/Generators/include/Generators/TPCLoopersParam.h @@ -24,26 +24,27 @@ namespace eventgen /** ** a parameter class/struct to keep the settings of - ** the tpc loopers event-generator and + ** the TPC loopers event-generator and ** allow the user to modify them **/ struct GenTPCLoopersParam : public o2::conf::ConfigurableParamHelper { - bool loopersVeto = false; // if true, no loopers are generated - std::string model_pairs = "ccdb://Users/m/mgiacalo/WGAN_ExtGenPair"; // ONNX model for e+e- pair production - std::string model_compton = "ccdb://Users/m/mgiacalo/WGAN_ExtGenCompton"; // ONNX model for Compton scattering - std::string poisson = "${O2_ROOT}/share/Generators/egconfig/poisson_params.csv"; // file with Poissonian parameters - std::string gauss = "${O2_ROOT}/share/Generators/egconfig/gaussian_params.csv"; // file with Gaussian parameters - std::string scaler_pair = "${O2_ROOT}/share/Generators/egconfig/ScalerPairParams.json"; // file with scaler parameters for e+e- pair production - std::string scaler_compton = "${O2_ROOT}/share/Generators/egconfig/ScalerComptonParams.json"; // file with scaler parameters for Compton scattering - std::string nclxrate = "ccdb://Users/m/mgiacalo/ClustersTrackRatio"; // file with clusters/rate information per orbit - std::string colsys = "PbPb"; // collision system (PbPb or pp) - int intrate = -1; // Automatic IR from collision context if -1, else user-defined interaction rate in Hz - bool flat_gas = true; // if true, the gas density is considered flat in the TPC volume - unsigned int nFlatGasLoopers = 500; // number of loopers to be generated per event in case of flat gas [currently unused, kept for possible future debug developments] - float fraction_pairs = 0.08; // fraction of loopers [currently unused, kept for possible future debug developments] - float multiplier[2] = {1., 1.}; // multiplier for pairs and compton loopers for Poissonian and Gaussian sampling - unsigned int fixedNLoopers[2] = {1, 1}; // fixed number of loopers coming from pairs and compton electrons - valid if flat gas is false and both Poisson and Gaussian params files are empty - float adjust_flatgas = 0.f; // adjustment for the number of flat gas loopers per orbit (in percentage, e.g. -0.1 = -10%) [-1, inf)] + bool loopersVeto = false; // if true, no loopers are generated + // Current files are set to custom user CCDB paths, TO BE CHANGED + std::string model_pairs = "ccdb://Users/m/mgiacalo/WGAN_ExtGenPair"; // ONNX model for e+e- pair production + std::string model_compton = "ccdb://Users/m/mgiacalo/WGAN_ExtGenCompton"; // ONNX model for Compton scattering + std::string poisson = "${O2_ROOT}/share/Generators/TPCLoopers/poisson_params.csv"; // file with Poissonian parameters + std::string gauss = "${O2_ROOT}/share/Generators/TPCLoopers/gaussian_params.csv"; // file with Gaussian parameters + std::string scaler_pair = "${O2_ROOT}/share/Generators/TPCLoopers/ScalerPairParams.json"; // file with scaler parameters for e+e- pair production + std::string scaler_compton = "${O2_ROOT}/share/Generators/TPCLoopers/ScalerComptonParams.json"; // file with scaler parameters for Compton scattering + std::string nclxrate = "ccdb://Users/m/mgiacalo/ClustersTrackRatio"; // file with clusters/rate information per orbit + std::string colsys = "PbPb"; // collision system (PbPb or pp) + int intrate = -1; // Automatic IR from collision context if -1, else user-defined interaction rate in Hz + bool flat_gas = true; // if true, the gas density is considered flat in the TPC volume + unsigned int nFlatGasLoopers = 500; // number of loopers to be generated per event in case of flat gas [currently unused, kept for possible future debug developments] + float fraction_pairs = 0.08; // fraction of loopers [currently unused, kept for possible future debug developments] + float multiplier[2] = {1., 1.}; // multiplier for pairs and compton loopers for Poissonian and Gaussian sampling + unsigned int fixedNLoopers[2] = {1, 1}; // fixed number of loopers coming from pairs and compton electrons - valid if flat gas is false and both Poisson and Gaussian params files are empty + float adjust_flatgas = 0.f; // adjustment for the number of flat gas loopers per orbit (in percentage, e.g. -0.1 = -10%) [-1, inf)] O2ParamDef(GenTPCLoopersParam, "GenTPCLoopers"); }; diff --git a/Generators/share/TPCLoopers/README.md b/Generators/share/TPCLoopers/README.md new file mode 100644 index 0000000000000..0e88baf46e2a0 --- /dev/null +++ b/Generators/share/TPCLoopers/README.md @@ -0,0 +1,79 @@ +# TPC Loopers Generator - Parameter Files + +This directory contains parameter files used by the TPC Loopers event generator in ALICE O2. + +## Overview + +The TPC Loopers generator uses pre-trained ONNX models to generate realistic looper particles based on machine learning models trained on full GEANT4 slow neutron transport simulations. The parameter files in this directory provide: +- Example statistical distribution parameters for sampling the number of loopers per event +- **Mandatory** scaling parameters for transforming the ONNX model outputs to physical values + +## Files Description + +### Statistical Sampling Parameters + +The files provided in the folder are examples based on the training dataset. + +#### `gaussian_params.csv` +Parameters for Gaussian distribution used to sample the number of Compton electrons per event. + +**Format:** Four values (one per line) +1. Mean (μ) +2. Standard deviation (σ) +3. Minimum value +4. Maximum value + +#### `poisson_params.csv` +Parameters for Poisson distribution used to sample the number of electron-positron pairs per event. + +**Format:** Three values (one per line) +1. Lambda (λ) parameter +2. Minimum value +3. Maximum value + +### Scaler Parameters + +These JSON files contain the parameters for inverse transformation of the ONNX models output. They should be kept as they are +unless a new version of the models is released. + +#### `ScalerComptonParams.json` +Scaler parameters for Compton electron generation model. + +**Structure:** +```json +{ + "normal": { + "min": [array of 5 min values for min-max normalization], + "max": [array of 5 max values for min-max normalization] + }, + "outlier": { + "center": [array of 2 center values for robust scaling], + "scale": [array of 2 scale values for robust scaling] + } +} +``` + +- **normal**: Min-max normalization parameters for standard features (`Px`, `Py`, `Pz`, `VertexCoordinatesX`, `VertexCoordinatesY`) +- **outlier**: Robust scaler parameters (center and scale) for outlier features (`VertexCoordinatesZ`,`time`) + +#### `ScalerPairParams.json` +Scaler parameters for electron-positron pair generation model. + +**Structure:** +```json +{ + "normal": { + "min": [array of 8 min values for min-max normalization], + "max": [array of 8 max values for min-max normalization] + }, + "outlier": { + "center": [array of 2 center values for robust scaling], + "scale": [array of 2 scale values for robust scaling] + } +} +``` + +- **normal**: Min-max normalization parameters for standard features (`Px_e`, `Py_e`, `Pz_e`,`Px_p`, `Py_p`, `Pz_p`, `VertexCoordinatesX`, `VertexCoordinatesY`) +- **outlier**: Robust scaler parameters (center and scale) for outlier features (`VertexCoordinatesZ`,`time`) +--- +*Author: M. Giacalone - September 2025* diff --git a/Generators/share/egconfig/ScalerComptonParams.json b/Generators/share/TPCLoopers/ScalerComptonParams.json similarity index 100% rename from Generators/share/egconfig/ScalerComptonParams.json rename to Generators/share/TPCLoopers/ScalerComptonParams.json diff --git a/Generators/share/egconfig/ScalerPairParams.json b/Generators/share/TPCLoopers/ScalerPairParams.json similarity index 100% rename from Generators/share/egconfig/ScalerPairParams.json rename to Generators/share/TPCLoopers/ScalerPairParams.json diff --git a/Generators/share/egconfig/gaussian_params.csv b/Generators/share/TPCLoopers/gaussian_params.csv similarity index 100% rename from Generators/share/egconfig/gaussian_params.csv rename to Generators/share/TPCLoopers/gaussian_params.csv diff --git a/Generators/share/egconfig/poisson_params.csv b/Generators/share/TPCLoopers/poisson_params.csv similarity index 100% rename from Generators/share/egconfig/poisson_params.csv rename to Generators/share/TPCLoopers/poisson_params.csv diff --git a/Generators/src/Generator.cxx b/Generators/src/Generator.cxx index ce49254799587..465a8ffb7ee22 100644 --- a/Generators/src/Generator.cxx +++ b/Generators/src/Generator.cxx @@ -25,6 +25,8 @@ #include "TParticle.h" #include "TSystem.h" #include "TGrid.h" +#include "CCDB/BasicCCDBManager.h" +#include namespace o2 { @@ -50,7 +52,7 @@ Generator::Generator() : FairGenerator("ALICEo2", "ALICEo2 Generator"), if (transport) { bool tpcActive = (std::find(simConfig.getReadoutDetectors().begin(), simConfig.getReadoutDetectors().end(), "TPC") != simConfig.getReadoutDetectors().end()); if (tpcActive) { - if (initLoopersGen()) { + if (initTPCLoopersGen()) { mAddTPCLoopers = kTRUE; } } else { @@ -79,7 +81,7 @@ Generator::Generator(const Char_t* name, const Char_t* title) : FairGenerator(na if (transport) { bool tpcActive = (std::find(simConfig.getReadoutDetectors().begin(), simConfig.getReadoutDetectors().end(), "TPC") != simConfig.getReadoutDetectors().end()); if (tpcActive) { - if (initLoopersGen()) { + if (initTPCLoopersGen()) { mAddTPCLoopers = kTRUE; } } else { @@ -94,7 +96,7 @@ Generator::Generator(const Char_t* name, const Char_t* title) : FairGenerator(na /*****************************************************************/ #ifdef GENERATORS_WITH_TPCLOOPERS -bool Generator::initLoopersGen() +bool Generator::initTPCLoopersGen() { // Expand all environment paths const auto& loopersParam = o2::eventgen::GenTPCLoopersParam::Instance(); @@ -169,24 +171,24 @@ bool Generator::initLoopersGen() nclxrate = isAlien[2] || isCCDB[2] ? local_names[2] : nclxrate; try { // Create the TPC loopers generator with the provided parameters - mLoopersGen = std::make_unique(model_pairs, model_compton, poisson, gauss, scaler_pair, scaler_compton); + mTPCLoopersGen = std::make_unique(model_pairs, model_compton, poisson, gauss, scaler_pair, scaler_compton); const auto& intrate = loopersParam.intrate; // Configure the generator with flat gas loopers defined per orbit with clusters/track info // If intrate is negative (default), automatic IR from collisioncontext.root will be used if (flat_gas) { - mLoopersGen->SetRate(nclxrate, (colsys == "PbPb") ? true : false, intrate); - mLoopersGen->SetAdjust(loopersParam.adjust_flatgas); + mTPCLoopersGen->SetRate(nclxrate, (colsys == "PbPb") ? true : false, intrate); + mTPCLoopersGen->SetAdjust(loopersParam.adjust_flatgas); } else { // Otherwise, Poisson+Gauss sampling or fixed number of loopers per event will be used // Multiplier is applied only with distribution sampling // This configuration can be used for testing purposes, in all other cases flat gas is recommended - mLoopersGen->SetNLoopers(nLoopersPairs, nLoopersCompton); - mLoopersGen->SetMultiplier(multiplier); + mTPCLoopersGen->SetNLoopers(nLoopersPairs, nLoopersCompton); + mTPCLoopersGen->SetMultiplier(multiplier); } LOG(info) << "TPC Loopers generator initialized successfully"; } catch (const std::exception& e) { LOG(error) << "Failed to initialize TPC Loopers generator: " << e.what(); - mLoopersGen.reset(); + mTPCLoopersGen.reset(); } return kTRUE; } @@ -210,21 +212,21 @@ Bool_t { #ifdef GENERATORS_WITH_TPCLOOPERS if (mAddTPCLoopers) { - if (!mLoopersGen) { + if (!mTPCLoopersGen) { LOG(error) << "Loopers generator not initialized"; return kFALSE; } // Generate loopers using the initialized TPC loopers generator - if (!mLoopersGen->generateEvent()) { + if (!mTPCLoopersGen->generateEvent()) { LOG(error) << "Failed to generate loopers event"; return kFALSE; } - if (mLoopersGen->getNLoopers() == 0) { + if (mTPCLoopersGen->getNLoopers() == 0) { LOG(warning) << "No loopers generated for this event"; return kTRUE; } - const auto& looperParticles = mLoopersGen->importParticles(); + const auto& looperParticles = mTPCLoopersGen->importParticles(); if (looperParticles.empty()) { LOG(error) << "Failed to import loopers particles"; return kFALSE; diff --git a/Generators/src/TPCLoopers.cxx b/Generators/src/TPCLoopers.cxx index 8dff795de40a3..6e5af7c0c84d8 100644 --- a/Generators/src/TPCLoopers.cxx +++ b/Generators/src/TPCLoopers.cxx @@ -12,6 +12,16 @@ /// \author M+Giacalone - September 2025 #include "Generators/TPCLoopers.h" +#include "CCDB/CCDBTimeStampUtils.h" +#include "CCDB/CcdbApi.h" +#include "DetectorsRaw/HBFUtils.h" +#include "TF1.h" +#include +#include +#include "SimulationDataFormat/MCGenProperties.h" +#include +#include +#include "TDatabasePDG.h" // Static Ort::Env instance for multiple onnx model loading Ort::Env global_env(ORT_LOGGING_LEVEL_WARNING, "GlobalEnv"); @@ -46,10 +56,11 @@ std::vector Scaler::inverse_transform(const std::vector& input) { std::vector output; for (int i = 0; i < input.size(); ++i) { - if (i < input.size() - 2) + if (i < input.size() - 2) { output.push_back(input[i] * (normal_max[i] - normal_min[i]) + normal_min[i]); - else + } else { output.push_back(input[i] * outlier_scale[i - (input.size() - 2)] + outlier_center[i - (input.size() - 2)]); + } } return output; @@ -80,8 +91,9 @@ std::vector ONNXGenerator::generate_sample() // Generate a latent vector (z) std::vector z(100); - for (auto& v : z) + for (auto& v : z) { v = rand_gen.Gaus(0.0, 1.0); + } // Prepare input tensor std::vector input_shape = {1, 100}; @@ -227,7 +239,7 @@ Bool_t GenTPCLoopers::generateEvent() return true; } -Bool_t GenTPCLoopers::generateEvent(double& time_limit) +Bool_t GenTPCLoopers::generateEvent(double time_limit) { LOG(info) << "Time constraint for loopers: " << time_limit << " ns"; // Generate pairs @@ -253,6 +265,8 @@ Bool_t GenTPCLoopers::generateEvent(double& time_limit) std::vector GenTPCLoopers::importParticles() { std::vector particles; + const double mass_e = TDatabasePDG::Instance()->GetParticle(11)->Mass(); + const double mass_p = TDatabasePDG::Instance()->GetParticle(-11)->Mass(); // Get looper pairs from the event for (auto& pair : mGenPairs) { double px_e, py_e, pz_e, px_p, py_p, pz_p; @@ -268,8 +282,8 @@ std::vector GenTPCLoopers::importParticles() vy = pair[7]; vz = pair[8]; time = pair[9]; - e_etot = TMath::Sqrt(px_e * px_e + py_e * py_e + pz_e * pz_e + mMass_e * mMass_e); - p_etot = TMath::Sqrt(px_p * px_p + py_p * py_p + pz_p * pz_p + mMass_p * mMass_p); + e_etot = TMath::Sqrt(px_e * px_e + py_e * py_e + pz_e * pz_e + mass_e * mass_e); + p_etot = TMath::Sqrt(px_p * px_p + py_p * py_p + pz_p * pz_p + mass_p * mass_p); // Push the electron TParticle electron(11, 1, -1, -1, -1, -1, px_e, py_e, pz_e, e_etot, vx, vy, vz, time / 1e9); electron.SetStatusCode(o2::mcgenstatus::MCGenStatusEncoding(electron.GetStatusCode(), 0).fullEncoding); @@ -295,7 +309,7 @@ std::vector GenTPCLoopers::importParticles() vy = compton[4]; vz = compton[5]; time = compton[6]; - etot = TMath::Sqrt(px * px + py * py + pz * pz + mMass_e * mMass_e); + etot = TMath::Sqrt(px * px + py * py + pz * pz + mass_e * mass_e); // Push the electron TParticle electron(11, 1, -1, -1, -1, -1, px, py, pz, etot, vx, vy, vz, time / 1e9); electron.SetStatusCode(o2::mcgenstatus::MCGenStatusEncoding(electron.GetStatusCode(), 0).fullEncoding); @@ -329,7 +343,7 @@ unsigned int GenTPCLoopers::GaussianElectrons() return gaussValue; } -void GenTPCLoopers::SetNLoopers(unsigned int& nsig_pair, unsigned int& nsig_compton) +void GenTPCLoopers::SetNLoopers(unsigned int nsig_pair, unsigned int nsig_compton) { if (mFlatGas) { mNLoopersPairs = nsig_pair; @@ -348,7 +362,7 @@ void GenTPCLoopers::SetNLoopers(unsigned int& nsig_pair, unsigned int& nsig_comp } } -void GenTPCLoopers::SetMultiplier(std::array& mult) +void GenTPCLoopers::SetMultiplier(const std::array& mult) { // Multipliers will work only if the poissonian and gaussian parameters are set // otherwise they will be ignored @@ -362,7 +376,7 @@ void GenTPCLoopers::SetMultiplier(std::array& mult) } } -void GenTPCLoopers::setFlatGas(Bool_t& flat, const Int_t& number = -1, const Int_t& nloopers_orbit = -1) +void GenTPCLoopers::setFlatGas(Bool_t flat, Int_t number, Int_t nloopers_orbit) { mFlatGas = flat; if (mFlatGas) { @@ -408,7 +422,7 @@ void GenTPCLoopers::setFlatGas(Bool_t& flat, const Int_t& number = -1, const Int LOG(info) << "Flat gas loopers: " << (mFlatGas ? "ON" : "OFF") << ", Reference loopers number per " << (mFlatGasOrbit ? "orbit " : "event ") << mFlatGasNumber; } -void GenTPCLoopers::setFractionPairs(float& fractionPairs) +void GenTPCLoopers::setFractionPairs(float fractionPairs) { if (fractionPairs < 0 || fractionPairs > 1) { LOG(fatal) << "Error: Loops fraction for pairs must be in the range [0, 1]."; @@ -418,7 +432,7 @@ void GenTPCLoopers::setFractionPairs(float& fractionPairs) LOG(info) << "Pairs fraction set to: " << mLoopsFractionPairs; } -void GenTPCLoopers::SetRate(const std::string& rateFile, const bool& isPbPb = true, const int& intRate = 50000) +void GenTPCLoopers::SetRate(const std::string& rateFile, bool isPbPb = true, int intRate) { // Checking if the rate file exists and is not empty TFile rate_file(rateFile.c_str(), "READ"); @@ -459,7 +473,7 @@ void GenTPCLoopers::SetRate(const std::string& rateFile, const bool& isPbPb = tr } } -void GenTPCLoopers::SetAdjust(const float& adjust = 0.f) +void GenTPCLoopers::SetAdjust(float adjust) { if (mFlatGas && mFlatGasOrbit && adjust >= -1.f && adjust != 0.f) { LOG(info) << "Adjusting flat gas number per orbit by " << adjust * 100.f << "%"; From 6bcab66ccb5ba46188702eccfb0291c6d17ecc17 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Wed, 3 Dec 2025 16:31:04 +0000 Subject: [PATCH 2/2] Please consider the following formatting changes --- Generators/include/Generators/TPCLoopersParam.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Generators/include/Generators/TPCLoopersParam.h b/Generators/include/Generators/TPCLoopersParam.h index 89d77e0a745ad..87e4510d6e617 100644 --- a/Generators/include/Generators/TPCLoopersParam.h +++ b/Generators/include/Generators/TPCLoopersParam.h @@ -28,7 +28,7 @@ namespace eventgen ** allow the user to modify them **/ struct GenTPCLoopersParam : public o2::conf::ConfigurableParamHelper { - bool loopersVeto = false; // if true, no loopers are generated + bool loopersVeto = false; // if true, no loopers are generated // Current files are set to custom user CCDB paths, TO BE CHANGED std::string model_pairs = "ccdb://Users/m/mgiacalo/WGAN_ExtGenPair"; // ONNX model for e+e- pair production std::string model_compton = "ccdb://Users/m/mgiacalo/WGAN_ExtGenCompton"; // ONNX model for Compton scattering