]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG1/AliComparisonDraw.cxx
New Raw Data format implemented
[u/mrichter/AliRoot.git] / PWG1 / AliComparisonDraw.cxx
1
2
3 //
4 // Comparison draw
5 // Compare the MC information with the reconstructed 
6 //
7
8 /*
9   after running analysis, read the file, and get component
10   gSystem->Load("libPWG1.so");
11   TFile f("Output.root");
12   AliComparisonDraw * comp = (AliComparisonDraw*)f.Get("AliComparisonDraw");
13   TF1 fl("fl","((min(250./(abs(x+0.000001)),250)-90))",0,2);  // length function
14   TF1 fl2("fl2","[0]/((min(250./(abs(x+0.000001)),250)-90))^[1]",0,2);
15   fl2.SetParameter(1,1);
16   fl2.SetParameter(0,1);
17
18 */
19
20
21
22
23 #include "TFile.h"
24 #include "TCint.h"
25 #include "TH3F.h"
26 #include "TH2F.h"
27 #include "TF1.h"
28 #include "TProfile.h"
29 #include "TProfile2D.h"
30 #include "TGraph2D.h"
31 #include "TCanvas.h"
32 #include "TGraph.h"
33 //
34 // 
35 #include "AliESDEvent.h"   // new container
36 #include "AliESD.h"
37 #include "AliESDfriend.h"
38 #include "AliESDfriendTrack.h"
39 //
40 #include "AliMathBase.h"
41 #include "AliTreeDraw.h" 
42
43 #include "AliMCInfo.h" 
44 #include "AliESDRecInfo.h" 
45 #include "AliComparisonDraw.h" 
46
47
48 ClassImp(AliComparisonDraw)
49
50 Bool_t    AliComparisonDraw::fgBDraw=kFALSE;         //option draw temporary results
51
52 AliComparisonDraw::AliComparisonDraw():
53   TNamed("ComparisonDraw","ComparisonDraw"),
54   fEffTPCPt(0),      // TPC efficiency as function of Pt (tan+-1)
55   fEffTPCPtMC(0),    // MC -TPC efficiency as function of Pt (tan+-1)
56   fEffTPCPtF(0),     // efficiency for findable tracks
57   //
58   fEffTPCTan(0),   // TPC efficiency as function of Tan (pt>0.15
59   fEffTPCTanMC(0), // MC -TPC efficiency as function of Tan (pt>0.15)
60   fEffTPCTanF(0),  // efficiency for findable tracks Tan (pt>0.15)
61   //
62   fEffTPCPtTan(0),    // TPC efficiency as function of Pt and tan
63   fEffTPCPtTanMC(0),  // MC -TPC efficiency as function of Pt and tan
64   fEffTPCPtTanF(0),  // TPC efficiency as function of Pt and tan
65   //
66   // dEdx resolution
67   //
68   fTPCSignalNormTan(0), // tpc signal normalized to the mean signal - MC
69   fTPCSignalNormSPhi(0),   // tpc signal normalized to the mean signal - MC
70   fTPCSignalNormTPhi(0),   // tpc signal normalized to the mean signal - MC
71   //
72   fTPCSignalNormTanSPhi(0),   // tpc signal normalized to the mean signal - MC
73   fTPCSignalNormTanTPhi(0),   // tpc signal normalized to the mean signal - MC
74   fTPCSignalNormTanSPt(0),   // tpc signal normalized to the mean signal - MC
75   //
76   //
77   fPtResolLPT(0),        // pt resolution - low pt
78   fPtResolHPT(0),        // pt resolution - high pt 
79   fPtPullLPT(0),         // pt resolution - low pt
80   fPtPullHPT(0),         // pt resolution - high pt 
81   //
82   // Resolution constrained param
83   //
84   fCPhiResolTan(0),   // angular resolution -  constrained
85   fCTanResolTan(0),   // angular resolution -  constrained
86   fCPtResolTan(0),    // pt resolution      -  constrained
87   fCPhiPullTan(0),   // angular resolution -  constrained
88   fCTanPullTan(0),   // angular resolution -  constrained
89   fCPtPullTan(0),    // pt resolution      -  constrained
90   //
91   // DCA resolution
92   //
93   fD0TanSPtB1(0),   // distance to vertex y  
94   fD1TanSPtB1(0),   // distance to vertex z  
95   fD0TanSPtL1(0),   // distance to vertex y  
96   fD1TanSPtL1(0)   // distance to vertex z  
97 {
98   InitHisto();
99 }
100
101 AliComparisonDraw::~AliComparisonDraw(){
102   //
103   //
104   //
105   delete  fEffTPCPt;      // TPC efficiency as function of Pt (tan+-1)
106   delete  fEffTPCPtMC;    // MC -TPC efficiency as function of Pt (tan+-1)
107   delete  fEffTPCPtF;     // efficiency for findable tracks
108   //
109   delete  fEffTPCTan;   // TPC efficiency as function of Tan (pt>0.15
110   delete  fEffTPCTanMC; // MC -TPC efficiency as function of Tan (pt>0.15)
111   delete  fEffTPCTanF;  // efficiency for findable tracks Tan (pt>0.15)
112   //
113   delete  fEffTPCPtTan;    // TPC efficiency as function of Pt and tan
114   delete  fEffTPCPtTanMC;  // MC -TPC efficiency as function of Pt and tan
115   delete  fEffTPCPtTanF;  // TPC efficiency as function of Pt and tan
116   //
117   // dEdx resolution
118   //
119   delete  fTPCSignalNormTan; // tpc signal normalized to the mean signal - MC
120   delete  fTPCSignalNormSPhi;   // tpc signal normalized to the mean signal - MC
121   delete  fTPCSignalNormTPhi;   // tpc signal normalized to the mean signal - MC
122   //
123   delete  fTPCSignalNormTanSPhi;   // tpc signal normalized to the mean signal - MC
124   delete  fTPCSignalNormTanTPhi;   // tpc signal normalized to the mean signal - MC
125   delete  fTPCSignalNormTanSPt;   // tpc signal normalized to the mean signal - MC
126   //
127   //
128   delete  fPtResolLPT;        // pt resolution - low pt
129   delete  fPtResolHPT;        // pt resolution - high pt 
130   delete  fPtPullLPT;         // pt resolution - low pt
131   delete  fPtPullHPT;         // pt resolution - high pt 
132   //
133   // Resolution constrained param
134   //
135   delete fCPhiResolTan;   // angular resolution -  constrained
136   delete fCTanResolTan;   // angular resolution -  constrained
137   delete fCPtResolTan;    // pt resolution      -  constrained
138   delete fCPhiPullTan;   // angular resolution -  constrained
139   delete fCTanPullTan;   // angular resolution -  constrained
140   delete fCPtPullTan;    // pt resolution      -  constrained
141   //
142   // DCA resolution
143   //
144   delete fD0TanSPtB1;   // distance to vertex y  
145   delete fD1TanSPtB1;   // distance to vertex z  
146   delete fD0TanSPtL1;   // distance to vertex y  
147   delete fD1TanSPtL1;   // distance to vertex z  
148  
149 }
150
151
152
153
154 void AliComparisonDraw::InitHisto(){
155   //
156   //
157   // EFFICIENCY
158   //  
159   // Efficiency as function of pt
160   fEffTPCPt = new TProfile("Eff_pt","Eff_Pt",50,0.1,3);            // physical
161   fEffTPCPtMC = new TProfile("MC_Eff_pt","MC_Eff_Pt",50,0.1,3);    // MC - particles make more than 50 rowdigits
162   fEffTPCPtF = new TProfile("F_Eff_pt","F_Eff_Pt",50,0.1,3);     // tracking - under condition more than 50 rdigits
163
164   // Efficiency as function of pt
165   fEffTPCTan = new TProfile("Eff_tan","Eff_tan",50,-2.5,2.5);            // physical
166   fEffTPCTanMC = new TProfile("MC_Eff_tan","MC_Eff_tan",50,-2.5,2.5);    // MC - particles make more than 50 rowdigits
167   fEffTPCTanF = new TProfile("F_Eff_tan","F_Eff_tan",50,-2.5,2.5);     // tracking - under condition more than 50 rdigits
168
169   fEffTPCPtTan = new TProfile2D("Eff_pt","Eff_Pt",10,0.1,3,20,-2.,2.);
170   fEffTPCPtTanMC = new TProfile2D("MC_Eff_pt","MC Eff Pt",10,0.1,3,20, -2.,2.);
171   fEffTPCPtTanF = new TProfile2D("MC_Eff_pt","MC Eff Pt",10,0.1,3,20, -2.,2.);
172   
173   //
174   // TPC dEdx
175   //
176   fTPCSignalNormTan = new TH2F("CdEdxTan","CdEdxTan",50, -2,2,  40,30,70); // tpc signal normalized to the MC
177   fTPCSignalNormSPhi   = new TH2F("CdEdxSPhi","CdEdxSPhi",10,0.0,1,40,30,70); // tpc signal normalized to the MC
178   fTPCSignalNormTPhi   = new TH2F("CdEdxTPhi","CdEdxTPhi",10,0.0,2,40,30,70); // tpc signal normalized to the MC
179
180   fTPCSignalNormTanSPhi= new TH3F("CdEdxTanSPhi","CdEdxTanSPhi",20, -2,2, 10,0.0 ,1,  40,30,70);   // tpc signal normalized to the mean signal - MC
181   fTPCSignalNormTanTPhi= new TH3F("CdEdxTanTPhi","CdEdxTanTPhi",20, -2,2, 10,0.0 ,1,  40,30,70);   // tpc signal normalized to the mean signal - MC
182   fTPCSignalNormTanSPt= new TH3F("CdEdxTanSPt","CdEdxTanSPt",20, -2,2, 10,0.3 ,3,  40,30,70);   // tpc signal normalized to the mean signal - MC
183
184
185
186   //
187   // RESOLUTION
188   //
189   fCPtResolTan = new TH2F("C Pt resol","C pt resol",50, -2,2,200,-0.2,0.2);
190   fCPtPullTan = new TH2F("C Pt pull","C pt pull",50, -2,2,200,-5,5);
191   //
192   fCPhiResolTan = new TH2F("CPhiResolTan","CPhiResolTan",50, -2,2,200,-0.025,0.025);   
193   // angular resolution -  constrained
194   fCTanResolTan = new TH2F("CTanResolTan","CTanResolTan",50, -2,2,200,-0.025,0.025);
195   // angular resolution -  constrained
196   fCPtResolTan=new TH2F("CPtResol","CPtResol",50, -2,2,200,-0.2,0.2);;    
197   // pt resolution      -  constrained
198   fCPhiPullTan = new TH2F("CPhiPullTan","CPhiPullTan",50, -2,2,200,-5,5);   
199   // angular resolution -  constrained
200   fCTanPullTan = new TH2F("CTanPullTan","CTanPullTan",50, -2,2,200,-5,5);
201   // angular resolution -  constrained
202   fCPtPullTan=new TH2F("CPtPull","CPtPull",50, -2,2,200,-5,5);    
203   // pt resolution      -  constrained
204   //
205   fPtResolLPT = new TH2F("Pt resol","pt resol",10, 0.1,3,200,-0.2,0.2);
206   fPtResolHPT = new TH2F("Pt resol","pt resol",10, 2,100,200,-0.3,0.3);  
207   fPtPullLPT = new TH2F("Pt pool","pt pool",10, 0.1,3,200,-6,6);
208   fPtPullHPT = new TH2F("Pt pool","pt pool",10, 2,100,200,-6,6);  
209   //
210   fD0TanSPtB1 = new TH3F("DCAyTanSPt","DCAyTanSPt",20,1,2, 10,0.3,2, 100,-4,4);
211   fD1TanSPtB1 = new TH3F("DCAzTanSPt","DCAzTanSPt",20,1,2, 10,0.3,2, 100,-4,4);
212   fD0TanSPtL1 = new TH3F("DCAyTanSPt","DCAyTanSPt",20,0,1, 10,0.3,2, 100,-0.1,0.1);
213   fD1TanSPtL1 = new TH3F("DCAzTanSPt","DCAzTanSPt",20,0,1, 10,0.3,2, 100, -0.1,0.1);
214
215
216
217 }
218
219 void AliComparisonDraw::ProcessEff(AliMCInfo* infoMC, AliESDRecInfo *infoRC){
220   //
221   // make efficiencies histograms
222   //
223   Float_t kptcut = 0.15;
224   Float_t ktancut=1.;
225   Int_t   kmincl =50;
226   Float_t mcpt = infoMC->GetParticle().Pt();
227   Float_t tantheta = TMath::Tan(infoMC->GetParticle().Theta()-TMath::Pi()*0.5);
228   Bool_t isPrim = infoMC->GetParticle().R()<0.1 && TMath::Abs(infoMC->GetParticle().Vz())<10;
229   //z diamond and 
230   
231   if (!isPrim) return;
232
233   //pt
234   if (TMath::Abs(tantheta)<ktancut){
235     fEffTPCPt->Fill(mcpt, infoRC->GetStatus(1)==3);
236     fEffTPCPtMC->Fill(mcpt, infoMC->GetRowsWithDigits()>kmincl);
237     if (infoMC->GetRowsWithDigits()>kmincl){
238       fEffTPCPtF->Fill(mcpt, infoRC->GetStatus(1)==3);
239     }
240   }
241
242   //theta
243   if (TMath::Abs(mcpt)>kptcut){
244     fEffTPCTan->Fill(tantheta, infoRC->GetStatus(1)==3);
245     fEffTPCTanMC->Fill(tantheta, infoMC->GetRowsWithDigits()>kmincl);
246     if (infoMC->GetRowsWithDigits()>kmincl){
247       fEffTPCTanF->Fill(tantheta, infoRC->GetStatus(1)==3);
248     }
249   }
250   // 
251   // pt-theta
252   //
253   fEffTPCPtTan->Fill(mcpt,tantheta,infoRC->GetStatus(1)==3);
254   fEffTPCPtTanMC->Fill(mcpt,tantheta,infoMC->GetRowsWithDigits()>50); 
255   if (infoMC->GetRowsWithDigits()>kmincl){
256     fEffTPCPtTanF->Fill(mcpt,tantheta,infoRC->GetStatus(1)==3); 
257   }
258 }
259
260
261 void AliComparisonDraw::ProcessResolConstrained(AliMCInfo* infoMC, AliESDRecInfo *infoRC){
262   //
263   //
264   //
265   Float_t mcpt = infoMC->GetParticle().Pt();
266   Float_t tantheta = TMath::Tan(infoMC->GetParticle().Theta()-TMath::Pi()*0.5);
267   Bool_t isPrim = infoMC->GetParticle().R()<0.1 && TMath::Abs(infoMC->GetParticle().Vz())<10;
268   //z diamond and 
269   
270   if (!isPrim) return;
271   if (infoRC->GetStatus(1)!=3) return;
272   if (!infoRC->GetESDtrack()) return;  
273   if (infoRC->GetESDtrack()->GetTPCNcls()<10) return;
274   if (!infoRC->GetESDtrack()->GetConstrainedParam()) return;
275   
276   //
277   // constrained parameters resolution
278   //
279   const AliExternalTrackParam * cparam = infoRC->GetESDtrack()->GetConstrainedParam();
280   Float_t deltaCPt= (mcpt-cparam->Pt())/mcpt;  
281   Float_t pullCPt= (1/mcpt-cparam->OneOverPt())/
282     TMath::Sqrt(cparam->GetSigma1Pt2());          
283   Float_t deltaPhi = TMath::ATan2(cparam->Py(),cparam->Px())-
284     TMath::ATan2(infoMC->GetParticle().Py(),infoMC->GetParticle().Px());
285   Float_t pullPhi = deltaPhi/TMath::Sqrt(cparam->GetSigmaSnp2()); 
286
287   Float_t deltaTan = TMath::ATan2(cparam->Pz(),cparam->Pt())-
288     TMath::ATan2(infoMC->GetParticle().Pz(),infoMC->GetParticle().Pt());
289   Float_t pullTan = deltaPhi/TMath::Sqrt(cparam->GetSigmaSnp2()); 
290
291   fCPtResolTan->Fill(tantheta,deltaCPt);
292   fCPtPullTan->Fill(tantheta,pullCPt);
293   fCPhiResolTan->Fill(tantheta,deltaPhi);
294   fCPhiPullTan->Fill(tantheta,pullPhi);
295   fCTanResolTan->Fill(tantheta,deltaTan);
296   fCTanPullTan->Fill(tantheta,pullTan);
297
298 }
299
300
301
302 void  AliComparisonDraw::ProcessTPCdedx(AliMCInfo* infoMC, AliESDRecInfo *infoRC){
303   //
304   //
305   //
306   Float_t mcpt = infoMC->GetParticle().Pt();
307   Float_t tantheta = TMath::Tan(infoMC->GetParticle().Theta()-TMath::Pi()*0.5);
308   Bool_t isPrim = infoMC->GetParticle().R()<0.1 && TMath::Abs(infoMC->GetParticle().Vz())<10;
309   //z diamond and 
310   
311   if (!isPrim) return;
312   if (infoRC->GetStatus(1)!=3) return;
313   if (!infoRC->GetESDtrack()) return;  
314   if (infoRC->GetESDtrack()->GetTPCNcls()<10) return;
315   if (!infoRC->GetESDtrack()->GetConstrainedParam()) return;
316   Float_t mprim = infoMC->GetPrim();
317   if (mprim>1.4) return;
318   if (mprim<0.5) return;
319   if (infoRC->GetESDtrack()->GetTPCsignalN()<50) return;
320   //
321   Float_t ratio = infoRC->GetESDtrack()->GetTPCsignal()/infoMC->GetPrim();
322   Float_t sphi =  infoRC->GetESDtrack()->GetInnerParam()->GetSnp();
323   Float_t tphi =  sphi/TMath::Sqrt(1-sphi*sphi);
324
325
326   if (TMath::Abs(infoMC->GetParticle().GetPdgCode())!=211) return;
327   if (mcpt>0.5){
328     fTPCSignalNormTan->Fill(tantheta,ratio);    //only subset
329   }
330   if (TMath::Abs(tantheta)<0.5){
331     fTPCSignalNormSPhi->Fill(sphi,ratio);        // only subset
332     fTPCSignalNormTPhi->Fill(tphi,ratio);        // only subset
333   }
334   fTPCSignalNormTanSPhi->Fill(tantheta,sphi,ratio);    
335   fTPCSignalNormTanTPhi->Fill(tantheta,tphi,ratio);    
336   fTPCSignalNormTanSPt->Fill(tantheta,TMath::Sqrt(mcpt),ratio);    
337 }
338
339 void      AliComparisonDraw::ProcessDCA(AliMCInfo* infoMC, AliESDRecInfo *infoRC){
340   //
341   //
342   //
343   Float_t mcpt = infoMC->GetParticle().Pt();
344   Float_t tantheta = TMath::Tan(infoMC->GetParticle().Theta()-TMath::Pi()*0.5);
345   Bool_t isPrim = infoMC->GetParticle().R()<0.1 && TMath::Abs(infoMC->GetParticle().Vz())<10;
346   //z diamond and 
347   if (!isPrim) return;
348   if (infoRC->GetStatus(1)!=3) return;
349   if (!infoRC->GetESDtrack()) return;  
350   if (infoRC->GetESDtrack()->GetTPCNcls()<10) return;
351   if (!infoRC->GetESDtrack()->GetConstrainedParam()) return;
352   Float_t spt = TMath::Sqrt(mcpt);
353   Float_t dca[2],cov[3];
354   infoRC->GetESDtrack()->GetImpactParameters(dca,cov);
355   Int_t clusterITS[100];
356   if (infoRC->GetESDtrack()->GetITSclusters(clusterITS)==0){
357     fD0TanSPtB1->Fill(tantheta,spt,dca[0]);
358     fD1TanSPtB1->Fill(tantheta,spt,dca[1]);
359   }
360   fD0TanSPtL1->Fill(tantheta,spt,dca[0]);
361   fD1TanSPtL1->Fill(tantheta,spt,dca[1]);  
362 }
363
364
365
366
367 void AliComparisonDraw::Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC){
368   //
369   // 
370   //
371   ProcessEff(infoMC,infoRC);
372   ProcessResolConstrained(infoMC,infoRC);
373   ProcessTPCdedx(infoMC, infoRC);
374   ProcessDCA(infoMC, infoRC);
375
376   Float_t mcpt = infoMC->GetParticle().Pt();
377   Bool_t isPrim = infoMC->GetParticle().R()<0.1 && TMath::Abs(infoMC->GetParticle().Vz())<10;
378   //z diamond and 
379   
380   if (!isPrim) return;
381   //
382   //
383   if (infoRC->GetStatus(1)==0) return;
384   if (!infoRC->GetESDtrack()) return;  
385   if (infoRC->GetESDtrack()->GetTPCNcls()<10) return;
386   //  printf("Pt\t%f\t%f\n",mcpt, infoRC->GetESDtrack()->Pt());
387   
388   Float_t deltaPt= (mcpt-infoRC->GetESDtrack()->Pt())/mcpt;  
389   Float_t poolPt= (1/mcpt-infoRC->GetESDtrack()->OneOverPt())/
390     TMath::Sqrt(infoRC->GetESDtrack()->GetSigma1Pt2());  
391
392   fPtResolLPT->Fill(mcpt,deltaPt);
393   fPtResolHPT->Fill(mcpt,deltaPt);
394   fPtPullLPT->Fill(mcpt,poolPt);
395   fPtPullHPT->Fill(mcpt,poolPt);  
396 }
397
398
399
400 TH1F* AliComparisonDraw::MakeResol(TH2F * his, Int_t integ, Bool_t type){
401   TH1F *hisr, *hism;
402   if (!gPad) new TCanvas;
403   hisr = AliTreeDraw::CreateResHistoI(his,&hism,integ);
404   if (type) return hism;
405   else 
406     return hisr;
407 }
408
409
410 TGraph2D * AliComparisonDraw::MakeStat2D(TH3 * his, Int_t delta0, Int_t delta1, Int_t type){
411   //
412   //
413   //
414   // delta - number of bins to integrate
415   // type - 0 - mean value
416
417   TAxis * xaxis  = his->GetXaxis();
418   TAxis * yaxis  = his->GetYaxis();
419   //  TAxis * zaxis  = his->GetZaxis();
420   Int_t   nbinx  = xaxis->GetNbins();
421   Int_t   nbiny  = yaxis->GetNbins();
422   char name[1000];
423   Int_t icount=0;
424   TGraph2D  *graph = new TGraph2D(nbinx*nbiny);
425   TF1 f1("f1","gaus");
426   for (Int_t ix=0; ix<nbinx;ix++)
427     for (Int_t iy=0; iy<nbiny;iy++){
428       Float_t xcenter = xaxis->GetBinCenter(ix); 
429       Float_t ycenter = yaxis->GetBinCenter(iy); 
430       sprintf(name,"%s_%d_%d",his->GetName(), ix,iy);
431       TH1 *projection = his->ProjectionZ(name,ix-delta0,ix+delta0,iy-delta1,iy+delta1);
432       Float_t stat= 0;
433       if (type==0) stat = projection->GetMean();
434       if (type==1) stat = projection->GetRMS();
435       if (type==2 || type==3){
436         TVectorD vec(3);
437         AliMathBase::LTM((TH1F*)projection,&vec,0.7);
438         if (type==2) stat= vec[1];
439         if (type==3) stat= vec[0];      
440       }
441       if (type==4|| type==5){
442         projection->Fit(&f1);
443         if (type==4) stat= f1.GetParameter(1);
444         if (type==5) stat= f1.GetParameter(2);
445       }
446       //printf("%d\t%f\t%f\t%f\n", icount,xcenter, ycenter, stat);
447       graph->SetPoint(icount,xcenter, ycenter, stat);
448       icount++;
449     }
450   return graph;
451 }
452
453 TGraph * AliComparisonDraw::MakeStat1D(TH3 * his, Int_t delta1, Int_t type){
454   //
455   //
456   //
457   // delta - number of bins to integrate
458   // type - 0 - mean value
459
460   TAxis * xaxis  = his->GetXaxis();
461   TAxis * yaxis  = his->GetYaxis();
462   //  TAxis * zaxis  = his->GetZaxis();
463   Int_t   nbinx  = xaxis->GetNbins();
464   Int_t   nbiny  = yaxis->GetNbins();
465   char name[1000];
466   Int_t icount=0;
467   TGraph  *graph = new TGraph(nbinx);
468   TF1 f1("f1","gaus");
469   for (Int_t ix=0; ix<nbinx;ix++){
470     Float_t xcenter = xaxis->GetBinCenter(ix); 
471     //    Float_t ycenter = yaxis->GetBinCenter(iy); 
472     sprintf(name,"%s_%d",his->GetName(), ix);
473     TH1 *projection = his->ProjectionZ(name,ix-delta1,ix+delta1,0,nbiny);
474     Float_t stat= 0;
475     if (type==0) stat = projection->GetMean();
476     if (type==1) stat = projection->GetRMS();
477     if (type==2 || type==3){
478       TVectorD vec(3);
479         AliMathBase::LTM((TH1F*)projection,&vec,0.7);
480         if (type==2) stat= vec[1];
481         if (type==3) stat= vec[0];      
482     }
483     if (type==4|| type==5){
484       projection->Fit(&f1);
485       if (type==4) stat= f1.GetParameter(1);
486       if (type==5) stat= f1.GetParameter(2);
487     }
488       //printf("%d\t%f\t%f\t%f\n", icount,xcenter, ycenter, stat);
489     graph->SetPoint(icount,xcenter, stat);
490     icount++;
491   }
492   return graph;
493 }
494
495 //
496 // Make derived plots
497 //
498
499 void AliComparisonDraw::MakePlots(){
500   //
501   //
502   //
503   AliComparisonDraw * comp=this;
504
505   TFile *fp = new TFile("picutures.root","recreate");
506   TH1F *hiss=0, *hism=0;
507   TGraph2D * gr=0, gr2=0;
508   TGraph * gr0 = 0;
509   TCanvas * c = new TCanvas("Phi resol Tan","Phi resol Tan");
510   //
511   //
512   //
513   hiss = comp->MakeResol(comp->fCPtResolTan,1,0);
514   hiss->SetXTitle("Tan(#theta)");
515   hiss->SetYTitle("#sigmap_{t}/p_{t}");
516   hiss->Draw(); 
517   hiss->Write("CptResolTan");
518   //
519   //
520   hiss = comp->MakeResol(comp->fCPhiResolTan,1,0);
521   c->cd();
522   hiss->SetXTitle("Tan(#theta)");
523   hiss->SetYTitle("#sigma#phi (rad)");
524   hiss->Draw();
525   fp->cd();
526   hiss->Write("PhiResolTan");
527   //
528   hiss = comp->MakeResol(comp->fCTanResolTan,1,0);
529   c->cd();
530   hiss->SetXTitle("Tan(#theta)");
531   hiss->SetYTitle("#sigma#theta (rad)");
532   hiss->Draw();
533   fp->cd();
534   hiss->Write("ThetaResolTan");
535   //
536   //
537   hiss = comp->MakeResol(comp->fCTanResolTan,1,0);
538   c->cd();
539   hiss->SetXTitle("Tan(#theta)");
540   hiss->SetYTitle("#sigmap_{t}/p_{t} ");
541   hiss->Draw();
542   fp->cd();
543   //
544   //
545   //
546   hiss = comp->MakeResol(comp->fTPCSignalNormTan,4,0);
547   hiss->SetXTitle("Tan(#theta)");
548   hiss->SetYTitle("#sigma_{dEdx}");
549   hiss->Draw();
550   fp->cd();
551   hiss->Write("TPCdEdxResolTan");
552   //
553   //
554   //
555   hiss = comp->MakeResol(comp->fTPCSignalNormTan,4,1); 
556   hiss->SetXTitle("Tan(#theta)");
557   hiss->SetYTitle("<dEdx>");
558   hiss->Draw(); 
559   hiss->Write("TPCdEdxMeanTan");
560   //
561   //
562   gr = comp->MakeStat2D(comp->fTPCSignalNormTanSPt,3,1,4);
563   gr->GetXaxis()->SetTitle("Tan(#theta)");
564   gr->GetYaxis()->SetTitle("#sqrt{p_{t}(GeV)}");
565   gr->GetZaxis()->SetTitle("<dEdx>");
566   gr->Draw("colz"); 
567   gr->GetHistogram()->Write("TPCdEdxMeanTanPt");
568   //
569   //
570   gr = comp->MakeStat2D(comp->fTPCSignalNormTanSPt,3,1,5);
571   gr->GetXaxis()->SetTitle("Tan(#theta)");
572   gr->GetYaxis()->SetTitle("#sqrt{p_{t}(GeV)}");
573   gr->GetZaxis()->SetTitle("#sigma_{dEdx}");
574   gr->Draw("colz"); 
575   gr->GetHistogram()->Write("TPCdEdxMeanTanPt");
576   //
577   //
578   //
579   comp->fEffTPCTanF->SetXTitle("Tan(#theta)");
580   comp->fEffTPCTanF->SetYTitle("eff_{findable}");
581   comp->fEffTPCTanF->Draw();
582   comp->fEffTPCTanF->Write("EffTanFindable");
583   //
584   //
585   comp->fEffTPCTan->SetXTitle("Tan(#theta)");
586   comp->fEffTPCTan->SetYTitle("eff_{all}");
587   comp->fEffTPCTan->Draw();
588   comp->fEffTPCTan->Write("EffTanAll");
589   //
590   //DCA resolution
591   //
592   gr0 = comp->MakeStat1D(comp->fD0TanSPtB1,2,5);
593   gr0->GetXaxis()->SetTitle("Tan(#theta)");
594   gr0->GetYaxis()->SetTitle("#sigmaDCA (cm)");
595   gPad->Clear();
596   gr0->Draw("al*");
597   gr->GetHistogram()->Write("DCAResolTan");
598   //
599   //
600   //
601   gr = comp->MakeStat2D(comp->fD0TanSPtB1,4,2,5); 
602   gr0->GetXaxis()->SetTitle("Tan(#theta)");
603   gr0->GetYaxis()->SetTitle("#sigmaDCA (cm)");
604   gPad->Clear();
605   gr0->Draw("al*");
606   gr->GetHistogram()->Write("DCAResolSPTTan");
607
608   fp->Close();
609
610
611 }
612
613
614