-
Notifications
You must be signed in to change notification settings - Fork 496
Expand file tree
/
Copy pathtrigger.macro
More file actions
45 lines (43 loc) · 1.38 KB
/
trigger.macro
File metadata and controls
45 lines (43 loc) · 1.38 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
#include "Generators/Trigger.h"
#include "TParticle.h"
#include <iostream>
// a very simple trigger example, examining generated particles
o2::eventgen::Trigger trigger()
{
//
return [](const std::vector<TParticle>& particles) -> bool {
std::cout << "Running trigger on event with size " << particles.size() << "\n";
if (particles.size() > 10000) {
return true;
}
return false;
};
}
#include "Pythia8/Pythia.h"
#include "Pythia8/HIInfo.h"
#include <fairlogger/Logger.h>
// a deep trigger example, looking into the internal generator state
o2::eventgen::DeepTrigger
trigger_impactb_pythia8(double bmin = 5., double bmax = 10.)
{
return [bmin, bmax](void* interface, std::string name) -> bool {
if (!name.compare("pythia8")) {
auto py8 = reinterpret_cast<Pythia8::Pythia*>(interface);
#if PYTHIA_VERSION_INTEGER < 8300
auto hiinfo = py8->info.hiinfo;
#else
auto hiinfo = py8->info.hiInfo;
#endif
if (!hiinfo) {
LOG(fatal) << "Cannot define impact parameter: is \'pythia8\' running in heavy-ion mode?";
}
auto b = hiinfo->b();
auto selected = (b > bmin && b < bmax);
LOG(info) << "Impact parameter = " << b << " fm: " << (selected ? "selected" : "rejected");
return selected;
} else {
LOG(fatal) << "Cannot define impact parameter for generator interface \'" << name << "\'";
}
return false;
};
}