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