We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d0435c1 commit 6674f1fCopy full SHA for 6674f1f
1 file changed
MC/utils/pythia8_reader.C
@@ -0,0 +1,35 @@
1
+void pythia8_reader(const char* fname, int version = 2);
2
+void user_code(const std::vector<TParticle>& particles);
3
+
4
+void
5
+pythia8_reader(const char* fname, int nev = 1000)
6
+{
7
8
+ /** instance and initialise genarator Pythia8 **/
9
+ auto reader = new o2::eventgen::GeneratorPythia8;
10
+ reader->setConfig(fname);
11
+ if (!reader->Init())
12
+ return;
13
14
+ /** loop over events **/
15
+ for (int iev = 0;
16
+ reader->generateEvent() && reader->importParticles() && iev < nev;
17
+ ++iev) {
18
19
+ /** get particles **/
20
+ auto& particles = reader->getParticles();
21
22
+ /** execute user code **/
23
+ user_code(particles);
24
25
+ }
26
27
+}
28
29
30
+user_code(const std::vector<TParticle>& particles)
31
32
+ for (auto& particle : particles)
33
+ particle.Print();
34
35
0 commit comments