]>
Commit | Line | Data |
---|---|---|
c484014f | 1 | /* |
2 | * | |
3 | ||
4 | .L $ALICE_ROOT/TPC/Upgrade/macros/finalPlots.C+g | |
5 | finalPlots("eps10/medStat/*.debug.root","eps20/medStat/*.debug.root") | |
6 | ||
7 | finalPlots("eps10/medStat/*.debug.root","eps20/medStat/*.debug.root","/data/Work/software/svncern/papers/TDR/08-Monitoring_calib/figs") | |
8 | ||
9 | ||
10 | */ | |
11 | ||
12 | #include "TLegend.h" | |
13 | #include "TCanvas.h" | |
14 | #include "TString.h" | |
15 | #include "TStyle.h" | |
16 | #include "TColor.h" | |
17 | #include "TPaveStats.h" | |
18 | #include "TH1.h" | |
19 | #include "TFile.h" | |
20 | #include "TTree.h" | |
21 | #include "TROOT.h" | |
22 | #include "TSystem.h" | |
23 | #include "AliToyMCReconstruction.h" | |
24 | ||
25 | void SetStyle(); | |
26 | TCanvas *GetCanvas(TString name, TString title, Float_t nx=1, Float_t ny=1); | |
27 | void SaveCanvas(TCanvas *c); | |
28 | void DrawOnTop(TPad *c, TObjArray &arrHists, Bool_t stats); | |
29 | ||
30 | TString fSaveDir; | |
31 | ||
d8afb874 | 32 | //void finalPlots(const char* filesEps10, const char* filesEps20, TString saveDir="") |
33 | void finalPlots(const char* filesEps20, TString saveDir="") | |
c484014f | 34 | { |
35 | fSaveDir=saveDir; | |
36 | ||
37 | TString idealUndistorted("t1_0_0_130_10."); | |
38 | TString idealDistorted("t1_1_3_130_10."); | |
39 | TString distorted("t0_1_0_130_10."); | |
40 | TString realTracking("t0_1_2_130_10."); | |
d8afb874 | 41 | TString realTrackingPreT0("t0_1_4_130_10."); |
c484014f | 42 | |
43 | SetStyle(); | |
44 | ||
0d93b228 | 45 | // TTree *tEps10=AliToyMCReconstruction::ConnectTrees(filesEps10); |
c484014f | 46 | TTree *tEps20=AliToyMCReconstruction::ConnectTrees(filesEps20); |
47 | ||
0d93b228 | 48 | TString test(tEps20->GetCurrentFile()->GetName()); |
c484014f | 49 | if (!test.Contains("0_0_0_")) { |
50 | printf("ERROR: default file is not '0_0_0'\n"); | |
51 | return; | |
52 | } | |
53 | ||
d8afb874 | 54 | if (/*tEps10->GetListOfFriends()->GetEntries()!=5 ||*/ tEps20->GetListOfFriends()->GetEntries()!=6) { |
c484014f | 55 | printf("ERROR: wrong number of entries in the friends, not default\n"); |
56 | return; | |
57 | } | |
58 | ||
59 | TString drawStr; | |
60 | ||
61 | // | |
62 | // T0seed resolution | |
63 | // | |
64 | TCanvas *cT0res=GetCanvas("T0seedResolution","T0 seed resolution"); | |
65 | //ideal undistorted | |
66 | TH1F *hT0resI = new TH1F("hT0resI","T0 resolution;(#it{t}_{0}^{seed}-#it{t}_{0}) #upoint #it{v}_{drift};#tracks",100,-50.1,50.1); | |
67 | drawStr=Form("(%sfTime0-t0)*vDrift",idealUndistorted.Data()); | |
68 | tEps20->Draw(drawStr+">>hT0resI","","goff"); | |
69 | //fully distorted | |
70 | TH1F *hT0resD = new TH1F("hT0resD","T0 resolution;(#it{t}_{0}^{seed}-#it{t}_{0}) #upoint #it{v}_{drift};#tracks",100,-50.1,50.1); | |
71 | hT0resD->SetLineColor(kRed); | |
72 | drawStr=Form("(%sfTime0-t0)*vDrift",distorted.Data()); | |
73 | tEps20->Draw(drawStr+">>hT0resD","","goff"); | |
74 | //distorted and average correction | |
d8afb874 | 75 | TH1F *hT0resDC = new TH1F("hT0resDC","T0 resolution;(#it{t}_{0}^{seed}-#it{t}_{0}) #upoint #it{v}_{d} (cm);#tracks",100,-50.1,50.1); |
c484014f | 76 | // hT0resDC->SetLineColor(kGreen+2); |
77 | drawStr=Form("(%sfTime0-t0)*vDrift",realTracking.Data()); | |
78 | tEps20->Draw(drawStr+">>hT0resDC","","goff"); | |
79 | ||
d8afb874 | 80 | TH1F *hT0resDCPreT0 = new TH1F("hT0resDCPreT0","T0 resolution;(#it{t}_{0}^{seed}-#it{t}_{0}) #upoint #it{v}_{drift};#tracks",100,-50.1,50.1); |
81 | drawStr=Form("(%sfTime0-t0)*vDrift",realTrackingPreT0.Data()); | |
82 | tEps20->Draw(drawStr+">>hT0resDCPreT0","","goff"); | |
83 | ||
84 | // hT0resI->Draw(); | |
85 | // hT0resD->Draw("same"); | |
c484014f | 86 | hT0resDC->Draw(/*"same"*/); |
d8afb874 | 87 | //hT0resDCPreT0->Draw(/*"same"*/); |
c484014f | 88 | |
89 | SaveCanvas(cT0res); | |
90 | ||
91 | // | |
92 | // Track parameter resolution (y) with ideal clusters at the ITS and inner wall of the TPC | |
93 | // | |
94 | TCanvas *cYresComparison=GetCanvas("YresComparison","Comparison of Yres for ideal clusters"); | |
95 | //ideal clusters at the ITS outermost point | |
d8afb874 | 96 | TH1F *hYresITS = new TH1F("hYresITS",";#it{y}_{TPC}-#it{y}_{ITS} (cm);#tracks",100,-0.21,0.21); |
c484014f | 97 | drawStr=Form("%strackITS.fP[0]-%stRealITS.fP[0]",idealUndistorted.Data(),idealUndistorted.Data()); |
98 | tEps20->Draw(drawStr+">>hYresITS","","goff"); | |
99 | hYresITS->SetLineColor(kRed); | |
100 | ||
d8afb874 | 101 | TH1F *hYresTPC = new TH1F("hYresTPC",";#it{y}_{TPC}-#it{y}_{ITS} (cm);#tracks",100,-0.21,0.21); |
c484014f | 102 | drawStr=Form("%strackITS2.fP[0]-%stRealITS2.fP[0]",idealUndistorted.Data(),idealUndistorted.Data()); |
103 | tEps20->Draw(drawStr+">>hYresTPC","","goff"); | |
104 | ||
105 | hYresTPC->Draw(); | |
106 | hYresITS->Draw("same"); | |
107 | ||
108 | SaveCanvas(cYresComparison); | |
109 | ||
110 | // | |
111 | // Track parameter resolution (y) with fully distorted clusters at the inner wall of the TPC | |
112 | // | |
113 | ||
114 | TCanvas *cYresDistorted=GetCanvas("YresDistorted","Yres for fully distorted clusters"); | |
115 | //ideal clusters at the ITS outermost point | |
d8afb874 | 116 | TH1F *hYresDist = new TH1F("hYresDist",";#it{y}_{TPC}-#it{y}_{ITS} (cm);#tracks",100,-15.5,15.5); |
c484014f | 117 | drawStr=Form("%strackITS2.fP[0]-%stRealITS2.fP[0]",distorted.Data(),distorted.Data()); |
118 | tEps20->Draw(drawStr+">>hYresDist","","goff"); | |
119 | ||
120 | hYresDist->Draw(); | |
121 | ||
122 | SaveCanvas(cYresDistorted); | |
123 | ||
124 | // | |
125 | // Track parameter resolution (y) with fully distorted and corrected clusters (Tzero seed) | |
126 | // at the inner wall of the TPC | |
127 | // | |
128 | ||
129 | TCanvas *cYresDistCorrTzeroSeed=GetCanvas("YresDistCorrTzeroSeed","Yres for fully distorted/corrected clusters (Tzero seed)"); | |
130 | //ideal clusters at the ITS outermost point | |
d8afb874 | 131 | TH1F *hYresDistCorrTzeroSeed = new TH1F("hYresDistCorrTzeroSeed",";#it{y}_{TPC}-#it{y}_{ITS} (cm);#tracks",100,-.85,0.85); |
c484014f | 132 | drawStr=Form("%strackITS2.fP[0]-%stRealITS2.fP[0]",realTracking.Data(),realTracking.Data()); |
133 | tEps20->Draw(drawStr+">>hYresDistCorrTzeroSeed","","goff"); | |
134 | ||
135 | hYresDistCorrTzeroSeed->Draw(); | |
136 | ||
137 | SaveCanvas(cYresDistCorrTzeroSeed); | |
138 | ||
139 | // | |
140 | // Track parameter resolution (y) with fully distorted and corrected clusters (Tzero seed) | |
141 | // at the inner wall of the TPC | |
142 | // | |
143 | ||
144 | TCanvas *cYresDistCorrTzero=GetCanvas("YresDistCorrTzero","Yres for fully distorted/corrected clusters (Tzero)"); | |
145 | //ideal clusters at the ITS outermost point | |
d8afb874 | 146 | TH1F *hYresDistCorrTzero = new TH1F("hYresDistCorrTzero",";#it{y}_{TPC}-#it{y}_{ITS} (cm);#tracks",100,-.5,.85); |
c484014f | 147 | drawStr=Form("%strackITS2.fP[0]-%stRealITS2.fP[0]",idealDistorted.Data(),idealDistorted.Data()); |
148 | tEps20->Draw(drawStr+">>hYresDistCorrTzero","","goff"); | |
149 | ||
150 | hYresDistCorrTzero->Draw(); | |
151 | ||
152 | SaveCanvas(cYresDistCorrTzero); | |
153 | ||
154 | ||
155 | // | |
156 | // plot all params | |
157 | // | |
158 | ||
d8afb874 | 159 | TString titles[5]={"#it{y}_{TPC}-#it{y}_{ITS} (cm)","#it{z}_{TPC}-#it{z}_{ITS} (cm)","sin(#it{#alpha})_{TPC}-sin(#it{#alpha})_{ITS}","tan(#it{#lambda})_{TPC}-tan(#it{#lambda})_{ITS}","1/#it{p}_{T TPC}-1/#it{p}_{T ITS} ((GeV/#it{c})^{-1})"}; |
9314dc19 | 160 | Double_t min[5]={-.85,-0.199,-.009,-.0019,-.05}; |
161 | Double_t max[5]={ .85, 0.199, .009, .0019, .05}; | |
c484014f | 162 | TString type[3]={idealUndistorted,idealDistorted,realTracking}; |
163 | Int_t colors[3]={kBlack,kGreen-2,kRed}; | |
164 | ||
165 | TLegend *leg=new TLegend(.1,.55,.95,.95); | |
166 | leg->SetTextSize(0.075); | |
167 | leg->SetBorderSize(1); | |
168 | leg->SetFillColor(10); | |
169 | TCanvas *cResParams=GetCanvas("ResParams","Resolution of parameters",1.2,1.8); | |
170 | cResParams->Divide(2,3); | |
171 | for (Int_t i=0;i<5;++i){ | |
172 | TPad *pad=(TPad*)cResParams->cd(i+1); | |
173 | TObjArray arr; | |
174 | for (Int_t it=0; it<3; ++it) { | |
175 | TH1F *hResParams=new TH1F(Form("hResParams_%d_%d",i,it), | |
176 | Form(";%s;#tracks",titles[i].Data()), | |
177 | 100,min[i],max[i]); | |
178 | drawStr=Form("%strackITS2.fP[%d]-tRealITS2.fP[%d]",type[it].Data(),i,i); | |
179 | tEps20->Draw(drawStr+Form(">>hResParams_%d_%d",i,it),"","goff"); | |
180 | hResParams->SetLineColor(colors[it]); | |
181 | arr.Add(hResParams); | |
182 | } | |
183 | if (i==0) { | |
184 | leg->AddEntry(arr.At(0),"no distortions (ideal)","l"); | |
185 | leg->AddEntry(arr.At(1),"distorted/corrected (t_{0})","l"); | |
186 | leg->AddEntry(arr.At(2),"distorted/corrected (t_{0}^{seed})","l"); | |
187 | } | |
188 | DrawOnTop(pad,arr,kTRUE); | |
189 | } | |
190 | ||
191 | cResParams->cd(6); | |
192 | leg->Draw(); | |
193 | SaveCanvas(cResParams); | |
194 | } | |
195 | ||
196 | ||
197 | TCanvas *GetCanvas(TString name, TString title, Float_t nx, Float_t ny) | |
198 | { | |
199 | TCanvas *c=(TCanvas*)gROOT->GetListOfCanvases()->FindObject(name.Data()); | |
200 | if (!c) c=new TCanvas(name,title,nx*700,ny*500); | |
201 | c->Clear(); | |
202 | c->cd(); | |
203 | return c; | |
204 | } | |
205 | ||
206 | void SaveCanvas(TCanvas *c) | |
207 | { | |
208 | // | |
209 | // | |
210 | // | |
211 | ||
212 | if (fSaveDir.IsNull()) return; | |
213 | ||
214 | c->SaveAs(Form("/tmp/%s.eps",c->GetName())); | |
215 | gSystem->Exec(Form("ps2pdf -dEPSCrop /tmp/%s.eps %s/%s.pdf",c->GetName(),fSaveDir.Data(),c->GetName())); | |
216 | } | |
217 | ||
218 | void DrawOnTop(TPad *c, TObjArray &arrHists, Bool_t /*stats*/) | |
219 | { | |
220 | Double_t min=0,max=0; | |
221 | Double_t ystatMax=gStyle->GetStatY(); | |
222 | Double_t ystatH =gStyle->GetStatH()*2./3.; | |
223 | const Int_t nHists=arrHists.GetEntriesFast(); | |
224 | for (Int_t iHist=0; iHist<nHists; ++iHist) { | |
225 | TH1 *h=(TH1*)arrHists.UncheckedAt(iHist); | |
226 | TPad *pad = new TPad(Form("%s_%d",c->GetName(),iHist+1),"",0,0,1,1); | |
227 | pad->SetFillStyle(4000); | |
228 | pad->SetFrameFillStyle(0); | |
229 | pad->Draw(); | |
230 | pad->cd(); | |
231 | if (iHist>0) { | |
232 | h->SetMinimum(min); | |
233 | h->SetMaximum(max); | |
234 | pad->SetTicky(0); | |
235 | pad->SetTickx(0); | |
236 | } | |
237 | h->Draw((iHist==0)?"":"AH"); | |
238 | pad->Update(); | |
239 | if (iHist==0){ | |
240 | min=pad->GetUymin(); | |
241 | max=pad->GetUymax(); | |
242 | printf("min: %.2f %.2f\n",min,max); | |
243 | } | |
244 | TPaveStats *ps = (TPaveStats*)h->GetListOfFunctions()->FindObject("stats"); | |
245 | if (!ps) printf("shitttt %s\n",h->GetName()); | |
246 | else { | |
247 | ps->SetTextColor(h->GetLineColor()); | |
248 | ps->SetY2NDC(ystatMax-iHist*ystatH); | |
249 | ps->SetY1NDC(ystatMax-(iHist+1)*ystatH);} | |
250 | } | |
251 | } | |
252 | ||
253 | void SetStyle() | |
254 | { | |
255 | const Int_t NCont=255; | |
256 | //const Int_t NCont=50; | |
257 | ||
258 | TStyle *st = new TStyle("mystyle","mystyle"); | |
259 | gROOT->GetStyle("Plain")->Copy((*st)); | |
260 | st->SetTitleX(0.1); | |
261 | st->SetTitleW(0.8); | |
262 | st->SetTitleH(0.08); | |
263 | st->SetStatX(.95); | |
264 | st->SetStatY(.95); | |
265 | st->SetStatW(.25); | |
266 | st->SetStatH(.25); | |
267 | st->SetNumberContours(NCont); | |
268 | st->SetPalette(1,0); | |
269 | st->SetOptStat("rm"); | |
270 | st->SetOptTitle(0); | |
271 | st->SetOptFit(0); | |
272 | st->SetGridColor(kGray+1); | |
273 | // st->SetPadGridX(kTRUE); | |
274 | // st->SetPadGridY(kTRUE); | |
275 | st->SetPadTickX(kTRUE); | |
276 | st->SetPadTickY(kTRUE); | |
277 | st->SetMarkerStyle(20); | |
278 | st->SetMarkerSize(.5); | |
279 | ||
280 | st->SetPadLeftMargin(0.12); | |
281 | st->SetPadBottomMargin(0.12); | |
282 | st->SetPadRightMargin(0.05); | |
283 | st->SetPadTopMargin(0.05); | |
284 | st->cd(); | |
285 | ||
286 | Int_t nimTPCFont=42; //or 62 for sans serif font | |
287 | //default definitions | |
288 | st->SetTextFont(nimTPCFont); | |
289 | st->SetTitleFont(nimTPCFont, "T"); | |
290 | st->SetTitleFont(nimTPCFont, "XYZ"); | |
291 | st->SetLabelFont(nimTPCFont,"XYZ"); | |
292 | st->SetLabelSize(0.045,"XYZ"); | |
293 | st->SetTitleSize(0.05,"XYZ"); | |
294 | st->SetTitleOffset(1.1,"XZ"); | |
295 | st->SetTitleOffset(1.3,"Y"); | |
296 | st->SetStatFont(nimTPCFont); | |
297 | st->SetOptTitle(0); | |
298 | st->SetPalette(1,0); | |
299 | st->SetStatBorderSize(1); | |
300 | new TColor(2001,1,1,1); | |
301 | st->SetFillColor(2001); | |
302 | st->SetTickLength(gStyle->GetTickLength()/696.*472.,"y"); | |
303 | ||
304 | const Int_t NRGBs = 5; | |
305 | Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 }; | |
306 | Double_t red[NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 }; | |
307 | Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 }; | |
308 | Double_t blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 }; | |
309 | //grey | |
310 | // Double_t stops[5] = {0.00, 0.34, 0.61, 0.84, 1.00}; | |
311 | // Double_t red[5] = {1.00, 0.84, 0.61, 0.34, 0.00}; | |
312 | // Double_t green[5] = {1.00, 0.84, 0.61, 0.34, 0.00}; | |
313 | // Double_t blue[5] = {1.00, 0.84, 0.61, 0.34, 0.00}; | |
314 | ||
315 | TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont); | |
316 | ||
317 | st->cd(); | |
318 | } | |
319 |