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