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