This repository has been archived by the owner on Oct 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake_plots.cxx
118 lines (100 loc) · 3.01 KB
/
make_plots.cxx
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
int make_plots(const char * mat = "Au", int length=15, int runnumber=5, double OD = 15)
{
int OD_print = OD;
TFile * f = new TFile(Form("bubble_%s_%dcm_%dmm_%d.root",mat,length,OD_print,runnumber),"UPDATE");
f->cd();
f->ls();
TLatex lt;
lt.SetNDC(true);
TCanvas * c = new TCanvas();
c->cd(0);
gPad->SetLogy(true);
TH1D * h1 = (TH1D*)f->FindObjectAny("/FakeSD1/forw0");
TH1D * hdenom = h1;
if(h1){
h1->Draw("hist");
h1->GetXaxis()->SetTitle("E (MeV)");
}
h1 = (TH1D*)f->FindObjectAny("/FakeSD2/forw0");
if(h1){
h1->Draw("hist,same");
}
TH1D * hnum = h1;
c->SaveAs(Form("Energy_in_out_%s_%dcm_%dmm_%d.pdf",mat,length,OD_print,runnumber));
// -------------------------
c = new TCanvas();
hnum->Sumw2();
hdenom->Sumw2();
hnum->Divide(hdenom);
hnum->SetTitle("After/Before");
hnum->Draw("hist,E1");
hnum->GetXaxis()->SetTitle("E (MeV)");
hnum->GetYaxis()->SetRangeUser(0.0,hnum->GetMaximum());
c->SaveAs(Form("Ratio_in_out_%s_%dcm_%dmm_%d.pdf",mat,length,OD_print,runnumber));
// -------------------------
TCanvas * c2 = new TCanvas();
c2->Divide(2,2);
c2->cd(1);
TH2D * h2 = (TH2D*)f->FindObjectAny("/FakeSD1/fhXY0_all");
if(h2){
h2->Draw("colz");
h2->SetTitle("Before collimator");
h2->GetXaxis()->SetTitle("x (cm)");
h2->GetYaxis()->SetTitle("y (cm)");
h2->Draw("colz");
}
c2->cd(2);
h2 = (TH2D*)f->FindObjectAny("/FakeSD2/fhXY0_all");
if(h2){
h2->Draw("colz");
h2->SetTitle("After collimator");
h2->GetXaxis()->SetTitle("x (cm)");
h2->GetYaxis()->SetTitle("y (cm)");
h2->Draw("colz");
}
c2->cd(3);
h2 = (TH2D*)f->FindObjectAny("/FakeSD1/fhXY2_all");
if(h2){
h2->Draw("colz");
h2->SetTitle("Before collimator");
h2->GetXaxis()->SetTitle("x (cm)");
h2->GetYaxis()->SetTitle("y (cm)");
h2->Draw("colz");
}
c2->cd(4);
h2 = (TH2D*)f->FindObjectAny("/FakeSD2/fhXY2_all");
if(h2){
h2->Draw("colz");
h2->SetTitle("After collimator");
h2->GetXaxis()->SetTitle("x (cm)");
h2->GetYaxis()->SetTitle("y (cm)");
h2->Draw("colz");
}
c2->cd(1);
lt.DrawLatex(0.0,0.0,Form("L = %dcm, %s",length,mat));
c2->SaveAs(Form("XY_before_after_%s_%dcm_%dmm_%d.pdf",mat,length,OD_print,runnumber));
// -------------------------
//
c2 = new TCanvas();
c2->Divide(2,1);
c2->cd(1);
h2 = (TH2D*)f->FindObjectAny("/FakeSD1/fhXvsE_all");
if(h2){
h2->Draw("colz");
h2->SetTitle("Before collimator");
h2->GetXaxis()->SetTitle("x (cm)");
h2->GetYaxis()->SetTitle("y (cm)");
h2->Draw("colz");
}
c2->cd(2);
h2 = (TH2D*)f->FindObjectAny("/FakeSD2/fhXvsE_all");
if(h2){
h2->Draw("colz");
h2->SetTitle("Before collimator");
h2->GetXaxis()->SetTitle("x (cm)");
h2->GetYaxis()->SetTitle("y (cm)");
h2->Draw("colz");
}
c2->SaveAs(Form("XvsE_before_after_%s_%dcm_%dmm_%d.pdf",mat,length,OD_print,runnumber));
return 0;
}