Makin compiled macro
[u/mrichter/AliRoot.git] / TPC / CalibMacros / CosmicPerformance.C
1 /*
2   
3   .x ~/UliStyle.C
4   .x ~/NimStyle.C
5   .x ~/rootlogon.C
6   TProof::Open("");
7   gSystem->Load("libSTAT.so");
8   gSystem->Load("libANALYSIS");
9   gSystem->Load("libTPCcalib");
10   gSystem->Load("libSTAT.so");
11
12   gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");  
13   gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+");
14   AliXRDPROOFtoolkit tool; 
15   TChain * chain = tool.MakeChain("cosmic.txt","Track0",0,1000000);
16   chain->Lookup();
17   chain->SetProof(kTRUE);
18
19   .L $ALICE_ROOT/TPC/CalibMacros/CosmicPerformance.C+
20   chainCosmic=chain;
21   MakeCuts()
22   MakeAlias();
23   Make1PtPlot();
24   Draw1Pt();
25   Draw1PtPull();
26
27   MakeZPlot();
28   DrawZ();
29   DrawZPull();
30
31   //
32   PtResolPt();
33   
34   
35 */
36
37 #include "TTree.h"
38 #include "TChain.h"
39 #include "TPad.h"
40 #include "TCanvas.h"
41 #include "TCut.h"
42 #include "TH1.h"
43 #include "TH2F.h"
44 #include "AliTPCcalibV0.h"
45 #include "AliExternalTrackParam.h"
46
47 TChain * chainCosmic=0;
48 Int_t kmicolors[10]={1,2,3,4,6,7,8,9,10,11};
49 Int_t kmimarkers[10]={21,22,23,24,25,26,27,28,29,30};
50
51 AliTPCcalibV0 v0;
52 Bool_t bUseCorrection =kFALSE;
53 //
54 // Global  cuts
55 //
56 TCut cutDiff[6];  // parameter diff cuts - 5 all
57 TCut cutPull[6];  // pull diff cuts      - 5 all
58 TCut cutGeomTPC;  // TPC geometrical cuts 
59 TCut cutN("cutN","min(Orig0.fTPCncls,Orig1.fTPCncls)>80");
60 TCut cutN120("cutN120","min(Orig0.fTPCncls,Orig1.fTPCncls)+abs(Tr1.fP[4]*10)>120");
61 TCut cutN130("cutN120","min(Orig0.fTPCncls,Orig1.fTPCncls)+abs(Tr1.fP[4]*20)>130");
62 TCut cutS("cutS","!crossI&&!crossO");
63 TCut cutRun("run<620600");
64 TCut cutAll;
65 TCut cutCustom=cutN130+cutS+cutRun;
66 TCut cut1Pt = "Tr0.fP[1]>0"; // Use only A side for Pt study
67 //
68 // Aliases
69 //
70 TString dP[5];      // delta of parameters
71 TString sP[5];      // sigma of parameters
72 TString pP[5];      // pull  of parameters
73 TString axisYDP[5];  // axis title
74 TString axisYPP[5];  // axis title
75 TString axisYDPm[5];  // axis title
76 TString axisYPPm[5];  // axis title
77 //
78 //
79 Float_t range[5] = {5,3,10,3,0.05};      // ranges for diff histogram
80
81 Float_t scale[5] = {10,10,1000,1000,1};  // scaling factor
82 //
83 // Z depend
84 TH2F * histoDPZ[5]={0,0,0,0,0};
85 TH2F * histoSPZ[5]={0,0,0,0,0};
86 TH2F * histoPPZ[5]={0,0,0,0,0};
87 TH1F * hmDPZ[5];
88 TH1F * hmSPZ[5];
89 TH1F * hmPPZ[5];
90 TH1F * hsDPZ[5];
91 TH1F * hsSPZ[5];
92 TH1F * hsPPZ[5];
93 //
94 // Pt depend
95 TH2F * histoDP1Pt[5]={0,0,0,0,0};
96 TH2F * histoSP1Pt[5]={0,0,0,0,0};
97 TH2F * histoPP1Pt[5]={0,0,0,0,0};
98 TH1F * hmDP1Pt[5];
99 TH1F * hmSP1Pt[5];
100 TH1F * hmPP1Pt[5];
101 TH1F * hsDP1Pt[5];
102 TH1F * hsSP1Pt[5];
103 TH1F * hsPP1Pt[5];
104
105 void MakeCutsParam(){
106   //
107   // Default selection criteria
108   //
109   cutDiff[0]="abs(Tr0.fP[0]+Tr1.fP[0])<3";
110   cutDiff[1]="abs(Tr0.fP[1]-Tr1.fP[1])<15"; 
111   cutDiff[2]="abs(Tr1.fAlpha-Tr0.fAlpha+pi)<0.1";
112   cutDiff[3]="abs(Tr0.fP[3]+Tr1.fP[3])<0.1";     
113   cutDiff[4]="abs(Tr0.fP[4]+Tr1.fP[4])<0.5";     
114   for (Int_t i=0;i<5;i++) cutDiff[5]+=cutDiff[i];
115   //
116   cutPull[0]="abs(Tr0.fP[0]+Tr1.fP[0])/sqrt(Tr0.fC[0]+Tr1.fC[0])<10";
117   cutPull[1]="1"; 
118   cutPull[2]="((Tr1.fAlpha-Tr0.fAlpha+pi))/sqrt(Tr0.fC[5]+Tr1.fC[5])<10";
119   cutPull[3]="1";     
120   cutPull[4]="abs(Tr0.fP[4]+Tr1.fP[4])/sqrt(Tr0.fC[14]+Tr1.fC[14])<10";     
121   for (Int_t i=0;i<5;i++) cutPull[5]+=cutPull[i];
122 }
123
124 void MakeGeomCuts(){
125 //
126 // Geometrical cut 
127 //
128   TCut cutOx("Op1.fX>240&&Op0.fX>240");
129   TCut cutOz("abs(Op1.fP[1])<240&&abs(Op0.fP[1])<240");
130   TCut cutIz("abs(Ip1.fP[1])<240&&abs(Ip0.fP[1])<240");
131   TCut cutX00("abs(x00)<70");
132   TCut cutX10("abs(x10)<70");
133   TCut cutT1P2("abs(Ip1.fP[2])<0.8");
134   TCut cutT0P2("abs(Ip0.fP[2])<0.8");
135   cutGeomTPC = cutOx+cutOz+cutIz+cutX00+cutX10+cutT1P2+cutT0P2;
136 }
137
138 void MakeCuts(){
139   // make cuts all 
140   MakeGeomCuts();
141   MakeCutsParam();
142   cutAll = cutDiff[5]+cutPull[5]+cutGeomTPC;
143 }
144
145 void MakeAlias(){
146   AliExternalTrackParam p;
147   dP[0]="(Tr0.fP[0]+Tr1.fP[0])";
148   dP[1]="(Tr0.fP[1]-Tr1.fP[1])"; 
149   dP[2]="(Tr1.fAlpha-Tr0.fAlpha+pi)";
150   dP[3]="(Tr0.fP[3]+Tr1.fP[3])";     
151   dP[4]="(Tr0.fP[4]+Tr1.fP[4])";     
152   for (Int_t i=0;i<5;i++){
153     sP[i]=Form("%f*sqrt(Tr0.fC[%d]+Tr1.fC[%d])",scale[i],p.GetIndex(i,i),p.GetIndex(i,i));
154     pP[i]=Form("%s/sqrt(Tr0.fC[%d]+Tr1.fC[%d])",dP[i].Data(),scale[i],p.GetIndex(i,i),p.GetIndex(i,i));
155     dP[i]+=Form("*%f",scale[i]);
156   }
157  
158   axisYDP[0]="#sigma_{r#phi} (mm)";
159   axisYDP[1]="#sigma_{z} (mm)";
160   axisYDP[2]="#sigma_{#phi} (mrad)";
161   axisYDP[3]="#sigma_{#theta} (mrad)";
162   axisYDP[4]="#sigma_{1/pt} (1/GeV))";
163   //
164   axisYPP[0]="#sigma_{r#phi} (Unit)";
165   axisYPP[1]="#sigma_{z} (Unit)";
166   axisYPP[2]="#sigma_{#phi} (Unit)";
167   axisYPP[3]="#sigma_{#theta} (Unit)";
168   axisYPP[4]="#sigma_{1/pt} (Unit))";
169   //
170   axisYDPm[0]="#Delta_{r#phi} (mm)";
171   axisYDPm[1]="#Delta_{z} (mm)";
172   axisYDPm[2]="#Delta_{#phi} (mrad)";
173   axisYDPm[3]="#Delta_{#theta} (mrad)";
174   axisYDPm[4]="#Delta_{1/pt} (1/GeV))";
175   //
176   axisYPPm[0]="#Delta_{r#phi} (Unit)";
177   axisYPPm[1]="#Delta_{z} (Unit)";
178   axisYPPm[2]="#Delta_{#phi} (Unit)";
179   axisYPPm[3]="#Delta_{#theta} (Unit)";
180   axisYPPm[4]="#Delta_{1/pt} (Unit))";
181 }
182
183 void MakeZPlot(){
184   
185   for (Int_t i=0;i<5;i++){
186     char hname[100];
187     sprintf(hname,"dP%ivZ",i);
188     //
189     if ( histoDPZ[i]==0){
190       histoDPZ[i]= new TH2F(hname, hname,10,-240,240,100,-range[i],range[i]);
191       sprintf(hname,"sP%ivZ",i);
192       histoSPZ[i]= new TH2F(hname, hname,10,-240,240,100,0,range[i]/3);
193       sprintf(hname,"pP%ivZ",i);
194       histoPPZ[i]= new TH2F(hname, hname,10,-240,240,100,-6,6);
195     }
196     //
197     histoDPZ[i]->SetXTitle("z (cm)");
198     histoSPZ[i]->SetXTitle("z (cm)");
199     histoPPZ[i]->SetXTitle("z (cm)");
200     histoDPZ[i]->SetYTitle(axisYDP[i]);
201     histoSPZ[i]->SetYTitle(axisYDP[i]);
202     histoPPZ[i]->SetYTitle(axisYPP[i]);
203     chainCosmic->Draw((dP[i]+"/sqrt(2.):Tr0.fP[1]>>"+histoDPZ[i]->GetName()),cutAll+cutCustom+cutS);
204     chainCosmic->Draw((sP[i]+"/sqrt(2.):Tr0.fP[1]>>"+histoSPZ[i]->GetName()),cutAll+cutCustom+cutS); 
205     chainCosmic->Draw((pP[i]+":Tr0.fP[1]>>"+histoPPZ[i]->GetName()),cutAll+cutCustom+cutS); 
206   }
207   
208   TObjArray array(3);
209   {
210     for (Int_t i=0;i<5;i++){
211       histoDPZ[i]->FitSlicesY(0,0,-1,0,"QNR",&array);
212       hmDPZ[i] = (TH1F*)((array.At(1))->Clone());
213       hsDPZ[i] = (TH1F*)((array.At(2))->Clone());
214       histoSPZ[i]->FitSlicesY(0,0,-1,0,"QNR",&array);
215       hmSPZ[i] = (TH1F*)((array.At(1))->Clone());
216       hsSPZ[i] = (TH1F*)((array.At(2))->Clone());
217       histoPPZ[i]->FitSlicesY(0,0,-1,0,"QNR",&array);
218       hmPPZ[i] = (TH1F*)((array.At(1))->Clone());
219       hsPPZ[i] = (TH1F*)((array.At(2))->Clone());
220       //
221       hmDPZ[i]->SetYTitle(axisYDPm[i]);
222       hmSPZ[i]->SetYTitle(axisYDPm[i]);
223       hmPPZ[i]->SetYTitle(axisYPPm[i]);
224       hsDPZ[i]->SetMinimum(0);
225       hsDPZ[i]->SetYTitle(axisYDP[i]);
226       hsSPZ[i]->SetYTitle(axisYDP[i]);
227       hsPPZ[i]->SetYTitle(axisYPP[i]);
228       //
229       hmDPZ[i]->SetMarkerColor(kmicolors[1]);
230       hmDPZ[i]->SetMarkerStyle(kmimarkers[1]);
231       hsDPZ[i]->SetMarkerColor(kmicolors[2]);
232       hsDPZ[i]->SetMarkerStyle(kmimarkers[2]);
233       hmPPZ[i]->SetMarkerColor(kmicolors[1]);
234       hmPPZ[i]->SetMarkerStyle(kmimarkers[1]);
235       hsPPZ[i]->SetMarkerColor(kmicolors[2]);
236       hsPPZ[i]->SetMarkerStyle(kmimarkers[2]);
237     }
238   }
239 }
240
241 void Make1PtPlot(){
242   
243   for (Int_t i=0;i<5;i++){
244     char hname[100];
245     sprintf(hname,"dP%iv1Pt",i);
246     //
247     if ( histoDP1Pt[i]==0){
248       histoDP1Pt[i]= new TH2F(hname, hname,6,0.02,0.75,100,-range[i],range[i]);
249       sprintf(hname,"sP%ivZ",i);
250       histoSP1Pt[i]= new TH2F(hname, hname,6,0.02,0.75,100,0,range[i]/3);
251       sprintf(hname,"pP%ivZ",i);
252       histoPP1Pt[i]= new TH2F(hname, hname,6,0.02,0.75,100,-6,6);
253     }
254     //
255     histoDP1Pt[i]->SetXTitle("#sqrt{1/p_{t} (GeV)}");
256     histoSP1Pt[i]->SetXTitle("#sqrt{1/p_{t} (GeV)}");
257     histoPP1Pt[i]->SetXTitle("#sqrt{1/p_{t} (GeV)}");
258     histoDP1Pt[i]->SetYTitle(axisYDP[i]);
259     histoSP1Pt[i]->SetYTitle(axisYDP[i]);
260     histoPP1Pt[i]->SetYTitle(axisYPP[i]);
261     chainCosmic->Draw((dP[i]+"/sqrt(2.):sqrt(0.5*abs(Tr0.fP[4]-Tr1.fP[4]))>>"+histoDP1Pt[i]->GetName()),cutAll+cutCustom+cutS+cut1Pt);
262     chainCosmic->Draw((sP[i]+"/sqrt(2.):sqrt(0.5*abs(Tr0.fP[4]-Tr1.fP[4]))>>"+histoSP1Pt[i]->GetName()),cutAll+cutCustom+cutS+cut1Pt);
263     chainCosmic->Draw((pP[i]+":sqrt(0.5*abs(Tr0.fP[4]-Tr1.fP[4]))>>"+histoPP1Pt[i]->GetName()),cutAll+cutCustom+cutS+cut1Pt);    
264   }
265   
266   TObjArray array(3);
267   {
268     for (Int_t i=0;i<5;i++){
269       histoDP1Pt[i]->FitSlicesY(0,0,-1,0,"QNR",&array);
270       hmDP1Pt[i] = (TH1F*)((array.At(1))->Clone());
271       hsDP1Pt[i] = (TH1F*)((array.At(2))->Clone());
272       histoSP1Pt[i]->FitSlicesY(0,0,-1,0,"QNR",&array);
273       hmSP1Pt[i] = (TH1F*)((array.At(1))->Clone());
274       hsSP1Pt[i] = (TH1F*)((array.At(2))->Clone());
275       histoPP1Pt[i]->FitSlicesY(0,0,-1,0,"QNR",&array);
276       hmPP1Pt[i] = (TH1F*)((array.At(1))->Clone());
277       hsPP1Pt[i] = (TH1F*)((array.At(2))->Clone());
278       hmDP1Pt[i]->SetYTitle(axisYDPm[i]);
279       hmSP1Pt[i]->SetYTitle(axisYDPm[i]);
280       hmPP1Pt[i]->SetYTitle(axisYPPm[i]);
281       hsDP1Pt[i]->SetMinimum(0);
282       hsDP1Pt[i]->SetYTitle(axisYDP[i]);
283       hsSP1Pt[i]->SetYTitle(axisYDP[i]);
284       hsPP1Pt[i]->SetYTitle(axisYPP[i]);
285       //
286       hmDP1Pt[i]->SetMarkerColor(kmicolors[1]);
287       hmDP1Pt[i]->SetMarkerStyle(kmimarkers[1]);
288       hsDP1Pt[i]->SetMarkerColor(kmicolors[2]);
289       hsDP1Pt[i]->SetMarkerStyle(kmimarkers[2]);
290       hmPP1Pt[i]->SetMarkerColor(kmicolors[1]);
291       hmPP1Pt[i]->SetMarkerStyle(kmimarkers[1]);
292       hsPP1Pt[i]->SetMarkerColor(kmicolors[2]);
293       hsPP1Pt[i]->SetMarkerStyle(kmimarkers[2]);
294
295
296     }
297   }
298 }
299
300 void DrawZ(){
301   TCanvas *czd = new TCanvas("Z depend (abs)","Z depend (abs)",700,900);
302   czd->Divide(2,5);
303   for (Int_t i=0;i<5;i++){
304     czd->cd(2*i+1);
305     hmDPZ[i]->Draw("");
306     czd->cd(2*i+2);
307     hsDPZ[i]->Draw("");
308   }
309   czd->SaveAs("picResol/deltaPxZ.eps");
310   czd->SaveAs("picResol/deltaPxZ.gif");
311   czd->SaveAs("picResol/deltaPxZ.root");
312 }
313
314 void DrawZPull(){
315   TCanvas *czp = new TCanvas("Z depend (Pull)","Z depend (Pull)",700,900);
316   czp->Divide(2,5);
317   for (Int_t i=0;i<5;i++){
318     czp->cd(2*i+1);
319     hmPPZ[i]->Draw("");
320     czp->cd(2*i+2);
321     hsPPZ[i]->Draw("");
322   }
323   czp->SaveAs("picResol/pullPxZ.eps");
324   czp->SaveAs("picResol/pullPxZ.gif");
325   czp->SaveAs("picResol/pullPxZ.root");
326
327 }
328
329
330 void Draw1Pt(){
331   TCanvas *cpd = new TCanvas("1/Pt depend","1/Pt depend",700,900);
332   cpd->Divide(2,5);
333   for (Int_t i=0;i<5;i++){
334     cpd->cd(2*i+1);
335     hmDP1Pt[i]->Draw("");
336     cpd->cd(2*i+2);
337     hsDP1Pt[i]->Draw("");
338   }
339   cpd->SaveAs("picResol/deltaPx1Pt.eps");
340   cpd->SaveAs("picResol/deltaPx1Pt.gif");
341   cpd->SaveAs("picResol/deltaPx1Pt.root");
342 }
343 void Draw1PtPull(){
344   TCanvas *cpp = new TCanvas("Pull 1/Pt","Pull 1/Pt",700,900);
345   cpp->Divide(2,5);
346   for (Int_t i=0;i<5;i++){
347     cpp->cd(2*i+1);
348     hmPP1Pt[i]->Draw("");
349     cpp->cd(2*i+2);
350     hsPP1Pt[i]->Draw("");
351   }
352   cpp->SaveAs("picResol/pullPx1Pt.eps");
353   cpp->SaveAs("picResol/pullPx1Pt.gif");
354   cpp->SaveAs("picResol/pullPx1Pt.root");
355 }
356
357
358 /*
359 //
360 //
361 //
362
363
364 void DrawPtSpectra(){
365   TH1F * hisPt0 = new TH1F("hisPt0","hisPt0",50,0,100);
366   TH1F * hisPtC = new TH1F("hisPtC","hisPtC",50,0,100);
367   chainCosmic->Draw("Tr0.Pt()>>hisPt0",cutAll+cutCustom);
368   chainCosmic->Draw("Tr0.Pt()>>hisPtC","abs(Tr0.fP[4])>3*sqrt(Tr0.fC[14])"+cutAll+cutCustom);
369   //
370   hisPt0->SetXTitle("p_{t} (GeV)");
371   hisPt0->SetLineColor(kmicolors[1]);
372   hisPtC->SetLineColor(kmicolors[2]);
373   //
374   hisPtC->Fit("exp");
375   hisPt0->Draw("");
376   hisPtC->Draw("same"); 
377   TLegend * legend = new TLegend(.4,.7, .99, .99,"Cosmic p_{t} spectra");
378   legend->AddEntry(hisPt0,"Raw spectra");
379   legend->AddEntry(hisPtC,"Selection abs(p_{t})<3#sigma_{p_{t}}");
380   legend->Draw();
381   gPad->SaveAs("picSpectra/ptSpectra.eps");
382   gPad->SaveAs("picSpectra/ptSpectra.gif");
383   gPad->SaveAs("picSpectra/ptSpectra.root");
384 }
385
386
387
388 void InitCuts(){
389   //
390   // Init cuts
391   //
392   chainCosmic->Draw(">>listELP",cutAll,"entryList");
393   TEntryList *elist = (TEntryList*)gDirectory->Get("listELP");
394   chainCosmic->SetEntryList(elist);
395   //
396   chainCosmic->Draw(">>listELFit",cutAll+cuthpt+cutS+cutRun,"entryList");
397   TEntryList *elistFit = (TEntryList*)gDirectory->Get("listELFit");
398   chainCosmic->SetEntryList(elistFit);
399 }
400
401 void SetAlias(){
402   //
403   // Set aliases
404   //
405   chainCosmic->SetAlias("dP0","(Tr0.fP[0]+Tr1.fP[0])");
406   chainCosmic->SetAlias("dP1","(Tr0.fP[1]-Tr1.fP[1])");
407   chainCosmic->SetAlias("dP2","(Tr1.fAlpha-Tr0.fAlpha+pi)");
408   chainCosmic->SetAlias("dP3","(Tr0.fP[3]+Tr1.fP[3])");
409   chainCosmic->SetAlias("dP4","(Tr0.fP[4]+Tr1.fP[4])");
410   //
411   chainCosmic->SetAlias("sP0","sqrt(Tr0.fC[0]+Tr1.fC[0])");
412   chainCosmic->SetAlias("sP1","sqrt(Tr0.fC[2]+Tr1.fC[2])");
413   chainCosmic->SetAlias("sP2","sqrt(Tr0.fC[5]+Tr0.fC[5])");
414   chainCosmic->SetAlias("sP3","sqrt(Tr0.fC[9]+Tr1.fC[9])");
415   chainCosmic->SetAlias("sP4","sqrt(Tr0.fC[14]+Tr1.fC[14])");
416   //
417   chainCosmic->SetAlias("corrP0","0");
418   chainCosmic->SetAlias("corrP1","0");
419   chainCosmic->SetAlias("corrP2","0");
420   chainCosmic->SetAlias("corrP3","0");
421   chainCosmic->SetAlias("corrP4","0");
422   //
423   chainCosmic->SetAlias("dR","(1-abs(Tr0.fP[1]/250))");
424   chainCosmic->SetAlias("side","(-1+(Tr0.fP[1]>0)*2)");
425   chainCosmic->SetAlias("meanPt","((Tr0.Pt()+Tr1.Pt())/2.)");
426
427 }
428
429 void Correction(){
430   //
431   // Fit corrections
432   //
433   TStatToolkit toolkit;
434   Double_t chi2=0;
435   Int_t    npoints=0;
436   TVectorD fitParam;
437   TMatrixD covMatrix;
438   //
439   TString fstring="";
440   fstring+="side++";
441   //
442   fstring+="dR++";
443   fstring+="dR*dR++";
444   fstring+="Tr0.fP[3]++";
445   //
446   fstring+="dR*side++";
447   fstring+="dR*dR*side++";
448   fstring+="Tr0.fP[3]*side++";
449   //
450   TString * strP0 = TStatToolkit::FitPlane(chainCosmic,"dP0", fstring.Data(),"1", chi2,npoints,fitParam,covMatrix);
451   chainCosmic->SetAlias("corrP0",strP0->Data());
452
453   TString * strP1 = TStatToolkit::FitPlane(chainCosmic,"dP1", fstring.Data(),"!crossI&&!crossO", chi2,npoints,fitParam,covMatrix);
454   chainCosmic->SetAlias("corrP1",strP1->Data());
455
456   TString * strP2 = TStatToolkit::FitPlane(chainCosmic,"dP2", fstring.Data(),"1", chi2,npoints,fitParam,covMatrix);
457   chainCosmic->SetAlias("corrP2",strP2->Data());
458
459   TString * strP3 = TStatToolkit::FitPlane(chainCosmic,"dP3", fstring.Data(),"!crossI&&!crossO", chi2,npoints,fitParam,covMatrix);
460   chainCosmic->SetAlias("corrP3",strP3->Data());
461
462   TString * strP4 = TStatToolkit::FitPlane(chainCosmic,"dP4", fstring.Data(),"1", chi2,npoints,fitParam,covMatrix);
463   chainCosmic->SetAlias("corrP4",strP4->Data());
464   bUseCorrection = kTRUE;
465 }
466
467
468
469 void DrawNClusterGeom(){
470   //
471   //
472   //
473   TH2F * hNd("hNd","hNd",50,0,190,100,10,160);
474   chainCosmic->Draw("Orig0.fTPCncls:sqrt(x00^2+x01^2)>>hNd",cutOx+cutOz+cutIx+cutIz);
475   hNd->FitSlicesY();
476   hNd_1->SetXTitle("DCA_{r} (cm)");
477   hNd_1->SetYTitle("Mean number of clusters");
478   gPad->SaveAs("pic/NCl_Radius.eps");
479   gPad->SaveAs("pic/NCl_Radius.gif");
480   gPad->SaveAs("pic/NCl_Radius.root");
481
482
483 }
484
485
486 void PtResolPt(){
487
488   TH2F * hdPtPt = new TH2F("hdPtPt","hdPtPt",20,0.5,30,100,-60,60);
489   TH2F * hsPtPt = new TH2F("hsPtPt","hsPtPt",20,0.5,30,200,-0,30);
490   TH2F * hdPtPtNoCor = new TH2F("hdPtPtNoCor","hdPtPtNoCor",20,0.5,30,100,-60,60);
491   TH2F * hdPtPtCor = new TH2F("hdPtPtCor","hdPtPtCor",20,0.5,30,200,-60,60);
492   //
493   v0.BinLogX(hdPtPt);
494   v0.BinLogX(hsPtPt);
495   v0.BinLogX(hdPtPtNoCor);
496   v0.BinLogX(hdPtPtCor);
497
498   chainCosmic->Draw("100*((Tr0.Pt()-Tr1.Pt())/meanPt)/sqrt(2.):meanPt>>hdPtPt","side>0"+cutAll+cutRun+cutS+cutN120,"");
499   chainCosmic->Draw("100*(sP4*meanPt)/sqrt(2.):meanPt>>hsPtPt","side>0"+cutAll+cutRun+cutS+cutN120,"");
500   if (bUseCorrection) chainCosmic->Draw("100*((dP4-corrP4)*meanPt)/sqrt(2.):meanPt>>hdPtPtCorr","side>0"+cutAll+cutRun+cutS+cutN120,"");
501   if (bUseCorrection) chainCosmic->Draw("100*(dP4*meanPt)/sqrt(2.):meanPt>>hdPtPtNoCorr","side>0"+cutAll+cutRun+cutS+cutN120,"");
502   hdPtPt->FitSlicesY();
503   hsPtPt->FitSlicesY();
504   hdPtPt_2->Fit("pol1");
505   {if (bUseCorrection){
506      hdPtPtNoCor->FitSlicesY();
507      hdPtPtCor->FitSlicesY();
508   }}
509
510   hdPtPt_2->SetXTitle("p_{t} (GeV)");
511   hdPtPt_2->SetYTitle("#sigma_{p_{t}}/p_{t} (%)");
512   hdPtPt_2->SetMinimum(0.5);
513   hsPtPt_1->SetMinimum(0.5);
514   hdPtPt_2->SetLineColor(kmicolors[1]);
515   hdPtPt_2->SetMarkerStyle(kmimarkers[1]);
516
517   hdPtPt_2->Draw();
518   {if (bUseCorrection){
519      hdPtPtNoCor_2->Draw("same");
520      hdPtPtCor_2->Draw("same");
521   }}
522   gPad->SaveAs("picPerformance/SigmaPt_pt.gif");
523   gPad->SaveAs("picPerformance/SigmaPt_pt.eps");
524   gPad->SaveAs("picPerformance/SigmaPt_pt.root");
525   hsPtPt_1->SetLineColor(kmicolors[2]);
526   hsPtPt_1->SetMarkerStyle(kmimarkers[2]);
527   hsPtPt_1->Draw("same");
528   gPad->SaveAs("picPerformance/SigmaPt_ptLimit.gif");
529   gPad->SaveAs("picPerformance/SigmaPt_ptLimit.eps");
530   gPad->SaveAs("picPerformance/SigmaPt_ptLimit.root");
531
532 }
533
534
535
536
537
538 void PtResolN(){
539   //
540   //
541   //
542   TH2F * hdP4Ncl= new TH2F("hdp4Ncl","hdp4Ncl",5,80,160,100,-0.1,0.1);
543   chainCosmic->Draw("(dP4-corrP4)/sqrt(2.):min(Orig0.fTPCncls,Orig1.fTPCncls)>>hdp4Ncl","side>0"+cuthpt+cutRun+cutS,"");
544   hdp4Ncl->FitSlicesY();
545   hdp4Ncl_2->SetXTitle("Number of clusters");
546   hdp4Ncl_2->SetYTitle("#sigma 1/p_{t} (1/GeV)");
547   hdp4Ncl_2->Draw();
548   gPad->SaveAs("pic/SigmaP4_N.gif");
549   gPad->SaveAs("pic/SigmaP4_N.eps");
550   gPad->SaveAs("pic/SigmaP4_N.root");
551
552   //
553   //
554   TH2F * hdP4PullNcl = new TH2F("hdP4PullNcl","hdP4PullNcl",5,80,160,100,-6.1,6.1);
555   chainCosmic->Draw("(Tr1.fP[4]+Tr0.fP[4])/sqrt(Tr1.fC[14]+Tr0.fC[14]):min(Orig0.fTPCncls,Orig1.fTPCncls)>>hdP4PullNcl","side>0"+cuthpt+cutRun+cutS,"");
556   hdP4PullNcl->FitSlicesY();
557   hdP4PullNcl_2->SetXTitle("Number of clusters");
558   hdP4PullNcl_2->SetYTitle("#sigma 1/p_{t} (Unit)");
559   hdP4PullNcl_2->Draw();
560   gPad->SaveAs("pic/PullP4_N.gif");
561   gPad->SaveAs("pic/PullP4_N.eps");
562   gPad->SaveAs("pic/PullP4_N.root");
563
564 }
565
566
567
568 void dEdxRatio(){
569   TH2F hratioPt("hratioPt","hratioPt",10,0,10,100,0.6,1.4);
570   chainCosmic->Draw("Seed0.CookdEdxNorm(0.01,0.65,1,0,159,0,kFALSE)/(0.3091*Seed0.CookdEdxNorm(0.01,0.65,0,0,159,0,kFALSE)):sqrt(Tr0.P())>>hratioPt","min(Orig0.fTPCncls,Orig1.fTPCncls)>60&&abs(mag)>0.1&&abs(Tr0.fP[3])>0.03","",10000000);
571   //
572   //
573   //
574   hratioPt->FitSlicesY();
575   TH2F hratioP3("hratioP3","hratioP3",10,0.0,0.6,100,0.6,1.4);
576   chainCosmic->Draw("Seed0.CookdEdxNorm(0.01,0.65,1,0,159,0,kFALSE)/(0.3091*Seed0.CookdEdxNorm(0.01,0.65,0,0,159,0,kFALSE)):abs(Tr0.fP[3])>>hratioP3","min(Orig0.fTPCncls,Orig1.fTPCncls)>60&&abs(mag)>0.1&&abs(Tr0.fP[3])>0.03","",10000000);
577 }
578
579
580
581
582 ///////////////////////////////////////////////////////////////////////////
583 //
584 //
585 //
586 // RESOLUTION  as function of 1/pt
587 //
588 //
589 //
590 ///////////////////////////////////////////////////////////////////////////
591
592 void P0resol1Pt(){
593   //
594   // P0 - Y -DCA resolution as function of the 1/pt
595   //
596   TH2F * hdP01Pt = new TH2F("hdP01Pt","hdP01Pt",6,0,1.0,100,-1.05,1.05);
597   TH2F * hdP01PtNoCor = new TH2F("hdP01PtNoCor","hdP01PtNoCor",6,0,1.0,100,-1.05,1.05);
598   chainCosmic->Draw("(dP0-corrP0)/sqrt(2.):sqrt(1/meanPt)>>hdP01Pt","side>0"+cutAll+cutRun+cutS+cutN120,"");
599   chainCosmic->Draw("(dP0-0)/sqrt(2.):sqrt(1/meanPt)>>hdP01PtNoCor","side>0"+cutAll+cutRun+cutS+cutN120,"");
600   hdP01Pt->FitSlicesY();
601   hdP01PtNoCor->FitSlicesY();
602   TH2F * hsP01Pt = new TH2F("hsP01Pt","hsP01Pt",6,0,1.0,100,-0.05,0.5);
603   chainCosmic->Draw("(sP0)/sqrt(2.):sqrt(1/meanPt)>>hsP01Pt","side>0"+cutAll+cutRun+cutS+cutN120,"");
604   TH1 *hsP01Pt_2 = hsP01Pt->ProfileX();
605
606   hdP01Pt_2->SetMinimum(0);
607   hdP01Pt_2->SetXTitle("#sqrt{1/p_{t} (1/GeV)}");
608   hdP01Pt_2->SetYTitle("#sigma_{y} (cm)");
609   hdP01Pt_2->SetMarkerStyle(kmimarkers[0]);  
610   hsP01Pt_2->SetMarkerStyle(kmimarkers[2]);  
611   hdP01PtNoCor_2->SetMarkerStyle(kmimarkers[1]);
612   hdP01Pt_2->Draw();  
613   hsP01Pt_2->Draw("same");  
614   hdP01PtNoCor_2->Draw("same");
615
616   gPad->SaveAs("picPerformance/SigmaP0_1pt.gif");
617   gPad->SaveAs("picPerformance/SigmaP0_1pt.eps");
618   gPad->SaveAs("picPerformance/SigmaP0_1pt.root");
619   //
620   TH2F * hPullP01Pt = new TH2F("hhPullP01Pt","hhPullP01Pt",6,0,1,50,-5.05,5.05);
621   TH2F * hncPullP01Pt = new TH2F("hhncPullP01Pt","hhncPullP01Pt",6,0,1,50,-5.05,5.05);
622   chainCosmic->Draw("(dP0-corrP0)/sP0:sqrt(1/meanPt)>>hhPullP01Pt","side>0"+cutAll+cutRun+cutS+cutN120,"");
623   chainCosmic->Draw("(dP0-0)/sP0:sqrt(1/meanPt)>>hhncPullP01Pt","side>0"+cutAll+cutRun+cutS+cutN120,"");
624   hPullP01Pt->FitSlicesY();
625   hncPullP01Pt->FitSlicesY();
626   hhPullP01Pt_2->SetMarkerStyle(kmimarkers[0]);
627   hhncPullP01Pt_2->SetMarkerStyle(kmimarkers[1]);
628   hhPullP01Pt_2->SetMinimum(0);
629   hhPullP01Pt_2->SetXTitle("#sqrt{1/p_{t} (1/GeV)}");
630   hhPullP01Pt_2->SetYTitle("#sigma_{y}(Unit) ");
631   hhPullP01Pt_2->Draw();
632   //hhncPullP01Pt_2->Draw("same");
633   gPad->SaveAs("picPerformance/PullP0_1pt.gif");
634   gPad->SaveAs("picPerformance/PullP0_1pt.eps");
635   gPad->SaveAs("picPerformance/PullP0_1pt.root");
636 }
637
638
639
640 void P1resol1Pt(){
641   //
642   // P1 - Z -DCA resolution as function of the 1/pt
643   //
644   TH2F * hdP11Pt = new TH2F("hdP11Pt","hdP11Pt",6,0,1.0,100,-1.05,1.05);
645   TH2F * hdP11PtNoCor = new TH2F("hdP11PtNoCor","hdP11PtNoCor",6,0,1.0,100,-1.05,1.05);
646   chainCosmic->Draw("(dP1-corrP1)/sqrt(2.):sqrt(1/meanPt)>>hdP11Pt","side>0"+cutAll+cutRun+cutS+cutN120,"");
647   chainCosmic->Draw("(dP1-0)/sqrt(2.):sqrt(1/meanPt)>>hdP11PtNoCor","side>0"+cutAll+cutRun+cutS+cutN120,"");
648   hdP11Pt->FitSlicesY();
649   hdP11PtNoCor->FitSlicesY();
650   hdP11Pt_2->SetMinimum(0);
651   hdP11Pt_2->SetXTitle("#sqrt{1/p_{t} (1/GeV)}");
652   hdP11Pt_2->SetYTitle("#sigma_{z} (cm)");
653   hdP11Pt_2->SetMarkerStyle(kmimarkers[0]);  
654   hdP11PtNoCor_2->SetMarkerStyle(kmimarkers[1]);
655   hdP11Pt_2NoCor->Draw();  
656   //  hdP11PtNoCor_2->Draw("same");
657   gPad->SaveAs("picPerformance/SigmaP1_1pt.gif");
658   gPad->SaveAs("picPerformance/SigmaP1_1pt.eps");
659   gPad->SaveAs("picPerformance/SigmaP1_1pt.root");
660
661   //
662   TH2F * hPullP11Pt = new TH2F("hhPullP11Pt","hhPullP11Pt",6,0,1,50,-5.05,5.05);
663   TH2F * hncPullP11Pt = new TH2F("hhncPullP11Pt","hhncPullP11Pt",6,0,1,50,-5.05,5.05);
664   chainCosmic->Draw("(dP1-corrP1)/sP1:sqrt(1/meanPt)>>hhPullP11Pt","side>0"+cutAll+cutRun+cutS+cutN120,"");
665   chainCosmic->Draw("(dP1-0)/sP1:sqrt(1/meanPt)>>hhncPullP11Pt","side>0"+cutAll+cutRun+cutS+cutN120,"");
666   hPullP11Pt->FitSlicesY();
667   hncPullP11Pt->FitSlicesY();
668   hhPullP11Pt_2->SetMarkerStyle(kmimarkers[0]);
669   hhncPullP11Pt_2->SetMarkerStyle(kmimarkers[1]);
670   hhPullP11Pt_2->SetMinimum(0);
671   hhPullP11Pt_2->SetXTitle("#sqrt{1/p_{t} (1/GeV)}");
672   hhPullP11Pt_2->SetYTitle("#sigma_{z}(Unit) ");
673   hhPullP11Pt_2NoCor->Draw();
674   //hhncPullP11Pt_2->Draw("same");
675   gPad->SaveAs("picPerformance/PullP1_1pt.gif");
676   gPad->SaveAs("picPerformance/PullP1_1pt.eps");
677   gPad->SaveAs("picPerformance/PullP1_1pt.root");
678 }
679
680 void P2resol1Pt(){
681   //
682   // P2 - Z -DCA resolution as function of the 1/pt
683   //
684   TH2F * hdP21Pt = new TH2F("hdP21Pt","hdP21Pt",6,0,1.0,100,-20.05,20.05);
685   TH2F * hdP21PtNoCor = new TH2F("hdP21PtNoCor","hdP21PtNoCor",6,0,1.0,100,-20.05,20.05);
686   chainCosmic->Draw("1000*(dP2-corrP2)/sqrt(2.):sqrt(1/meanPt)>>hdP21Pt","side>0"+cutAll+cutRun+cutS+cutN120,"");
687   chainCosmic->Draw("1000*(dP2-0)/sqrt(2.):sqrt(1/meanPt)>>hdP21PtNoCor","side>0"+cutAll+cutRun+cutS+cutN120,"");
688   hdP21Pt->FitSlicesY();
689   hdP21PtNoCor->FitSlicesY();
690   hdP21Pt_2->SetMinimum(0);
691   hdP21Pt_2->SetXTitle("#sqrt{1/p_{t} (1/GeV)}");
692   hdP21Pt_2->SetYTitle("#sigma_{#Phi} (mrad)");
693   hdP21Pt_2->SetMarkerStyle(kmimarkers[0]);  
694   hdP21PtNoCor_2->SetMarkerStyle(kmimarkers[1]);
695   hdP21Pt_2NoCor->Draw();  
696   //  hdP21PtNoCor_2->Draw("same");
697   gPad->SaveAs("picPerformance/SigmaP2_1pt.gif");
698   gPad->SaveAs("picPerformance/SigmaP2_1pt.eps");
699   gPad->SaveAs("picPerformance/SigmaP2_1pt.root");
700
701   //
702   TH2F * hPullP21Pt = new TH2F("hhPullP21Pt","hhPullP21Pt",6,0,1,50,-5.05,5.05);
703   TH2F * hncPullP21Pt = new TH2F("hhncPullP21Pt","hhncPullP21Pt",6,0,1,50,-5.05,5.05);
704   chainCosmic->Draw("(dP2-corrP2)/sP2:sqrt(1/meanPt)>>hhPullP21Pt","side>0"+cutAll+cutRun+cutS+cutN120,"");
705   chainCosmic->Draw("(dP2-0)/sP2:sqrt(1/meanPt)>>hhncPullP21Pt","side>0"+cutAll+cutRun+cutS+cutN120,"");
706   hPullP21Pt->FitSlicesY();
707   hncPullP21Pt->FitSlicesY();
708   hhPullP21Pt_2->SetMarkerStyle(kmimarkers[0]);
709   hhncPullP21Pt_2->SetMarkerStyle(kmimarkers[1]);
710   hhPullP21Pt_2->SetMinimum(0);
711   hhPullP21Pt_2->SetXTitle("#sqrt{1/p_{t} (1/GeV)}");
712   hhPullP21Pt_2->SetYTitle("#sigma_{#Phi}(Unit) ");
713   hhPullP21Pt_2NoCor->Draw();
714   //hhncPullP21Pt_2->Draw("same");
715   gPad->SaveAs("picPerformance/PullP2_1pt.gif");
716   gPad->SaveAs("picPerformance/PullP2_1pt.eps");
717   gPad->SaveAs("picPerformance/PullP2_1pt.root");
718 }
719
720 void P3resol1Pt(){
721   //
722   // P3 - Z -DCA resolution as function of the 1/pt
723   //
724   TH2F * hdP31Pt = new TH2F("hdP31Pt","hdP31Pt",6,0,1.0,100,-5.05,5.05);
725   TH2F * hdP31PtNoCor = new TH2F("hdP31PtNoCor","hdP31PtNoCor",6,0,1.0,100,-5.05,5.05);
726   chainCosmic->Draw("1000*(dP3-corrP3)/sqrt(2.):sqrt(1/meanPt)>>hdP31Pt","side>0"+cutAll+cutRun+cutS+cutN120,"");
727   chainCosmic->Draw("1000*(dP3-0)/sqrt(2.):sqrt(1/meanPt)>>hdP31PtNoCor","side>0"+cutAll+cutRun+cutS+cutN120,"");
728   hdP31Pt->FitSlicesY();
729   hdP31PtNoCor->FitSlicesY();
730   hdP31Pt_2->SetMinimum(0);
731   hdP31Pt_2->SetXTitle("#sqrt{1/p_{t} (1/GeV)}");
732   hdP31Pt_2->SetYTitle("#sigma_{#Theta} (mrad)");
733   hdP31Pt_2->SetMarkerStyle(kmimarkers[0]);  
734   hdP31PtNoCor_2->SetMarkerStyle(kmimarkers[1]);
735   hdP31Pt_2NoCor->Draw();  
736   //  hdP31PtNoCor_2->Draw("same");
737   gPad->SaveAs("picPerformance/SigmaP3_1pt.gif");
738   gPad->SaveAs("picPerformance/SigmaP3_1pt.eps");
739   gPad->SaveAs("picPerformance/SigmaP3_1pt.root");
740
741   //
742   TH2F * hPullP31Pt = new TH2F("hhPullP31Pt","hhPullP31Pt",6,0,1,50,-5.05,5.05);
743   TH2F * hncPullP31Pt = new TH2F("hhncPullP31Pt","hhncPullP31Pt",6,0,1,50,-5.05,5.05);
744   chainCosmic->Draw("(dP3-corrP3)/sP3:sqrt(1/meanPt)>>hhPullP31Pt","side>0"+cutAll+cutRun+cutS+cutN120,"");
745   chainCosmic->Draw("(dP3-0)/sP3:sqrt(1/meanPt)>>hhncPullP31Pt","side>0"+cutAll+cutRun+cutS+cutN120,"");
746   hPullP31Pt->FitSlicesY();
747   hncPullP31Pt->FitSlicesY();
748   hhPullP31Pt_2->SetMarkerStyle(kmimarkers[0]);
749   hhncPullP31Pt_2->SetMarkerStyle(kmimarkers[1]);
750   hhPullP31Pt_2->SetMinimum(0);
751   hhPullP31Pt_2->SetXTitle("#sqrt{1/p_{t} (1/GeV)}");
752   hhPullP31Pt_2->SetYTitle("#sigma_{#Theta}(Unit) ");
753   hhPullP31Pt_2NoCor->Draw();
754   //hhncPullP31Pt_2->Draw("same");
755   gPad->SaveAs("picPerformance/PullP3_1pt.gif");
756   gPad->SaveAs("picPerformance/PullP3_1pt.eps");
757   gPad->SaveAs("picPerformance/PullP3_1pt.root");
758 }
759
760
761
762
763
764
765 void P4resol1Pt(){
766   //
767   // P4 - 1/Pt resolution as function of the 1/pt
768   //
769   TH2F * hdP41Pt = new TH2F("hdP41Pt","hdP41Pt",6,0,1.0,100,-0.05,0.05);
770   TH2F * hdP41PtNoCor = new TH2F("hdP41PtNoCor","hdP41PtNoCor",6,0,1.0,100,-0.05,0.05);
771   chainCosmic->Draw("(dP4-corrP4)/sqrt(2.):sqrt(1/meanPt)>>hdP41Pt","side>0"+cutAll+cutRun+cutS+cutN120,"");
772   chainCosmic->Draw("(dP4-0)/sqrt(2.):sqrt(1/meanPt)>>hdP41PtNoCor","side>0"+cutAll+cutRun+cutS+cutN120,"");
773   hdP41Pt->FitSlicesY();
774   hdP41PtNoCor->FitSlicesY();
775   hdP41Pt_2->SetMinimum(0);
776   hdP41Pt_2->SetXTitle("#sqrt{1/p_{t} (1/GeV)}");
777   hdP41Pt_2->SetYTitle("#sigma_{1/pt} (1/GeV)");
778   hdP41Pt_2->SetMarkerStyle(kmimarkers[0]);  
779   hdP41PtNoCor_2->SetMarkerStyle(kmimarkers[1]);
780   hdP41Pt_2NoCor->Draw();  
781   //hdP41PtNoCor_2->Draw("same");
782   gPad->SaveAs("picPerformance/SigmaP4_1pt.gif");
783   gPad->SaveAs("picPerformance/SigmaP4_1pt.eps");
784   gPad->SaveAs("picPerformance/SigmaP4_1pt.root");
785
786   //
787   TH2F * hPullP41Pt = new TH2F("hhPullP41Pt","hhPullP41Pt",6,0,1,50,-5.05,5.05);
788   TH2F * hncPullP41Pt = new TH2F("hhncPullP41Pt","hhncPullP41Pt",6,0,1,50,-5.05,5.05);
789   chainCosmic->Draw("(dP4-corrP4)/sP4:sqrt(1/meanPt)>>hhPullP41Pt","side>0"+cutAll+cutRun+cutS+cutN120,"");
790   chainCosmic->Draw("(dP4-0)/sP4:sqrt(1/meanPt)>>hhncPullP41Pt","side>0"+cutAll+cutRun+cutS+cutN120,"");
791   hPullP41Pt->FitSlicesY();
792   hncPullP41Pt->FitSlicesY();
793   hhPullP41Pt_2->SetMarkerStyle(kmimarkers[0]);
794   hhncPullP41Pt_2->SetMarkerStyle(kmimarkers[1]);
795   hhPullP41Pt_2->SetMinimum(0);
796   hhPullP41Pt_2->SetXTitle("#sqrt{1/p_{t}} (1/GeV)}");
797   hhPullP41Pt_2->SetYTitle("#sigma_{1/pt} (Unit) ");
798   hhPullP41Pt_2NoCor->Draw();
799   //hhncPullP41Pt_2->Draw("same");
800   gPad->SaveAs("picPerformance/PullP4_1pt.gif");
801   gPad->SaveAs("picPerformance/PullP4_1pt.eps");
802   gPad->SaveAs("picPerformance/PullP4_1pt.root");
803 }
804
805 //////////////////////////////////////////////////////
806 //
807 //
808 // RESOLUTION as function of Z
809 //
810 //
811 //////////////////////////////////////////////////////
812
813 void P0resolZ(){
814   //
815   //
816   //
817   TH2F * hdP0Z = new TH2F("hdP0Z","hdP0Z",10,-250,250,100,-3.05,3.05);
818   TH2F * hdP0ZNoCor = new TH2F("hdP0ZNoCor","hdP0ZNoCor",10,-250,250,100,-3.05,3.05);
819   chainCosmic->Draw("(dP0-corrP0)/sqrt(2.):x02>>hdP0Z",cutAll+cutRun+cutS+cutN120,"");
820   chainCosmic->Draw("(dP0-0)/sqrt(2.):x02>>hdP0ZNoCor",cutAll+cutRun+cutS+cutN120,"");
821   hdP0Z->FitSlicesY();
822   hdP0ZNoCor->FitSlicesY();
823   //
824   TH2F * hsP0Z = new TH2F("hsP0Z","hsP0Z",10,-250,250,200,0.0,2);
825   chainCosmic->Draw("(sP0)/sqrt(2.):x02>>hsP0Z",cutAll+cutRun+cutS+cutN120,"");  
826   TH1 * hsP0Z_2 = hsP0Z->ProfileX();
827
828   //
829   hdP0Z_2->SetMinimum(0);
830   hdP0Z_2->SetXTitle("Z position (cm)");
831   hdP0Z_2->SetYTitle("#sigma_{y} (cm)");
832   hdP0Z_2->SetMarkerStyle(kmimarkers[0]);  
833   hdP0ZNoCor_2->SetMarkerStyle(kmimarkers[1]);
834   hdP0Z_2->Draw();  
835   hsP0Z_2->Draw("same");  
836   hdP0ZNoCor_2->Draw("same");
837
838   gPad->SaveAs("picPerformance/SigmaP0_z.gif");
839   gPad->SaveAs("picPerformance/SigmaP0_z.eps");
840   gPad->SaveAs("picPerformance/SigmaP0_z.root");
841   //
842   TH2F * hdPP0Z = new TH2F("hdPP0Z","hdPP0Z",8,-200,200,50,-5.05,5.05);
843   TH2F * hncdPP0Z = new TH2F("hncdPP0Z","hncdPP0Z",8,-200,200,50,-5.05,5.05);
844   chainCosmic->Draw("(dP0-corrP0)/sP0:x02>>hdPP0Z",cutAll+cutRun+cutS+cutN120,"");
845   chainCosmic->Draw("(dP0-0)/sP0:x02>>hncdPP0Z",cutAll+cutRun+cutS+cutN120,"");
846   hdPP0Z->FitSlicesY();
847   hncdPP0Z->FitSlicesY();
848   hdPP0Z_2->SetMarkerStyle(kmimarkers[0]);
849   hncdPP0Z_2->SetMarkerStyle(kmimarkers[1]);
850   hdPP0Z_2->SetMinimum(0);
851   hdPP0Z_2->SetXTitle("Z position (cm)");
852   hdPP0Z_2->SetYTitle("#sigma_{y}(Unit) ");
853   hdPP0Z_2->Draw();
854   hncdPP0Z_2->Draw("same");
855   gPad->SaveAs("picPerformance/PullP0_z.gif");
856   gPad->SaveAs("picPerformance/PullP0_z.eps");
857   gPad->SaveAs("picPerformance/PullP0_z.root");
858 }
859
860 void P1resolZ(){
861   //
862   //
863   //
864   TH2F *hdP1Z = new TH2F("hdP1Z","hdP1Z",10,-250,250,100,-1.05,1.05);
865   TH2F *hdP1ZNoCor=new TH2F("hdP1ZNoCor","hdP1ZNoCor",10,-250,250,100,-1.05,1.05);
866   chainCosmic->Draw("(dP1-corrP1)/sqrt(2.):x02>>hdP1Z",cutAll+cutRun+cutS+cutN120,"");
867   chainCosmic->Draw("(dP1-0)/sqrt(2.):x02>>hdP1ZNoCor",cutAll+cutRun+cutS+cutN120,"");
868   TH2F * hsP1Z = new TH2F("hsP1Z","hsP1Z",10,-250,250,200,0.0,1);
869   chainCosmic->Draw("(sP1)/sqrt(2.):x02>>hsP1Z",cutAll+cutRun+cutS+cutN120,"");  
870   TH1 * hsP1Z_2 = hsP1Z->ProfileX();
871
872   hdP1Z->FitSlicesY();
873   hdP1ZNoCor->FitSlicesY();
874   hdP1Z_2->SetMinimum(0);
875   hdP1Z_2->SetXTitle("Z position (cm)");
876   hdP1Z_2->SetYTitle("#sigma_{z} (cm)");
877   hdP1Z_2->SetMarkerStyle(kmimarkers[0]);  
878   hsP1Z_2->SetMarkerStyle(kmimarkers[2]);  
879   hdP1ZNoCor_2->SetMarkerStyle(kmimarkers[1]);
880
881   hdP1ZNoCor_2->SetMinimum(0);
882   hdP1Z_2->Draw("");
883   hdP1ZNoCor_2->Draw("same");
884   hsP1Z_2->Draw("same");
885
886   gPad->SaveAs("picPerformance/SigmaP1_z.gif");
887   gPad->SaveAs("picPerformance/SigmaP1_z.eps");
888   gPad->SaveAs("picPerformance/SigmaP1_z.root");
889   //
890   TH2F * hdPP1Z = new TH2F("hdPP1Z","hdPP1Z",8,-200,200,50,-5.05,5.05);
891   TH2F * hncdPP1Z = new TH2F("hncdPP1Z","hncdPP1Z",8,-200,200,50,-5.05,5.05);
892   chainCosmic->Draw("(dP1-corrP1)/sP1:x02>>hdPP1Z",cutAll+cutRun+cutS+cutN120,"");
893   chainCosmic->Draw("(dP1-0)/sP1:x02>>hncdPP1Z",cutAll+cutRun+cutS+cutN120,"");
894   hdPP1Z->FitSlicesY();
895   hncdPP1Z->FitSlicesY();
896   hdPP1Z_2->SetMarkerStyle(kmimarkers[0]);
897   hncdPP1Z_2->SetMarkerStyle(kmimarkers[1]);
898   hdPP1Z_2->SetMinimum(0);
899   hncdPP1Z_2->SetMinimum(0);
900   hncdPP1Z_2->SetXTitle("Z position (cm)");
901   hncdPP1Z_2->SetYTitle("#sigma_{z} (Unit) ");
902   hncdPP1Z_2->Draw("");
903   hdPP1Z_2->Draw();
904   gPad->SaveAs("picPerformance/PullP1_z.gif");
905   gPad->SaveAs("picPerformance/PullP1_z.eps");
906   gPad->SaveAs("picPerformance/PullP1_z.root");
907 }
908
909
910 void P2resolZ(){
911   //
912   //
913   //
914   TH2F * hdP2Z = new TH2F("hdP2Z","hdP2Z",10,-250,250,50,-20.0,20.0);
915   chainCosmic->Draw("1000*(dP2-corrP2)/sqrt(2.):x02>>hdP2Z",cutAll+cutRun+cutS+cutN120,"");
916   hdP2Z->FitSlicesY();
917   hdP2Z_2->SetXTitle("Z position (cm)");
918   hdP2Z_2->SetYTitle("#sigma_{#phi} (mrad)");
919   hdP2Z_2->Draw();
920   gPad->SaveAs("picPerformance/SigmaP2_z.gif");
921   gPad->SaveAs("picPerformance/SigmaP2_z.eps");
922   gPad->SaveAs("picPerformance/SigmaP2_z.root");
923
924   //
925   TH2F * hdPP2Z = new TH2F("hdPP2Z","hdPP2Z",8,-200,200,50,-5.05,5.05);
926   chainCosmic->Draw("(dP2-corrP2)/sP2:x02>>hdPP2Z",cutAll+cutRun+cutS+cutN120,"");
927   hdPP2Z->FitSlicesY();
928   hdPP2Z_2->SetXTitle("Z position (cm)");
929   hdPP2Z_2->SetYTitle("#sigma_{#Phi} (Unit) ");
930   hdPP2Z_2->Draw();
931   gPad->SaveAs("picPerformance/PullP2_z.gif");
932   gPad->SaveAs("picPerformance/PullP2_z.eps");
933   gPad->SaveAs("picPerformance/PullP2_z.root");
934
935 }
936
937 void P3resolZ(){
938   //
939   //
940   //
941   TH2F * hdP3Z= new TH2F("hdP3Z","hdP3Z",10,-250,250,50,-5,5);
942   chainCosmic->Draw("1000*(dP3-corrP3)/sqrt(2.):x02>>hdP3Z",cutAll+cutRun+cutS+cutN120,"");
943   hdP3Z->FitSlicesY();
944   hdP3Z_2->SetMinimum(0);
945   hdP3Z_2->SetXTitle("Z position (cm)");
946   hdP3Z_2->SetYTitle("#sigma_{#Theta}  (mrad)");
947   hdP3Z_2->Draw();
948   gPad->SaveAs("picPerformance/SigmaP3_z.gif");
949   gPad->SaveAs("picPerformance/SigmaP3_z.eps");
950   gPad->SaveAs("picPerformance/SigmaP3_z.root");
951   //
952   TH2F * hdPP3Z=  new TH2F("hdPP3Z","hdPP3Z",8,-200,200,50,-5.05,5.05);
953   chainCosmic->Draw("(dP3-corrP3)/sP3:x02>>hdPP3Z",cutAll+cutRun+cutS+cutN120,"");
954   hdPP3Z->FitSlicesY();
955   hdPP3Z->SetMinimum(0);
956   hdPP3Z_2->SetXTitle("Z position (cm)");
957   hdPP3Z_2->SetYTitle("#sigma_{#Theta} (Unit) ");
958   hdPP3Z_2->Draw();
959   //
960   gPad->SaveAs("picPerformance/PullP3_z.gif");
961   gPad->SaveAs("picPerformance/PullP3_z.eps");
962   gPad->SaveAs("picPerformance/PullP3_z.root");
963 }
964
965
966
967 void P4resolZ(){
968   //
969   //
970   //
971   TH2F *hdP4Z = new TH2F("hdP4Z","hdP4Z",10,-250,250,100,-0.05,0.05);
972   TH2F *hdP4ZNoCor=new TH2F("hdP4ZNoCor","hdP4ZNoCor",10,-250,250,100,-0.05,0.05);
973   chainCosmic->Draw("(dP4-corrP4)/sqrt(2.):x02>>hdP4Z",cutAll+cutRun+cutS+cutN120,"");
974   chainCosmic->Draw("(dP4-0)/sqrt(2.):x02>>hdP4ZNoCor",cutAll+cutRun+cutS+cutN120,"");
975   hdP4Z->FitSlicesY();
976   hdP4ZNoCor->FitSlicesY();
977   hdP4Z_2->SetMinimum(0);
978   hdP4Z_2->SetXTitle("Z position (cm)");
979   hdP4Z_2->SetYTitle("#sigma_{1/pt} (1/GeV)");
980   hdP4Z_2->SetMarkerStyle(kmimarkers[0]);  
981   hdP4ZNoCor_2->SetMarkerStyle(kmimarkers[1]);
982   hdP4Z_2->Draw();  
983   //hdP4ZNoCor_2->Draw("same");
984   gPad->SaveAs("picPerformance/SigmaP4_z.gif");
985   gPad->SaveAs("picPerformance/SigmaP4_z.eps");
986   gPad->SaveAs("picPerformance/SigmaP4_z.root");
987   //
988   TH2F * hdPP4Z = new TH2F("hdPP4Z","hdPP4Z",8,-200,200,50,-5.05,5.05);
989   TH2F * hncdPP4Z = new TH2F("hncdPP4Z","hncdPP4Z",8,-200,200,50,-5.05,5.05);
990   chainCosmic->Draw("(dP4-corrP4)/sP4:x02>>hdPP4Z",cutAll+cutRun+cutS+cutN120,"");
991   chainCosmic->Draw("(dP4-0)/sP4:x02>>hncdPP4Z",cutAll+cutRun+cutS+cutN120,"");
992   hdPP4Z->FitSlicesY();
993   hncdPP4Z->FitSlicesY();
994   hdPP4Z_2->SetMarkerStyle(kmimarkers[0]);
995   hncdPP4Z_2->SetMarkerStyle(kmimarkers[1]);
996   hdPP4Z_2->SetMinimum(0);
997   hdPP4Z_2->SetXTitle("Z position (cm)");
998   hdPP4Z_2->SetYTitle("#sigma_{1/pt} (Unit) ");
999   hdPP4Z_2->Draw();
1000   //hncdPP4Z_2->Draw("same");
1001   gPad->SaveAs("picPerformance/PullP4_z.gif");
1002   gPad->SaveAs("picPerformance/PullP4_z.eps");
1003   gPad->SaveAs("picPerformance/PullP4_z.root");
1004
1005 }
1006
1007 */