]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG1/ITS/AliAnalysisTaskSEImpParRes.cxx
remove include fstream and Riostream
[u/mrichter/AliRoot.git] / PWG1 / ITS / AliAnalysisTaskSEImpParRes.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-2010, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /////////////////////////////////////////////////////////////
17 //
18 // AliAnalysisTaskSE for the study of the impact parameter resolution
19 //
20 // Authors:A.Dainese,    andrea.dainese@pd.infn.it
21 //     and Xianbao Yuan, yuanxb@iopp.ccnu.edu.cn; xianbao.yuan@pd.infn.it
22 /////////////////////////////////////////////////////////
23
24 #include <TList.h>
25 #include <TH1F.h>
26
27 #include "AliAnalysisManager.h"
28 #include "AliMCEventHandler.h"
29 #include "AliMCEvent.h"
30 #include "AliStack.h"
31 #include "AliESDEvent.h"
32 #include "AliESDVertex.h"
33 #include "AliESDtrack.h"   
34 #include "AliVertexerTracks.h"
35 #include "AliAnalysisTaskSEImpParRes.h"
36
37 ClassImp(AliAnalysisTaskSEImpParRes)
38
39 //________________________________________________________________________
40 AliAnalysisTaskSEImpParRes::AliAnalysisTaskSEImpParRes():
41 AliAnalysisTaskSE(),
42 fReadMC(kFALSE),
43 fSelectedPdg(-1),
44 fOutputitspureSARec(0),
45 fOutputitspureSASkip(0), 
46 fOutputallPointRec(0),
47 fOutputallPointSkip(0),
48 fOutputpartPointRec(0),
49 fOutputpartPointSkip(0),
50 fOutputonepointSPDRec(0),
51 fOutputonepointSPDSkip(0),
52 fOutputpostvTracRec(0),
53 fOutputpostvTracSkip(0),
54 fOutputnegtvTracRec(0),
55 fOutputnegtvTracSkip(0),
56 fOutputpullAllpointRec(0),
57 fOutputpullAllpointSkip(0),
58 fOutputOnlyRefitRec(0),
59 fOutputOnlyRefitSkip(0),
60 fOutputPt(0),
61 fNentries(0),
62 fEstimVtx(0)
63 {
64   //
65   // Default constructor
66   //
67 }
68
69 //________________________________________________________________________
70 AliAnalysisTaskSEImpParRes::AliAnalysisTaskSEImpParRes(const char *name):
71 AliAnalysisTaskSE(name),
72 fReadMC(kFALSE),
73 fSelectedPdg(-1),
74 fOutputitspureSARec(0),
75 fOutputitspureSASkip(0), 
76 fOutputallPointRec(0),
77 fOutputallPointSkip(0),
78 fOutputpartPointRec(0),
79 fOutputpartPointSkip(0),
80 fOutputonepointSPDRec(0),
81 fOutputonepointSPDSkip(0),
82 fOutputpostvTracRec(0),
83 fOutputpostvTracSkip(0),
84 fOutputnegtvTracRec(0),
85 fOutputnegtvTracSkip(0),
86 fOutputpullAllpointRec(0),
87 fOutputpullAllpointSkip(0),
88 fOutputOnlyRefitRec(0),
89 fOutputOnlyRefitSkip(0),
90 fOutputPt(0),
91 fNentries(0),
92 fEstimVtx(0)
93 {
94   //
95   // Default constructor
96   //
97
98   DefineOutput(1, TList::Class());  //My private output
99   DefineOutput(2, TList::Class());  //My private output
100   DefineOutput(3, TList::Class());  //My private output
101   DefineOutput(4, TList::Class());  //My private output
102   DefineOutput(5, TList::Class());
103   DefineOutput(6, TList::Class());  //My private output
104   DefineOutput(7, TList::Class());
105   DefineOutput(8, TList::Class());  //My private output
106   DefineOutput(9, TList::Class());  //My private output
107   DefineOutput(10, TList::Class());  //My private output
108   DefineOutput(11, TList::Class());  //My private output
109   DefineOutput(12, TList::Class());
110   DefineOutput(13, TList::Class());  //My private output
111   DefineOutput(14, TList::Class());
112   DefineOutput(15, TList::Class());  //My private output
113   DefineOutput(16, TList::Class());
114   DefineOutput(17, TList::Class());  //My private output
115   DefineOutput(18, TH1F::Class());
116   DefineOutput(19, TH1F::Class());
117 }
118
119 //________________________________________________________________________
120 AliAnalysisTaskSEImpParRes::~AliAnalysisTaskSEImpParRes()
121 {
122   //
123   // default distructor  
124   // 
125   if (fOutputitspureSARec)            { delete fOutputitspureSARec; fOutputitspureSARec=0x0;}
126   if (fOutputitspureSASkip)         { delete fOutputitspureSASkip; fOutputitspureSASkip=0x0;}
127   if (fOutputallPointRec)              { delete fOutputallPointRec; fOutputallPointRec=0x0; }
128   if (fOutputallPointSkip)           { delete fOutputallPointSkip; fOutputallPointSkip=0x0; }
129   if (fOutputpartPointRec)           { delete fOutputpartPointRec; fOutputpartPointRec=0x0; }
130   if (fOutputpartPointSkip)        { delete fOutputpartPointSkip; fOutputpartPointSkip=0x0; }
131   if (fOutputonepointSPDRec)       { delete fOutputonepointSPDRec;fOutputonepointSPDRec=0x0;}
132   if (fOutputonepointSPDSkip)    { delete fOutputonepointSPDSkip;fOutputonepointSPDSkip=0x0;}
133   if (fOutputpostvTracRec)            { delete fOutputpostvTracRec; fOutputpostvTracRec=0x0;}
134   if (fOutputpostvTracSkip)        {  delete fOutputpostvTracSkip; fOutputpostvTracSkip=0x0;}
135   if (fOutputnegtvTracRec)            { delete fOutputnegtvTracRec; fOutputnegtvTracRec=0x0;}
136   if (fOutputnegtvTracSkip)         { delete fOutputnegtvTracSkip; fOutputnegtvTracSkip=0x0;}
137   if (fOutputpullAllpointRec)    {delete fOutputpullAllpointRec; fOutputpullAllpointRec=0x0;}
138   if (fOutputpullAllpointSkip) {delete fOutputpullAllpointSkip; fOutputpullAllpointSkip=0x0;}
139   if (fOutputOnlyRefitRec)             {delete fOutputOnlyRefitRec; fOutputOnlyRefitRec=0x0;}
140   if (fOutputOnlyRefitSkip)          {delete fOutputOnlyRefitSkip; fOutputOnlyRefitSkip=0x0;}
141   if (fOutputPt)                                          { delete fOutputPt; fOutputPt=0x0;}
142   if (fNentries)                                 { delete fNentries;     fNentries    =0x0; }
143   if (fEstimVtx)                                 { delete fEstimVtx;     fEstimVtx    =0x0; }
144
145
146
147 //________________________________________________________________________
148 void AliAnalysisTaskSEImpParRes::UserCreateOutputObjects()
149 {
150   // 
151   // Create the output container
152   //
153   
154   if(fDebug>1) printf("AnalysisTaskSEImpParRes::UserCreateOutputObjects() \n");
155   
156   // Several histograms are more conveniently managed in a TList
157   if (!fOutputitspureSARec) {
158     fOutputitspureSARec = new TList();
159     fOutputitspureSARec->SetOwner();
160     fOutputitspureSARec->SetName("ITSpureSARec");
161   }
162
163   if (!fOutputitspureSASkip) {
164     fOutputitspureSASkip = new TList();
165     fOutputitspureSASkip->SetOwner();
166     fOutputitspureSASkip->SetName("ITSpureSASkip");
167   }
168
169   if (!fOutputallPointRec) {
170     fOutputallPointRec = new TList();
171     fOutputallPointRec->SetOwner();
172     fOutputallPointRec->SetName("allpointRec");
173   }
174
175   if (!fOutputallPointSkip) {
176     fOutputallPointSkip = new TList();
177     fOutputallPointSkip->SetOwner();
178     fOutputallPointSkip->SetName("allpointSkip");
179   }
180
181   if (!fOutputpartPointRec) {
182     fOutputpartPointRec = new TList();
183     fOutputpartPointRec->SetOwner();
184     fOutputpartPointRec->SetName("partpointRec");
185   }
186
187   if (!fOutputpartPointSkip) {
188     fOutputpartPointSkip = new TList();
189     fOutputpartPointSkip->SetOwner();
190     fOutputpartPointSkip->SetName("partpointSkip");
191   }
192
193   if (!fOutputonepointSPDRec) {
194     fOutputonepointSPDRec = new TList();
195     fOutputonepointSPDRec->SetOwner();
196     fOutputonepointSPDRec->SetName("onepointSPDRec");
197   }
198
199   if (!fOutputonepointSPDSkip) {
200     fOutputonepointSPDSkip = new TList();
201     fOutputonepointSPDSkip->SetOwner();
202     fOutputonepointSPDSkip->SetName("onepointSPDSkip");
203   }
204
205   if (!fOutputpostvTracRec) {
206     fOutputpostvTracRec = new TList();
207     fOutputpostvTracRec->SetOwner();
208     fOutputpostvTracRec->SetName("postvtracRec");
209   }
210
211   if (!fOutputpostvTracSkip) {
212     fOutputpostvTracSkip = new TList();
213     fOutputpostvTracSkip->SetOwner();
214     fOutputpostvTracSkip->SetName("postvtracSkip");
215   }
216  
217   if (!fOutputnegtvTracRec) {
218     fOutputnegtvTracRec = new TList();
219     fOutputnegtvTracRec->SetOwner();
220     fOutputnegtvTracRec->SetName("negtvtracRe");
221   }
222
223   if (!fOutputnegtvTracSkip) {
224     fOutputnegtvTracSkip = new TList();
225     fOutputnegtvTracSkip->SetOwner();
226     fOutputnegtvTracSkip->SetName("negtvtracSkip");
227   }
228
229   if (!fOutputpullAllpointSkip) {
230     fOutputpullAllpointSkip = new TList();
231     fOutputpullAllpointSkip->SetOwner();
232     fOutputpullAllpointSkip->SetName("pullAllpointSkip");
233   }
234
235   if (!fOutputpullAllpointRec) {
236     fOutputpullAllpointRec = new TList();
237     fOutputpullAllpointRec->SetOwner();
238     fOutputpullAllpointRec->SetName("pullAllpointRec");
239   }
240
241   if (!fOutputOnlyRefitRec) {
242     fOutputOnlyRefitRec = new TList();
243     fOutputOnlyRefitRec->SetOwner();
244     fOutputOnlyRefitRec->SetName("onlyRefitRec");
245   }
246
247   if (!fOutputOnlyRefitSkip) {
248     fOutputOnlyRefitSkip = new TList();
249     fOutputOnlyRefitSkip->SetOwner();
250     fOutputOnlyRefitSkip->SetName("onlyRefitRec");
251   }
252
253   if (!fOutputPt) {
254     fOutputPt = new TList();
255     fOutputPt->SetOwner();
256     fOutputPt->SetName("Pt");
257   }
258
259   const Int_t nhist=26;
260   const TString d0ITSpureSArphiTitle = "d_0 Distribution_rphi; d_0 [#mum]; Entries";
261   const TString d0ITSpureSAzTitle = "d_0 Distribution_z; d_0 [#mum]; Entries";
262   const TString d0allpointrphiTitle = "d_0 Distribution_rphi; d_0 [#mum]; Entries";
263   const TString d0allpointzTitle  = "d_0 Distribution_z; d_0 [#mum]; Entries";
264   const TString d0partpointrphiTitle = "d_0 Distribution_rphi; d_0 [#mum]; Entries";
265   const TString d0partpointzTitle  = "d_0 Distribution_z; d_0 [#mum]; Entries";
266   const TString d0onepointSPDrphiTitle = "d_0 Distribution_rphi; d_0 [#mum]; Entries";
267   const TString d0onepointSPDzTitle = "d_0 Distribution_rphi; d_0 [#mum]; Entries";
268   const TString d0postvtracrphiTitle = "d_0 Distribution_rphi; d_0 [#mum]; Entries";
269   const TString d0postvtraczTitle  = "d_0 Distribution_z; d_0 [#mum]; Entries";
270   const TString d0negtvtracrphiTitle = "d_0 Distribution_rphi; d_0 [#mum]; Entries";
271   const TString d0negtvtraczTitle  = "d_0 Distribution_z; d_0 [#mum]; Entries";
272   const TString d0pullAllpointrphiTitle = "d_0 Pull Distribution_rphi; d_0 pull; Entries";
273   const TString d0pullAllpointzTitle  = "d_0 Pull Distribution_z; d_0 pull; Entries";
274   const TString d0onlyRefitrphiTitle = "d_0 Distribution_rphi; d_0 [#mum]; Entries";
275   const TString d0onlyRefitzTitle  = "d_0 Distribution_z; d_0 [#mum]; Entries";
276   const TString d0ptTitle = "d_0 Distribution_rphi; d_0 [#mum]; Entries";
277   TString  named0itspureSArphiRec,named0itspureSAzRec,named0allpointrphiRec, named0allpointzRec,named0partpointrphiRec, named0partpointzRec,named0onepointSPDrphiRec, named0onepointSPDzRec,named0postvtracrphiRec, named0postvtraczRec,named0negtvtracrphiRec, named0negtvtraczRec,named0pt,named0pullAllpointrphiRec,named0pullAllpointzRec,named0onlyRefitrphiRec,named0onlyRefitzRec;
278   TH1F *d0ITSpureSArphiRec=0,*d0ITSpureSAzRec=0,*d0AllpointrphiRec=0, *d0AllpointzRec=0,*d0PartpointrphiRec=0, *d0PartpointzRec=0,
279     *d0OnepointSPDrphiRec=0,*d0OnepointSPDzRec=0,*d0PostvtracrphiRec=0, *d0PostvtraczRec=0,*d0NegtvtracrphiRec=0, *d0NegtvtraczRec=0,*d0Pt=0,*d0PullAllpointrphiRec,*d0PullAllpointzRec,*d0OnlyRefitrphiRec,*d0OnlyRefitzRec;
280
281   TString  named0itspureSArphiSkip,named0itspureSAzSkip,named0allpointrphiSkip, named0allpointzSkip,named0partpointrphiSkip, named0partpointzSkip,named0onepointSPDrphiSkip, named0onepointSPDzSkip,named0postvtracrphiSkip, named0postvtraczSkip,named0negtvtracrphiSkip, named0negtvtraczSkip,named0ptSkip,named0pullAllpointrphiSkip,named0pullAllpointzSkip,named0onlyRefitrphiSkip,named0onlyRefitzSkip;
282   TH1F *d0ITSpureSArphiSkip=0,*d0ITSpureSAzSkip=0,*d0AllpointrphiSkip=0, *d0AllpointzSkip=0,*d0PartpointrphiSkip=0, *d0PartpointzSkip=0,*d0OnepointSPDrphiSkip=0,*d0OnepointSPDzSkip=0,*d0PostvtracrphiSkip=0, *d0PostvtraczSkip=0,*d0NegtvtracrphiSkip=0,*d0NegtvtraczSkip=0,*d0PullAllpointrphiSkip,*d0PullAllpointzSkip,*d0OnlyRefitrphiSkip,*d0OnlyRefitzSkip;
283
284
285   for(Int_t i=0; i<nhist; i++) {
286
287     named0itspureSArphiRec = "d0itspureSArphiRec_";
288     named0itspureSArphiRec += (i+1);
289     named0itspureSAzRec = "d0itspureSAzRec_";
290     named0itspureSAzRec += (i+1);
291     d0ITSpureSArphiRec = new TH1F(named0itspureSArphiRec.Data(), d0ITSpureSArphiTitle.Data(), 400, -2000., 2000.);
292     d0ITSpureSArphiRec->Sumw2();
293     d0ITSpureSArphiRec->SetMinimum(0);  
294     fOutputitspureSARec->Add(d0ITSpureSArphiRec);
295     d0ITSpureSAzRec = new TH1F(named0itspureSAzRec.Data(), d0ITSpureSAzTitle.Data(), 400, -2000., 2000.);
296     d0ITSpureSAzRec->Sumw2();
297     d0ITSpureSAzRec->SetMinimum(0);  
298     fOutputitspureSARec->Add(d0ITSpureSAzRec);
299
300     named0itspureSArphiSkip = "d0itspureSArphiSkip_";
301     named0itspureSArphiSkip += (i+1);
302     named0itspureSAzSkip = "d0itspureSAzSkip_";
303     named0itspureSAzSkip += (i+1);
304     d0ITSpureSArphiSkip = new TH1F(named0itspureSArphiSkip.Data(), d0ITSpureSArphiTitle.Data(), 400, -2000., 2000.);
305     d0ITSpureSArphiSkip->Sumw2();
306     d0ITSpureSArphiSkip->SetMinimum(0);  
307     fOutputitspureSASkip->Add(d0ITSpureSArphiSkip);
308     d0ITSpureSAzSkip = new TH1F(named0itspureSAzSkip.Data(), d0ITSpureSAzTitle.Data(), 400, -2000., 2000.);
309     d0ITSpureSAzSkip->Sumw2();
310     d0ITSpureSAzSkip->SetMinimum(0);  
311     fOutputitspureSASkip->Add(d0ITSpureSAzSkip);
312
313     named0allpointrphiRec = "d0allpointrphiRec_";
314     named0allpointrphiRec += (i+1);
315     named0allpointzRec = "d0allpointzRec_";
316     named0allpointzRec += (i+1);
317     d0AllpointrphiRec = new TH1F(named0allpointrphiRec.Data(), d0allpointrphiTitle.Data(), 400, -2000., 2000.);
318     d0AllpointrphiRec->Sumw2();
319     d0AllpointrphiRec->SetMinimum(0);  
320     fOutputallPointRec->Add(d0AllpointrphiRec);
321     d0AllpointzRec= new TH1F(named0allpointzRec.Data(), d0allpointzTitle.Data(), 400, -2000., 2000.);
322     d0AllpointzRec->Sumw2();
323     d0AllpointzRec->SetMinimum(0);  
324     fOutputallPointRec->Add(d0AllpointzRec);
325
326     named0allpointrphiSkip = "d0allpointrphiSkip_";
327     named0allpointrphiSkip += (i+1);
328     named0allpointzSkip = "d0allpointzSkip_";
329     named0allpointzSkip += (i+1);
330     d0AllpointrphiSkip = new TH1F(named0allpointrphiSkip.Data(), d0allpointrphiTitle.Data(), 400, -2000., 2000.);
331     d0AllpointrphiSkip->Sumw2();
332     d0AllpointrphiSkip->SetMinimum(0);  
333     fOutputallPointSkip->Add(d0AllpointrphiSkip);
334     d0AllpointzSkip = new TH1F(named0allpointzSkip.Data(), d0allpointzTitle.Data(), 400, -2000., 2000.);
335     d0AllpointzSkip->Sumw2();
336     d0AllpointzSkip->SetMinimum(0);  
337     fOutputallPointSkip->Add(d0AllpointzSkip);
338
339     named0partpointrphiRec = "d0partpointrphiRec_";
340     named0partpointrphiRec += (i+1);
341     named0partpointzRec = "d0partpointzRec_";
342     named0partpointzRec += (i+1);
343     d0PartpointrphiRec = new TH1F(named0partpointrphiRec.Data(), d0partpointrphiTitle.Data(), 400, -2000., 2000.);
344     d0PartpointrphiRec->Sumw2();
345     d0PartpointrphiRec->SetMinimum(0);  
346     fOutputpartPointRec->Add(d0PartpointrphiRec);
347     d0PartpointzRec = new TH1F(named0partpointzRec.Data(), d0partpointzTitle.Data(), 400, -2000., 2000.);
348     d0PartpointzRec->Sumw2();
349     d0PartpointzRec->SetMinimum(0);  
350     fOutputpartPointRec->Add(d0PartpointzRec);
351
352     named0partpointrphiSkip = "d0partpointrphiSkip_";
353     named0partpointrphiSkip += (i+1);
354     named0partpointzSkip = "d0partpointzSkip_";
355     named0partpointzSkip += (i+1);
356     d0PartpointrphiSkip = new TH1F(named0partpointrphiSkip.Data(), d0partpointrphiTitle.Data(), 400, -2000., 2000.);
357     d0PartpointrphiSkip->Sumw2();
358     d0PartpointrphiSkip->SetMinimum(0);  
359     fOutputpartPointSkip->Add(d0PartpointrphiSkip);
360     d0PartpointzSkip = new TH1F(named0partpointzSkip.Data(), d0partpointzTitle.Data(), 400, -2000., 2000.);
361     d0PartpointzSkip->Sumw2();
362     d0PartpointzSkip->SetMinimum(0);  
363     fOutputpartPointSkip->Add(d0PartpointzSkip);
364
365     named0onepointSPDrphiRec = "d0onepointSPDrphiRec_";
366     named0onepointSPDrphiRec += (i+1);
367     named0onepointSPDzRec = "d0onepointSPDzRec_";
368     named0onepointSPDzRec += (i+1);
369     d0OnepointSPDrphiRec = new TH1F(named0onepointSPDrphiRec.Data(), d0onepointSPDrphiTitle.Data(), 400, -2000., 2000.);
370     d0OnepointSPDrphiRec->Sumw2();
371     d0OnepointSPDrphiRec->SetMinimum(0);  
372     fOutputonepointSPDRec->Add(d0OnepointSPDrphiRec);
373     d0OnepointSPDzRec = new TH1F(named0onepointSPDzRec.Data(), d0onepointSPDzTitle.Data(), 400, -2000., 2000.);
374     d0OnepointSPDzRec->Sumw2();
375     d0OnepointSPDzRec->SetMinimum(0);  
376     fOutputonepointSPDRec->Add(d0OnepointSPDzRec);
377
378     named0onepointSPDrphiSkip = "d0onepointSPDrphiSkip_";
379     named0onepointSPDrphiSkip += (i+1);
380     named0onepointSPDzSkip = "d0onepointSPDzSkip_";
381     named0onepointSPDzSkip += (i+1);
382     d0OnepointSPDrphiSkip = new TH1F(named0onepointSPDrphiSkip.Data(), d0onepointSPDrphiTitle.Data(), 400, -2000., 2000.);
383     d0OnepointSPDrphiSkip->Sumw2();
384     d0OnepointSPDrphiSkip->SetMinimum(0);  
385     fOutputonepointSPDSkip->Add(d0OnepointSPDrphiSkip);
386     d0OnepointSPDzSkip = new TH1F(named0onepointSPDzSkip.Data(), d0onepointSPDzTitle.Data(), 400, -2000., 2000.);
387     d0OnepointSPDzSkip->Sumw2();
388     d0OnepointSPDzSkip->SetMinimum(0);  
389     fOutputonepointSPDSkip->Add(d0OnepointSPDzSkip);
390
391     named0postvtracrphiRec = "d0postvtracrphiRec_";
392     named0postvtracrphiRec += (i+1);
393     named0postvtraczRec = "d0postvtraczRec_";
394     named0postvtraczRec += (i+1);
395     d0PostvtracrphiRec = new TH1F(named0postvtracrphiRec.Data(), d0postvtracrphiTitle.Data(), 400, -2000., 2000.);
396     d0PostvtracrphiRec->Sumw2();
397     d0PostvtracrphiRec->SetMinimum(0);  
398     fOutputpostvTracRec->Add(d0PostvtracrphiRec);
399     d0PostvtraczRec = new TH1F(named0postvtraczRec.Data(), d0postvtraczTitle.Data(), 400, -2000., 2000.);
400     d0PostvtraczRec->Sumw2();
401     d0PostvtraczRec->SetMinimum(0);  
402     fOutputpostvTracRec->Add(d0PostvtraczRec);
403
404     named0postvtracrphiSkip = "d0postvtracrphiSkip_";
405     named0postvtracrphiSkip += (i+1);
406     named0postvtraczSkip = "d0postvtraczSkip_";
407     named0postvtraczSkip += (i+1);
408     d0PostvtracrphiSkip = new TH1F(named0postvtracrphiSkip.Data(), d0postvtracrphiTitle.Data(), 400, -2000., 2000.);
409     d0PostvtracrphiSkip->Sumw2();
410     d0PostvtracrphiSkip->SetMinimum(0);  
411     fOutputpostvTracSkip->Add(d0PostvtracrphiSkip);
412     d0PostvtraczSkip = new TH1F(named0postvtraczSkip.Data(), d0postvtraczTitle.Data(), 400, -2000., 2000.);
413     d0PostvtraczSkip->Sumw2();
414     d0PostvtraczSkip->SetMinimum(0);  
415     fOutputpostvTracSkip->Add(d0PostvtraczSkip);
416
417     named0negtvtracrphiRec = "d0negtvtracrphiRec_";
418     named0negtvtracrphiRec += (i+1);
419     named0negtvtraczRec = "d0negtvtraczRec_";
420     named0negtvtraczRec += (i+1);
421     d0NegtvtracrphiRec = new TH1F(named0negtvtracrphiRec.Data(), d0negtvtracrphiTitle.Data(), 400, -2000., 2000.);
422     d0NegtvtracrphiRec->Sumw2();
423     d0NegtvtracrphiRec->SetMinimum(0);  
424     fOutputnegtvTracRec->Add(d0NegtvtracrphiRec);
425     d0NegtvtraczRec = new TH1F(named0negtvtraczRec.Data(), d0negtvtraczTitle.Data(), 400, -2000., 2000.);
426     d0NegtvtraczRec->Sumw2();
427     d0NegtvtraczRec->SetMinimum(0);  
428     fOutputnegtvTracRec->Add(d0NegtvtraczRec);
429
430     named0negtvtracrphiSkip = "d0negtvtracrphiSkip_";
431     named0negtvtracrphiSkip += (i+1);
432     named0negtvtraczSkip = "d0negtvtraczSkip_";
433     named0negtvtraczSkip += (i+1);
434     d0NegtvtracrphiSkip = new TH1F(named0negtvtracrphiSkip.Data(), d0negtvtracrphiTitle.Data(), 400, -2000., 2000.);
435     d0NegtvtracrphiSkip->Sumw2();
436     d0NegtvtracrphiSkip->SetMinimum(0);  
437     fOutputnegtvTracSkip->Add(d0NegtvtracrphiSkip);
438     d0NegtvtraczSkip = new TH1F(named0negtvtraczSkip.Data(), d0negtvtraczTitle.Data(), 400, -2000., 2000.);
439     d0NegtvtraczSkip->Sumw2();
440     d0NegtvtraczSkip->SetMinimum(0);  
441     fOutputnegtvTracSkip->Add(d0NegtvtraczSkip);
442
443     named0pullAllpointrphiSkip = "d0pullAllpointrphiSkip_";
444     named0pullAllpointrphiSkip +=(i+1);
445     named0pullAllpointzSkip = "d0pullAllpointzSkip_";
446     named0pullAllpointzSkip +=(i+1);
447     d0PullAllpointrphiSkip = new TH1F(named0pullAllpointrphiSkip.Data(),d0pullAllpointrphiTitle.Data(),400,-10.,10.);
448     d0PullAllpointrphiSkip->Sumw2();
449     d0PullAllpointrphiSkip->SetMinimum(0);
450     fOutputpullAllpointSkip->Add(d0PullAllpointrphiSkip);
451     d0PullAllpointzSkip = new TH1F(named0pullAllpointzSkip.Data(),d0pullAllpointzTitle.Data(),400,-10.,10.);
452     d0PullAllpointzSkip->Sumw2();
453     d0PullAllpointzSkip->SetMinimum(0);
454     fOutputpullAllpointSkip->Add(d0PullAllpointzSkip);
455
456     named0pullAllpointrphiRec = "d0pullAllpointrphiRec_";
457     named0pullAllpointrphiRec +=(i+1);
458     named0pullAllpointzRec = "d0pullAllpointzRec_";
459     named0pullAllpointzRec +=(i+1);
460     d0PullAllpointrphiRec = new TH1F(named0pullAllpointrphiRec.Data(),d0pullAllpointrphiTitle.Data(),400,-10.,10.);
461     d0PullAllpointrphiRec->Sumw2();
462     d0PullAllpointrphiRec->SetMinimum(0);
463     fOutputpullAllpointRec->Add(d0PullAllpointrphiRec);
464     d0PullAllpointzRec = new TH1F(named0pullAllpointzRec.Data(),d0pullAllpointzTitle.Data(),400,-10.,10.);
465     d0PullAllpointzRec->Sumw2();
466     d0PullAllpointzRec->SetMinimum(0);
467     fOutputpullAllpointRec->Add(d0PullAllpointzRec);
468
469
470     named0onlyRefitrphiRec = "d0onlyrefitrphiRec_";
471     named0onlyRefitrphiRec +=(i+1);
472     named0onlyRefitzRec = "d0onlyrefitzRec_";
473     named0onlyRefitzRec +=(i+1);
474     d0OnlyRefitrphiRec = new TH1F(named0onlyRefitrphiRec.Data(),d0onlyRefitrphiTitle.Data(),400,-2000.,2000.);
475     d0OnlyRefitrphiRec->Sumw2();
476     d0OnlyRefitrphiRec->SetMinimum(0);
477     fOutputOnlyRefitRec->Add(d0OnlyRefitrphiRec);
478     d0OnlyRefitzRec = new TH1F(named0onlyRefitzRec.Data(),d0onlyRefitzTitle.Data(),400,-2000.,2000.);
479     d0OnlyRefitzRec->Sumw2();
480     d0OnlyRefitzRec->SetMinimum(0);
481     fOutputOnlyRefitRec->Add(d0OnlyRefitzRec);
482
483
484     named0onlyRefitrphiSkip = "d0onlyrefitrphiSkip_";
485     named0onlyRefitrphiSkip +=(i+1);
486     named0onlyRefitzSkip = "d0onlyrefitzSkip_";
487     named0onlyRefitzSkip +=(i+1);
488     d0OnlyRefitrphiSkip = new TH1F(named0onlyRefitrphiSkip.Data(),d0onlyRefitrphiTitle.Data(),400,-2000.,2000.);
489     d0OnlyRefitrphiSkip->Sumw2();
490     d0OnlyRefitrphiSkip->SetMinimum(0);
491     fOutputOnlyRefitSkip->Add(d0OnlyRefitrphiSkip);
492     d0OnlyRefitzSkip = new TH1F(named0onlyRefitzSkip.Data(),d0onlyRefitzTitle.Data(),400,-2000.,2000.);
493     d0OnlyRefitzSkip->Sumw2();
494     d0OnlyRefitzSkip->SetMinimum(0);
495     fOutputOnlyRefitSkip->Add(d0OnlyRefitzSkip);
496
497     named0pt = "d0pt_";
498     named0pt += (i+1);
499     d0Pt = new TH1F(named0pt.Data(), d0ptTitle.Data(), 100, 0, 35.);
500     d0Pt->Sumw2();
501     d0Pt->SetMinimum(0);  
502     fOutputPt->Add(d0Pt);
503
504   }
505
506   if(!fNentries) fNentries = new TH1F("hNentries", "number of entries", 26, 0., 40.);
507   if(!fEstimVtx) fEstimVtx = new TH1F("vtxRes","Resolution of vertex",400,-1000.,1000);
508
509   return;
510 }
511
512 //________________________________________________________________________
513 void AliAnalysisTaskSEImpParRes::UserExec(Option_t */*option*/)
514 {
515   //
516   // Track selection and filling of d0 histograms
517   //
518   AliESDEvent *esd = dynamic_cast<AliESDEvent*>(InputEvent());
519   if (!esd) {
520     AliError("ESD event not found. Nothing done!");
521     return;
522   }
523
524   Float_t diamondcovxy[3];
525   esd->GetDiamondCovXY(diamondcovxy);
526   Double_t pos[3]={esd->GetDiamondX(),esd->GetDiamondY(),0.};
527   diamondcovxy[0]=0.05*0.05;
528   diamondcovxy[2]=0.05*0.05;
529   Double_t cov[6]={diamondcovxy[0],diamondcovxy[1],diamondcovxy[2],0.,0.,10.};
530   AliESDVertex *diamond = new AliESDVertex(pos,cov,1.,1);
531
532   AliVertexerTracks *vertexer0 = new AliVertexerTracks(esd->GetMagneticField());
533   vertexer0->SetITSMode();
534   vertexer0->SetMinClusters(4);  
535   vertexer0->SetVtxStart(diamond);
536   AliESDVertex *vtxESDRec = (AliESDVertex*)vertexer0->FindPrimaryVertex(esd);
537   delete vertexer0; vertexer0=0;
538   if(vtxESDRec->GetNContributors()<1) return;
539
540
541   AliStack *stack=0; 
542   if (fReadMC) { 
543     AliMCEventHandler *eventHandler = dynamic_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()); 
544     if (!eventHandler) { 
545       Printf("ERROR: Could not retrieve MC event handler"); 
546       return; 
547     } 
548
549     AliMCEvent* mcEvent = eventHandler->MCEvent(); 
550     if (!mcEvent) { 
551       Printf("ERROR: Could not retrieve MC event"); 
552       return; 
553     } 
554
555     stack = mcEvent->Stack(); 
556     if (!stack) { 
557       AliDebug(AliLog::kError, "Stack not available"); 
558       return; 
559     } 
560   } 
561
562   
563   Int_t nTrks = esd->GetNumberOfTracks();
564   for (Int_t it=0; it<nTrks; it++) {  // loop over tracks
565     // read track
566     AliESDtrack *esdtrack = esd->GetTrack(it);
567
568     // ask for ITS refit
569     if (!(esdtrack->GetStatus()&AliESDtrack::kITSrefit)) {
570       continue;
571     }
572     
573     Int_t pdgCode=0; 
574     if(fReadMC && stack) { 
575       Int_t trkLabel = esdtrack->GetLabel(); 
576       //Int_t trkLabel = TMath::Abs(esdtrack->GetLabel()); 
577       if(trkLabel<0) continue;
578       TParticle  *part = (TParticle*)stack->Particle(trkLabel); 
579       pdgCode = TMath::Abs(part->GetPdgCode()); 
580       //printf("pdgCode===%d\n", pdgCode);
581       if(fSelectedPdg>0 && pdgCode!=fSelectedPdg) continue;
582     }
583
584
585     Int_t npointsITS=0,npointsSPD=0;
586     for (Int_t i=0;i<6;i++){ 
587       if (i<2 && esdtrack->HasPointOnITSLayer(i)) npointsSPD +=1;
588       if (esdtrack->HasPointOnITSLayer(i)) npointsITS +=1;  
589     }
590
591     //Get specific primary vertex--Reconstructed primary vertex do not include the track considering.
592     AliVertexerTracks *vertexer = new AliVertexerTracks(esd->GetMagneticField());
593     vertexer->SetITSMode();
594     vertexer->SetMinClusters(4);
595     vertexer->SetVtxStart(diamond);
596     Int_t skipped[2];
597     skipped[0] = (Int_t)esdtrack->GetID();
598     vertexer->SetSkipTracks(1,skipped);      
599     AliESDVertex *vtxESDSkip = (AliESDVertex*)vertexer->FindPrimaryVertex(esd); 
600     delete vertexer; vertexer=NULL;
601     if(vtxESDSkip->GetNContributors()<1) continue;
602      
603
604     Double_t dzRec[2], covdzRec[3], dzRecSkip[2], covdzRecSkip[3];
605     Double_t beampiperadius=3.;
606     Double_t pt= esdtrack->Pt();
607     Int_t bin = PtBin(pt);
608
609     if(bin==-1) {
610       delete vtxESDSkip; vtxESDSkip = 0x0;
611       continue;
612     }
613
614
615     esdtrack->PropagateToDCA(vtxESDRec, esd->GetMagneticField(), beampiperadius, dzRec, covdzRec);
616     esdtrack->PropagateToDCA(vtxESDSkip, esd->GetMagneticField(), beampiperadius, dzRecSkip, covdzRecSkip);
617
618     if(covdzRec[0]<0 || covdzRec[2]<0 || covdzRecSkip[0]<0 || covdzRecSkip[2]<0) {
619       delete vtxESDSkip; vtxESDSkip = 0x0;
620       continue;
621     }
622       
623     //printf("Pt: %f GeV/c; Impact parameter: rphi %f cm  z %f cm\n", pt, dzRec[0], dzRec[1]);
624
625     /*
626     // RUBEN'S METHOD, NOT FULLY IMPLEMENTED YET    
627     Double_t      fIPCenIni[3], xyzDCA[3];
628     for (int i=3;i--;) fIPCenIni[i] = 0.;
629     //Int_t nTracks = nTrks - 1;
630     esdtrack->GetXYZ(xyzDCA);
631     //double pTrack = esdtrack->GetP();
632     double phiTrack = esdtrack->Phi();
633     double cs = TMath::Cos(phiTrack);
634     double sn = TMath::Sin(phiTrack);
635     double trDCA = (xyzDCA[0]-fIPCenIni[0])         *sn - (xyzDCA[1]-fIPCenIni[1])         *cs;  // track signed DCA to origin
636     double vtDCA = (vtxESDSkip->GetXv()-fIPCenIni[0])*sn - (vtxESDSkip->GetYv()-fIPCenIni[1])*cs;  // vertex signed DCA to origin
637     
638     // update the estimator values
639     //double estIP  = rvD*rtD;
640     double estVtx = vtDCA*( vtDCA- trDCA);
641     //double estTrc = rtD*(rtD - rvD);
642     //
643     //if (nTracks >= fMinTracksForIP) fEstimIP->Fill(phiTrack, estIP);
644     fEstimVtx->Fill(10000*estVtx);
645     //if (pTrack<1e-6) pTrack = GetTrackMinP()+1e6;
646     //fEstimTrc->Fill(1./pTrack,estTrc);
647     */
648
649
650     //fill the histgram with all particle 
651     //-------------------------------------------1----------------------------------------------
652     
653     /*
654     TString named0AllrphiRec=" ",named0AllzRec =" ";//named0AllrphiTrue=" ",named0AllzTrue =" ";
655       //named0AllrphiSkip=" ",named0AllzSkip =" ";
656       
657       named0AllrphiRec ="d0allrphiRec_";
658       named0AllrphiRec += bin;
659       named0AllzRec = "d0allzRec_";
660       named0AllzRec += bin;
661       ((TH1F*)(fOutputallRec->FindObject(named0AllrphiRec)))->Fill(10000*dzRec[0]);
662       ((TH1F*)(fOutputallRec->FindObject(named0AllzRec)))->Fill(10000*dzRec[1]);
663     */
664
665     //-------------------------------------------2----------------------------------------------
666     //TSting named0AllrphiRec = "d0allrphiRec_" + bin;
667     //TSting named0AllzRec = "d0allzRec_" + bin;
668     //((TH1F*)(fOutputallRec->FindObject(named0AllrphiRec.Data())))->Fill(10000.*dzRec[0]);
669     //((TH1F*)(fOutputallRec->FindObject(named0AllzRec.Data())))->Fill(10000.*dzRec[1]);
670
671     //-------------------------------------------3------------------------------------------------
672
673
674     // ITS standalone
675     if (!(esdtrack->GetStatus()&AliESDtrack::kTPCrefit) && (esdtrack->GetStatus()&AliESDtrack::kITSpureSA)
676         && npointsSPD>0 && npointsITS>=4) {
677       char *named0ITSpureSArphiRec = Form("d0itspureSArphiRec_%d", bin);
678       char *named0ITSpureSArphiSkip = Form("d0itspureSArphiSkip_%d", bin);
679       char *named0ITSpureSAzRec = Form("d0itspureSAzRec_%d", bin); 
680       char *named0ITSpureSAzSkip = Form("d0itspureSAzSkip_%d", bin); 
681       ((TH1F*)(fOutputitspureSARec->FindObject(named0ITSpureSArphiRec)))->Fill(10000.*dzRec[0]);
682       ((TH1F*)(fOutputitspureSARec->FindObject(named0ITSpureSAzRec)))->Fill(10000.*dzRec[1]);
683       ((TH1F*)(fOutputitspureSASkip->FindObject(named0ITSpureSArphiSkip)))->Fill(10000.*dzRecSkip[0]);
684       ((TH1F*)(fOutputitspureSASkip->FindObject(named0ITSpureSAzSkip)))->Fill(10000.*dzRecSkip[1]);
685     }
686
687     
688     // ask for TPC refit
689     if (!(esdtrack->GetStatus()&AliESDtrack::kTPCrefit) || esdtrack->GetNcls(1)<70) {
690       delete vtxESDSkip; vtxESDSkip = 0x0;
691       continue;
692     }
693
694     // only ITS and TPC refit
695     char *named0OnlyrefitrphiRec = Form("d0onlyrefitrphiRec_%d", bin);
696     char *named0OnlyrefitrphiSkip = Form("d0onlyrefitrphiSkip_%d", bin);
697     char *named0OnlyrefitzRec = Form("d0onlyrefitzRec_%d", bin);
698     char *named0OnlyrefitzSkip = Form("d0onlyrefitzSkip_%d", bin); 
699     ((TH1F*)(fOutputOnlyRefitRec->FindObject(named0OnlyrefitrphiRec)))->Fill(10000.*dzRec[0]);
700     ((TH1F*)(fOutputOnlyRefitRec->FindObject(named0OnlyrefitzRec)))->Fill(10000.*dzRec[1]);
701     ((TH1F*)(fOutputOnlyRefitSkip->FindObject(named0OnlyrefitrphiSkip)))->Fill(10000.*dzRecSkip[0]);
702     ((TH1F*)(fOutputOnlyRefitSkip->FindObject(named0OnlyrefitzSkip)))->Fill(10000.*dzRecSkip[1]);  
703     
704     // with 6 ITS points
705     if(npointsITS==6) {
706       char *named0AllpointrphiRec = Form("d0allpointrphiRec_%d", bin);
707       char *named0AllpointrphiSkip = Form("d0allpointrphiSkip_%d", bin);
708       char *named0AllpointzRec = Form("d0allpointzRec_%d", bin);
709       char *named0AllpointzSkip = Form("d0allpointzSkip_%d", bin); 
710       ((TH1F*)(fOutputallPointRec->FindObject(named0AllpointrphiRec)))->Fill(10000.*dzRec[0]);
711       ((TH1F*)(fOutputallPointRec->FindObject(named0AllpointzRec)))->Fill(10000.*dzRec[1]);
712       ((TH1F*)(fOutputallPointSkip->FindObject(named0AllpointrphiSkip)))->Fill(10000.*dzRecSkip[0]);
713       ((TH1F*)(fOutputallPointSkip->FindObject(named0AllpointzSkip)))->Fill(10000.*dzRecSkip[1]);
714  
715       // pulls
716       char *named0PullAllpointrphiRec = Form("d0pullAllpointrphiRec_%d", bin);
717       char *named0PullAllpointrphiSkip = Form("d0pullAllpointrphiSkip_%d", bin);
718       char *named0PullAllpointzRec = Form("d0pullAllpointzRec_%d", bin);
719       char *named0PullAllpointzSkip = Form("d0pullAllpointzSkip_%d", bin); 
720       ((TH1F*)(fOutputpullAllpointRec->FindObject(named0PullAllpointrphiRec)))->Fill(dzRec[0]/TMath::Sqrt(covdzRec[0]));
721       
722       ((TH1F*)(fOutputpullAllpointRec->FindObject(named0PullAllpointzRec)))->Fill(dzRec[1]/TMath::Sqrt(covdzRec[2]));
723       ((TH1F*)(fOutputpullAllpointSkip->FindObject(named0PullAllpointrphiSkip)))->Fill(dzRecSkip[0]/TMath::Sqrt(covdzRecSkip[0]));
724       ((TH1F*)(fOutputpullAllpointSkip->FindObject(named0PullAllpointzSkip)))->Fill(dzRecSkip[1]/TMath::Sqrt(covdzRecSkip[2]));
725     }
726    
727     if(npointsITS>=4 && npointsSPD>0) {
728       char *named0PartpointrphiRec = Form("d0partpointrphiRec_%d", bin);
729       char *named0PartpointrphiSkip = Form("d0partpointrphiSkip_%d", bin);
730       char *named0PartpointzRec = Form("d0partpointzRec_%d", bin); 
731       char *named0PartpointzSkip = Form("d0partpointzSkip_%d", bin); 
732       ((TH1F*)(fOutputpartPointRec->FindObject(named0PartpointrphiRec)))->Fill(10000.*dzRec[0]);
733       ((TH1F*)(fOutputpartPointRec->FindObject(named0PartpointzRec)))->Fill(10000.*dzRec[1]);
734       ((TH1F*)(fOutputpartPointSkip->FindObject(named0PartpointrphiSkip)))->Fill(10000.*dzRecSkip[0]);
735       ((TH1F*)(fOutputpartPointSkip->FindObject(named0PartpointzSkip)))->Fill(10000.*dzRecSkip[1]);
736     }
737
738     if(npointsSPD>0) {
739       char *named0OnepointSPDrphiRec = Form("d0onepointSPDrphiRec_%d", bin);
740       char *named0OnepointSPDrphiSkip = Form("d0onepointSPDrphiSkip_%d", bin);
741       char *named0OnepointSPDzRec = Form("d0onepointSPDzRec_%d", bin); 
742       char *named0OnepointSPDzSkip = Form("d0onepointSPDzSkip_%d", bin); 
743       ((TH1F*)(fOutputonepointSPDRec->FindObject(named0OnepointSPDrphiRec)))->Fill(10000.*dzRec[0]);
744       ((TH1F*)(fOutputonepointSPDRec->FindObject(named0OnepointSPDzRec)))->Fill(10000.*dzRec[1]);
745       ((TH1F*)(fOutputonepointSPDSkip->FindObject(named0OnepointSPDrphiSkip)))->Fill(10000.*dzRecSkip[0]);
746       ((TH1F*)(fOutputonepointSPDSkip->FindObject(named0OnepointSPDzSkip)))->Fill(10000.*dzRecSkip[1]);
747     }
748
749     Short_t charge=esdtrack->Charge();
750     if(charge==1 && npointsITS==6) {
751       char *named0PostvtracrphiRec = Form("d0postvtracrphiRec_%d", bin);
752       char *named0PostvtracrphiSkip = Form("d0postvtracrphiSkip_%d", bin);
753       char *named0PostvtraczRec = Form("d0postvtraczRec_%d", bin); 
754       char *named0PostvtraczSkip = Form("d0postvtraczSkip_%d", bin); 
755       ((TH1F*)(fOutputpostvTracRec->FindObject(named0PostvtracrphiRec)))->Fill(10000.*dzRec[0]);
756       ((TH1F*)(fOutputpostvTracRec->FindObject(named0PostvtraczRec)))->Fill(10000.*dzRec[1]);
757       ((TH1F*)(fOutputpostvTracSkip->FindObject(named0PostvtracrphiSkip)))->Fill(10000.*dzRecSkip[0]);
758       ((TH1F*)(fOutputpostvTracSkip->FindObject(named0PostvtraczSkip)))->Fill(10000.*dzRecSkip[1]);
759     }
760
761     if(charge==-1 && npointsITS==6) {
762       char *named0NegtvtracrphiRec = Form("d0negtvtracrphiRec_%d", bin);
763       char *named0NegtvtracrphiSkip = Form("d0negtvtracrphiSkip_%d", bin);
764       char *named0NegtvtraczRec = Form("d0negtvtraczRec_%d", bin); 
765       char *named0NegtvtraczSkip = Form("d0negtvtraczSkip_%d", bin); 
766       ((TH1F*)(fOutputnegtvTracRec->FindObject(named0NegtvtracrphiRec)))->Fill(10000.*dzRec[0]);
767       ((TH1F*)(fOutputnegtvTracRec->FindObject(named0NegtvtraczRec)))->Fill(10000.*dzRec[1]);
768       ((TH1F*)(fOutputnegtvTracSkip->FindObject(named0NegtvtracrphiSkip)))->Fill(10000.*dzRecSkip[0]);
769       ((TH1F*)(fOutputnegtvTracSkip->FindObject(named0NegtvtraczSkip)))->Fill(10000.*dzRecSkip[1]);
770     }
771     char *named0Pt = Form("d0pt_%d",bin);
772     if(npointsITS==6) ((TH1F*)(fOutputPt->FindObject(named0Pt)))->Fill(pt);
773
774     delete vtxESDSkip; vtxESDSkip = 0x0;
775   }  // end loop of tracks
776   
777   delete diamond; diamond=NULL;
778   delete vtxESDRec; vtxESDRec = 0x0;
779   fNentries->Fill(1);
780   PostData(1, fOutputitspureSARec);
781   PostData(2, fOutputitspureSASkip);
782   PostData(3, fOutputallPointRec);
783   PostData(4, fOutputallPointSkip);
784   PostData(5, fOutputpartPointRec);
785   PostData(6, fOutputpartPointSkip);
786   PostData(7, fOutputonepointSPDRec);
787   PostData(8, fOutputonepointSPDSkip);
788   PostData(9, fOutputpostvTracRec);
789   PostData(10, fOutputpostvTracSkip);
790   PostData(11, fOutputnegtvTracRec);
791   PostData(12, fOutputnegtvTracSkip);
792   PostData(13, fOutputpullAllpointRec);
793   PostData(14, fOutputpullAllpointSkip);
794   PostData(15, fOutputOnlyRefitRec);
795   PostData(16, fOutputOnlyRefitSkip);
796   PostData(17, fOutputPt);
797   PostData(18, fNentries);
798   PostData(19,fEstimVtx);
799   
800   return;
801 }
802
803 //________________________________________________________________________
804 Int_t AliAnalysisTaskSEImpParRes::PtBin(Double_t pt) const {
805   //
806   // return the number of the pt bin
807   //
808
809   if (pt>0.22 && pt<0.23) return 1 ;
810   if (pt>0.26 && pt<0.27) return 2 ; 
811   if (pt>0.35 && pt<0.36) return 3 ;
812   if (pt>0.45 && pt<0.46) return 4 ; 
813   if (pt>0.55 && pt<0.56) return 5 ;
814   if (pt>0.65 && pt<0.66) return 6 ; 
815   if (pt>0.75 && pt<0.76) return 7 ; 
816   if (pt>0.85 && pt<0.865) return 8 ; 
817   if (pt>1.05 && pt<1.07) return 9 ;
818   if (pt>1.25 && pt<1.30) return 10; 
819   if (pt>1.4 && pt<1.55) return 11; 
820   if (pt>1.6 && pt<1.8) return 12; 
821   if (pt>1.8 && pt<2.0) return 13; 
822   if (pt>2.1 && pt<2.3) return 14; 
823   if (pt>2.34 && pt<2.64) return 15; 
824   if (pt>2.65 && pt<3.0) return 16; 
825   if (pt>3.1 && pt<4.) return 17; 
826   if (pt>4.1 && pt<5.2) return 18; 
827   if (pt>5.3 && pt<6.8)  return 19; 
828   if (pt>7.0 && pt<8.8) return 20; 
829   if (pt>9. && pt<30.) return 2;
830   if (pt>30.1 && pt<32.) return 22; 
831   if (pt>32.5  && pt<33.)  return 23;
832   if (pt>33.2  && pt<33.8) return 24; 
833   if (pt>33.9  && pt<34.)  return 25;
834   if (pt>34.05  && pt<35.)  return 26;
835
836   /*
837   if (pt>0.22 && pt<0.23) return 1 ;
838   if (pt>0.26 && pt<0.27) return 2 ; 
839   if (pt>0.35 && pt<0.36) return 3 ;
840   if (pt>0.45 && pt<0.46) return 4 ; 
841   if (pt>0.55 && pt<0.56) return 5 ;
842   if (pt>0.65 && pt<0.66) return 6 ; 
843   if (pt>0.75 && pt<0.76) return 7 ; 
844   if (pt>0.85 && pt<0.86) return 8 ; 
845   if (pt>1.05 && pt<1.06) return 9 ;
846   if (pt>1.25 && pt<1.27) return 10; 
847   if (pt>1.45 && pt<1.47) return 11; 
848   if (pt>1.65 && pt<1.67) return 12; 
849   if (pt>1.85 && pt<1.87) return 13; 
850   if (pt>2.15 && pt<2.17) return 14; 
851   if (pt>2.45 && pt<2.48) return 15; 
852   if (pt>2.65 && pt<2.67) return 16; 
853   if (pt>2.85 && pt<2.87) return 17; 
854   if (pt>3.25 && pt<3.27) return 18; 
855   if (pt>3.75 && pt<3.8)  return 19; 
856   if (pt>4.15 && pt<4.20) return 20; 
857   if (pt>4.95 && pt<5.15) return 21;
858   if (pt>5.35 && pt<5.55) return 22; 
859   if (pt>6.0  && pt<6.8)  return 23;
860   if (pt>8.5  && pt<10.5) return 24; 
861   if (pt>12.  && pt<19.)  return 25;
862   if (pt>21.  && pt<32.)  return 26;
863   */  
864   return -1; 
865 }
866
867 //_________________________________________________________________________
868 void AliAnalysisTaskSEImpParRes::Terminate(Option_t */*option*/) {
869   //
870   // Terminate analysis
871   //
872
873   if (fDebug>1) printf("AnalysisTaskSEImpParRes: Terminate() \n");
874
875   fOutputitspureSARec = dynamic_cast<TList*>(GetOutputData(1));
876   if (!fOutputitspureSARec) printf("ERROR: fOutputitspureSARec not available\n");
877
878   fOutputitspureSASkip = dynamic_cast<TList*>(GetOutputData(2));
879   if (!fOutputitspureSASkip) printf("ERROR: fOutputitspureSASkip not available\n");
880
881   fOutputallPointRec = dynamic_cast<TList*>(GetOutputData(3));
882   if (!fOutputallPointRec) printf("ERROR: fOutputallPointRec not available\n");
883
884   fOutputallPointSkip = dynamic_cast<TList*>(GetOutputData(4));
885   if (!fOutputallPointSkip) printf("ERROR: fOutputallPointSkip not available\n");
886
887   fOutputpartPointRec = dynamic_cast<TList*>(GetOutputData(5));
888   if (!fOutputpartPointRec) printf("ERROR: fOutputpartPointRec not available\n");
889
890   fOutputpartPointSkip = dynamic_cast<TList*>(GetOutputData(6));
891   if (!fOutputpartPointSkip) printf("ERROR: fOutputpartPointSkip not available\n");
892
893   fOutputonepointSPDRec = dynamic_cast<TList*>(GetOutputData(7));
894   if (!fOutputonepointSPDRec) printf("ERROR: fOutputonepointSPDSRec not available\n");
895
896   fOutputonepointSPDSkip = dynamic_cast<TList*>(GetOutputData(8));
897   if (!fOutputonepointSPDSkip) printf("ERROR: fOutputonepointSPDSkip not available\n");
898
899   fOutputpostvTracRec = dynamic_cast<TList*>(GetOutputData(9));
900   if (!fOutputpostvTracRec) printf("ERROR: fOutputpostvTracRec not available\n");
901
902   fOutputpostvTracSkip = dynamic_cast<TList*>(GetOutputData(10));
903   if (!fOutputpostvTracSkip) printf("ERROR: fOutputpostvTracSkip not available\n");
904
905   fOutputnegtvTracRec = dynamic_cast<TList*>(GetOutputData(11));
906   if (!fOutputnegtvTracRec) printf("ERROR: fOutputnegtvTracRec not available\n");
907
908   fOutputnegtvTracSkip = dynamic_cast<TList*>(GetOutputData(12));
909   if (!fOutputnegtvTracSkip) printf("ERROR: fOutputnegtvTracSkip not available\n");
910
911
912   fOutputpullAllpointRec = dynamic_cast<TList*>(GetOutputData(13));
913   if (!fOutputpullAllpointRec) printf("ERROR: fOutputpullAllpointRec not available\n");
914
915   fOutputpullAllpointSkip = dynamic_cast<TList*>(GetOutputData(14));
916   if (!fOutputpullAllpointSkip) printf("ERROR: fOutputpullAllpointSkip not available\n");
917
918   fOutputOnlyRefitRec = dynamic_cast<TList*>(GetOutputData(15));
919   if (!fOutputOnlyRefitRec) printf("ERROR: fOutputOnlyRefitRec not available\n");
920
921   fOutputOnlyRefitSkip = dynamic_cast<TList*>(GetOutputData(16));
922   if (!fOutputOnlyRefitSkip) printf("ERROR: fOutputOnlyRefitSkip not available\n");
923
924   fOutputPt = dynamic_cast<TList*>(GetOutputData(17));
925   if (!fOutputPt) printf("ERROR: fOutputPt not available\n");
926
927   fNentries = dynamic_cast<TH1F*>(GetOutputData(18));
928   if (!fNentries) printf("ERROR: fNentries not available\n");
929   
930   fEstimVtx = dynamic_cast<TH1F*>(GetOutputData(19));
931   if (!fEstimVtx) printf("ERROR: fEstimVtx not available\n");
932   
933   return;
934 }