]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/CalibMacros/CalibCosmic.C
Added separate chi2 cut for ITS/TPC matching
[u/mrichter/AliRoot.git] / TPC / CalibMacros / CalibCosmic.C
1 /*
2 Draw result of perfomance test:
3
4 aliroot -b -q  $ALICE_ROOT/TPC/scripts/loadTPCcalib.C $ALICE_ROOT/TPC/CalibMacros/CalibCosmic.C
5
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
11   gSystem->Load("libANALYSIS");
12   gSystem->Load("libTPCcalib");
13   .L $ALICE_ROOT/TPC/CalibMacros/CalibCosmic.C
14   // init
15   Init();
16   SetDefaultCut();  // check defualt cut 
17   //
18   MakeDefaultPlots();
19
20   gROOT->Macro("~/NimStyle.C");
21   TFile f("cosmicPlots.root");
22   TBrowser b
23   b.Add(CosmicPlots,"CosmicPlot");
24
25 */  
26
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
56 class AliTPCcalibCosmic;
57 AliTPCcalibCosmic * cosmicScan =0;
58 TObjArray fitArr;
59 Int_t colors[3]={1,2,4};
60 TObjArray *picArray = new TObjArray();
61 const char * chsign[3]={"all", "Positive","Negative"};
62 void Init();
63 void SetRangeAll(Int_t axis, Float_t xmin, Float_t xmax);
64 void SetDefaultCut();
65 void  MakeDefaultPlots();
66
67
68
69 void CalibCosmic(){
70   // init
71   Init();
72   SetDefaultCut(); 
73   //
74   MakeDefaultPlots();
75 }
76
77 void Init(){
78   //
79   //
80   TH1::AddDirectory(0);
81   TFile fcalib("TPCCosmicObjects.root");
82   cosmicScan = ( AliTPCcalibCosmic *)fcalib.Get("cosmicTPC");
83   TString axisName[9];
84   axisName[0]  ="#Delta"; axisName[1]  ="N_{cl}";
85   axisName[2]  ="DCA_{r}(cm)";
86   axisName[3]  ="z (cm)"; axisName[4]  ="sin(#phi)";
87   axisName[5]  ="tan(#theta)"; axisName[6]  ="1/p_{t} (1/GeV)";
88   axisName[7]  ="p_{t} (GeV)"; axisName[8]  ="alpha";
89
90   {
91   for (Int_t ivar=0;ivar<6;ivar++){
92     for (Int_t ivar2=0;ivar2<9;ivar2++){      
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());
97     }
98   }
99   }
100 }
101
102 void SetRangeAll(Int_t axis, Float_t xmin, Float_t xmax){
103
104   for (Int_t i=0;i<6;i++){
105     //
106     cosmicScan->fHistoDelta[i]->GetAxis(axis)->SetRangeUser(xmin,xmax);
107     cosmicScan->fHistoPull[i]->GetAxis(axis)->SetRangeUser(xmin,xmax);
108   }
109 }
110
111
112 void SetDefaultCut(){
113   for (Int_t i=0;i<6;i++){
114     //
115     //cut on number of clusters
116     cosmicScan->fHistoDelta[i]->GetAxis(1)->SetRangeUser(130,200);
117     cosmicScan->fHistoPull[i]->GetAxis(1)->SetRangeUser(130,200);
118     //cut on DCA r
119     cosmicScan->fHistoDelta[i]->GetAxis(2)->SetRangeUser(0,15);
120     cosmicScan->fHistoPull[i]->GetAxis(2)->SetRangeUser(0,15);
121     //cut on z at
122     cosmicScan->fHistoDelta[i]->GetAxis(3)->SetRangeUser(-20,20);
123     cosmicScan->fHistoPull[i]->GetAxis(3)->SetRangeUser(-20,20);
124   }
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);
128 }
129
130 TH2 * GetDelta2D(Int_t type, Int_t var){
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());
134   return his;
135 }
136
137
138 TH1* GetFit2D(Int_t type, Int_t var, Bool_t resol){
139   
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());
143   his->FitSlicesY(0,0,-1,0,"QNR",&fitArr);
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);
149   hres->GetYaxis()->SetTitleOffset(1.8);
150   hres->GetYaxis()->SetDecimals(kTRUE);
151   return hres;
152 }
153
154
155 TH1 * GetDelta(Int_t type){
156   TH1 * his = cosmicScan->fHistoDelta[type]->Projection(0);
157   his->SetXTitle(cosmicScan->fHistoDelta[type]->GetAxis(0)->GetName());
158   return his;
159 }
160
161 TH2 * GetPull2D(Int_t type, Int_t var){
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());
165   return his;
166 }
167
168 TH1* GetPull2DSigma(Int_t type, Int_t var){
169   
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());
173   his->FitSlicesY(0,0,-1,0,"QNR",&fitArr);
174   TH1 * hres = (TH1*)(fitArr.At(2)->Clone());
175   return hres;
176 }
177
178
179
180 TH1 * GetPull(Int_t type){
181   TH1 * his = cosmicScan->fHistoPull[type]->Projection(0);
182   his->SetXTitle(cosmicScan->fHistoPull[type]->GetAxis(0)->GetName());
183   return his;
184 }
185
186
187 void DrawResoldEdx(){
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++){
199     cosmicScan->fHistodEdxTot[ipad]->GetAxis(4)->SetRangeUser(-0.6,0.6);
200     cosmicScan->fHistodEdxMax[ipad]->GetAxis(4)->SetRangeUser(-0.6,0.6);
201   }
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);
210   //
211
212   for (Int_t ipad=0;ipad<4;ipad++){
213     htemp = cosmicScan->fHistodEdxTot[ipad]->Projection(0,1);
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     //
221     htemp = cosmicScan->fHistodEdxMax[ipad]->Projection(0,1);
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 }
249
250 void DrawStat(Int_t coord, TObjArray *array=0){
251   //
252   //
253   //
254   TCanvas *cStat = new TCanvas(Form("Cosmic stat%d",coord), Form("CosmicStat%d",coord),1000,800);
255   Float_t mx0=0.2, mx1=0.05, my0=0.15, my1=0.1;
256   cStat->SetMargin(mx0,mx1,my0,my1);
257   cStat->Divide(3,3);
258   for (Int_t i=1; i<8; i++){
259     cStat->cd(i+1);
260     cosmicScan->fHistoDelta[0]->Projection(i)->Draw();
261   }
262   if (array) array->AddLast(cStat);
263 }
264
265 void SetStylePad(TVirtualPad *pad){
266   Float_t mx0=0.2, mx1=0.05, my0=0.15, my1=0.1;
267   pad->SetMargin(mx0,mx1,my0,my1);
268   pad->SetTicks(1,1);
269   pad->SetGrid(1,1); 
270   
271 }
272
273 void MakePlotPt(TObjArray * array){
274   //
275   //
276   TCanvas *cptRes = new TCanvas("TPCPtResol","TPCPtResol",900,600);
277   cptRes->Divide(2,1);
278   SetStylePad(cptRes->cd(1));
279   SetStylePad(cptRes->cd(2)); 
280   cptRes->cd(1);
281   TLegend *legend = new TLegend(0.2,0.7,0.6,0.9,"");
282
283   //
284   TH1 * hisRes=0;
285   TH1 * hisMean=0;
286   for (Int_t i=0; i<3; i++){
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
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);
307     hisRes->SetYTitle("#sigma_{p_{t}}/p_{t} (%)");
308     hisMean->SetYTitle("#Delta_{p_{t}}/p_{t} (%)");
309     hisRes->GetXaxis()->SetRangeUser(0,50);
310     hisMean->GetXaxis()->SetRangeUser(0,50);  
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("");
317     legend->AddEntry(hisMean);
318   }
319   legend->Draw();
320   if (array) array->AddLast(cptRes);
321 }
322
323
324 void MakePlotP4(TObjArray * array){
325   //
326   //
327   TCanvas *cptRes = new TCanvas("TPCP4Resol","TPCP4Resol",900,600);
328   cptRes->Divide(2,1);
329   SetStylePad(cptRes->cd(1));
330   SetStylePad(cptRes->cd(2));
331   cptRes->cd(1);
332   TLegend *legend = new TLegend(0.2,0.7,0.6,0.9,"");
333
334   //
335   TH1 * hisRes  =0;
336   TH1 * hisMean=0;
337
338   for (Int_t i=0; i<3; i++){
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
349     hisRes->SetMarkerStyle(20+i);
350     hisMean->SetMarkerStyle(20+i);
351     hisMean->SetMarkerColor(colors[i]);
352     hisRes->SetMarkerColor(colors[i]);
353     hisRes->SetMaximum(0.02);
354     hisRes->SetMinimum(-0.0);
355     hisMean->SetMaximum(0.02);
356     hisMean->SetMinimum(-0.02);
357     hisRes->SetYTitle("#sigma_{1/pt} (1/GeV)");
358     hisMean->SetYTitle("#Delta_{1/pt} (1/GeV)");
359     hisMean->SetXTitle("p_{t} (GeV)");
360     hisRes->SetXTitle("p_{t} (GeV)");
361     hisRes->GetXaxis()->SetRangeUser(0,50);
362     hisMean->GetXaxis()->SetRangeUser(0,50);      
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("");
369     legend->AddEntry(hisMean);
370   }
371   legend->Draw();
372   if (array) array->AddLast(cptRes);
373 }
374
375
376
377
378
379
380 void MakePlotPosY(TObjArray * array){
381   //
382   //
383   TCanvas *cptRes = new TCanvas("TPCPosResolY","TPCPosResolY",900,600);
384   cptRes->Divide(2,1);
385   SetStylePad(cptRes->cd(1));
386   SetStylePad(cptRes->cd(2));
387   cptRes->cd(1);
388   TLegend *legend = new TLegend(0.2,0.7,0.6,0.9,"");
389
390   //
391   TH1 * hisRes=0;
392   TH1 * hisMean=0;
393   for (Int_t i=0; i<3; i++){
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
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)");
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
432 void 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 }
481 void 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);  
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("");
525     legend->AddEntry(hisMean);   
526   }
527   legend->Draw();
528   if (array) array->AddLast(cptRes);
529 }
530
531 void MakePlotPosZ(TObjArray * array){
532   //
533   //
534   TCanvas *cptRes = new TCanvas("TPCPosResolZ","TPCPosResolZ",900,600);
535   cptRes->Divide(2,1);
536   SetStylePad(cptRes->cd(1));
537   SetStylePad(cptRes->cd(2));
538   cptRes->cd(1);
539   TLegend *legend = new TLegend(0.2,0.7,0.6,0.9,"");
540
541   //
542   TH1 * hisRes=0;
543   TH1 * hisMean=0;
544   for (Int_t i=0; i<3; i++){
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);
548     
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
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)");
570     hisRes->GetXaxis()->SetRangeUser(0,50);
571     hisMean->GetXaxis()->SetRangeUser(0,50);  
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();
578     legend->AddEntry(hisMean);
579   }
580   legend->Draw();
581   if (array) array->AddLast(cptRes);
582 }
583
584
585 void  MakeDefaultPlots(){
586   //
587   //
588   //
589   gStyle->SetOptStat(1100);
590   DrawStat(0,picArray);
591   gStyle->SetOptStat(0);
592   MakePlotPosY(picArray);
593   MakePlotPosZ(picArray);
594   MakePlotSnp(picArray);
595   MakePlotTgl(picArray);
596   MakePlotP4(picArray);
597   MakePlotPt(picArray);
598   //
599
600   TFile f("cosmicPlots.root","recreate");
601   picArray->Write("CosmicPlots",TObject::kSingleKey);
602   f.Close();
603   TPostScript *ps=new TPostScript("cosmicPerformance.ps", 112);
604   ps->NewPage();
605   for (Int_t ipad=0;ipad<picArray->GetEntries();ipad++){
606     TCanvas *c =dynamic_cast<TCanvas*> (picArray->At(ipad));
607     if (c) {
608       c->Draw();
609       c->Update();
610       ps->NewPage();
611     }
612   } 
613   ps->Close();
614   delete ps;
615 }