]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/CalibMacros/CalibCosmic.C
roll back of previous commit
[u/mrichter/AliRoot.git] / TPC / CalibMacros / CalibCosmic.C
CommitLineData
91fd44c9 1/*
5813554a 2Draw result of perfomance test:
3
4aliroot -b -q $ALICE_ROOT/TPC/scripts/loadTPCcalib.C $ALICE_ROOT/TPC/CalibMacros/CalibCosmic.C
5
ed56a3fa 6 //gROOT->Macro("~/NimStyle.C");
7 gSystem->AddIncludePath("-I$ALICE_ROOT/STAT")
8 gSystem->AddIncludePath("-I$ALICE_ROOT/TPC")
9 gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros")
10
91fd44c9 11 gSystem->Load("libANALYSIS");
12 gSystem->Load("libTPCcalib");
13 .L $ALICE_ROOT/TPC/CalibMacros/CalibCosmic.C
14 // init
15 Init();
712f2cab 16 SetDefaultCut(); // check defualt cut
17 //
18 MakeDefaultPlots();
19
5813554a 20 gROOT->Macro("~/NimStyle.C");
21 TFile f("cosmicPlots.root");
22 TBrowser b
23 b.Add(CosmicPlots,"CosmicPlot");
712f2cab 24
91fd44c9 25*/
35a255d8 26
ed56a3fa 27#if !defined(__CINT__) || defined(__MAKECINT__)
28#include "THnSparse.h"
29#include "TLatex.h"
30#include "TCanvas.h"
31#include "TLegend.h"
32#include "TSystem.h"
33#include "TFile.h"
34#include "TChain.h"
35#include "TCut.h"
36#include "TH3.h"
37#include "TH2F.h"
38#include "TProfile3D.h"
39#include "TMath.h"
40#include "TVectorD.h"
41#include "TMatrixD.h"
42#include "TTreeStream.h"
43#include "AliExternalTrackParam.h"
44#include "AliESDfriend.h"
45#include "AliTPCcalibCosmic.h"
46#include "TROOT.h"
47#include "TPostScript.h"
48#include "TStyle.h"
49#include "AliTrackerBase.h"
50#include "AliTPCExBEffective.h"
51#include "TEntryList.h"
52#include "TLegend.h"
53#endif
54
55
56class AliTPCcalibCosmic;
57AliTPCcalibCosmic * cosmicScan =0;
91fd44c9 58TObjArray fitArr;
ed56a3fa 59Int_t colors[3]={1,2,4};
60TObjArray *picArray = new TObjArray();
61const char * chsign[3]={"all", "Positive","Negative"};
62void Init();
63void SetRangeAll(Int_t axis, Float_t xmin, Float_t xmax);
64void SetDefaultCut();
65void MakeDefaultPlots();
66
67
91fd44c9 68
712f2cab 69void CalibCosmic(){
70 // init
71 Init();
72 SetDefaultCut();
73 //
74 MakeDefaultPlots();
75}
76
91fd44c9 77void Init(){
78 //
79 //
ed56a3fa 80 TH1::AddDirectory(0);
81 TFile fcalib("TPCCosmicObjects.root");
82 cosmicScan = ( AliTPCcalibCosmic *)fcalib.Get("cosmicTPC");
91fd44c9 83 TString axisName[9];
84 axisName[0] ="#Delta"; axisName[1] ="N_{cl}";
35a255d8 85 axisName[2] ="DCA_{r}(cm)";
91fd44c9 86 axisName[3] ="z (cm)"; axisName[4] ="sin(#phi)";
35a255d8 87 axisName[5] ="tan(#theta)"; axisName[6] ="1/p_{t} (1/GeV)";
88 axisName[7] ="p_{t} (GeV)"; axisName[8] ="alpha";
91fd44c9 89
90 {
91 for (Int_t ivar=0;ivar<6;ivar++){
92 for (Int_t ivar2=0;ivar2<9;ivar2++){
ed56a3fa 93 cosmicScan->fHistoDelta[ivar]->GetAxis(ivar2)->SetName(axisName[ivar2].Data());
94 cosmicScan->fHistoDelta[ivar]->GetAxis(ivar2)->SetTitle(axisName[ivar2].Data());
95 cosmicScan->fHistoPull[ivar]->GetAxis(ivar2)->SetName(axisName[ivar2].Data());
96 cosmicScan->fHistoPull[ivar]->GetAxis(ivar2)->SetTitle(axisName[ivar2].Data());
91fd44c9 97 }
98 }
99 }
100}
101
35a255d8 102void SetRangeAll(Int_t axis, Float_t xmin, Float_t xmax){
103
91fd44c9 104 for (Int_t i=0;i<6;i++){
105 //
ed56a3fa 106 cosmicScan->fHistoDelta[i]->GetAxis(axis)->SetRangeUser(xmin,xmax);
107 cosmicScan->fHistoPull[i]->GetAxis(axis)->SetRangeUser(xmin,xmax);
35a255d8 108 }
109}
110
91fd44c9 111
35a255d8 112void SetDefaultCut(){
113 for (Int_t i=0;i<6;i++){
114 //
712f2cab 115 //cut on number of clusters
ed56a3fa 116 cosmicScan->fHistoDelta[i]->GetAxis(1)->SetRangeUser(130,200);
117 cosmicScan->fHistoPull[i]->GetAxis(1)->SetRangeUser(130,200);
712f2cab 118 //cut on DCA r
ed56a3fa 119 cosmicScan->fHistoDelta[i]->GetAxis(2)->SetRangeUser(0,15);
120 cosmicScan->fHistoPull[i]->GetAxis(2)->SetRangeUser(0,15);
712f2cab 121 //cut on z at
ed56a3fa 122 cosmicScan->fHistoDelta[i]->GetAxis(3)->SetRangeUser(-20,20);
123 cosmicScan->fHistoPull[i]->GetAxis(3)->SetRangeUser(-20,20);
91fd44c9 124 }
ed56a3fa 125 cosmicScan->fHistoDelta[0]->GetAxis(0)->SetRangeUser(-1,1);
126 cosmicScan->fHistoDelta[1]->GetAxis(0)->SetRangeUser(-1,1);
127 cosmicScan->fHistoDelta[4]->GetAxis(0)->SetRangeUser(-0.1,0.1);
91fd44c9 128}
129
130TH2 * GetDelta2D(Int_t type, Int_t var){
ed56a3fa 131 TH2 * his = cosmicScan->fHistoDelta[type]->Projection(0,var);
132 his->SetXTitle(cosmicScan->fHistoDelta[type]->GetAxis(var)->GetName());
133 his->SetYTitle(cosmicScan->fHistoDelta[type]->GetAxis(0)->GetName());
91fd44c9 134 return his;
135}
136
137
712f2cab 138TH1* GetFit2D(Int_t type, Int_t var, Bool_t resol){
91fd44c9 139
ed56a3fa 140 TH2 * his = cosmicScan->fHistoDelta[type]->Projection(0,var);
141 his->SetXTitle(cosmicScan->fHistoDelta[type]->GetAxis(var)->GetName());
142 his->SetYTitle(cosmicScan->fHistoDelta[type]->GetAxis(0)->GetName());
91fd44c9 143 his->FitSlicesY(0,0,-1,0,"QNR",&fitArr);
712f2cab 144 TH1 * hres = 0;
145 if (resol) hres = (TH1*)(fitArr.At(2)->Clone());
146 if (!resol) hres = (TH1*)(fitArr.At(1)->Clone());
147 hres->SetMarkerStyle(20);
148 hres->SetMarkerColor(2);
5813554a 149 hres->GetYaxis()->SetTitleOffset(1.8);
150 hres->GetYaxis()->SetDecimals(kTRUE);
91fd44c9 151 return hres;
152}
153
154
155TH1 * GetDelta(Int_t type){
ed56a3fa 156 TH1 * his = cosmicScan->fHistoDelta[type]->Projection(0);
157 his->SetXTitle(cosmicScan->fHistoDelta[type]->GetAxis(0)->GetName());
91fd44c9 158 return his;
159}
160
161TH2 * GetPull2D(Int_t type, Int_t var){
ed56a3fa 162 TH2 * his = cosmicScan->fHistoPull[type]->Projection(0,var);
163 his->SetXTitle(cosmicScan->fHistoPull[type]->GetAxis(var)->GetName());
164 his->SetYTitle(cosmicScan->fHistoPull[type]->GetAxis(0)->GetName());
91fd44c9 165 return his;
166}
167
168TH1* GetPull2DSigma(Int_t type, Int_t var){
169
ed56a3fa 170 TH2 * his = cosmicScan->fHistoPull[type]->Projection(0,var);
171 his->SetXTitle(cosmicScan->fHistoPull[type]->GetAxis(var)->GetName());
172 his->SetYTitle(cosmicScan->fHistoPull[type]->GetAxis(0)->GetName());
91fd44c9 173 his->FitSlicesY(0,0,-1,0,"QNR",&fitArr);
174 TH1 * hres = (TH1*)(fitArr.At(2)->Clone());
175 return hres;
176}
177
178
179
180TH1 * GetPull(Int_t type){
ed56a3fa 181 TH1 * his = cosmicScan->fHistoPull[type]->Projection(0);
182 his->SetXTitle(cosmicScan->fHistoPull[type]->GetAxis(0)->GetName());
91fd44c9 183 return his;
184}
35a255d8 185
186
ed56a3fa 187void DrawResoldEdx(){
35a255d8 188 //
189 //
190 //
191 Int_t kmicolors[10]={1,2,3,6,7,8,9,10,11,12};
192 Int_t kmimarkers[10]={21,22,23,24,25,26,27,28,29,30};
193 TH2 *htemp;
194 TObjArray arr;
195 TH1 * hResolMax[4];
196 TH1 * hResolTot[4];
197 //
198 for (Int_t ipad=0;ipad<4;ipad++){
ed56a3fa 199 cosmicScan->fHistodEdxTot[ipad]->GetAxis(4)->SetRangeUser(-0.6,0.6);
200 cosmicScan->fHistodEdxMax[ipad]->GetAxis(4)->SetRangeUser(-0.6,0.6);
35a255d8 201 }
ed56a3fa 202 cosmicScan->fHistodEdxTot[0]->GetAxis(1)->SetRangeUser(30,62);
203 cosmicScan->fHistodEdxTot[1]->GetAxis(1)->SetRangeUser(30,62);
204 cosmicScan->fHistodEdxTot[2]->GetAxis(1)->SetRangeUser(10,35);
205 cosmicScan->fHistodEdxTot[3]->GetAxis(1)->SetRangeUser(10,150);
206 cosmicScan->fHistodEdxMax[0]->GetAxis(1)->SetRangeUser(30,62);
207 cosmicScan->fHistodEdxMax[1]->GetAxis(1)->SetRangeUser(30,62);
208 cosmicScan->fHistodEdxMax[2]->GetAxis(1)->SetRangeUser(10,35);
209 cosmicScan->fHistodEdxMax[3]->GetAxis(1)->SetRangeUser(10,150);
35a255d8 210 //
211
212 for (Int_t ipad=0;ipad<4;ipad++){
ed56a3fa 213 htemp = cosmicScan->fHistodEdxTot[ipad]->Projection(0,1);
35a255d8 214 htemp->FitSlicesY(0,0,-1,0,"QNR",&arr);
215 hResolTot[ipad] = (TH1*)(arr.At(2)->Clone());
216 delete htemp;
217 arr.SetOwner(kTRUE);
218 arr.Delete();
219 hResolTot[ipad]->Scale(1./TMath::Sqrt(2.));
220 //
ed56a3fa 221 htemp = cosmicScan->fHistodEdxMax[ipad]->Projection(0,1);
35a255d8 222 htemp->FitSlicesY(0,0,-1,0,"QNR",&arr);
223 hResolMax[ipad] = (TH1*)(arr.At(2)->Clone());
224 delete htemp;
225 arr.SetOwner(kTRUE);
226 arr.Delete();
227 hResolMax[ipad]->Scale(1./TMath::Sqrt(2.));
228 }
229 hResolTot[3]->GetXaxis()->SetRangeUser(0,160);
230 hResolTot[3]->SetXTitle("N_{cl}");
231 hResolTot[3]->SetYTitle("#sigma(dEdx/dEdx_{d})/#sqrt{2.}");
232 hResolTot[3]->SetTitle("Relative dEdx resolution");
233 for (Int_t ipad=3;ipad>=0;ipad--){
234 hResolTot[ipad]->SetMaximum(0.1);
235 hResolTot[ipad]->SetMinimum(0.);
236 hResolTot[ipad]->SetMarkerColor(kmicolors[ipad]+0);
237 hResolTot[ipad]->SetMarkerStyle(kmimarkers[ipad]+1);
238 if (ipad==3) hResolTot[ipad]->Draw();
239 hResolTot[ipad]->Draw("same");
240 //
241 hResolMax[ipad]->SetMaximum(0.1);
242 hResolMax[ipad]->SetMinimum(0.);
243 hResolMax[ipad]->SetMarkerColor(kmicolors[ipad]+0);
244 hResolMax[ipad]->SetMarkerStyle(kmimarkers[ipad]+4);
245 hResolMax[ipad]->Draw("same");
246 }
247
248}
712f2cab 249
250void DrawStat(Int_t coord, TObjArray *array=0){
251 //
252 //
253 //
ed56a3fa 254 TCanvas *cStat = new TCanvas(Form("Cosmic stat%d",coord), Form("CosmicStat%d",coord),1000,800);
5813554a 255 Float_t mx0=0.2, mx1=0.05, my0=0.15, my1=0.1;
ed56a3fa 256 cStat->SetMargin(mx0,mx1,my0,my1);
712f2cab 257 cStat->Divide(3,3);
ed56a3fa 258 for (Int_t i=1; i<8; i++){
712f2cab 259 cStat->cd(i+1);
ed56a3fa 260 cosmicScan->fHistoDelta[0]->Projection(i)->Draw();
712f2cab 261 }
262 if (array) array->AddLast(cStat);
263}
264
265void SetStylePad(TVirtualPad *pad){
5813554a 266 Float_t mx0=0.2, mx1=0.05, my0=0.15, my1=0.1;
712f2cab 267 pad->SetMargin(mx0,mx1,my0,my1);
268 pad->SetTicks(1,1);
269 pad->SetGrid(1,1);
ed56a3fa 270
712f2cab 271}
272
273void MakePlotPt(TObjArray * array){
274 //
275 //
ed56a3fa 276 TCanvas *cptRes = new TCanvas("TPCPtResol","TPCPtResol",900,600);
712f2cab 277 cptRes->Divide(2,1);
278 SetStylePad(cptRes->cd(1));
ed56a3fa 279 SetStylePad(cptRes->cd(2));
280 cptRes->cd(1);
281 TLegend *legend = new TLegend(0.2,0.7,0.6,0.9,"");
282
712f2cab 283 //
284 TH1 * hisRes=0;
285 TH1 * hisMean=0;
5813554a 286 for (Int_t i=0; i<3; i++){
ed56a3fa 287 if (i==0) cosmicScan->fHistoDelta[5]->GetAxis(6)->SetRangeUser(-1,1);
288 if (i==1) cosmicScan->fHistoDelta[5]->GetAxis(6)->SetRangeUser(0.001,1);
289 if (i==2) cosmicScan->fHistoDelta[5]->GetAxis(6)->SetRangeUser(-1,-0.001);
290 hisRes = (TH1*)GetFit2D(5,7,kTRUE)->Clone();
291 hisMean = (TH1*)GetFit2D(5,7,kFALSE)->Clone();
292 hisMean->SetName(Form("#Deltap_{t}/p_{t} %s",chsign[i]));
293 hisRes->SetName(Form("#sigma_{p_{t}}/p_{t} %s",chsign[i]));
294 hisMean->SetTitle(Form("#Delta_{p_{t}}/p_{t} %s",chsign[i]));
295 hisRes->SetTitle(Form("#sigma_{p_{t}}/p_{t} %s",chsign[i]));
296
5813554a 297 hisRes->SetMarkerStyle(20);
298 hisMean->SetMarkerStyle(20);
299 hisRes->SetMarkerColor(colors[i]);
300 hisMean->SetMarkerColor(colors[i]);
301 hisRes->Scale(100);
302 hisMean->Scale(100);
303 hisRes->SetMaximum(30);
304 hisRes->SetMinimum(0);
305 hisMean->SetMaximum(20);
306 hisMean->SetMinimum(-20);
5813554a 307 hisRes->SetYTitle("#sigma_{p_{t}}/p_{t} (%)");
308 hisMean->SetYTitle("#Delta_{p_{t}}/p_{t} (%)");
ed56a3fa 309 hisRes->GetXaxis()->SetRangeUser(0,50);
310 hisMean->GetXaxis()->SetRangeUser(0,50);
5813554a 311 cptRes->cd(2);
312 hisRes->Draw("same");
313 if (i==0) hisRes->Draw("");
314 cptRes->cd(1);
315 hisMean->Draw("same");
316 if (i==0) hisMean->Draw("");
ed56a3fa 317 legend->AddEntry(hisMean);
5813554a 318 }
ed56a3fa 319 legend->Draw();
712f2cab 320 if (array) array->AddLast(cptRes);
321}
322
323
5813554a 324void MakePlotP4(TObjArray * array){
325 //
326 //
ed56a3fa 327 TCanvas *cptRes = new TCanvas("TPCP4Resol","TPCP4Resol",900,600);
5813554a 328 cptRes->Divide(2,1);
329 SetStylePad(cptRes->cd(1));
330 SetStylePad(cptRes->cd(2));
ed56a3fa 331 cptRes->cd(1);
332 TLegend *legend = new TLegend(0.2,0.7,0.6,0.9,"");
333
5813554a 334 //
335 TH1 * hisRes =0;
ed56a3fa 336 TH1 * hisMean=0;
337
5813554a 338 for (Int_t i=0; i<3; i++){
ed56a3fa 339 if (i==0) cosmicScan->fHistoDelta[4]->GetAxis(6)->SetRangeUser(-1,1);
340 if (i==1) cosmicScan->fHistoDelta[4]->GetAxis(6)->SetRangeUser(0.001,1);
341 if (i==2) cosmicScan->fHistoDelta[4]->GetAxis(6)->SetRangeUser(-1,-0.001);
342 hisRes = (TH1*)GetFit2D(4,7,kTRUE)->Clone();
343 hisMean = (TH1*)GetFit2D(4,7,kFALSE)->Clone();
344 hisMean->SetName(Form("#Delta_{1/p_{t}} %s",chsign[i]));
345 hisRes->SetName(Form("#sigma_{1/p_{t}} %s",chsign[i]));
346 hisMean->SetTitle(Form("#Delta_{1/p_{t}} %s",chsign[i]));
347 hisRes->SetTitle(Form("#sigma_{1/p_{t}} %s",chsign[i]));
348
5813554a 349 hisRes->SetMarkerStyle(20+i);
350 hisMean->SetMarkerStyle(20+i);
351 hisMean->SetMarkerColor(colors[i]);
352 hisRes->SetMarkerColor(colors[i]);
ed56a3fa 353 hisRes->SetMaximum(0.02);
5813554a 354 hisRes->SetMinimum(-0.0);
355 hisMean->SetMaximum(0.02);
356 hisMean->SetMinimum(-0.02);
ed56a3fa 357 hisRes->SetYTitle("#sigma_{1/pt} (1/GeV)");
358 hisMean->SetYTitle("#Delta_{1/pt} (1/GeV)");
5813554a 359 hisMean->SetXTitle("p_{t} (GeV)");
360 hisRes->SetXTitle("p_{t} (GeV)");
ed56a3fa 361 hisRes->GetXaxis()->SetRangeUser(0,50);
362 hisMean->GetXaxis()->SetRangeUser(0,50);
5813554a 363 cptRes->cd(2);
364 hisRes->Draw("same");
365 if (i==0) hisRes->Draw("");
366 cptRes->cd(1);
367 hisMean->Draw("same");
368 if (i==0) hisMean->Draw("");
ed56a3fa 369 legend->AddEntry(hisMean);
5813554a 370 }
ed56a3fa 371 legend->Draw();
5813554a 372 if (array) array->AddLast(cptRes);
373}
374
375
376
377
378
379
712f2cab 380void MakePlotPosY(TObjArray * array){
381 //
382 //
ed56a3fa 383 TCanvas *cptRes = new TCanvas("TPCPosResolY","TPCPosResolY",900,600);
712f2cab 384 cptRes->Divide(2,1);
385 SetStylePad(cptRes->cd(1));
386 SetStylePad(cptRes->cd(2));
ed56a3fa 387 cptRes->cd(1);
388 TLegend *legend = new TLegend(0.2,0.7,0.6,0.9,"");
389
712f2cab 390 //
391 TH1 * hisRes=0;
392 TH1 * hisMean=0;
5813554a 393 for (Int_t i=0; i<3; i++){
ed56a3fa 394 if (i==1) cosmicScan->fHistoDelta[0]->GetAxis(6)->SetRangeUser(0.0001,1);
395 if (i==2) cosmicScan->fHistoDelta[0]->GetAxis(6)->SetRangeUser(-1,-0.0001);
396 if (i==0) cosmicScan->fHistoDelta[0]->GetAxis(6)->SetRangeUser(-1,1);
397 hisRes = (TH1*)GetFit2D(0,7,kTRUE)->Clone();
398 hisMean = (TH1*)GetFit2D(0,7,kFALSE)->Clone();
399 hisMean->SetName(Form("#Delta_{r#phi} %s",chsign[i]));
400 hisRes->SetName(Form("#sigma_{r#phi} %s",chsign[i]));
401 hisMean->SetTitle(Form("#Delta_{r#phi} %s",chsign[i]));
402 hisRes->SetTitle(Form("#sigma_{r#phi} %s",chsign[i]));
403
5813554a 404 hisRes->SetMarkerStyle(20+i);
405 hisMean->SetMarkerStyle(20+i);
406 hisMean->SetMarkerColor(colors[i]);
407 hisRes->SetMarkerColor(colors[i]);
408
409 //
410 hisRes->SetMaximum(0.4);
411 hisRes->SetMinimum(0.0);
412 hisMean->SetMaximum(0.4);
413 hisMean->SetMinimum(-0.4);
414 hisRes->SetName("Y resol");
415 hisRes->SetName("Y resolution");
416 hisRes->SetYTitle("#sigma_{y} (cm)");
417 hisMean->SetYTitle("#Delta_{y} (cm)");
ed56a3fa 418 hisRes->GetXaxis()->SetRangeUser(0,50);
419 hisMean->GetXaxis()->SetRangeUser(0,50);
420 cptRes->cd(2);
421 hisRes->Draw("same");
422 if (i==0) hisRes->Draw("");
423 cptRes->cd(1);
424 hisMean->Draw("same");
425 if (i==0) hisMean->Draw("");
426 legend->AddEntry(hisMean);
427 }
428 legend->Draw();
429 if (array) array->AddLast(cptRes);
430}
431
432void MakePlotSnp(TObjArray * array){
433 //
434 //
435 TCanvas *cptRes = new TCanvas("TPCSnp","TPCSnp",900,600);
436 cptRes->Divide(2,1);
437 SetStylePad(cptRes->cd(1));
438 SetStylePad(cptRes->cd(2));
439 cptRes->cd(1);
440 TLegend *legend = new TLegend(0.2,0.7,0.6,0.9,"");
441
442 //
443 TH1 * hisRes=0;
444 TH1 * hisMean=0;
445 for (Int_t i=0; i<3; i++){
446 if (i==1) cosmicScan->fHistoDelta[2]->GetAxis(6)->SetRangeUser(0.0001,1);
447 if (i==2) cosmicScan->fHistoDelta[2]->GetAxis(6)->SetRangeUser(-1,-0.0001);
448 if (i==0) cosmicScan->fHistoDelta[2]->GetAxis(6)->SetRangeUser(-1,1);
449 hisRes = (TH1*)GetFit2D(2,7,kTRUE)->Clone();
450 hisMean = (TH1*)GetFit2D(2,7,kFALSE)->Clone();
451 hisMean->SetName(Form("#Delta_{#phi} %s",chsign[i]));
452 hisRes->SetName(Form("#sigma_{#phi} %s",chsign[i]));
453 hisMean->SetTitle(Form("#Delta_{#phi} %s",chsign[i]));
454 hisRes->SetTitle(Form("#sigma_{#phi} %s",chsign[i]));
455
456 hisRes->SetMarkerStyle(20+i);
457 hisMean->SetMarkerStyle(20+i);
458 hisMean->SetMarkerColor(colors[i]);
459 hisRes->SetMarkerColor(colors[i]);
460
461 //
462 hisRes->SetMaximum(4);
463 hisRes->SetMinimum(4);
464 hisMean->SetMaximum(4);
465 hisMean->SetMinimum(-4);
466 hisRes->SetYTitle("#sigma_{#phi} (mrad)");
467 hisMean->SetYTitle("#Delta_{#phi} (mrad)");
468 hisRes->GetXaxis()->SetRangeUser(0,50);
469 hisMean->GetXaxis()->SetRangeUser(0,50);
470 cptRes->cd(2);
471 hisRes->Draw("same");
472 if (i==0) hisRes->Draw("");
473 cptRes->cd(1);
474 hisMean->Draw("same");
475 if (i==0) hisMean->Draw("");
476 legend->AddEntry(hisMean);
477 }
478 legend->Draw();
479 if (array) array->AddLast(cptRes);
480}
481void MakePlotTgl(TObjArray * array){
482 //
483 //
484 TCanvas *cptRes = new TCanvas("TPCtgl","TPCtgl",900,600);
485 cptRes->Divide(2,1);
486 SetStylePad(cptRes->cd(1));
487 SetStylePad(cptRes->cd(2));
488 cptRes->cd(1);
489 TLegend *legend = new TLegend(0.2,0.7,0.6,0.9,"");
490
491 //
492 TH1 * hisRes=0;
493 TH1 * hisMean=0;
494 for (Int_t i=0; i<3; i++){
495 if (i==1) cosmicScan->fHistoDelta[3]->GetAxis(6)->SetRangeUser(0.0001,1);
496 if (i==2) cosmicScan->fHistoDelta[3]->GetAxis(6)->SetRangeUser(-1,-0.0001);
497 if (i==0) cosmicScan->fHistoDelta[3]->GetAxis(6)->SetRangeUser(-1,1);
498 hisRes = (TH1*)GetFit2D(3,7,kTRUE)->Clone();
499 hisMean = (TH1*)GetFit2D(3,7,kFALSE)->Clone();
500 hisMean->SetName(Form("#Delta_{#theta} %s",chsign[i]));
501 hisRes->SetName(Form("#sigma_{#theta} %s",chsign[i]));
502 hisMean->SetTitle(Form("#Delta_{#theta} %s",chsign[i]));
503 hisRes->SetTitle(Form("#sigma_{#theta} %s",chsign[i]));
504
505 hisRes->SetMarkerStyle(20+i);
506 hisMean->SetMarkerStyle(20+i);
507 hisMean->SetMarkerColor(colors[i]);
508 hisRes->SetMarkerColor(colors[i]);
509
510 //
511 hisRes->SetMaximum(4);
512 hisRes->SetMinimum(4);
513 hisMean->SetMaximum(4);
514 hisMean->SetMinimum(-4);
515 hisRes->SetYTitle("#sigma_{#theta} (mrad)");
516 hisMean->SetYTitle("#Delta_{#theta} (mrad)");
517 hisRes->GetXaxis()->SetRangeUser(0,50);
518 hisMean->GetXaxis()->SetRangeUser(0,50);
5813554a 519 cptRes->cd(2);
520 hisRes->Draw("same");
521 if (i==0) hisRes->Draw("");
522 cptRes->cd(1);
523 hisMean->Draw("same");
524 if (i==0) hisMean->Draw("");
ed56a3fa 525 legend->AddEntry(hisMean);
5813554a 526 }
ed56a3fa 527 legend->Draw();
712f2cab 528 if (array) array->AddLast(cptRes);
529}
530
531void MakePlotPosZ(TObjArray * array){
532 //
533 //
ed56a3fa 534 TCanvas *cptRes = new TCanvas("TPCPosResolZ","TPCPosResolZ",900,600);
712f2cab 535 cptRes->Divide(2,1);
536 SetStylePad(cptRes->cd(1));
537 SetStylePad(cptRes->cd(2));
ed56a3fa 538 cptRes->cd(1);
539 TLegend *legend = new TLegend(0.2,0.7,0.6,0.9,"");
540
712f2cab 541 //
542 TH1 * hisRes=0;
543 TH1 * hisMean=0;
5813554a 544 for (Int_t i=0; i<3; i++){
ed56a3fa 545 if (i==1) cosmicScan->fHistoDelta[1]->GetAxis(6)->SetRangeUser(0.001,1.);
546 if (i==2) cosmicScan->fHistoDelta[1]->GetAxis(6)->SetRangeUser(-1,-0.001);
547 if (i==0) cosmicScan->fHistoDelta[1]->GetAxis(6)->SetRangeUser(-1,1);
5813554a 548
ed56a3fa 549 hisRes = (TH1*)GetFit2D(1,7,kTRUE)->Clone();
550 hisMean = (TH1*)GetFit2D(1,7,kFALSE)->Clone();
551 hisMean->SetName(Form("#Delta_{z} %s",chsign[i]));
552 hisRes->SetName(Form("#sigma_{z} %s",chsign[i]));
553 hisMean->SetTitle(Form("#Delta_{z} %s",chsign[i]));
554 hisRes->SetTitle(Form("#sigma_{z} %s",chsign[i]));
555
556
5813554a 557 hisRes->SetMaximum(0.4);
558 hisRes->SetMinimum(0.0);
559 hisMean->SetMaximum(0.2);
560 hisMean->SetMinimum(-0.2);
561 hisRes->SetMarkerStyle(20);
562 hisMean->SetMarkerStyle(20);
563 hisRes->SetMarkerColor(colors[i]);
564 hisMean->SetMarkerColor(colors[i]);
565
566 hisRes->SetName("Z resol");
567 hisRes->SetName("Z resolution");
568 hisRes->SetYTitle("#sigma_{z} (cm)");
569 hisMean->SetYTitle("#Delta_{z} (cm)");
ed56a3fa 570 hisRes->GetXaxis()->SetRangeUser(0,50);
571 hisMean->GetXaxis()->SetRangeUser(0,50);
5813554a 572 cptRes->cd(2);
573 hisRes->Draw("same");
574 if (i==0) hisRes->Draw();
575 cptRes->cd(1);
576 hisMean->Draw("same");
577 if (i==0) hisMean->Draw();
ed56a3fa 578 legend->AddEntry(hisMean);
5813554a 579 }
ed56a3fa 580 legend->Draw();
712f2cab 581 if (array) array->AddLast(cptRes);
582}
583
584
585void MakeDefaultPlots(){
586 //
587 //
588 //
ed56a3fa 589 gStyle->SetOptStat(1100);
712f2cab 590 DrawStat(0,picArray);
ed56a3fa 591 gStyle->SetOptStat(0);
712f2cab 592 MakePlotPosY(picArray);
593 MakePlotPosZ(picArray);
ed56a3fa 594 MakePlotSnp(picArray);
595 MakePlotTgl(picArray);
5813554a 596 MakePlotP4(picArray);
ed56a3fa 597 MakePlotPt(picArray);
598 //
599
712f2cab 600 TFile f("cosmicPlots.root","recreate");
601 picArray->Write("CosmicPlots",TObject::kSingleKey);
602 f.Close();
5813554a 603 TPostScript *ps=new TPostScript("cosmicPerformance.ps", 112);
ed56a3fa 604 ps->NewPage();
5813554a 605 for (Int_t ipad=0;ipad<picArray->GetEntries();ipad++){
ed56a3fa 606 TCanvas *c =dynamic_cast<TCanvas*> (picArray->At(ipad));
5813554a 607 if (c) {
5813554a 608 c->Draw();
609 c->Update();
ed56a3fa 610 ps->NewPage();
5813554a 611 }
612 }
613 ps->Close();
614 delete ps;
712f2cab 615}