-
Notifications
You must be signed in to change notification settings - Fork 0
/
tut4b.cc
93 lines (63 loc) · 1.83 KB
/
tut4b.cc
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#include <iostream>
//#include <vector>
#include "Pythia8/Pythia.h"
//#include "TROOT.h"
#include "TFile.h"
#include "TTree.h"
using namespace Pythia8;
int main(){
TFile *output=new TFile("tut4.root", "recreate");
TTree *tree = new TTree("tr","tr");
int ntrackmax=10000;
float phi[ntrackmax]={0};
float eta[ntrackmax]={0};
float pt[ntrackmax]={0};
float sp;
int mult=0;
int nTrack;
//branches
tree->Branch("nTrack",&nTrack,"nTrack/I");
tree->Branch("phi",phi, "phi[nTrack]/F");
tree->Branch("eta",eta, "eta[nTrack]/F");
tree->Branch("pt",pt, "pt[nTrack]/F");
tree->Branch("mult",&mult, "mult/I");
tree->Branch("sp",&sp, "sp/F");
int nevents =10000;
Sphericity sph;
Pythia8::Pythia pythia;
pythia.readString("Beams:idA= 2212");
pythia.readString("Beams:idB= 2212");
pythia.readString("Beams:eCM= 13000");
pythia.readString("SoftQCD:all=on");//for min-bias
pythia.readString("Tune:pp=14");
pythia.readString("PartonLevel:MPI=on");// for MPI
//pythia.readString("PhaseSpace:pTHatMin =5");
//pythia.readString("SoftQCD:nonDiffractive = on");
pythia.init();
for (int i=0; i<nevents; i++)
{
//nTrack[i]=(pythia.event.size());
if(!pythia.next()) continue;
if (sph.analyze( pythia.event )) {
if (nevents < 3) sph.list();
sp=sph.sphericity();
}
nTrack =pythia.event.size();
std::cout<< "Event:" << i << std::endl;
std::cout<< "Event size: " << nTrack << std::endl;
for (int k = 0; k< pythia.event.size(); ++k)
{
phi[k]= pythia.event[k].phi();
eta[k]= pythia.event[k].eta();
pt[k]= pythia.event[k].pT();
if ( pythia.event[k].isFinal() && pythia.event[k].isCharged() )
mult++;
}
cout<<mult<<endl;
tree->Fill();
}
pythia.stat();
output->Write();
output->Close();
return 0;
}