Skip to content

Commit 390aa1a

Browse files
committed
Simulation example of MPI-triggered Pythia8
1 parent c582705 commit 390aa1a

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// MPI trigger
2+
//
3+
// usage: o2sim --trigger external --configKeyValues 'TriggerExternal.fileName=trigger_mpi.C;TriggerExternal.funcName="trigger_mpi()"'
4+
//
5+
6+
/// \author R+Preghenella - February 2020
7+
8+
#include "Generators/Trigger.h"
9+
#include "Pythia8/Pythia.h"
10+
#include "TPythia6.h"
11+
#include "FairLogger.h"
12+
13+
o2::eventgen::DeepTrigger
14+
trigger_mpi(int mpiMin = 15)
15+
{
16+
return [mpiMin](void* interface, std::string name) -> bool {
17+
int nMPI = 0;
18+
if (!name.compare("pythia8")) {
19+
auto py8 = reinterpret_cast<Pythia8::Pythia*>(interface);
20+
nMPI = py8->info.nMPI();
21+
} else if (!name.compare("pythia6")) {
22+
auto py6 = reinterpret_cast<TPythia6*>(interface);
23+
nMPI = py6->GetMSTI(31);
24+
} else
25+
LOG(FATAL) << "Cannot define MPI for generator interface \'" << name << "\'";
26+
return nMPI >= mpiMin;
27+
};
28+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
### The setup uses an external even generator trigger which is
2+
### defined in the following file and it is retrieved and configured
3+
### according to the specified function call
4+
5+
[TriggerExternal]
6+
fileName=${O2DPG_ROOT}/MC/config/common/external/trigger/trigger_mpi.C
7+
funcName=trigger_mpi(10)
8+
9+
### This part configures Pythia8
10+
11+
[GeneratorPythia8]
12+
config = ${O2DPG_ROOT}/MC/config/common/pythia8/generator/pythia8_inel.cfg

MC/run/examples/trigger_mpi.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
3+
### This script run the simulation of Pythia8 pp INEL events with a trigger on number of MPI.
4+
### The details of the configuration are defined in the INI config files (--configFile).
5+
6+
set -x
7+
8+
MODULES="PIPE ITS TPC"
9+
EVENTS=20
10+
NWORKERS=8
11+
12+
o2-sim -j ${NWORKERS} -n ${EVENTS} -g pythia8 -m ${MODULES} -o sim \
13+
--configFile ${O2DPG_ROOT}/MC/config/examples/ini/trigger_mpi.ini \
14+
> logsim 2>&1

0 commit comments

Comments
 (0)