1 #include "TCanvas.h" // needed for some reason.
4 const char* prefixToName = "imgs/";
5 const char* appendToName = ".pdf";
8 void Draw(const char* name, const char* options = "", double yFrom=0., double yTo=-1.)
10 TH1* hist = ((TH1*)file->Get(name))->Clone();
11 //hist->SetAxisRange(0, 30 );
12 hist->GetXaxis()->SetLabelSize(0.011);
13 //hist->GetXaxis()->SetTitle("Run");
14 hist->GetXaxis()->SetRange(1,84);
16 hist->GetYaxis()->SetRangeUser(yFrom, yTo);
19 //if( ! TString(options).Contains("same") )
20 TCanvas* canv = new TCanvas;
22 hist->GetYaxis()->SetNdivisions(16);
26 hist->GetXaxis()->SetLabelSize(0.051);
29 hist->GetXaxis()->SetRange(1,84);
30 hist->DrawCopy(options);
33 hist->GetXaxis()->SetRange(85,200);
34 hist->DrawCopy(options);
37 canv->SaveAs(Form("%s%s%s", prefixToName, hist->GetName(), appendToName ));
43 for(int cent=0; cent<kNCents; ++cent) {
44 TH1* grNPhotAll = (TH1*)file->Get(Form("grNPhotAll_cen%d", cent))->Clone();
45 TH1* grNPhotDisp = (TH1*)file->Get(Form("grNPhotDisp_cen%d", cent))->Clone();
46 TH1* grNPhotDisp2 = (TH1*)file->Get(Form("grNPhotDisp2_cen%d", cent))->Clone();
47 TH1* grNPhotCPV = (TH1*)file->Get(Form("grNPhotCPV_cen%d", cent))->Clone();
48 TH1* grNPhotCPV2 = (TH1*)file->Get(Form("grNPhotCPV2_cen%d", cent))->Clone();
50 grNPhotAll->GetXaxis()->SetLabelSize(0.045);
51 grNPhotAll->GetYaxis()->SetRangeUser(0, 40);
53 grNPhotAll ->SetMarkerColor(kBlack);
54 grNPhotDisp ->SetMarkerColor(kCyan+1);
55 grNPhotDisp2->SetMarkerColor(kBlue);
56 grNPhotCPV ->SetMarkerColor(kOrange+1);
57 grNPhotCPV2 ->SetMarkerColor(kRed);
59 TCanvas* canv = new TCanvas;
63 grNPhotAll->SetTitle("#LTN_{clusters}^{PID}#GT");
64 grNPhotAll->GetXaxis()->SetRange(0, 84);
65 grNPhotAll->DrawCopy();
66 grNPhotDisp->DrawCopy("same");
67 grNPhotDisp2->DrawCopy("same");
68 grNPhotCPV->DrawCopy("same");
69 grNPhotCPV2->DrawCopy("same");
72 grNPhotAll->SetTitle("");
73 grNPhotAll->GetXaxis()->SetRange(85, 200);
74 grNPhotAll->DrawCopy();
75 grNPhotDisp->DrawCopy("same");
76 grNPhotDisp2->DrawCopy("same");
77 grNPhotCPV->DrawCopy("same");
78 grNPhotCPV2->DrawCopy("same");
81 leg = new TLegend(0.9,0.7,0.99,0.99);
82 leg->SetFillColor(kWhite);
83 leg->SetBorderSize(1);
84 leg->AddEntry(Form("grNPhotAll_cen%d",cent),"All","lP");
85 leg->AddEntry(Form("grNPhotCPV_cen%d",cent),"CPV","lP");
86 leg->AddEntry(Form("grNPhotCPV2_cen%d",cent),"CPV2","lP");
87 leg->AddEntry(Form("grNPhotDisp_cen%d",cent),"Disp","lP");
88 leg->AddEntry(Form("grNPhotDisp2_cen%d",cent),"Disp2","lP");
91 canv->SaveAs(Form("%s%s%s", prefixToName, Form("nPhotPID_cen%d", cent), appendToName ));
97 for(int cent=0; cent<kNCents; ++cent) {
98 TH1* grNPhotAll = (TH1*)file->Get(Form("grNPhotAll_cen0", cent))->Clone();
99 TH1* grNPhotCPV = (TH1*)file->Get(Form("grNPhotCPV_cen0", cent))->Clone();
100 TH1* grNPhotCPV2 = (TH1*)file->Get(Form("grNPhotCPV2_cen0", cent))->Clone();
102 grNPhotCPV->Divide(grNPhotAll);
103 grNPhotCPV->SetTitle(Form("%s / %s", grNPhotCPV->GetTitle(), grNPhotAll->GetTitle()));
104 grNPhotCPV->GetYaxis()->SetRangeUser(0.7,0.85);
106 grNPhotCPV2->Divide(grNPhotAll);
108 TCanvas* canv = new TCanvas;
111 grNPhotCPV->GetXaxis()->SetRange(0, 84);
112 grNPhotCPV->DrawCopy();
115 grNPhotCPV->SetTitle("");
116 grNPhotCPV->GetXaxis()->SetRange(85, 200);
117 grNPhotCPV->DrawCopy();
119 canv->SaveAs(Form("%s%s%s", prefixToName, Form("CPVtoAllRatio_cen%d", cent), appendToName ));
123 void DrawNPhotAllAndHigh()
125 for(int cent=0; cent<kNCents; ++cent) {
126 TH1* grNPhotAll = (TH1*)file->Get(Form("grNPhotAll_cen0", cent))->Clone();
127 TH1* grNPhotAllHigh = (TH1*)file->Get(Form("grNPhotAllHigh_cen0", cent))->Clone();
129 double sizeAll = grNPhotAll->Integral();
130 double sizeAllHigh = grNPhotAllHigh->Integral();
131 double scale = (sizeAll / sizeAllHigh);
132 grNPhotAllHigh->Scale(scale);
134 grNPhotAllHigh->SetMarkerColor(kRed);
135 grNPhotAllHigh->SetLineColor(kRed);
137 TCanvas* canv = new TCanvas;
141 grNPhotAll->SetTitle("#LTN_{clusters}#GT");
142 grNPhotAll->GetXaxis()->SetRange(0, 84);
143 int min = grNPhotAll->GetMinimum(1.);
144 int max = grNPhotAll->GetMaximum() +1;
145 //grNPhotAll->GetYaxis()->SetRangeUser( min, max);
146 grNPhotAll->DrawCopy();
147 grNPhotAllHigh->DrawCopy("same");
150 grNPhotAll->GetXaxis()->SetRange(85, 200);
151 grNPhotAll->DrawCopy();
152 grNPhotAllHigh->DrawCopy("same");
155 leg = new TLegend(0.8,0.8,0.99,0.99);
156 leg->SetFillColor(kWhite);
157 leg->SetBorderSize(1);
158 leg->AddEntry(grNPhotAll, Form("All"),"lP");
159 leg->AddEntry(grNPhotAllHigh, Form("High * %f", scale),"lP");
162 canv->SaveAs( Form("%s%s%s", prefixToName, Form("nPhotAllAndHigh_cen%d", cent), appendToName ));
166 void DrawPIDRatiosHighCore(const char* pidNames[], int nPids, const char* append)
169 const Int_t colors[8] = {kBlack, kRed-1, kRed+1, kBlue, kCyan, kGreen+3, kYellow+1, kMagenta};
170 int currentColorID = 99999;
173 for(int cent=0; cent<kNCents; ++cent) {
174 TH1* hAll = (TH1*)file->Get( Form("grNPhot%s%s_cen%d", pidNames[0], append, cent) )->Clone();
176 leg = new TLegend(0.91,0.6,0.99,0.99);
177 leg->SetFillColor(kWhite);
178 leg->SetBorderSize(1);
180 TCanvas* canv = new TCanvas;
183 for(int ipid = 1; ipid < nPids; ++ipid) {
184 TString name(Form("grNPhot%s%s_cen%d", pidNames[ipid], append, cent));
185 TH1* hPID = (TH1*)file->Get( name.Data() )->Clone();
188 if( ++currentColorID < kNColors )
189 color = colors[currentColorID] ;
191 color = colors[ currentColorID = 0 ];
193 hPID->SetMarkerColor(color);
194 hPID->SetLineColor(color);
195 hPID->GetYaxis()->SetRangeUser(0, 1.);
197 leg->AddEntry( hPID , pidNames[ipid], "lP");
200 hPID->SetTitle( Form("#LTN_{clusters}^{PID}#GT, cent=%d, %s", cent, append) );
201 hPID->GetXaxis()->SetRange(0, 84);
202 hPID->DrawCopy(same);
206 hPID->GetXaxis()->SetRange(85, 200);
207 hPID->DrawCopy(same);
213 canv->SaveAs(Form("%s%s%s", prefixToName, Form("CPVtoAllRatio_cen%d", cent), appendToName ));
221 const char* kPIDNames[nn] = {"All", "Allwou", "CPV", "CPV2", "Disp", "Disp2", "Dispwou", "Both"};
222 const char* kPIDNamesCore[nc] = {"Allcore", "CPVcore", "Dispcore", "Bothcore"};
223 const char* fillHigh[2] = {"", "High"};
224 for(int ihigh = 0; ihigh < 1; ++ihigh) {
225 DrawPIDRatiosHighCore(kPIDNames, nn, fillHigh[ihigh]);
226 //DrawPIDRatiosHighCore(kPIDNamesCore, nc, fillHigh[ihigh]);
232 gStyle->SetOptStat(0);
234 file = TFile::Open("runQA.root", "read");
236 // Draw("grVtxZ10Cent", "", 0.7, 1.);
237 // Draw("grNCellsM1", "E");
238 // Draw("grNCellsM2");
239 // Draw("grNCellsM3");
240 // Draw("grECluster", "", 0.5, 0.7);
241 // Draw("grNCluster", "", 0, 40);
242 // Draw("grNTracks0", "", 0 , 12000);
243 // Draw("grNPhotAll_cen0", "", 0, 40);
244 // Draw("grNPhotAllcore_cen0", "", 0, 40);
245 // Draw("grNPhotAllwou_cen0", "", 0, 40);
246 // Draw("grNPhotDisp_cen0", "", 0, 40);
247 // Draw("grNPhotDisp2_cen0", "", 0, 40);
248 // Draw("grNPhotDispwou_cen0", "", 0, 40);
249 // Draw("grNPhotCPV_cen0", "", 0, 40);
250 // Draw("grNPhotCPV2_cen0", "", 0, 40);
251 // Draw("grNPhotBoth_cen0", "", 0, 40);
252 // Draw("grEnAll_cen0", "", 0.4, 0.7);
253 // Draw("grEnAllcore_cen0", "", 0.4, 0.7);
254 // Draw("grEnAllwou_cen0", "", 0.4, 0.7);
255 // Draw("grEnDisp_cen0", "", 0.4, 0.7);
256 // Draw("grEnDisp2_cen0", "", 0.4, 0.7);
257 // Draw("grEnDispcore_cen0", "", 0.4, 0.7);
258 // Draw("grEnDispwou_cen0", "", 0.4, 0.7);
259 // Draw("grEnCPV_cen0", "", 0.4, 0.7);
260 // Draw("grEnCPVcore_cen0", "", 0.4, 0.7);
261 // Draw("grEnCPV2_cen0", "", 0.4, 0.7);
262 // Draw("grEnBoth_cen0", "", 0.4, 0.7);
263 // Draw("grEnBothcore_cen0", "", 0.4, 0.7);
268 DrawNPhotAllAndHigh();