-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrock_rate.c
103 lines (91 loc) · 3.48 KB
/
rock_rate.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
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
94
95
96
97
98
99
100
101
102
103
void rock_rate()
{
TFile*p=new TFile("test2.root");
p->ls();
struct eventStruct{
Float_t Position[3];
Float_t TMS[3];
Float_t GlobalDeathPosition[3];
Float_t leptonMomentum[3];
};
eventStruct myEvent;
TTree*s;
p->GetObject("tree",s);
s->Print();
s->ls();
s->SetBranchAddress("vtx", &(myEvent.Position));
s->SetBranchAddress("TMSBirth", &(myEvent.TMS));
s->SetBranchAddress("GlobalDeath", &(myEvent.GlobalDeathPosition));
s->SetBranchAddress("p3lep", &(myEvent.leptonMomentum));
// new TTreeViewer(s);
gROOT->ForceStyle();
unsigned int mysize1 = s->GetEntries();
TH2F* Hist1 = new TH2F("Hist1","Event_Vertex Y position vs Event_vertex Z position;Event_vertex Z position;Event_vertex Y position",300,-80000,2000,300,-6000,10000);
TH1F* Hist2 = new TH1F("Hist2","muons first layer of the TMS;TMSBirth;Events",300,10000,15000);
TH1F* Hist3 = new TH1F("Hist3","muons first layer of the TMS with forward globaldeath;TMSBirth;Events",300,10000,15000);
TH1F* Hist4 = new TH1F("Hist4","muons first layer of the TMS with lepton momentum;Muon Momentum[GeV];Events",300,-1000,80000);
TH1F* Hist5 = new TH1F("Hist5","muons first layer of the TMS with lepton momentum and forward globaldeath;Muon Momentum[GeV];Events",300,-1000,80000);
//std::cout << mysize << std::endl;
for (unsigned int i = 0; i < mysize1; ++i) {
s->GetEntry(i);
//std::cout << myEvent.PositionY << std::endl;
Float_t z = myEvent.Position[2];
Float_t y = myEvent.Position[1];
Float_t Birthz=myEvent.TMS[2];
Float_t GlobalDeath_z_position =myEvent.GlobalDeathPosition[2];
Float_t leptonmometum_z_position =myEvent.leptonMomentum[2];
//cout<<z<<endl;
if(11000<Birthz && Birthz<11400){
Hist1->Fill(z,y);
}
if(z<0 && 11000<Birthz && Birthz<11400){
Hist2->Fill(Birthz);
}
if(GlobalDeath_z_position>0 && z<0 && 11000<Birthz && Birthz<11400){
Hist3->Fill(Birthz);
}
if( z<0 && 11000<Birthz && Birthz<11400 && leptonmometum_z_position>0 ){
Hist4->Fill(leptonmometum_z_position);
}
if(GlobalDeath_z_position>0 && z<0 && 11000<Birthz && Birthz<11400 && leptonmometum_z_position>0 ){
Hist5->Fill(leptonmometum_z_position);
}
}
TGaxis::SetMaxDigits(3);
gStyle->SetPalette(kRainBow);
auto canvas_1 = new TCanvas("canvas1","canvas1", 2500, 2500);
Hist1 ->SetContour(100000);
Hist1->Draw("colz");
//Hist1->GetYaxis()->SetRange(-60,60);
//Hist1->GetXaxis()->SetRange(-60,60);
gPad->Update();
canvas_1->Draw();
TGaxis::SetMaxDigits(3);
gStyle->SetPalette(kRainBow);
auto canvas_2 = new TCanvas("canvas2","canvas2", 2500, 2500);
Hist2 ->SetContour(100000);
Hist2->Draw("colz");
gPad->Update();
canvas_2->Draw();
TGaxis::SetMaxDigits(3);
gStyle->SetPalette(kRainBow);
auto canvas_3 = new TCanvas("canvas3","canvas3", 2500, 2500);
Hist3 ->SetContour(100000);
Hist3->Draw("colz");
gPad->Update();
canvas_3->Draw();
TGaxis::SetMaxDigits(3);
gStyle->SetPalette(kRainBow);
auto canvas_4 = new TCanvas("canvas4","canvas4", 2500, 2500);
Hist4 ->SetContour(100000);
Hist4->Draw("colz");
gPad->Update();
canvas_4->Draw();
TGaxis::SetMaxDigits(3);
gStyle->SetPalette(kRainBow);
auto canvas_5 = new TCanvas("canvas5","canvas5", 2500, 2500);
Hist5 ->SetContour(100000);
Hist5->Draw("colz");
gPad->Update();
canvas_5->Draw();
}