]>
Commit | Line | Data |
---|---|---|
91fd44c9 | 1 | /* |
5813554a | 2 | Draw result of perfomance test: |
3 | ||
4 | aliroot -b -q $ALICE_ROOT/TPC/scripts/loadTPCcalib.C $ALICE_ROOT/TPC/CalibMacros/CalibCosmic.C | |
5 | ||
712f2cab | 6 | //gROOT->Macro("~/NimStyle.C"); |
91fd44c9 | 7 | gSystem->Load("libANALYSIS"); |
8 | gSystem->Load("libTPCcalib"); | |
9 | .L $ALICE_ROOT/TPC/CalibMacros/CalibCosmic.C | |
10 | // init | |
11 | Init(); | |
712f2cab | 12 | SetDefaultCut(); // check defualt cut |
13 | // | |
14 | MakeDefaultPlots(); | |
15 | ||
5813554a | 16 | gROOT->Macro("~/NimStyle.C"); |
17 | TFile f("cosmicPlots.root"); | |
18 | TBrowser b | |
19 | b.Add(CosmicPlots,"CosmicPlot"); | |
712f2cab | 20 | |
91fd44c9 | 21 | */ |
35a255d8 | 22 | |
91fd44c9 | 23 | AliTPCcalibCosmic * cosmic =0; |
24 | TObjArray fitArr; | |
5813554a | 25 | Int_t colors[3]={1,3,4}; |
91fd44c9 | 26 | |
712f2cab | 27 | void CalibCosmic(){ |
28 | // init | |
29 | Init(); | |
30 | SetDefaultCut(); | |
31 | // | |
32 | MakeDefaultPlots(); | |
33 | } | |
34 | ||
91fd44c9 | 35 | void Init(){ |
36 | // | |
37 | // | |
712f2cab | 38 | TFile fcalib("CalibObjectsTrain1.root"); |
39 | cosmic = ( AliTPCcalibCosmic *)fcalib.Get("cosmicTPC"); | |
91fd44c9 | 40 | TString axisName[9]; |
41 | axisName[0] ="#Delta"; axisName[1] ="N_{cl}"; | |
35a255d8 | 42 | axisName[2] ="DCA_{r}(cm)"; |
91fd44c9 | 43 | axisName[3] ="z (cm)"; axisName[4] ="sin(#phi)"; |
35a255d8 | 44 | axisName[5] ="tan(#theta)"; axisName[6] ="1/p_{t} (1/GeV)"; |
45 | axisName[7] ="p_{t} (GeV)"; axisName[8] ="alpha"; | |
91fd44c9 | 46 | |
47 | { | |
48 | for (Int_t ivar=0;ivar<6;ivar++){ | |
49 | for (Int_t ivar2=0;ivar2<9;ivar2++){ | |
50 | cosmic->fHistoDelta[ivar]->GetAxis(ivar2)->SetName(axisName[ivar2].Data()); | |
51 | cosmic->fHistoDelta[ivar]->GetAxis(ivar2)->SetTitle(axisName[ivar2].Data()); | |
52 | cosmic->fHistoPull[ivar]->GetAxis(ivar2)->SetName(axisName[ivar2].Data()); | |
53 | cosmic->fHistoPull[ivar]->GetAxis(ivar2)->SetTitle(axisName[ivar2].Data()); | |
54 | } | |
55 | } | |
56 | } | |
57 | } | |
58 | ||
35a255d8 | 59 | void SetRangeAll(Int_t axis, Float_t xmin, Float_t xmax){ |
60 | ||
91fd44c9 | 61 | for (Int_t i=0;i<6;i++){ |
62 | // | |
35a255d8 | 63 | cosmic->fHistoDelta[i]->GetAxis(axis)->SetRangeUser(xmin,xmax); |
64 | cosmic->fHistoPull[i]->GetAxis(axis)->SetRangeUser(xmin,xmax); | |
65 | } | |
66 | } | |
67 | ||
91fd44c9 | 68 | |
35a255d8 | 69 | void SetDefaultCut(){ |
70 | for (Int_t i=0;i<6;i++){ | |
71 | // | |
712f2cab | 72 | //cut on number of clusters |
35a255d8 | 73 | cosmic->fHistoDelta[i]->GetAxis(1)->SetRangeUser(120,200); |
74 | cosmic->fHistoPull[i]->GetAxis(1)->SetRangeUser(120,200); | |
712f2cab | 75 | //cut on DCA r |
5813554a | 76 | cosmic->fHistoDelta[i]->GetAxis(2)->SetRangeUser(0,15); |
77 | cosmic->fHistoPull[i]->GetAxis(2)->SetRangeUser(0,15); | |
712f2cab | 78 | //cut on z at |
5813554a | 79 | cosmic->fHistoDelta[i]->GetAxis(3)->SetRangeUser(20,200); |
80 | cosmic->fHistoPull[i]->GetAxis(3)->SetRangeUser(20,200); | |
91fd44c9 | 81 | } |
712f2cab | 82 | cosmic->fHistoDelta[0]->GetAxis(0)->SetRangeUser(-1,1); |
83 | cosmic->fHistoDelta[1]->GetAxis(0)->SetRangeUser(-1,1); | |
91fd44c9 | 84 | } |
85 | ||
86 | TH2 * GetDelta2D(Int_t type, Int_t var){ | |
87 | TH2 * his = cosmic->fHistoDelta[type]->Projection(0,var); | |
88 | his->SetXTitle(cosmic->fHistoDelta[type]->GetAxis(var)->GetName()); | |
89 | his->SetYTitle(cosmic->fHistoDelta[type]->GetAxis(0)->GetName()); | |
90 | return his; | |
91 | } | |
92 | ||
93 | ||
712f2cab | 94 | TH1* GetFit2D(Int_t type, Int_t var, Bool_t resol){ |
91fd44c9 | 95 | |
96 | TH2 * his = cosmic->fHistoDelta[type]->Projection(0,var); | |
97 | his->SetXTitle(cosmic->fHistoDelta[type]->GetAxis(var)->GetName()); | |
98 | his->SetYTitle(cosmic->fHistoDelta[type]->GetAxis(0)->GetName()); | |
99 | his->FitSlicesY(0,0,-1,0,"QNR",&fitArr); | |
712f2cab | 100 | TH1 * hres = 0; |
101 | if (resol) hres = (TH1*)(fitArr.At(2)->Clone()); | |
102 | if (!resol) hres = (TH1*)(fitArr.At(1)->Clone()); | |
103 | hres->SetMarkerStyle(20); | |
104 | hres->SetMarkerColor(2); | |
5813554a | 105 | hres->GetYaxis()->SetTitleOffset(1.8); |
106 | hres->GetYaxis()->SetDecimals(kTRUE); | |
91fd44c9 | 107 | return hres; |
108 | } | |
109 | ||
110 | ||
111 | TH1 * GetDelta(Int_t type){ | |
112 | TH1 * his = cosmic->fHistoDelta[type]->Projection(0); | |
113 | his->SetXTitle(cosmic->fHistoDelta[type]->GetAxis(0)->GetName()); | |
114 | return his; | |
115 | } | |
116 | ||
117 | TH2 * GetPull2D(Int_t type, Int_t var){ | |
118 | TH2 * his = cosmic->fHistoPull[type]->Projection(0,var); | |
119 | his->SetXTitle(cosmic->fHistoPull[type]->GetAxis(var)->GetName()); | |
120 | his->SetYTitle(cosmic->fHistoPull[type]->GetAxis(0)->GetName()); | |
121 | return his; | |
122 | } | |
123 | ||
124 | TH1* GetPull2DSigma(Int_t type, Int_t var){ | |
125 | ||
126 | TH2 * his = cosmic->fHistoPull[type]->Projection(0,var); | |
127 | his->SetXTitle(cosmic->fHistoPull[type]->GetAxis(var)->GetName()); | |
128 | his->SetYTitle(cosmic->fHistoPull[type]->GetAxis(0)->GetName()); | |
129 | his->FitSlicesY(0,0,-1,0,"QNR",&fitArr); | |
130 | TH1 * hres = (TH1*)(fitArr.At(2)->Clone()); | |
131 | return hres; | |
132 | } | |
133 | ||
134 | ||
135 | ||
136 | TH1 * GetPull(Int_t type){ | |
137 | TH1 * his = cosmic->fHistoPull[type]->Projection(0); | |
138 | his->SetXTitle(cosmic->fHistoPull[type]->GetAxis(0)->GetName()); | |
139 | return his; | |
140 | } | |
35a255d8 | 141 | |
142 | ||
143 | void DrawResoldEdx(AliTPCcalibCosmic *cosmic){ | |
144 | // | |
145 | // | |
146 | // | |
147 | Int_t kmicolors[10]={1,2,3,6,7,8,9,10,11,12}; | |
148 | Int_t kmimarkers[10]={21,22,23,24,25,26,27,28,29,30}; | |
149 | TH2 *htemp; | |
150 | TObjArray arr; | |
151 | TH1 * hResolMax[4]; | |
152 | TH1 * hResolTot[4]; | |
153 | // | |
154 | for (Int_t ipad=0;ipad<4;ipad++){ | |
155 | cosmic->fHistodEdxTot[ipad]->GetAxis(4)->SetRangeUser(-0.6,0.6); | |
156 | cosmic->fHistodEdxMax[ipad]->GetAxis(4)->SetRangeUser(-0.6,0.6); | |
157 | } | |
158 | cosmic->fHistodEdxTot[0]->GetAxis(1)->SetRangeUser(30,62); | |
159 | cosmic->fHistodEdxTot[1]->GetAxis(1)->SetRangeUser(30,62); | |
160 | cosmic->fHistodEdxTot[2]->GetAxis(1)->SetRangeUser(10,35); | |
161 | cosmic->fHistodEdxTot[3]->GetAxis(1)->SetRangeUser(10,150); | |
162 | cosmic->fHistodEdxMax[0]->GetAxis(1)->SetRangeUser(30,62); | |
163 | cosmic->fHistodEdxMax[1]->GetAxis(1)->SetRangeUser(30,62); | |
164 | cosmic->fHistodEdxMax[2]->GetAxis(1)->SetRangeUser(10,35); | |
165 | cosmic->fHistodEdxMax[3]->GetAxis(1)->SetRangeUser(10,150); | |
166 | // | |
167 | ||
168 | for (Int_t ipad=0;ipad<4;ipad++){ | |
169 | htemp = cosmic->fHistodEdxTot[ipad]->Projection(0,1); | |
170 | htemp->FitSlicesY(0,0,-1,0,"QNR",&arr); | |
171 | hResolTot[ipad] = (TH1*)(arr.At(2)->Clone()); | |
172 | delete htemp; | |
173 | arr.SetOwner(kTRUE); | |
174 | arr.Delete(); | |
175 | hResolTot[ipad]->Scale(1./TMath::Sqrt(2.)); | |
176 | // | |
177 | htemp = cosmic->fHistodEdxMax[ipad]->Projection(0,1); | |
178 | htemp->FitSlicesY(0,0,-1,0,"QNR",&arr); | |
179 | hResolMax[ipad] = (TH1*)(arr.At(2)->Clone()); | |
180 | delete htemp; | |
181 | arr.SetOwner(kTRUE); | |
182 | arr.Delete(); | |
183 | hResolMax[ipad]->Scale(1./TMath::Sqrt(2.)); | |
184 | } | |
185 | hResolTot[3]->GetXaxis()->SetRangeUser(0,160); | |
186 | hResolTot[3]->SetXTitle("N_{cl}"); | |
187 | hResolTot[3]->SetYTitle("#sigma(dEdx/dEdx_{d})/#sqrt{2.}"); | |
188 | hResolTot[3]->SetTitle("Relative dEdx resolution"); | |
189 | for (Int_t ipad=3;ipad>=0;ipad--){ | |
190 | hResolTot[ipad]->SetMaximum(0.1); | |
191 | hResolTot[ipad]->SetMinimum(0.); | |
192 | hResolTot[ipad]->SetMarkerColor(kmicolors[ipad]+0); | |
193 | hResolTot[ipad]->SetMarkerStyle(kmimarkers[ipad]+1); | |
194 | if (ipad==3) hResolTot[ipad]->Draw(); | |
195 | hResolTot[ipad]->Draw("same"); | |
196 | // | |
197 | hResolMax[ipad]->SetMaximum(0.1); | |
198 | hResolMax[ipad]->SetMinimum(0.); | |
199 | hResolMax[ipad]->SetMarkerColor(kmicolors[ipad]+0); | |
200 | hResolMax[ipad]->SetMarkerStyle(kmimarkers[ipad]+4); | |
201 | hResolMax[ipad]->Draw("same"); | |
202 | } | |
203 | ||
204 | } | |
712f2cab | 205 | |
206 | void DrawStat(Int_t coord, TObjArray *array=0){ | |
207 | // | |
208 | // | |
209 | // | |
210 | TCanvas *cStat = new TCanvas(Form("Cosmic stat%d",coord), Form("CosmicStat%d",coord),800,600); | |
5813554a | 211 | Float_t mx0=0.2, mx1=0.05, my0=0.15, my1=0.1; |
712f2cab | 212 | //pad->SetMargin(mx0,mx1,my0,my1); |
213 | cStat->Divide(3,3); | |
214 | for (Int_t i=0; i<8; i++){ | |
215 | cStat->cd(i+1); | |
216 | cosmic->fHistoDelta[0]->Projection(i)->Draw(); | |
217 | } | |
218 | if (array) array->AddLast(cStat); | |
219 | } | |
220 | ||
221 | void SetStylePad(TVirtualPad *pad){ | |
5813554a | 222 | Float_t mx0=0.2, mx1=0.05, my0=0.15, my1=0.1; |
712f2cab | 223 | pad->SetMargin(mx0,mx1,my0,my1); |
224 | pad->SetTicks(1,1); | |
225 | pad->SetGrid(1,1); | |
226 | } | |
227 | ||
228 | void MakePlotPt(TObjArray * array){ | |
229 | // | |
230 | // | |
231 | TCanvas *cptRes = new TCanvas("TPCPtResol","TPCPtResol",600,500); | |
232 | cptRes->Divide(2,1); | |
233 | SetStylePad(cptRes->cd(1)); | |
234 | SetStylePad(cptRes->cd(2)); | |
235 | // | |
236 | TH1 * hisRes=0; | |
237 | TH1 * hisMean=0; | |
5813554a | 238 | for (Int_t i=0; i<3; i++){ |
239 | if (i==0) cosmic->fHistoDelta[5]->GetAxis(6)->SetRangeUser(0,2); | |
240 | if (i==1) cosmic->fHistoDelta[5]->GetAxis(6)->SetRangeUser(-2,0); | |
241 | if (i==2) cosmic->fHistoDelta[5]->GetAxis(6)->SetRangeUser(-2,2); | |
242 | hisRes = GetFit2D(5,7,kTRUE); | |
243 | hisMean = GetFit2D(5,7,kFALSE); | |
244 | hisRes->SetMarkerStyle(20); | |
245 | hisMean->SetMarkerStyle(20); | |
246 | hisRes->SetMarkerColor(colors[i]); | |
247 | hisMean->SetMarkerColor(colors[i]); | |
248 | hisRes->Scale(100); | |
249 | hisMean->Scale(100); | |
250 | hisRes->SetMaximum(30); | |
251 | hisRes->SetMinimum(0); | |
252 | hisMean->SetMaximum(20); | |
253 | hisMean->SetMinimum(-20); | |
254 | hisRes->SetName("Pt resol"); | |
255 | hisRes->SetName("p_{t} resolution"); | |
256 | hisRes->SetYTitle("#sigma_{p_{t}}/p_{t} (%)"); | |
257 | hisMean->SetYTitle("#Delta_{p_{t}}/p_{t} (%)"); | |
258 | hisRes->GetXaxis()->SetRangeUser(0,10); | |
259 | hisMean->GetXaxis()->SetRangeUser(0,10); | |
260 | cptRes->cd(2); | |
261 | hisRes->Draw("same"); | |
262 | if (i==0) hisRes->Draw(""); | |
263 | cptRes->cd(1); | |
264 | hisMean->Draw("same"); | |
265 | if (i==0) hisMean->Draw(""); | |
266 | } | |
712f2cab | 267 | if (array) array->AddLast(cptRes); |
268 | } | |
269 | ||
270 | ||
5813554a | 271 | void MakePlotP4(TObjArray * array){ |
272 | // | |
273 | // | |
274 | TCanvas *cptRes = new TCanvas("TPCP4Resol","TPCP4Resol",600,500); | |
275 | cptRes->Divide(2,1); | |
276 | SetStylePad(cptRes->cd(1)); | |
277 | SetStylePad(cptRes->cd(2)); | |
278 | // | |
279 | TH1 * hisRes =0; | |
280 | TH1 * hisMeanP=0; | |
281 | ||
282 | for (Int_t i=0; i<3; i++){ | |
283 | if (i==0) cosmic->fHistoDelta[4]->GetAxis(6)->SetRangeUser(0,2); | |
284 | if (i==1) cosmic->fHistoDelta[4]->GetAxis(6)->SetRangeUser(-2,0); | |
285 | if (i==2) cosmic->fHistoDelta[4]->GetAxis(6)->SetRangeUser(-2,2); | |
286 | hisRes = GetFit2D(4,7,kTRUE); | |
287 | hisMean = GetFit2D(4,7,kFALSE); | |
288 | hisRes->SetMarkerStyle(20+i); | |
289 | hisMean->SetMarkerStyle(20+i); | |
290 | hisMean->SetMarkerColor(colors[i]); | |
291 | hisRes->SetMarkerColor(colors[i]); | |
292 | hisRes->SetMaximum(0.04); | |
293 | hisRes->SetMinimum(-0.0); | |
294 | hisMean->SetMaximum(0.02); | |
295 | hisMean->SetMinimum(-0.02); | |
296 | hisRes->SetName("C resol"); | |
297 | hisRes->SetName("C resolution"); | |
298 | hisRes->SetYTitle("#sigma_{C} (1/GeV)"); | |
299 | hisMean->SetYTitle("#Delta_{C} (1/GeV)"); | |
300 | hisMean->SetXTitle("p_{t} (GeV)"); | |
301 | hisRes->SetXTitle("p_{t} (GeV)"); | |
302 | hisRes->GetXaxis()->SetRangeUser(0,10); | |
303 | hisMean->GetXaxis()->SetRangeUser(0,10); | |
304 | cptRes->cd(2); | |
305 | hisRes->Draw("same"); | |
306 | if (i==0) hisRes->Draw(""); | |
307 | cptRes->cd(1); | |
308 | hisMean->Draw("same"); | |
309 | if (i==0) hisMean->Draw(""); | |
310 | } | |
311 | if (array) array->AddLast(cptRes); | |
312 | } | |
313 | ||
314 | ||
315 | ||
316 | ||
317 | ||
318 | ||
712f2cab | 319 | void MakePlotPosY(TObjArray * array){ |
320 | // | |
321 | // | |
322 | TCanvas *cptRes = new TCanvas("TPCPosResolY","TPCPosResolY",600,500); | |
323 | cptRes->Divide(2,1); | |
324 | SetStylePad(cptRes->cd(1)); | |
325 | SetStylePad(cptRes->cd(2)); | |
326 | // | |
327 | TH1 * hisRes=0; | |
328 | TH1 * hisMean=0; | |
5813554a | 329 | for (Int_t i=0; i<3; i++){ |
330 | if (i==0) cosmic->fHistoDelta[0]->GetAxis(6)->SetRangeUser(0,2); | |
331 | if (i==1) cosmic->fHistoDelta[0]->GetAxis(6)->SetRangeUser(-2,0); | |
332 | if (i==2) cosmic->fHistoDelta[0]->GetAxis(6)->SetRangeUser(-2,2); | |
333 | hisRes = GetFit2D(0,7,kTRUE); | |
334 | hisMean = GetFit2D(0,7,kFALSE); | |
335 | hisRes->SetMarkerStyle(20+i); | |
336 | hisMean->SetMarkerStyle(20+i); | |
337 | hisMean->SetMarkerColor(colors[i]); | |
338 | hisRes->SetMarkerColor(colors[i]); | |
339 | ||
340 | // | |
341 | hisRes->SetMaximum(0.4); | |
342 | hisRes->SetMinimum(0.0); | |
343 | hisMean->SetMaximum(0.4); | |
344 | hisMean->SetMinimum(-0.4); | |
345 | hisRes->SetName("Y resol"); | |
346 | hisRes->SetName("Y resolution"); | |
347 | hisRes->SetYTitle("#sigma_{y} (cm)"); | |
348 | hisMean->SetYTitle("#Delta_{y} (cm)"); | |
349 | hisRes->GetXaxis()->SetRangeUser(0,10); | |
350 | hisMean->GetXaxis()->SetRangeUser(0,10); | |
351 | cptRes->cd(2); | |
352 | hisRes->Draw("same"); | |
353 | if (i==0) hisRes->Draw(""); | |
354 | cptRes->cd(1); | |
355 | hisMean->Draw("same"); | |
356 | if (i==0) hisMean->Draw(""); | |
357 | } | |
712f2cab | 358 | if (array) array->AddLast(cptRes); |
359 | } | |
360 | ||
361 | void MakePlotPosZ(TObjArray * array){ | |
362 | // | |
363 | // | |
364 | TCanvas *cptRes = new TCanvas("TPCPosResolZ","TPCPosResolZ",600,500); | |
365 | cptRes->Divide(2,1); | |
366 | SetStylePad(cptRes->cd(1)); | |
367 | SetStylePad(cptRes->cd(2)); | |
368 | // | |
369 | TH1 * hisRes=0; | |
370 | TH1 * hisMean=0; | |
5813554a | 371 | for (Int_t i=0; i<3; i++){ |
372 | if (i==0) cosmic->fHistoDelta[1]->GetAxis(6)->SetRangeUser(0,2); | |
373 | if (i==1) cosmic->fHistoDelta[1]->GetAxis(6)->SetRangeUser(-2,0); | |
374 | if (i==2) cosmic->fHistoDelta[1]->GetAxis(6)->SetRangeUser(-2,2); | |
375 | ||
376 | hisRes = GetFit2D(1,7,kTRUE); | |
377 | hisMean = GetFit2D(1,7,kFALSE); | |
378 | hisRes->SetMaximum(0.4); | |
379 | hisRes->SetMinimum(0.0); | |
380 | hisMean->SetMaximum(0.2); | |
381 | hisMean->SetMinimum(-0.2); | |
382 | hisRes->SetMarkerStyle(20); | |
383 | hisMean->SetMarkerStyle(20); | |
384 | hisRes->SetMarkerColor(colors[i]); | |
385 | hisMean->SetMarkerColor(colors[i]); | |
386 | ||
387 | hisRes->SetName("Z resol"); | |
388 | hisRes->SetName("Z resolution"); | |
389 | hisRes->SetYTitle("#sigma_{z} (cm)"); | |
390 | hisMean->SetYTitle("#Delta_{z} (cm)"); | |
391 | hisRes->GetXaxis()->SetRangeUser(0,10); | |
392 | hisMean->GetXaxis()->SetRangeUser(0,10); | |
393 | cptRes->cd(2); | |
394 | hisRes->Draw("same"); | |
395 | if (i==0) hisRes->Draw(); | |
396 | cptRes->cd(1); | |
397 | hisMean->Draw("same"); | |
398 | if (i==0) hisMean->Draw(); | |
399 | } | |
712f2cab | 400 | if (array) array->AddLast(cptRes); |
401 | } | |
402 | ||
403 | ||
404 | void MakeDefaultPlots(){ | |
405 | // | |
406 | // | |
407 | // | |
408 | TObjArray *picArray = new TObjArray(); | |
409 | DrawStat(0,picArray); | |
410 | MakePlotPt(picArray); | |
411 | MakePlotPosY(picArray); | |
412 | MakePlotPosZ(picArray); | |
5813554a | 413 | MakePlotP4(picArray); |
712f2cab | 414 | TFile f("cosmicPlots.root","recreate"); |
415 | picArray->Write("CosmicPlots",TObject::kSingleKey); | |
416 | f.Close(); | |
5813554a | 417 | TPostScript *ps=new TPostScript("cosmicPerformance.ps", 112); |
418 | for (Int_t ipad=0;ipad<picArray->GetEntries();ipad++){ | |
419 | TCanvas *c =dynamic_cast<TCanvas*> picArray->At(ipad); | |
420 | if (c) { | |
421 | c->SaveAs(Form("pic/cosmic/%s.gif",c->GetName())); | |
422 | c->SaveAs(Form("pic/cosmic/%s.eps",c->GetName())); | |
423 | ps->NewPage(); | |
424 | c->Draw(); | |
425 | c->Update(); | |
426 | } | |
427 | } | |
428 | ps->Close(); | |
429 | delete ps; | |
712f2cab | 430 | } |