-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy patheventAnalysis.C
53 lines (42 loc) · 1.36 KB
/
eventAnalysis.C
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
#include <stdio.h>
#include <complex>
#include <iostream>
#include "TF1.h"
#include "TFile.h"
#include "TH1.h"
#include "TH2.h"
#include "TH1F.h"
#include "TProfile.h"
#include "TRandom.h"
#include "TTree.h"
#include <TMath.h>
using namespace std;
void eventAnalysis(){
long nEvt, nEvtProcess;
Int_t nParticle, iParticle;
Float_t phi[20000];
Float_t pt[20000];
Float_t eta[20000];
TH1D *histPt = new TH1D("histPt", "histPt", 200,0,10);
TH2D *hist2DPtVsEta = new TH2D("hist2DPtVsEta","2D histogram of pT vs eta", 200, -2.4,2.4, 200,0.0,10);
TChain t1("t1");
t1.Add("./steg_output_events.root/tree");
t1.SetBranchAddress("n", &nParticle);
t1.SetBranchAddress("ptg", &pt);
t1.SetBranchAddress("etag", &eta);
t1.SetBranchAddress("phig", &phi);
nEvt=t1.GetEntries();
//nEvtProcess=50;
for(long ne=0; ne<nEvt; ne++)
{
if(ne%20==0) cout<<"Have run "<<ne<<" of the total "<<nEvt<<" events; "<<endl;
t1.GetEntry(ne);
for(iParticle=0; iParticle<nParticle; iParticle++){
//cout<<"evtID = "<<ne<<", particlesPt = "<<pt[iParticle]<<", particlePhi = "<<phi[iParticle]<<endl;
histPt->Fill(pt[iParticle]);
hist2DPtVsEta->Fill(eta[iParticle], pt[iParticle]);
}
} // end of event loop
histPt->Draw();
//hist2DPtVsEta->Draw("colz");
}