Skip to content

Commit

Permalink
pythia8 generator flag will start empty pythia8 config, make sure you…
Browse files Browse the repository at this point in the history
… configure it
  • Loading branch information
preghenella authored and sawenzel committed Jun 2, 2021
1 parent aa27448 commit 8baef2f
Show file tree
Hide file tree
Showing 14 changed files with 28 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Detectors/FIT/FT0/reconstruction/src/test-raw2digit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ int main()
}
};
std::vector<EventFT0_t> vecTotalEvents, vecTotalEvents2;
gSystem->Exec("$O2_ROOT/bin/o2-sim -n 10 -m FT0 -g pythia8");
gSystem->Exec("$O2_ROOT/bin/o2-sim -n 10 -m FT0 -g pythia8pp");
gSystem->Exec("$O2_ROOT/bin/o2-sim-digitizer-workflow -b");
TFile flIn("ft0digits.root");
std::unique_ptr<TTree> treeInput((TTree*)flIn.Get("o2sim"));
Expand Down
4 changes: 2 additions & 2 deletions Detectors/FIT/benchmark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ To obtain plots of (FairMQ) devices operating in the simulation you will have to

e.g. if you wish to monitor 50 pp (pythia) events with Geant3 as the VMC backend using the FIT detector and utilizing parallel mode with 2 simulation workers AND keep track of FairMQ devices, you can do:

`$> ./monitor.sh o2-sim -g pythia8 -e TGeant3 -m FV0 FT0 FDD -j 2 -n 50 | tee o2sim.log`
`$> ./monitor.sh o2-sim -g pythia8pp -e TGeant3 -m FV0 FT0 FDD -j 2 -n 50 | tee o2sim.log`

---

Expand All @@ -40,7 +40,7 @@ The monitored data has to be processed as:

This will generate an output:

```Your command was: o2-sim -g pythia8 -e TGeant3 -m FV0 FT0 FDD -j 2 -n 50
```Your command was: o2-sim -g pythia8pp -e TGeant3 -m FV0 FT0 FDD -j 2 -n 50
You have monitored o2 simulation in parallel.
********************************
Expand Down
2 changes: 1 addition & 1 deletion Detectors/TRD/workflow/test/run_trivial_trapsimulator.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#! /bin/bash

o2-sim -n 10 -g pythia8 --skipModules ZDC > o2sim.log
o2-sim -n 10 -g pythia8pp --skipModules ZDC > o2sim.log
o2-sim-digitizer-workflow -b --onlyDET TRD > o2digitizer.log
o2-trd-trap-sim -b >trapsim.log
2 changes: 1 addition & 1 deletion Generators/share/egconfig/pythia8_userhooks_charm.C
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Pythia8 UserHooks
//
// usage: o2sim -g pythia8 --configKeyValues "GeneratorPythia8.hooksFileName=pythia8_userhooks_charm.C"
// usage: o2sim -g pythia8pp --configKeyValues "GeneratorPythia8.hooksFileName=pythia8_userhooks_charm.C"
//
/// \author R+Preghenella - February 2020

Expand Down
10 changes: 8 additions & 2 deletions Generators/src/GeneratorFactory.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ void GeneratorFactory::setPrimaryGenerator(o2::conf::SimConfig const& conf, Fair
#ifdef GENERATORS_WITH_PYTHIA8
auto makePythia8Gen = [](std::string& config) {
auto gen = new o2::eventgen::GeneratorPythia8();
LOG(INFO) << "Reading \'Pythia8\' base configuration: " << config << std::endl;
gen->readFile(config);
if (!config.empty()) {
LOG(INFO) << "Reading \'Pythia8\' base configuration: " << config << std::endl;
gen->readFile(config);
}
auto seed = (gRandom->GetSeed() % 900000000);
LOG(INFO) << "Using random seed from gRandom % 900000000: " << seed;
gen->readString("Random:setSeed on");
Expand Down Expand Up @@ -183,6 +185,10 @@ void GeneratorFactory::setPrimaryGenerator(o2::conf::SimConfig const& conf, Fair
auto muon = makeBoxGen(13, 100, -2.5, -4.0, 100, 100, 0., 360);
primGen->AddGenerator(muon);
} else if (genconfig.compare("pythia8") == 0) {
auto py8config = std::string();
auto py8 = makePythia8Gen(py8config);
primGen->AddGenerator(py8);
} else if (genconfig.compare("pythia8pp") == 0) {
auto py8config = std::string(std::getenv("O2_ROOT")) + "/share/Generators/egconfig/pythia8_inel.cfg";
auto py8 = makePythia8Gen(py8config);
primGen->AddGenerator(py8);
Expand Down
14 changes: 7 additions & 7 deletions doc/DetectorSimulation.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The purpose of the `o2-sim` executable is to simulate the passage of particles e
## Usage overview
* **Quick start example:** A typical (exemplary) invocation is of the form

```o2-sim -n 10 -g pythia8 -e TGeant4 -j 2 --skipModules ZDC,PHS```
```o2-sim -n 10 -g pythia8pp -e TGeant4 -j 2 --skipModules ZDC,PHS```

which would launch a simulation for 10 pythia8 events on the whole ALICE detector but ZDC and PHOS, using Geant4 on 2 parallel worker processes.
* **Generated output**: The simulation creates the following output files:
Expand All @@ -55,7 +55,7 @@ The purpose of the `o2-sim` executable is to simulate the passage of particles e
| --------------------- | -------------------------------------------------------------------------------------- |
| -h,--help | Prints the list of possible command line options and their default values. |
| -n,--number | The number of events to simulate. |
| -g,--generator | name of a predefined generator template to use (such as pythia8, pythia8hi). Configuration of generations is explained in a dedicated section. |
| -g,--generator | name of a predefined generator template to use (such as pythia8pp, pythia8hi). Configuration of generations is explained in a dedicated section. |
| -e,--engine | Select the VMC transport engine (TGeant4, TGeant3). |
| -m,--modules | List of modules/geometries to include (default is ALL); example -m PIPE ITS TPC |
| -j,--nworkers | Number of parallel simulation engine workers (default is half the number of hyperthread CPU cores) |
Expand Down Expand Up @@ -120,7 +120,7 @@ o2-sim -m PIPE ITS MFT -e TGeant3 -g boxgen -n 10 --configKeyValues 'BoxGun.pdg=
Configures pythia8 for min.bias pp collisions at 14 TeV

```
o2-sim -m PIPE ITS MFT -g pythia8 -n 50
o2-sim -m PIPE ITS MFT -g pythia8pp -n 50
```

[Describe in detail the environment variables]
Expand Down Expand Up @@ -181,13 +181,13 @@ All event generator interfaces that comply with the `o2::eventgen::Generator` pr
A basic 'particle trigger' is implemented in the `o2::eventgen` core and allows the user to define a trigger particle.
The definitions of the trigger particle can be expressed via command line arguments
```
o2-sim -g pythia8 -t particle --configKeyValues "TriggerParticle.pdg=333;TriggerParticle.ptMin=5.;TriggerParticle.yMin=-0.5;TriggerParticle.yMax=0.5"
o2-sim -g pythia8pp -t particle --configKeyValues "TriggerParticle.pdg=333;TriggerParticle.ptMin=5.;TriggerParticle.yMin=-0.5;TriggerParticle.yMax=0.5"
```

Custom triggers can also be constructed by the user to provide unlimited flexibility in the trigger needs.
An external trigger function can be specified via command line arguments
```
o2-sim -g pythia8 -t external --configKeyValues 'TriggerExternal.fileName=path_to_trigger_macro.C;TriggerExternal.funcName="the_function(some, parameters)"'
o2-sim -g pythia8pp -t external --configKeyValues 'TriggerExternal.fileName=path_to_trigger_macro.C;TriggerExternal.funcName="the_function(some, parameters)"'
```
The function must comply with a simple protocol and return a lambda function defined as follows
```
Expand All @@ -205,7 +205,7 @@ To allow users to define triggers that go beyond the particle stack generated by
This allows the user to go deep into the core of the event generator, whenever this is possible.
For this reason, this is called a 'DeepTrigger'. A 'DeepTrigger' is attached to the simulation in the same way as a normal trigger
```
o2-sim -g pythia8 -t external --configKeyValues 'TriggerExternal.fileName=path_to_deep_trigger_macro.C;TriggerExternal.funcName="the_deep_function(some, parameters)"'
o2-sim -g pythia8pp -t external --configKeyValues 'TriggerExternal.fileName=path_to_deep_trigger_macro.C;TriggerExternal.funcName="the_deep_function(some, parameters)"'
```
In this case the function must comply with a similar, but different protocol than before and return a lambda function defined as follows
``` o2::eventgen::DeepTrigger the_deep_function()
Expand Down Expand Up @@ -258,7 +258,7 @@ This functionality might be of use for users who want to be able to steer the ev
An example of a configuration macro is this one

```
// usage: o2sim -g pythia8 --configKeyValues "GeneratorPythia8.hooksFileName=pythia8_userhooks_charm.C"
// usage: o2sim -g pythia8pp --configKeyValues "GeneratorPythia8.hooksFileName=pythia8_userhooks_charm.C"
#include "Generators/Trigger.h"
#include "Pythia8/Pythia.h"
Expand Down
2 changes: 1 addition & 1 deletion run/SimExamples/Inspect_Hits/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ for I in $(seq -w 1 $NRUNS); do
cp secondary_and_hits.macro $DIR/.
cd $DIR
echo " --- starting run $I"
o2-sim -j $NJOBS -n $NEVENTS -e $GEANT -g pythia8 --skipModules ZDC --configKeyValues "Stack.pruneKine=false" &> o2-sim.log
o2-sim -j $NJOBS -n $NEVENTS -e $GEANT -g pythia8pp --skipModules ZDC --configKeyValues "Stack.pruneKine=false" &> o2-sim.log

root -b -q -l "primary_and_hits.macro(\"o2sim_Kine.root\", \"barrel\")" &
root -b -q -l "primary_and_hits.macro(\"o2sim_Kine.root\", \"muon\")" &
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Pythia8 UserHooks
//
// usage: o2sim -g pythia8 --configKeyValues "GeneratorPythia8.hooksFileName=pythia8_userhooks_jets.C"
// usage: o2sim -g pythia8pp --configKeyValues "GeneratorPythia8.hooksFileName=pythia8_userhooks_jets.C"
//
/// \author R+Preghenella - April 2020

Expand Down
2 changes: 1 addition & 1 deletion run/SimExamples/Jet_Embedding_Pythia8/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ o2-sim -j 20 -n ${NBGR} -g pythia8hi -m PIPE ITS TPC -o bkg --configKeyValues \
# produce hard jets using a pythia8 configuration given in a file 'pythia8_hard.cfg'; event selection is done by a user hook specified
# in file 'pythia8_userhooks_jets.macro' and using same vertex setting as background events (via --embedInto)
NSGN=10
o2-sim -j 20 -n ${NSGN} -g pythia8 -m PIPE ITS TPC --configKeyValues "GeneratorPythia8.config=pythia8_hard.cfg;GeneratorPythia8.hooksFileName=pythia8_userhooks_jets.macro" --embedIntoFile bkg_Kine.root -o sgn > logsgn 2>&1
o2-sim -j 20 -n ${NSGN} -g pythia8pp -m PIPE ITS TPC --configKeyValues "GeneratorPythia8.config=pythia8_hard.cfg;GeneratorPythia8.hooksFileName=pythia8_userhooks_jets.macro" --embedIntoFile bkg_Kine.root -o sgn > logsgn 2>&1

# PART c)
# digitization with summation of signal on top of background events
Expand Down
2 changes: 1 addition & 1 deletion run/SimExamples/JustPrimaryKinematics/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# tight geometry cuts so that Geant will not do work.

# first stage --> produce events using Pythia8 (no transport)
o2-sim -n 10 -g pythia8 -m CAVE --configFile only_primarykine.ini
o2-sim -n 10 -g pythia8pp -m CAVE --configFile only_primarykine.ini

# second stage --> read back events from O2 kine (no transport)
o2-sim -n 10 -g extkinO2 --extKinFile o2sim_Kine.root -m CAVE --configFile only_primarykine.ini -o o2sim2
Expand Down
2 changes: 1 addition & 1 deletion run/SimExamples/Selective_Transport/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ MODULES="PIPE ITS TPC"
EVENTS=100
NWORKERS=8

o2-sim -j ${NWORKERS} -n ${EVENTS} -g pythia8 -m ${MODULES} -o step1 \
o2-sim -j ${NWORKERS} -n ${EVENTS} -g pythia8pp -m ${MODULES} -o step1 \
--configFile sim.ini \
> logstep1 2>&1

2 changes: 1 addition & 1 deletion run/SimExamples/Selective_Transport_pi0/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ NWORKERS=1

### step 1

o2-sim -j ${NWORKERS} -n ${NEVENTS1} -g pythia8 -m ${MODULES} -o step1 \
o2-sim -j ${NWORKERS} -n ${NEVENTS1} -g pythia8pp -m ${MODULES} -o step1 \
--configFile sim_step1.ini --seed 73141128

### step 2
Expand Down
2 changes: 1 addition & 1 deletion run/SimExamples/StepMonitoring/Simple1/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# alienv enter O2/latest MCStepLogger/latest

# This demonstrates the most basic usage of the steplogger
LD_PRELOAD=$MCSTEPLOGGER_ROOT/lib/libMCStepLoggerIntercept.so o2-sim-serial -n 1 -g pythia8 -m PIPE ITS TPC
LD_PRELOAD=$MCSTEPLOGGER_ROOT/lib/libMCStepLoggerIntercept.so o2-sim-serial -n 1 -g pythia8pp -m PIPE ITS TPC
2 changes: 1 addition & 1 deletion run/startSim.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ killall -9 o2-sim-hit-merger-runner
topologyfile=${O2_ROOT}/share/config/o2simtopology.json

# we have one primary distributor
xterm -geometry 80x25+0+0 -e "o2-sim-primary-server-device-runner --control static --id primary-server --mq-config ${topologyfile} -n 20 -m PIPE TOF TRD TPC PHS EMC FIT MCH -g pythia8 -e TGeant3 | tee serverlog;bash" &
xterm -geometry 80x25+0+0 -e "o2-sim-primary-server-device-runner --control static --id primary-server --mq-config ${topologyfile} -n 20 -m PIPE TOF TRD TPC PHS EMC FIT MCH -g pythia8pp -e TGeant3 | tee serverlog;bash" &

for i in `seq 1 ${NSIMWORKERS}`; do
xterm -geometry 80x25+500+0 -e "o2-sim-device-runner --control static --id worker${i} --config-key worker --mq-config ${topologyfile} --severity info | tee simlog${i};bash" &
Expand Down

0 comments on commit 8baef2f

Please sign in to comment.