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