Skip to content

Commit 5d14848

Browse files
authored
Make the non-prompt injection ratio configurable also for p-O
Following the commit for O-O (see c53f5cd) from donglovo, the non-prompt injection ratio has now also made configurable for the p-O case. I copy here below the description from the commit above, as this one is identical: * Set the non-prompt injection ratio to 2 Change the default injection ratio from 5 to 2 for the non-prompt gap-triggered generators, corresponding to one injected signal event every two generated events. * Allow input trigger ratio configuration via environment variable Read INPUT_TRIGGER_RATIO from the environment and use it to override the default input trigger ratio. Fall back to the constructor default when the variable is unset or invalid.
1 parent e4a7c3d commit 5d14848

1 file changed

Lines changed: 25 additions & 2 deletions

File tree

MC/config/PWGDQ/external/generator/generator_pythia8_NonPromptSignals_pO_gaptriggered_dq.C

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,33 @@ class GeneratorPythia8NonPromptInjectedpOGapTriggeredDQ : public o2::eventgen::G
1919
public:
2020

2121
/// constructor
22-
GeneratorPythia8NonPromptInjectedpOGapTriggeredDQ(int inputTriggerRatio = 5) {
22+
GeneratorPythia8NonPromptInjectedpOGapTriggeredDQ(int inputTriggerRatio = 2) {
2323

2424
mGeneratedEvents = 0;
25-
mInverseTriggerRatio = inputTriggerRatio;
25+
mInverseTriggerRatio = inputTriggerRatio;
26+
27+
// Read INPUT_TRIGGER_RATIO from the shell environment.
28+
// If it is not defined, keep the default constructor value.
29+
const char* envTriggerRatio = gSystem->Getenv("INPUT_TRIGGER_RATIO");
30+
31+
if (envTriggerRatio && envTriggerRatio[0] != '\0') {
32+
const int valueFromEnv = TString(envTriggerRatio).Atoi();
33+
34+
if (valueFromEnv > 0) {
35+
inputTriggerRatio = valueFromEnv;
36+
} else {
37+
printf(
38+
"WARNING: invalid INPUT_TRIGGER_RATIO=%s, using default value %d\n",
39+
envTriggerRatio,
40+
inputTriggerRatio);
41+
}
42+
}
43+
44+
mGeneratedEvents = 0;
45+
mInverseTriggerRatio = inputTriggerRatio;
46+
47+
printf("Input trigger ratio: %d\n", mInverseTriggerRatio);
48+
2649
// define minimum bias event generator
2750
auto seed = (gRandom->TRandom::GetSeed() % 900000000);
2851
TString pathconfigMB = gSystem->ExpandPathName("${O2DPG_MC_CONFIG_ROOT}/MC/config/common/pythia8/generator/pythia8_pO_961.cfg");

0 commit comments

Comments
 (0)