Skip to content

Commit 2e58a85

Browse files
committed
Simulation example of multiplicity-triggered Pythia8
1 parent 4e1eef2 commit 2e58a85

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// multiplicity trigger
2+
//
3+
// usage: o2sim --trigger external --extTrgFile trigger_multiplicity.C
4+
// options: --extTrgFunc "trigger_multiplicity(-0.8, 0.8, 100)"
5+
//
6+
7+
/// \author R+Preghenella - February 2020
8+
9+
#include "Generators/Trigger.h"
10+
#include "TParticle.h"
11+
#include "TParticlePDG.h"
12+
13+
o2::eventgen::Trigger
14+
trigger_multiplicity(double etaMin = -0.8, double etaMax = 0.8, int minNch = 100)
15+
{
16+
auto trigger = [etaMin, etaMax, minNch](const std::vector<TParticle>& particles) -> bool {
17+
int nch = 0;
18+
for (const auto& particle : particles) {
19+
if (particle.GetStatusCode() != 1)
20+
continue;
21+
if (!particle.GetPDG())
22+
continue;
23+
if (particle.GetPDG()->Charge() == 0)
24+
continue;
25+
if (particle.Eta() < etaMin || particle.Eta() > etaMax)
26+
continue;
27+
nch++;
28+
}
29+
bool fired = nch >= minNch;
30+
return fired;
31+
};
32+
33+
return trigger;
34+
}
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_multiplicity.C
7+
funcName=trigger_multiplicity(-0.8, 0.8, 100)
8+
9+
### This part configures Pythia8
10+
11+
[GeneratorPythia8]
12+
config = ${O2DPG_ROOT}/MC/config/common/pythia8/generator/pythia8_inel.cfg
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 multiplicity trigger.
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_multiplicity.ini \
14+
> logsim 2>&1

0 commit comments

Comments
 (0)