In mapping:
[u/mrichter/AliRoot.git] / PWG1 / AliAnalysisTaskQASym.cxx
1 #include "TChain.h"
2 #include "TTree.h"
3 #include "TH1F.h"
4 #include "TH2F.h"
5 #include "TH3F.h"
6 #include "TCanvas.h"
7 #include "TList.h"
8 #include "TParticle.h"
9 #include "TParticlePDG.h"
10 #include "TProfile.h"
11 #include "TNtuple.h"
12 #include "TFile.h"
13
14 #include "AliAnalysisTask.h"
15 #include "AliAnalysisManager.h"
16
17 #include "AliESDEvent.h"
18 #include "AliLog.h"
19 #include "AliESDVertex.h"
20 #include "AliESDInputHandler.h"
21 #include "AliESDtrackCuts.h"
22 #include "AliMultiplicity.h"
23
24 #include "AliAnalysisTaskQASym.h"
25 #include "AliExternalTrackParam.h"
26 #include "AliTrackReference.h"
27 #include "AliHeader.h"
28 #include "AliGenEventHeader.h"
29 #include "AliGenDPMjetEventHeader.h"
30
31 // Analysis Task for basic QA on the ESD
32
33 // Authors: Jan Fiete Grosse-Oetringhaus, Christian Klein-Boesing,
34 //          Andreas Morsch, Eva Sicking
35
36 ClassImp(AliAnalysisTaskQASym)
37
38   //________________________________________________________________________
39   AliAnalysisTaskQASym::AliAnalysisTaskQASym(const char *name) 
40     : AliAnalysisTaskSE(name) 
41     ,fTrackType(0)
42     ,fFieldOn(kTRUE)
43     ,fHists(0)
44     ,fHistRECpt(0)
45     ,fEta(0)
46     ,fEtaPhi(0)
47     ,fEtaPt(0)
48     ,fQPt(0)
49     ,fDca(0)
50     ,fqRec(0)
51     ,fsigmaPt(0)
52     
53     ,fRecPtPos(0)
54     ,fRecPtNeg(0)
55     ,fRecPhiPos(0)
56     ,fRecPhiNeg(0)
57     ,fRecEtaPos(0)
58     ,fRecEtaNeg(0)
59     ,fRecEtaPtPos(0)
60     ,fRecEtaPtNeg(0)
61     ,fRecDcaPos(0)
62     ,fRecDcaNeg(0)
63     ,fRecDcaNegInv(0)
64     ,fRecDPos(0)
65     ,fRecDNeg(0)
66     
67     
68     ,fRecQPtPosEta(0)
69     ,fRecQPtNegEta(0)
70     ,fRecPtPosEta(0)
71     ,fRecPtNegEta(0)
72     ,fRecPhiPosEta(0)
73     ,fRecPhiNegEta(0)
74     ,fRecDcaPosEta(0)
75     ,fRecDcaNegEta(0)
76     ,fRecDPosEta(0)
77     ,fRecDNegEta(0)
78     
79     ,fRecPtPosVz(0)
80     ,fRecPtNegVz(0)
81     ,fRecEtaPosVz(0)
82     ,fRecEtaNegVz(0)
83     ,fRecPhiPosVz(0)
84     ,fRecPhiNegVz(0)
85     ,fSignedDcaPosVz(0)
86     ,fSignedDcaNegVz(0)
87     ,fRecQPtPosEtaVz(0)
88     ,fRecQPtNegEtaVz(0)
89     ,fRecEtaPtPosVz(0)
90     ,fRecEtaPtNegVz(0)
91     
92     
93     ,fDeltaPhiAll(0)
94     ,fDeltaPhiLeading(0) 
95     ,fDiffDcaD(0)
96     
97     ,fPhiRec(0)
98     ,fThetaRec(0)
99     ,fNumber(0)
100     ,fVx(0)
101     ,fVy(0)
102     ,fVz(0)
103     ,fVertexX(0)
104     ,fVertexY(0)
105     ,fVertexZ(0)
106     ,test(0)
107   
108     ,fRecDcaPosPhi(0)
109     ,fRecDcaNegPhi(0)
110     ,fRecPtPosPhi(0)
111     ,fRecPtNegPhi(0)
112     ,fRecEtaPosPhi(0)
113     ,fRecEtaNegPhi(0)
114     ,fRecQPtPhi(0)
115     ,fRecEtaPtPosPhi(0)
116     ,fRecEtaPtNegPhi(0)
117
118     ,fRecPtPosEtaPos(0)
119     ,fRecPtNegEtaPos(0)
120     ,fRecPtPosEtaNeg(0)
121     ,fRecPtNegEtaNeg(0)
122
123     ,fRec1PtPosEtaPos(0)
124     ,fRec1PtNegEtaPos(0)
125     ,fRec1PtPosEtaNeg(0)
126     ,fRec1PtNegEtaNeg(0)
127
128     ,fRecPhiPosEtaPos(0)
129     ,fRecPhiNegEtaPos(0)
130     ,fRecPhiPosEtaNeg(0)
131     ,fRecPhiNegEtaNeg(0)
132
133     ,fRecDcaPosPhiEtaPos(0)
134     ,fRecDcaNegPhiEtaPos(0) 
135     ,fRecDcaPosPhiEtaNeg(0)  
136     ,fRecDcaNegPhiEtaNeg(0)  
137
138     ,fRecDcaPosPtEtaPos(0)
139     ,fRecDcaNegPtEtaPos(0) 
140     ,fRecDcaPosPtEtaNeg(0)  
141     ,fRecDcaNegPtEtaNeg(0)  
142   
143     ,fRecPtPosPhiEtaPos(0)  
144     ,fRecPtNegPhiEtaPos(0)  
145     ,fRecPtPosPhiEtaNeg(0) 
146     ,fRecPtNegPhiEtaNeg(0) 
147
148
149 //    ,fRecDcaPhiPtPosEtaPos(0)
150 //    ,fRecDcaPhiPtNegEtaPos(0)
151 //    ,fRecDcaPhiPtPosEtaNeg(0)  
152 //    ,fRecDcaPhiPtNegEtaNeg(0)  
153
154     ,fEtavPt(0)  
155     ,fCompareTPCparam(0)
156
157     
158     ,sdca(0)
159     ,xy(0)
160     ,z(0)
161     ,xvertexcor(0)
162     ,yvertexcor(0)  
163  
164     ,fCuts(0)
165
166 {
167   // Constructor
168   for(Int_t i = 0;i<18;++i){
169     fRecPtTpcSector[i] = 0;
170     fRecEtaTpcSector[i] = 0;
171     fSignedDcaTpcSector[i] = 0;
172     fRecQPtTpcSector[i] = 0;
173     fRecEtaPtTpcSector[i] = 0;
174   }
175
176   for(Int_t i = 0;i< 7;++i){
177     fRecPtPosLadder[i] = 0;
178     fRecPtNegLadder[i] = 0;
179     fRecPhiPosLadder[i] = 0;
180     fRecPhiNegLadder[i] = 0;
181     fRecEtaPosLadder[i] = 0;
182     fRecEtaNegLadder[i] = 0;
183     fSignDcaPos[i] = 0;
184     fSignDcaNeg[i] = 0;
185     fSignDcaNegInv[i] = 0;
186     fPtSigmaPos[i] =0;
187     fPtSigmaNeg[i] =0;
188     fqPtRec[i] =0;
189     fDcaSigmaPos[i] =0;
190     fDcaSigmaNeg[i] =0;
191   }
192
193   DefineOutput(1,  TList::Class()); 
194
195   
196   
197 }
198
199
200 //________________________________________________________________________
201 void AliAnalysisTaskQASym::UserCreateOutputObjects()
202 {
203   // Create histograms
204   // Called once
205
206   Bool_t oldStatus = TH1::AddDirectoryStatus();
207   TH1::AddDirectory(kFALSE);
208
209   Double_t range = 0.3;
210   Double_t pt = 20.;
211
212   fHists = new TList();
213   //  test   = new TNtuple("test","test",  
214   //                      "pt:phi:theta:x:y:z:charge");
215   fHistRECpt   = new TH1F("fHistRECpt", 
216                           " p_{T}",
217                           200, 0., pt);
218   fEta   = new TH1F("fEta", 
219                     " #eta",
220                     200, -2., 2.);
221   fEtavPt   = new TH2F("fEtavPt", 
222                        " #eta -p_{T}",
223                        200, -2., 2.,
224                        100, 0, 1.5);
225   fCompareTPCparam   = new TH2F("fCompareTPCparam", 
226                                 "fCompareTPCparam",
227                                 100, -1., 1.,100,-5, 5);
228   
229   fEtaPhi   = new TH2F("fEtaPhi", 
230                        " #eta - #phi",
231                        200, -2., 2., 128, 0., 2. * TMath::Pi());
232   
233   fThetaRec   = new TH1F("fThetaRec", 
234                          " #theta",
235                          180, 0., TMath::Pi());
236   fPhiRec   = new TH1F("fPhiRec", 
237                        " #phi",
238                        180, 0., 2*TMath::Pi());
239   fNumber   = new TH1F("fNumber", 
240                        "number of tracks per event",
241                        200, -0.5, 199.5);
242   fVx   = new TH1F("fVx", 
243                    "X of first track point",
244                    100, -1., 1.);
245   fVy   = new TH1F("fVy", 
246                    "Y of first track point",
247                    100, -1., 1.);
248   fVz   = new TH1F("fVz", 
249                    "Z of first track point",
250                    200, -50., 50.);
251   fVertexX   = new TH1F("fVerteX", 
252                         "X of vertex",
253                         100, -1., 1.);
254   fVertexY   = new TH1F("fVertexY", 
255                         "Y of vertex",
256                         100, -1., 1.);
257   fVertexZ   = new TH1F("fVertexZ", 
258                         "Z of vertex",
259                         200, -50., 50.);
260   
261   fEtaPt   = new TH1F("fEtaPt", 
262                       " #eta/p_{T} ",
263                       100, -1., 1.);
264
265   fQPt   = new TH1F("fQPt", 
266                     " charge/p_{T} ",
267                     100, -1., 1.);
268
269   fDca   = new TH1F("fDca", 
270                     " dca ",
271                     200,  -range*(1+Int_t(fTrackType/2)*9), range*(1+Int_t(fTrackType/2)*9));
272
273
274   fqRec    = new TH1F("fqRec",   
275                       " charge all reconstructed particle",
276                       21, -9.5, 10.5);
277   
278   fsigmaPt    = new TH1F("fsigmaPt",   
279                          "Log_{10}(#sigma_{p_{T}})",
280                          200, -4., 8.);
281
282
283
284
285   //------------
286   for(Int_t ITSlayer_case=0;ITSlayer_case<7;ITSlayer_case++){
287
288     fSignDcaPos[ITSlayer_case]   = new TH1F(Form("fSignDcaPos%d", ITSlayer_case),  
289                                             " Signed dca", 
290                                             200, -range*(1+Int_t(fTrackType/2)*9), range*(1+Int_t(fTrackType/2)*9));
291     fSignDcaPos[ITSlayer_case]->GetXaxis()->SetTitle("dca");
292     fSignDcaPos[ITSlayer_case]->GetYaxis()->SetTitle("");
293    
294  
295     fSignDcaNeg[ITSlayer_case]   = new TH1F(Form("fSignDcaNeg%d", ITSlayer_case),  
296                                             " Signed dcas",
297                                             200, -range*(1+Int_t(fTrackType/2)*9), range*(1+Int_t(fTrackType/2)*9));
298     fSignDcaNeg[ITSlayer_case]->GetXaxis()->SetTitle("dca");
299     fSignDcaNeg[ITSlayer_case]->GetYaxis()->SetTitle("");
300
301     fSignDcaNegInv[ITSlayer_case]   = new TH1F(Form("fSignDcaNegInv%d", ITSlayer_case),  
302                                                " inverse Signed dca ",
303                                                200, -range*(1+Int_t(fTrackType/2)*9), range*(1+Int_t(fTrackType/2)*9));
304     fSignDcaNegInv[ITSlayer_case]->GetXaxis()->SetTitle("-dca");
305     fSignDcaNegInv[ITSlayer_case]->GetYaxis()->SetTitle("");
306
307
308
309
310     fPtSigmaPos[ITSlayer_case]   = new TH1F(Form("fPtSigmaPos%d", ITSlayer_case),  
311                                             " #sigma_{pT} ",
312                                             208, -4., 8.);
313     fPtSigmaPos[ITSlayer_case]->GetXaxis()->SetTitle("Log_{10}(#sigma_{pT})");
314     fPtSigmaPos[ITSlayer_case]->GetYaxis()->SetTitle("");
315     
316     
317     fPtSigmaNeg[ITSlayer_case]   = new TH1F(Form("fPtSigmaNeg%d",ITSlayer_case),  
318                                             " #sigma_{pT}",
319                                             208, -4., 8.);
320     fPtSigmaNeg[ITSlayer_case]->GetXaxis()->SetTitle("Log_{10}(#sigma_{pT})");
321     fPtSigmaNeg[ITSlayer_case]->GetYaxis()->SetTitle("");
322
323
324
325
326
327     fqPtRec[ITSlayer_case]   = new TH1F(Form("fqPtRec%d",ITSlayer_case),  
328                                         "q/ p_{T}",
329                                         200, -100., 100.);
330     fqPtRec[ITSlayer_case]->GetXaxis()->SetTitle("q_{tr}/p_{T, tr} (GeV/c)");
331     fqPtRec[ITSlayer_case]->GetYaxis()->SetTitle("");
332
333   
334    
335
336
337     fDcaSigmaPos[ITSlayer_case]   = new TH2F(Form("fDcaSigmaPos%d", ITSlayer_case),  
338                                              " p_{T} shift vs #sigma_{pT} ",
339                                              200, -range*(1+Int_t(fTrackType/2)*9), range*(1+Int_t(fTrackType/2)*9),200, -4., 4. );
340     fDcaSigmaPos[ITSlayer_case]->GetXaxis()->SetTitle("signed DCA)");
341     fDcaSigmaPos[ITSlayer_case]->GetYaxis()->SetTitle("log_{10}(#sigma_{pT})");
342     
343     
344     fDcaSigmaNeg[ITSlayer_case]   = new TH2F(Form("fDcaSigmaNeg%d", ITSlayer_case),  
345                                              " p_{T} shift vs #sigma_{pT} ",
346                                              200, -range*(1+Int_t(fTrackType/2)*9), range*(1+Int_t(fTrackType/2)*9),200, -4., 4. );
347     fDcaSigmaNeg[ITSlayer_case]->GetXaxis()->SetTitle("signed DCA");
348     fDcaSigmaNeg[ITSlayer_case]->GetYaxis()->SetTitle("log_{10}(#sigma_{pT})");
349
350
351   }
352     
353  
354     
355   // YIELDs---------- positive and negative particles
356     
357   fRecPtPos   = new TH1F("fRecPtPos", 
358                          " p_{T}",
359                          100, 0.,pt);
360   fRecPtPos->GetXaxis()->SetTitle("p_{T} (GeV/c)");
361   fRecPtNeg   = new TH1F("fRecPtNeg", 
362                          " p_{T} ",
363                          100, 0., pt);
364   fRecPtNeg->GetXaxis()->SetTitle("p_{T} (GeV/c)");
365
366     
367   fRecPhiPos   = new TH1F("fRecPhiPos", 
368                           "#phi",
369                           361, 0., 360.);
370   fRecPhiPos->GetXaxis()->SetTitle("#phi (deg)");
371   
372   fRecPhiNeg   = new TH1F("fRecPhiNeg", 
373                           "#phi ",
374                           361, 0., 360.);
375   fRecPhiNeg->GetXaxis()->SetTitle("#phi (deg)");
376     
377   fRecEtaPos   = new TH1F("fRecEtaPos", 
378                           "#eta",
379                           200, -2., 2.);
380   fRecEtaPos->GetXaxis()->SetTitle("#eta");
381
382   fRecEtaNeg   = new TH1F("fRecEtaNeg", 
383                           "#eta",
384                           200, -2., 2.);
385   fRecEtaNeg->GetXaxis()->SetTitle("#eta");
386     
387   fRecEtaPtPos   = new TH1F("fRecEtaPtPos", 
388                             "#eta/p_{T}",
389                             200, -0.1, .1);
390   fRecEtaPtPos->GetXaxis()->SetTitle("#eta/p_{T}");
391
392   fRecEtaPtNeg   = new TH1F("fRecEtaPtNeg", 
393                             "#eta/p_{T}",
394                             200, -.1, .1);
395   fRecEtaPtNeg->GetXaxis()->SetTitle("#eta/p_{T}");
396
397   fRecDcaPos   = new TH1F("fRecDcaPos", 
398                           " dca",
399                           100, -range*(1+Int_t(fTrackType/2)*9), range*(1+Int_t(fTrackType/2)*9));
400   fRecDcaPos->GetXaxis()->SetTitle("dca (cm)");
401   fRecDcaNeg   = new TH1F("fRecDcaNeg", 
402                           " dca",
403                           100, -range*(1+Int_t(fTrackType/2)*9), range*(1+Int_t(fTrackType/2)*9));
404   fRecDcaNeg->GetXaxis()->SetTitle("dca (cm)");
405
406   fRecDcaNegInv   = new TH1F("fRecDcaNegInv", 
407                              " dca",
408                              100, -range*(1+Int_t(fTrackType/2)*9), range*(1+Int_t(fTrackType/2)*9));
409   fRecDcaNegInv->GetXaxis()->SetTitle("dca (cm)");
410
411
412   fRecDPos   = new TH1F("fRecDPos", 
413                         " d",
414                         100, -range*(1+Int_t(fTrackType/2)*9), range*(1+Int_t(fTrackType/2)*9));
415   fRecDPos->GetXaxis()->SetTitle("d (cm)");
416   fRecDNeg   = new TH1F("fRecDNeg", 
417                         "d",
418                         100, -range*(1+Int_t(fTrackType/2)*9), range*(1+Int_t(fTrackType/2)*9));
419   fRecDNeg->GetXaxis()->SetTitle("d (cm)");
420
421
422   //  YIELDs ---------------- positive and negative eta
423     
424     
425   fRecQPtPosEta   = new TH1F("fRecQPtPosEta", 
426                              "q/p_{T}",
427                              200, -0.5, 0.5);
428   fRecQPtPosEta->GetXaxis()->SetTitle("q/p_{T} ");
429
430   fRecQPtNegEta   = new TH1F("fRecQPtNegEta", 
431                              "q/p_{T}",
432                              200, -0.5, 0.5);
433   fRecQPtNegEta->GetXaxis()->SetTitle("q/p_{T}");
434     
435   fRecPtPosEta   = new TH1F("fRecPtPosEta", 
436                             " p_{T} ",
437                             100, 0., pt);
438   fRecPtPosEta->GetXaxis()->SetTitle("p_{T} (GeV/c)");
439
440   fRecPtNegEta   = new TH1F("fRecPtNegEta", 
441                             " p_{T}",
442                             100, 0., pt);
443   fRecPtNegEta->GetXaxis()->SetTitle("p_{T} (GeV/c)");
444     
445   fRecPhiPosEta   = new TH1F("fRecPhiPosEta", 
446                              "#phi",
447                              361, 0., 360);
448   fRecPhiPosEta->GetXaxis()->SetTitle("#phi (deg)");
449
450   fRecPhiNegEta   = new TH1F("fRecPhiNegEta", 
451                              "#phi ",
452                              361, 0, 360);
453   fRecPhiNegEta->GetXaxis()->SetTitle("#phi (deg)");
454
455   fRecDcaPosEta   = new TH1F("fRecDcaPosEta", 
456                              " dca ",
457                              100, -range*(1+Int_t(fTrackType/2)*9), range*(1+Int_t(fTrackType/2)*9));
458   fRecDcaPosEta->GetXaxis()->SetTitle("dca (cm)");
459   fRecDcaNegEta   = new TH1F("fRecDcaNegEta", 
460                              " dca",
461                              100, -range*(1+Int_t(fTrackType/2)*9), range*(1+Int_t(fTrackType/2)*9));
462   fRecDcaNegEta->GetXaxis()->SetTitle("dca (cm)");
463
464   fRecDPosEta   = new TH1F("fRecDPosEta", 
465                            " d",
466                            100, -range*(1+Int_t(fTrackType/2)*9), range*(1+Int_t(fTrackType/2)*9));
467   fRecDPosEta->GetXaxis()->SetTitle("d (cm)");
468   fRecDNegEta   = new TH1F("fRecDNegEta", 
469                            "d",
470                            100, -5., 5.);
471   fRecDNegEta->GetXaxis()->SetTitle("d (cm)");
472
473   fRecDcaPosPhi   = new TH2F("fRecDcaPosPhi", 
474                              " dca vs. phi",
475                              100, -range*(1+Int_t(fTrackType/2)*9), range*(1+Int_t(fTrackType/2)*9), 180, 0, TMath::Pi()*2);
476   fRecDcaPosPhi->GetXaxis()->SetTitle("dca (cm)");
477   fRecDcaPosPhi->GetYaxis()->SetTitle("#phi (rad.)");
478   fRecDcaNegPhi   = new TH2F("fRecDcaNegPhi", 
479                              " dca vs. phi",
480                              100, -range*(1+Int_t(fTrackType/2)*9), range*(1+Int_t(fTrackType/2)*9), 180, 0, TMath::Pi()*2);
481   fRecDcaNegPhi->GetXaxis()->SetTitle("dca (cm)");
482   fRecDcaNegPhi->GetYaxis()->SetTitle("#phi (rad.)");
483
484   fRecPtPosPhi   = new TH2F("fRecPtPosPhi", 
485                              " log(p_T) vs. phi",
486                              100, -2.5, 2., 180, 0, TMath::Pi()*2);
487   fRecPtPosPhi->GetXaxis()->SetTitle("log_{10}(p_{T})");
488   fRecPtPosPhi->GetYaxis()->SetTitle("#phi (rad.)");
489   fRecPtNegPhi   = new TH2F("fRecPtNegPhi", 
490                              " log(p_T) vs. phi",
491                              100,-2.5 , 2., 180, 0, TMath::Pi()*2);
492   fRecPtNegPhi->GetXaxis()->SetTitle("log_{10}(p_{T})");
493   fRecPtNegPhi->GetYaxis()->SetTitle("#phi (rad.)");
494
495   fRecEtaPosPhi   = new TH2F("fRecEtaPosPhi", 
496                              " eta vs. phi",
497                              100, -1.5, 1.5, 180, 0, TMath::Pi()*2);
498   fRecEtaPosPhi->GetXaxis()->SetTitle("#eta");
499   fRecEtaPosPhi->GetYaxis()->SetTitle("#phi (rad.)");
500   fRecEtaNegPhi   = new TH2F("fRecEtaNegPhi", 
501                              " eta vs. phi",
502                              100, -1.5, 1.5, 180, 0, TMath::Pi()*2);
503   fRecEtaNegPhi->GetXaxis()->SetTitle("#eta");
504   fRecEtaNegPhi->GetYaxis()->SetTitle("#phi (rad.)");
505
506   fRecQPtPhi   = new TH2F("fRecQPtPhi", 
507                              " charge/p_T vs. phi",
508                              100,-1. , 1., 180, 0, TMath::Pi()*2);
509   fRecQPtPhi->GetXaxis()->SetTitle("charge/p_{T}");
510   fRecQPtPhi->GetYaxis()->SetTitle("#phi (rad.)");
511
512   fRecEtaPtPosPhi   = new TH2F("fRecEtaPtPosPhi", 
513                              " eta/p_T vs. phi",
514                              100, -5, 5., 180, 0, TMath::Pi()*2);
515   fRecEtaPtPosPhi->GetXaxis()->SetTitle("#eta/p_{T}");
516   fRecEtaPtPosPhi->GetYaxis()->SetTitle("#phi (rad.)");
517   fRecEtaPtNegPhi   = new TH2F("fRecEtaPtNegPhi", 
518                              " eta/p_T vs. phi",
519                              100,-5 , 5., 180, 0, TMath::Pi()*2);
520   fRecEtaPtNegPhi->GetXaxis()->SetTitle("#eta/p_{T}");
521   fRecEtaPtNegPhi->GetYaxis()->SetTitle("#phi (rad.)");
522
523
524
525
526
527   fRecDcaPosPhiEtaPos   = new TH2F("fRecDcaPosPhiEtaPos", 
528                              " dca vs. phi",
529                              100, -range*(1+Int_t(fTrackType/2)*9), range*(1+Int_t(fTrackType/2)*9), 180, 0, TMath::Pi()*2);
530   fRecDcaPosPhiEtaPos->GetXaxis()->SetTitle("dca (cm)");
531   fRecDcaPosPhiEtaPos->GetYaxis()->SetTitle("#phi (rad.)");
532   fRecDcaNegPhiEtaPos   = new TH2F("fRecDcaNegPhiEtaPos", 
533                              " dca vs. phi",
534                              100, -range*(1+Int_t(fTrackType/2)*9), range*(1+Int_t(fTrackType/2)*9), 180, 0, TMath::Pi()*2);
535   fRecDcaNegPhiEtaPos->GetXaxis()->SetTitle("dca (cm)");
536   fRecDcaNegPhiEtaPos->GetYaxis()->SetTitle("#phi (rad.)");
537
538   fRecPtPosPhiEtaPos   = new TH2F("fRecPtPosPhiEtaPos", 
539                              " log(p_T) vs. phi",
540                              100, -2.5, 2., 180, 0, TMath::Pi()*2);
541   fRecPtPosPhiEtaPos->GetXaxis()->SetTitle("log_{10}(p_{T})");
542   fRecPtPosPhiEtaPos->GetYaxis()->SetTitle("#phi (rad.)");
543   fRecPtNegPhiEtaPos   = new TH2F("fRecPtNegPhiEtaPos", 
544                              " log(p_T) vs. phi",
545                              100,-2.5 , 2., 180, 0, TMath::Pi()*2);
546   fRecPtNegPhiEtaPos->GetXaxis()->SetTitle("log_{10}(p_{T})");
547   fRecPtNegPhiEtaPos->GetYaxis()->SetTitle("#phi (rad.)");
548
549
550   fRecDcaPosPhiEtaNeg   = new TH2F("fRecDcaPosPhiEtaNeg", 
551                              " dca vs. phi",
552                              100, -range*(1+Int_t(fTrackType/2)*9), range*(1+Int_t(fTrackType/2)*9), 180, 0, TMath::Pi()*2);
553   fRecDcaPosPhiEtaNeg->GetXaxis()->SetTitle("dca (cm)");
554   fRecDcaPosPhiEtaNeg->GetYaxis()->SetTitle("#phi (rad.)");
555   fRecDcaNegPhiEtaNeg   = new TH2F("fRecDcaNegPhiEtaNeg", 
556                              " dca vs. phi",
557                              100, -range*(1+Int_t(fTrackType/2)*9), range*(1+Int_t(fTrackType/2)*9), 180, 0, TMath::Pi()*2);
558   fRecDcaNegPhiEtaNeg->GetXaxis()->SetTitle("dca (cm)");
559   fRecDcaNegPhiEtaNeg->GetYaxis()->SetTitle("#phi (rad.)");
560
561   fRecPtPosPhiEtaNeg   = new TH2F("fRecPtPosPhiEtaNeg", 
562                              " log(p_T) vs. phi",
563                              100, -2.5, 2., 180, 0, TMath::Pi()*2);
564   fRecPtPosPhiEtaNeg->GetXaxis()->SetTitle("log_{10}(p_{T})");
565   fRecPtPosPhiEtaNeg->GetYaxis()->SetTitle("#phi (rad.)");
566   fRecPtNegPhiEtaNeg   = new TH2F("fRecPtNegPhiEtaNeg", 
567                              " log(p_T) vs. phi",
568                              100,-2.5 , 2., 180, 0, TMath::Pi()*2);
569   fRecPtNegPhiEtaNeg->GetXaxis()->SetTitle("log_{10}(p_{T})");
570   fRecPtNegPhiEtaNeg->GetYaxis()->SetTitle("#phi (rad.)");
571   
572   //new
573   fRecDcaPosPtEtaPos   = new TH2F("fRecDcaPosPtEtaPos", 
574                              " dca vs. pt",
575                              100, -range*(1+Int_t(fTrackType/2)*9), range*(1+Int_t(fTrackType/2)*9), 200, -2, 2);
576   fRecDcaPosPtEtaPos->GetXaxis()->SetTitle("dca (cm)");
577   fRecDcaPosPtEtaPos->GetYaxis()->SetTitle("log_{10}(p_{T})");
578
579   fRecDcaPosPtEtaNeg   = new TH2F("fRecDcaPosPtEtaNeg", 
580                              " dca vs. pt",
581                              100, -range*(1+Int_t(fTrackType/2)*9), range*(1+Int_t(fTrackType/2)*9), 200, -2, 2);
582   fRecDcaPosPtEtaNeg->GetXaxis()->SetTitle("dca (cm)");
583   fRecDcaPosPtEtaNeg->GetYaxis()->SetTitle("log_{10}(p_{T})");
584
585   fRecDcaNegPtEtaPos   = new TH2F("fRecDcaNegPtEtaPos", 
586                              " dca vs. pt",
587                              100, -range*(1+Int_t(fTrackType/2)*9), range*(1+Int_t(fTrackType/2)*9), 200, -2, 2);
588   fRecDcaNegPtEtaPos->GetXaxis()->SetTitle("dca (cm)");
589   fRecDcaNegPtEtaPos->GetYaxis()->SetTitle("log_{10}(p_{T})");
590
591   fRecDcaNegPtEtaNeg   = new TH2F("fRecDcaNegPtEtaNeg", 
592                              " dca vs. pt",
593                              100, -range*(1+Int_t(fTrackType/2)*9), range*(1+Int_t(fTrackType/2)*9), 200, -2, 2);
594   fRecDcaNegPtEtaNeg->GetXaxis()->SetTitle("dca (cm)");
595   fRecDcaNegPtEtaNeg->GetYaxis()->SetTitle("log_{10}(p_{T})");
596     
597
598
599   //  YIELDs ---------------- for TPC sectors
600   for(Int_t sector=0; sector<18;sector++){
601       
602
603     fRecPtTpcSector[sector]   = new TH1F(Form("fRecPtTpcSector%02d",sector), 
604                                          Form("p_{T} distribution: TPC sector %d",
605                                               sector),100, 0., pt);
606     fRecPtTpcSector[sector]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
607
608     fRecEtaTpcSector[sector]   = new TH1F(Form("fRecEtaTpcSector%02d",sector), 
609                                           Form("#eta distribution: TPC sector %d",
610                                                sector),200, -2., 2.);
611     fRecEtaTpcSector[sector]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
612      
613
614     fSignedDcaTpcSector[sector]   = new TH1F(Form("fSignedDcaTpcSector%02d",sector), 
615                                              Form("dca distribution: TPC sector %d",
616                                                   sector),200, -range*(1+Int_t(fTrackType/2)*9), range*(1+Int_t(fTrackType/2)*9) );
617     fSignedDcaTpcSector[sector]->GetXaxis()->SetTitle("dca");
618
619     fRecQPtTpcSector[sector]   = new TH1F(Form("fRecQPtTpcSector%02d",sector), 
620                                           Form("Q/ p_{T} distribution: TPC sector %d",
621                                                sector),100, -1., 1.);
622     fRecQPtTpcSector[sector]->GetXaxis()->SetTitle("Q/p_{T} (GeV/c)");
623
624     fRecEtaPtTpcSector[sector]   = new TH1F(Form("fRecEtaPtTpcSector%02d",sector), 
625                                             Form("#eta/ p_{T} distribution: TPC sector %d",
626                                                  sector),100, -1., 1.);
627     fRecEtaPtTpcSector[sector]->GetXaxis()->SetTitle("#eta/p_{T} (GeV/c)");
628  
629   }
630   // YIELDS ITS ladder
631   for(Int_t i=0;i<7;i++){
632     fRecPtPosLadder[i]   = new TH1F(Form("fRecPtPosLadder%d", i), 
633                                     " p_{T} distribution",
634                                     100, 0., pt);
635     fRecPtPosLadder[i]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
636     fRecPtNegLadder[i]   = new TH1F(Form("fRecPtNegLadder%d",i), 
637                                     " p_{T} distribution ",
638                                     100, 0., pt);
639     fRecPtNegLadder[i]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
640
641
642     fRecPhiPosLadder[i]   = new TH1F(Form("fRecPhiPosLadder%d",i), 
643                                      "#phi distribution: all pos eta",
644                                      361, 0., 360);
645     fRecPhiPosLadder[i]->GetXaxis()->SetTitle("#phi (deg)");
646       
647     fRecPhiNegLadder[i]   = new TH1F(Form("fRecPhiNegLadder%d", i),
648                                      "#phi distribution: all neg eta",
649                                      361, 0, 360);
650     fRecPhiNegLadder[i]->GetXaxis()->SetTitle("#phi (deg)");
651
652
653
654     fRecEtaPosLadder[i]   = new TH1F(Form("fRecEtaPosLadder%d",i), 
655                                      "#eta distribution",
656                                      200, -2., 2.);
657     fRecEtaPosLadder[i]->GetXaxis()->SetTitle("#eta)");
658       
659     fRecEtaNegLadder[i]   = new TH1F(Form("fRecEtaNegLadder%d", i),
660                                      "#eta distribution",
661                                      200, -2., 2.);
662     fRecEtaNegLadder[i]->GetXaxis()->SetTitle("#eta");
663   }
664
665   Double_t vzmax = 15;
666
667   fRecPtPosVz = new TH2F("fRecPtPosVz", 
668                          "p_{T} distribution vs Vz()",
669                          100, -1., 2., 200,-vzmax,vzmax);
670   fRecPtPosVz->GetXaxis()->SetTitle("log_{10}(p_{T})");
671     
672   fRecPtNegVz = new TH2F("fRecPtNegVz",
673                          "p_{T} distribution vs Vz()",
674                          100, -1., 2.,200,-vzmax,vzmax);
675   fRecPtNegVz->GetXaxis()->SetTitle("Log_{10}(p_{T})");
676     
677    
678   fRecEtaPosVz= new TH2F("fRecEtaPosVz", 
679                          "#eta distribution vs Vz()",
680                          100, -2., 2., 200,-vzmax,vzmax);
681   fRecEtaPosVz->GetXaxis()->SetTitle("#eta");
682   fRecEtaNegVz = new TH2F("fRecEtaNegVz",
683                           "#eta distribution vs Vz()",
684                           100, -2., 2.,200,-vzmax,vzmax);
685   fRecEtaNegVz->GetXaxis()->SetTitle("#eta");
686
687   fRecPhiPosVz= new TH2F("fRecPhiPosVz", 
688                          "#eta distribution vs Vz()",
689                          361, 0., 360., 200,-vzmax,vzmax);
690   fRecPhiPosVz->GetXaxis()->SetTitle("#phi (deg)");
691   fRecPhiNegVz = new TH2F("fRecPhiNegVz",
692                           "dca vs Vz()",
693                           361, 0., 360.,200,-vzmax,vzmax);
694   fRecPhiNegVz->GetXaxis()->SetTitle("#phi (deg)");
695
696   fSignedDcaPosVz= new TH2F("fSignedDcaPosVz", 
697                             "#eta distribution vs Vz()",
698                             200, -range*(1+Int_t(fTrackType/2)*9), range*(1+Int_t(fTrackType/2)*9), 200,-vzmax,vzmax);
699   fSignedDcaPosVz->GetXaxis()->SetTitle("dca (cm)");
700   fSignedDcaNegVz = new TH2F("fSignedDcaNegVz",
701                              "dca vs Vz()",
702                              200, -range*(1+Int_t(fTrackType/2)*9), range*(1+Int_t(fTrackType/2)*9),200,-vzmax,vzmax);
703   fSignedDcaNegVz->GetXaxis()->SetTitle("dca (cm)");
704
705   fRecQPtPosEtaVz= new TH2F("fRecQPtPosEtaVz",
706                             " Q/p_{T} distribution vs Vz()",
707                             100, -1., 1., 200,-vzmax,vzmax);
708   fRecQPtPosEtaVz->GetXaxis()->SetTitle("Q/p_{T}");
709   fRecQPtNegEtaVz = new TH2F("fRecQPtNegEtaVz",
710                              " Q/p_{T} distribution vs Vz()",
711                              100, -1., 1.,200,-vzmax,vzmax);
712   fRecQPtNegEtaVz->GetXaxis()->SetTitle("Q/p_{T}");
713
714  
715   fRecEtaPtPosVz= new TH2F("fRecEtaPtPosVz",
716                            " #eta/p_{T} distribution vs Vz()",
717                            100, -1., 1., 200,-vzmax,vzmax);
718   fRecEtaPtPosVz->GetXaxis()->SetTitle("#eta/p_{T");
719   fRecEtaPtNegVz = new TH2F("fRecEtaPtNegVz",
720                             " #eta/p_{T} distribution vs Vz()",
721                             100, -1., 1.,200,-vzmax,vzmax);
722   fRecEtaPtNegVz->GetXaxis()->SetTitle("#eta/p_{T}");
723
724   //new
725   fDeltaPhiAll = new TH1F("fDeltaPhiAll",
726                           " #Delta #phi",200,-360,360);
727   fDeltaPhiAll->GetXaxis()->SetTitle("#Delta #phi");
728
729
730   fDeltaPhiLeading = new TH2F("fDeltaPhiLeading",
731                               " #Delta #phi",361,-360,360, 361,0, 360);
732   fDeltaPhiLeading->GetXaxis()->SetTitle("#Delta #phi (deg.)");
733   fDeltaPhiLeading->GetYaxis()->SetTitle("#phi_{leading particle} (deg.)");
734
735   fDiffDcaD    = new TH1F("fDiffDcaD",   
736                           "dca-d",
737                           200, -1., 1.);
738
739   
740   fRecPtPosEtaPos = new TH1F("fRecPtPosEtaPos",
741                              "p_{T} distribution",100,0,pt);
742   fRecPtPosEtaPos->GetXaxis()->SetTitle("p_{T} (GeV/c)");
743
744   fRecPtNegEtaPos = new TH1F("fRecPtNegEtaPos",
745                              "p_{T} distribution",100,0,pt);
746   fRecPtNegEtaPos->GetXaxis()->SetTitle("p_{T} (GeV/c)");
747
748   fRecPtPosEtaNeg = new TH1F("fRecPtPosEtaNeg",
749                              "p_{T} distribution",100,0,pt);
750   fRecPtPosEtaNeg->GetXaxis()->SetTitle("p_{T} (GeV/c)");
751
752   fRecPtNegEtaNeg = new TH1F("fRecPtNegEtaNeg",
753                              "p_{T} distribution",100,0,pt);
754   fRecPtNegEtaNeg->GetXaxis()->SetTitle("p_{T} (GeV/c)");
755
756
757
758   fRec1PtPosEtaPos = new TH1F("fRec1PtPosEtaPos",
759                              "1/p_{T} distribution",100,0,0.5);
760   fRec1PtPosEtaPos->GetXaxis()->SetTitle("p_{T} (c/GeV)");
761
762   fRec1PtNegEtaPos = new TH1F("fRec1PtNegEtaPos",
763                              "1/p_{T} distribution",100,0,0.5);
764   fRec1PtNegEtaPos->GetXaxis()->SetTitle("p_{T} (c/GeV)");
765
766   fRec1PtPosEtaNeg = new TH1F("fRec1PtPosEtaNeg",
767                              "1/p_{T} distribution",100,0,0.5);
768   fRec1PtPosEtaNeg->GetXaxis()->SetTitle("p_{T} (c/GeV)");
769
770   fRec1PtNegEtaNeg = new TH1F("fRec1PtNegEtaNeg",
771                              "1/p_{T} distribution",100,0,0.5);
772   fRec1PtNegEtaNeg->GetXaxis()->SetTitle("1/p_{T} (c/GeV)");
773
774
775  
776   fRecPhiPosEtaPos = new TH1F("fRecPhiPosEtaPos",
777                              "#phi",180,0,2*TMath::Pi());
778   fRecPhiPosEtaPos->GetXaxis()->SetTitle("#phi (rad.)");
779
780   fRecPhiNegEtaPos = new TH1F("fRecPhiNegEtaPos",
781                              "#phi",180,0,2*TMath::Pi());
782   fRecPhiNegEtaPos->GetXaxis()->SetTitle("#phi (rad.)");
783
784   fRecPhiPosEtaNeg = new TH1F("fRecPhiPosEtaNeg",
785                              "#phi",180,0,2*TMath::Pi());
786   fRecPhiPosEtaNeg->GetXaxis()->SetTitle("#phi (rad.)");
787
788   fRecPhiNegEtaNeg = new TH1F("fRecPhiNegEtaNeg",
789                              "#phi",180,0,2*TMath::Pi());
790   fRecPhiNegEtaNeg->GetXaxis()->SetTitle("#phi (rad.)");
791
792
793
794 //   fRecDcaPhiPtPosEtaPos = new TH3F("fRecDcaPhiPtPosEtaPos",
795 //                                 "#phi- p_{T} - DCA",
796 //                                 180,0,2*TMath::Pi(),
797 //                                 100,0,pt,
798 //                                 100, -range*(1+Int_t(fTrackType/2)*9), range*(1+Int_t(fTrackType/2)*9));
799 //   fRecDcaPhiPtPosEtaPos->GetXaxis()->SetTitle("#phi (rad.)");
800 //   fRecDcaPhiPtPosEtaPos->GetYaxis()->SetTitle("p_{T} (GeV/c)");
801 //   fRecDcaPhiPtPosEtaPos->GetZaxis()->SetTitle("dca (cm)");
802
803 //   fRecDcaPhiPtPosEtaNeg = new TH3F("fRecDcaPhiPtPosEtaNeg",
804 //                                 "#phi- p_{T} - DCA",
805 //                                 180,0,2*TMath::Pi(),
806 //                                 100,0,pt,
807 //                                 100, -range*(1+Int_t(fTrackType/2)*9), range*(1+Int_t(fTrackType/2)*9));
808 //   fRecDcaPhiPtPosEtaNeg->GetZaxis()->SetTitle("dca (cm)");
809 //   fRecDcaPhiPtPosEtaNeg->GetXaxis()->SetTitle("#phi (rad.)");
810 //   fRecDcaPhiPtPosEtaNeg->GetYaxis()->SetTitle("p_{T} (GeV/c)");
811
812 //   fRecDcaPhiPtNegEtaPos = new TH3F("fRecDcaPhiPtNegEtaPos",
813 //                                 "#phi- p_{T} - DCA",
814 //                                 180,0,2*TMath::Pi(),
815 //                                 100,0,pt,
816 //                                 100, -range*(1+Int_t(fTrackType/2)*9), range*(1+Int_t(fTrackType/2)*9));
817 //   fRecDcaPhiPtNegEtaPos->GetZaxis()->SetTitle("dca (cm)");
818 //   fRecDcaPhiPtNegEtaPos->GetXaxis()->SetTitle("#phi (rad.)");
819 //   fRecDcaPhiPtNegEtaPos->GetYaxis()->SetTitle("p_{T} (GeV/c)");
820
821 //   fRecDcaPhiPtNegEtaNeg = new TH3F("fRecDcaPhiPtNegEtaNeg",
822 //                                 "#phi- p_{T} - DCA",
823 //                                 180,0,2*TMath::Pi(),
824 //                                 100,0,pt,
825 //                                 100, -range*(1+Int_t(fTrackType/2)*9), range*(1+Int_t(fTrackType/2)*9));
826 //   fRecDcaPhiPtNegEtaNeg->GetZaxis()->SetTitle("dca (cm)");
827 //   fRecDcaPhiPtNegEtaNeg->GetYaxis()->SetTitle("#phi (rad.)");
828 //   fRecDcaPhiPtNegEtaNeg->GetXaxis()->SetTitle("p_{T} (GeV/c)");
829
830
831
832
833   fHists->SetOwner();
834
835   fHists->Add(fHistRECpt);
836   fHists->Add(fEta);
837   fHists->Add(fEtavPt);
838   fHists->Add(fCompareTPCparam);
839   fHists->Add(fEtaPhi);
840   fHists->Add(fThetaRec);
841   fHists->Add(fPhiRec);
842   fHists->Add(fNumber);
843   fHists->Add(fVx);
844   fHists->Add(fVy);
845   fHists->Add(fVz);
846   fHists->Add(fVertexX);
847   fHists->Add(fVertexY);
848   fHists->Add(fVertexZ);
849
850   fHists->Add(fEtaPt);
851   fHists->Add(fQPt);
852   fHists->Add(fDca);
853
854   fHists->Add(fDeltaPhiAll);
855   fHists->Add(fDeltaPhiLeading);
856   fHists->Add(fDiffDcaD);
857
858   fHists->Add(fqRec);
859   fHists->Add(fsigmaPt);
860
861   fHists->Add(fRecPtPos);
862   fHists->Add(fRecPtNeg);
863   fHists->Add(fRecPhiPos);
864   fHists->Add(fRecPhiNeg);
865   fHists->Add(fRecEtaPos);
866   fHists->Add(fRecEtaNeg);
867   fHists->Add(fRecEtaPtPos);
868   fHists->Add(fRecEtaPtNeg);
869   fHists->Add(fRecDcaPos);
870   fHists->Add(fRecDcaNeg);
871   fHists->Add(fRecDcaNegInv);
872   fHists->Add(fRecDPos);
873   fHists->Add(fRecDNeg);
874
875
876   fHists->Add(fRecQPtPosEta);
877   fHists->Add(fRecQPtNegEta);
878   fHists->Add(fRecPtPosEta);
879   fHists->Add(fRecPtNegEta);
880   fHists->Add(fRecPhiPosEta);
881   fHists->Add(fRecPhiNegEta);
882   fHists->Add(fRecDcaPosEta);
883   fHists->Add(fRecDcaNegEta);
884   fHists->Add(fRecDPosEta);
885   fHists->Add(fRecDNegEta);
886
887
888   for(Int_t i=0;i<18;i++){
889     fHists->Add(fRecPtTpcSector[i]);
890     fHists->Add(fRecEtaTpcSector[i]);
891     fHists->Add(fSignedDcaTpcSector[i]);
892     fHists->Add(fRecQPtTpcSector[i]);
893     fHists->Add(fRecEtaPtTpcSector[i]);
894   }
895
896   for(Int_t i=0;i<7;i++){
897     fHists->Add(fRecPtPosLadder[i]);
898     fHists->Add(fRecPtNegLadder[i]);
899     fHists->Add(fRecPhiPosLadder[i]);
900     fHists->Add(fRecPhiNegLadder[i]);
901     fHists->Add(fRecEtaPosLadder[i]);
902     fHists->Add(fRecEtaNegLadder[i]);
903   }
904
905   fHists->Add(fRecPtPosVz);
906   fHists->Add(fRecPtNegVz);
907   fHists->Add(fRecEtaPosVz);
908   fHists->Add(fRecEtaNegVz);
909   fHists->Add(fRecPhiPosVz);
910   fHists->Add(fRecPhiNegVz);
911   fHists->Add(fSignedDcaPosVz);
912   fHists->Add(fSignedDcaNegVz);
913   fHists->Add(fRecQPtPosEtaVz);
914   fHists->Add(fRecQPtNegEtaVz);
915   fHists->Add(fRecEtaPtPosVz);
916   fHists->Add(fRecEtaPtNegVz);
917
918
919   for(Int_t i=0;i<7;i++){
920     fHists->Add(fSignDcaPos[i]);
921     fHists->Add(fSignDcaNeg[i]);
922     fHists->Add(fSignDcaNegInv[i]);
923  
924     fHists->Add(fPtSigmaPos[i]);
925     fHists->Add(fPtSigmaNeg[i]);
926     fHists->Add(fqPtRec[i]);
927   
928     fHists->Add(fDcaSigmaPos[i]);
929     fHists->Add(fDcaSigmaNeg[i]);
930  
931
932   } 
933   
934   fHists->Add(fRecDcaPosPhi);
935   fHists->Add(fRecDcaNegPhi);   
936   fHists->Add(fRecPtPosPhi);
937   fHists->Add(fRecPtNegPhi);   
938   fHists->Add(fRecEtaPosPhi);
939   fHists->Add(fRecEtaNegPhi);  
940   fHists->Add(fRecQPtPhi);   
941   fHists->Add(fRecEtaPtPosPhi);
942   fHists->Add(fRecEtaPtNegPhi);   
943
944   fHists->Add(fRecPtPosEtaPos);   
945   fHists->Add(fRecPtNegEtaPos);   
946   fHists->Add(fRecPtPosEtaNeg);   
947   fHists->Add(fRecPtNegEtaNeg); 
948
949   fHists->Add(fRec1PtPosEtaPos);   
950   fHists->Add(fRec1PtNegEtaPos);   
951   fHists->Add(fRec1PtPosEtaNeg);   
952   fHists->Add(fRec1PtNegEtaNeg);   
953  
954
955   fHists->Add(fRecPhiPosEtaPos);   
956   fHists->Add(fRecPhiNegEtaPos);   
957   fHists->Add(fRecPhiPosEtaNeg);   
958   fHists->Add(fRecPhiNegEtaNeg);   
959
960   fHists->Add(fRecDcaPosPhiEtaPos);
961   fHists->Add(fRecDcaNegPhiEtaPos);   
962   fHists->Add(fRecPtPosPhiEtaPos);
963   fHists->Add(fRecPtNegPhiEtaPos);  
964   fHists->Add(fRecDcaPosPhiEtaNeg);
965   fHists->Add(fRecDcaNegPhiEtaNeg);   
966   fHists->Add(fRecPtPosPhiEtaNeg);
967   fHists->Add(fRecPtNegPhiEtaNeg); 
968
969   fHists->Add(fRecDcaPosPtEtaPos);
970   fHists->Add(fRecDcaNegPtEtaPos);
971   fHists->Add(fRecDcaPosPtEtaNeg);
972   fHists->Add(fRecDcaNegPtEtaNeg);
973
974   //  fHists->Add(fRecDcaPhiPtPosEtaPos); 
975   //  fHists->Add(fRecDcaPhiPtPosEtaNeg); 
976   //  fHists->Add(fRecDcaPhiPtNegEtaPos); 
977   //  fHists->Add(fRecDcaPhiPtNegEtaNeg); 
978
979
980
981
982     
983 //   for (Int_t i=0; i<fHists->GetEntries(); ++i) {
984 //     TH1 *h1 = dynamic_cast<TH1*>(fHists->At(i));
985 //     if (h1){
986 //     //  Printf("%s ",h1->GetName());
987 //       h1->Sumw2();
988 //     }
989 //   }
990   // BKC
991
992   TH1::AddDirectory(oldStatus);
993 }
994
995 //__________________________________________________________
996
997 void AliAnalysisTaskQASym::UserExec(Option_t *) 
998 {
999   AliVEvent *event = InputEvent();
1000   if (!event) {
1001     Printf("ERROR: Could not retrieve event");
1002     return;
1003   }
1004
1005
1006   if(Entry()==0){
1007     AliESDEvent* esd = dynamic_cast<AliESDEvent*>(event);
1008     if(esd){
1009       Printf("We are reading from ESD");
1010     }
1011    
1012   }
1013
1014
1015
1016   if(fDebug>1)Printf("There are %d tracks in this event", event->GetNumberOfTracks());
1017
1018   
1019   Int_t   leadingTrack  =   0;
1020   Float_t leadingEnergy = -20.;
1021   Float_t leadingPhi    =   0;//TMath::Pi();
1022
1023
1024   if(event->GetNumberOfTracks()!=0) fNumber->Fill(event->GetNumberOfTracks());
1025
1026   const AliVVertex* vertex = event->GetPrimaryVertex();
1027   if(vertex->GetNContributors()==0) return;
1028   Float_t vx = vertex->GetX();
1029   Float_t vy = vertex->GetY();
1030   Float_t vz = vertex->GetZ();
1031   
1032   fVertexX->Fill(vx);
1033   fVertexY->Fill(vy);
1034   fVertexZ->Fill(vz);
1035
1036   if (TMath::Abs(vz) > 10.) return;
1037
1038   AliESDtrack *tpcP = 0x0;
1039
1040   for (Int_t iTrack = 0; iTrack < event->GetNumberOfTracks(); iTrack++) {
1041     
1042     //prevent mem leak for TPConly track
1043     if(fTrackType==2&&tpcP){
1044       delete tpcP;
1045       tpcP = 0;
1046     }
1047
1048     AliVParticle *track = event->GetTrack(iTrack);
1049     AliESDtrack *esdtrack =  dynamic_cast<AliESDtrack*>(track);
1050     esdtrack->PropagateToDCA(event->GetPrimaryVertex(),
1051                              event->GetMagneticField(), 10000.);
1052
1053     if (!track) {
1054       Printf("ERROR: Could not receive track %d", iTrack);
1055       continue;
1056     }
1057     //__________
1058     // run Task for global tracks or ITS tracks or TPC tracks
1059     const AliExternalTrackParam *tpcPin = 0x0;
1060     Double_t phiIn=0;
1061
1062     if(fTrackType==0){
1063       //Fill all histograms with global tracks
1064       tpcP = esdtrack;
1065       phiIn = tpcP->Phi();
1066       if (!tpcP) continue;
1067       if (!fCuts->AcceptTrack(tpcP)) continue;
1068     }
1069     else if(fTrackType==1){
1070       //Fill all histograms with ITS tracks
1071       tpcP = esdtrack;
1072       phiIn = tpcP->Phi();
1073       if (!tpcP) continue;
1074       if (!fCuts->AcceptTrack(tpcP)) continue;
1075     }
1076     else if(fTrackType==2){     
1077       //Fill all histograms with TPC track information
1078       tpcPin = esdtrack->GetInnerParam();
1079       if (!tpcPin) continue;
1080       phiIn=tpcPin->Phi();
1081
1082       tpcP = AliESDtrackCuts::GetTPCOnlyTrack(dynamic_cast<AliESDEvent*>(event),esdtrack->GetID());
1083       if (!tpcP) continue;
1084       if (!fCuts->AcceptTrack(tpcP)) continue;
1085       if(tpcP->GetNcls(1)>160)continue;//jacek's track cut
1086       if(tpcP->GetConstrainedChi2TPC()<0)continue; // jacek's track cut
1087     }
1088     else{
1089       Printf("ERROR: wrong track type \n");
1090       continue;
1091     }
1092     //___________
1093     //
1094   
1095  
1096     if(tpcP->E()>leadingEnergy){
1097       leadingTrack=iTrack;
1098       leadingEnergy=tpcP->E();
1099       leadingPhi=phiIn;
1100     }
1101    
1102     
1103     fqRec->Fill(tpcP->Charge());
1104   
1105
1106     Double_t sigmapt = tpcP->GetSigma1Pt2();
1107     sigmapt= sqrt(sigmapt);
1108     sigmapt= sigmapt *(tpcP->Pt()*tpcP->Pt()); 
1109
1110     if(sigmapt == 0.)continue;
1111     fsigmaPt->Fill(TMath::Log10(sigmapt));
1112  
1113
1114     // hits in ITS layer
1115     Int_t cas=-1;
1116     if(tpcP->HasPointOnITSLayer(0)) 
1117       cas=0;
1118     else if(!tpcP->HasPointOnITSLayer(0)
1119             &&  tpcP->HasPointOnITSLayer(1)) 
1120       cas=1;
1121     else if(!tpcP->HasPointOnITSLayer(0)
1122             && !tpcP->HasPointOnITSLayer(1) 
1123             &&  tpcP->HasPointOnITSLayer(2)) 
1124       cas=2;
1125     else if(!tpcP->HasPointOnITSLayer(0)
1126             && !tpcP->HasPointOnITSLayer(1) 
1127             && !tpcP->HasPointOnITSLayer(2)
1128             &&  tpcP->HasPointOnITSLayer(3)) 
1129       cas=3;
1130     else if(!tpcP->HasPointOnITSLayer(0)
1131             && !tpcP->HasPointOnITSLayer(1) 
1132             && !tpcP->HasPointOnITSLayer(2)
1133             && !tpcP->HasPointOnITSLayer(3)
1134             &&  tpcP->HasPointOnITSLayer(4)) 
1135       cas=4;
1136     else if(   !tpcP->HasPointOnITSLayer(0)
1137                && !tpcP->HasPointOnITSLayer(1)
1138                && !tpcP->HasPointOnITSLayer(2)
1139                && !tpcP->HasPointOnITSLayer(3)
1140                && !tpcP->HasPointOnITSLayer(4) 
1141                &&  tpcP->HasPointOnITSLayer(5)) 
1142       cas=5;
1143     else 
1144       cas=6;
1145   
1146    
1147    
1148     //------------------- 
1149
1150     xvertexcor = tpcP->Xv() - vertex->GetX(); // coordinate corrected for vertex position
1151     yvertexcor = tpcP->Yv() - vertex->GetY(); // "
1152     sdca = (tpcP->Py()*xvertexcor - tpcP->Px()*yvertexcor)/tpcP->Pt();
1153
1154
1155     fqPtRec[cas]->Fill(tpcP->Charge()/tpcP->Pt());
1156     
1157     
1158
1159     fHistRECpt->Fill(tpcP->Pt());
1160     fEta->Fill(tpcP->Eta());
1161     fEtavPt->Fill(tpcP->Eta(), tpcP->Pt());
1162     fEtaPhi->Fill(tpcP->Eta(), phiIn);
1163     fThetaRec->Fill(tpcP->Theta());
1164     fPhiRec->Fill(phiIn);
1165     fVx->Fill(tpcP->Xv());
1166     fVy->Fill(tpcP->Yv());
1167     fVz->Fill(tpcP->Zv());
1168   
1169
1170     fEtaPt->Fill(tpcP->Eta()/tpcP->Pt());
1171     fQPt->Fill(tpcP->Charge()/tpcP->Pt());
1172     fDca->Fill(sdca);
1173     fRecQPtPhi->Fill(tpcP->Charge()/tpcP->Pt(), phiIn);
1174
1175
1176     tpcP->GetImpactParameters(xy,z);
1177     fDiffDcaD->Fill(sdca+xy);
1178
1179     if(fTrackType==2) fCompareTPCparam->Fill(z,tpcPin->GetTgl());
1180     
1181     //for positive particles
1182
1183     if(tpcP->Charge()>0){
1184       fRecPtPos->Fill(tpcP->Pt());
1185       fRecPtPosLadder[cas]->Fill(tpcP->Pt());
1186       fRecPtPosVz->Fill(TMath::Log10(tpcP->Pt()),tpcP->Zv());
1187       fRecPhiPos->Fill(TMath::RadToDeg()*phiIn);
1188     
1189      
1190       fRecPhiPosLadder[cas]->Fill(TMath::RadToDeg()*phiIn);
1191       fRecPhiPosVz->Fill(TMath::RadToDeg()*phiIn,tpcP->Zv());
1192       fSignedDcaPosVz->Fill(sdca,tpcP->Zv());
1193
1194       fRecEtaPos->Fill(tpcP->Eta());
1195       fRecEtaPosLadder[cas]->Fill(tpcP->Eta());
1196       fRecEtaPtPos->Fill(tpcP->Eta()/tpcP->Pt());
1197       fRecEtaPosVz->Fill(tpcP->Eta(),tpcP->Zv());
1198       fRecEtaPtPosVz->Fill(tpcP->Eta()/tpcP->Pt(),tpcP->Zv());
1199      
1200       fRecDcaPos->Fill(sdca);
1201       fRecDcaPosPhi->Fill(sdca, phiIn);
1202       fRecPtPosPhi->Fill(TMath::Log10(tpcP->Pt()), phiIn);
1203       fRecEtaPtPosPhi->Fill(tpcP->Eta()/tpcP->Pt(), phiIn);
1204       fRecEtaPosPhi->Fill(tpcP->Eta(), phiIn);
1205       fRecDPos->Fill(xy);
1206       fSignDcaPos[cas]->Fill(sdca);
1207     
1208      
1209       fDcaSigmaPos[cas]->Fill(sdca, TMath::Log10(sigmapt));
1210     
1211       fPtSigmaPos[cas]->Fill(TMath::Log10(sigmapt));
1212       //pos eta
1213       if(tpcP->Eta()>0){
1214         fRecPtPosEtaPos->Fill(tpcP->Pt());
1215         fRec1PtPosEtaPos->Fill(1/tpcP->Pt());
1216         fRecPhiPosEtaPos->Fill(phiIn);
1217         fRecDcaPosPhiEtaPos->Fill(sdca, phiIn);
1218         fRecDcaPosPtEtaPos->Fill(sdca, TMath::Log10(tpcP->Pt()));
1219         fRecPtPosPhiEtaPos->Fill(TMath::Log10(tpcP->Pt()), phiIn);
1220         //fRecDcaPhiPtPosEtaPos->Fill(phiIn, tpcP->Pt(), sdca);
1221       }
1222       //neg eta
1223       else{
1224         fRecPtPosEtaNeg->Fill(tpcP->Pt());
1225         fRec1PtPosEtaNeg->Fill(1/tpcP->Pt());
1226         fRecPhiPosEtaNeg->Fill(phiIn);
1227         fRecDcaPosPhiEtaNeg->Fill(sdca, phiIn);
1228         fRecDcaPosPtEtaNeg->Fill(sdca, TMath::Log10(tpcP->Pt()));
1229         fRecPtPosPhiEtaNeg->Fill(TMath::Log10(tpcP->Pt()), phiIn);
1230         //fRecDcaPhiPtPosEtaNeg->Fill(phiIn, tpcP->Pt(), sdca);
1231       }
1232       
1233     }
1234     //and negative particles
1235     else {
1236       fRecPtNeg->Fill(tpcP->Pt());
1237       fRecPtNegLadder[cas]->Fill(tpcP->Pt());
1238       fRecPtNegVz->Fill(TMath::Log10(tpcP->Pt()),tpcP->Zv());
1239            
1240       fRecPhiNeg->Fill(TMath::RadToDeg()*phiIn);
1241       fRecPhiNegLadder[cas]->Fill(TMath::RadToDeg()*phiIn);
1242       fRecPhiNegVz->Fill(TMath::RadToDeg()*phiIn,tpcP->Zv());
1243       fSignedDcaNegVz->Fill(sdca,tpcP->Zv());
1244       fRecEtaPtNegVz->Fill(tpcP->Eta()/tpcP->Pt(),tpcP->Zv());
1245
1246       fRecEtaNeg->Fill(tpcP->Eta());
1247       fRecEtaNegLadder[cas]->Fill(tpcP->Eta());
1248       fRecEtaPtNeg->Fill(tpcP->Eta()/tpcP->Pt());
1249       fRecEtaNegVz->Fill(tpcP->Eta(),tpcP->Zv());
1250      
1251       fRecDcaNeg->Fill(sdca);
1252       fRecDcaNegInv->Fill(-sdca);
1253       fRecDcaNegPhi->Fill(sdca, phiIn);
1254       fRecPtNegPhi->Fill(TMath::Log10(tpcP->Pt()), phiIn);
1255       fRecEtaNegPhi->Fill(tpcP->Eta(), phiIn);
1256       fRecEtaPtNegPhi->Fill(tpcP->Eta()/tpcP->Pt(), phiIn);
1257       fRecDNeg->Fill(xy);
1258       fSignDcaNeg[cas]->Fill(sdca);
1259       fSignDcaNegInv[cas]->Fill(-sdca);
1260      
1261      
1262       fDcaSigmaNeg[cas]->Fill(sdca,TMath::Log10(sigmapt));
1263    
1264       fPtSigmaNeg[cas]->Fill(TMath::Log10(sigmapt));
1265       
1266       //pos eta
1267       if(tpcP->Eta()>0){
1268         fRecPtNegEtaPos->Fill(tpcP->Pt());
1269         fRec1PtNegEtaPos->Fill(1/tpcP->Pt());
1270         fRecPhiNegEtaPos->Fill(phiIn);
1271         fRecDcaNegPhiEtaPos->Fill(sdca, phiIn);
1272         fRecDcaNegPtEtaPos->Fill(sdca, TMath::Log10(tpcP->Pt()));
1273         fRecPtNegPhiEtaPos->Fill(TMath::Log10(tpcP->Pt()), phiIn);
1274         //fRecDcaPhiPtNegEtaPos->Fill(phiIn, tpcP->Pt(), sdca);
1275       }
1276       //neg eta
1277       else{
1278         fRecPtNegEtaNeg->Fill(tpcP->Pt());
1279         fRec1PtNegEtaNeg->Fill(1/tpcP->Pt());
1280         fRecPhiNegEtaNeg->Fill(phiIn);
1281         fRecDcaNegPhiEtaNeg->Fill(sdca, phiIn);
1282         fRecDcaNegPtEtaNeg->Fill(sdca, TMath::Log10(tpcP->Pt()));
1283         fRecPtNegPhiEtaNeg->Fill(TMath::Log10(tpcP->Pt()), phiIn);
1284         //fRecDcaPhiPtNegEtaNeg->Fill(phiIn, tpcP->Pt(), sdca);
1285       }
1286
1287     }
1288     
1289
1290
1291     //all particles with positive eta
1292     if(tpcP->Eta()>0){
1293       fRecQPtPosEta->Fill(tpcP->Charge()/tpcP->Pt());
1294       fRecPtPosEta->Fill(tpcP->Pt());
1295       fRecPhiPosEta->Fill(TMath::RadToDeg()*phiIn);
1296       fRecQPtPosEtaVz->Fill(tpcP->Charge()/tpcP->Pt(),tpcP->Zv());
1297       fRecDcaPosEta->Fill(sdca);
1298       fRecDPosEta->Fill(xy);
1299     }
1300     //all particles with negative eta (and eta==0)
1301     else{
1302       fRecQPtNegEta->Fill(tpcP->Charge()/tpcP->Pt());
1303       fRecPtNegEta->Fill(tpcP->Pt());
1304       fRecPhiNegEta->Fill(TMath::RadToDeg()*phiIn);
1305       fRecQPtNegEtaVz->Fill(tpcP->Charge()/tpcP->Pt(),tpcP->Zv());
1306       fRecDcaNegEta->Fill(sdca);
1307       fRecDNegEta->Fill(xy);
1308
1309     }
1310
1311
1312     fRecPtTpcSector[Int_t(phiIn*
1313                           TMath::RadToDeg()/20)]->Fill(tpcP->Pt());
1314     fRecEtaTpcSector[Int_t(phiIn*
1315                            TMath::RadToDeg()/20)]->Fill(tpcP->Eta());
1316     fSignedDcaTpcSector[Int_t(phiIn*
1317                               TMath::RadToDeg()/20)]->Fill(sdca); 
1318     fRecQPtTpcSector[Int_t(phiIn*
1319                            TMath::RadToDeg()/20)]->Fill(tpcP->Charge()/tpcP->Pt());
1320     fRecEtaPtTpcSector[Int_t(phiIn*
1321                              TMath::RadToDeg()/20)]->Fill(tpcP->Eta()/tpcP->Pt());
1322      
1323
1324
1325 //     // another track loop
1326 //     for (Int_t iTrack2 = 0; iTrack2 < event->GetNumberOfTracks(); iTrack2++) {
1327       
1328 //       if(LeadingTrack==iTrack2) continue;
1329
1330 //       AliVParticle *track2 = event->GetTrack(iTrack2);
1331 //       AliESDtrack* esdtrack2 =  dynamic_cast<AliESDtrack*>(track2);
1332 //       if (!track2) {
1333 //      Printf("ERROR: Could not receive track %d", iTrack);
1334 //      continue;
1335 //       }
1336 //       if (!fCuts->AcceptTrack(esdtrack2)) continue;
1337 //       //propagate to dca
1338 //       esdtrack2->PropagateToDCA(event->GetPrimaryVertex(),
1339 //                              event->GetMagneticField(), 10000.);
1340  
1341 //       fDeltaPhiLeading->Fill((LeadingPhi-esdtrack2->Phi())*TMath::RadToDeg(),
1342 //                           LeadingPhi*TMath::RadToDeg() );
1343
1344      
1345
1346 //     }//second track loop
1347
1348     // if(fTrackType==2) delete tpcP; // delete in case of TPCOnlyTrack
1349
1350   }//first track loop
1351
1352   //prevent mem leak for TPConly track
1353   if(fTrackType==2&&tpcP){
1354     delete tpcP;
1355     tpcP = 0;
1356   }
1357   
1358
1359   // Post output data.
1360   // PostData(1, fHistPt);
1361   PostData(1, fHists);
1362 }      
1363
1364
1365
1366
1367
1368 //________________________________________________________________________
1369 void AliAnalysisTaskQASym::Terminate(Option_t *) 
1370 {
1371
1372
1373 }  
1374
1375
1376
1377
1378