Skip to content

Conversation

@jackal1-66
Copy link
Collaborator

TPC loopers are currently injected via an O2DPG external generator by creating a cocktail. This development feeds them automatically in case the TPC detector is used and transported. A collisioncontext.root file is mandatory, otherwise the loopers will be automatically turned off. In addition the GenTPCLoopers.loopersVeto parameter has been introduced to forcefully turn off the injection. This PR is linked to AliceO2Group/O2DPG#2191, in which the collision system is automatically fed to the sgnsim step

@jackal1-66 jackal1-66 requested a review from sawenzel as a code owner November 25, 2025 07:46
@github-actions
Copy link
Contributor

REQUEST FOR PRODUCTION RELEASES:
To request your PR to be included in production software, please add the corresponding labels called "async-" to your PR. Add the labels directly (if you have the permissions) or add a comment of the form (note that labels are separated by a ",")

+async-label <label1>, <label2>, !<label3> ...

This will add <label1> and <label2> and removes <label3>.

The following labels are available
async-2023-pbpb-apass4
async-2023-pp-apass4
async-2024-pp-apass1
async-2022-pp-apass7
async-2024-pp-cpass0
async-2024-PbPb-apass1
async-2024-ppRef-apass1
async-2024-PbPb-apass2
async-2023-PbPb-apass5

@alibuild
Copy link
Collaborator

Error while checking build/O2/fullCI_slc9 for 797f283 at 2025-11-25 09:12:

## sw/BUILD/O2-latest/log
CMake Error at cmake/AddRootDictionary.cmake:91 (message):

Full log here.

@alibuild
Copy link
Collaborator

alibuild commented Nov 25, 2025

Error while checking build/O2/fullCI_slc9 for 76f9996 at 2025-12-03 15:26:

## sw/BUILD/o2checkcode-latest/log
--
========== List of errors found ==========
++ GRERR=0
++ grep -v clang-diagnostic-error error-log.txt
++ grep ' error:'
/sw/SOURCES/O2/14851-slc9_x86-64/0/Generators/src/TPCLoopers.cxx:49:30: error: statement should be inside braces [readability-braces-around-statements]
/sw/SOURCES/O2/14851-slc9_x86-64/0/Generators/src/TPCLoopers.cxx:51:9: error: statement should be inside braces [readability-braces-around-statements]
/sw/SOURCES/O2/14851-slc9_x86-64/0/Generators/src/TPCLoopers.cxx:83:20: error: statement should be inside braces [readability-braces-around-statements]
++ [[ 0 == 0 ]]
++ exit 1
--

Full log here.

src/GeneratorTParticleParam.cxx
src/GeneratorService.cxx
src/FlowMapper.cxx
$<$<BOOL:${onnxruntime_FOUND}>:src/TPCLoopers.cxx>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If think we always have onnxruntime. It's specified as requirement in alidist/o2.sh; So I would not make it a conditional compile and this will also make the code cleaner (less #ifdefs)

#include "FairGenerator.h"
#include "TParticle.h"
#include "Generators/Trigger.h"
#include "CCDB/BasicCCDBManager.h"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only include headers in headers if it cannot be avoided. Better to include in source file.


#ifdef GENERATORS_WITH_TPCLOOPERS
// Loopers generator instance
std::unique_ptr<o2::eventgen::GenTPCLoopers> mLoopersGen = nullptr;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in general, I would suggest to be (consistently) more specific. Sometimes we say "TPCLoopers" ... sometimes just "mLoopers". I think it would be good to always put TPC in the name. So mLoopersGen --> mTPCLoopersGen and the same for the functions.

#include "TDatabasePDG.h"
#include <SimulationDataFormat/DigitizationContext.h>
#include <SimulationDataFormat/ParticleStatus.h>
#include "SimulationDataFormat/MCGenProperties.h"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please reduce this include list to a minimum and prefer inclusion where they are used (in the source).

{

#ifdef GENERATORS_WITH_TPCLOOPERS
class GenTPCLoopers
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a small doxygen style class description would be good

// Random number generator
TRandom3 mRandGen;
// Masses of the electrons and positrons
TDatabasePDG* mPDG = TDatabasePDG::Instance();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this pointer as a member function?

// Masses of the electrons and positrons
TDatabasePDG* mPDG = TDatabasePDG::Instance();
double mMass_e = mPDG->GetParticle(11)->Mass();
double mMass_p = mPDG->GetParticle(-11)->Mass();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here. These are rather constants. Probably no need to have them as class member variables.

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preferably avoid user-paths. (We might put it under TPC detector). What is this object in any case?


// Generate a latent vector (z)
std::vector<float> z(100);
for (auto& v : z)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add {} bodies here and in a few other places (FullCI is failing).

return true;
}

Bool_t GenTPCLoopers::generateEvent(double& time_limit)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you need double& (reference) ?

return gaussValue;
}

void GenTPCLoopers::SetNLoopers(unsigned int& nsig_pair, unsigned int& nsig_compton)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer passing constant pod args as non-reference

}
}

void GenTPCLoopers::SetMultiplier(std::array<float, 2>& mult)
Copy link
Collaborator

@sawenzel sawenzel Nov 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const std::array & ?

}
}

void GenTPCLoopers::setFlatGas(Bool_t& flat, const Int_t& number = -1, const Int_t& nloopers_orbit = -1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dito

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default args are normally only specific in the function declaration

@jackal1-66
Copy link
Collaborator Author

I implemented all the comments and retested the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants