083702b9b4464fe494602e3c33d0f630c6e7df58
[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 "AliGeomManager.h"
29 #include "AliTrackPointArray.h"
30 #include "AliMCEventHandler.h"
31 #include "AliGenEventHeader.h"
32 #include "AliMCEvent.h"
33 #include "AliStack.h"
34 #include "AliESDEvent.h"
35 #include "AliESDVertex.h"
36 #include "AliESDtrack.h"   
37 #include "AliVertexerTracks.h"
38 #include "AliVVertex.h"
39 #include "AliPID.h"
40 #include "AliAnalysisTaskSEImpParRes.h"
41
42 ClassImp(AliAnalysisTaskSEImpParRes)
43
44 //________________________________________________________________________
45 AliAnalysisTaskSEImpParRes::AliAnalysisTaskSEImpParRes():
46 AliAnalysisTaskSE(),
47 fReadMC(kFALSE),
48 fSelectedPdg(-1),
49 fUseDiamond(kFALSE),
50 fOutputitspureSARec(0),
51 fOutputitspureSASkip(0), 
52 fOutputallPointRec(0),
53 fOutputallPointSkip(0),
54 fOutputpartPointRec(0),
55 fOutputpartPointSkip(0),
56 fOutputonepointSPDRec(0),
57 fOutputonepointSPDSkip(0),
58 fOutputpostvTracRec(0),
59 fOutputpostvTracSkip(0),
60 fOutputnegtvTracRec(0),
61 fOutputnegtvTracSkip(0),
62 fOutputpullAllpointRec(0),
63 fOutputpullAllpointSkip(0),
64 fOutputOnlyRefitRec(0),
65 fOutputOnlyRefitSkip(0),
66 fOutputSinThetaRec(0),
67 fOutputSinThetaSkip(0),
68 fOutputallPointTrue(0),
69 fOutputpostvTracTrue(0),
70 fOutputnegtvTracTrue(0),
71 fOutputpullAllpointTrue(0),
72 fOutputphiAllpointSkip(0),
73 fOutputphiPostvtracSkip(0),
74 fOutputphiNegtvtracSkip(0),
75 fOutputclusterTypeSPD01Skip(0),
76 fOutputclusterTypeSPD02Skip(0),
77 fOutputclusterTypeSPD03Skip(0),
78 fOutputclusterTypeSPD11Skip(0),
79 fOutputclusterTypeSPD12Skip(0),
80 fOutputclusterTypeSPD13Skip(0),
81 fOutputparticlePID(0),
82 fOutputPt(0),
83 fNentries(0),
84 fEstimVtx(0)
85 {
86   //
87   // Default constructor
88   //
89 }
90
91 //________________________________________________________________________
92 AliAnalysisTaskSEImpParRes::AliAnalysisTaskSEImpParRes(const char *name):
93 AliAnalysisTaskSE(name),
94 fReadMC(kFALSE),
95 fSelectedPdg(-1),
96 fUseDiamond(kFALSE),
97 fOutputitspureSARec(0),
98 fOutputitspureSASkip(0), 
99 fOutputallPointRec(0),
100 fOutputallPointSkip(0),
101 fOutputpartPointRec(0),
102 fOutputpartPointSkip(0),
103 fOutputonepointSPDRec(0),
104 fOutputonepointSPDSkip(0),
105 fOutputpostvTracRec(0),
106 fOutputpostvTracSkip(0),
107 fOutputnegtvTracRec(0),
108 fOutputnegtvTracSkip(0),
109 fOutputpullAllpointRec(0),
110 fOutputpullAllpointSkip(0),
111 fOutputOnlyRefitRec(0),
112 fOutputOnlyRefitSkip(0),
113 fOutputSinThetaRec(0),
114 fOutputSinThetaSkip(0),
115 fOutputallPointTrue(0),
116 fOutputpostvTracTrue(0),
117 fOutputnegtvTracTrue(0),
118 fOutputpullAllpointTrue(0),
119 fOutputphiAllpointSkip(0),
120 fOutputphiPostvtracSkip(0),
121 fOutputphiNegtvtracSkip(0),
122 fOutputclusterTypeSPD01Skip(0),
123 fOutputclusterTypeSPD02Skip(0),
124 fOutputclusterTypeSPD03Skip(0),
125 fOutputclusterTypeSPD11Skip(0),
126 fOutputclusterTypeSPD12Skip(0),
127 fOutputclusterTypeSPD13Skip(0),
128 fOutputparticlePID(0),
129 fOutputPt(0),
130 fNentries(0),
131 fEstimVtx(0)
132 {
133   //
134   // Default constructor
135   //
136
137   DefineOutput(1, TList::Class());  //My private output
138   DefineOutput(2, TList::Class());  //My private output
139   DefineOutput(3, TList::Class());  //My private output
140   DefineOutput(4, TList::Class());  //My private output
141   DefineOutput(5, TList::Class());
142   DefineOutput(6, TList::Class());  //My private output
143   DefineOutput(7, TList::Class());
144   DefineOutput(8, TList::Class());  //My private output
145   DefineOutput(9, TList::Class());  //My private output
146   DefineOutput(10, TList::Class());  //My private output
147   DefineOutput(11, TList::Class());  //My private output
148   DefineOutput(12, TList::Class());
149   DefineOutput(13, TList::Class());  //My private output
150   DefineOutput(14, TList::Class());
151   DefineOutput(15, TList::Class());  //My private output
152   DefineOutput(16, TList::Class());
153   DefineOutput(17, TList::Class());  //My private output
154   DefineOutput(18, TList::Class());
155   DefineOutput(19, TList::Class());  //My private output
156   DefineOutput(20, TList::Class());  //My private output
157   DefineOutput(21, TList::Class());
158   DefineOutput(22, TList::Class());  //My private output
159   DefineOutput(23, TList::Class());
160   DefineOutput(24, TList::Class());  //My private output
161   DefineOutput(25, TList::Class());
162   DefineOutput(26, TList::Class());  //My private output
163   DefineOutput(27, TList::Class());
164   DefineOutput(28, TList::Class());  //My private output
165   DefineOutput(29, TList::Class());
166   DefineOutput(30, TList::Class());  //My private output
167   DefineOutput(31, TList::Class());
168   DefineOutput(32, TList::Class());  //My private output
169   DefineOutput(33, TList::Class());  //My private output
170   DefineOutput(34, TH1F::Class());
171   DefineOutput(35, TH1F::Class());
172 }
173
174 //________________________________________________________________________
175 AliAnalysisTaskSEImpParRes::~AliAnalysisTaskSEImpParRes()
176 {
177   //
178   // default distructor  
179   // 
180   if (fOutputitspureSARec)                      { delete fOutputitspureSARec; fOutputitspureSARec=0x0;}
181   if (fOutputitspureSASkip)                   { delete fOutputitspureSASkip; fOutputitspureSASkip=0x0;}
182   if (fOutputallPointRec)                        { delete fOutputallPointRec; fOutputallPointRec=0x0; }
183   if (fOutputallPointSkip)                     { delete fOutputallPointSkip; fOutputallPointSkip=0x0; }
184   if (fOutputpartPointRec)                     { delete fOutputpartPointRec; fOutputpartPointRec=0x0; }
185   if (fOutputpartPointSkip)                  { delete fOutputpartPointSkip; fOutputpartPointSkip=0x0; }
186   if (fOutputonepointSPDRec)                 { delete fOutputonepointSPDRec;fOutputonepointSPDRec=0x0;}
187   if (fOutputonepointSPDSkip)              { delete fOutputonepointSPDSkip;fOutputonepointSPDSkip=0x0;}
188   if (fOutputpostvTracRec)                      { delete fOutputpostvTracRec; fOutputpostvTracRec=0x0;}
189   if (fOutputpostvTracSkip)                  {  delete fOutputpostvTracSkip; fOutputpostvTracSkip=0x0;}
190   if (fOutputnegtvTracRec)                      { delete fOutputnegtvTracRec; fOutputnegtvTracRec=0x0;}
191   if (fOutputnegtvTracSkip)                   { delete fOutputnegtvTracSkip; fOutputnegtvTracSkip=0x0;}
192   if (fOutputpullAllpointRec)              {delete fOutputpullAllpointRec; fOutputpullAllpointRec=0x0;}
193   if (fOutputpullAllpointSkip)           {delete fOutputpullAllpointSkip; fOutputpullAllpointSkip=0x0;}
194   if (fOutputOnlyRefitRec)                       {delete fOutputOnlyRefitRec; fOutputOnlyRefitRec=0x0;}
195   if (fOutputOnlyRefitSkip)                    {delete fOutputOnlyRefitSkip; fOutputOnlyRefitSkip=0x0;}
196   if (fOutputSinThetaRec)                          {delete fOutputSinThetaRec; fOutputSinThetaRec=0x0;}  
197   if (fOutputSinThetaSkip)                       {delete fOutputSinThetaSkip; fOutputSinThetaSkip=0x0;}
198   if (fOutputallPointTrue)                       {delete fOutputallPointTrue; fOutputallPointTrue=0x0;}
199   if (fOutputpostvTracTrue)                     {delete fOutputpostvTracTrue;fOutputpostvTracTrue=0x0;}
200   if (fOutputnegtvTracTrue)                     {delete fOutputnegtvTracTrue;fOutputnegtvTracTrue=0x0;}
201   if (fOutputpullAllpointTrue)            {delete fOutputpullAllpointTrue;fOutputpullAllpointTrue=0x0;}
202   if (fOutputphiAllpointSkip)               {delete fOutputphiAllpointSkip;fOutputphiAllpointSkip=0x0;}
203   if (fOutputphiPostvtracSkip)            {delete fOutputphiPostvtracSkip;fOutputphiPostvtracSkip=0x0;}
204   if (fOutputphiNegtvtracSkip)            {delete fOutputphiNegtvtracSkip;fOutputphiNegtvtracSkip=0x0;}
205   if (fOutputclusterTypeSPD01Skip){delete fOutputclusterTypeSPD01Skip;fOutputclusterTypeSPD01Skip=0x0;}
206   if (fOutputclusterTypeSPD02Skip){delete fOutputclusterTypeSPD02Skip;fOutputclusterTypeSPD02Skip=0x0;}
207   if (fOutputclusterTypeSPD03Skip){delete fOutputclusterTypeSPD03Skip;fOutputclusterTypeSPD03Skip=0x0;}
208   if (fOutputclusterTypeSPD11Skip){delete fOutputclusterTypeSPD11Skip;fOutputclusterTypeSPD11Skip=0x0;}
209   if (fOutputclusterTypeSPD12Skip){delete fOutputclusterTypeSPD12Skip;fOutputclusterTypeSPD12Skip=0x0;}
210   if (fOutputclusterTypeSPD13Skip){delete fOutputclusterTypeSPD13Skip;fOutputclusterTypeSPD13Skip=0x0;}
211   if (fOutputparticlePID)                           {delete fOutputparticlePID;fOutputparticlePID=0x0;}
212   if (fOutputPt)                                                      {delete fOutputPt;fOutputPt=0x0;}
213   if (fNentries)                                           { delete fNentries;     fNentries    =0x0; }
214   if (fEstimVtx)                                           { delete fEstimVtx;     fEstimVtx    =0x0; }
215
216
217
218 //________________________________________________________________________
219 void AliAnalysisTaskSEImpParRes::UserCreateOutputObjects()
220 {
221   // 
222   // Create the output container
223   //
224   
225   if(fDebug>1) printf("AnalysisTaskSEImpParRes::UserCreateOutputObjects() \n");
226   
227   // Several histograms are more conveniently managed in a TList
228   if (!fOutputitspureSARec) {
229     fOutputitspureSARec = new TList();
230     fOutputitspureSARec->SetOwner();
231     fOutputitspureSARec->SetName("ITSpureSARec");
232   }
233
234   if (!fOutputitspureSASkip) {
235     fOutputitspureSASkip = new TList();
236     fOutputitspureSASkip->SetOwner();
237     fOutputitspureSASkip->SetName("ITSpureSASkip");
238   }
239
240   if (!fOutputallPointRec) {
241     fOutputallPointRec = new TList();
242     fOutputallPointRec->SetOwner();
243     fOutputallPointRec->SetName("allpointRec");
244   }
245
246   if (!fOutputallPointSkip) {
247     fOutputallPointSkip = new TList();
248     fOutputallPointSkip->SetOwner();
249     fOutputallPointSkip->SetName("allpointSkip");
250   }
251
252   if (!fOutputpartPointRec) {
253     fOutputpartPointRec = new TList();
254     fOutputpartPointRec->SetOwner();
255     fOutputpartPointRec->SetName("partpointRec");
256   }
257
258   if (!fOutputpartPointSkip) {
259     fOutputpartPointSkip = new TList();
260     fOutputpartPointSkip->SetOwner();
261     fOutputpartPointSkip->SetName("partpointSkip");
262   }
263
264   if (!fOutputonepointSPDRec) {
265     fOutputonepointSPDRec = new TList();
266     fOutputonepointSPDRec->SetOwner();
267     fOutputonepointSPDRec->SetName("onepointSPDRec");
268   }
269
270   if (!fOutputonepointSPDSkip) {
271     fOutputonepointSPDSkip = new TList();
272     fOutputonepointSPDSkip->SetOwner();
273     fOutputonepointSPDSkip->SetName("onepointSPDSkip");
274   }
275
276   if (!fOutputpostvTracRec) {
277     fOutputpostvTracRec = new TList();
278     fOutputpostvTracRec->SetOwner();
279     fOutputpostvTracRec->SetName("postvtracRec");
280   }
281
282   if (!fOutputpostvTracSkip) {
283     fOutputpostvTracSkip = new TList();
284     fOutputpostvTracSkip->SetOwner();
285     fOutputpostvTracSkip->SetName("postvtracSkip");
286   }
287  
288   if (!fOutputnegtvTracRec) {
289     fOutputnegtvTracRec = new TList();
290     fOutputnegtvTracRec->SetOwner();
291     fOutputnegtvTracRec->SetName("negtvtracRe");
292   }
293
294   if (!fOutputnegtvTracSkip) {
295     fOutputnegtvTracSkip = new TList();
296     fOutputnegtvTracSkip->SetOwner();
297     fOutputnegtvTracSkip->SetName("negtvtracSkip");
298   }
299   
300   if (!fOutputpullAllpointSkip) {
301     fOutputpullAllpointSkip = new TList();
302     fOutputpullAllpointSkip->SetOwner();
303     fOutputpullAllpointSkip->SetName("pullAllpointSkip");
304   }
305   
306   if (!fOutputpullAllpointRec) {
307     fOutputpullAllpointRec = new TList();
308     fOutputpullAllpointRec->SetOwner();
309     fOutputpullAllpointRec->SetName("pullAllpointRec");
310   }
311   
312   if (!fOutputOnlyRefitRec) {
313     fOutputOnlyRefitRec = new TList();
314     fOutputOnlyRefitRec->SetOwner();
315     fOutputOnlyRefitRec->SetName("onlyRefitRec");
316   }
317   
318   if (!fOutputOnlyRefitSkip) {
319     fOutputOnlyRefitSkip = new TList();
320     fOutputOnlyRefitSkip->SetOwner();
321     fOutputOnlyRefitSkip->SetName("onlyRefitRec");
322   }
323   
324   if (!fOutputallPointTrue) {
325     fOutputallPointTrue = new TList();
326     fOutputallPointTrue->SetOwner();
327     fOutputallPointTrue->SetName("allpointTrue");
328   }
329   
330   if (!fOutputpostvTracTrue) {
331     fOutputpostvTracTrue = new TList();
332     fOutputpostvTracTrue->SetOwner();
333     fOutputpostvTracTrue->SetName("postvtracTrue");
334   }
335   
336   if (!fOutputnegtvTracTrue) {
337     fOutputnegtvTracTrue = new TList();
338     fOutputnegtvTracTrue->SetOwner();
339     fOutputnegtvTracTrue->SetName("negtvtracTrue");
340   }
341   
342   if (!fOutputpullAllpointTrue) {
343     fOutputpullAllpointTrue = new TList();
344     fOutputpullAllpointTrue->SetOwner();
345     fOutputpullAllpointTrue->SetName("pullAllpointTrue");
346   } 
347   
348   if (!fOutputclusterTypeSPD01Skip) {
349     fOutputclusterTypeSPD01Skip = new TList();
350     fOutputclusterTypeSPD01Skip->SetOwner();
351     fOutputclusterTypeSPD01Skip->SetName("clustertypeSPD01Skip");
352   }
353   
354   
355   if (!fOutputclusterTypeSPD02Skip) {
356     fOutputclusterTypeSPD02Skip = new TList();
357     fOutputclusterTypeSPD02Skip->SetOwner();
358     fOutputclusterTypeSPD02Skip->SetName("clustertypeSPD02Skip");
359   }
360   
361   if (!fOutputclusterTypeSPD03Skip) {
362     fOutputclusterTypeSPD03Skip = new TList();
363     fOutputclusterTypeSPD03Skip->SetOwner();
364     fOutputclusterTypeSPD03Skip->SetName("clustertypeSPD03Skip");
365   }
366   
367   if (!fOutputclusterTypeSPD11Skip) {
368     fOutputclusterTypeSPD11Skip = new TList();
369     fOutputclusterTypeSPD11Skip->SetOwner();
370     fOutputclusterTypeSPD11Skip->SetName("clustertypeSPD11Skip");
371   }
372   
373   if (!fOutputclusterTypeSPD12Skip) {
374     fOutputclusterTypeSPD12Skip = new TList();
375     fOutputclusterTypeSPD12Skip->SetOwner();
376     fOutputclusterTypeSPD12Skip->SetName("clustertypeSPD12Skip");
377   }
378   
379   if (!fOutputclusterTypeSPD13Skip) {
380     fOutputclusterTypeSPD13Skip = new TList();
381     fOutputclusterTypeSPD13Skip->SetOwner();
382     fOutputclusterTypeSPD13Skip->SetName("clustertypeSPD13Skip");
383   }
384   
385   if (!fOutputparticlePID) {
386     fOutputparticlePID = new TList();
387     fOutputparticlePID->SetOwner();
388     fOutputparticlePID->SetName("particlePID");
389   }
390  
391   if (!fOutputPt) {
392     fOutputPt = new TList();
393     fOutputPt->SetOwner();
394     fOutputPt->SetName("Pt");
395   }
396
397   const Int_t nhist=26;
398   const TString d0ITSpureSArphiTitle = "d_{0} Distribution_rphi; d_{0} [#mum]; Entries";
399   const TString d0ITSpureSAzTitle = "d_{0} Distribution_z; d_{0} [#mum]; Entries";
400   const TString d0allpointrphiTitle = "d_{0} Distribution_rphi; d_{0} [#mum]; Entries";
401   const TString d0allpointzTitle  = "d_{0} Distribution_z; d_{0} [#mum]; Entries";
402   const TString d0partpointrphiTitle = "d_{0} Distribution_rphi; d_{0} [#mum]; Entries";
403   const TString d0partpointzTitle  = "d_{0} Distribution_z; d_{0} [#mum]; Entries";
404   const TString d0onepointSPDrphiTitle = "d_{0} Distribution_rphi; d_{0} [#mum]; Entries";
405   const TString d0onepointSPDzTitle = "d_{0} Distribution_rphi; d_{0} [#mum]; Entries";
406   const TString d0postvtracrphiTitle = "d_{0} Distribution_rphi; d_{0} [#mum]; Entries";
407   const TString d0postvtraczTitle  = "d_{0} Distribution_z; d_{0} [#mum]; Entries";
408   const TString d0negtvtracrphiTitle = "d_{0} Distribution_rphi; d_{0} [#mum]; Entries";
409   const TString d0negtvtraczTitle  = "d_{0} Distribution_z; d_{0} [#mum]; Entries";
410   const TString d0pullAllpointrphiTitle = "d_{0} Pull Distribution_rphi; d_{0} pull; Entries";
411   const TString d0pullAllpointzTitle  = "d_{0} Pull Distribution_z; d_{0} pull; Entries";
412   const TString d0onlyRefitrphiTitle = "d_{0} Distribution_rphi; d_{0} [#mum]; Entries";
413   const TString d0onlyRefitzTitle  = "d_{0} Distribution_z; d_{0} [#mum]; Entries";
414   const TString d0ptTitle = "d_{0} Distribution_rphi; d_{0} [#mum]; Entries";
415   const TString d0clusterTypeSPD01rphiTitle = "d_{0} Distribution_rphi; d_{0} [#mum]; Entries";
416   const TString d0clusterTypeSPD01zTitle = "d_{0} Distribution_rphi; d_{0} [#mum]; Entries"; 
417   const TString d0clusterTypeSPD02rphiTitle = "d_{0} Distribution_rphi; d_{0} [#mum]; Entries";
418   const TString d0clusterTypeSPD02zTitle = "d_{0} Distribution_rphi; d_{0} [#mum]; Entries";
419   const TString d0clusterTypeSPD03rphiTitle = "d_{0} Distribution_rphi; d_{0} [#mum]; Entries";
420   const TString d0clusterTypeSPD03zTitle = "d_{0} Distribution_rphi; d_{0} [#mum]; Entries";
421   const TString d0clusterTypeSPD11rphiTitle = "d_{0} Distribution_rphi; d_{0} [#mum]; Entries";
422   const TString d0clusterTypeSPD11zTitle = "d_{0} Distribution_rphi; d_{0} [#mum]; Entries";
423   const TString d0clusterTypeSPD12rphiTitle = "d_{0} Distribution_rphi; d_{0} [#mum]; Entries";
424   const TString d0clusterTypeSPD12zTitle = "d_{0} Distribution_rphi; d_{0} [#mum]; Entries";
425   const TString d0clusterTypeSPD13rphiTitle = "d_{0} Distribution_rphi; d_{0} [#mum]; Entries";
426   const TString d0clusterTypeSPD13zTitle = "d_{0} Distribution_rphi; d_{0} [#mum]; Entries";
427   const TString d0rphiTitle = "d_{0} Distribution_rphi; d_{0} [#mum]; Entries";
428   const TString d0zTitle  = "d_{0} Distribution_z; d_{0} [#mum]; Entries";
429   const TString d0rphiParticlPID = "d_{0} Distribution_rphi; d_{0} [#mum]; Entries";
430   const TString d0zPrtilePID  = "d_{0} Distribution_z; d_{0} [#mum]; Entries";
431
432   TString  named0itspureSArphiRec,named0itspureSAzRec,named0allpointrphiRec, named0allpointzRec,named0partpointrphiRec, named0partpointzRec,named0onepointSPDrphiRec, named0onepointSPDzRec,named0postvtracrphiRec, named0postvtraczRec,named0negtvtracrphiRec, named0negtvtraczRec,named0pt,named0pullAllpointrphiRec,named0pullAllpointzRec,named0onlyRefitrphiRec,named0onlyRefitzRec,named0pionPIDrphiRec, named0pionPIDzRec,named0kaonPIDrphiRec, named0kaonPIDzRec,named0protonPIDrphiRec, named0protonPIDzRec;
433  
434   TH1F *d0ITSpureSArphiRec=0,*d0ITSpureSAzRec=0,*d0AllpointrphiRec=0, *d0AllpointzRec=0,*d0PartpointrphiRec=0, *d0PartpointzRec=0,
435     *d0OnepointSPDrphiRec=0,*d0OnepointSPDzRec=0,*d0PostvtracrphiRec=0, *d0PostvtraczRec=0,*d0NegtvtracrphiRec=0, *d0NegtvtraczRec=0,*d0Pt=0,*d0PullAllpointrphiRec=0,*d0PullAllpointzRec=0,*d0OnlyRefitrphiRec=0,*d0OnlyRefitzRec=0,*d0PionPIDrphiRec=0,*d0PionPIDzRec=0,*d0KaonPIDrphiRec=0,*d0KaonPIDzRec=0,*d0ProtonPIDrphiRec=0,*d0ProtonPIDzRec=0;
436
437   TString  named0itspureSArphiSkip,named0itspureSAzSkip,named0allpointrphiSkip, named0allpointzSkip,named0partpointrphiSkip, named0partpointzSkip,named0onepointSPDrphiSkip, named0onepointSPDzSkip,named0postvtracrphiSkip, named0postvtraczSkip,named0negtvtracrphiSkip, named0negtvtraczSkip,named0ptSkip,named0pullAllpointrphiSkip,named0pullAllpointzSkip,named0onlyRefitrphiSkip,named0onlyRefitzSkip,named0allpointrphiTrue, named0allpointzTrue,named0postvtracrphiTrue, named0postvtraczTrue,named0negtvtracrphiTrue, named0negtvtraczTrue,named0pullAllpointrphiTrue,named0pullAllpointzTrue,named0clusterTypeSPD01rphiSkip,named0clusterTypeSPD01zSkip,named0clusterTypeSPD02rphiSkip,named0clusterTypeSPD02zSkip,named0clusterTypeSPD03rphiSkip,named0clusterTypeSPD03zSkip,named0clusterTypeSPD11rphiSkip,named0clusterTypeSPD11zSkip,named0clusterTypeSPD12rphiSkip,named0clusterTypeSPD12zSkip,named0clusterTypeSPD13rphiSkip,named0clusterTypeSPD13zSkip,named0pionPIDrphiSkip, named0pionPIDzSkip,named0kaonPIDrphiSkip, named0kaonPIDzSkip,named0protonPIDrphiSkip, named0protonPIDzSkip;
438
439   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=0,*d0PullAllpointzSkip=0,*d0OnlyRefitrphiSkip=0,*d0OnlyRefitzSkip=0,*d0AllpointrphiTrue=0, *d0AllpointzTrue=0,*d0PostvtracrphiTrue=0, *d0PostvtraczTrue=0,*d0NegtvtracrphiTrue=0,*d0NegtvtraczTrue=0,*d0PullAllpointrphiTrue,*d0PullAllpointzTrue,*d0ClustertypeSPD01rphiSkip=0,*d0ClustertypeSPD01zSkip=0,*d0ClustertypeSPD02rphiSkip=0,*d0ClustertypeSPD02zSkip=0,*d0ClustertypeSPD03rphiSkip=0,*d0ClustertypeSPD03zSkip=0,*d0ClustertypeSPD11rphiSkip=0,*d0ClustertypeSPD11zSkip=0,*d0ClustertypeSPD12rphiSkip=0,*d0ClustertypeSPD12zSkip=0,*d0ClustertypeSPD13rphiSkip=0,*d0ClustertypeSPD13zSkip=0,*d0PionPIDrphiSkip=0,*d0PionPIDzSkip=0,*d0KaonPIDrphiSkip=0,*d0KaonPIDzSkip=0,*d0ProtonPIDrphiSkip=0,*d0ProtonPIDzSkip=0;
440
441   for(Int_t i=1; i<=nhist; i++) {
442    
443     named0itspureSArphiRec = "d0itspureSArphiRec_";
444     named0itspureSArphiRec += i;
445     named0itspureSAzRec = "d0itspureSAzRec_";
446     named0itspureSAzRec += i;
447     d0ITSpureSArphiRec = new TH1F(named0itspureSArphiRec.Data(), d0ITSpureSArphiTitle.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
448     d0ITSpureSArphiRec->Sumw2();
449     d0ITSpureSArphiRec->SetMinimum(0);  
450     fOutputitspureSARec->Add(d0ITSpureSArphiRec);
451     d0ITSpureSAzRec = new TH1F(named0itspureSAzRec.Data(), d0ITSpureSAzTitle.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
452     d0ITSpureSAzRec->Sumw2();
453     d0ITSpureSAzRec->SetMinimum(0);  
454     fOutputitspureSARec->Add(d0ITSpureSAzRec);
455
456     named0itspureSArphiSkip = "d0itspureSArphiSkip_";
457     named0itspureSArphiSkip += i;
458     named0itspureSAzSkip = "d0itspureSAzSkip_";
459     named0itspureSAzSkip += i;
460     d0ITSpureSArphiSkip = new TH1F(named0itspureSArphiSkip.Data(), d0ITSpureSArphiTitle.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));    d0ITSpureSArphiSkip->Sumw2();
461     d0ITSpureSArphiSkip->SetMinimum(0);  
462     fOutputitspureSASkip->Add(d0ITSpureSArphiSkip);
463     d0ITSpureSAzSkip = new TH1F(named0itspureSAzSkip.Data(), d0ITSpureSAzTitle.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
464     d0ITSpureSAzSkip->Sumw2();
465     d0ITSpureSAzSkip->SetMinimum(0);  
466     fOutputitspureSASkip->Add(d0ITSpureSAzSkip);
467
468     named0allpointrphiRec = "d0allpointrphiRec_";
469     named0allpointrphiRec += i;
470     named0allpointzRec = "d0allpointzRec_";
471     named0allpointzRec += i;
472     d0AllpointrphiRec = new TH1F(named0allpointrphiRec.Data(), d0allpointrphiTitle.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
473     d0AllpointrphiRec->Sumw2();
474     d0AllpointrphiRec->SetMinimum(0);  
475     fOutputallPointRec->Add(d0AllpointrphiRec);
476     d0AllpointzRec= new TH1F(named0allpointzRec.Data(), d0allpointzTitle.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
477     d0AllpointzRec->Sumw2();
478     d0AllpointzRec->SetMinimum(0);  
479     fOutputallPointRec->Add(d0AllpointzRec);
480
481     named0allpointrphiSkip = "d0allpointrphiSkip_";
482     named0allpointrphiSkip += i;
483     named0allpointzSkip = "d0allpointzSkip_";
484     named0allpointzSkip += i;
485     d0AllpointrphiSkip = new TH1F(named0allpointrphiSkip.Data(), d0allpointrphiTitle.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
486     d0AllpointrphiSkip->Sumw2();
487     d0AllpointrphiSkip->SetMinimum(0);  
488     fOutputallPointSkip->Add(d0AllpointrphiSkip);
489     d0AllpointzSkip = new TH1F(named0allpointzSkip.Data(), d0allpointzTitle.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
490     d0AllpointzSkip->Sumw2();
491     d0AllpointzSkip->SetMinimum(0);  
492     fOutputallPointSkip->Add(d0AllpointzSkip);
493
494     named0partpointrphiRec = "d0partpointrphiRec_";
495     named0partpointrphiRec += i;
496     named0partpointzRec = "d0partpointzRec_";
497     named0partpointzRec += i;
498     d0PartpointrphiRec = new TH1F(named0partpointrphiRec.Data(), d0partpointrphiTitle.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
499     d0PartpointrphiRec->Sumw2();
500     d0PartpointrphiRec->SetMinimum(0);  
501     fOutputpartPointRec->Add(d0PartpointrphiRec);
502     d0PartpointzRec = new TH1F(named0partpointzRec.Data(), d0partpointzTitle.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
503     d0PartpointzRec->Sumw2();
504     d0PartpointzRec->SetMinimum(0);  
505     fOutputpartPointRec->Add(d0PartpointzRec);
506
507     named0partpointrphiSkip = "d0partpointrphiSkip_";
508     named0partpointrphiSkip += i;
509     named0partpointzSkip = "d0partpointzSkip_";
510     named0partpointzSkip += i;
511     d0PartpointrphiSkip = new TH1F(named0partpointrphiSkip.Data(), d0partpointrphiTitle.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
512     d0PartpointrphiSkip->Sumw2();
513     d0PartpointrphiSkip->SetMinimum(0);  
514     fOutputpartPointSkip->Add(d0PartpointrphiSkip);
515     d0PartpointzSkip = new TH1F(named0partpointzSkip.Data(), d0partpointzTitle.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
516     d0PartpointzSkip->Sumw2();
517     d0PartpointzSkip->SetMinimum(0);  
518     fOutputpartPointSkip->Add(d0PartpointzSkip);
519
520     named0onepointSPDrphiRec = "d0onepointSPDrphiRec_";
521     named0onepointSPDrphiRec += i;
522     named0onepointSPDzRec = "d0onepointSPDzRec_";
523     named0onepointSPDzRec += i;
524     d0OnepointSPDrphiRec = new TH1F(named0onepointSPDrphiRec.Data(), d0onepointSPDrphiTitle.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
525     d0OnepointSPDrphiRec->Sumw2();
526     d0OnepointSPDrphiRec->SetMinimum(0);  
527     fOutputonepointSPDRec->Add(d0OnepointSPDrphiRec);
528     d0OnepointSPDzRec = new TH1F(named0onepointSPDzRec.Data(), d0onepointSPDzTitle.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
529     d0OnepointSPDzRec->Sumw2();
530     d0OnepointSPDzRec->SetMinimum(0);  
531     fOutputonepointSPDRec->Add(d0OnepointSPDzRec);
532
533     named0onepointSPDrphiSkip = "d0onepointSPDrphiSkip_";
534     named0onepointSPDrphiSkip += i;
535     named0onepointSPDzSkip = "d0onepointSPDzSkip_";
536     named0onepointSPDzSkip += i;
537     d0OnepointSPDrphiSkip = new TH1F(named0onepointSPDrphiSkip.Data(), d0onepointSPDrphiTitle.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
538     d0OnepointSPDrphiSkip->Sumw2();
539     d0OnepointSPDrphiSkip->SetMinimum(0);  
540     fOutputonepointSPDSkip->Add(d0OnepointSPDrphiSkip);
541     d0OnepointSPDzSkip = new TH1F(named0onepointSPDzSkip.Data(), d0onepointSPDzTitle.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
542     d0OnepointSPDzSkip->Sumw2();
543     d0OnepointSPDzSkip->SetMinimum(0);  
544     fOutputonepointSPDSkip->Add(d0OnepointSPDzSkip);
545
546     named0postvtracrphiRec = "d0postvtracrphiRec_";
547     named0postvtracrphiRec += i;
548     named0postvtraczRec = "d0postvtraczRec_";
549     named0postvtraczRec += i;
550     d0PostvtracrphiRec = new TH1F(named0postvtracrphiRec.Data(), d0postvtracrphiTitle.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
551     d0PostvtracrphiRec->Sumw2();
552     d0PostvtracrphiRec->SetMinimum(0);  
553     fOutputpostvTracRec->Add(d0PostvtracrphiRec);
554     d0PostvtraczRec = new TH1F(named0postvtraczRec.Data(), d0postvtraczTitle.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
555     d0PostvtraczRec->Sumw2();
556     d0PostvtraczRec->SetMinimum(0);  
557     fOutputpostvTracRec->Add(d0PostvtraczRec);
558
559     named0postvtracrphiSkip = "d0postvtracrphiSkip_";
560     named0postvtracrphiSkip += i;
561     named0postvtraczSkip = "d0postvtraczSkip_";
562     named0postvtraczSkip += i;
563     d0PostvtracrphiSkip = new TH1F(named0postvtracrphiSkip.Data(), d0postvtracrphiTitle.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
564     d0PostvtracrphiSkip->Sumw2();
565     d0PostvtracrphiSkip->SetMinimum(0);  
566     fOutputpostvTracSkip->Add(d0PostvtracrphiSkip);
567     d0PostvtraczSkip = new TH1F(named0postvtraczSkip.Data(), d0postvtraczTitle.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
568     d0PostvtraczSkip->Sumw2();
569     d0PostvtraczSkip->SetMinimum(0);  
570     fOutputpostvTracSkip->Add(d0PostvtraczSkip);
571
572     named0negtvtracrphiRec = "d0negtvtracrphiRec_";
573     named0negtvtracrphiRec += i;
574     named0negtvtraczRec = "d0negtvtraczRec_";
575     named0negtvtraczRec += i;
576     d0NegtvtracrphiRec = new TH1F(named0negtvtracrphiRec.Data(), d0negtvtracrphiTitle.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
577     d0NegtvtracrphiRec->Sumw2();
578     d0NegtvtracrphiRec->SetMinimum(0);  
579     fOutputnegtvTracRec->Add(d0NegtvtracrphiRec);
580     d0NegtvtraczRec = new TH1F(named0negtvtraczRec.Data(), d0negtvtraczTitle.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
581     d0NegtvtraczRec->Sumw2();
582     d0NegtvtraczRec->SetMinimum(0);  
583     fOutputnegtvTracRec->Add(d0NegtvtraczRec);
584
585     named0negtvtracrphiSkip = "d0negtvtracrphiSkip_";
586     named0negtvtracrphiSkip += i;
587     named0negtvtraczSkip = "d0negtvtraczSkip_";
588     named0negtvtraczSkip += i;
589     d0NegtvtracrphiSkip = new TH1F(named0negtvtracrphiSkip.Data(), d0negtvtracrphiTitle.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
590     d0NegtvtracrphiSkip->Sumw2();
591     d0NegtvtracrphiSkip->SetMinimum(0);  
592     fOutputnegtvTracSkip->Add(d0NegtvtracrphiSkip);
593     d0NegtvtraczSkip = new TH1F(named0negtvtraczSkip.Data(), d0negtvtraczTitle.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
594     d0NegtvtraczSkip->Sumw2();
595     d0NegtvtraczSkip->SetMinimum(0);  
596     fOutputnegtvTracSkip->Add(d0NegtvtraczSkip);
597
598     named0pullAllpointrphiSkip = "d0pullAllpointrphiSkip_";
599     named0pullAllpointrphiSkip +=i;
600     named0pullAllpointzSkip = "d0pullAllpointzSkip_";
601     named0pullAllpointzSkip +=i;
602     d0PullAllpointrphiSkip = new TH1F(named0pullAllpointrphiSkip.Data(),d0pullAllpointrphiTitle.Data(),400,-10.,10.);
603     d0PullAllpointrphiSkip->Sumw2();
604     d0PullAllpointrphiSkip->SetMinimum(0);
605     fOutputpullAllpointSkip->Add(d0PullAllpointrphiSkip);
606     d0PullAllpointzSkip = new TH1F(named0pullAllpointzSkip.Data(),d0pullAllpointzTitle.Data(),400,-10.,10.);
607     d0PullAllpointzSkip->Sumw2();
608     d0PullAllpointzSkip->SetMinimum(0);
609     fOutputpullAllpointSkip->Add(d0PullAllpointzSkip);
610
611     named0pullAllpointrphiRec = "d0pullAllpointrphiRec_";
612     named0pullAllpointrphiRec +=i;
613     named0pullAllpointzRec = "d0pullAllpointzRec_";
614     named0pullAllpointzRec +=i;
615     d0PullAllpointrphiRec = new TH1F(named0pullAllpointrphiRec.Data(),d0pullAllpointrphiTitle.Data(),400,-10.,10.);
616     d0PullAllpointrphiRec->Sumw2();
617     d0PullAllpointrphiRec->SetMinimum(0);
618     fOutputpullAllpointRec->Add(d0PullAllpointrphiRec);
619     d0PullAllpointzRec = new TH1F(named0pullAllpointzRec.Data(),d0pullAllpointzTitle.Data(),400,-10.,10.);
620     d0PullAllpointzRec->Sumw2();
621     d0PullAllpointzRec->SetMinimum(0);
622     fOutputpullAllpointRec->Add(d0PullAllpointzRec);
623
624     named0onlyRefitrphiRec = "d0onlyrefitrphiRec_";
625     named0onlyRefitrphiRec +=i;
626     named0onlyRefitzRec = "d0onlyrefitzRec_";
627     named0onlyRefitzRec +=i;
628     d0OnlyRefitrphiRec = new TH1F(named0onlyRefitrphiRec.Data(),d0onlyRefitrphiTitle.Data(),400,-Getd0HistRange(i),Getd0HistRange(i));
629     d0OnlyRefitrphiRec->Sumw2();
630     d0OnlyRefitrphiRec->SetMinimum(0);
631     fOutputOnlyRefitRec->Add(d0OnlyRefitrphiRec);
632     d0OnlyRefitzRec = new TH1F(named0onlyRefitzRec.Data(),d0onlyRefitzTitle.Data(),400,-Getd0HistRange(i),Getd0HistRange(i));
633     d0OnlyRefitzRec->Sumw2();
634     d0OnlyRefitzRec->SetMinimum(0);
635     fOutputOnlyRefitRec->Add(d0OnlyRefitzRec);
636
637     named0onlyRefitrphiSkip = "d0onlyrefitrphiSkip_";
638     named0onlyRefitrphiSkip +=i;
639     named0onlyRefitzSkip = "d0onlyrefitzSkip_";
640     named0onlyRefitzSkip +=i;
641     d0OnlyRefitrphiSkip = new TH1F(named0onlyRefitrphiSkip.Data(),d0onlyRefitrphiTitle.Data(),400,-Getd0HistRange(i),Getd0HistRange(i));
642     d0OnlyRefitrphiSkip->Sumw2();
643     d0OnlyRefitrphiSkip->SetMinimum(0);
644     fOutputOnlyRefitSkip->Add(d0OnlyRefitrphiSkip);
645     d0OnlyRefitzSkip = new TH1F(named0onlyRefitzSkip.Data(),d0onlyRefitzTitle.Data(),400,-Getd0HistRange(i),Getd0HistRange(i));
646     d0OnlyRefitzSkip->Sumw2();
647     d0OnlyRefitzSkip->SetMinimum(0);
648     fOutputOnlyRefitSkip->Add(d0OnlyRefitzSkip);
649
650     named0allpointrphiTrue = "d0allpointrphiTrue_";
651     named0allpointrphiTrue += i;
652     named0allpointzTrue = "d0allpointzTrue_";
653     named0allpointzTrue += i;
654     d0AllpointrphiTrue = new TH1F(named0allpointrphiTrue.Data(), d0allpointrphiTitle.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
655     d0AllpointrphiTrue->Sumw2();
656     d0AllpointrphiTrue->SetMinimum(0);  
657     fOutputallPointTrue->Add(d0AllpointrphiTrue);
658     d0AllpointzTrue = new TH1F(named0allpointzTrue.Data(), d0allpointzTitle.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
659     d0AllpointzTrue->Sumw2();
660     d0AllpointzTrue->SetMinimum(0);  
661     fOutputallPointTrue->Add(d0AllpointzTrue);
662
663     named0postvtracrphiTrue = "d0postvtracrphiTrue_";
664     named0postvtracrphiTrue += i;
665     named0postvtraczTrue = "d0postvtraczTrue_";
666     named0postvtraczTrue += i;
667     d0PostvtracrphiTrue = new TH1F(named0postvtracrphiTrue.Data(), d0postvtracrphiTitle.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
668     d0PostvtracrphiTrue->Sumw2();
669     d0PostvtracrphiTrue->SetMinimum(0);  
670     fOutputpostvTracTrue->Add(d0PostvtracrphiTrue);
671     d0PostvtraczTrue = new TH1F(named0postvtraczTrue.Data(), d0postvtraczTitle.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
672     d0PostvtraczTrue->Sumw2();
673     d0PostvtraczTrue->SetMinimum(0);  
674     fOutputpostvTracTrue->Add(d0PostvtraczTrue);
675
676     named0negtvtracrphiTrue = "d0negtvtracrphiTrue_";
677     named0negtvtracrphiTrue += i;
678     named0negtvtraczTrue = "d0negtvtraczTrue_";
679     named0negtvtraczTrue += i;
680     d0NegtvtracrphiTrue = new TH1F(named0negtvtracrphiTrue.Data(), d0negtvtracrphiTitle.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
681     d0NegtvtracrphiTrue->Sumw2();
682     d0NegtvtracrphiTrue->SetMinimum(0);  
683     fOutputnegtvTracTrue->Add(d0NegtvtracrphiTrue);
684     d0NegtvtraczTrue = new TH1F(named0negtvtraczTrue.Data(), d0negtvtraczTitle.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
685     d0NegtvtraczTrue->Sumw2();
686     d0NegtvtraczTrue->SetMinimum(0);  
687     fOutputnegtvTracTrue->Add(d0NegtvtraczTrue);
688
689     named0pullAllpointrphiTrue = "d0pullAllpointrphiTrue_";
690     named0pullAllpointrphiTrue +=i;
691     named0pullAllpointzTrue = "d0pullAllpointzTrue_";
692     named0pullAllpointzTrue +=i;
693     d0PullAllpointrphiTrue = new TH1F(named0pullAllpointrphiTrue.Data(),d0pullAllpointrphiTitle.Data(),400,-10.,10.);
694     d0PullAllpointrphiTrue->Sumw2();
695     d0PullAllpointrphiTrue->SetMinimum(0);
696     fOutputpullAllpointTrue->Add(d0PullAllpointrphiTrue);
697     d0PullAllpointzTrue = new TH1F(named0pullAllpointzTrue.Data(),d0pullAllpointzTitle.Data(),400,-10.,10.);
698     d0PullAllpointzTrue->Sumw2();
699     d0PullAllpointzTrue->SetMinimum(0);
700     fOutputpullAllpointTrue->Add(d0PullAllpointzTrue);
701
702     named0clusterTypeSPD01rphiSkip = "d0clustertypeSPD01rphiSkip_";
703     named0clusterTypeSPD01rphiSkip +=i;
704     named0clusterTypeSPD01zSkip = "d0clustertypeSPD01zSkip_";
705     named0clusterTypeSPD01zSkip +=i;
706     d0ClustertypeSPD01rphiSkip = new TH1F(named0clusterTypeSPD01rphiSkip.Data(),d0clusterTypeSPD01rphiTitle.Data(),400,-Getd0HistRange(i),Getd0HistRange(i));
707     d0ClustertypeSPD01rphiSkip->Sumw2();
708     d0ClustertypeSPD01rphiSkip->SetMinimum(0);
709     fOutputclusterTypeSPD01Skip->Add(d0ClustertypeSPD01rphiSkip);
710     d0ClustertypeSPD01zSkip = new TH1F(named0clusterTypeSPD01zSkip.Data(),d0clusterTypeSPD01zTitle.Data(),400,-Getd0HistRange(i),Getd0HistRange(i));
711     d0ClustertypeSPD01zSkip->Sumw2();
712     d0ClustertypeSPD01zSkip->SetMinimum(0);
713     fOutputclusterTypeSPD01Skip->Add(d0ClustertypeSPD01zSkip);
714
715     named0clusterTypeSPD02rphiSkip = "d0clustertypeSPD02rphiSkip_";
716     named0clusterTypeSPD02rphiSkip +=i;
717     named0clusterTypeSPD02zSkip = "d0clustertypeSPD02zSkip_";
718     named0clusterTypeSPD02zSkip +=i;
719     d0ClustertypeSPD02rphiSkip = new TH1F(named0clusterTypeSPD02rphiSkip.Data(),d0clusterTypeSPD02rphiTitle.Data(),400,-Getd0HistRange(i),Getd0HistRange(i));
720     d0ClustertypeSPD02rphiSkip->Sumw2();
721     d0ClustertypeSPD02rphiSkip->SetMinimum(0);
722     fOutputclusterTypeSPD02Skip->Add(d0ClustertypeSPD02rphiSkip);
723     d0ClustertypeSPD02zSkip = new TH1F(named0clusterTypeSPD02zSkip.Data(),d0clusterTypeSPD02zTitle.Data(),400,-Getd0HistRange(i),Getd0HistRange(i));
724     d0ClustertypeSPD02zSkip->Sumw2();
725     d0ClustertypeSPD02zSkip->SetMinimum(0);
726     fOutputclusterTypeSPD02Skip->Add(d0ClustertypeSPD02zSkip);
727
728     named0clusterTypeSPD03rphiSkip = "d0clustertypeSPD03rphiSkip_";
729     named0clusterTypeSPD03rphiSkip +=i;
730     named0clusterTypeSPD03zSkip = "d0clustertypeSPD03zSkip_";
731     named0clusterTypeSPD03zSkip +=i;
732     d0ClustertypeSPD03rphiSkip = new TH1F(named0clusterTypeSPD03rphiSkip.Data(),d0clusterTypeSPD03rphiTitle.Data(),400,-Getd0HistRange(i),Getd0HistRange(i));
733     d0ClustertypeSPD03rphiSkip->Sumw2();
734     d0ClustertypeSPD03rphiSkip->SetMinimum(0);
735     fOutputclusterTypeSPD03Skip->Add(d0ClustertypeSPD03rphiSkip);
736     d0ClustertypeSPD03zSkip = new TH1F(named0clusterTypeSPD03zSkip.Data(),d0clusterTypeSPD03zTitle.Data(),400,-Getd0HistRange(i),Getd0HistRange(i));
737     d0ClustertypeSPD03zSkip->Sumw2();
738     d0ClustertypeSPD03zSkip->SetMinimum(0);
739     fOutputclusterTypeSPD03Skip->Add(d0ClustertypeSPD03zSkip);
740
741     named0clusterTypeSPD11rphiSkip = "d0clustertypeSPD11rphiSkip_";
742     named0clusterTypeSPD11rphiSkip +=i;
743     named0clusterTypeSPD11zSkip = "d0clustertypeSPD11zSkip_";
744     named0clusterTypeSPD11zSkip +=i;
745     d0ClustertypeSPD11rphiSkip = new TH1F(named0clusterTypeSPD11rphiSkip.Data(),d0clusterTypeSPD11rphiTitle.Data(),400,-Getd0HistRange(i),Getd0HistRange(i));
746     d0ClustertypeSPD11rphiSkip->Sumw2();
747     d0ClustertypeSPD11rphiSkip->SetMinimum(0);
748     fOutputclusterTypeSPD11Skip->Add(d0ClustertypeSPD11rphiSkip);
749     d0ClustertypeSPD11zSkip = new TH1F(named0clusterTypeSPD11zSkip.Data(),d0clusterTypeSPD11zTitle.Data(),400,-Getd0HistRange(i),Getd0HistRange(i));
750     d0ClustertypeSPD11zSkip->Sumw2();
751     d0ClustertypeSPD11zSkip->SetMinimum(0);
752     fOutputclusterTypeSPD11Skip->Add(d0ClustertypeSPD11zSkip);
753
754     named0clusterTypeSPD12rphiSkip = "d0clustertypeSPD12rphiSkip_";
755     named0clusterTypeSPD12rphiSkip +=i;
756     named0clusterTypeSPD12zSkip = "d0clustertypeSPD12zSkip_";
757     named0clusterTypeSPD12zSkip +=i;
758     d0ClustertypeSPD12rphiSkip = new TH1F(named0clusterTypeSPD12rphiSkip.Data(),d0clusterTypeSPD12rphiTitle.Data(),400,-Getd0HistRange(i),Getd0HistRange(i));
759     d0ClustertypeSPD12rphiSkip->Sumw2();
760     d0ClustertypeSPD12rphiSkip->SetMinimum(0);
761     fOutputclusterTypeSPD12Skip->Add(d0ClustertypeSPD12rphiSkip);
762     d0ClustertypeSPD12zSkip = new TH1F(named0clusterTypeSPD12zSkip.Data(),d0clusterTypeSPD12zTitle.Data(),400,-Getd0HistRange(i),Getd0HistRange(i));
763     d0ClustertypeSPD12zSkip->Sumw2();
764     d0ClustertypeSPD12zSkip->SetMinimum(0);
765     fOutputclusterTypeSPD12Skip->Add(d0ClustertypeSPD12zSkip);
766
767     named0clusterTypeSPD13rphiSkip = "d0clustertypeSPD13rphiSkip_";
768     named0clusterTypeSPD13rphiSkip +=i;
769     named0clusterTypeSPD13zSkip = "d0clustertypeSPD13zSkip_";
770     named0clusterTypeSPD13zSkip +=i;
771     d0ClustertypeSPD13rphiSkip = new TH1F(named0clusterTypeSPD13rphiSkip.Data(),d0clusterTypeSPD13rphiTitle.Data(),400,-Getd0HistRange(i),Getd0HistRange(i));
772     d0ClustertypeSPD13rphiSkip->Sumw2();
773     d0ClustertypeSPD13rphiSkip->SetMinimum(0);
774     fOutputclusterTypeSPD13Skip->Add(d0ClustertypeSPD13rphiSkip);
775     d0ClustertypeSPD13zSkip = new TH1F(named0clusterTypeSPD13zSkip.Data(),d0clusterTypeSPD13zTitle.Data(),400,-Getd0HistRange(i),Getd0HistRange(i));
776     d0ClustertypeSPD13zSkip->Sumw2();
777     d0ClustertypeSPD13zSkip->SetMinimum(0);
778     fOutputclusterTypeSPD13Skip->Add(d0ClustertypeSPD13zSkip);
779
780     named0pionPIDrphiRec = "d0pionPIDrphiRec_";
781     named0pionPIDrphiRec += i;
782     named0pionPIDzRec = "d0pionPIDzRec_";
783     named0pionPIDzRec += i;
784     d0PionPIDrphiRec = new TH1F(named0pionPIDrphiRec.Data(), d0rphiParticlPID.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
785     d0PionPIDrphiRec->Sumw2();
786     d0PionPIDrphiRec->SetMinimum(0);  
787     fOutputparticlePID->Add(d0PionPIDrphiRec);
788     d0PionPIDzRec = new TH1F(named0pionPIDzRec.Data(), d0zPrtilePID.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
789     d0PionPIDzRec->Sumw2();
790     d0PionPIDzRec->SetMinimum(0);  
791     fOutputparticlePID->Add(d0PionPIDzRec);
792
793     named0pionPIDrphiSkip = "d0pionPIDrphiSkip_";
794     named0pionPIDrphiSkip += i;
795     named0pionPIDzSkip = "d0pionPIDzSkip_";
796     named0pionPIDzSkip += i;
797     d0PionPIDrphiSkip = new TH1F(named0pionPIDrphiSkip.Data(), d0rphiParticlPID.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
798     d0PionPIDrphiSkip->Sumw2();
799     d0PionPIDrphiSkip->SetMinimum(0);  
800     fOutputparticlePID->Add(d0PionPIDrphiSkip);
801     d0PionPIDzSkip = new TH1F(named0pionPIDzSkip.Data(), d0zPrtilePID.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
802     d0PionPIDzSkip->Sumw2();
803     d0PionPIDzSkip->SetMinimum(0);  
804     fOutputparticlePID->Add(d0PionPIDzSkip);
805
806     named0kaonPIDrphiRec = "d0kaonPIDrphiRec_";
807     named0kaonPIDrphiRec += i;
808     named0kaonPIDzRec = "d0kaonPIDzRec_";
809     named0kaonPIDzRec += i;
810     d0KaonPIDrphiRec = new TH1F(named0kaonPIDrphiRec.Data(), d0rphiParticlPID.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
811     d0KaonPIDrphiRec->Sumw2();
812     d0KaonPIDrphiRec->SetMinimum(0);  
813     fOutputparticlePID->Add(d0KaonPIDrphiRec);
814     d0KaonPIDzRec = new TH1F(named0kaonPIDzRec.Data(), d0zPrtilePID.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
815     d0KaonPIDzRec->Sumw2();
816     d0KaonPIDzRec->SetMinimum(0);  
817     fOutputparticlePID->Add(d0KaonPIDzRec);
818
819     named0kaonPIDrphiSkip = "d0kaonPIDrphiSkip_";
820     named0kaonPIDrphiSkip += i;
821     named0kaonPIDzSkip = "d0kaonPIDzSkip_";
822     named0kaonPIDzSkip += i;
823     d0KaonPIDrphiSkip = new TH1F(named0kaonPIDrphiSkip.Data(), d0rphiParticlPID.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
824     d0KaonPIDrphiSkip->Sumw2();
825     d0KaonPIDrphiSkip->SetMinimum(0);  
826     fOutputparticlePID->Add(d0KaonPIDrphiSkip);
827     d0KaonPIDzSkip = new TH1F(named0kaonPIDzSkip.Data(), d0zPrtilePID.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
828     d0KaonPIDzSkip->Sumw2();
829     d0KaonPIDzSkip->SetMinimum(0);  
830     fOutputparticlePID->Add(d0KaonPIDzSkip);
831
832     named0protonPIDrphiRec = "d0protonPIDrphiRec_";
833     named0protonPIDrphiRec += i;
834     named0protonPIDzRec = "d0protonPIDzRec_";
835     named0protonPIDzRec += i;
836     d0ProtonPIDrphiRec = new TH1F(named0protonPIDrphiRec.Data(), d0rphiParticlPID.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
837     d0ProtonPIDrphiRec->Sumw2();
838     d0ProtonPIDrphiRec->SetMinimum(0);  
839     fOutputparticlePID->Add(d0ProtonPIDrphiRec);
840     d0ProtonPIDzRec = new TH1F(named0protonPIDzRec.Data(), d0zPrtilePID.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
841     d0ProtonPIDzRec->Sumw2();
842     d0ProtonPIDzRec->SetMinimum(0);  
843     fOutputparticlePID->Add(d0ProtonPIDzRec);
844
845     named0protonPIDrphiSkip = "d0protonPIDrphiSkip_";
846     named0protonPIDrphiSkip += i;
847     named0protonPIDzSkip = "d0protonPIDzSkip_";
848     named0protonPIDzSkip += i;
849     d0ProtonPIDrphiSkip = new TH1F(named0protonPIDrphiSkip.Data(), d0rphiParticlPID.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
850     d0ProtonPIDrphiSkip->Sumw2();
851     d0ProtonPIDrphiSkip->SetMinimum(0);  
852     fOutputparticlePID->Add(d0ProtonPIDrphiSkip);
853     d0ProtonPIDzSkip = new TH1F(named0protonPIDzSkip.Data(), d0zPrtilePID.Data(), 400, -Getd0HistRange(i), Getd0HistRange(i));
854     d0ProtonPIDzSkip->Sumw2();
855     d0ProtonPIDzSkip->SetMinimum(0);  
856     fOutputparticlePID->Add(d0ProtonPIDzSkip);
857
858     named0pt = "d0pt_";
859     named0pt += i;
860     d0Pt = new TH1F(named0pt.Data(), d0ptTitle.Data(), 100, 0, 35.);
861     d0Pt->Sumw2();
862     d0Pt->SetMinimum(0);  
863     fOutputPt->Add(d0Pt);
864   }
865
866   
867   if (!fOutputSinThetaRec){
868     fOutputSinThetaRec = new TList();
869     fOutputSinThetaRec->SetOwner();
870     fOutputSinThetaRec->SetName("thetaRec");
871   }
872   
873   if (!fOutputSinThetaSkip){
874     fOutputSinThetaSkip = new TList();
875     fOutputSinThetaSkip->SetOwner();
876     fOutputSinThetaSkip->SetName("thetaSkip");
877   }
878   
879   if (!fOutputphiAllpointSkip) {
880     fOutputphiAllpointSkip = new TList();
881     fOutputphiAllpointSkip->SetOwner();
882     fOutputphiAllpointSkip->SetName("phiallpointSkip");
883   }
884   
885   if (!fOutputphiPostvtracSkip) {
886     fOutputphiPostvtracSkip = new TList();
887     fOutputphiPostvtracSkip->SetOwner();
888     fOutputphiPostvtracSkip->SetName("postvtracSkip");
889   }
890   
891   if (!fOutputphiNegtvtracSkip) {
892     fOutputphiNegtvtracSkip = new TList();
893     fOutputphiNegtvtracSkip->SetOwner();
894     fOutputphiNegtvtracSkip->SetName("negtvtracSkip");
895   }
896   
897   
898   const TString d0sinThetarphiTitle ="d_{0} Distribution_rphi; d_{0} [#mum]; Entries";
899   const TString d0sinThetazTitle ="d_{0} Distribution_z; d_{0} [#mum]; Entries";  
900   const TString d0phiAllpointrphiTitle = "d_{0} Distribution_rphi; d_{0} [#mum]; Entries";
901   const TString d0phiAllpointzTitle  = "d_{0} Distribution_z; d_{0} [#mum]; Entries";    
902   const TString  d0phiPostvtracrphiTitle = "d_{0} Distribution_rphi; d_{0} [#mum]; Entries";
903   const TString d0phiPostvtraczTitle  = "d_{0} Distribution_z; d_{0} [#mum]; Entries";  
904   const TString  d0phiNegtvtracrphiTitle = "d_{0} Distribution_rphi; d_{0} [#mum]; Entries";
905   const TString d0phiNegtvtraczTitle  = "d_{0} Distribution_z; d_{0} [#mum]; Entries";   
906   TString named0sinThetaonerphiRec,named0sinThetaonezRec,named0sinThetatworphiRec,named0sinThetatwozRec,named0sinThetathreerphiRec,named0sinThetathreezRec,named0sinThetafourrphiRec,named0sinThetafourzRec,named0thetaForwardrphiRec,named0thetaForwardzRec,named0thetaBackwardrphiRec,named0thetaBackwardzRec;
907   
908   TH1F *d0SinThetaonerphiRec,*d0SinThetaonezRec,*d0SinThetatworphiRec,*d0SinThetatwozRec,*d0SinThetathreerphiRec,*d0SinThetathreezRec,*d0SinThetafourrphiRec,*d0SinThetafourzRec,*d0ThetaforwardrphiRec,*d0ThetaforwardzRec,*d0ThetabackwardrphiRec,*d0ThetabackwardzRec;
909   
910   TString  named0sinThetaonerphiSkip,named0sinThetaonezSkip,named0sinThetatworphiSkip,named0sinThetatwozSkip,named0sinThetathreerphiSkip,named0sinThetathreezSkip,named0sinThetafourrphiSkip,named0sinThetafourzSkip,named0phiAllpointrphiSkip, named0phiAllpointzSkip,named0phiPostvtracrphiSkip, named0phiPostvtraczSkip,named0phiNegtvtracrphiSkip,named0phiNegtvtraczSkip,named0thetaForwardrphiSkip,named0thetaForwardzSkip,named0thetaBackwardrphiSkip,named0thetaBackwardzSkip;
911   
912   TH1F*d0SinThetaonerphiSkip,*d0SinThetaonezSkip,*d0SinThetatworphiSkip,*d0SinThetatwozSkip,*d0SinThetathreerphiSkip,*d0SinThetathreezSkip,*d0SinThetafourrphiSkip,*d0SinThetafourzSkip, *d0PhiAllpointrphiSkip,*d0PhiAllpointzSkip,*d0PhiPostvtracrphiSkip,*d0PhiPostvtraczSkip,*d0PhiNegtvtracrphiSkip,*d0PhiNegtvtraczSkip,*d0ThetaforwardrphiSkip,*d0ThetaforwardzSkip,*d0ThetabackwardrphiSkip,*d0ThetabackwardzSkip;
913   
914   const Int_t nhistm=10;
915   for(Int_t i=0; i<=nhistm; i++) {
916     named0sinThetaonerphiRec = "d0sinthetaonerphiRec_";
917     named0sinThetaonerphiRec += i;
918     named0sinThetaonezRec ="d0sinthetaonezRec_";
919     named0sinThetaonezRec += i;
920     d0SinThetaonerphiRec = new TH1F(named0sinThetaonerphiRec.Data(),d0sinThetarphiTitle.Data(),400,-2000,2000);
921     d0SinThetaonerphiRec->Sumw2();
922     d0SinThetaonerphiRec->SetMinimum(0);
923     fOutputSinThetaRec->Add(d0SinThetaonerphiRec);
924     d0SinThetaonezRec = new TH1F(named0sinThetaonezRec.Data(),d0sinThetazTitle.Data(),400,-2000,2000);
925     d0SinThetaonezRec->Sumw2();
926     d0SinThetaonezRec->SetMinimum(0);
927     fOutputSinThetaRec->Add(d0SinThetaonezRec);
928     
929     named0sinThetatworphiRec = "d0sinthetatworphiRec_";
930     named0sinThetatworphiRec += i;
931     named0sinThetatwozRec ="d0sinthetatwozRec_";
932     named0sinThetatwozRec += i;
933     d0SinThetatworphiRec = new TH1F(named0sinThetatworphiRec.Data(),d0sinThetarphiTitle.Data(),400,-2000,2000);
934     d0SinThetatworphiRec->Sumw2();
935     d0SinThetatworphiRec->SetMinimum(0);
936     fOutputSinThetaRec->Add(d0SinThetatworphiRec);
937     d0SinThetatwozRec = new TH1F(named0sinThetatwozRec.Data(),d0sinThetazTitle.Data(),400,-2000,2000);
938     d0SinThetatwozRec->Sumw2();
939     d0SinThetatwozRec->SetMinimum(0);
940     fOutputSinThetaRec->Add(d0SinThetatwozRec);
941     
942     named0sinThetathreerphiRec = "d0sinthetathreerphiRec_";
943     named0sinThetathreerphiRec += i;
944     named0sinThetathreezRec ="d0sinthetathreezRec_";
945     named0sinThetathreezRec += i;
946     
947     d0SinThetathreerphiRec = new TH1F(named0sinThetathreerphiRec.Data(),d0sinThetarphiTitle.Data(),400,-2000,2000);
948     d0SinThetathreerphiRec->Sumw2();
949     d0SinThetathreerphiRec->SetMinimum(0);
950     fOutputSinThetaRec->Add(d0SinThetathreerphiRec);
951     d0SinThetathreezRec = new TH1F(named0sinThetathreezRec.Data(),d0sinThetazTitle.Data(),400,-2000,2000);
952     d0SinThetathreezRec->Sumw2();
953     d0SinThetathreezRec->SetMinimum(0);
954     fOutputSinThetaRec->Add(d0SinThetathreezRec);
955     
956     named0sinThetafourrphiRec = "d0sinthetafourrphiRec_";
957     named0sinThetafourrphiRec += i;
958     named0sinThetafourzRec ="d0sinthetafourzRec_";
959     named0sinThetafourzRec += i;
960     d0SinThetafourrphiRec = new TH1F(named0sinThetafourrphiRec.Data(),d0sinThetarphiTitle.Data(),400,-2000,2000);
961     d0SinThetafourrphiRec->Sumw2();
962     d0SinThetafourrphiRec->SetMinimum(0);
963     fOutputSinThetaRec->Add(d0SinThetafourrphiRec);
964     d0SinThetafourzRec = new TH1F(named0sinThetafourzRec.Data(),d0sinThetazTitle.Data(),400,-2000,2000);
965     d0SinThetafourzRec->Sumw2();
966     d0SinThetafourzRec->SetMinimum(0);
967     fOutputSinThetaRec->Add(d0SinThetafourzRec);
968
969     named0thetaForwardrphiRec = "d0thetaforwardrphiRec_";
970     named0thetaForwardrphiRec += i;
971     named0thetaForwardzRec ="d0thetaforwardzRec_";
972     named0thetaForwardzRec += i;
973     d0ThetaforwardrphiRec = new TH1F(named0thetaForwardrphiRec.Data(),d0sinThetarphiTitle.Data(),400,-2000,2000);
974     d0ThetaforwardrphiRec->Sumw2();
975     d0ThetaforwardrphiRec->SetMinimum(0);
976     fOutputSinThetaRec->Add(d0ThetaforwardrphiRec);
977     d0ThetaforwardzRec = new TH1F(named0thetaForwardzRec.Data(),d0sinThetazTitle.Data(),400,-2000,2000);
978     d0ThetaforwardzRec->Sumw2();
979     d0ThetaforwardzRec->SetMinimum(0);
980     fOutputSinThetaRec->Add(d0ThetaforwardzRec);
981
982     named0thetaBackwardrphiRec = "d0thetabackwardrphiRec_";
983     named0thetaBackwardrphiRec += i;
984     named0thetaBackwardzRec ="d0thetabackwardzRec_";
985     named0thetaBackwardzRec += i;
986     d0ThetabackwardrphiRec = new TH1F(named0thetaBackwardrphiRec.Data(),d0sinThetarphiTitle.Data(),400,-2000,2000);
987     d0ThetabackwardrphiRec->Sumw2();
988     d0ThetabackwardrphiRec->SetMinimum(0);
989     fOutputSinThetaRec->Add(d0ThetabackwardrphiRec);
990     d0ThetabackwardzRec = new TH1F(named0thetaBackwardzRec.Data(),d0sinThetazTitle.Data(),400,-2000,2000);
991     d0ThetabackwardzRec->Sumw2();
992     d0ThetabackwardzRec->SetMinimum(0);
993     fOutputSinThetaRec->Add(d0ThetabackwardzRec);
994     
995     named0sinThetaonerphiSkip = "d0sinthetaonerphiSkip_";
996     named0sinThetaonerphiSkip += i;
997     named0sinThetaonezSkip ="d0sinthetaonezSkip_";
998     named0sinThetaonezSkip += i;
999     d0SinThetaonerphiSkip = new TH1F(named0sinThetaonerphiSkip.Data(),d0sinThetarphiTitle.Data(),400,-2000,2000);
1000     d0SinThetaonerphiSkip->Sumw2();
1001     d0SinThetaonerphiSkip->SetMinimum(0);
1002     fOutputSinThetaSkip->Add(d0SinThetaonerphiSkip);
1003     d0SinThetaonezSkip = new TH1F(named0sinThetaonezSkip.Data(),d0sinThetazTitle.Data(),400,-2000,2000);
1004     d0SinThetaonezSkip->Sumw2();
1005     d0SinThetaonezSkip->SetMinimum(0);
1006     fOutputSinThetaSkip->Add(d0SinThetaonezSkip);
1007     
1008     named0sinThetatworphiSkip = "d0sinthetatworphiSkip_";
1009     named0sinThetatworphiSkip += i;
1010     named0sinThetatwozSkip ="d0sinthetatwozSkip_";
1011     named0sinThetatwozSkip += i;
1012     d0SinThetatworphiSkip = new TH1F(named0sinThetatworphiSkip.Data(),d0sinThetarphiTitle.Data(),400,-2000,2000);
1013     d0SinThetatworphiSkip->Sumw2();
1014     d0SinThetatworphiSkip->SetMinimum(0);
1015     fOutputSinThetaSkip->Add(d0SinThetatworphiSkip);
1016     d0SinThetatwozSkip = new TH1F(named0sinThetatwozSkip.Data(),d0sinThetazTitle.Data(),400,-2000,2000);
1017     d0SinThetatwozSkip->Sumw2();
1018     d0SinThetatwozSkip->SetMinimum(0);
1019     fOutputSinThetaSkip->Add(d0SinThetatwozSkip);
1020     
1021     named0sinThetathreerphiSkip = "d0sinthetathreerphiSkip_";
1022     named0sinThetathreerphiSkip += i;
1023     named0sinThetathreezSkip ="d0sinthetathreezSkip_";
1024     named0sinThetathreezSkip += i;
1025     
1026     d0SinThetathreerphiSkip = new TH1F(named0sinThetathreerphiSkip.Data(),d0sinThetarphiTitle.Data(),400,-2000,2000);
1027     d0SinThetathreerphiSkip->Sumw2();
1028     d0SinThetathreerphiSkip->SetMinimum(0);
1029     fOutputSinThetaSkip->Add(d0SinThetathreerphiSkip);
1030     d0SinThetathreezSkip = new TH1F(named0sinThetathreezSkip.Data(),d0sinThetazTitle.Data(),400,-2000,2000);
1031     d0SinThetathreezSkip->Sumw2();
1032     d0SinThetathreezSkip->SetMinimum(0);
1033     fOutputSinThetaSkip->Add(d0SinThetathreezSkip);
1034     
1035     named0sinThetafourrphiSkip = "d0sinthetafourrphiSkip_";
1036     named0sinThetafourrphiSkip += i;
1037     named0sinThetafourzSkip ="d0sinthetafourzSkip_";
1038     named0sinThetafourzSkip += i;
1039     d0SinThetafourrphiSkip = new TH1F(named0sinThetafourrphiSkip.Data(),d0sinThetarphiTitle.Data(),400,-2000,2000);
1040     d0SinThetafourrphiSkip->Sumw2();
1041     d0SinThetafourrphiSkip->SetMinimum(0);
1042     fOutputSinThetaSkip->Add(d0SinThetafourrphiSkip);
1043     d0SinThetafourzSkip = new TH1F(named0sinThetafourzSkip.Data(),d0sinThetazTitle.Data(),400,-2000,2000);
1044     d0SinThetafourzSkip->Sumw2();
1045     d0SinThetafourzSkip->SetMinimum(0);
1046     fOutputSinThetaSkip->Add(d0SinThetafourzSkip);
1047
1048     named0thetaForwardrphiSkip = "d0thetaforwardrphiSkip_";
1049     named0thetaForwardrphiSkip += i;
1050     named0thetaForwardzSkip ="d0thetaforwardzSkip_";
1051     named0thetaForwardzSkip += i;
1052     d0ThetaforwardrphiSkip = new TH1F(named0thetaForwardrphiSkip.Data(),d0sinThetarphiTitle.Data(),400,-2000,2000);
1053     d0ThetaforwardrphiSkip->Sumw2();
1054     d0ThetaforwardrphiSkip->SetMinimum(0);
1055     fOutputSinThetaSkip->Add(d0ThetaforwardrphiSkip);
1056     d0ThetaforwardzSkip = new TH1F(named0thetaForwardzSkip.Data(),d0sinThetazTitle.Data(),400,-2000,2000);
1057     d0ThetaforwardzSkip->Sumw2();
1058     d0ThetaforwardzSkip->SetMinimum(0);
1059     fOutputSinThetaSkip->Add(d0ThetaforwardzSkip);
1060
1061     named0thetaBackwardrphiSkip = "d0thetabackwardrphiSkip_";
1062     named0thetaBackwardrphiSkip += i;
1063     named0thetaBackwardzSkip ="d0thetabackwardzSkip_";
1064     named0thetaBackwardzSkip += i;
1065     d0ThetabackwardrphiSkip = new TH1F(named0thetaBackwardrphiSkip.Data(),d0sinThetarphiTitle.Data(),400,-2000,2000);
1066     d0ThetabackwardrphiSkip->Sumw2();
1067     d0ThetabackwardrphiSkip->SetMinimum(0);
1068     fOutputSinThetaSkip->Add(d0ThetabackwardrphiSkip);
1069     d0ThetabackwardzSkip = new TH1F(named0thetaBackwardzSkip.Data(),d0sinThetazTitle.Data(),400,-2000,2000);
1070     d0ThetabackwardzSkip->Sumw2();
1071     d0ThetabackwardzSkip->SetMinimum(0);
1072     fOutputSinThetaSkip->Add(d0ThetabackwardzSkip);
1073
1074   }
1075
1076   const Int_t nhistphi=20;
1077   for(Int_t i=0; i<=nhistphi; i++) {
1078
1079     named0phiAllpointrphiSkip = "d0phiallpointrphiSkip_";
1080     named0phiAllpointrphiSkip += i;
1081     named0phiAllpointzSkip ="d0phiallpointzSkip_";
1082     named0phiAllpointzSkip += i;
1083     d0PhiAllpointrphiSkip = new TH1F(named0phiAllpointrphiSkip.Data(),d0phiAllpointrphiTitle.Data(),400,-2000,2000);
1084     d0PhiAllpointrphiSkip->Sumw2();
1085     d0PhiAllpointrphiSkip->SetMinimum(0);
1086     fOutputphiAllpointSkip->Add(d0PhiAllpointrphiSkip);
1087     d0PhiAllpointzSkip = new TH1F(named0phiAllpointzSkip.Data(),d0phiAllpointzTitle.Data(),400,-2000,2000);
1088     d0PhiAllpointzSkip->Sumw2();
1089     d0PhiAllpointzSkip->SetMinimum(0);
1090     fOutputphiAllpointSkip->Add(d0PhiAllpointzSkip);
1091
1092
1093     named0phiPostvtracrphiSkip = "d0phipostvtracrphiSkip_";
1094     named0phiPostvtracrphiSkip += i;
1095     named0phiPostvtraczSkip ="d0phipostvtraczSkip_";
1096     named0phiPostvtraczSkip += i;
1097     d0PhiPostvtracrphiSkip = new TH1F(named0phiPostvtracrphiSkip.Data(),d0phiPostvtracrphiTitle.Data(),400,-2000,2000);
1098     d0PhiPostvtracrphiSkip->Sumw2();
1099     d0PhiPostvtracrphiSkip->SetMinimum(0);
1100     fOutputphiPostvtracSkip->Add(d0PhiPostvtracrphiSkip);
1101     d0PhiPostvtraczSkip = new TH1F(named0phiPostvtraczSkip.Data(),d0phiPostvtraczTitle.Data(),400,-2000,2000);
1102     d0PhiPostvtraczSkip->Sumw2();
1103     d0PhiPostvtraczSkip->SetMinimum(0);
1104     fOutputphiPostvtracSkip->Add(d0PhiPostvtraczSkip);
1105
1106
1107     named0phiNegtvtracrphiSkip = "d0phinegtvtracrphiSkip_";
1108     named0phiNegtvtracrphiSkip += i;
1109     named0phiNegtvtraczSkip ="d0phinegtvtraczSkip_";
1110     named0phiNegtvtraczSkip += i;
1111     d0PhiNegtvtracrphiSkip = new TH1F(named0phiNegtvtracrphiSkip.Data(),d0phiNegtvtracrphiTitle.Data(),400,-2000,2000);
1112     d0PhiNegtvtracrphiSkip->Sumw2();
1113     d0PhiNegtvtracrphiSkip->SetMinimum(0);
1114     fOutputphiNegtvtracSkip->Add(d0PhiNegtvtracrphiSkip);
1115     d0PhiNegtvtraczSkip = new TH1F(named0phiNegtvtraczSkip.Data(),d0phiNegtvtraczTitle.Data(),400,-2000,2000);
1116     d0PhiNegtvtraczSkip->Sumw2();
1117     d0PhiNegtvtraczSkip->SetMinimum(0);
1118     fOutputphiNegtvtracSkip->Add(d0PhiNegtvtraczSkip);
1119   }
1120
1121   if(!fNentries) fNentries = new TH1F("hNentries", "number of entries", 26, 0., 40.);
1122   if(!fEstimVtx) fEstimVtx = new TH1F("vtxRes","Resolution of vertex",1000,-5000.,5000);
1123
1124   PostData(34,fNentries);
1125
1126   return;
1127 }
1128
1129 //________________________________________________________________________
1130 void AliAnalysisTaskSEImpParRes::UserExec(Option_t */*option*/)
1131 {
1132   //
1133   // Track selection and filling of d0 histograms
1134   //
1135   AliESDEvent *esd = dynamic_cast<AliESDEvent*>(InputEvent());
1136   if (!esd) {
1137     AliError("ESD event not found. Nothing done!");
1138     return;
1139   }
1140
1141   fNentries->Fill(1);
1142   
1143   // diamond constraint
1144   Float_t diamondcovxy[3];
1145   esd->GetDiamondCovXY(diamondcovxy);
1146   Double_t pos[3]={esd->GetDiamondX(),esd->GetDiamondY(),0.};
1147   Double_t cov[6]={diamondcovxy[0],diamondcovxy[1],diamondcovxy[2],0.,0.,10.};
1148   AliESDVertex diamond(pos,cov,1.,1);
1149   
1150   Double_t vtxTrue[3];
1151   AliStack *stack=0;
1152   AliESDVertex *vtxESDTrue=0;
1153   AliESDVertex *vtxESDSkip=0;
1154   AliESDVertex *vtxESDRec=0;  
1155
1156   // event primary vertex
1157   AliVertexerTracks vertexer0(esd->GetMagneticField());
1158   vertexer0.SetITSMode();
1159   vertexer0.SetMinClusters(4);  
1160   if(fUseDiamond) vertexer0.SetVtxStart(&diamond);
1161   vtxESDRec = (AliESDVertex*)vertexer0.FindPrimaryVertex(esd);
1162   if(vtxESDRec->GetNContributors()<1) {
1163     delete vtxESDRec; vtxESDRec=NULL;
1164     return;
1165   }
1166
1167   if (fReadMC) { 
1168     AliMCEventHandler *eventHandler = dynamic_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()); 
1169     if (!eventHandler) { 
1170       Printf("ERROR: Could not retrieve MC event handler"); 
1171       return; 
1172     } 
1173     
1174     AliMCEvent* mcEvent = eventHandler->MCEvent(); 
1175     if (!mcEvent) { 
1176       Printf("ERROR: Could not retrieve MC event"); 
1177       return; 
1178     } 
1179     
1180     stack = mcEvent->Stack(); 
1181     if (!stack) { 
1182       AliDebug(AliLog::kError, "Stack not available"); 
1183       return; 
1184     } 
1185
1186     //load MC header for ESD;//see $ALICE_ROOT/PWG1/global/AliAnalysisTaskSEVertexESD.cxx
1187     AliHeader *mcHeader = eventHandler->MCEvent()->Header();
1188     if (!mcHeader) {
1189       AliDebug(AliLog::kError, "Header not available");
1190       return;
1191     }
1192
1193     AliGenEventHeader* genHeader = mcHeader->GenEventHeader();   
1194     TArrayF mcVertex(3);
1195     mcVertex[0]=9999.; mcVertex[1]=9999.; mcVertex[2]=9999.;
1196     genHeader->PrimaryVertex(mcVertex);
1197     vtxTrue[0]=mcVertex[0];vtxTrue[1]=mcVertex[1];vtxTrue[2]=mcVertex[2];
1198     Double_t sigmaTrue[3]={0., 0., 0.,};
1199     //mcHeader->GetVertex(vtxTrue);//note the vtxTrue is void here,so must need the next line.
1200     //AliESDVertex *vtxESDTrue = new AliESDVertex(vtxTrue,sigmaTrue);
1201     vtxESDTrue = new AliESDVertex(vtxTrue,sigmaTrue);
1202   }
1203  
1204   Int_t nTrks = esd->GetNumberOfTracks();
1205   Double_t beampiperadius=3.;
1206   AliESDtrack *esdtrack = 0;
1207   Int_t pdgCode=0; 
1208   Int_t trkLabel;
1209   TParticle  *part =0;
1210   Int_t npointsITS=0,npointsSPD=0;
1211   Int_t ilayer;
1212   Int_t skipped[2];
1213   Double_t dzRec[2], covdzRec[3], dzRecSkip[2], covdzRecSkip[3],dzTrue[2], covdzTrue[3];
1214   Double_t pt;
1215   Int_t bin;
1216
1217   for (Int_t it=0; it<nTrks; it++) {  // loop over tracks
1218     // read track
1219     esdtrack = esd->GetTrack(it);
1220
1221     // ask for ITS refit
1222     if (!(esdtrack->GetStatus()&AliESDtrack::kITSrefit)) {
1223       continue;
1224     }
1225     
1226     pdgCode=0;
1227     if(fReadMC && stack) { 
1228       trkLabel = esdtrack->GetLabel(); 
1229       if(trkLabel<0) continue;
1230       part = (TParticle*)stack->Particle(trkLabel);
1231       pdgCode = TMath::Abs(part->GetPdgCode()); 
1232       //printf("pdgCode===%d\n", pdgCode);
1233       if(fSelectedPdg>0 && pdgCode!=fSelectedPdg) continue;
1234     }
1235
1236     npointsITS=0; npointsSPD=0;
1237     for (ilayer=0; ilayer<6; ilayer++){ 
1238       if (ilayer<2 && esdtrack->HasPointOnITSLayer(ilayer)) npointsSPD++;
1239       if (esdtrack->HasPointOnITSLayer(ilayer)) npointsITS++;  
1240     }
1241
1242     //Get specific primary vertex--Reconstructed primary vertex do not include the track considering.
1243     AliVertexerTracks vertexer(esd->GetMagneticField());
1244     vertexer.SetITSMode();
1245     vertexer.SetMinClusters(4);
1246     if(fUseDiamond) vertexer.SetVtxStart(&diamond);
1247     skipped[0] = (Int_t)esdtrack->GetID();
1248     vertexer.SetSkipTracks(1,skipped);      
1249     // create vertex with new!
1250     vtxESDSkip = (AliESDVertex*)vertexer.FindPrimaryVertex(esd);
1251     if(vtxESDSkip->GetNContributors()<1) {
1252       delete vtxESDSkip; vtxESDSkip=NULL;
1253       continue;
1254     }
1255
1256     //pt= esdtrack->P();
1257     pt = esdtrack->Pt();
1258     bin = PtBin(pt);
1259
1260     if(bin==-1) {
1261       delete vtxESDSkip; vtxESDSkip=NULL;
1262       continue;
1263     }
1264
1265    
1266     // Select primary particle if MC event (for ESD event), Rprod < 1 micron 
1267     if(fReadMC){
1268       if((part->Vx()-vtxTrue[0])*(part->Vx()-vtxTrue[0])+
1269          (part->Vy()-vtxTrue[1])*(part->Vy()-vtxTrue[1])
1270          > 0.0001*0.0001) {
1271         delete vtxESDSkip; vtxESDSkip=NULL;
1272         continue;
1273       }
1274     }
1275
1276     // compute impact patameters
1277     // wrt event vertex
1278     esdtrack->PropagateToDCA(vtxESDRec, esd->GetMagneticField(), beampiperadius, dzRec, covdzRec);
1279     // wrt event vertex without this track
1280     esdtrack->PropagateToDCA(vtxESDSkip, esd->GetMagneticField(), beampiperadius, dzRecSkip, covdzRecSkip);
1281     delete vtxESDSkip; vtxESDSkip=NULL; // not needed anymore
1282     // wrt MC vertex
1283     if(fReadMC) esdtrack->PropagateToDCA(vtxESDTrue, esd->GetMagneticField(), beampiperadius, dzTrue, covdzTrue);
1284
1285     if(covdzRec[0]<1.e-13 || covdzRec[2]<1.e-13 || covdzRecSkip[0]<1.e-13 || covdzRecSkip[2]<1.e-13) continue;
1286  
1287     if(fReadMC && (covdzTrue[0]<1.e-13 || covdzTrue[2]<1.e-13)) continue;
1288       
1289     //printf("Pt: %f GeV/c; Impact parameter: rphi %f cm  z %f cm\n", pt, dzRec[0], dzRec[1]);
1290
1291     /*
1292     // RUBEN'S METHOD, NOT FULLY IMPLEMENTED YET    
1293     Double_t      fIPCenIni[3], xyzDCA[3];
1294     for (int i=3;i--;) fIPCenIni[i] = 0.;
1295     //Int_t nTracks = nTrks - 1;
1296     esdtrack->GetXYZ(xyzDCA);
1297     //double pTrack = esdtrack->GetP();
1298     double phiTrack = esdtrack->Phi();
1299     double cs = TMath::Cos(phiTrack);
1300     double sn = TMath::Sin(phiTrack);
1301     double trDCA = (xyzDCA[0]-fIPCenIni[0])         *sn - (xyzDCA[1]-fIPCenIni[1])         *cs;  // track signed DCA to origin
1302     double vtDCA = (vtxESDSkip->GetXv()-fIPCenIni[0])*sn - (vtxESDSkip->GetYv()-fIPCenIni[1])*cs;  // vertex signed DCA to origin
1303     
1304     // update the estimator values
1305     //double estIP  = rvD*rtD;
1306     double estVtx = vtDCA*( vtDCA- trDCA);
1307     //double estTrc = rtD*(rtD - rvD);
1308     //
1309     //if (nTracks >= fMinTracksForIP) fEstimIP->Fill(phiTrack, estIP);
1310     fEstimVtx->Fill(10000*estVtx);
1311     //if (pTrack<1e-6) pTrack = GetTrackMinP()+1e6;
1312     //fEstimTrc->Fill(1./pTrack,estTrc);
1313     */
1314
1315
1316     //fill the histgram with all particle 
1317     //-------------------------------------------1----------------------------------------------
1318     
1319     /*
1320     TString named0AllrphiRec=" ",named0AllzRec =" ";//named0AllrphiTrue=" ",named0AllzTrue =" ";
1321       //named0AllrphiSkip=" ",named0AllzSkip =" ";
1322       
1323       named0AllrphiRec ="d0allrphiRec_";
1324       named0AllrphiRec += bin;
1325       named0AllzRec = "d0allzRec_";
1326       named0AllzRec += bin;
1327       ((TH1F*)(fOutputallRec->FindObject(named0AllrphiRec)))->Fill(10000*dzRec[0]);
1328       ((TH1F*)(fOutputallRec->FindObject(named0AllzRec)))->Fill(10000*dzRec[1]);
1329     */
1330
1331     //-------------------------------------------2----------------------------------------------
1332     //TSting named0AllrphiRec = "d0allrphiRec_" + bin;
1333     //TSting named0AllzRec = "d0allzRec_" + bin;
1334     //((TH1F*)(fOutputallRec->FindObject(named0AllrphiRec.Data())))->Fill(10000.*dzRec[0]);
1335     //((TH1F*)(fOutputallRec->FindObject(named0AllzRec.Data())))->Fill(10000.*dzRec[1]);
1336
1337     //-------------------------------------------3------------------------------------------------
1338
1339
1340     // ITS standalone
1341     if (!(esdtrack->GetStatus()&AliESDtrack::kTPCrefit) && 
1342          (esdtrack->GetStatus()&AliESDtrack::kITSpureSA)
1343         && npointsSPD>0 && npointsITS>=4) {
1344       char *named0ITSpureSArphiRec = Form("d0itspureSArphiRec_%d", bin);
1345       char *named0ITSpureSArphiSkip = Form("d0itspureSArphiSkip_%d", bin);
1346       char *named0ITSpureSAzRec = Form("d0itspureSAzRec_%d", bin); 
1347       char *named0ITSpureSAzSkip = Form("d0itspureSAzSkip_%d", bin); 
1348       ((TH1F*)(fOutputitspureSARec->FindObject(named0ITSpureSArphiRec)))->Fill(10000.*dzRec[0]);
1349       ((TH1F*)(fOutputitspureSARec->FindObject(named0ITSpureSAzRec)))->Fill(10000.*dzRec[1]);
1350       ((TH1F*)(fOutputitspureSASkip->FindObject(named0ITSpureSArphiSkip)))->Fill(10000.*dzRecSkip[0]);
1351       ((TH1F*)(fOutputitspureSASkip->FindObject(named0ITSpureSAzSkip)))->Fill(10000.*dzRecSkip[1]);
1352     }
1353
1354     
1355     // ask for TPC refit
1356     if (!(esdtrack->GetStatus()&AliESDtrack::kTPCrefit) || 
1357         esdtrack->GetNcls(1)<70) continue;
1358
1359     // only ITS and TPC refit
1360     char *named0OnlyrefitrphiRec = Form("d0onlyrefitrphiRec_%d", bin);
1361     char *named0OnlyrefitrphiSkip = Form("d0onlyrefitrphiSkip_%d", bin);
1362     char *named0OnlyrefitzRec = Form("d0onlyrefitzRec_%d", bin);
1363     char *named0OnlyrefitzSkip = Form("d0onlyrefitzSkip_%d", bin); 
1364     ((TH1F*)(fOutputOnlyRefitRec->FindObject(named0OnlyrefitrphiRec)))->Fill(10000.*dzRec[0]);
1365     ((TH1F*)(fOutputOnlyRefitRec->FindObject(named0OnlyrefitzRec)))->Fill(10000.*dzRec[1]);
1366     ((TH1F*)(fOutputOnlyRefitSkip->FindObject(named0OnlyrefitrphiSkip)))->Fill(10000.*dzRecSkip[0]);
1367     ((TH1F*)(fOutputOnlyRefitSkip->FindObject(named0OnlyrefitzSkip)))->Fill(10000.*dzRecSkip[1]);  
1368    
1369
1370     if(npointsITS>=4 && npointsSPD>0) {
1371       char *named0PartpointrphiRec = Form("d0partpointrphiRec_%d", bin);
1372       char *named0PartpointrphiSkip = Form("d0partpointrphiSkip_%d", bin);
1373       char *named0PartpointzRec = Form("d0partpointzRec_%d", bin); 
1374       char *named0PartpointzSkip = Form("d0partpointzSkip_%d", bin); 
1375       ((TH1F*)(fOutputpartPointRec->FindObject(named0PartpointrphiRec)))->Fill(10000.*dzRec[0]);
1376       ((TH1F*)(fOutputpartPointRec->FindObject(named0PartpointzRec)))->Fill(10000.*dzRec[1]);
1377       ((TH1F*)(fOutputpartPointSkip->FindObject(named0PartpointrphiSkip)))->Fill(10000.*dzRecSkip[0]);
1378       ((TH1F*)(fOutputpartPointSkip->FindObject(named0PartpointzSkip)))->Fill(10000.*dzRecSkip[1]);
1379     }
1380
1381     if(npointsSPD>0) {
1382       char *named0OnepointSPDrphiRec = Form("d0onepointSPDrphiRec_%d", bin);
1383       char *named0OnepointSPDrphiSkip = Form("d0onepointSPDrphiSkip_%d", bin);
1384       char *named0OnepointSPDzRec = Form("d0onepointSPDzRec_%d", bin); 
1385       char *named0OnepointSPDzSkip = Form("d0onepointSPDzSkip_%d", bin); 
1386       ((TH1F*)(fOutputonepointSPDRec->FindObject(named0OnepointSPDrphiRec)))->Fill(10000.*dzRec[0]);
1387       ((TH1F*)(fOutputonepointSPDRec->FindObject(named0OnepointSPDzRec)))->Fill(10000.*dzRec[1]);
1388       ((TH1F*)(fOutputonepointSPDSkip->FindObject(named0OnepointSPDrphiSkip)))->Fill(10000.*dzRecSkip[0]);
1389       ((TH1F*)(fOutputonepointSPDSkip->FindObject(named0OnepointSPDzSkip)))->Fill(10000.*dzRecSkip[1]);
1390     }
1391
1392     // with 6 ITS points (including different selection)
1393     if(npointsITS==6) {
1394       //pt 
1395       char *named0Pt = Form("d0pt_%d",bin);
1396       ((TH1F*)(fOutputPt->FindObject(named0Pt)))->Fill(pt);
1397      
1398       // allpoint
1399       char *named0AllpointrphiRec = Form("d0allpointrphiRec_%d", bin);
1400       char *named0AllpointrphiSkip = Form("d0allpointrphiSkip_%d", bin);
1401       char *named0AllpointrphiTrue = Form("d0allpointrphiTrue_%d", bin);
1402       char *named0AllpointzRec = Form("d0allpointzRec_%d", bin);
1403       char *named0AllpointzSkip = Form("d0allpointzSkip_%d", bin); 
1404       char *named0AllpointzTrue = Form("d0allpointzTrue_%d", bin);
1405       ((TH1F*)(fOutputallPointRec->FindObject(named0AllpointrphiRec)))->Fill(10000.*dzRec[0]);
1406       ((TH1F*)(fOutputallPointRec->FindObject(named0AllpointzRec)))->Fill(10000.*dzRec[1]);
1407       ((TH1F*)(fOutputallPointSkip->FindObject(named0AllpointrphiSkip)))->Fill(10000.*dzRecSkip[0]);
1408       ((TH1F*)(fOutputallPointSkip->FindObject(named0AllpointzSkip)))->Fill(10000.*dzRecSkip[1]);
1409       if(fReadMC) {
1410         ((TH1F*)(fOutputallPointTrue->FindObject(named0AllpointrphiTrue)))->Fill(10000.*dzTrue[0]);
1411         ((TH1F*)(fOutputallPointTrue->FindObject(named0AllpointzTrue)))->Fill(10000.*dzTrue[1]);
1412       }
1413       
1414       // pulls
1415       char *named0PullAllpointrphiRec = Form("d0pullAllpointrphiRec_%d", bin);
1416       char *named0PullAllpointrphiSkip = Form("d0pullAllpointrphiSkip_%d", bin);
1417       char *named0PullAllpointrphiTrue = Form("d0pullAllpointrphiTrue_%d", bin);
1418       char *named0PullAllpointzRec = Form("d0pullAllpointzRec_%d", bin);
1419       char *named0PullAllpointzSkip = Form("d0pullAllpointzSkip_%d", bin); 
1420       char *named0PullAllpointzTrue = Form("d0pullAllpointzTrue_%d", bin);
1421       ((TH1F*)(fOutputpullAllpointRec->FindObject(named0PullAllpointrphiRec)))->Fill(dzRec[0]/TMath::Sqrt(covdzRec[0]));     
1422       ((TH1F*)(fOutputpullAllpointRec->FindObject(named0PullAllpointzRec)))->Fill(dzRec[1]/TMath::Sqrt(covdzRec[2]));
1423       ((TH1F*)(fOutputpullAllpointSkip->FindObject(named0PullAllpointrphiSkip)))->Fill(dzRecSkip[0]/TMath::Sqrt(covdzRecSkip[0]));
1424       ((TH1F*)(fOutputpullAllpointSkip->FindObject(named0PullAllpointzSkip)))->Fill(dzRecSkip[1]/TMath::Sqrt(covdzRecSkip[2]));
1425       if(fReadMC) {
1426         ((TH1F*)(fOutputpullAllpointTrue->FindObject(named0PullAllpointrphiTrue)))->Fill(dzTrue[0]/TMath::Sqrt(covdzTrue[0]));
1427         ((TH1F*)(fOutputpullAllpointTrue->FindObject(named0PullAllpointzTrue)))->Fill(dzTrue[1]/TMath::Sqrt(covdzTrue[2]));
1428       }
1429       //postive and negative track
1430       //Short_t charge=esdtrack->Charge();
1431       Int_t pdgcode=TMath::Abs(pdgCode);
1432       Int_t charge=esdtrack->Charge();
1433       if(charge==1 && pdgcode==211) {
1434         char *named0PostvtracrphiRec = Form("d0postvtracrphiRec_%d", bin);
1435         char *named0PostvtracrphiSkip = Form("d0postvtracrphiSkip_%d", bin);
1436         char *named0PostvtracrphiTrue = Form("d0postvtracrphiTrue_%d", bin);
1437         char *named0PostvtraczRec = Form("d0postvtraczRec_%d", bin); 
1438         char *named0PostvtraczSkip = Form("d0postvtraczSkip_%d", bin);
1439         char *named0PostvtraczTrue = Form("d0postvtraczTrue_%d", bin);
1440         ((TH1F*)(fOutputpostvTracRec->FindObject(named0PostvtracrphiRec)))->Fill(10000.*dzRec[0]);
1441         ((TH1F*)(fOutputpostvTracRec->FindObject(named0PostvtraczRec)))->Fill(10000.*dzRec[1]);
1442         ((TH1F*)(fOutputpostvTracSkip->FindObject(named0PostvtracrphiSkip)))->Fill(10000.*dzRecSkip[0]);
1443         ((TH1F*)(fOutputpostvTracSkip->FindObject(named0PostvtraczSkip)))->Fill(10000.*dzRecSkip[1]);
1444         if(fReadMC) {
1445           ((TH1F*)(fOutputpostvTracTrue->FindObject(named0PostvtracrphiTrue)))->Fill(10000.*dzTrue[0]);
1446           ((TH1F*)(fOutputpostvTracTrue->FindObject(named0PostvtraczTrue)))->Fill(10000.*dzTrue[1]);
1447         }
1448       }
1449       
1450       if(charge==-1 && pdgcode==211 ) {
1451         char *named0NegtvtracrphiRec = Form("d0negtvtracrphiRec_%d", bin);
1452         char *named0NegtvtracrphiSkip = Form("d0negtvtracrphiSkip_%d", bin);
1453         char *named0NegtvtracrphiTrue = Form("d0negtvtracrphiTrue_%d", bin);
1454         char *named0NegtvtraczRec = Form("d0negtvtraczRec_%d", bin); 
1455         char *named0NegtvtraczSkip = Form("d0negtvtraczSkip_%d", bin);
1456         char *named0NegtvtraczTrue = Form("d0negtvtraczTrue_%d", bin);
1457         ((TH1F*)(fOutputnegtvTracRec->FindObject(named0NegtvtracrphiRec)))->Fill(10000.*dzRec[0]);
1458         ((TH1F*)(fOutputnegtvTracRec->FindObject(named0NegtvtraczRec)))->Fill(10000.*dzRec[1]);
1459         ((TH1F*)(fOutputnegtvTracSkip->FindObject(named0NegtvtracrphiSkip)))->Fill(10000.*dzRecSkip[0]);
1460         ((TH1F*)(fOutputnegtvTracSkip->FindObject(named0NegtvtraczSkip)))->Fill(10000.*dzRecSkip[1]);
1461         if(fReadMC) {
1462           ((TH1F*)(fOutputnegtvTracTrue->FindObject(named0NegtvtracrphiTrue)))->Fill(10000.*dzTrue[0]);
1463           ((TH1F*)(fOutputnegtvTracTrue->FindObject(named0NegtvtraczTrue)))->Fill(10000.*dzTrue[1]);    
1464         }    
1465       }
1466       
1467       // SinTheta 
1468       Double_t theta=esdtrack->Theta(); 
1469       Double_t Sintheta=TMath::Sin(theta);
1470       Double_t pi=TMath::Pi();
1471       Double_t halfpi=0.5*pi;
1472       Int_t thetabin = SinThetaBin(Sintheta);
1473       if(thetabin<0) continue;
1474       if(bin==4 && theta<halfpi){
1475         char *named0ThetaforwardrphiRec = Form("d0thetaforwardrphiRec_%d", thetabin);
1476         char *named0ThetaforwardzRec = Form("d0thetaforwardzRec_%d", thetabin);
1477         char *named0ThetaforwardrphiSkip = Form("d0thetaforwardrphiSkip_%d", thetabin);
1478         char *named0ThetaforwardzSkip = Form("d0thetaforwardzSkip_%d", thetabin);
1479         ((TH1F*)(fOutputSinThetaRec->FindObject(named0ThetaforwardrphiRec)))->Fill(10000*dzRec[0]);
1480         ((TH1F*)(fOutputSinThetaRec->FindObject(named0ThetaforwardzRec)))->Fill(10000*dzRec[1]);
1481         ((TH1F*)(fOutputSinThetaSkip->FindObject(named0ThetaforwardrphiSkip)))->Fill(10000*dzRecSkip[0]);
1482         ((TH1F*)(fOutputSinThetaSkip->FindObject(named0ThetaforwardzSkip)))->Fill(10000*dzRecSkip[1]);
1483       }
1484
1485       if(bin==4 && theta>halfpi){
1486         char *named0ThetabackwardrphiRec = Form("d0thetabackwardrphiRec_%d", thetabin);
1487         char *named0ThetabackwardzRec = Form("d0thetabackwardzRec_%d", thetabin);
1488         char *named0ThetabackwardrphiSkip = Form("d0thetabackwardrphiSkip_%d", thetabin);
1489         char *named0ThetabackwardzSkip = Form("d0thetabackwardzSkip_%d", thetabin);
1490         ((TH1F*)(fOutputSinThetaRec->FindObject(named0ThetabackwardrphiRec)))->Fill(10000*dzRec[0]);
1491         ((TH1F*)(fOutputSinThetaRec->FindObject(named0ThetabackwardzRec)))->Fill(10000*dzRec[1]);
1492         ((TH1F*)(fOutputSinThetaSkip->FindObject(named0ThetabackwardrphiSkip)))->Fill(10000*dzRecSkip[0]);
1493         ((TH1F*)(fOutputSinThetaSkip->FindObject(named0ThetabackwardzSkip)))->Fill(10000*dzRecSkip[1]);
1494       }
1495       
1496       if(bin==1) {
1497         char *named0SinthetaonerphiRec = Form("d0sinthetaonerphiRec_%d", thetabin);
1498         char *named0SinthetaonezRec = Form("d0sinthetaonezRec_%d", thetabin);
1499         char *named0SinthetaonerphiSkip = Form("d0sinthetaonerphiSkip_%d", thetabin);
1500         char *named0SinthetaonezSkip = Form("d0sinthetaonezSkip_%d", thetabin);
1501         ((TH1F*)(fOutputSinThetaRec->FindObject(named0SinthetaonerphiRec)))->Fill(10000*dzRec[0]);
1502         ((TH1F*)(fOutputSinThetaRec->FindObject(named0SinthetaonezRec)))->Fill(10000*dzRec[1]);
1503         ((TH1F*)(fOutputSinThetaSkip->FindObject(named0SinthetaonerphiSkip)))->Fill(10000*dzRecSkip[0]);
1504         ((TH1F*)(fOutputSinThetaSkip->FindObject(named0SinthetaonezSkip)))->Fill(10000*dzRecSkip[1]);
1505       }
1506       
1507       if(bin==5) {
1508         char *named0SinthetatworphiRec = Form("d0sinthetatworphiRec_%d", thetabin);
1509         char *named0SinthetatwozRec = Form("d0sinthetatwozRec_%d", thetabin);
1510         char *named0SinthetatworphiSkip = Form("d0sinthetatworphiSkip_%d", thetabin);
1511         char *named0SinthetatwozSkip = Form("d0sinthetatwozSkip_%d", thetabin);
1512         ((TH1F*)(fOutputSinThetaRec->FindObject(named0SinthetatworphiRec)))->Fill(10000*dzRec[0]);
1513         ((TH1F*)(fOutputSinThetaRec->FindObject(named0SinthetatwozRec)))->Fill(10000*dzRec[1]);
1514         ((TH1F*)(fOutputSinThetaSkip->FindObject(named0SinthetatworphiSkip)))->Fill(10000*dzRecSkip[0]);
1515         ((TH1F*)(fOutputSinThetaSkip->FindObject(named0SinthetatwozSkip)))->Fill(10000*dzRecSkip[1]);
1516       }
1517       
1518       if(bin==10) {
1519         char *named0SinthetathreerphiRec = Form("d0sinthetathreerphiRec_%d", thetabin);
1520         char *named0SinthetathreezRec = Form("d0sinthetathreezRec_%d", thetabin);
1521         char *named0SinthetathreerphiSkip = Form("d0sinthetathreerphiSkip_%d", thetabin);
1522         char *named0SinthetathreezSkip = Form("d0sinthetathreezSkip_%d", thetabin);
1523         ((TH1F*)(fOutputSinThetaRec->FindObject(named0SinthetathreerphiRec)))->Fill(10000*dzRec[0]);
1524         ((TH1F*)(fOutputSinThetaRec->FindObject(named0SinthetathreezRec)))->Fill(10000*dzRec[1]);
1525         ((TH1F*)(fOutputSinThetaSkip->FindObject(named0SinthetathreerphiSkip)))->Fill(10000*dzRecSkip[0]);
1526         ((TH1F*)(fOutputSinThetaSkip->FindObject(named0SinthetathreezSkip)))->Fill(10000*dzRecSkip[1]);
1527       }
1528       
1529       if(bin==15) {
1530         char *named0SinthetafourrphiRec = Form("d0sinthetafourrphiRec_%d", thetabin);
1531         char *named0SinthetafourzRec = Form("d0sinthetafourzRec_%d", thetabin);
1532         char *named0SinthetafourrphiSkip = Form("d0sinthetafourrphiSkip_%d", thetabin);
1533         char *named0SinthetafourzSkip = Form("d0sinthetafourzSkip_%d", thetabin);
1534         ((TH1F*)(fOutputSinThetaRec->FindObject(named0SinthetafourrphiRec)))->Fill(10000*dzRec[0]);
1535         ((TH1F*)(fOutputSinThetaRec->FindObject(named0SinthetafourzRec)))->Fill(10000*dzRec[1]);
1536         ((TH1F*)(fOutputSinThetaSkip->FindObject(named0SinthetafourrphiSkip)))->Fill(10000*dzRecSkip[0]);
1537         ((TH1F*)(fOutputSinThetaSkip->FindObject(named0SinthetafourzSkip)))->Fill(10000*dzRecSkip[1]);
1538       }
1539       
1540       //Phi
1541       Double_t phi=esdtrack->Phi(); 
1542       //Double_t pi=TMath::Pi();
1543       Int_t phibin=PhiBin(phi);
1544       if(phibin<0) continue;
1545       if(pt>0.34 && pt<0.5) {
1546         char *named0PhiallpointrphiSkip =Form("d0phiallpointrphiSkip_%d",phibin);
1547         char *named0PhiallpointzSkip = Form("d0phiallpointzSkip_%d",phibin);
1548         char *named0PhipostvtracrphiSkip =Form("d0phipostvtracrphiSkip_%d",phibin);
1549         char *named0PhipostvtraczSkip = Form("d0phipostvtraczSkip_%d",phibin);
1550         char *named0PhinegtvtracrphiSkip =Form("d0phinegtvtracrphiSkip_%d",phibin);
1551         char *named0PhinegtvtraczSkip = Form("d0phinegtvtraczSkip_%d",phibin);
1552         ((TH1F*)(fOutputphiAllpointSkip->FindObject(named0PhiallpointrphiSkip)))->Fill(10000*dzRecSkip[0]);
1553         ((TH1F*)(fOutputphiAllpointSkip->FindObject(named0PhiallpointzSkip)))->Fill(10000*dzRecSkip[1]);
1554         if(charge==+1) {
1555           ((TH1F*)(fOutputphiPostvtracSkip->FindObject(named0PhipostvtracrphiSkip)))->Fill(10000*dzRecSkip[0]);
1556           ((TH1F*)(fOutputphiPostvtracSkip->FindObject(named0PhipostvtraczSkip)))->Fill(10000*dzRecSkip[1]);
1557         } 
1558         if(charge==-1) {
1559           ((TH1F*)(fOutputphiNegtvtracSkip->FindObject(named0PhinegtvtracrphiSkip)))->Fill(10000*dzRecSkip[0]);
1560           ((TH1F*)(fOutputphiNegtvtracSkip->FindObject(named0PhinegtvtraczSkip)))->Fill(10000*dzRecSkip[1]);
1561         }
1562       }
1563
1564       //cluster type
1565       Int_t ctypeSPD0 = ClusterTypeOnITSLayer(esdtrack,0);
1566       if(ctypeSPD0==-1) continue;
1567       Int_t ctypeSPD1 = ClusterTypeOnITSLayer(esdtrack,1);
1568       if(ctypeSPD1==-1) continue;
1569
1570       if(ctypeSPD0==1) {
1571         char *named0ClustertypeSPD01rphiSkip = Form("d0clustertypeSPD01rphiSkip_%d",phibin);
1572         char *named0ClustertypeSPD01zSkip = Form("d0clustertypeSPD01rphiSkip_%d",phibin);
1573         ((TH1F*)(fOutputclusterTypeSPD01Skip->FindObject(named0ClustertypeSPD01rphiSkip)))->Fill(10000*dzRecSkip[0]);
1574         ((TH1F*)(fOutputclusterTypeSPD01Skip->FindObject(named0ClustertypeSPD01zSkip)))->Fill(10000*dzRecSkip[1]);
1575       }
1576       
1577       if(ctypeSPD0==2) {
1578         char *named0ClustertypeSPD02rphiSkip = Form("d0clustertypeSPD02rphiSkip_%d",phibin);
1579         char *named0ClustertypeSPD02zSkip = Form("d0clustertypeSPD02rphiSkip_%d",phibin);
1580         ((TH1F*)(fOutputclusterTypeSPD02Skip->FindObject(named0ClustertypeSPD02rphiSkip)))->Fill(10000*dzRecSkip[0]);
1581         ((TH1F*)(fOutputclusterTypeSPD02Skip->FindObject(named0ClustertypeSPD02zSkip)))->Fill(10000*dzRecSkip[1]);
1582       }
1583       
1584       if(ctypeSPD0==3) {
1585         char *named0ClustertypeSPD03rphiSkip = Form("d0clustertypeSPD03rphiSkip_%d",phibin);
1586         char *named0ClustertypeSPD03zSkip = Form("d0clustertypeSPD03zSkip_%d",phibin);
1587         ((TH1F*)(fOutputclusterTypeSPD03Skip->FindObject(named0ClustertypeSPD03rphiSkip)))->Fill(10000*dzRecSkip[0]);
1588         ((TH1F*)(fOutputclusterTypeSPD03Skip->FindObject(named0ClustertypeSPD03zSkip)))->Fill(10000*dzRecSkip[1]);
1589       }
1590       
1591       if(ctypeSPD1==1) {
1592         char *named0ClustertypeSPD11rphiSkip = Form("d0clustertypeSPD11rphiSkip_%d",phibin);
1593         char *named0ClustertypeSPD11zSkip = Form("d0clustertypeSPD11rphiSkip_%d",phibin);
1594         ((TH1F*)(fOutputclusterTypeSPD11Skip->FindObject(named0ClustertypeSPD11rphiSkip)))->Fill(10000*dzRecSkip[0]);
1595         ((TH1F*)(fOutputclusterTypeSPD11Skip->FindObject(named0ClustertypeSPD11zSkip)))->Fill(10000*dzRecSkip[1]);
1596       } 
1597       if(ctypeSPD1==2) {
1598         char *named0ClustertypeSPD12rphiSkip = Form("d0clustertypeSPD12rphiSkip_%d",phibin);
1599         char *named0ClustertypeSPD12zSkip = Form("d0clustertypeSPD12rphiSkip_%d",phibin);
1600         ((TH1F*)(fOutputclusterTypeSPD12Skip->FindObject(named0ClustertypeSPD12rphiSkip)))->Fill(10000*dzRecSkip[0]);
1601         ((TH1F*)(fOutputclusterTypeSPD12Skip->FindObject(named0ClustertypeSPD12zSkip)))->Fill(10000*dzRecSkip[1]);
1602       } 
1603       
1604       if(ctypeSPD1==3) {
1605         char *named0ClustertypeSPD13rphiSkip = Form("d0clustertypeSPD13rphiSkip_%d",phibin);
1606         char *named0ClustertypeSPD13zSkip = Form("d0clustertypeSPD13rphiSkip_%d",phibin);
1607         ((TH1F*)(fOutputclusterTypeSPD13Skip->FindObject(named0ClustertypeSPD13rphiSkip)))->Fill(10000*dzRecSkip[0]);
1608         ((TH1F*)(fOutputclusterTypeSPD13Skip->FindObject(named0ClustertypeSPD13zSkip)))->Fill(10000*dzRecSkip[1]);
1609       }  
1610      
1611       // Bayesian PID
1612       Double_t prob[AliPID::kSPECIES];
1613       esdtrack->GetESDpid(prob);
1614       Double_t priors[5] = {0.01, 0.01, 0.85, 0.10, 0.05};
1615       
1616       //Int_t charge = track->Charge();
1617       //Int_t esdPid = -1;
1618       
1619       AliPID pid;
1620       pid.SetPriors(priors);
1621       pid.SetProbabilities(prob);
1622       
1623       // identify particle as the most probable     
1624       Double_t pelectron = pid.GetProbability(AliPID::kElectron);
1625       Double_t pmuon = pid.GetProbability(AliPID::kMuon);
1626       Double_t ppion = pid.GetProbability(AliPID::kPion);
1627       Double_t pkaon = pid.GetProbability(AliPID::kKaon);
1628       Double_t pproton = pid.GetProbability(AliPID::kProton);  
1629   
1630       if (ppion > pelectron && 
1631           ppion >pmuon  && 
1632           ppion > pkaon && 
1633           ppion > pproton ) {
1634         //esdPid =-kPDGelectron;
1635         char *named0PionPIDrphiRec = Form("d0pionPIDrphiRec_%d", bin);
1636         char *named0PionPIDzRec = Form("d0pionPIDzRec_%d", bin);
1637         char *named0PionPIDrphiSkip = Form("d0pionPIDrphiSkip_%d", bin);
1638         char *named0PionPIDzSkip = Form("d0pionPIDzSkip_%d", bin);
1639         ((TH1F*)(fOutputparticlePID->FindObject(named0PionPIDrphiRec)))->Fill(10000.*dzRec[0]);
1640         ((TH1F*)(fOutputparticlePID->FindObject(named0PionPIDzRec)))->Fill(10000.*dzRec[1]);
1641         ((TH1F*)(fOutputparticlePID->FindObject(named0PionPIDrphiSkip)))->Fill(10000.*dzRecSkip[0]);
1642         ((TH1F*)(fOutputparticlePID->FindObject(named0PionPIDzSkip)))->Fill(10000.*dzRecSkip[1]);
1643       }
1644       
1645       
1646       if (pkaon > pelectron && 
1647           pkaon >pmuon  && 
1648           pkaon > ppion && 
1649           pkaon > pproton ) {
1650         //esdPid =-kPDGelectron;
1651         char *named0KaonPIDrphiRec = Form("d0kaonPIDrphiRec_%d", bin);
1652         char *named0KaonPIDzRec = Form("d0kaonPIDzRec_%d", bin);
1653         char *named0KaonPIDrphiSkip = Form("d0kaonPIDrphiSkip_%d", bin);
1654         char *named0KaonPIDzSkip = Form("d0kaonPIDzSkip_%d", bin);
1655         ((TH1F*)(fOutputparticlePID->FindObject(named0KaonPIDrphiRec)))->Fill(10000.*dzRec[0]);
1656         ((TH1F*)(fOutputparticlePID->FindObject(named0KaonPIDzRec)))->Fill(10000.*dzRec[1]);
1657         ((TH1F*)(fOutputparticlePID->FindObject(named0KaonPIDrphiSkip)))->Fill(10000.*dzRecSkip[0]);
1658         ((TH1F*)(fOutputparticlePID->FindObject(named0KaonPIDzSkip)))->Fill(10000.*dzRecSkip[1]);
1659       }
1660
1661
1662       if (pproton > pelectron && 
1663           pproton >pmuon  && 
1664           pproton > ppion && 
1665           pproton > pkaon ) {
1666         //esdPid =-kPDGelectron;
1667         //if(p<0.5 && fReadMC){fEstimVtx->Fill(pdgCode);}
1668         char *named0ProtonPIDrphiRec = Form("d0protonPIDrphiRec_%d", bin);
1669         char *named0ProtonPIDzRec = Form("d0protonPIDzRec_%d", bin);
1670         char *named0ProtonPIDrphiSkip = Form("d0protonPIDrphiSkip_%d", bin);
1671         char *named0ProtonPIDzSkip = Form("d0protonPIDzSkip_%d", bin);
1672         ((TH1F*)(fOutputparticlePID->FindObject(named0ProtonPIDrphiRec)))->Fill(10000.*dzRec[0]);
1673         ((TH1F*)(fOutputparticlePID->FindObject(named0ProtonPIDzRec)))->Fill(10000.*dzRec[1]);
1674         ((TH1F*)(fOutputparticlePID->FindObject(named0ProtonPIDrphiSkip)))->Fill(10000.*dzRecSkip[0]);
1675         ((TH1F*)(fOutputparticlePID->FindObject(named0ProtonPIDzSkip)))->Fill(10000.*dzRecSkip[1]);
1676       }
1677       
1678     }
1679
1680      
1681   }  // end loop of tracks
1682   
1683   if(vtxESDRec)  {delete vtxESDRec;  vtxESDRec=NULL;}
1684   if(vtxESDTrue) {delete vtxESDTrue; vtxESDTrue=NULL;}
1685   PostData(1, fOutputitspureSARec);
1686   PostData(2, fOutputitspureSASkip);
1687   PostData(3, fOutputallPointRec);
1688   PostData(4, fOutputallPointSkip);
1689   PostData(5, fOutputpartPointRec);
1690   PostData(6, fOutputpartPointSkip);
1691   PostData(7, fOutputonepointSPDRec);
1692   PostData(8, fOutputonepointSPDSkip);
1693   PostData(9, fOutputpostvTracRec);
1694   PostData(10, fOutputpostvTracSkip);
1695   PostData(11, fOutputnegtvTracRec);
1696   PostData(12, fOutputnegtvTracSkip);
1697   PostData(13, fOutputpullAllpointRec);
1698   PostData(14, fOutputpullAllpointSkip);
1699   PostData(15, fOutputOnlyRefitRec);
1700   PostData(16, fOutputOnlyRefitSkip);
1701   PostData(17, fOutputSinThetaRec);
1702   PostData(18, fOutputSinThetaSkip);
1703   PostData(19, fOutputallPointTrue);
1704   PostData(20, fOutputpostvTracTrue);
1705   PostData(21, fOutputnegtvTracTrue);
1706   PostData(22, fOutputpullAllpointTrue);
1707   PostData(23, fOutputphiAllpointSkip);
1708   PostData(24, fOutputphiPostvtracSkip);
1709   PostData(25, fOutputphiNegtvtracSkip);
1710   PostData(26, fOutputclusterTypeSPD01Skip);
1711   PostData(27, fOutputclusterTypeSPD02Skip);
1712   PostData(28, fOutputclusterTypeSPD03Skip);
1713   PostData(29, fOutputclusterTypeSPD11Skip);
1714   PostData(30, fOutputclusterTypeSPD12Skip);
1715   PostData(31, fOutputclusterTypeSPD13Skip);
1716   PostData(32, fOutputparticlePID);
1717   PostData(33, fOutputPt);
1718   PostData(34, fNentries);
1719   PostData(35, fEstimVtx);  
1720
1721   return;
1722 }
1723
1724 //________________________________________________________________________
1725 Int_t AliAnalysisTaskSEImpParRes::PtBin(Double_t pt) const {
1726   //
1727   // return the number of the pt bin
1728   //
1729
1730   if (pt>0.22 && pt<0.23) return 1;
1731   if (pt>0.26 && pt<0.27) return 2; 
1732   if (pt>0.345 && pt<0.355) return 3;
1733   if (pt>0.45 && pt<0.46) return 4; 
1734   if (pt>0.55 && pt<0.56) return 5;
1735   if (pt>0.65 && pt<0.66) return 6; 
1736   if (pt>0.75 && pt<0.76) return 7; 
1737   if (pt>0.85 && pt<0.865) return 8; 
1738   if (pt>1.05 && pt<1.07) return 9;
1739   if (pt>1.25 && pt<1.30) return 10; 
1740   if (pt>1.4 && pt<1.55) return 11; 
1741   if (pt>1.6 && pt<1.8) return 12; 
1742   if (pt>1.8 && pt<2.0) return 13; 
1743   if (pt>2.1 && pt<2.3) return 14; 
1744   if (pt>2.34 && pt<2.64) return 15; 
1745   if (pt>2.65 && pt<3.0) return 16; 
1746   if (pt>3.1 && pt<4.) return 17; 
1747   if (pt>4.1 && pt<5.2) return 18; 
1748   if (pt>5.3 && pt<6.8)  return 19; 
1749   if (pt>7.0 && pt<8.8) return 20; 
1750   if (pt>9. && pt<11.) return 21;
1751   if (pt>11.1 && pt<14.) return 22; 
1752   if (pt>14.1  && pt<17.)  return 23;
1753   if (pt>17.2  && pt<21.8) return 24; 
1754   if (pt>22.1  && pt<29.)  return 25;
1755   if (pt>29.05  && pt<35.)  return 26;
1756   /*
1757   if (pt>0.22 && pt<0.23) return 1 ;
1758   if (pt>0.26 && pt<0.27) return 2 ; 
1759   if (pt>0.35 && pt<0.36) return 3 ;
1760   if (pt>0.45 && pt<0.46) return 4 ; 
1761   if (pt>0.55 && pt<0.56) return 5 ;
1762   if (pt>0.65 && pt<0.66) return 6 ; 
1763   if (pt>0.75 && pt<0.76) return 7 ; 
1764   if (pt>0.85 && pt<0.86) return 8 ; 
1765   if (pt>1.05 && pt<1.06) return 9 ;
1766   if (pt>1.25 && pt<1.27) return 10; 
1767   if (pt>1.45 && pt<1.47) return 11; 
1768   if (pt>1.65 && pt<1.67) return 12; 
1769   if (pt>1.85 && pt<1.87) return 13; 
1770   if (pt>2.15 && pt<2.17) return 14; 
1771   if (pt>2.45 && pt<2.48) return 15; 
1772   if (pt>2.65 && pt<2.67) return 16; 
1773   if (pt>2.85 && pt<2.87) return 17; 
1774   if (pt>3.25 && pt<3.27) return 18; 
1775   if (pt>3.75 && pt<3.8)  return 19; 
1776   if (pt>4.15 && pt<4.20) return 20; 
1777   if (pt>4.95 && pt<5.15) return 21;
1778   if (pt>5.35 && pt<5.55) return 22; 
1779   if (pt>6.0  && pt<6.8)  return 23;
1780   if (pt>8.5  && pt<10.5) return 24; 
1781   if (pt>12.  && pt<19.)  return 25;
1782   if (pt>21.  && pt<32.)  return 26;
1783   */  
1784   return -1; 
1785 }
1786
1787 //________________________________________________________________________
1788 Double_t AliAnalysisTaskSEImpParRes::Getd0HistRange(Int_t i) const {
1789   //
1790   // Return the range of the d0 histograms for each pt bin
1791   //
1792   if (i==1) return  2500.; 
1793   if (i==2) return  1800.;
1794   if (i==3) return  1750.;
1795   if (i==4) return  1200.;
1796   if (i==5) return  1000.;
1797   if (i==6) return  900.;
1798   if (i==7) return  850.;
1799   if (i==8) return  700.;
1800   if (i==9) return  650.;
1801   if (i==10) return 600.;
1802   if (i==11) return 550.;
1803   if (i==12) return 500.;
1804   if (i==13) return 450.;
1805   if (i==14) return 400.;
1806   if (i==15) return 390.;
1807   if (i==16) return 380.;
1808   if (i==17) return 380.;
1809   if (i==18) return 350.;
1810   if (i==19) return 320.;
1811   if (i==20) return 300.;
1812   if (i==21) return 290.;
1813   if (i==22) return 270.;
1814   if (i==23) return 250.;
1815   if (i==24) return 270.;
1816   if (i==25) return 279.;
1817   if (i==26) return 270.;
1818
1819   return 2000.;
1820 }
1821
1822 //________________________________________________________________________
1823 Int_t AliAnalysisTaskSEImpParRes::SinThetaBin(Double_t sintheta) const {  
1824   //
1825   // Return the number of the sinTheta bin
1826   // 
1827   if(sintheta>0.7 && sintheta<0.73) return 1;
1828   if(sintheta>0.73 && sintheta<0.76) return 2; 
1829   if(sintheta>0.76 && sintheta<0.79) return 3; 
1830   if(sintheta>0.79 && sintheta<0.82) return 4;
1831   if(sintheta>0.82 && sintheta<0.85) return 5;       
1832   if(sintheta>0.85 && sintheta<0.88) return 6; 
1833   if(sintheta>0.88 && sintheta<0.91) return 7;
1834   if(sintheta>0.91 && sintheta<0.94) return 8;       
1835   if(sintheta>0.94 && sintheta<0.97) return 9; 
1836   if(sintheta>0.97 && sintheta<1.0) return 10;  
1837   return -1;
1838 }
1839
1840 //___________________________________________________________________________
1841 Int_t AliAnalysisTaskSEImpParRes::PhiBin(Double_t phi) const { 
1842   Double_t pi=TMath::Pi();
1843   if(phi>2.*pi || phi<0.) return -1;
1844   if(phi<0.1*pi) return 1;
1845   if(phi<0.2*pi) return 2;
1846   if(phi<0.3*pi) return 3;
1847   if(phi<0.4*pi) return 4;
1848   if(phi<0.5*pi) return 5;
1849   if(phi<0.6*pi) return 6;
1850   if(phi<0.7*pi) return 7;
1851   if(phi<0.8*pi) return 8;
1852   if(phi<0.9*pi) return 9;
1853   if(phi<1.0*pi) return 10;
1854   if(phi<1.1*pi) return 11;
1855   if(phi<1.2*pi) return 12;
1856   if(phi<1.3*pi) return 13;
1857   if(phi<1.4*pi) return 14;
1858   if(phi<1.5*pi) return 15;
1859   if(phi<1.6*pi) return 16;
1860   if(phi<1.7*pi) return 17;
1861   if(phi<1.8*pi) return 18;
1862   if(phi<1.9*pi) return 19;
1863   if(phi<2.0*pi) return 20;
1864   return -1;
1865 }
1866 //___________________________________________________________________________
1867 void AliAnalysisTaskSEImpParRes::Terminate(Option_t */*option*/) {
1868   //
1869   // Terminate analysis
1870   //
1871
1872   if (fDebug>1) printf("AnalysisTaskSEImpParRes: Terminate() \n");
1873
1874   return;
1875 }
1876 //__________________________________________________________________________
1877 Int_t AliAnalysisTaskSEImpParRes::ClusterTypeOnITSLayer(AliESDtrack *track,
1878                                                         Int_t layer) const {
1879 //
1880 // Returns cluster type on ITS layer. Returns -1 if no cluster on this layer
1881 //
1882   Int_t ctype=-1;
1883
1884   if(layer<0 || layer>5) return ctype;
1885   if(!track->HasPointOnITSLayer(layer)) return ctype;
1886   
1887   const AliTrackPointArray *array = track->GetTrackPointArray();
1888   if(!array) {
1889     printf("No tracks points avaialble: check ESDfriends\n");
1890     return ctype;
1891   }
1892   AliTrackPoint point;
1893   Int_t ipt,volId,modId,layerId;
1894   for(ipt=0; ipt<array->GetNPoints(); ipt++) {
1895     array->GetPoint(point,ipt);
1896     volId = point.GetVolumeID();
1897     if(volId<=0) continue;
1898     layerId = AliGeomManager::VolUIDToLayer(volId,modId);
1899     if(layerId==layer+1 && !point.IsExtra()) {
1900       ctype = point.GetClusterType();
1901       break;
1902     }
1903   }
1904   return ctype;
1905 }