-
Notifications
You must be signed in to change notification settings - Fork 496
Expand file tree
/
Copy pathtrigger_multiplicity.C
More file actions
33 lines (29 loc) · 932 Bytes
/
trigger_multiplicity.C
File metadata and controls
33 lines (29 loc) · 932 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// multiplicity trigger
//
// usage: o2sim --trigger external --configKeyValues 'TriggerExternal.fileName=trigger_multiplicity.C;TriggerExternal.funcName="trigger_multiplicity(-0.8, 0.8, 100)"'
//
/// \author R+Preghenella - February 2020
#include "Generators/Trigger.h"
#include "TParticle.h"
#include "TParticlePDG.h"
o2::eventgen::Trigger
trigger_multiplicity(double etaMin = -0.8, double etaMax = 0.8, int minNch = 100)
{
auto trigger = [etaMin, etaMax, minNch](const std::vector<TParticle>& particles) -> bool {
int nch = 0;
for (const auto& particle : particles) {
if (particle.GetStatusCode() != 1)
continue;
if (!particle.GetPDG())
continue;
if (particle.GetPDG()->Charge() == 0)
continue;
if (particle.Eta() < etaMin || particle.Eta() > etaMax)
continue;
nch++;
}
bool fired = nch >= minNch;
return fired;
};
return trigger;
}