Skip to content

Commit c419989

Browse files
sawenzelclaude
andcommitted
Apply PAI in the TRD gas only with the energy-deposit charge
This moves the PAI model for the TRD gas from g4config.in to g4config_trd_pai.in, which g4Config.C applies only with TRDSimParams.ionisationModel=0. - ionisationModel=0 keeps the current production: energy deposit with PAI. - ionisationModel=1 runs without PAI, since the TRD collision model does not use the Geant4 energy loss in the gas. - A custom G4.configMacroFile is applied as before, without PAI lines added. - The README describes the two modes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent ad31f64 commit c419989

4 files changed

Lines changed: 34 additions & 6 deletions

File tree

‎Detectors/TRD/simulation/README.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,17 @@ o2-sim -m PIPE MAG TRD -n 1000 -g boxgen --configKeyValues 'BoxGun.pdg=211;BoxGu
2525
--configKeyValues 'TRDSimParams.doTR=false;TRDSimParams.maxMCStepSize=0.1'
2626
```
2727

28+
The charge of a hit in the gas comes from one of two models, selected with `TRDSimParams.ionisationModel`:
29+
- `0`: the Geant4 energy deposit in the gas divided by Wion. Geant4 then uses the PAI model in the TRD gas
30+
(`Detectors/gconfig/g4config_trd_pai.in`, applied by `g4Config.C`).
31+
- `1`: the TRD collision model (`src/IonisationModel.cxx`). Geant4 runs without PAI in the gas. The tables are made
32+
with `macros/makeIonisationTables.cxx` from Geant4's PAI cross-section, for the 10 keV delta-ray cut of the gas.
33+
Slow tracks keep the energy deposit.
34+
```
35+
--configKeyValues 'TRDSimParams.ionisationModel=1'
36+
```
37+
A custom `G4.configMacroFile` replaces `g4config.in` and the PAI file; it must contain the PAI lines itself if wanted.
38+
2839
# Generate Raw data from MonteCarlo:
2940

3041
```

‎Detectors/gconfig/g4Config.C‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ R__LOAD_LIBRARY(libgeant4vmc)
7272
#include "DetectorsBase/VMCSeederService.h"
7373
#include "CLHEP/Random/Random.h"
7474
#include "TRandom.h"
75+
#include "CommonUtils/ConfigurableParam.h"
76+
#include <boost/property_tree/ptree.hpp>
7577
#include "DetectorsBase/MTWorkerHooks.h"
7678
#include "G4RunManager.hh"
7779
#include "G4Threading.hh"
@@ -84,6 +86,16 @@ R__LOAD_LIBRARY(libgeant4vmc)
8486
// skips particles unknown to Geant4 (e.g. some ions) with a warning instead of a crash
8587
constexpr const char* kSkipUnknownParticles = "/mcPrimaryGenerator/skipUnknownParticles true";
8688

89+
// whether the TRD charge comes from the Geant4 energy deposit (TRDSimParams.ionisationModel=0), true without TRD
90+
bool trdUsesEnergyDeposit()
91+
{
92+
try {
93+
return o2::conf::ConfigurableParam::getValueAs<int>("TRDSimParams.ionisationModel") == 0;
94+
} catch (...) {
95+
return true;
96+
}
97+
}
98+
8799
// Configuration macro for Geant4 VirtualMC
88100
void Config()
89101
{
@@ -233,6 +245,11 @@ void Config()
233245
/// Customise Geant4 setting
234246
/// (verbose level, global range cut, ..)
235247
geant4->ProcessGeantMacro(configm1.Data());
248+
249+
// PAI in the TRD gas only when the TRD charge comes from the energy deposit
250+
if (trdUsesEnergyDeposit()) {
251+
geant4->ProcessGeantMacro((configm + "/Detectors/gconfig/g4config_trd_pai.in").Data());
252+
}
236253
}
237254
if (!mtMode) {
238255
geant4->ProcessGeantCommand(kSkipUnknownParticles);

‎Detectors/gconfig/g4config.in‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@
2828
/process/optical/cerenkov/setTrackSecondariesFirst false
2929
/mcMagField/stepperType NystromRK4
3030

31-
# PAI for TRD
32-
# Geant4 VMC >= v3.2
33-
/mcPhysics/emModel/setEmModel PAI
34-
/mcPhysics/emModel/setRegions TRD_Gas-mix
35-
/mcPhysics/emModel/setParticles e- e+ mu- mu+ pi- pi+ kaon- kaon+ proton anti_proton deuteron triton He3 alpha
36-
3731
#
3832
# Precise Msc for EMCAL
3933
#
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# PAI for the TRD gas, applied by g4Config.C only when the TRD charge comes from the Geant4
2+
# energy deposit (TRDSimParams.ionisationModel=0)
3+
# Geant4 VMC >= v3.2
4+
/mcPhysics/emModel/setEmModel PAI
5+
/mcPhysics/emModel/setRegions TRD_Gas-mix
6+
/mcPhysics/emModel/setParticles e- e+ mu- mu+ pi- pi+ kaon- kaon+ proton anti_proton deuteron triton He3 alpha

0 commit comments

Comments
 (0)