Changes to run on PbPb events
[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
1144   Int_t nTrks = esd->GetNumberOfTracks();
1145   Bool_t highMult=(nTrks>500 ? kTRUE : kFALSE);
1146
1147
1148   
1149   // diamond constraint
1150   Float_t diamondcovxy[3];
1151   esd->GetDiamondCovXY(diamondcovxy);
1152   Double_t pos[3]={esd->GetDiamondX(),esd->GetDiamondY(),0.};
1153   Double_t cov[6]={diamondcovxy[0],diamondcovxy[1],diamondcovxy[2],0.,0.,10.};
1154   AliESDVertex diamond(pos,cov,1.,1);
1155   
1156   Double_t vtxTrue[3];
1157   AliStack *stack=0;
1158   AliESDVertex *vtxESDTrue=0;
1159   AliESDVertex *vtxESDSkip=0;
1160   AliESDVertex *vtxESDRec=0;  
1161
1162   // event primary vertex
1163   AliVertexerTracks vertexer0(esd->GetMagneticField());
1164   vertexer0.SetITSMode();
1165   vertexer0.SetMinClusters(4);  
1166   if(highMult) vertexer0.SetITSMode(0.1,0.1,0.5,5,1,3.,100.,1000.,3.,30.,1,1); 
1167   if(fUseDiamond) vertexer0.SetVtxStart(&diamond);
1168   vtxESDRec = (AliESDVertex*)vertexer0.FindPrimaryVertex(esd);
1169   if(vtxESDRec->GetNContributors()<1) {
1170     delete vtxESDRec; vtxESDRec=NULL;
1171     return;
1172   }
1173
1174   if (fReadMC) { 
1175     AliMCEventHandler *eventHandler = dynamic_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()); 
1176     if (!eventHandler) { 
1177       Printf("ERROR: Could not retrieve MC event handler"); 
1178       return; 
1179     } 
1180     
1181     AliMCEvent* mcEvent = eventHandler->MCEvent(); 
1182     if (!mcEvent) { 
1183       Printf("ERROR: Could not retrieve MC event"); 
1184       return; 
1185     } 
1186     
1187     stack = mcEvent->Stack(); 
1188     if (!stack) { 
1189       AliDebug(AliLog::kError, "Stack not available"); 
1190       return; 
1191     } 
1192
1193     //load MC header for ESD;//see $ALICE_ROOT/PWG1/global/AliAnalysisTaskSEVertexESD.cxx
1194     AliHeader *mcHeader = eventHandler->MCEvent()->Header();
1195     if (!mcHeader) {
1196       AliDebug(AliLog::kError, "Header not available");
1197       return;
1198     }
1199
1200     AliGenEventHeader* genHeader = mcHeader->GenEventHeader();   
1201     TArrayF mcVertex(3);
1202     mcVertex[0]=9999.; mcVertex[1]=9999.; mcVertex[2]=9999.;
1203     genHeader->PrimaryVertex(mcVertex);
1204     vtxTrue[0]=mcVertex[0];vtxTrue[1]=mcVertex[1];vtxTrue[2]=mcVertex[2];
1205     Double_t sigmaTrue[3]={0., 0., 0.,};
1206     //mcHeader->GetVertex(vtxTrue);//note the vtxTrue is void here,so must need the next line.
1207     //AliESDVertex *vtxESDTrue = new AliESDVertex(vtxTrue,sigmaTrue);
1208     vtxESDTrue = new AliESDVertex(vtxTrue,sigmaTrue);
1209   }
1210  
1211   Double_t beampiperadius=3.;
1212   AliESDtrack *esdtrack = 0;
1213   Int_t pdgCode=0; 
1214   Int_t trkLabel;
1215   TParticle  *part =0;
1216   Int_t npointsITS=0,npointsSPD=0;
1217   Int_t ilayer;
1218   Int_t skipped[2];
1219   Double_t dzRec[2], covdzRec[3], dzRecSkip[2], covdzRecSkip[3],dzTrue[2], covdzTrue[3];
1220   Double_t pt;
1221   Int_t bin;
1222
1223   for (Int_t it=0; it<nTrks; it++) {  // loop over tracks
1224     // read track
1225     esdtrack = esd->GetTrack(it);
1226
1227     // ask for ITS refit
1228     if (!(esdtrack->GetStatus()&AliESDtrack::kITSrefit)) {
1229       continue;
1230     }
1231     
1232     pdgCode=0;
1233     if(fReadMC && stack) { 
1234       trkLabel = esdtrack->GetLabel(); 
1235       if(trkLabel<0) continue;
1236       part = (TParticle*)stack->Particle(trkLabel);
1237       pdgCode = TMath::Abs(part->GetPdgCode()); 
1238       //printf("pdgCode===%d\n", pdgCode);
1239       if(fSelectedPdg>0 && pdgCode!=fSelectedPdg) continue;
1240     }
1241
1242     npointsITS=0; npointsSPD=0;
1243     for (ilayer=0; ilayer<6; ilayer++){ 
1244       if (ilayer<2 && esdtrack->HasPointOnITSLayer(ilayer)) npointsSPD++;
1245       if (esdtrack->HasPointOnITSLayer(ilayer)) npointsITS++;  
1246     }
1247
1248     //Get specific primary vertex--Reconstructed primary vertex do not include the track considering.
1249     AliVertexerTracks vertexer(esd->GetMagneticField());
1250     vertexer.SetITSMode();
1251     vertexer.SetMinClusters(4);
1252     if(fUseDiamond) vertexer.SetVtxStart(&diamond);
1253     skipped[0] = (Int_t)esdtrack->GetID();
1254     vertexer.SetSkipTracks(1,skipped);      
1255     // create vertex with new!
1256     if(!highMult) {
1257       vtxESDSkip = (AliESDVertex*)vertexer.FindPrimaryVertex(esd);
1258       if(vtxESDSkip->GetNContributors()<1) {
1259         delete vtxESDSkip; vtxESDSkip=NULL;
1260         continue;
1261       }
1262     } else {
1263       vtxESDSkip = new AliESDVertex(); // dummy
1264     }
1265
1266     //pt= esdtrack->P();
1267     pt = esdtrack->Pt();
1268     bin = PtBin(pt);
1269
1270     if(bin==-1) {
1271       delete vtxESDSkip; vtxESDSkip=NULL;
1272       continue;
1273     }
1274
1275    
1276     // Select primary particle if MC event (for ESD event), Rprod < 1 micron 
1277     if(fReadMC){
1278       if((part->Vx()-vtxTrue[0])*(part->Vx()-vtxTrue[0])+
1279          (part->Vy()-vtxTrue[1])*(part->Vy()-vtxTrue[1])
1280          > 0.0001*0.0001) {
1281         delete vtxESDSkip; vtxESDSkip=NULL;
1282         continue;
1283       }
1284     }
1285
1286     // compute impact patameters
1287     // wrt event vertex
1288     esdtrack->PropagateToDCA(vtxESDRec, esd->GetMagneticField(), beampiperadius, dzRec, covdzRec);
1289     // wrt event vertex without this track
1290     if(!highMult) {
1291       esdtrack->PropagateToDCA(vtxESDSkip, esd->GetMagneticField(), beampiperadius, dzRecSkip, covdzRecSkip);
1292     } else {
1293       dzRecSkip[0]=0.;dzRecSkip[1]=0.;
1294       covdzRecSkip[0]=1.;covdzRecSkip[1]=0.;covdzRecSkip[2]=1.;
1295     }
1296     delete vtxESDSkip; vtxESDSkip=NULL; // not needed anymore
1297     // wrt MC vertex
1298     if(fReadMC) esdtrack->PropagateToDCA(vtxESDTrue, esd->GetMagneticField(), beampiperadius, dzTrue, covdzTrue);
1299
1300     if(covdzRec[0]<1.e-13 || covdzRec[2]<1.e-13 || covdzRecSkip[0]<1.e-13 || covdzRecSkip[2]<1.e-13) continue;
1301  
1302     if(fReadMC && (covdzTrue[0]<1.e-13 || covdzTrue[2]<1.e-13)) continue;
1303       
1304     //printf("Pt: %f GeV/c; Impact parameter: rphi %f cm  z %f cm\n", pt, dzRec[0], dzRec[1]);
1305
1306     /*
1307     // RUBEN'S METHOD, NOT FULLY IMPLEMENTED YET    
1308     Double_t      fIPCenIni[3], xyzDCA[3];
1309     for (int i=3;i--;) fIPCenIni[i] = 0.;
1310     //Int_t nTracks = nTrks - 1;
1311     esdtrack->GetXYZ(xyzDCA);
1312     //double pTrack = esdtrack->GetP();
1313     double phiTrack = esdtrack->Phi();
1314     double cs = TMath::Cos(phiTrack);
1315     double sn = TMath::Sin(phiTrack);
1316     double trDCA = (xyzDCA[0]-fIPCenIni[0])         *sn - (xyzDCA[1]-fIPCenIni[1])         *cs;  // track signed DCA to origin
1317     double vtDCA = (vtxESDSkip->GetXv()-fIPCenIni[0])*sn - (vtxESDSkip->GetYv()-fIPCenIni[1])*cs;  // vertex signed DCA to origin
1318     
1319     // update the estimator values
1320     //double estIP  = rvD*rtD;
1321     double estVtx = vtDCA*( vtDCA- trDCA);
1322     //double estTrc = rtD*(rtD - rvD);
1323     //
1324     //if (nTracks >= fMinTracksForIP) fEstimIP->Fill(phiTrack, estIP);
1325     fEstimVtx->Fill(10000*estVtx);
1326     //if (pTrack<1e-6) pTrack = GetTrackMinP()+1e6;
1327     //fEstimTrc->Fill(1./pTrack,estTrc);
1328     */
1329
1330
1331     //fill the histgram with all particle 
1332     //-------------------------------------------1----------------------------------------------
1333     
1334     /*
1335     TString named0AllrphiRec=" ",named0AllzRec =" ";//named0AllrphiTrue=" ",named0AllzTrue =" ";
1336       //named0AllrphiSkip=" ",named0AllzSkip =" ";
1337       
1338       named0AllrphiRec ="d0allrphiRec_";
1339       named0AllrphiRec += bin;
1340       named0AllzRec = "d0allzRec_";
1341       named0AllzRec += bin;
1342       ((TH1F*)(fOutputallRec->FindObject(named0AllrphiRec)))->Fill(10000*dzRec[0]);
1343       ((TH1F*)(fOutputallRec->FindObject(named0AllzRec)))->Fill(10000*dzRec[1]);
1344     */
1345
1346     //-------------------------------------------2----------------------------------------------
1347     //TSting named0AllrphiRec = "d0allrphiRec_" + bin;
1348     //TSting named0AllzRec = "d0allzRec_" + bin;
1349     //((TH1F*)(fOutputallRec->FindObject(named0AllrphiRec.Data())))->Fill(10000.*dzRec[0]);
1350     //((TH1F*)(fOutputallRec->FindObject(named0AllzRec.Data())))->Fill(10000.*dzRec[1]);
1351
1352     //-------------------------------------------3------------------------------------------------
1353
1354
1355     // ITS standalone
1356     if (!(esdtrack->GetStatus()&AliESDtrack::kTPCrefit) && 
1357          (esdtrack->GetStatus()&AliESDtrack::kITSpureSA)
1358         && npointsSPD>0 && npointsITS>=4) {
1359       char *named0ITSpureSArphiRec = Form("d0itspureSArphiRec_%d", bin);
1360       char *named0ITSpureSArphiSkip = Form("d0itspureSArphiSkip_%d", bin);
1361       char *named0ITSpureSAzRec = Form("d0itspureSAzRec_%d", bin); 
1362       char *named0ITSpureSAzSkip = Form("d0itspureSAzSkip_%d", bin); 
1363       ((TH1F*)(fOutputitspureSARec->FindObject(named0ITSpureSArphiRec)))->Fill(10000.*dzRec[0]);
1364       ((TH1F*)(fOutputitspureSARec->FindObject(named0ITSpureSAzRec)))->Fill(10000.*dzRec[1]);
1365       ((TH1F*)(fOutputitspureSASkip->FindObject(named0ITSpureSArphiSkip)))->Fill(10000.*dzRecSkip[0]);
1366       ((TH1F*)(fOutputitspureSASkip->FindObject(named0ITSpureSAzSkip)))->Fill(10000.*dzRecSkip[1]);
1367     }
1368
1369     
1370     // ask for TPC refit
1371     if (!(esdtrack->GetStatus()&AliESDtrack::kTPCrefit) || 
1372         esdtrack->GetNcls(1)<70) continue;
1373
1374     // only ITS and TPC refit
1375     char *named0OnlyrefitrphiRec = Form("d0onlyrefitrphiRec_%d", bin);
1376     char *named0OnlyrefitrphiSkip = Form("d0onlyrefitrphiSkip_%d", bin);
1377     char *named0OnlyrefitzRec = Form("d0onlyrefitzRec_%d", bin);
1378     char *named0OnlyrefitzSkip = Form("d0onlyrefitzSkip_%d", bin); 
1379     ((TH1F*)(fOutputOnlyRefitRec->FindObject(named0OnlyrefitrphiRec)))->Fill(10000.*dzRec[0]);
1380     ((TH1F*)(fOutputOnlyRefitRec->FindObject(named0OnlyrefitzRec)))->Fill(10000.*dzRec[1]);
1381     ((TH1F*)(fOutputOnlyRefitSkip->FindObject(named0OnlyrefitrphiSkip)))->Fill(10000.*dzRecSkip[0]);
1382     ((TH1F*)(fOutputOnlyRefitSkip->FindObject(named0OnlyrefitzSkip)))->Fill(10000.*dzRecSkip[1]);  
1383    
1384
1385     if(npointsITS>=4 && npointsSPD>0) {
1386       char *named0PartpointrphiRec = Form("d0partpointrphiRec_%d", bin);
1387       char *named0PartpointrphiSkip = Form("d0partpointrphiSkip_%d", bin);
1388       char *named0PartpointzRec = Form("d0partpointzRec_%d", bin); 
1389       char *named0PartpointzSkip = Form("d0partpointzSkip_%d", bin); 
1390       ((TH1F*)(fOutputpartPointRec->FindObject(named0PartpointrphiRec)))->Fill(10000.*dzRec[0]);
1391       ((TH1F*)(fOutputpartPointRec->FindObject(named0PartpointzRec)))->Fill(10000.*dzRec[1]);
1392       ((TH1F*)(fOutputpartPointSkip->FindObject(named0PartpointrphiSkip)))->Fill(10000.*dzRecSkip[0]);
1393       ((TH1F*)(fOutputpartPointSkip->FindObject(named0PartpointzSkip)))->Fill(10000.*dzRecSkip[1]);
1394     }
1395
1396     if(npointsSPD>0) {
1397       char *named0OnepointSPDrphiRec = Form("d0onepointSPDrphiRec_%d", bin);
1398       char *named0OnepointSPDrphiSkip = Form("d0onepointSPDrphiSkip_%d", bin);
1399       char *named0OnepointSPDzRec = Form("d0onepointSPDzRec_%d", bin); 
1400       char *named0OnepointSPDzSkip = Form("d0onepointSPDzSkip_%d", bin); 
1401       ((TH1F*)(fOutputonepointSPDRec->FindObject(named0OnepointSPDrphiRec)))->Fill(10000.*dzRec[0]);
1402       ((TH1F*)(fOutputonepointSPDRec->FindObject(named0OnepointSPDzRec)))->Fill(10000.*dzRec[1]);
1403       ((TH1F*)(fOutputonepointSPDSkip->FindObject(named0OnepointSPDrphiSkip)))->Fill(10000.*dzRecSkip[0]);
1404       ((TH1F*)(fOutputonepointSPDSkip->FindObject(named0OnepointSPDzSkip)))->Fill(10000.*dzRecSkip[1]);
1405     }
1406
1407     // with 6 ITS points (including different selection)
1408     if(npointsITS==6) {
1409       //pt 
1410       char *named0Pt = Form("d0pt_%d",bin);
1411       ((TH1F*)(fOutputPt->FindObject(named0Pt)))->Fill(pt);
1412      
1413       // allpoint
1414       char *named0AllpointrphiRec = Form("d0allpointrphiRec_%d", bin);
1415       char *named0AllpointrphiSkip = Form("d0allpointrphiSkip_%d", bin);
1416       char *named0AllpointrphiTrue = Form("d0allpointrphiTrue_%d", bin);
1417       char *named0AllpointzRec = Form("d0allpointzRec_%d", bin);
1418       char *named0AllpointzSkip = Form("d0allpointzSkip_%d", bin); 
1419       char *named0AllpointzTrue = Form("d0allpointzTrue_%d", bin);
1420       ((TH1F*)(fOutputallPointRec->FindObject(named0AllpointrphiRec)))->Fill(10000.*dzRec[0]);
1421       ((TH1F*)(fOutputallPointRec->FindObject(named0AllpointzRec)))->Fill(10000.*dzRec[1]);
1422       ((TH1F*)(fOutputallPointSkip->FindObject(named0AllpointrphiSkip)))->Fill(10000.*dzRecSkip[0]);
1423       ((TH1F*)(fOutputallPointSkip->FindObject(named0AllpointzSkip)))->Fill(10000.*dzRecSkip[1]);
1424       if(fReadMC) {
1425         ((TH1F*)(fOutputallPointTrue->FindObject(named0AllpointrphiTrue)))->Fill(10000.*dzTrue[0]);
1426         ((TH1F*)(fOutputallPointTrue->FindObject(named0AllpointzTrue)))->Fill(10000.*dzTrue[1]);
1427       }
1428       
1429       // pulls
1430       char *named0PullAllpointrphiRec = Form("d0pullAllpointrphiRec_%d", bin);
1431       char *named0PullAllpointrphiSkip = Form("d0pullAllpointrphiSkip_%d", bin);
1432       char *named0PullAllpointrphiTrue = Form("d0pullAllpointrphiTrue_%d", bin);
1433       char *named0PullAllpointzRec = Form("d0pullAllpointzRec_%d", bin);
1434       char *named0PullAllpointzSkip = Form("d0pullAllpointzSkip_%d", bin); 
1435       char *named0PullAllpointzTrue = Form("d0pullAllpointzTrue_%d", bin);
1436       ((TH1F*)(fOutputpullAllpointRec->FindObject(named0PullAllpointrphiRec)))->Fill(dzRec[0]/TMath::Sqrt(covdzRec[0]));     
1437       ((TH1F*)(fOutputpullAllpointRec->FindObject(named0PullAllpointzRec)))->Fill(dzRec[1]/TMath::Sqrt(covdzRec[2]));
1438       ((TH1F*)(fOutputpullAllpointSkip->FindObject(named0PullAllpointrphiSkip)))->Fill(dzRecSkip[0]/TMath::Sqrt(covdzRecSkip[0]));
1439       ((TH1F*)(fOutputpullAllpointSkip->FindObject(named0PullAllpointzSkip)))->Fill(dzRecSkip[1]/TMath::Sqrt(covdzRecSkip[2]));
1440       if(fReadMC) {
1441         ((TH1F*)(fOutputpullAllpointTrue->FindObject(named0PullAllpointrphiTrue)))->Fill(dzTrue[0]/TMath::Sqrt(covdzTrue[0]));
1442         ((TH1F*)(fOutputpullAllpointTrue->FindObject(named0PullAllpointzTrue)))->Fill(dzTrue[1]/TMath::Sqrt(covdzTrue[2]));
1443       }
1444       //postive and negative track
1445       //Short_t charge=esdtrack->Charge();
1446       Int_t pdgcode=TMath::Abs(pdgCode);
1447       Int_t charge=esdtrack->Charge();
1448       if(charge==1 && pdgcode==211) {
1449         char *named0PostvtracrphiRec = Form("d0postvtracrphiRec_%d", bin);
1450         char *named0PostvtracrphiSkip = Form("d0postvtracrphiSkip_%d", bin);
1451         char *named0PostvtracrphiTrue = Form("d0postvtracrphiTrue_%d", bin);
1452         char *named0PostvtraczRec = Form("d0postvtraczRec_%d", bin); 
1453         char *named0PostvtraczSkip = Form("d0postvtraczSkip_%d", bin);
1454         char *named0PostvtraczTrue = Form("d0postvtraczTrue_%d", bin);
1455         ((TH1F*)(fOutputpostvTracRec->FindObject(named0PostvtracrphiRec)))->Fill(10000.*dzRec[0]);
1456         ((TH1F*)(fOutputpostvTracRec->FindObject(named0PostvtraczRec)))->Fill(10000.*dzRec[1]);
1457         ((TH1F*)(fOutputpostvTracSkip->FindObject(named0PostvtracrphiSkip)))->Fill(10000.*dzRecSkip[0]);
1458         ((TH1F*)(fOutputpostvTracSkip->FindObject(named0PostvtraczSkip)))->Fill(10000.*dzRecSkip[1]);
1459         if(fReadMC) {
1460           ((TH1F*)(fOutputpostvTracTrue->FindObject(named0PostvtracrphiTrue)))->Fill(10000.*dzTrue[0]);
1461           ((TH1F*)(fOutputpostvTracTrue->FindObject(named0PostvtraczTrue)))->Fill(10000.*dzTrue[1]);
1462         }
1463       }
1464       
1465       if(charge==-1 && pdgcode==211 ) {
1466         char *named0NegtvtracrphiRec = Form("d0negtvtracrphiRec_%d", bin);
1467         char *named0NegtvtracrphiSkip = Form("d0negtvtracrphiSkip_%d", bin);
1468         char *named0NegtvtracrphiTrue = Form("d0negtvtracrphiTrue_%d", bin);
1469         char *named0NegtvtraczRec = Form("d0negtvtraczRec_%d", bin); 
1470         char *named0NegtvtraczSkip = Form("d0negtvtraczSkip_%d", bin);
1471         char *named0NegtvtraczTrue = Form("d0negtvtraczTrue_%d", bin);
1472         ((TH1F*)(fOutputnegtvTracRec->FindObject(named0NegtvtracrphiRec)))->Fill(10000.*dzRec[0]);
1473         ((TH1F*)(fOutputnegtvTracRec->FindObject(named0NegtvtraczRec)))->Fill(10000.*dzRec[1]);
1474         ((TH1F*)(fOutputnegtvTracSkip->FindObject(named0NegtvtracrphiSkip)))->Fill(10000.*dzRecSkip[0]);
1475         ((TH1F*)(fOutputnegtvTracSkip->FindObject(named0NegtvtraczSkip)))->Fill(10000.*dzRecSkip[1]);
1476         if(fReadMC) {
1477           ((TH1F*)(fOutputnegtvTracTrue->FindObject(named0NegtvtracrphiTrue)))->Fill(10000.*dzTrue[0]);
1478           ((TH1F*)(fOutputnegtvTracTrue->FindObject(named0NegtvtraczTrue)))->Fill(10000.*dzTrue[1]);    
1479         }    
1480       }
1481       
1482       // SinTheta 
1483       Double_t theta=esdtrack->Theta(); 
1484       Double_t Sintheta=TMath::Sin(theta);
1485       Double_t pi=TMath::Pi();
1486       Double_t halfpi=0.5*pi;
1487       Int_t thetabin = SinThetaBin(Sintheta);
1488       if(thetabin<0) continue;
1489       if(bin==4 && theta<halfpi){
1490         char *named0ThetaforwardrphiRec = Form("d0thetaforwardrphiRec_%d", thetabin);
1491         char *named0ThetaforwardzRec = Form("d0thetaforwardzRec_%d", thetabin);
1492         char *named0ThetaforwardrphiSkip = Form("d0thetaforwardrphiSkip_%d", thetabin);
1493         char *named0ThetaforwardzSkip = Form("d0thetaforwardzSkip_%d", thetabin);
1494         ((TH1F*)(fOutputSinThetaRec->FindObject(named0ThetaforwardrphiRec)))->Fill(10000*dzRec[0]);
1495         ((TH1F*)(fOutputSinThetaRec->FindObject(named0ThetaforwardzRec)))->Fill(10000*dzRec[1]);
1496         ((TH1F*)(fOutputSinThetaSkip->FindObject(named0ThetaforwardrphiSkip)))->Fill(10000*dzRecSkip[0]);
1497         ((TH1F*)(fOutputSinThetaSkip->FindObject(named0ThetaforwardzSkip)))->Fill(10000*dzRecSkip[1]);
1498       }
1499
1500       if(bin==4 && theta>halfpi){
1501         char *named0ThetabackwardrphiRec = Form("d0thetabackwardrphiRec_%d", thetabin);
1502         char *named0ThetabackwardzRec = Form("d0thetabackwardzRec_%d", thetabin);
1503         char *named0ThetabackwardrphiSkip = Form("d0thetabackwardrphiSkip_%d", thetabin);
1504         char *named0ThetabackwardzSkip = Form("d0thetabackwardzSkip_%d", thetabin);
1505         ((TH1F*)(fOutputSinThetaRec->FindObject(named0ThetabackwardrphiRec)))->Fill(10000*dzRec[0]);
1506         ((TH1F*)(fOutputSinThetaRec->FindObject(named0ThetabackwardzRec)))->Fill(10000*dzRec[1]);
1507         ((TH1F*)(fOutputSinThetaSkip->FindObject(named0ThetabackwardrphiSkip)))->Fill(10000*dzRecSkip[0]);
1508         ((TH1F*)(fOutputSinThetaSkip->FindObject(named0ThetabackwardzSkip)))->Fill(10000*dzRecSkip[1]);
1509       }
1510       
1511       if(bin==1) {
1512         char *named0SinthetaonerphiRec = Form("d0sinthetaonerphiRec_%d", thetabin);
1513         char *named0SinthetaonezRec = Form("d0sinthetaonezRec_%d", thetabin);
1514         char *named0SinthetaonerphiSkip = Form("d0sinthetaonerphiSkip_%d", thetabin);
1515         char *named0SinthetaonezSkip = Form("d0sinthetaonezSkip_%d", thetabin);
1516         ((TH1F*)(fOutputSinThetaRec->FindObject(named0SinthetaonerphiRec)))->Fill(10000*dzRec[0]);
1517         ((TH1F*)(fOutputSinThetaRec->FindObject(named0SinthetaonezRec)))->Fill(10000*dzRec[1]);
1518         ((TH1F*)(fOutputSinThetaSkip->FindObject(named0SinthetaonerphiSkip)))->Fill(10000*dzRecSkip[0]);
1519         ((TH1F*)(fOutputSinThetaSkip->FindObject(named0SinthetaonezSkip)))->Fill(10000*dzRecSkip[1]);
1520       }
1521       
1522       if(bin==5) {
1523         char *named0SinthetatworphiRec = Form("d0sinthetatworphiRec_%d", thetabin);
1524         char *named0SinthetatwozRec = Form("d0sinthetatwozRec_%d", thetabin);
1525         char *named0SinthetatworphiSkip = Form("d0sinthetatworphiSkip_%d", thetabin);
1526         char *named0SinthetatwozSkip = Form("d0sinthetatwozSkip_%d", thetabin);
1527         ((TH1F*)(fOutputSinThetaRec->FindObject(named0SinthetatworphiRec)))->Fill(10000*dzRec[0]);
1528         ((TH1F*)(fOutputSinThetaRec->FindObject(named0SinthetatwozRec)))->Fill(10000*dzRec[1]);
1529         ((TH1F*)(fOutputSinThetaSkip->FindObject(named0SinthetatworphiSkip)))->Fill(10000*dzRecSkip[0]);
1530         ((TH1F*)(fOutputSinThetaSkip->FindObject(named0SinthetatwozSkip)))->Fill(10000*dzRecSkip[1]);
1531       }
1532       
1533       if(bin==10) {
1534         char *named0SinthetathreerphiRec = Form("d0sinthetathreerphiRec_%d", thetabin);
1535         char *named0SinthetathreezRec = Form("d0sinthetathreezRec_%d", thetabin);
1536         char *named0SinthetathreerphiSkip = Form("d0sinthetathreerphiSkip_%d", thetabin);
1537         char *named0SinthetathreezSkip = Form("d0sinthetathreezSkip_%d", thetabin);
1538         ((TH1F*)(fOutputSinThetaRec->FindObject(named0SinthetathreerphiRec)))->Fill(10000*dzRec[0]);
1539         ((TH1F*)(fOutputSinThetaRec->FindObject(named0SinthetathreezRec)))->Fill(10000*dzRec[1]);
1540         ((TH1F*)(fOutputSinThetaSkip->FindObject(named0SinthetathreerphiSkip)))->Fill(10000*dzRecSkip[0]);
1541         ((TH1F*)(fOutputSinThetaSkip->FindObject(named0SinthetathreezSkip)))->Fill(10000*dzRecSkip[1]);
1542       }
1543       
1544       if(bin==15) {
1545         char *named0SinthetafourrphiRec = Form("d0sinthetafourrphiRec_%d", thetabin);
1546         char *named0SinthetafourzRec = Form("d0sinthetafourzRec_%d", thetabin);
1547         char *named0SinthetafourrphiSkip = Form("d0sinthetafourrphiSkip_%d", thetabin);
1548         char *named0SinthetafourzSkip = Form("d0sinthetafourzSkip_%d", thetabin);
1549         ((TH1F*)(fOutputSinThetaRec->FindObject(named0SinthetafourrphiRec)))->Fill(10000*dzRec[0]);
1550         ((TH1F*)(fOutputSinThetaRec->FindObject(named0SinthetafourzRec)))->Fill(10000*dzRec[1]);
1551         ((TH1F*)(fOutputSinThetaSkip->FindObject(named0SinthetafourrphiSkip)))->Fill(10000*dzRecSkip[0]);
1552         ((TH1F*)(fOutputSinThetaSkip->FindObject(named0SinthetafourzSkip)))->Fill(10000*dzRecSkip[1]);
1553       }
1554       
1555       //Phi
1556       Double_t phi=esdtrack->Phi(); 
1557       //Double_t pi=TMath::Pi();
1558       Int_t phibin=PhiBin(phi);
1559       if(phibin<0) continue;
1560       if(pt>0.34 && pt<0.5) {
1561         char *named0PhiallpointrphiSkip =Form("d0phiallpointrphiSkip_%d",phibin);
1562         char *named0PhiallpointzSkip = Form("d0phiallpointzSkip_%d",phibin);
1563         char *named0PhipostvtracrphiSkip =Form("d0phipostvtracrphiSkip_%d",phibin);
1564         char *named0PhipostvtraczSkip = Form("d0phipostvtraczSkip_%d",phibin);
1565         char *named0PhinegtvtracrphiSkip =Form("d0phinegtvtracrphiSkip_%d",phibin);
1566         char *named0PhinegtvtraczSkip = Form("d0phinegtvtraczSkip_%d",phibin);
1567         ((TH1F*)(fOutputphiAllpointSkip->FindObject(named0PhiallpointrphiSkip)))->Fill(10000*dzRecSkip[0]);
1568         ((TH1F*)(fOutputphiAllpointSkip->FindObject(named0PhiallpointzSkip)))->Fill(10000*dzRecSkip[1]);
1569         if(charge==+1) {
1570           ((TH1F*)(fOutputphiPostvtracSkip->FindObject(named0PhipostvtracrphiSkip)))->Fill(10000*dzRecSkip[0]);
1571           ((TH1F*)(fOutputphiPostvtracSkip->FindObject(named0PhipostvtraczSkip)))->Fill(10000*dzRecSkip[1]);
1572         } 
1573         if(charge==-1) {
1574           ((TH1F*)(fOutputphiNegtvtracSkip->FindObject(named0PhinegtvtracrphiSkip)))->Fill(10000*dzRecSkip[0]);
1575           ((TH1F*)(fOutputphiNegtvtracSkip->FindObject(named0PhinegtvtraczSkip)))->Fill(10000*dzRecSkip[1]);
1576         }
1577       }
1578
1579       //cluster type
1580       Int_t ctypeSPD0 = ClusterTypeOnITSLayer(esdtrack,0);
1581       if(ctypeSPD0==-1) continue;
1582       Int_t ctypeSPD1 = ClusterTypeOnITSLayer(esdtrack,1);
1583       if(ctypeSPD1==-1) continue;
1584
1585       if(ctypeSPD0==1) {
1586         char *named0ClustertypeSPD01rphiSkip = Form("d0clustertypeSPD01rphiSkip_%d",phibin);
1587         char *named0ClustertypeSPD01zSkip = Form("d0clustertypeSPD01rphiSkip_%d",phibin);
1588         ((TH1F*)(fOutputclusterTypeSPD01Skip->FindObject(named0ClustertypeSPD01rphiSkip)))->Fill(10000*dzRecSkip[0]);
1589         ((TH1F*)(fOutputclusterTypeSPD01Skip->FindObject(named0ClustertypeSPD01zSkip)))->Fill(10000*dzRecSkip[1]);
1590       }
1591       
1592       if(ctypeSPD0==2) {
1593         char *named0ClustertypeSPD02rphiSkip = Form("d0clustertypeSPD02rphiSkip_%d",phibin);
1594         char *named0ClustertypeSPD02zSkip = Form("d0clustertypeSPD02rphiSkip_%d",phibin);
1595         ((TH1F*)(fOutputclusterTypeSPD02Skip->FindObject(named0ClustertypeSPD02rphiSkip)))->Fill(10000*dzRecSkip[0]);
1596         ((TH1F*)(fOutputclusterTypeSPD02Skip->FindObject(named0ClustertypeSPD02zSkip)))->Fill(10000*dzRecSkip[1]);
1597       }
1598       
1599       if(ctypeSPD0==3) {
1600         char *named0ClustertypeSPD03rphiSkip = Form("d0clustertypeSPD03rphiSkip_%d",phibin);
1601         char *named0ClustertypeSPD03zSkip = Form("d0clustertypeSPD03zSkip_%d",phibin);
1602         ((TH1F*)(fOutputclusterTypeSPD03Skip->FindObject(named0ClustertypeSPD03rphiSkip)))->Fill(10000*dzRecSkip[0]);
1603         ((TH1F*)(fOutputclusterTypeSPD03Skip->FindObject(named0ClustertypeSPD03zSkip)))->Fill(10000*dzRecSkip[1]);
1604       }
1605       
1606       if(ctypeSPD1==1) {
1607         char *named0ClustertypeSPD11rphiSkip = Form("d0clustertypeSPD11rphiSkip_%d",phibin);
1608         char *named0ClustertypeSPD11zSkip = Form("d0clustertypeSPD11rphiSkip_%d",phibin);
1609         ((TH1F*)(fOutputclusterTypeSPD11Skip->FindObject(named0ClustertypeSPD11rphiSkip)))->Fill(10000*dzRecSkip[0]);
1610         ((TH1F*)(fOutputclusterTypeSPD11Skip->FindObject(named0ClustertypeSPD11zSkip)))->Fill(10000*dzRecSkip[1]);
1611       } 
1612       if(ctypeSPD1==2) {
1613         char *named0ClustertypeSPD12rphiSkip = Form("d0clustertypeSPD12rphiSkip_%d",phibin);
1614         char *named0ClustertypeSPD12zSkip = Form("d0clustertypeSPD12rphiSkip_%d",phibin);
1615         ((TH1F*)(fOutputclusterTypeSPD12Skip->FindObject(named0ClustertypeSPD12rphiSkip)))->Fill(10000*dzRecSkip[0]);
1616         ((TH1F*)(fOutputclusterTypeSPD12Skip->FindObject(named0ClustertypeSPD12zSkip)))->Fill(10000*dzRecSkip[1]);
1617       } 
1618       
1619       if(ctypeSPD1==3) {
1620         char *named0ClustertypeSPD13rphiSkip = Form("d0clustertypeSPD13rphiSkip_%d",phibin);
1621         char *named0ClustertypeSPD13zSkip = Form("d0clustertypeSPD13rphiSkip_%d",phibin);
1622         ((TH1F*)(fOutputclusterTypeSPD13Skip->FindObject(named0ClustertypeSPD13rphiSkip)))->Fill(10000*dzRecSkip[0]);
1623         ((TH1F*)(fOutputclusterTypeSPD13Skip->FindObject(named0ClustertypeSPD13zSkip)))->Fill(10000*dzRecSkip[1]);
1624       }  
1625      
1626       // Bayesian PID
1627       Double_t prob[AliPID::kSPECIES];
1628       esdtrack->GetESDpid(prob);
1629       Double_t priors[5] = {0.01, 0.01, 0.85, 0.10, 0.05};
1630       
1631       //Int_t charge = track->Charge();
1632       //Int_t esdPid = -1;
1633       
1634       AliPID pid;
1635       pid.SetPriors(priors);
1636       pid.SetProbabilities(prob);
1637       
1638       // identify particle as the most probable     
1639       Double_t pelectron = pid.GetProbability(AliPID::kElectron);
1640       Double_t pmuon = pid.GetProbability(AliPID::kMuon);
1641       Double_t ppion = pid.GetProbability(AliPID::kPion);
1642       Double_t pkaon = pid.GetProbability(AliPID::kKaon);
1643       Double_t pproton = pid.GetProbability(AliPID::kProton);  
1644   
1645       if (ppion > pelectron && 
1646           ppion >pmuon  && 
1647           ppion > pkaon && 
1648           ppion > pproton ) {
1649         //esdPid =-kPDGelectron;
1650         char *named0PionPIDrphiRec = Form("d0pionPIDrphiRec_%d", bin);
1651         char *named0PionPIDzRec = Form("d0pionPIDzRec_%d", bin);
1652         char *named0PionPIDrphiSkip = Form("d0pionPIDrphiSkip_%d", bin);
1653         char *named0PionPIDzSkip = Form("d0pionPIDzSkip_%d", bin);
1654         ((TH1F*)(fOutputparticlePID->FindObject(named0PionPIDrphiRec)))->Fill(10000.*dzRec[0]);
1655         ((TH1F*)(fOutputparticlePID->FindObject(named0PionPIDzRec)))->Fill(10000.*dzRec[1]);
1656         ((TH1F*)(fOutputparticlePID->FindObject(named0PionPIDrphiSkip)))->Fill(10000.*dzRecSkip[0]);
1657         ((TH1F*)(fOutputparticlePID->FindObject(named0PionPIDzSkip)))->Fill(10000.*dzRecSkip[1]);
1658       }
1659       
1660       
1661       if (pkaon > pelectron && 
1662           pkaon >pmuon  && 
1663           pkaon > ppion && 
1664           pkaon > pproton ) {
1665         //esdPid =-kPDGelectron;
1666         char *named0KaonPIDrphiRec = Form("d0kaonPIDrphiRec_%d", bin);
1667         char *named0KaonPIDzRec = Form("d0kaonPIDzRec_%d", bin);
1668         char *named0KaonPIDrphiSkip = Form("d0kaonPIDrphiSkip_%d", bin);
1669         char *named0KaonPIDzSkip = Form("d0kaonPIDzSkip_%d", bin);
1670         ((TH1F*)(fOutputparticlePID->FindObject(named0KaonPIDrphiRec)))->Fill(10000.*dzRec[0]);
1671         ((TH1F*)(fOutputparticlePID->FindObject(named0KaonPIDzRec)))->Fill(10000.*dzRec[1]);
1672         ((TH1F*)(fOutputparticlePID->FindObject(named0KaonPIDrphiSkip)))->Fill(10000.*dzRecSkip[0]);
1673         ((TH1F*)(fOutputparticlePID->FindObject(named0KaonPIDzSkip)))->Fill(10000.*dzRecSkip[1]);
1674       }
1675
1676
1677       if (pproton > pelectron && 
1678           pproton >pmuon  && 
1679           pproton > ppion && 
1680           pproton > pkaon ) {
1681         //esdPid =-kPDGelectron;
1682         //if(p<0.5 && fReadMC){fEstimVtx->Fill(pdgCode);}
1683         char *named0ProtonPIDrphiRec = Form("d0protonPIDrphiRec_%d", bin);
1684         char *named0ProtonPIDzRec = Form("d0protonPIDzRec_%d", bin);
1685         char *named0ProtonPIDrphiSkip = Form("d0protonPIDrphiSkip_%d", bin);
1686         char *named0ProtonPIDzSkip = Form("d0protonPIDzSkip_%d", bin);
1687         ((TH1F*)(fOutputparticlePID->FindObject(named0ProtonPIDrphiRec)))->Fill(10000.*dzRec[0]);
1688         ((TH1F*)(fOutputparticlePID->FindObject(named0ProtonPIDzRec)))->Fill(10000.*dzRec[1]);
1689         ((TH1F*)(fOutputparticlePID->FindObject(named0ProtonPIDrphiSkip)))->Fill(10000.*dzRecSkip[0]);
1690         ((TH1F*)(fOutputparticlePID->FindObject(named0ProtonPIDzSkip)))->Fill(10000.*dzRecSkip[1]);
1691       }
1692       
1693     }
1694
1695      
1696   }  // end loop of tracks
1697   
1698   if(vtxESDRec)  {delete vtxESDRec;  vtxESDRec=NULL;}
1699   if(vtxESDTrue) {delete vtxESDTrue; vtxESDTrue=NULL;}
1700   PostData(1, fOutputitspureSARec);
1701   PostData(2, fOutputitspureSASkip);
1702   PostData(3, fOutputallPointRec);
1703   PostData(4, fOutputallPointSkip);
1704   PostData(5, fOutputpartPointRec);
1705   PostData(6, fOutputpartPointSkip);
1706   PostData(7, fOutputonepointSPDRec);
1707   PostData(8, fOutputonepointSPDSkip);
1708   PostData(9, fOutputpostvTracRec);
1709   PostData(10, fOutputpostvTracSkip);
1710   PostData(11, fOutputnegtvTracRec);
1711   PostData(12, fOutputnegtvTracSkip);
1712   PostData(13, fOutputpullAllpointRec);
1713   PostData(14, fOutputpullAllpointSkip);
1714   PostData(15, fOutputOnlyRefitRec);
1715   PostData(16, fOutputOnlyRefitSkip);
1716   PostData(17, fOutputSinThetaRec);
1717   PostData(18, fOutputSinThetaSkip);
1718   PostData(19, fOutputallPointTrue);
1719   PostData(20, fOutputpostvTracTrue);
1720   PostData(21, fOutputnegtvTracTrue);
1721   PostData(22, fOutputpullAllpointTrue);
1722   PostData(23, fOutputphiAllpointSkip);
1723   PostData(24, fOutputphiPostvtracSkip);
1724   PostData(25, fOutputphiNegtvtracSkip);
1725   PostData(26, fOutputclusterTypeSPD01Skip);
1726   PostData(27, fOutputclusterTypeSPD02Skip);
1727   PostData(28, fOutputclusterTypeSPD03Skip);
1728   PostData(29, fOutputclusterTypeSPD11Skip);
1729   PostData(30, fOutputclusterTypeSPD12Skip);
1730   PostData(31, fOutputclusterTypeSPD13Skip);
1731   PostData(32, fOutputparticlePID);
1732   PostData(33, fOutputPt);
1733   PostData(34, fNentries);
1734   PostData(35, fEstimVtx);  
1735
1736   return;
1737 }
1738
1739 //________________________________________________________________________
1740 Int_t AliAnalysisTaskSEImpParRes::PtBin(Double_t pt) const {
1741   //
1742   // return the number of the pt bin
1743   //
1744
1745   if (pt>0.22 && pt<0.23) return 1;
1746   if (pt>0.26 && pt<0.27) return 2; 
1747   if (pt>0.345 && pt<0.355) return 3;
1748   if (pt>0.45 && pt<0.46) return 4; 
1749   if (pt>0.55 && pt<0.56) return 5;
1750   if (pt>0.65 && pt<0.66) return 6; 
1751   if (pt>0.75 && pt<0.76) return 7; 
1752   if (pt>0.85 && pt<0.865) return 8; 
1753   if (pt>1.05 && pt<1.07) return 9;
1754   if (pt>1.25 && pt<1.30) return 10; 
1755   if (pt>1.4 && pt<1.55) return 11; 
1756   if (pt>1.6 && pt<1.8) return 12; 
1757   if (pt>1.8 && pt<2.0) return 13; 
1758   if (pt>2.1 && pt<2.3) return 14; 
1759   if (pt>2.34 && pt<2.64) return 15; 
1760   if (pt>2.65 && pt<3.0) return 16; 
1761   if (pt>3.1 && pt<4.) return 17; 
1762   if (pt>4.1 && pt<5.2) return 18; 
1763   if (pt>5.3 && pt<6.8)  return 19; 
1764   if (pt>7.0 && pt<8.8) return 20; 
1765   if (pt>9. && pt<11.) return 21;
1766   if (pt>11.1 && pt<14.) return 22; 
1767   if (pt>14.1  && pt<17.)  return 23;
1768   if (pt>17.2  && pt<21.8) return 24; 
1769   if (pt>22.1  && pt<29.)  return 25;
1770   if (pt>29.05  && pt<35.)  return 26;
1771   /*
1772   if (pt>0.22 && pt<0.23) return 1 ;
1773   if (pt>0.26 && pt<0.27) return 2 ; 
1774   if (pt>0.35 && pt<0.36) return 3 ;
1775   if (pt>0.45 && pt<0.46) return 4 ; 
1776   if (pt>0.55 && pt<0.56) return 5 ;
1777   if (pt>0.65 && pt<0.66) return 6 ; 
1778   if (pt>0.75 && pt<0.76) return 7 ; 
1779   if (pt>0.85 && pt<0.86) return 8 ; 
1780   if (pt>1.05 && pt<1.06) return 9 ;
1781   if (pt>1.25 && pt<1.27) return 10; 
1782   if (pt>1.45 && pt<1.47) return 11; 
1783   if (pt>1.65 && pt<1.67) return 12; 
1784   if (pt>1.85 && pt<1.87) return 13; 
1785   if (pt>2.15 && pt<2.17) return 14; 
1786   if (pt>2.45 && pt<2.48) return 15; 
1787   if (pt>2.65 && pt<2.67) return 16; 
1788   if (pt>2.85 && pt<2.87) return 17; 
1789   if (pt>3.25 && pt<3.27) return 18; 
1790   if (pt>3.75 && pt<3.8)  return 19; 
1791   if (pt>4.15 && pt<4.20) return 20; 
1792   if (pt>4.95 && pt<5.15) return 21;
1793   if (pt>5.35 && pt<5.55) return 22; 
1794   if (pt>6.0  && pt<6.8)  return 23;
1795   if (pt>8.5  && pt<10.5) return 24; 
1796   if (pt>12.  && pt<19.)  return 25;
1797   if (pt>21.  && pt<32.)  return 26;
1798   */  
1799   return -1; 
1800 }
1801
1802 //________________________________________________________________________
1803 Double_t AliAnalysisTaskSEImpParRes::Getd0HistRange(Int_t i) const {
1804   //
1805   // Return the range of the d0 histograms for each pt bin
1806   //
1807   if (i==1) return  2500.; 
1808   if (i==2) return  1800.;
1809   if (i==3) return  1750.;
1810   if (i==4) return  1200.;
1811   if (i==5) return  1000.;
1812   if (i==6) return  900.;
1813   if (i==7) return  850.;
1814   if (i==8) return  700.;
1815   if (i==9) return  650.;
1816   if (i==10) return 600.;
1817   if (i==11) return 550.;
1818   if (i==12) return 500.;
1819   if (i==13) return 450.;
1820   if (i==14) return 400.;
1821   if (i==15) return 390.;
1822   if (i==16) return 380.;
1823   if (i==17) return 380.;
1824   if (i==18) return 350.;
1825   if (i==19) return 320.;
1826   if (i==20) return 300.;
1827   if (i==21) return 290.;
1828   if (i==22) return 270.;
1829   if (i==23) return 250.;
1830   if (i==24) return 270.;
1831   if (i==25) return 279.;
1832   if (i==26) return 270.;
1833
1834   return 2000.;
1835 }
1836
1837 //________________________________________________________________________
1838 Int_t AliAnalysisTaskSEImpParRes::SinThetaBin(Double_t sintheta) const {  
1839   //
1840   // Return the number of the sinTheta bin
1841   // 
1842   if(sintheta>0.7 && sintheta<0.73) return 1;
1843   if(sintheta>0.73 && sintheta<0.76) return 2; 
1844   if(sintheta>0.76 && sintheta<0.79) return 3; 
1845   if(sintheta>0.79 && sintheta<0.82) return 4;
1846   if(sintheta>0.82 && sintheta<0.85) return 5;       
1847   if(sintheta>0.85 && sintheta<0.88) return 6; 
1848   if(sintheta>0.88 && sintheta<0.91) return 7;
1849   if(sintheta>0.91 && sintheta<0.94) return 8;       
1850   if(sintheta>0.94 && sintheta<0.97) return 9; 
1851   if(sintheta>0.97 && sintheta<1.0) return 10;  
1852   return -1;
1853 }
1854
1855 //___________________________________________________________________________
1856 Int_t AliAnalysisTaskSEImpParRes::PhiBin(Double_t phi) const { 
1857   Double_t pi=TMath::Pi();
1858   if(phi>2.*pi || phi<0.) return -1;
1859   if(phi<0.1*pi) return 1;
1860   if(phi<0.2*pi) return 2;
1861   if(phi<0.3*pi) return 3;
1862   if(phi<0.4*pi) return 4;
1863   if(phi<0.5*pi) return 5;
1864   if(phi<0.6*pi) return 6;
1865   if(phi<0.7*pi) return 7;
1866   if(phi<0.8*pi) return 8;
1867   if(phi<0.9*pi) return 9;
1868   if(phi<1.0*pi) return 10;
1869   if(phi<1.1*pi) return 11;
1870   if(phi<1.2*pi) return 12;
1871   if(phi<1.3*pi) return 13;
1872   if(phi<1.4*pi) return 14;
1873   if(phi<1.5*pi) return 15;
1874   if(phi<1.6*pi) return 16;
1875   if(phi<1.7*pi) return 17;
1876   if(phi<1.8*pi) return 18;
1877   if(phi<1.9*pi) return 19;
1878   if(phi<2.0*pi) return 20;
1879   return -1;
1880 }
1881 //___________________________________________________________________________
1882 void AliAnalysisTaskSEImpParRes::Terminate(Option_t */*option*/) {
1883   //
1884   // Terminate analysis
1885   //
1886
1887   if (fDebug>1) printf("AnalysisTaskSEImpParRes: Terminate() \n");
1888
1889   return;
1890 }
1891 //__________________________________________________________________________
1892 Int_t AliAnalysisTaskSEImpParRes::ClusterTypeOnITSLayer(AliESDtrack *track,
1893                                                         Int_t layer) const {
1894 //
1895 // Returns cluster type on ITS layer. Returns -1 if no cluster on this layer
1896 //
1897   Int_t ctype=-1;
1898
1899   if(layer<0 || layer>5) return ctype;
1900   if(!track->HasPointOnITSLayer(layer)) return ctype;
1901   
1902   const AliTrackPointArray *array = track->GetTrackPointArray();
1903   if(!array) {
1904     printf("No tracks points avaialble: check ESDfriends\n");
1905     return ctype;
1906   }
1907   AliTrackPoint point;
1908   Int_t ipt,volId,modId,layerId;
1909   for(ipt=0; ipt<array->GetNPoints(); ipt++) {
1910     array->GetPoint(point,ipt);
1911     volId = point.GetVolumeID();
1912     if(volId<=0) continue;
1913     layerId = AliGeomManager::VolUIDToLayer(volId,modId);
1914     if(layerId==layer+1 && !point.IsExtra()) {
1915       ctype = point.GetClusterType();
1916       break;
1917     }
1918   }
1919   return ctype;
1920 }