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