-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtutorial1.cc
More file actions
46 lines (31 loc) · 1.1 KB
/
tutorial1.cc
File metadata and controls
46 lines (31 loc) · 1.1 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
46
#include <iostream>
#include "Pythia8/Pythia.h"
int main()
{
int nevents = 10;
Pythia8::Pythia pythia;
pythia.readString("Beams:idA = 2212");
pythia.readString("Beams:idB = 2212");
pythia.readString("Beams:eCM = 14.e3");
pythia.readString("SoftQCD:all = on");
pythia.readString("HardQCD:all = on");
pythia.init();
for(int i = 0; i < nevents; i++)
{
if(!pythia.next()) continue;
int entries = pythia.event.size();
std::cout << "Event: " << i << std::endl;
std::cout << "Event size: " << entries << std::endl;
for(int j = 0; j < entries; j++)
{
int id = pythia.event[j].id();
double m = pythia.event[j].m();
double px = pythia.event[j].px();
double py = pythia.event[j].py();
double pz = pythia.event[j].pz();
double pabs = sqrt(pow(px,2) + pow(py,2) + pow(pz,2));
std::cout << id << " " << m << " " << pabs << std::endl;
}
}
return 0;
}