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