]>
Commit | Line | Data |
---|---|---|
ff329095 | 1 | #include "TCanvas.h" // needed for some reason. |
2 | ||
b5bff3e2 | 3 | TFile* file; |
4 | const char* prefixToName = "imgs/"; | |
ff329095 | 5 | const int kNCents = 1; |
b5bff3e2 | 6 | |
7 | void Draw(const char* name, const char* options = "", double yFrom=0., double yTo=-1.) | |
8 | { | |
9 | TH1* hist = ((TH1*)file->Get(name))->Clone(); | |
10 | //hist->SetAxisRange(0, 30 ); | |
11 | hist->GetXaxis()->SetLabelSize(0.011); | |
12 | //hist->GetXaxis()->SetTitle("Run"); | |
f0230efe | 13 | //hist->GetXaxis()->SetRange(1, ); |
14 | if( yFrom < yTo ) { | |
15 | if(yFrom > hist->GetMinimum()) | |
16 | Printf("in hist %s, yFrom (%f), is larger then hist min (%f)", name, yFrom, hist->GetMinimum()); | |
17 | if(yTo < hist->GetMaximum()) | |
18 | Printf("in hist %s, yTo (%f), is smaller then hist max (%f)", name, yTo, hist->GetMaximum()); | |
b5bff3e2 | 19 | |
f0230efe | 20 | hist->GetYaxis()->SetRangeUser(yFrom, yTo); |
21 | } | |
b5bff3e2 | 22 | |
23 | //if( ! TString(options).Contains("same") ) | |
24 | TCanvas* canv = new TCanvas; | |
5f3e9080 | 25 | //canv->SetGrid(); |
26 | //hist->GetYaxis()->SetNdivisions(16); | |
b5bff3e2 | 27 | |
28 | canv->Divide(1,2); | |
29 | ||
30 | hist->GetXaxis()->SetLabelSize(0.051); | |
31 | ||
5f3e9080 | 32 | if( TString(options).Contains("LINFIT") ) |
33 | hist->Fit("pol0", "Q"); | |
34 | ||
b5bff3e2 | 35 | canv->cd(1); |
8e9e6516 | 36 | if( TString(name).Contains("grChi2RP") ) |
37 | gPad->SetLogy(); | |
f0230efe | 38 | hist->GetXaxis()->SetRange(1, hist->GetNbinsX()/2); |
b5bff3e2 | 39 | hist->DrawCopy(options); |
40 | ||
41 | canv->cd(2); | |
8e9e6516 | 42 | if( TString(name).Contains("grChi2RP") ) |
43 | gPad->SetLogy(); | |
f0230efe | 44 | hist->GetXaxis()->SetRange(hist->GetNbinsX()/2+1,200); |
b5bff3e2 | 45 | hist->DrawCopy(options); |
46 | ||
47 | ||
e65a8d2d | 48 | canv->SaveAs(Form("%s%s.pdf", prefixToName, hist->GetName())); |
49 | canv->SaveAs(Form("%s%s.png", prefixToName, hist->GetName())); | |
b5bff3e2 | 50 | delete hist; |
51 | } | |
52 | ||
53 | void DrawPID() | |
54 | { | |
ff329095 | 55 | for(int cent=0; cent<kNCents; ++cent) { |
e65a8d2d | 56 | TString key = Form("nPhotPID_cen%i", cent); |
57 | ||
58 | TH1* grNPhotAllcore = (TH1*)file->Get(Form("grNPhotAllcore_cen%d", cent))->Clone(); | |
59 | TH1* grNPhotCPVcore = (TH1*)file->Get(Form("grNPhotCPVcore_cen%d", cent))->Clone(); | |
60 | TH1* grNPhotDisp2core = (TH1*)file->Get(Form("grNPhotDisp2core_cen%d", cent))->Clone(); | |
61 | TH1* grNPhotBoth2core = (TH1*)file->Get(Form("grNPhotBoth2core_cen%d", cent))->Clone(); | |
62 | ||
63 | grNPhotAllcore->GetXaxis()->SetLabelSize(0.045); | |
64 | grNPhotAllcore->GetYaxis()->SetRangeUser(0, grNPhotAllcore->GetMaximum()*1.2); | |
65 | ||
66 | grNPhotAllcore ->SetMarkerColor(kBlack); | |
67 | grNPhotCPVcore ->SetMarkerColor(kCyan+1); | |
68 | grNPhotDisp2core->SetMarkerColor(kBlue); | |
69 | grNPhotBoth2core ->SetMarkerColor(kOrange+1); | |
70 | ||
71 | TCanvas* canv = new TCanvas(key.Data(), key.Data(), 1024, 768); | |
ff329095 | 72 | canv->Divide(1,2); |
73 | ||
74 | canv->cd(1); | |
e65a8d2d | 75 | grNPhotAllcore->SetTitle("#LTN_{clusters}^{PID}#GT"); |
76 | gPad->SetGridy(); | |
77 | grNPhotAllcore->GetXaxis()->SetRange(0, 85); | |
78 | grNPhotAllcore->DrawCopy(); | |
79 | grNPhotCPVcore->DrawCopy("same"); | |
80 | grNPhotDisp2core->DrawCopy("same"); | |
81 | grNPhotBoth2core->DrawCopy("same"); | |
ff329095 | 82 | |
83 | canv->cd(2); | |
e65a8d2d | 84 | gPad->SetGridy(); |
85 | grNPhotAllcore->SetTitle(""); | |
86 | grNPhotAllcore->GetXaxis()->SetRange(85, 200); | |
87 | grNPhotAllcore->DrawCopy(); | |
88 | grNPhotCPVcore->DrawCopy("same"); | |
89 | grNPhotDisp2core->DrawCopy("same"); | |
90 | grNPhotBoth2core->DrawCopy("same"); | |
ff329095 | 91 | |
92 | canv->cd(1); | |
93 | leg = new TLegend(0.9,0.7,0.99,0.99); | |
94 | leg->SetFillColor(kWhite); | |
95 | leg->SetBorderSize(1); | |
e65a8d2d | 96 | leg->AddEntry(Form("grNPhotAllcore_cen%d",cent),"All","lP"); |
97 | leg->AddEntry(Form("grNPhotCPVcore_cen%d",cent),"CPVcore","lP"); | |
98 | leg->AddEntry(Form("grNPhotDisp2core_cen%d",cent),"Disp2core","lP"); | |
99 | leg->AddEntry(Form("grNPhotBoth2core_cen%d",cent),"Both2core","lP"); | |
100 | ||
ff329095 | 101 | leg->Draw(); |
102 | ||
e65a8d2d | 103 | canv->SaveAs(Form("%s%s_squeezed.pdf", prefixToName, key.Data())); |
104 | canv->SaveAs(Form("%s%s_squeezed.png", prefixToName, key.Data())); | |
b5bff3e2 | 105 | } |
ff329095 | 106 | } |
107 | ||
108 | void DrawCPVRatio() | |
109 | { | |
110 | for(int cent=0; cent<kNCents; ++cent) { | |
111 | TH1* grNPhotAll = (TH1*)file->Get(Form("grNPhotAll_cen0", cent))->Clone(); | |
112 | TH1* grNPhotCPV = (TH1*)file->Get(Form("grNPhotCPV_cen0", cent))->Clone(); | |
113 | TH1* grNPhotCPV2 = (TH1*)file->Get(Form("grNPhotCPV2_cen0", cent))->Clone(); | |
114 | ||
115 | grNPhotCPV->Divide(grNPhotAll); | |
116 | grNPhotCPV->SetTitle(Form("%s / %s", grNPhotCPV->GetTitle(), grNPhotAll->GetTitle())); | |
117 | grNPhotCPV->GetYaxis()->SetRangeUser(0.7,0.85); | |
118 | ||
119 | grNPhotCPV2->Divide(grNPhotAll); | |
120 | ||
121 | TCanvas* canv = new TCanvas; | |
122 | canv->Divide(1,2); | |
123 | canv->cd(1); | |
e65a8d2d | 124 | grNPhotCPV->GetXaxis()->SetRange(0, 85); |
ff329095 | 125 | grNPhotCPV->DrawCopy(); |
126 | ||
127 | canv->cd(2); | |
128 | grNPhotCPV->SetTitle(""); | |
129 | grNPhotCPV->GetXaxis()->SetRange(85, 200); | |
130 | grNPhotCPV->DrawCopy(); | |
131 | ||
e65a8d2d | 132 | canv->SaveAs(Form("%sCPVtoAllRatio_cen%d.pdf", prefixToName, cent)); |
133 | canv->SaveAs(Form("%sCPVtoAllRatio_cen%d.png", prefixToName, cent)); | |
b5bff3e2 | 134 | } |
ff329095 | 135 | } |
136 | ||
137 | void DrawNPhotAllAndHigh() | |
138 | { | |
139 | for(int cent=0; cent<kNCents; ++cent) { | |
3b8b9fc1 | 140 | TH1* grNPhotAll = (TH1*)file->Get(Form("grNPhotAll_cen%d", cent))->Clone(); |
141 | TH1* grNPhotAllHigh = (TH1*)file->Get(Form("grNPhotAllHigh_cen%d", cent))->Clone(); | |
142 | TH1* grNPhotAllcoreHigh = (TH1*)file->Get(Form("grNPhotAllcoreHigh_cen%d", cent))->Clone(); | |
ff329095 | 143 | |
144 | double sizeAll = grNPhotAll->Integral(); | |
145 | double sizeAllHigh = grNPhotAllHigh->Integral(); | |
3b8b9fc1 | 146 | int scale = TMath::Nint(sizeAll / sizeAllHigh); |
ff329095 | 147 | grNPhotAllHigh->Scale(scale); |
3b8b9fc1 | 148 | grNPhotAllcoreHigh->Scale(scale); |
b5bff3e2 | 149 | |
ff329095 | 150 | grNPhotAllHigh->SetMarkerColor(kRed); |
151 | grNPhotAllHigh->SetLineColor(kRed); | |
3b8b9fc1 | 152 | grNPhotAllcoreHigh->SetMarkerColor(kGreen+1); |
153 | grNPhotAllcoreHigh->SetLineColor(kGreen+1); | |
b5bff3e2 | 154 | |
ff329095 | 155 | TCanvas* canv = new TCanvas; |
156 | canv->Divide(1,2); | |
b5bff3e2 | 157 | |
ff329095 | 158 | canv->cd(1); |
159 | grNPhotAll->SetTitle("#LTN_{clusters}#GT"); | |
e65a8d2d | 160 | grNPhotAll->GetXaxis()->SetRange(0, 85); |
3b8b9fc1 | 161 | grNPhotAll->GetYaxis()->SetRange(15, 40); |
162 | //grNPhotAll->GetYaxis()->SetRangeUser(15, 45); | |
ff329095 | 163 | grNPhotAll->DrawCopy(); |
164 | grNPhotAllHigh->DrawCopy("same"); | |
3b8b9fc1 | 165 | grNPhotAllcoreHigh->DrawCopy("same"); |
ff329095 | 166 | |
167 | canv->cd(2); | |
168 | grNPhotAll->GetXaxis()->SetRange(85, 200); | |
169 | grNPhotAll->DrawCopy(); | |
170 | grNPhotAllHigh->DrawCopy("same"); | |
3b8b9fc1 | 171 | grNPhotAllcoreHigh->DrawCopy("same"); |
ff329095 | 172 | |
173 | canv->cd(1); | |
3b8b9fc1 | 174 | leg = new TLegend(0.8, 0.15, 0.99, 0.4); |
ff329095 | 175 | leg->SetFillColor(kWhite); |
176 | leg->SetBorderSize(1); | |
177 | leg->AddEntry(grNPhotAll, Form("All"),"lP"); | |
3b8b9fc1 | 178 | leg->AddEntry(grNPhotAllHigh, Form("AllHigh * %d", scale),"lP"); |
179 | leg->AddEntry(grNPhotAllcoreHigh, Form("AllcoreHigh * %d", scale),"lP"); | |
ff329095 | 180 | leg->Draw(); |
181 | ||
e65a8d2d | 182 | canv->SaveAs( Form("%s%s.pdf", prefixToName, Form("nPhotAllAndHigh_cen%d", cent))); |
183 | canv->SaveAs( Form("%s%s.png", prefixToName, Form("nPhotAllAndHigh_cen%d", cent))); | |
ff329095 | 184 | } |
b5bff3e2 | 185 | } |
186 | ||
3b8b9fc1 | 187 | void DrawPIDRatiosHighCore(const char* pidNames[], int nPids, const char* high) |
b5bff3e2 | 188 | { |
ff329095 | 189 | int kNColors = 8; |
190 | const Int_t colors[8] = {kBlack, kRed-1, kRed+1, kBlue, kCyan, kGreen+3, kYellow+1, kMagenta}; | |
191 | int currentColorID = 99999; | |
192 | Int_t color; | |
193 | ||
194 | for(int cent=0; cent<kNCents; ++cent) { | |
3b8b9fc1 | 195 | TH1* hAll = (TH1*)file->Get( Form("grNPhot%s%s_cen%d", pidNames[0], high, cent) )->Clone(); |
b5bff3e2 | 196 | |
ff329095 | 197 | leg = new TLegend(0.91,0.6,0.99,0.99); |
198 | leg->SetFillColor(kWhite); | |
199 | leg->SetBorderSize(1); | |
b5bff3e2 | 200 | |
ff329095 | 201 | TCanvas* canv = new TCanvas; |
202 | canv->Divide(1,2); | |
203 | char* same = ""; | |
204 | for(int ipid = 1; ipid < nPids; ++ipid) { | |
3b8b9fc1 | 205 | TString name(Form("grNPhot%s%s_cen%d", pidNames[ipid], high, cent)); |
ff329095 | 206 | TH1* hPID = (TH1*)file->Get( name.Data() )->Clone(); |
207 | hPID->Divide(hAll); | |
b5bff3e2 | 208 | |
ff329095 | 209 | if( ++currentColorID < kNColors ) |
210 | color = colors[currentColorID] ; | |
211 | else | |
212 | color = colors[ currentColorID = 0 ]; | |
b5bff3e2 | 213 | |
ff329095 | 214 | hPID->SetMarkerColor(color); |
215 | hPID->SetLineColor(color); | |
216 | hPID->GetYaxis()->SetRangeUser(0, 1.); | |
217 | ||
218 | leg->AddEntry( hPID , pidNames[ipid], "lP"); | |
219 | ||
220 | canv->cd(1); | |
3b8b9fc1 | 221 | hPID->SetTitle( Form("#LTN_{clusters}^{PID}#GT / #LTN_{clusters}^{%s}#GT, cent=%d, %s", pidNames[0], cent, high) ); |
e65a8d2d | 222 | hPID->GetXaxis()->SetRange(0, 85); |
ff329095 | 223 | hPID->DrawCopy(same); |
224 | ||
225 | canv->cd(2); | |
226 | hPID->SetTitle(""); | |
227 | hPID->GetXaxis()->SetRange(85, 200); | |
228 | hPID->DrawCopy(same); | |
229 | ||
230 | same = "same"; | |
231 | } | |
232 | canv->cd(1); | |
233 | leg->Draw(); | |
3b8b9fc1 | 234 | TString fn(Form("CPVtoAllRatio%s_cen%d", high, cent)); |
e65a8d2d | 235 | |
236 | canv->SaveAs(Form("%s%s.pdf", prefixToName, fn.Data())); | |
237 | canv->SaveAs(Form("%s%s.png", prefixToName, fn.Data())); | |
ff329095 | 238 | } |
239 | } | |
240 | ||
241 | void DrawPIDRatios() | |
242 | { | |
243 | const int nn = 8; | |
244 | const int nc = 4; | |
245 | const char* kPIDNames[nn] = {"All", "Allwou", "CPV", "CPV2", "Disp", "Disp2", "Dispwou", "Both"}; | |
246 | const char* kPIDNamesCore[nc] = {"Allcore", "CPVcore", "Dispcore", "Bothcore"}; | |
247 | const char* fillHigh[2] = {"", "High"}; | |
3b8b9fc1 | 248 | for(int ihigh = 0; ihigh < 2; ++ihigh) { |
ff329095 | 249 | DrawPIDRatiosHighCore(kPIDNames, nn, fillHigh[ihigh]); |
3b8b9fc1 | 250 | DrawPIDRatiosHighCore(kPIDNamesCore, nc, fillHigh[ihigh]); |
ff329095 | 251 | } |
b5bff3e2 | 252 | } |
253 | ||
b5bff3e2 | 254 | void DrawQA() |
255 | { | |
256 | gStyle->SetOptStat(0); | |
5f3e9080 | 257 | gStyle->SetOptFit(1); |
b5bff3e2 | 258 | |
3b8b9fc1 | 259 | file = TFile::Open("outputQA.root", "read"); |
b5bff3e2 | 260 | |
e65a8d2d | 261 | Draw("grVtxZ10Cent", "", 0.7, 1.); |
262 | Draw("grNCellsM1", "E"); | |
263 | Draw("grNCellsM2"); | |
264 | Draw("grNCellsM3"); | |
265 | Draw("grECluster", "", 0.5, 0.7); | |
266 | Draw("grNCluster", "", 0, 40); | |
267 | Draw("grNTracks0", "", 0 , 12000); | |
268 | Draw("grNPhotAll_cen0", "", 0, 40); | |
269 | Draw("grNPhotAllcore_cen0", "", 0, 40); | |
270 | Draw("grNPhotAllwou_cen0", "", 0, 40); | |
271 | Draw("grNPhotDisp_cen0", "", 0, 40); | |
272 | Draw("grNPhotDisp2_cen0", "", 0, 40); | |
273 | Draw("grNPhotDispwou_cen0", "", 0, 40); | |
274 | Draw("grNPhotCPV_cen0", "", 0, 40); | |
275 | Draw("grNPhotCPV2_cen0", "", 0, 40); | |
276 | Draw("grNPhotBoth_cen0", "", 0, 40); | |
277 | Draw("grEnAll_cen0", "", 0.4, 0.7); | |
278 | Draw("grEnAllcore_cen0", "", 0.4, 0.7); | |
279 | Draw("grEnAllwou_cen0", "", 0.4, 0.7); | |
280 | Draw("grEnDisp_cen0", "", 0.4, 0.7); | |
281 | Draw("grEnDisp2_cen0", "", 0.4, 0.7); | |
282 | Draw("grEnDispcore_cen0", "", 0.4, 0.7); | |
283 | Draw("grEnDispwou_cen0", "", 0.4, 0.7); | |
284 | Draw("grEnCPV_cen0", "", 0.4, 0.7); | |
285 | Draw("grEnCPVcore_cen0", "", 0.4, 0.7); | |
286 | Draw("grEnCPV2_cen0", "", 0.4, 0.7); | |
287 | Draw("grEnBoth_cen0", "", 0.4, 0.7); | |
288 | Draw("grEnBothcore_cen0", "", 0.4, 0.7); | |
289 | ||
290 | ||
291 | DrawPID(); | |
292 | DrawCPVRatio(); | |
293 | DrawNPhotAllAndHigh(); | |
294 | DrawPIDRatios(); | |
295 | ||
296 | Draw("grMPi0", "LINFIT", 0.13, 0.15 ); | |
297 | Draw("grWPi0", "LINFIT"); | |
298 | Draw("grNPi0", "LINFIT"); | |
299 | ||
300 | Draw("grSERPV0Aflat", "", 0, 0.4); | |
301 | Draw("grSERPV0Cflat", "", 0, 0.4); | |
302 | Draw("grSERPTPCflat", "", 0, 0.4); | |
303 | ||
304 | Draw("grChi2RPV0A", "", 0.1, 500); | |
305 | Draw("grChi2RPV0C", "", 0.1, 500); | |
306 | Draw("grChi2RPTPC", "", 0.1, 500); | |
307 | Draw("grChi2RPV0Aflat", "", 0.1, 500); | |
308 | Draw("grChi2RPV0Cflat", "", 0.1, 500); | |
309 | Draw("grChi2RPTPCflat", "", 0.1, 500); | |
f0230efe | 310 | |
311 | Draw("grSinRPV0A1", "", 0, 0.7); | |
312 | Draw("grSinRPV0A2", "", 0, 10); | |
313 | Draw("grSinRPV0A3", "", -TMath::Pi(), TMath::Pi()); | |
314 | Draw("grSinRPV0C1", "", 0, 0.7); | |
315 | Draw("grSinRPV0C2", "", 0, 10); | |
316 | Draw("grSinRPV0C3", "", -TMath::Pi(), TMath::Pi()); | |
317 | Draw("grSinRPTPC1", "", 0, 0.7); | |
318 | Draw("grSinRPTPC2", "", 0, 10); | |
319 | Draw("grSinRPTPC3", "", -TMath::Pi(), TMath::Pi()); | |
320 | ||
b5bff3e2 | 321 | file->Close(); |
322 | } |