]>
Commit | Line | Data |
---|---|---|
1 | #if !defined(__CINT__) || defined(__MAKECINT__) | |
2 | ||
3 | #include <stdio.h> | |
4 | #include <stdlib.h> | |
5 | #include <TROOT.h> | |
6 | #include <Riostream.h> | |
7 | #include <TClassTable.h> | |
8 | #include <TStyle.h> | |
9 | #include <TMath.h> | |
10 | #include <TFile.h> | |
11 | #include <TCanvas.h> | |
12 | #include <TH1.h> | |
13 | #include <TH2.h> | |
14 | #include <TProfile.h> | |
15 | #include <TLine.h> | |
16 | #include <TGrid.h> | |
17 | #include <TBits.h> | |
18 | #include <TChain.h> | |
19 | #include <TNtuple.h> | |
20 | #include <TTree.h> | |
21 | #include <TBranch.h> | |
22 | #include <TFileMerger.h> | |
23 | #include <TGridResult.h> | |
24 | #include <TSystem.h> | |
25 | #include <TLegend.h> | |
26 | ||
27 | #endif | |
28 | ||
29 | void MakePlots(TString ntupleFileName){ | |
30 | //*********************************************************** | |
31 | // #### ROOT initialization | |
32 | gROOT->Reset(); | |
33 | gStyle->SetCanvasColor(10); | |
34 | gStyle->SetFrameFillColor(10); | |
35 | gStyle->SetOptTitle(1); | |
36 | gStyle->SetOptStat(0); | |
37 | gStyle->SetOptFit(0); | |
38 | gStyle->SetTitleTextColor(4); | |
39 | gStyle->SetStatTextColor(4); | |
40 | gStyle->SetStatX(0.92); | |
41 | gStyle->SetStatY(0.92); | |
42 | gStyle->SetLineColor(1); | |
43 | gStyle->SetPalette(1); | |
44 | gStyle->SetPadTopMargin(0.08); | |
45 | gStyle->SetPadRightMargin(0.04); | |
46 | gStyle->SetPadBottomMargin(0.1); | |
47 | gStyle->SetPadLeftMargin(0.06); | |
48 | gStyle->SetTitleOffset(1.2,"X"); | |
49 | gStyle->SetTitleOffset(0.7,"Y"); | |
50 | // ************************************************************* | |
51 | ||
52 | TFile* fil = new TFile(ntupleFileName.Data(),"read"); | |
53 | if(!fil){ | |
54 | printf("File with ntuple does not exist\n"); | |
55 | return; | |
56 | } | |
57 | TNtuple* ntzdc = (TNtuple*)fil->Get("ntzdc"); | |
58 | ||
59 | Float_t nrun; | |
60 | Float_t meanZNC,meanZPC,meanZNA,meanZPA,meanZEM1,meanZEM2; | |
61 | Float_t emeanZNC,emeanZPC,emeanZNA,emeanZPA,emeanZEM1,emeanZEM2; | |
62 | Float_t ZNClg,ZNAlg,pmcZNClg,pmcZNAlg; | |
63 | Float_t eZNClg,eZNAlg,epmcZNClg,epmcZNAlg; | |
64 | Float_t xZNC,yZNC,xZNA,yZNA,tdcSum,tdcDiff; | |
65 | ||
66 | ntzdc->SetBranchAddress("nrun",&nrun); | |
67 | ntzdc->SetBranchAddress("meanZNC",&meanZNC); | |
68 | ntzdc->SetBranchAddress("meanZPC",&meanZPC); | |
69 | ntzdc->SetBranchAddress("meanZNA",&meanZNA); | |
70 | ntzdc->SetBranchAddress("meanZPA",&meanZPA); | |
71 | ntzdc->SetBranchAddress("meanZEM1",&meanZEM1); | |
72 | ntzdc->SetBranchAddress("meanZEM2",&meanZEM2); | |
73 | ntzdc->SetBranchAddress("emeanZNC",&emeanZNC); | |
74 | ntzdc->SetBranchAddress("emeanZPC",&emeanZPC); | |
75 | ntzdc->SetBranchAddress("emeanZNA",&emeanZNA); | |
76 | ntzdc->SetBranchAddress("emeanZPA",&emeanZPA); | |
77 | ntzdc->SetBranchAddress("emeanZEM1",&emeanZEM1); | |
78 | ntzdc->SetBranchAddress("emeanZEM2",&emeanZEM2); | |
79 | ntzdc->SetBranchAddress("ZNClg",&ZNClg); | |
80 | ntzdc->SetBranchAddress("ZNAlg",&ZNAlg); | |
81 | ntzdc->SetBranchAddress("eZNClg",&eZNClg); | |
82 | ntzdc->SetBranchAddress("eZNAlg",&eZNAlg); | |
83 | ntzdc->SetBranchAddress("pmcZNClg",&pmcZNClg); | |
84 | ntzdc->SetBranchAddress("pmcZNAlg",&pmcZNAlg); | |
85 | ntzdc->SetBranchAddress("epmcZNClg",&epmcZNClg); | |
86 | ntzdc->SetBranchAddress("epmcZNAlg",&epmcZNAlg); | |
87 | ntzdc->SetBranchAddress("xZNC",&xZNC); | |
88 | ntzdc->SetBranchAddress("yZNC",&yZNC); | |
89 | ntzdc->SetBranchAddress("xZNA",&xZNA); | |
90 | ntzdc->SetBranchAddress("yZNA",&yZNA); | |
91 | ntzdc->SetBranchAddress("tdcSum",&tdcSum); | |
92 | ntzdc->SetBranchAddress("tdcDiff",&tdcDiff); | |
93 | ||
94 | TH1F *hznc = new TH1F("hznc","",(Int_t)ntzdc->GetEntries(),0.,ntzdc->GetEntries()); | |
95 | TH1F *hzna = new TH1F("hzna","",(Int_t)ntzdc->GetEntries(),0.,ntzdc->GetEntries()); | |
96 | TH1F *hzpc = new TH1F("hzpc","",(Int_t)ntzdc->GetEntries(),0.,ntzdc->GetEntries()); | |
97 | TH1F *hzpa = new TH1F("hzpa","",(Int_t)ntzdc->GetEntries(),0.,ntzdc->GetEntries()); | |
98 | TH1F *hzem1 = new TH1F("hzem1","",(Int_t)ntzdc->GetEntries(),0.,ntzdc->GetEntries()); | |
99 | TH1F *hzem2 = new TH1F("hzem2","",(Int_t)ntzdc->GetEntries(),0.,ntzdc->GetEntries()); | |
100 | TH1F *hznclg = new TH1F("hznclg","",(Int_t)ntzdc->GetEntries(),0.,ntzdc->GetEntries()); | |
101 | TH1F *hznalg = new TH1F("hznalg","",(Int_t)ntzdc->GetEntries(),0.,ntzdc->GetEntries()); | |
102 | TH1F *hpmcznclg = new TH1F("hpmcznclg","",(Int_t)ntzdc->GetEntries(),0.,ntzdc->GetEntries()); | |
103 | TH1F *hpmcznalg = new TH1F("hpmcznalg","",(Int_t)ntzdc->GetEntries(),0.,ntzdc->GetEntries()); | |
104 | TH1F *hxznc = new TH1F("hxznc","",(Int_t)ntzdc->GetEntries(),0.,ntzdc->GetEntries()); | |
105 | TH1F *hyznc = new TH1F("hyznc","",(Int_t)ntzdc->GetEntries(),0.,ntzdc->GetEntries()); | |
106 | TH1F *hxzna = new TH1F("hxzna","",(Int_t)ntzdc->GetEntries(),0.,ntzdc->GetEntries()); | |
107 | TH1F *hyzna = new TH1F("hyzna","",(Int_t)ntzdc->GetEntries(),0.,ntzdc->GetEntries()); | |
108 | TH1F *htdcsum = new TH1F("htdcsum","",(Int_t)ntzdc->GetEntries(),0.,ntzdc->GetEntries()); | |
109 | TH1F *htdcdiff = new TH1F("htdcdiff","",(Int_t)ntzdc->GetEntries(),0.,ntzdc->GetEntries()); | |
110 | ||
111 | for(Int_t i = 0; i<ntzdc->GetEntries();i++){ | |
112 | ntzdc->GetEvent(i); | |
113 | // | |
114 | hznc->SetBinContent(i+1, meanZNC); | |
115 | hznc->SetBinError(i+1, emeanZNC); | |
116 | hznc->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun)); | |
117 | hznc->GetXaxis()->SetTitle("RUN #"); | |
118 | hznc->GetYaxis()->SetTitle("ZN mean signal"); | |
119 | hzpc->SetBinContent(i+1, meanZPC); | |
120 | hzpc->SetBinError(i+1, emeanZPC); | |
121 | hzpc->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun)); | |
122 | hzpc->GetXaxis()->SetTitle("RUN #"); | |
123 | hzpc->GetYaxis()->SetTitle("ZP mean signal"); | |
124 | hzna->SetBinContent(i+1, meanZNA); | |
125 | hzna->SetBinError(i+1, emeanZNA); | |
126 | hzna->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun)); | |
127 | hzna->GetXaxis()->SetTitle("RUN #"); | |
128 | hzna->GetYaxis()->SetTitle("ZN mean signal"); | |
129 | hzpa->SetBinContent(i+1, meanZPA); | |
130 | hzpa->SetBinError(i+1, emeanZPA); | |
131 | hzpa->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun)); | |
132 | hzpa->GetXaxis()->SetTitle("RUN #"); | |
133 | hzpa->GetYaxis()->SetTitle("ZP mean signal"); | |
134 | hzem1->SetBinContent(i+1, meanZEM1); | |
135 | hzem1->SetBinError(i+1, emeanZEM1); | |
136 | hzem1->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun)); | |
137 | hzem1->GetXaxis()->SetTitle("RUN #"); | |
138 | hzem1->GetYaxis()->SetTitle("ZEM mean signal"); | |
139 | hzem2->SetBinContent(i+1, meanZEM2); | |
140 | hzem2->SetBinError(i+1, emeanZEM2); | |
141 | hzem2->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun)); | |
142 | hzem2->GetXaxis()->SetTitle("RUN #"); | |
143 | hzem2->GetYaxis()->SetTitle("ZEM mean signal"); | |
144 | hznclg->SetBinContent(i+1, ZNClg); | |
145 | hznclg->SetBinError(i+1, eZNClg); | |
146 | hznclg->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun)); | |
147 | hznclg->GetXaxis()->SetTitle("RUN #"); | |
148 | hznclg->GetYaxis()->SetTitle("ZN LG mean signal"); | |
149 | hznalg->SetBinContent(i+1, ZNAlg); | |
150 | hznalg->SetBinError(i+1, eZNAlg); | |
151 | hznalg->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun)); | |
152 | hznalg->GetXaxis()->SetTitle("RUN #"); | |
153 | hznalg->GetYaxis()->SetTitle("ZN LG mean signal"); | |
154 | hpmcznclg->SetBinContent(i+1, pmcZNClg); | |
155 | hpmcznclg->SetBinError(i+1, epmcZNClg); | |
156 | hpmcznclg->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun)); | |
157 | hpmcznclg->GetXaxis()->SetTitle("RUN #"); | |
158 | hpmcznclg->GetYaxis()->SetTitle("ZN LG PMC mean signal"); | |
159 | hpmcznalg->SetBinContent(i+1, pmcZNAlg); | |
160 | hpmcznalg->SetBinError(i+1, epmcZNAlg); | |
161 | hpmcznalg->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun)); | |
162 | hpmcznalg->GetXaxis()->SetTitle("RUN #"); | |
163 | hpmcznalg->GetYaxis()->SetTitle("ZN LG PMC mean signal"); | |
164 | hxznc->SetBinContent(i+1, xZNC); | |
165 | hxznc->SetBinError(i+1, 0.1*xZNC); | |
166 | hxznc->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun)); | |
167 | hxznc->GetXaxis()->SetTitle("RUN #"); | |
168 | hxznc->GetYaxis()->SetTitle("X_{ZN} (cm)"); | |
169 | hyznc->SetBinContent(i+1, yZNC); | |
170 | hyznc->SetBinError(i+1, 0.1*yZNC); | |
171 | hyznc->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun)); | |
172 | hyznc->GetXaxis()->SetTitle("RUN #"); | |
173 | hyznc->GetYaxis()->SetTitle("Y_{ZN} (cm)"); | |
174 | hxzna->SetBinContent(i+1, xZNA); | |
175 | hxzna->SetBinError(i+1, 0.1*xZNA); | |
176 | hxzna->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun)); | |
177 | hxzna->GetXaxis()->SetTitle("RUN #"); | |
178 | hxzna->GetYaxis()->SetTitle("X_{ZN} (cm)"); | |
179 | hyzna->SetBinContent(i+1, yZNA); | |
180 | hyzna->SetBinError(i+1, 0.1*yZNA); | |
181 | hyzna->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun)); | |
182 | hyzna->GetXaxis()->SetTitle("RUN #"); | |
183 | hyzna->GetYaxis()->SetTitle("Y_{ZN} (cm)"); | |
184 | htdcsum->SetBinContent(i+1, tdcSum); | |
185 | htdcsum->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun)); | |
186 | htdcsum->GetXaxis()->SetTitle("RUN #"); | |
187 | htdcsum->GetYaxis()->SetTitle("TDC Sum (ns)"); | |
188 | htdcdiff->SetBinContent(i+1, tdcDiff); | |
189 | htdcdiff->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun)); | |
190 | htdcdiff->GetXaxis()->SetTitle("RUN #"); | |
191 | htdcdiff->GetYaxis()->SetTitle("TDC Diff (ns)"); | |
192 | } | |
193 | ||
194 | ||
195 | TCanvas *c1 = new TCanvas("c1", "Mean value ZNs", 0, 0, 1200, 1000); | |
196 | c1->Divide(1,2); | |
197 | // | |
198 | c1->cd(1); | |
199 | hznc->SetMarkerColor(kAzure+6); hznc->SetLineColor(kAzure+6); | |
200 | hznc->SetMarkerStyle(21); | |
201 | hznc->Draw(""); | |
202 | hzna->SetMarkerColor(kPink-2); hzna->SetLineColor(kPink-2); | |
203 | hzna->SetMarkerStyle(20); | |
204 | hzna->Draw("SAME"); | |
205 | // | |
206 | TLegend *l1 = new TLegend(0.44,0.18,0.54,0.32); | |
207 | l1->SetFillColor(kWhite); | |
208 | l1->AddEntry(hznc," ZNC " ,"P"); | |
209 | l1->AddEntry(hzna," ZNA " ,"P"); | |
210 | l1->Draw(""); | |
211 | // | |
212 | c1->cd(2); | |
213 | hznclg->SetMarkerColor(kPink+5); hznclg->SetLineColor(kPink+5); | |
214 | hznclg->SetMarkerStyle(21); | |
215 | hznclg->Draw(""); | |
216 | hznalg->SetMarkerColor(kBlue+1); hznalg->SetLineColor(kBlue+1); | |
217 | hznalg->SetMarkerStyle(20); hznalg->SetMinimum(0); | |
218 | hznalg->Draw("SAME"); | |
219 | // | |
220 | TLegend *l2 = new TLegend(0.44,0.18,0.54,0.32); | |
221 | l2->SetFillColor(kWhite); | |
222 | l2->AddEntry(hznclg," ZNC LG " ,"P"); | |
223 | l2->AddEntry(hznalg," ZNA LG " ,"P"); | |
224 | l2->Draw(""); | |
225 | ||
226 | ||
227 | TCanvas *c1b = new TCanvas("c1b", "Mean value ZEMs ZPs", 200, 0, 1200, 1000); | |
228 | c1b->Divide(1,2); | |
229 | c1b->cd(1); | |
230 | hzpc->SetMarkerColor(kAzure+6); hzpc->SetLineColor(kAzure+6); | |
231 | hzpc->SetMarkerStyle(21); | |
232 | hzpc->Draw(""); | |
233 | hzpa->SetMarkerColor(kPink-2); hzpa->SetLineColor(kPink-2); | |
234 | hzpa->SetMarkerStyle(20); | |
235 | hzpa->Draw("SAME"); | |
236 | // | |
237 | TLegend *l3 = new TLegend(0.44,0.18,0.54,0.32); | |
238 | l3->SetFillColor(kWhite); | |
239 | l3->AddEntry(hzpc," ZPC " ,"P"); | |
240 | l3->AddEntry(hzpa," ZPA " ,"P"); | |
241 | l3->Draw(""); | |
242 | ||
243 | c1b->cd(2); | |
244 | hzem1->SetMarkerColor(kTeal-7); hzem1->SetLineColor(kTeal-7); | |
245 | hzem1->SetMarkerStyle(29); | |
246 | hzem2->SetMarkerColor(kTeal+5); hzem2->SetLineColor(kTeal+5); | |
247 | hzem2->SetMarkerStyle(30); | |
248 | hzem2->Draw(""); | |
249 | hzem1->Draw("SAME"); | |
250 | // | |
251 | TLegend *l4 = new TLegend(0.44,0.18,0.54,0.32); | |
252 | l4->SetFillColor(kWhite); | |
253 | l4->AddEntry(hzem1," ZEM1 " ,"P"); | |
254 | l4->AddEntry(hzem2," ZEM2 " ,"P"); | |
255 | l4->Draw(""); | |
256 | ||
257 | ||
258 | /*TCanvas *c2 = new TCanvas("c2", "ZN centroids", 400, 400, 1200, 1000); | |
259 | c2->Divide(1,2); | |
260 | // | |
261 | c2->cd(1); | |
262 | hxznc->SetMarkerColor(kAzure+5); hxznc->SetLineColor(kAzure+5); | |
263 | hxznc->SetMarkerStyle(21); | |
264 | hxzna->SetMarkerColor(kPink+5); hxzna->SetLineColor(kPink+5); | |
265 | hxzna->SetMarkerStyle(20); | |
266 | hxznc->Draw(""); | |
267 | hxzna->Draw("SAME"); | |
268 | c2->cd(2); | |
269 | hyznc->SetMarkerColor(kAzure+5); hyznc->SetLineColor(kAzure+5); | |
270 | hyznc->SetMarkerStyle(21); | |
271 | hyzna->SetMarkerColor(kPink+5); hyzna->SetLineColor(kPink+5); | |
272 | hyzna->SetMarkerStyle(20); | |
273 | hyznc->Draw(""); | |
274 | hyzna->Draw("SAME");*/ | |
275 | ||
276 | ||
277 | TCanvas *c3 = new TCanvas("c3", "LG signals", 600, 0, 1200, 1000); | |
278 | c3->Divide(1,2); | |
279 | // | |
280 | c3->cd(1); | |
281 | hznclg->SetMarkerColor(kPink+5); hznclg->SetLineColor(kPink+5); | |
282 | hznclg->SetMarkerStyle(21); | |
283 | hznclg->Draw(""); | |
284 | hznalg->SetMarkerColor(kBlue+1); hznalg->SetLineColor(kBlue+1); | |
285 | hznalg->SetMarkerStyle(20); | |
286 | hznalg->Draw("SAME"); | |
287 | TLegend *l7 = new TLegend(0.44,0.18,0.54,0.32); | |
288 | l7->SetFillColor(kWhite); | |
289 | l7->AddEntry(hznclg," ZNC LG " ,"P"); | |
290 | l7->AddEntry(hznalg," ZNA LG " ,"P"); | |
291 | l7->Draw(""); | |
292 | // | |
293 | c3->cd(2); | |
294 | hpmcznclg->SetMarkerColor(kPink+6); hpmcznclg->SetLineColor(kPink+6); | |
295 | hpmcznclg->SetMarkerStyle(21); hpmcznclg->SetMinimum(0); | |
296 | hpmcznclg->Draw(""); | |
297 | hpmcznalg->SetMarkerColor(kAzure+7); hpmcznalg->SetLineColor(kAzure+7); | |
298 | hpmcznalg->SetMarkerStyle(20); hpmcznalg->SetMinimum(0); | |
299 | hpmcznalg->Draw("SAME"); | |
300 | TLegend *l8 = new TLegend(0.44,0.15,0.58,0.32); | |
301 | l8->SetFillColor(kWhite); | |
302 | l8->AddEntry(hpmcznclg," ZNC LG PMC" ,"P"); | |
303 | l8->AddEntry(hpmcznalg," ZNA LG PMC" ,"P"); | |
304 | l8->Draw(""); | |
305 | } |