trigger class selection and more histograms added
[u/mrichter/AliRoot.git] / PWG0 / dNdPt / AlidNdPtAnalysis.cxx
1 /**************************************************************************\r
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
3  *                                                                        *\r
4  * Author: The ALICE Off-line Project.                                    *\r
5  * Contributors are mentioned in the code where appropriate.              *\r
6  *                                                                        *\r
7  * Permission to use, copy, modify and distribute this software and its   *\r
8  * documentation strictly for non-commercial purposes is hereby granted   *\r
9  * without fee, provided that the above copyright notice appears in all   *\r
10  * copies and that both the copyright notice and this permission notice   *\r
11  * appear in the supporting documentation. The authors make no claims     *\r
12  * about the suitability of this software for any purpose. It is          *\r
13  * provided "as is" without express or implied warranty.                  *\r
14  **************************************************************************/\r
15 \r
16 #include <iostream>\r
17 \r
18 #include "TFile.h"\r
19 #include "TCint.h"\r
20 #include "TH1.h"\r
21 #include "TH2.h"\r
22 #include "TCanvas.h"\r
23 \r
24 #include "AliHeader.h"  \r
25 #include "AliGenEventHeader.h"  \r
26 #include "AliStack.h"  \r
27 #include "AliESDEvent.h"  \r
28 #include "AliMCEvent.h"  \r
29 #include "AliESDtrackCuts.h"  \r
30 #include "AliLog.h" \r
31 \r
32 #include "AlidNdPtEventCuts.h"\r
33 #include "AlidNdPtAcceptanceCuts.h"\r
34 \r
35 #include "AliPWG0Helper.h"\r
36 #include "AlidNdPtHelper.h"\r
37 #include "AlidNdPtAnalysis.h"\r
38 \r
39 using namespace std;\r
40 \r
41 ClassImp(AlidNdPtAnalysis)\r
42 \r
43 //_____________________________________________________________________________\r
44   AlidNdPtAnalysis::AlidNdPtAnalysis(): AlidNdPt(),\r
45   fAnalysisFolder(0),\r
46   fHistogramsOn(kFALSE),\r
47 \r
48   // event multiplicity correlation matrix \r
49   fEventMultCorrelationMatrix(0),\r
50 \r
51   // rec. track pt vs true track pt correlation matrix \r
52   fTrackPtCorrelationMatrix(0),\r
53 \r
54   // event level correction\r
55   fGenEventMatrix(0),\r
56   fGenSDEventMatrix(0),\r
57   fGenDDEventMatrix(0),\r
58   fGenNDEventMatrix(0),\r
59   fGenNSDEventMatrix(0),\r
60 \r
61   fTriggerEventMatrix(0),\r
62   fTriggerSDEventMatrix(0),\r
63   fTriggerDDEventMatrix(0),\r
64   fTriggerNDEventMatrix(0),\r
65   fTriggerNSDEventMatrix(0),\r
66 \r
67   fRecEventMatrix(0),\r
68   fRecSDEventMatrix(0),\r
69   fRecDDEventMatrix(0),\r
70   fRecNDEventMatrix(0),\r
71   fRecNSDEventMatrix(0),\r
72 \r
73   //\r
74   // track-event level correction \r
75   //\r
76   fGenTrackEventMatrix(0),\r
77   fGenTrackSDEventMatrix(0),\r
78   fGenTrackDDEventMatrix(0),\r
79   fGenTrackNDEventMatrix(0),\r
80   fGenTrackNSDEventMatrix(0),\r
81 \r
82   fTriggerTrackEventMatrix(0),\r
83   fTriggerTrackSDEventMatrix(0),\r
84   fTriggerTrackDDEventMatrix(0),\r
85   fTriggerTrackNDEventMatrix(0),\r
86   fTriggerTrackNSDEventMatrix(0),\r
87 \r
88   fRecTrackEventMatrix(0),\r
89   fRecTrackSDEventMatrix(0),\r
90   fRecTrackDDEventMatrix(0),\r
91   fRecTrackNDEventMatrix(0),\r
92   fRecTrackNSDEventMatrix(0),\r
93 \r
94   // track rec. efficiency correction (fRecPrimTrackMatrix / fGenPrimTrackMatrix)\r
95   fGenTrackMatrix(0),\r
96   fGenPrimTrackMatrix(0),\r
97   fRecPrimTrackMatrix(0),\r
98 \r
99   // secondary track contamination correction (fRecSecTrackMatrix / fRecTrackMatrix)\r
100   fRecTrackMatrix(0),\r
101   fRecSecTrackMatrix(0),\r
102 \r
103   // multiple rec. track contamination corrections (fRecMultTrackMatrix / fRecTrackMatrix)\r
104   fRecMultTrackMatrix(0),\r
105 \r
106   // event control histograms\r
107   fMCEventHist1(0),\r
108   fRecEventHist1(0),\r
109   fRecEventHist2(0),\r
110   fRecMCEventHist1(0),\r
111   fRecMCEventHist2(0),\r
112   fRecMCEventHist3(0),\r
113 \r
114   // rec. pt and eta resolution w.r.t MC\r
115   fRecMCTrackHist1(0),\r
116 \r
117   //multple reconstructed tracks\r
118   fMCMultRecTrackHist1(0), \r
119 \r
120   // rec. track control histograms\r
121   fRecTrackHist2(0)\r
122 {\r
123   // default constructor\r
124   for(Int_t i=0; i<AlidNdPtHelper::kCutSteps; i++) { \r
125     fMCTrackHist1[i]=0;     \r
126     fMCPrimTrackHist1[i]=0;     \r
127     fMCSecTrackHist1[i]=0;     \r
128     fRecTrackHist1[i]=0;     \r
129     fRecTrackMultHist1[i]=0;     \r
130   }\r
131   Init();\r
132 }\r
133 \r
134 //_____________________________________________________________________________\r
135 AlidNdPtAnalysis::AlidNdPtAnalysis(Char_t* name, Char_t* title): AlidNdPt(name,title),\r
136   fAnalysisFolder(0),\r
137   fHistogramsOn(kFALSE),\r
138 \r
139   // event multiplicity correlation matrix \r
140   fEventMultCorrelationMatrix(0),\r
141 \r
142   // rec. track pt vs true track pt correlation matrix \r
143   fTrackPtCorrelationMatrix(0),\r
144 \r
145   // event level correction\r
146   fGenEventMatrix(0),\r
147   fGenSDEventMatrix(0),\r
148   fGenDDEventMatrix(0),\r
149   fGenNDEventMatrix(0),\r
150   fGenNSDEventMatrix(0),\r
151 \r
152   fTriggerEventMatrix(0),\r
153   fTriggerSDEventMatrix(0),\r
154   fTriggerDDEventMatrix(0),\r
155   fTriggerNDEventMatrix(0),\r
156   fTriggerNSDEventMatrix(0),\r
157 \r
158   fRecEventMatrix(0),\r
159   fRecSDEventMatrix(0),\r
160   fRecDDEventMatrix(0),\r
161   fRecNDEventMatrix(0),\r
162   fRecNSDEventMatrix(0),\r
163 \r
164   //\r
165   // track-event level correction \r
166   //\r
167   fGenTrackEventMatrix(0),\r
168   fGenTrackSDEventMatrix(0),\r
169   fGenTrackDDEventMatrix(0),\r
170   fGenTrackNDEventMatrix(0),\r
171   fGenTrackNSDEventMatrix(0),\r
172 \r
173   fTriggerTrackEventMatrix(0),\r
174   fTriggerTrackSDEventMatrix(0),\r
175   fTriggerTrackDDEventMatrix(0),\r
176   fTriggerTrackNDEventMatrix(0),\r
177   fTriggerTrackNSDEventMatrix(0),\r
178 \r
179   fRecTrackEventMatrix(0),\r
180   fRecTrackSDEventMatrix(0),\r
181   fRecTrackDDEventMatrix(0),\r
182   fRecTrackNDEventMatrix(0),\r
183   fRecTrackNSDEventMatrix(0),\r
184 \r
185   // track rec. efficiency correction (fRecPrimTrackMatrix / fGenPrimTrackMatrix)\r
186   fGenTrackMatrix(0),\r
187   fGenPrimTrackMatrix(0),\r
188   fRecPrimTrackMatrix(0),\r
189 \r
190   // secondary track contamination correction (fRecSecTrackMatrix / fRecTrackMatrix)\r
191   fRecTrackMatrix(0),\r
192   fRecSecTrackMatrix(0),\r
193 \r
194   // multiple rec. track contamination corrections (fRecMultTrackMatrix / fRecTrackMatrix)\r
195   fRecMultTrackMatrix(0),\r
196 \r
197   // event control histograms\r
198   fMCEventHist1(0),\r
199   fRecEventHist1(0),\r
200   fRecEventHist2(0),\r
201   fRecMCEventHist1(0),\r
202   fRecMCEventHist2(0),\r
203   fRecMCEventHist3(0),\r
204  \r
205   // rec. pt and eta resolution w.r.t MC\r
206   fRecMCTrackHist1(0),\r
207 \r
208   //multple reconstructed tracks\r
209   fMCMultRecTrackHist1(0), \r
210 \r
211   // rec. track control histograms\r
212   fRecTrackHist2(0)\r
213 {\r
214   // constructor\r
215   for(Int_t i=0; i<AlidNdPtHelper::kCutSteps; i++) { \r
216     fMCTrackHist1[i]=0;     \r
217     fMCPrimTrackHist1[i]=0;     \r
218     fMCSecTrackHist1[i]=0;     \r
219     fRecTrackHist1[i]=0;     \r
220     fRecTrackMultHist1[i]=0; \r
221   }\r
222 \r
223   Init();\r
224 }\r
225 \r
226 //_____________________________________________________________________________\r
227 AlidNdPtAnalysis::~AlidNdPtAnalysis() {\r
228   //\r
229   if(fEventMultCorrelationMatrix) delete fEventMultCorrelationMatrix; fEventMultCorrelationMatrix=0;\r
230   //\r
231   if(fTrackPtCorrelationMatrix) delete fTrackPtCorrelationMatrix; fTrackPtCorrelationMatrix=0;\r
232   //\r
233   if(fGenEventMatrix) delete fGenEventMatrix; fGenEventMatrix=0;\r
234   if(fGenSDEventMatrix) delete fGenSDEventMatrix; fGenSDEventMatrix=0;\r
235   if(fGenDDEventMatrix) delete fGenDDEventMatrix; fGenDDEventMatrix=0;\r
236   if(fGenNDEventMatrix) delete fGenNDEventMatrix; fGenNDEventMatrix=0;\r
237   if(fGenNSDEventMatrix) delete fGenNSDEventMatrix; fGenNSDEventMatrix=0;\r
238 \r
239   if(fTriggerEventMatrix) delete fTriggerEventMatrix; fTriggerEventMatrix=0;\r
240   if(fTriggerSDEventMatrix) delete fTriggerSDEventMatrix; fTriggerSDEventMatrix=0;\r
241   if(fTriggerDDEventMatrix) delete fTriggerDDEventMatrix; fTriggerDDEventMatrix=0;\r
242   if(fTriggerNDEventMatrix) delete fTriggerNDEventMatrix; fTriggerNDEventMatrix=0;\r
243   if(fTriggerNSDEventMatrix) delete fTriggerNSDEventMatrix; fTriggerNSDEventMatrix=0;\r
244 \r
245   if(fRecEventMatrix) delete fRecEventMatrix; fRecEventMatrix=0;\r
246   if(fRecSDEventMatrix) delete fRecSDEventMatrix; fRecSDEventMatrix=0;\r
247   if(fRecDDEventMatrix) delete fRecDDEventMatrix; fRecDDEventMatrix=0;\r
248   if(fRecNDEventMatrix) delete fRecNDEventMatrix; fRecNDEventMatrix=0;\r
249   if(fRecNSDEventMatrix) delete fRecNSDEventMatrix; fRecNSDEventMatrix=0;\r
250 \r
251   //\r
252   if(fGenTrackEventMatrix) delete fGenTrackEventMatrix; fGenTrackEventMatrix=0;\r
253   if(fGenTrackSDEventMatrix) delete fGenTrackSDEventMatrix; fGenTrackSDEventMatrix=0;\r
254   if(fGenTrackDDEventMatrix) delete fGenTrackDDEventMatrix; fGenTrackDDEventMatrix=0;\r
255   if(fGenTrackNDEventMatrix) delete fGenTrackNDEventMatrix; fGenTrackNDEventMatrix=0;\r
256   if(fGenTrackNSDEventMatrix) delete fGenTrackNSDEventMatrix; fGenTrackNSDEventMatrix=0;\r
257 \r
258   if(fTriggerEventMatrix) delete fTriggerEventMatrix; fTriggerEventMatrix=0;\r
259   if(fTriggerTrackSDEventMatrix) delete fTriggerTrackSDEventMatrix; fTriggerTrackSDEventMatrix=0;\r
260   if(fTriggerTrackDDEventMatrix) delete fTriggerTrackDDEventMatrix; fTriggerTrackDDEventMatrix=0;\r
261   if(fTriggerTrackNDEventMatrix) delete fTriggerTrackNDEventMatrix; fTriggerTrackNDEventMatrix=0;\r
262   if(fTriggerTrackNSDEventMatrix) delete fTriggerTrackNSDEventMatrix; fTriggerTrackNSDEventMatrix=0;\r
263 \r
264   if(fRecTrackEventMatrix) delete fRecTrackEventMatrix; fRecTrackEventMatrix=0;\r
265   if(fRecTrackSDEventMatrix) delete fRecTrackSDEventMatrix; fRecTrackSDEventMatrix=0;\r
266   if(fRecTrackDDEventMatrix) delete fRecTrackDDEventMatrix; fRecTrackDDEventMatrix=0;\r
267   if(fRecTrackNDEventMatrix) delete fRecTrackNDEventMatrix; fRecTrackNDEventMatrix=0;\r
268   if(fRecTrackNSDEventMatrix) delete fRecTrackNSDEventMatrix; fRecTrackNSDEventMatrix=0;\r
269 \r
270   //\r
271   if(fGenTrackMatrix) delete fGenTrackMatrix; fGenTrackMatrix=0;\r
272   if(fGenPrimTrackMatrix) delete fGenPrimTrackMatrix; fGenPrimTrackMatrix=0;\r
273   if(fRecPrimTrackMatrix) delete fRecPrimTrackMatrix; fRecPrimTrackMatrix=0;\r
274   //\r
275   if(fRecTrackMatrix) delete fRecTrackMatrix; fRecTrackMatrix=0;\r
276   if(fRecSecTrackMatrix) delete fRecSecTrackMatrix; fRecSecTrackMatrix=0;\r
277   // \r
278   if(fRecMultTrackMatrix) delete fRecMultTrackMatrix; fRecMultTrackMatrix=0;\r
279   //\r
280   // Control histograms\r
281   //\r
282   if(fMCEventHist1) delete fMCEventHist1; fMCEventHist1=0;\r
283   if(fRecEventHist1) delete fRecEventHist1; fRecEventHist1=0;\r
284   if(fRecEventHist2) delete fRecEventHist2; fRecEventHist2=0;\r
285   if(fRecMCEventHist1) delete fRecMCEventHist1; fRecMCEventHist1=0;\r
286   if(fRecMCEventHist2) delete fRecMCEventHist2; fRecMCEventHist2=0;\r
287   if(fRecMCEventHist3) delete fRecMCEventHist3; fRecMCEventHist3=0;\r
288   //\r
289   for(Int_t i=0; i<AlidNdPtHelper::kCutSteps; i++) { \r
290     if(fMCTrackHist1[i]) delete fMCTrackHist1[i]; fMCTrackHist1[i]=0;\r
291     if(fMCPrimTrackHist1[i]) delete fMCPrimTrackHist1[i]; fMCPrimTrackHist1[i]=0;\r
292     if(fMCSecTrackHist1[i]) delete fMCSecTrackHist1[i]; fMCSecTrackHist1[i]=0;\r
293     if(fRecTrackHist1[i]) delete fRecTrackHist1[i]; fRecTrackHist1[i]=0;\r
294     if(fRecTrackMultHist1[i]) delete fRecTrackMultHist1[i]; fRecTrackMultHist1[i]=0;\r
295   }\r
296   if(fRecMCTrackHist1) delete fRecMCTrackHist1; fRecMCTrackHist1=0;\r
297   if(fMCMultRecTrackHist1) delete fMCMultRecTrackHist1; fMCMultRecTrackHist1=0; \r
298   if(fRecTrackHist2) delete fRecTrackHist2; fRecTrackHist2=0; \r
299   //\r
300   if(fAnalysisFolder) delete fAnalysisFolder; fAnalysisFolder=0;\r
301 }\r
302 \r
303 //_____________________________________________________________________________\r
304 void AlidNdPtAnalysis::Init(){\r
305   //\r
306   // Init histograms\r
307   //\r
308 \r
309   const Int_t ptNbins = 56;\r
310   const Int_t etaNbins = 30;\r
311   const Int_t zvNbins = 12;\r
312   //const Int_t multNbins = 22;\r
313 \r
314   Double_t binsPt[ptNbins+1] = {0.,0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.65,0.7,0.75,0.8,0.85,0.9,0.95,1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.0,2.2,2.4,2.6,2.8,3.0,3.2,3.4,3.6,3.8,4.0,4.5,5.0,5.5,6.0,6.5,7.0,7.5,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0};\r
315   Double_t binsEta[etaNbins+1] = {-1.5,-1.4,-1.3,-1.2,-1.1,-1.0,-0.9,-0.8,-0.7,-0.6,-0.5,-0.4,-0.3,-0.2,-0.1,0.,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5};\r
316   Double_t binsZv[zvNbins+1] = {-30.,-25.,-20.,-15.,-10.,-5.,0.,5.,10.,15.,20.,25.,30.};\r
317   //Double_t binsMult[multNbins+1] = {0.,1.,2.,3.,4.,5.,6.,7.,8.,9.,10.,12.,14.,16.,18.,20.,30.,40.,50.,70.,90.,110.,150.};\r
318 \r
319   //Int_t binsTrackMatrix[4]={zvNbins,ptNbins,etaNbins,multNbins};\r
320   Int_t binsTrackMatrix[3]={zvNbins,ptNbins,etaNbins};\r
321   //Int_t binsTrackMatrix[3]={multNbins,ptNbins,etaNbins};\r
322 \r
323   //\r
324   // rec. vs MC correlation matrices\r
325   //\r
326   Int_t binsMultTrueEventMatrix[2]={150,150};\r
327   Double_t minMultTrueEventMatrix[2]={-0.5,-0.5}; \r
328   Double_t maxMultTrueEventMatrix[2]={149.5,149.5}; \r
329   fEventMultCorrelationMatrix = new THnSparseF("fEventMultCorrelationMatrix","mult:true_mult",2,binsMultTrueEventMatrix,minMultTrueEventMatrix,maxMultTrueEventMatrix);\r
330   fEventMultCorrelationMatrix->GetAxis(0)->SetTitle("track multiplicity");\r
331   fEventMultCorrelationMatrix->GetAxis(1)->SetTitle("multiplicity");\r
332   fEventMultCorrelationMatrix->Sumw2();\r
333   \r
334   Int_t binsTrackPtCorrelationMatrix[3]={ptNbins,ptNbins,etaNbins};\r
335   fTrackPtCorrelationMatrix = new THnSparseF("fTrackPtCorrelationMatrix","Pt:mcPt:mcEta",3,binsTrackPtCorrelationMatrix);\r
336   fTrackPtCorrelationMatrix->SetBinEdges(0,binsPt);\r
337   fTrackPtCorrelationMatrix->SetBinEdges(1,binsPt);\r
338   fTrackPtCorrelationMatrix->SetBinEdges(2,binsEta);\r
339   fTrackPtCorrelationMatrix->GetAxis(0)->SetTitle("Pt (GeV/c)");\r
340   fTrackPtCorrelationMatrix->GetAxis(1)->SetTitle("mcPt (GeV/c)");\r
341   fTrackPtCorrelationMatrix->GetAxis(2)->SetTitle("mcEta");\r
342   fTrackPtCorrelationMatrix->Sumw2();\r
343 \r
344   //\r
345   // Efficiency and contamination correction matrices\r
346   //\r
347   Int_t binsEventMatrix[2]={zvNbins,150};\r
348   Double_t minEventMatrix[2]={-25.,-0.5}; \r
349   Double_t maxEventMatrix[2]={25.,149.5}; \r
350 \r
351   fGenEventMatrix = new THnSparseF("fGenEventMatrix","mcZv:multMB",2,binsEventMatrix,minEventMatrix,maxEventMatrix);\r
352   fGenEventMatrix->SetBinEdges(0,binsZv);\r
353   fGenEventMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
354   fGenEventMatrix->GetAxis(1)->SetTitle("multiplicity MB");\r
355   fGenEventMatrix->Sumw2();\r
356   \r
357   fGenSDEventMatrix = new THnSparseF("fGenSDEventMatrix","mcZv:multMB",2,binsEventMatrix,minEventMatrix,maxEventMatrix);\r
358   fGenSDEventMatrix->SetBinEdges(0,binsZv);\r
359   fGenSDEventMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
360   fGenSDEventMatrix->GetAxis(1)->SetTitle("multiplicity MB");\r
361   fGenSDEventMatrix->Sumw2();\r
362   \r
363   fGenDDEventMatrix = new THnSparseF("fGenDDEventMatrix","mcZv:multMB",2,binsEventMatrix,minEventMatrix,maxEventMatrix);\r
364   fGenDDEventMatrix->SetBinEdges(0,binsZv);\r
365   fGenDDEventMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
366   fGenDDEventMatrix->GetAxis(1)->SetTitle("multiplicity MB");\r
367   fGenDDEventMatrix->Sumw2();\r
368   \r
369   fGenNDEventMatrix = new THnSparseF("fGenNDEventMatrix","mcZv:multMB",2,binsEventMatrix,minEventMatrix,maxEventMatrix);\r
370   fGenNDEventMatrix->SetBinEdges(0,binsZv);\r
371   fGenNDEventMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
372   fGenNDEventMatrix->GetAxis(1)->SetTitle("multiplicity MB");\r
373   fGenNDEventMatrix->Sumw2();\r
374 \r
375   fGenNSDEventMatrix = new THnSparseF("fGenNSDEventMatrix","mcZv:multMB",2,binsEventMatrix,minEventMatrix,maxEventMatrix);\r
376   fGenNSDEventMatrix->SetBinEdges(0,binsZv);\r
377   fGenNSDEventMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
378   fGenNSDEventMatrix->GetAxis(1)->SetTitle("multiplicity MB");\r
379   fGenNSDEventMatrix->Sumw2();\r
380 \r
381   //\r
382   fTriggerEventMatrix = new THnSparseF("fTriggerEventMatrix","mcZv:multMB",2,binsEventMatrix,minEventMatrix,maxEventMatrix);\r
383   fTriggerEventMatrix->SetBinEdges(0,binsZv);\r
384   fTriggerEventMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
385   fTriggerEventMatrix->GetAxis(1)->SetTitle("multiplicity MB");\r
386   fTriggerEventMatrix->Sumw2();\r
387 \r
388   fTriggerSDEventMatrix = new THnSparseF("fTriggerSDEventMatrix","mcZv:multMB",2,binsEventMatrix,minEventMatrix,maxEventMatrix);\r
389   fTriggerSDEventMatrix->SetBinEdges(0,binsZv);\r
390   fTriggerSDEventMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
391   fTriggerSDEventMatrix->GetAxis(1)->SetTitle("multiplicity MB");\r
392   fTriggerSDEventMatrix->Sumw2();\r
393   \r
394   fTriggerDDEventMatrix = new THnSparseF("fTriggerDDEventMatrix","mcZv:multMB",2,binsEventMatrix,minEventMatrix,maxEventMatrix);\r
395   fTriggerDDEventMatrix->SetBinEdges(0,binsZv);\r
396   fTriggerDDEventMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
397   fTriggerDDEventMatrix->GetAxis(1)->SetTitle("multiplicity MB");\r
398   fTriggerDDEventMatrix->Sumw2();\r
399   \r
400   fTriggerNDEventMatrix = new THnSparseF("fTriggerNDEventMatrix","mcZv:multMB",2,binsEventMatrix,minEventMatrix,maxEventMatrix);\r
401   fTriggerNDEventMatrix->SetBinEdges(0,binsZv);\r
402   fTriggerNDEventMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
403   fTriggerNDEventMatrix->GetAxis(1)->SetTitle("multiplicity MB");\r
404   fTriggerNDEventMatrix->Sumw2();\r
405  \r
406   fTriggerNSDEventMatrix = new THnSparseF("fTriggerNSDEventMatrix","mcZv:multMB",2,binsEventMatrix,minEventMatrix,maxEventMatrix);\r
407   fTriggerNSDEventMatrix->SetBinEdges(0,binsZv);\r
408   fTriggerNSDEventMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
409   fTriggerNSDEventMatrix->GetAxis(1)->SetTitle("multiplicity MB");\r
410   fTriggerNSDEventMatrix->Sumw2();\r
411  \r
412   //\r
413   fRecEventMatrix = new THnSparseF("fRecEventMatrix","mcZv:multMB",2,binsEventMatrix,minEventMatrix,maxEventMatrix);\r
414   fRecEventMatrix->SetBinEdges(0,binsZv);\r
415   fRecEventMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
416   fRecEventMatrix->GetAxis(1)->SetTitle("multiplicity MB");\r
417   fRecEventMatrix->Sumw2();\r
418 \r
419   fRecSDEventMatrix = new THnSparseF("fRecSDEventMatrix","mcZv:multMB",2,binsEventMatrix,minEventMatrix,maxEventMatrix);\r
420   fRecSDEventMatrix->SetBinEdges(0,binsZv);\r
421   fRecSDEventMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
422   fRecSDEventMatrix->GetAxis(1)->SetTitle("multiplicity MB");\r
423   fRecSDEventMatrix->Sumw2();\r
424   \r
425   fRecDDEventMatrix = new THnSparseF("fRecDDEventMatrix","mcZv:multMB",2,binsEventMatrix,minEventMatrix,maxEventMatrix);\r
426   fRecDDEventMatrix->SetBinEdges(0,binsZv);\r
427   fRecDDEventMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
428   fRecDDEventMatrix->GetAxis(1)->SetTitle("multiplicity MB");\r
429   fRecDDEventMatrix->Sumw2();\r
430   \r
431   fRecNDEventMatrix = new THnSparseF("fRecNDEventMatrix","mcZv:multMB",2,binsEventMatrix,minEventMatrix,maxEventMatrix);\r
432   fRecNDEventMatrix->SetBinEdges(0,binsZv);\r
433   fRecNDEventMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
434   fRecNDEventMatrix->GetAxis(1)->SetTitle("multiplicity MB");\r
435   fRecNDEventMatrix->Sumw2();\r
436  \r
437   fRecNSDEventMatrix = new THnSparseF("fRecNSDEventMatrix","mcZv:multMB",2,binsEventMatrix,minEventMatrix,maxEventMatrix);\r
438   fRecNSDEventMatrix->SetBinEdges(0,binsZv);\r
439   fRecNSDEventMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
440   fRecNSDEventMatrix->GetAxis(1)->SetTitle("multiplicity MB");\r
441   fRecNSDEventMatrix->Sumw2();\r
442 \r
443   // \r
444   // track to event corrections\r
445   //\r
446 \r
447   fGenTrackEventMatrix = new THnSparseF("fGenTrackEventMatrix","mcZv:mcPt:mcEta",3,binsTrackMatrix);\r
448   fGenTrackEventMatrix->SetBinEdges(0,binsZv);\r
449   fGenTrackEventMatrix->SetBinEdges(1,binsPt);\r
450   fGenTrackEventMatrix->SetBinEdges(2,binsEta);\r
451   fGenTrackEventMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
452   fGenTrackEventMatrix->GetAxis(1)->SetTitle("mcPt (GeV/c)");\r
453   fGenTrackEventMatrix->GetAxis(2)->SetTitle("mcEta");\r
454   fGenTrackEventMatrix->Sumw2();\r
455 \r
456   fGenTrackSDEventMatrix = new THnSparseF("fGenTrackSDEventMatrix","mcZv:mcPt:mcEta",3,binsTrackMatrix);\r
457   fGenTrackSDEventMatrix->SetBinEdges(0,binsZv);\r
458   fGenTrackSDEventMatrix->SetBinEdges(1,binsPt);\r
459   fGenTrackSDEventMatrix->SetBinEdges(2,binsEta);\r
460   fGenTrackSDEventMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
461   fGenTrackSDEventMatrix->GetAxis(1)->SetTitle("mcPt (GeV/c)");\r
462   fGenTrackSDEventMatrix->GetAxis(2)->SetTitle("mcEta");\r
463   fGenTrackSDEventMatrix->Sumw2();\r
464 \r
465   fGenTrackDDEventMatrix = new THnSparseF("fGenTrackDDEventMatrix","mcZv:mcPt:mcEta",3,binsTrackMatrix);\r
466   fGenTrackDDEventMatrix->SetBinEdges(0,binsZv);\r
467   fGenTrackDDEventMatrix->SetBinEdges(1,binsPt);\r
468   fGenTrackDDEventMatrix->SetBinEdges(2,binsEta);\r
469   fGenTrackDDEventMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
470   fGenTrackDDEventMatrix->GetAxis(1)->SetTitle("mcPt (GeV/c)");\r
471   fGenTrackDDEventMatrix->GetAxis(2)->SetTitle("mcEta");\r
472   fGenTrackDDEventMatrix->Sumw2();\r
473 \r
474   fGenTrackNDEventMatrix = new THnSparseF("fGenTrackNDEventMatrix","mcZv:mcPt:mcEta",3,binsTrackMatrix);\r
475   fGenTrackNDEventMatrix->SetBinEdges(0,binsZv);\r
476   fGenTrackNDEventMatrix->SetBinEdges(1,binsPt);\r
477   fGenTrackNDEventMatrix->SetBinEdges(2,binsEta);\r
478   fGenTrackNDEventMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
479   fGenTrackNDEventMatrix->GetAxis(1)->SetTitle("mcPt (GeV/c)");\r
480   fGenTrackNDEventMatrix->GetAxis(2)->SetTitle("mcEta");\r
481   fGenTrackNDEventMatrix->Sumw2();\r
482 \r
483   fGenTrackNSDEventMatrix = new THnSparseF("fGenTrackNSDEventMatrix","mcZv:mcPt:mcEta",3,binsTrackMatrix);\r
484   fGenTrackNSDEventMatrix->SetBinEdges(0,binsZv);\r
485   fGenTrackNSDEventMatrix->SetBinEdges(1,binsPt);\r
486   fGenTrackNSDEventMatrix->SetBinEdges(2,binsEta);\r
487   fGenTrackNSDEventMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
488   fGenTrackNSDEventMatrix->GetAxis(1)->SetTitle("mcPt (GeV/c)");\r
489   fGenTrackNSDEventMatrix->GetAxis(2)->SetTitle("mcEta");\r
490   fGenTrackNSDEventMatrix->Sumw2();\r
491 \r
492 \r
493   //\r
494   fTriggerTrackEventMatrix = new THnSparseF("fTriggerTrackEventMatrix","mcZv:mcPt:mcEta",3,binsTrackMatrix);\r
495   fTriggerTrackEventMatrix->SetBinEdges(0,binsZv);\r
496   fTriggerTrackEventMatrix->SetBinEdges(1,binsPt);\r
497   fTriggerTrackEventMatrix->SetBinEdges(2,binsEta);\r
498   fTriggerTrackEventMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
499   fTriggerTrackEventMatrix->GetAxis(1)->SetTitle("mcPt (GeV/c)");\r
500   fTriggerTrackEventMatrix->GetAxis(2)->SetTitle("mcEta");\r
501   fTriggerTrackEventMatrix->Sumw2();\r
502 \r
503   fTriggerTrackSDEventMatrix = new THnSparseF("fTriggerTrackSDEventMatrix","mcZv:mcPt:mcEta",3,binsTrackMatrix);\r
504   fTriggerTrackSDEventMatrix->SetBinEdges(0,binsZv);\r
505   fTriggerTrackSDEventMatrix->SetBinEdges(1,binsPt);\r
506   fTriggerTrackSDEventMatrix->SetBinEdges(2,binsEta);\r
507   fTriggerTrackSDEventMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
508   fTriggerTrackSDEventMatrix->GetAxis(1)->SetTitle("mcPt (GeV/c)");\r
509   fTriggerTrackSDEventMatrix->GetAxis(2)->SetTitle("mcEta");\r
510   fTriggerTrackSDEventMatrix->Sumw2();\r
511 \r
512   fTriggerTrackDDEventMatrix = new THnSparseF("fTriggerTrackDDEventMatrix","mcZv:mcPt:mcEta",3,binsTrackMatrix);\r
513   fTriggerTrackDDEventMatrix->SetBinEdges(0,binsZv);\r
514   fTriggerTrackDDEventMatrix->SetBinEdges(1,binsPt);\r
515   fTriggerTrackDDEventMatrix->SetBinEdges(2,binsEta);\r
516   fTriggerTrackDDEventMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
517   fTriggerTrackDDEventMatrix->GetAxis(1)->SetTitle("mcPt (GeV/c)");\r
518   fTriggerTrackDDEventMatrix->GetAxis(2)->SetTitle("mcEta");\r
519   fTriggerTrackDDEventMatrix->Sumw2();\r
520 \r
521   fTriggerTrackNDEventMatrix = new THnSparseF("fTriggerTrackNDEventMatrix","mcZv:mcPt:mcEta",3,binsTrackMatrix);\r
522   fTriggerTrackNDEventMatrix->SetBinEdges(0,binsZv);\r
523   fTriggerTrackNDEventMatrix->SetBinEdges(1,binsPt);\r
524   fTriggerTrackNDEventMatrix->SetBinEdges(2,binsEta);\r
525   fTriggerTrackNDEventMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
526   fTriggerTrackNDEventMatrix->GetAxis(1)->SetTitle("mcPt (GeV/c)");\r
527   fTriggerTrackNDEventMatrix->GetAxis(2)->SetTitle("mcEta");\r
528   fTriggerTrackNDEventMatrix->Sumw2();\r
529 \r
530   fTriggerTrackNSDEventMatrix = new THnSparseF("fTriggerTrackNSDEventMatrix","mcZv:mcPt:mcEta",3,binsTrackMatrix);\r
531   fTriggerTrackNSDEventMatrix->SetBinEdges(0,binsZv);\r
532   fTriggerTrackNSDEventMatrix->SetBinEdges(1,binsPt);\r
533   fTriggerTrackNSDEventMatrix->SetBinEdges(2,binsEta);\r
534   fTriggerTrackNSDEventMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
535   fTriggerTrackNSDEventMatrix->GetAxis(1)->SetTitle("mcPt (GeV/c)");\r
536   fTriggerTrackNSDEventMatrix->GetAxis(2)->SetTitle("mcEta");\r
537   fTriggerTrackNSDEventMatrix->Sumw2();\r
538 \r
539   //\r
540   fRecTrackEventMatrix = new THnSparseF("fRecTrackEventMatrix","mcZv:mcPt:mcEta",3,binsTrackMatrix);\r
541   fRecTrackEventMatrix->SetBinEdges(0,binsZv);\r
542   fRecTrackEventMatrix->SetBinEdges(1,binsPt);\r
543   fRecTrackEventMatrix->SetBinEdges(2,binsEta);\r
544   fRecTrackEventMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
545   fRecTrackEventMatrix->GetAxis(1)->SetTitle("mcPt (GeV/c)");\r
546   fRecTrackEventMatrix->GetAxis(2)->SetTitle("mcEta");\r
547   fRecTrackEventMatrix->Sumw2();\r
548 \r
549   fRecTrackSDEventMatrix = new THnSparseF("fRecTrackSDEventMatrix","mcZv:mcPt:mcEta",3,binsTrackMatrix);\r
550   fRecTrackSDEventMatrix->SetBinEdges(0,binsZv);\r
551   fRecTrackSDEventMatrix->SetBinEdges(1,binsPt);\r
552   fRecTrackSDEventMatrix->SetBinEdges(2,binsEta);\r
553   fRecTrackSDEventMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
554   fRecTrackSDEventMatrix->GetAxis(1)->SetTitle("mcPt (GeV/c)");\r
555   fRecTrackSDEventMatrix->GetAxis(2)->SetTitle("mcEta");\r
556   fRecTrackSDEventMatrix->Sumw2();\r
557 \r
558   fRecTrackDDEventMatrix = new THnSparseF("fRecTrackDDEventMatrix","mcZv:mcPt:mcEta",3,binsTrackMatrix);\r
559   fRecTrackDDEventMatrix->SetBinEdges(0,binsZv);\r
560   fRecTrackDDEventMatrix->SetBinEdges(1,binsPt);\r
561   fRecTrackDDEventMatrix->SetBinEdges(2,binsEta);\r
562   fRecTrackDDEventMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
563   fRecTrackDDEventMatrix->GetAxis(1)->SetTitle("mcPt (GeV/c)");\r
564   fRecTrackDDEventMatrix->GetAxis(2)->SetTitle("mcEta");\r
565   fRecTrackDDEventMatrix->Sumw2();\r
566 \r
567   fRecTrackNDEventMatrix = new THnSparseF("fRecTrackNDEventMatrix","mcZv:mcPt:mcEta",3,binsTrackMatrix);\r
568   fRecTrackNDEventMatrix->SetBinEdges(0,binsZv);\r
569   fRecTrackNDEventMatrix->SetBinEdges(1,binsPt);\r
570   fRecTrackNDEventMatrix->SetBinEdges(2,binsEta);\r
571   fRecTrackNDEventMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
572   fRecTrackNDEventMatrix->GetAxis(1)->SetTitle("mcPt (GeV/c)");\r
573   fRecTrackNDEventMatrix->GetAxis(2)->SetTitle("mcEta");\r
574   fRecTrackNDEventMatrix->Sumw2();\r
575 \r
576   fRecTrackNSDEventMatrix = new THnSparseF("fRecTrackNSDEventMatrix","mcZv:mcPt:mcEta",3,binsTrackMatrix);\r
577   fRecTrackNSDEventMatrix->SetBinEdges(0,binsZv);\r
578   fRecTrackNSDEventMatrix->SetBinEdges(1,binsPt);\r
579   fRecTrackNSDEventMatrix->SetBinEdges(2,binsEta);\r
580   fRecTrackNSDEventMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
581   fRecTrackNSDEventMatrix->GetAxis(1)->SetTitle("mcPt (GeV/c)");\r
582   fRecTrackNSDEventMatrix->GetAxis(2)->SetTitle("mcEta");\r
583   fRecTrackNSDEventMatrix->Sumw2();\r
584 \r
585   //\r
586   // tracks correction matrices\r
587   //\r
588   fGenTrackMatrix = new THnSparseF("fGenTrackMatrix","mcZv:mcPt:mcEta",3,binsTrackMatrix);\r
589   fGenTrackMatrix->SetBinEdges(0,binsZv);\r
590   fGenTrackMatrix->SetBinEdges(1,binsPt);\r
591   fGenTrackMatrix->SetBinEdges(2,binsEta);\r
592   fGenTrackMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
593   fGenTrackMatrix->GetAxis(1)->SetTitle("mcPt (GeV/c)");\r
594   fGenTrackMatrix->GetAxis(2)->SetTitle("mcEta");\r
595   fGenTrackMatrix->Sumw2();\r
596 \r
597   fGenPrimTrackMatrix = new THnSparseF("fGenPrimTrackMatrix","mcZv:mcPt:mcEta",3,binsTrackMatrix);\r
598   fGenPrimTrackMatrix->SetBinEdges(0,binsZv);\r
599   fGenPrimTrackMatrix->SetBinEdges(1,binsPt);\r
600   fGenPrimTrackMatrix->SetBinEdges(2,binsEta);\r
601   fGenPrimTrackMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
602   fGenPrimTrackMatrix->GetAxis(1)->SetTitle("mcPt (GeV/c)");\r
603   fGenPrimTrackMatrix->GetAxis(2)->SetTitle("mcEta");\r
604   fGenPrimTrackMatrix->Sumw2();\r
605 \r
606   fRecPrimTrackMatrix = new THnSparseF("fRecPrimTrackMatrix","mcZv:mcPt:mcEta",3,binsTrackMatrix);\r
607   fRecPrimTrackMatrix->SetBinEdges(0,binsZv);\r
608   fRecPrimTrackMatrix->SetBinEdges(1,binsPt);\r
609   fRecPrimTrackMatrix->SetBinEdges(2,binsEta);\r
610   fRecPrimTrackMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
611   fRecPrimTrackMatrix->GetAxis(1)->SetTitle("mcPt (GeV/c)");\r
612   fRecPrimTrackMatrix->GetAxis(2)->SetTitle("mcEta");\r
613   fRecPrimTrackMatrix->Sumw2();\r
614 \r
615   //\r
616   fRecTrackMatrix = new THnSparseF("fRecTrackMatrix","mcZv:mcPt:mcEta",3,binsTrackMatrix);\r
617   fRecTrackMatrix->SetBinEdges(0,binsZv);\r
618   fRecTrackMatrix->SetBinEdges(1,binsPt);\r
619   fRecTrackMatrix->SetBinEdges(2,binsEta);\r
620   fRecTrackMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
621   fRecTrackMatrix->GetAxis(1)->SetTitle("Pt (GeV/c)");\r
622   fRecTrackMatrix->GetAxis(2)->SetTitle("Eta");\r
623   fRecTrackMatrix->Sumw2();\r
624 \r
625   fRecSecTrackMatrix = new THnSparseF("fRecSecTrackMatrix","mcZv:mcPt:mcEta",3,binsTrackMatrix);\r
626   fRecSecTrackMatrix->SetBinEdges(0,binsZv);\r
627   fRecSecTrackMatrix->SetBinEdges(1,binsPt);\r
628   fRecSecTrackMatrix->SetBinEdges(2,binsEta);\r
629   fRecSecTrackMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
630   fRecSecTrackMatrix->GetAxis(1)->SetTitle("Pt (GeV/c)");\r
631   fRecSecTrackMatrix->GetAxis(2)->SetTitle("Eta");\r
632   fRecSecTrackMatrix->Sumw2();\r
633 \r
634   //\r
635   fRecMultTrackMatrix = new THnSparseF("fRecMultTrackMatrix","mcZv:mcPt:mcEta",3,binsTrackMatrix);\r
636   fRecMultTrackMatrix->SetBinEdges(0,binsZv);\r
637   fRecMultTrackMatrix->SetBinEdges(1,binsPt);\r
638   fRecMultTrackMatrix->SetBinEdges(2,binsEta);\r
639   fRecMultTrackMatrix->GetAxis(0)->SetTitle("mcZv (cm)");\r
640   fRecMultTrackMatrix->GetAxis(1)->SetTitle("mcPt (GeV/c)");\r
641   fRecMultTrackMatrix->GetAxis(2)->SetTitle("mcEta");\r
642   fRecMultTrackMatrix->Sumw2();\r
643 \r
644   //\r
645   // Control analysis histograms\r
646   //\r
647 \r
648   Int_t binsMCEventHist1[3]={100,100,140};\r
649   Double_t minMCEventHist1[3]={-0.1,-0.1,-35.}; \r
650   Double_t maxMCEventHist1[3]={0.1,0.1,35.}; \r
651   fMCEventHist1 = new THnSparseF("fMCEventHist1","mcXv:mcYv:mcZv",3,binsMCEventHist1,minMCEventHist1,maxMCEventHist1);\r
652   fMCEventHist1->GetAxis(0)->SetTitle("mcXv (cm)");\r
653   fMCEventHist1->GetAxis(1)->SetTitle("mcYv (cm)");\r
654   fMCEventHist1->GetAxis(2)->SetTitle("mcZv (cm)");\r
655   fMCEventHist1->Sumw2();\r
656 \r
657   //\r
658   Int_t binsRecEventHist1[3]={100,100,140};\r
659   Double_t minRecEventHist1[3]={-3.,-3.,-35.}; \r
660   Double_t maxRecEventHist1[3]={3.,3.,35.}; \r
661   \r
662   fRecEventHist1 = new THnSparseF("fRecEventHist1","Xv:Yv:Zv",3,binsRecEventHist1,minRecEventHist1,maxRecEventHist1);\r
663   fRecEventHist1->GetAxis(0)->SetTitle("Xv (cm)");\r
664   fRecEventHist1->GetAxis(1)->SetTitle("Yv (cm)");\r
665   fRecEventHist1->GetAxis(2)->SetTitle("Zv (cm)");\r
666   fRecEventHist1->Sumw2();\r
667 \r
668   //\r
669   Int_t binsRecEventHist2[3]={zvNbins,150,150};\r
670   Double_t minRecEventHist2[3]={-25.,-0.5,-0.5}; \r
671   Double_t maxRecEventHist2[3]={25.,149.5,149.5}; \r
672   \r
673   fRecEventHist2 = new THnSparseF("fRecEventHist2","Zv:multMB:mult",3,binsRecEventHist2,minRecEventHist2,maxRecEventHist2);\r
674   fRecEventHist2->SetBinEdges(0,binsZv);\r
675   fRecEventHist2->GetAxis(0)->SetTitle("Zv (cm)");\r
676   fRecEventHist2->GetAxis(1)->SetTitle("multiplicity MB");\r
677   fRecEventHist2->GetAxis(2)->SetTitle("multiplicity");\r
678   fRecEventHist2->Sumw2();\r
679 \r
680   //\r
681   Double_t kFact = 1.0;\r
682   if(GetAnalysisMode() == AlidNdPtHelper::kTPCSPDvtx) kFact = 0.05; \r
683 \r
684   Int_t binsRecMCEventHist1[3]={100,100,100};\r
685   Double_t minRecMCEventHist1[3]={-10.0*kFact,-10.0*kFact,-10.0*kFact}; \r
686   Double_t maxRecMCEventHist1[3]={10.0*kFact,10.0*kFact,10.0*kFact}; \r
687    \r
688   fRecMCEventHist1 = new THnSparseF("fRecMCEventHist1","Xv-mcXv:Yv-mcYv:Zv-mcZv",3,binsRecMCEventHist1,minRecMCEventHist1,maxRecMCEventHist1);\r
689   fRecMCEventHist1->GetAxis(0)->SetTitle("Xv-mcXv (cm)");\r
690   fRecMCEventHist1->GetAxis(1)->SetTitle("Yv-mcYv (cm)");\r
691   fRecMCEventHist1->GetAxis(2)->SetTitle("Zv-mcZv (cm)");\r
692   fRecMCEventHist1->Sumw2();\r
693 \r
694   //\r
695   Int_t binsRecMCEventHist2[3]={100,100,150};\r
696   Double_t minRecMCEventHist2[3]={-10.0*kFact,-10.0*kFact,0.0}; \r
697   Double_t maxRecMCEventHist2[3]={10.0*kFact,10.0*kFact,149.50}; \r
698 \r
699   fRecMCEventHist2 = new THnSparseF("fRecMCEventHist2","Xv-mcXv:Zv-mcZv:mult",3,binsRecMCEventHist2,minRecMCEventHist2,maxRecMCEventHist2);\r
700   fRecMCEventHist2->GetAxis(0)->SetTitle("Xv-mcXv (cm)");\r
701   fRecMCEventHist2->GetAxis(1)->SetTitle("Zv-mcZv (cm)");\r
702   fRecMCEventHist2->GetAxis(2)->SetTitle("multiplicity");\r
703   fRecMCEventHist2->Sumw2();\r
704 \r
705   Int_t binsRecMCEventHist3[2]={150,5};\r
706   Double_t minRecMCEventHist3[2]={-0.5,0.0}; \r
707   Double_t maxRecMCEventHist3[2]={149.50,5.0}; \r
708   fRecMCEventHist3 = new THnSparseF("fRecMCEventHist3","mult:EventType (ND, DD, SD)",2,binsRecMCEventHist3,minRecMCEventHist3,maxRecMCEventHist3);\r
709   fRecMCEventHist3->GetAxis(0)->SetTitle("multiplicity");\r
710   fRecMCEventHist3->GetAxis(1)->SetTitle("EventType");\r
711   fRecMCEventHist3->Sumw2();\r
712 \r
713   //\r
714   char name[256];\r
715   char title[256];\r
716   for(Int_t i=0; i<AlidNdPtHelper::kCutSteps; i++) \r
717   {\r
718   // THnSparse track histograms\r
719  \r
720   Int_t binsMCTrackHist1[3]=  {ptNbins, etaNbins, 90};\r
721   Double_t minMCTrackHist1[3]={0.,-1.,0.}; \r
722   Double_t maxMCTrackHist1[3]={10.,1.,2.*TMath::Pi()}; \r
723   sprintf(name,"fMCTrackHist1_%d",i);\r
724   sprintf(title,"mcPt:mcEta:mcPhi");\r
725   \r
726   fMCTrackHist1[i] = new THnSparseF(name,title,3,binsMCTrackHist1,minMCTrackHist1,maxMCTrackHist1);\r
727   fMCTrackHist1[i]->SetBinEdges(0,binsPt);\r
728   fMCTrackHist1[i]->SetBinEdges(1,binsEta);\r
729   fMCTrackHist1[i]->GetAxis(0)->SetTitle("mcPt (GeV/c)");\r
730   fMCTrackHist1[i]->GetAxis(1)->SetTitle("mcEta");\r
731   fMCTrackHist1[i]->GetAxis(2)->SetTitle("mcPhi (rad)");\r
732   fMCTrackHist1[i]->Sumw2();\r
733 \r
734   Int_t binsMCPrimTrackHist2[5]=  {ptNbins,etaNbins,6,20,4000};\r
735   Double_t minMCPrimTrackHist2[5]={0.,-1.,0.,0.,0.}; \r
736   Double_t maxMCPrimTrackHist2[5]={10.,1.,6.,20.,4000.}; \r
737   sprintf(name,"fMCPrimTrackHist1_%d",i);\r
738   sprintf(title,"mcPt:mcEta:pid:mech:mother");\r
739   \r
740   fMCPrimTrackHist1[i] = new THnSparseF(name,title,5,binsMCPrimTrackHist2,minMCPrimTrackHist2,maxMCPrimTrackHist2);\r
741   fMCPrimTrackHist1[i]->SetBinEdges(0,binsPt);\r
742   fMCPrimTrackHist1[i]->SetBinEdges(1,binsEta);\r
743   fMCPrimTrackHist1[i]->GetAxis(0)->SetTitle("mcPt (GeV/c)");\r
744   fMCPrimTrackHist1[i]->GetAxis(1)->SetTitle("mcEta");\r
745   fMCPrimTrackHist1[i]->GetAxis(2)->SetTitle("pid");\r
746   fMCPrimTrackHist1[i]->GetAxis(3)->SetTitle("mech");\r
747   fMCPrimTrackHist1[i]->GetAxis(4)->SetTitle("mother");\r
748   fMCPrimTrackHist1[i]->Sumw2();\r
749 \r
750   Int_t binsMCSecTrackHist1[5]=  {ptNbins,etaNbins,6,20,4000};\r
751   Double_t minMCSecTrackHist1[5]={0.,-1.,0.,0.,0.}; \r
752   Double_t maxMCSecTrackHist1[5]={10.,1.,6.,20.,4000.}; \r
753   sprintf(name,"fMCSecTrackHist1_%d",i);\r
754   sprintf(title,"mcPt:mcEta:mcPhi:pid:mech:mother");\r
755   \r
756   fMCSecTrackHist1[i] = new THnSparseF(name,title,5,binsMCSecTrackHist1,minMCSecTrackHist1,maxMCSecTrackHist1);\r
757   fMCSecTrackHist1[i]->SetBinEdges(0,binsPt);\r
758   fMCSecTrackHist1[i]->SetBinEdges(1,binsEta);\r
759   fMCSecTrackHist1[i]->GetAxis(0)->SetTitle("mcPt (GeV/c)");\r
760   fMCSecTrackHist1[i]->GetAxis(1)->SetTitle("mcEta");\r
761   fMCSecTrackHist1[i]->GetAxis(2)->SetTitle("pid");\r
762   fMCSecTrackHist1[i]->GetAxis(3)->SetTitle("mech");\r
763   fMCSecTrackHist1[i]->GetAxis(4)->SetTitle("mother");\r
764   fMCSecTrackHist1[i]->Sumw2();\r
765 \r
766   //\r
767 \r
768   // \r
769   \r
770   Int_t binsRecTrackHist1[3]={ptNbins,etaNbins,90};\r
771   Double_t minRecTrackHist1[3]={0.,-1.,0.}; \r
772   Double_t maxRecTrackHist1[3]={10.,1.,2.*TMath::Pi()};\r
773   sprintf(name,"fRecTrackHist1_%d",i);\r
774   sprintf(title,"Pt:Eta:Phi");\r
775   fRecTrackHist1[i] = new THnSparseF(name,title,3,binsRecTrackHist1,minRecTrackHist1,maxRecTrackHist1);\r
776   fRecTrackHist1[i]->SetBinEdges(0,binsPt);\r
777   fRecTrackHist1[i]->SetBinEdges(1,binsEta);\r
778   fRecTrackHist1[i]->GetAxis(0)->SetTitle("p_{T} (GeV/c)");\r
779   fRecTrackHist1[i]->GetAxis(1)->SetTitle("#eta");\r
780   fRecTrackHist1[i]->GetAxis(2)->SetTitle("#phi (rad)");\r
781   fRecTrackHist1[i]->Sumw2();\r
782 \r
783   // \r
784   Int_t binsRecTrackMultHist1[2]={ptNbins,150};\r
785   Double_t minRecTrackMultHist1[2]={0.,-0.5}; \r
786   Double_t maxRecTrackMultHist1[2]={10.,149.5};\r
787   sprintf(name,"fRecTrackMultHist_%d",i);\r
788   sprintf(title,"Pt:Mult");\r
789   fRecTrackMultHist1[i] = new THnSparseF(name,title,2,binsRecTrackMultHist1,minRecTrackMultHist1,maxRecTrackMultHist1);\r
790   fRecTrackMultHist1[i]->SetBinEdges(0,binsPt);\r
791   fRecTrackMultHist1[i]->GetAxis(0)->SetTitle("Pt (GeV/c)");\r
792   fRecTrackMultHist1[i]->GetAxis(1)->SetTitle("multiplicity");\r
793   fRecTrackMultHist1[i]->Sumw2();\r
794   }\r
795 \r
796   Int_t binsRecMCTrackHist1[4] = {ptNbins,etaNbins,100,100};\r
797   Double_t minRecMCTrackHist1[4]={0.,-1.,-0.5,-0.5}; \r
798   Double_t maxRecMCTrackHist1[4]={20.,1.,0.5,0.5}; \r
799   sprintf(name,"fRecMCTrackHist1");\r
800   sprintf(title,"mcPt:mcEta:(Pt-mcPt)/mcPt:(Eta-mcEta)");\r
801   fRecMCTrackHist1 = new THnSparseF(name,title,4,binsRecMCTrackHist1,minRecMCTrackHist1,maxRecMCTrackHist1);\r
802   fRecMCTrackHist1->SetBinEdges(0,binsPt);\r
803   fRecMCTrackHist1->SetBinEdges(1,binsEta);\r
804   fRecMCTrackHist1->GetAxis(0)->SetTitle("mcPt (GeV/c)");\r
805   fRecMCTrackHist1->GetAxis(1)->SetTitle("mcEta");\r
806   fRecMCTrackHist1->GetAxis(2)->SetTitle("(Pt-mcPt)/mcPt");\r
807   fRecMCTrackHist1->GetAxis(3)->SetTitle("Eta-mcEta");\r
808 \r
809   Int_t binsMCMultRecTrackHist1[3] = {ptNbins,etaNbins,6};\r
810   Double_t minMCMultRecTrackHist1[3]={0.,-1.,0.}; \r
811   Double_t maxMCMultRecTrackHist1[3]={20.,1.,6.}; \r
812   sprintf(name,"fMCMultRecTrackHist1");\r
813   sprintf(title,"mcPt:mcEta:pid");\r
814   fMCMultRecTrackHist1 = new THnSparseF(name,title,3,binsMCMultRecTrackHist1,minMCMultRecTrackHist1,maxMCMultRecTrackHist1);\r
815   fMCMultRecTrackHist1->SetBinEdges(0,binsPt);\r
816   fMCMultRecTrackHist1->SetBinEdges(1,binsEta);\r
817   fMCMultRecTrackHist1->GetAxis(0)->SetTitle("mcPt (GeV/c)");\r
818   fMCMultRecTrackHist1->GetAxis(1)->SetTitle("mcEta");\r
819   fMCMultRecTrackHist1->GetAxis(2)->SetTitle("pid");\r
820 \r
821   //nClust:chi2PerClust:pt:eta:phi\r
822   Int_t binsRecTrackHist2[5]={160,100,ptNbins,etaNbins,90};\r
823   Double_t minRecTrackHist2[5]={0., 0., 0, -1.5, 0.};\r
824   Double_t maxRecRecTrackHist2[5]={160.,10., 16, 1.5, 2.*TMath::Pi()};\r
825 \r
826   fRecTrackHist2 = new THnSparseF("fRecTrackHist2","nClust:chi2PerClust:pt:eta:phi",5,binsRecTrackHist2,minRecTrackHist2,maxRecRecTrackHist2);\r
827   fRecTrackHist2->SetBinEdges(2,binsPt);\r
828   fRecTrackHist2->SetBinEdges(3,binsEta);\r
829   fRecTrackHist2->GetAxis(0)->SetTitle("nClust");\r
830   fRecTrackHist2->GetAxis(1)->SetTitle("chi2PerClust");\r
831   fRecTrackHist2->GetAxis(2)->SetTitle("p_{T} (GeV/c)");\r
832   fRecTrackHist2->GetAxis(3)->SetTitle("#eta");\r
833   fRecTrackHist2->GetAxis(4)->SetTitle("#phi (rad)");\r
834   fRecTrackHist2->Sumw2();\r
835 \r
836   // init folder\r
837   fAnalysisFolder = CreateFolder("folderdNdPt","Analysis dNdPt Folder");\r
838 }\r
839 \r
840 //_____________________________________________________________________________\r
841 void AlidNdPtAnalysis::Process(AliESDEvent *const esdEvent, AliMCEvent *const mcEvent)\r
842 {\r
843   //\r
844   // Process real and/or simulated events\r
845   //\r
846   if(!esdEvent) {\r
847     AliDebug(AliLog::kError, "esdEvent not available");\r
848     return;\r
849   }\r
850 \r
851   // get selection cuts\r
852   AlidNdPtEventCuts *evtCuts = GetEventCuts(); \r
853   AlidNdPtAcceptanceCuts *accCuts = GetAcceptanceCuts(); \r
854   AliESDtrackCuts *esdTrackCuts = GetTrackCuts(); \r
855 \r
856   if(!evtCuts || !accCuts  || !esdTrackCuts) {\r
857     AliDebug(AliLog::kError, "cuts not available");\r
858     return;\r
859   }\r
860 \r
861   // trigger selection\r
862   Bool_t isEventTriggered = kTRUE;\r
863   if(evtCuts->IsTriggerRequired())  {\r
864     //static AliTriggerAnalysis* triggerAnalysis = new AliTriggerAnalysis;\r
865     //isEventTriggered = triggerAnalysis->IsTriggerFired(esdEvent, GetTrigger());\r
866     isEventTriggered = esdEvent->IsTriggerClassFired(GetTriggerClass());\r
867   }\r
868 \r
869   // use MC information\r
870   AliHeader* header = 0;\r
871   AliGenEventHeader* genHeader = 0;\r
872   AliStack* stack = 0;\r
873   TArrayF vtxMC(3);\r
874   AliPWG0Helper::MCProcessType evtType = AliPWG0Helper::kInvalidProcess;\r
875 \r
876   Int_t multMCTrueTracks = 0;\r
877   if(IsUseMCInfo())\r
878   {\r
879     //\r
880     if(!mcEvent) {\r
881       AliDebug(AliLog::kError, "mcEvent not available");\r
882       return;\r
883     }\r
884     // get MC event header\r
885     header = mcEvent->Header();\r
886     if (!header) {\r
887       AliDebug(AliLog::kError, "Header not available");\r
888       return;\r
889     }\r
890     // MC particle stack\r
891     stack = mcEvent->Stack();\r
892     if (!stack) {\r
893       AliDebug(AliLog::kError, "Stack not available");\r
894       return;\r
895     }\r
896     // get event type (ND=0x1, DD=0x2, SD=0x4)\r
897     evtType = AliPWG0Helper::GetEventProcessType(header);\r
898     AliDebug(AliLog::kDebug+1, Form("Found process type %d", evtType));\r
899 \r
900     // get MC vertex\r
901     genHeader = header->GenEventHeader();\r
902     if (!genHeader) {\r
903       AliDebug(AliLog::kError, "Could not retrieve genHeader from Header");\r
904       return;\r
905     }\r
906     genHeader->PrimaryVertex(vtxMC);\r
907 \r
908     Double_t vMCEventHist1[3]={vtxMC[0],vtxMC[1],vtxMC[2]};\r
909     fMCEventHist1->Fill(vMCEventHist1);\r
910 \r
911     // multipliticy of all MC primary tracks\r
912     // in Zv, pt and eta ranges)\r
913     multMCTrueTracks = AlidNdPtHelper::GetMCTrueTrackMult(mcEvent,evtCuts,accCuts);\r
914 \r
915   } // end bUseMC\r
916 \r
917   // get reconstructed vertex  \r
918   const AliESDVertex* vtxESD = 0; \r
919   Bool_t isRecVertex = kFALSE;\r
920   if(evtCuts->IsRecVertexRequired()) \r
921   {\r
922     Bool_t bRedoTPCVertex = evtCuts->IsRedoTPCVertex();\r
923     Bool_t bUseConstraints = evtCuts->IsUseBeamSpotConstraint();\r
924     vtxESD = AlidNdPtHelper::GetVertex(esdEvent,evtCuts,accCuts,esdTrackCuts,GetAnalysisMode(),kFALSE,bRedoTPCVertex,bUseConstraints); \r
925     isRecVertex = AlidNdPtHelper::TestRecVertex(vtxESD, GetAnalysisMode(), kFALSE);\r
926   }\r
927   if( IsUseMCInfo() && !evtCuts->IsRecVertexRequired() ) {\r
928     vtxESD = new AliESDVertex(vtxMC[2],10.,genHeader->NProduced(),"smearMC");\r
929     isRecVertex = kTRUE;\r
930   }\r
931   Bool_t isEventOK = evtCuts->AcceptEvent(esdEvent,mcEvent,vtxESD) && isRecVertex; \r
932   //printf("isEventOK %d, isEventTriggered %d \n",isEventOK, isEventTriggered);\r
933 \r
934   // MB bias tracks\r
935   Int_t multMBTracks = 0; \r
936   if(GetAnalysisMode() == AlidNdPtHelper::kTPC || GetAnalysisMode() == AlidNdPtHelper::kMCPion ||  \r
937      GetAnalysisMode() == AlidNdPtHelper::kMCKaon ||  GetAnalysisMode() == AlidNdPtHelper::kMCProton || \r
938      GetAnalysisMode() ==AlidNdPtHelper::kPlus || GetAnalysisMode() ==AlidNdPtHelper::kMinus) {  \r
939 \r
940      multMBTracks = AlidNdPtHelper::GetTPCMBTrackMult(esdEvent,evtCuts,accCuts,esdTrackCuts);\r
941   } \r
942   else if(GetAnalysisMode() == AlidNdPtHelper::kTPCSPDvtx || GetAnalysisMode() == AlidNdPtHelper::kMCPion || \r
943           GetAnalysisMode() == AlidNdPtHelper::kMCKaon || GetAnalysisMode() == AlidNdPtHelper::kMCProton || \r
944           GetAnalysisMode() ==AlidNdPtHelper::kPlus || GetAnalysisMode() == AlidNdPtHelper::kMinus) {\r
945 \r
946            multMBTracks = AlidNdPtHelper::GetSPDMBTrackMult(esdEvent,0.0);\r
947   } \r
948   else {\r
949     AliDebug(AliLog::kError, Form("Found analysis type %s", GetAnalysisMode()));\r
950     return; \r
951   }\r
952  \r
953   TObjArray *allChargedTracks=0;\r
954   Int_t multAll=0, multAcc=0, multRec=0;\r
955   Int_t *labelsAll=0, *labelsAcc=0, *labelsRec=0;\r
956 \r
957   // check event cuts\r
958   if(isEventOK && isEventTriggered)\r
959   {\r
960     // get all charged tracks\r
961     //allChargedTracks = AlidNdPtHelper::GetAllChargedTracks(esdEvent,vtxESD,GetAnalysisMode());\r
962     allChargedTracks = AlidNdPtHelper::GetAllChargedTracks(esdEvent,GetAnalysisMode());\r
963     if(!allChargedTracks) return;\r
964 \r
965     Int_t entries = allChargedTracks->GetEntries();\r
966     labelsAll = new Int_t[entries];\r
967     labelsAcc = new Int_t[entries];\r
968     labelsRec = new Int_t[entries];\r
969     for(Int_t i=0; i<entries;++i) \r
970     {\r
971       AliESDtrack *track = (AliESDtrack*)allChargedTracks->At(i);\r
972       if(!track) continue;\r
973       if(track->Charge()==0) continue;\r
974         \r
975        FillHistograms(track,stack,AlidNdPtHelper::kAllTracks); \r
976        labelsAll[multAll] = TMath::Abs(track->GetLabel());\r
977        multAll++;\r
978 \r
979        if(accCuts->AcceptTrack(track)) {\r
980          FillHistograms(track,stack,AlidNdPtHelper::kAccTracks); \r
981          labelsAcc[multAcc] = TMath::Abs(track->GetLabel());\r
982          multAcc++;\r
983 \r
984          if(esdTrackCuts->AcceptTrack(track)) {\r
985            FillHistograms(track,stack,AlidNdPtHelper::kRecTracks); \r
986            labelsRec[multRec] = TMath::Abs(track->GetLabel());\r
987            multRec++;\r
988          }\r
989        }\r
990      } \r
991      // fill track multiplicity histograms\r
992      FillHistograms(allChargedTracks,labelsAll,multAll,labelsAcc,multAcc,labelsRec,multRec);\r
993 \r
994      Double_t vRecEventHist1[3] = {vtxESD->GetXv(),vtxESD->GetYv(),vtxESD->GetZv()};\r
995      fRecEventHist1->Fill(vRecEventHist1);\r
996 \r
997      Double_t vRecEventHist2[3] = {vtxESD->GetZv(),multMBTracks,multRec};\r
998      fRecEventHist2->Fill(vRecEventHist2);\r
999    } \r
1000 \r
1001    //\r
1002    // Determine correction matrices\r
1003    //\r
1004    if(IsUseMCInfo())  \r
1005    {\r
1006      //\r
1007      // multiplicity correlation matrix\r
1008      //\r
1009      Double_t vMultTrueEventMatrix[2] = {multRec,multMCTrueTracks};\r
1010      fEventMultCorrelationMatrix->Fill(vMultTrueEventMatrix);\r
1011 \r
1012      // \r
1013      // event level corrections (zv,N_MB)\r
1014      //\r
1015 \r
1016      // all inelastic\r
1017      Double_t vEventMatrix[2] = {vtxMC[2],multMBTracks};\r
1018      fGenEventMatrix->Fill(vEventMatrix); \r
1019      if(isEventTriggered) fTriggerEventMatrix->Fill(vEventMatrix);\r
1020      if(isEventOK && isEventTriggered) fRecEventMatrix->Fill(vEventMatrix);\r
1021 \r
1022      // single diffractive\r
1023      if(evtType == AliPWG0Helper::kSD) {\r
1024        fGenSDEventMatrix->Fill(vEventMatrix); \r
1025        if(isEventTriggered) fTriggerSDEventMatrix->Fill(vEventMatrix);\r
1026        if(isEventOK && isEventTriggered) fRecSDEventMatrix->Fill(vEventMatrix);\r
1027      }\r
1028 \r
1029      // double diffractive\r
1030      if(evtType == AliPWG0Helper::kDD) {\r
1031        fGenDDEventMatrix->Fill(vEventMatrix); \r
1032        if(isEventTriggered) fTriggerDDEventMatrix->Fill(vEventMatrix);\r
1033        if(isEventOK && isEventTriggered)  fRecDDEventMatrix->Fill(vEventMatrix);\r
1034      }\r
1035 \r
1036      // non diffractive\r
1037      if(evtType == AliPWG0Helper::kND) {\r
1038        fGenNDEventMatrix->Fill(vEventMatrix); \r
1039        if(isEventTriggered) fTriggerNDEventMatrix->Fill(vEventMatrix);\r
1040        if(isEventOK && isEventTriggered) fRecNDEventMatrix->Fill(vEventMatrix);\r
1041      }\r
1042 \r
1043      // non single diffractive\r
1044      if(evtType != AliPWG0Helper::kSD) {\r
1045        fGenNSDEventMatrix->Fill(vEventMatrix); \r
1046        if(isEventTriggered) fTriggerNSDEventMatrix->Fill(vEventMatrix);\r
1047        if(isEventOK && isEventTriggered) fRecNSDEventMatrix->Fill(vEventMatrix);\r
1048      }\r
1049 \r
1050      //\r
1051      // track-event level corrections (zv,pt,eta)\r
1052      //\r
1053      for (Int_t iMc = 0; iMc < stack->GetNtrack(); ++iMc) \r
1054      {\r
1055        TParticle* particle = stack->Particle(iMc);\r
1056        if (!particle)\r
1057        continue;\r
1058 \r
1059        // only charged particles\r
1060        Double_t charge = particle->GetPDG()->Charge()/3.;\r
1061        if (charge == 0.0)\r
1062         continue;\r
1063 \r
1064        // only postive charged \r
1065        if(GetAnalysisMode() == AlidNdPtHelper::kPlus && charge < 0.) \r
1066         continue;\r
1067        \r
1068        // only negative charged \r
1069        if(GetAnalysisMode() == AlidNdPtHelper::kMinus && charge > 0.) \r
1070        continue;\r
1071       \r
1072        // physical primary\r
1073        Bool_t prim = stack->IsPhysicalPrimary(iMc);\r
1074        if(!prim) continue;\r
1075 \r
1076        // checked accepted\r
1077        if(accCuts->AcceptTrack(particle)) \r
1078        {\r
1079          Double_t vTrackEventMatrix[3] = {vtxMC[2], particle->Pt(), particle->Eta()}; \r
1080          fGenTrackEventMatrix->Fill(vTrackEventMatrix);\r
1081 \r
1082          if(evtType == AliPWG0Helper::kSD) {\r
1083            fGenTrackSDEventMatrix->Fill(vTrackEventMatrix);\r
1084          }\r
1085          if(evtType == AliPWG0Helper::kDD) {\r
1086            fGenTrackDDEventMatrix->Fill(vTrackEventMatrix);\r
1087          }\r
1088          if(evtType == AliPWG0Helper::kND) {\r
1089            fGenTrackNDEventMatrix->Fill(vTrackEventMatrix);\r
1090          }\r
1091          if(evtType != AliPWG0Helper::kSD) {\r
1092            fGenTrackNSDEventMatrix->Fill(vTrackEventMatrix);\r
1093          }\r
1094 \r
1095          //\r
1096          if(!isEventTriggered) continue;  \r
1097 \r
1098          fTriggerTrackEventMatrix->Fill(vTrackEventMatrix);\r
1099          if(evtType == AliPWG0Helper::kSD) {\r
1100            fTriggerTrackSDEventMatrix->Fill(vTrackEventMatrix);\r
1101          }\r
1102          if(evtType == AliPWG0Helper::kDD) {\r
1103            fTriggerTrackDDEventMatrix->Fill(vTrackEventMatrix);\r
1104          }\r
1105          if(evtType == AliPWG0Helper::kND) {\r
1106            fTriggerTrackNDEventMatrix->Fill(vTrackEventMatrix);\r
1107          }\r
1108          if(evtType != AliPWG0Helper::kSD) {\r
1109            fTriggerTrackNSDEventMatrix->Fill(vTrackEventMatrix);\r
1110          }\r
1111 \r
1112          //\r
1113          if(!isEventOK) continue;  \r
1114 \r
1115          fRecTrackEventMatrix->Fill(vTrackEventMatrix);\r
1116          if(evtType == AliPWG0Helper::kSD) {\r
1117            fRecTrackSDEventMatrix->Fill(vTrackEventMatrix);\r
1118          }\r
1119          if(evtType == AliPWG0Helper::kDD) {\r
1120            fRecTrackDDEventMatrix->Fill(vTrackEventMatrix);\r
1121          }\r
1122          if(evtType == AliPWG0Helper::kND) {\r
1123            fRecTrackNDEventMatrix->Fill(vTrackEventMatrix);\r
1124          }\r
1125          if(evtType != AliPWG0Helper::kSD) {\r
1126            fRecTrackNSDEventMatrix->Fill(vTrackEventMatrix);\r
1127          }\r
1128        }\r
1129      }\r
1130 \r
1131      // \r
1132      // track-level corrections (zv,pt.eta)\r
1133      //\r
1134      if(isEventOK && isEventTriggered)\r
1135      {\r
1136 \r
1137        // fill MC and rec event control histograms\r
1138        if(fHistogramsOn) {\r
1139          Double_t vRecMCEventHist1[3] = {vtxESD->GetXv()-vtxMC[0],vtxESD->GetYv()-vtxMC[1],vtxESD->GetZv()-vtxMC[2]};\r
1140          fRecMCEventHist1->Fill(vRecMCEventHist1);\r
1141 \r
1142          Double_t vRecMCEventHist2[3] = {vtxESD->GetXv()-vtxMC[0],vtxESD->GetZv()-vtxMC[2],multMBTracks};\r
1143          fRecMCEventHist2->Fill(vRecMCEventHist2);\r
1144 \r
1145          Double_t vRecMCEventHist3[2] = {multRec,evtType};\r
1146          fRecMCEventHist3->Fill(vRecMCEventHist3);\r
1147        }\r
1148 \r
1149        //\r
1150        // MC histograms for track efficiency studies\r
1151        //\r
1152        for (Int_t iMc = 0; iMc < stack->GetNtrack(); ++iMc) \r
1153        {\r
1154          TParticle* particle = stack->Particle(iMc);\r
1155          if (!particle)\r
1156          continue;\r
1157 \r
1158          Double_t vTrackMatrix[3] = {vtxMC[2],particle->Pt(),particle->Eta()}; \r
1159 \r
1160          // all genertated primaries including neutral\r
1161          if( iMc < stack->GetNprimary() ) {\r
1162            fGenTrackMatrix->Fill(vTrackMatrix);\r
1163          }\r
1164 \r
1165          // only charged particles\r
1166          Double_t charge = particle->GetPDG()->Charge()/3.;\r
1167          if (charge == 0.0)\r
1168          continue;\r
1169 \r
1170          // only postive charged \r
1171          if(GetAnalysisMode() == AlidNdPtHelper::kPlus && charge < 0.) \r
1172          continue;\r
1173        \r
1174          // only negative charged \r
1175          if(GetAnalysisMode() == AlidNdPtHelper::kMinus && charge > 0.) \r
1176          continue;\r
1177       \r
1178          // physical primary\r
1179          Bool_t prim = stack->IsPhysicalPrimary(iMc);\r
1180 \r
1181          // check accepted\r
1182          if(accCuts->AcceptTrack(particle)) \r
1183          {\r
1184 \r
1185            if( AlidNdPtHelper::IsPrimaryParticle(stack, iMc, GetAnalysisMode()) ) fGenPrimTrackMatrix->Fill(vTrackMatrix);\r
1186 \r
1187            // fill control histograms\r
1188            if(fHistogramsOn) \r
1189              FillHistograms(stack,iMc,AlidNdPtHelper::kAccTracks); \r
1190 \r
1191            // check multiple found tracks\r
1192            Int_t mult_count = 0;\r
1193            for(Int_t iRec=0; iRec<multRec; ++iRec)\r
1194            {\r
1195              if(iMc == labelsRec[iRec]) \r
1196              {\r
1197                mult_count++;\r
1198                if(mult_count>1)\r
1199                {  \r
1200                  fRecMultTrackMatrix->Fill(vTrackMatrix);\r
1201 \r
1202                  // fill control histogram\r
1203                  if(fHistogramsOn) {\r
1204                    Int_t pid = AlidNdPtHelper::ConvertPdgToPid(particle);\r
1205                    Double_t vMCMultRecTrackHist1[3] = {particle->Pt(), particle->Eta(), pid};\r
1206                    fMCMultRecTrackHist1->Fill(vMCMultRecTrackHist1);\r
1207                  }\r
1208                }\r
1209              }\r
1210            }\r
1211 \r
1212            // check reconstructed\r
1213            for(Int_t iRec=0; iRec<multRec; ++iRec)\r
1214            {\r
1215              if(iMc == labelsRec[iRec]) \r
1216              {\r
1217                fRecTrackMatrix->Fill(vTrackMatrix);\r
1218                if( AlidNdPtHelper::IsPrimaryParticle(stack, iMc, GetAnalysisMode()) ) fRecPrimTrackMatrix->Fill(vTrackMatrix);\r
1219                if(!prim) fRecSecTrackMatrix->Fill(vTrackMatrix);\r
1220 \r
1221                // fill control histograms\r
1222                if(fHistogramsOn) \r
1223                  FillHistograms(stack,iMc,AlidNdPtHelper::kRecTracks); \r
1224               \r
1225                break;\r
1226              }\r
1227            }\r
1228          }\r
1229        }\r
1230      }\r
1231    } // end bUseMC\r
1232 \r
1233   if(allChargedTracks) delete allChargedTracks; allChargedTracks = 0;\r
1234   if(labelsAll) delete [] labelsAll; labelsAll = 0;\r
1235   if(labelsAcc) delete [] labelsAcc; labelsAcc = 0;\r
1236   if(labelsRec) delete [] labelsRec; labelsRec = 0;\r
1237 \r
1238   if(!evtCuts->IsRecVertexRequired() && vtxESD != NULL) delete vtxESD;\r
1239 \r
1240 }\r
1241 \r
1242 //_____________________________________________________________________________\r
1243 void AlidNdPtAnalysis::FillHistograms(TObjArray *const allChargedTracks,Int_t *const labelsAll,Int_t multAll,Int_t *const labelsAcc,Int_t multAcc,Int_t *const labelsRec,Int_t multRec) {\r
1244  // multiplicity  histograms\r
1245  \r
1246   if(!allChargedTracks) return;\r
1247   if(!labelsAll) return;\r
1248   if(!labelsAcc) return;\r
1249   if(!labelsRec) return;\r
1250 \r
1251   Int_t entries = allChargedTracks->GetEntries();\r
1252   for(Int_t i=0; i<entries; ++i)\r
1253   {\r
1254      AliESDtrack *track = (AliESDtrack*)allChargedTracks->At(i);\r
1255      if(!track) continue;\r
1256      if(track->Charge() == 0) continue;\r
1257 \r
1258      Int_t label = TMath::Abs(track->GetLabel());\r
1259      for(Int_t iAll=0; iAll<multAll; ++iAll) {\r
1260        if(label == labelsAll[iAll]) {\r
1261          Double_t v1[2] = {track->Pt(), multAll}; \r
1262          fRecTrackMultHist1[AlidNdPtHelper::kAllTracks]->Fill(v1);\r
1263        }\r
1264      }\r
1265      for(Int_t iAcc=0; iAcc<multAcc; ++iAcc) {\r
1266        if(label == labelsAcc[iAcc]) {\r
1267          Double_t v2[2] = {track->Pt(), multAcc}; \r
1268          fRecTrackMultHist1[AlidNdPtHelper::kAccTracks]->Fill(v2);\r
1269        }\r
1270      }\r
1271      for(Int_t iRec=0; iRec<multRec; ++iRec) {\r
1272        if(label == labelsRec[iRec]) {\r
1273          Double_t v3[2] = {track->Pt(), multRec}; \r
1274          fRecTrackMultHist1[AlidNdPtHelper::kRecTracks]->Fill(v3);\r
1275        }\r
1276      }\r
1277   }\r
1278 }\r
1279 \r
1280 //_____________________________________________________________________________\r
1281 void AlidNdPtAnalysis::FillHistograms(AliESDtrack *const esdTrack, AliStack *const stack, AlidNdPtHelper::TrackObject trackObj)\r
1282 {\r
1283   //\r
1284   // Fill ESD track and MC histograms \r
1285   //\r
1286   if(!esdTrack) return;\r
1287 \r
1288   Float_t q = esdTrack->Charge();\r
1289   if(q==0) return;\r
1290 \r
1291   Float_t pt = esdTrack->Pt();\r
1292   //Float_t qpt = esdTrack->Pt() * q;\r
1293   Float_t eta = esdTrack->Eta();\r
1294   Float_t phi = esdTrack->Phi();\r
1295 \r
1296   Float_t dca[2], bCov[3];\r
1297   esdTrack->GetImpactParameters(dca,bCov);\r
1298 \r
1299   Int_t nClust = esdTrack->GetTPCclusters(0);\r
1300   Float_t chi2PerCluster = 0.;\r
1301   if(nClust>0.) chi2PerCluster = esdTrack->GetTPCchi2()/Float_t(nClust);\r
1302 \r
1303 \r
1304   // fill histograms\r
1305   Double_t values[3] = {pt,eta,phi};      \r
1306   fRecTrackHist1[trackObj]->Fill(values);\r
1307 \r
1308   Double_t values1[5] = {nClust,chi2PerCluster,pt,eta,phi};       \r
1309   if(trackObj == AlidNdPtHelper::kRecTracks)  \r
1310   {\r
1311     if(fHistogramsOn)\r
1312       fRecTrackHist2->Fill(values1);\r
1313   }\r
1314  \r
1315   //\r
1316   // Fill rec vs MC information\r
1317   //\r
1318   if(!stack) return;\r
1319 \r
1320   Int_t label = TMath::Abs(esdTrack->GetLabel()); \r
1321   //if(label == 0) return;\r
1322 \r
1323   TParticle* particle = stack->Particle(label);\r
1324   if(!particle) return;\r
1325 \r
1326   //Bool_t prim = stack->IsPhysicalPrimary(label);\r
1327   //Int_t pid = AlidNdPtHelper::ConvertPdgToPid(particle);\r
1328 \r
1329   Int_t mother_pdg = -1;\r
1330   TParticle* mother = 0;\r
1331 \r
1332   //TParticle* prim_mother = AlidNdPtHelper::FindPrimaryMother(stack,label);\r
1333   Int_t motherLabel = particle->GetMother(0); \r
1334   if(motherLabel>0) mother = stack->Particle(motherLabel);\r
1335   if(mother) mother_pdg = TMath::Abs(mother->GetPdgCode()); // take abs for visualisation only\r
1336   //Int_t mech = particle->GetUniqueID(); // production mechanism\r
1337 \r
1338   Double_t gq = particle->GetPDG()->Charge()/3.0; // Charge units |e|/3 \r
1339   if(gq==0) return;\r
1340   Float_t gpt = particle->Pt();\r
1341   Float_t geta = particle->Eta();\r
1342   //Float_t qgpt = particle->Pt() * gq;\r
1343   //Float_t gphi = particle->Phi();\r
1344 \r
1345   Double_t dpt=0;\r
1346   if(gpt) dpt = (pt-gpt)/gpt;\r
1347   Double_t deta = (eta-geta);\r
1348  \r
1349   // fill histograms\r
1350   if(trackObj == AlidNdPtHelper::kRecTracks)  \r
1351   {\r
1352     Double_t vTrackPtCorrelationMatrix[3]={pt,gpt,geta};\r
1353     fTrackPtCorrelationMatrix->Fill(vTrackPtCorrelationMatrix);\r
1354 \r
1355     Double_t vRecMCTrackHist1[4]={gpt,geta,dpt,deta};\r
1356     fRecMCTrackHist1->Fill(vRecMCTrackHist1);\r
1357   }\r
1358 }\r
1359 \r
1360 //_____________________________________________________________________________\r
1361 void AlidNdPtAnalysis::FillHistograms(AliStack *const stack, Int_t label, AlidNdPtHelper::TrackObject trackObj)\r
1362 {\r
1363   // Fill MC histograms\r
1364   if(!stack) return;\r
1365 \r
1366   TParticle* particle = stack->Particle(label);\r
1367   if(!particle) return;\r
1368 \r
1369   Int_t mother_pdg = -1;\r
1370   TParticle* mother = 0;\r
1371 \r
1372   //TParticle* prim_mother = AlidNdPtHelper::FindPrimaryMother(stack,label);\r
1373   Int_t motherLabel = particle->GetMother(0); \r
1374   if(motherLabel>0) mother = stack->Particle(motherLabel);\r
1375   if(mother) mother_pdg = TMath::Abs(mother->GetPdgCode()); // take abs for visualisation only\r
1376   Int_t mech = particle->GetUniqueID(); // production mechanism\r
1377 \r
1378   Double_t gq = particle->GetPDG()->Charge()/3.0; // Charge units |e|/3 \r
1379   if(gq == 0) return;\r
1380   Float_t gpt = particle->Pt();\r
1381   //Float_t qgpt = particle->Pt() * gq;\r
1382   Float_t geta = particle->Eta();\r
1383   Float_t gphi = particle->Phi();\r
1384   //Float_t gpz = particle->Pz();\r
1385 \r
1386   Bool_t prim = stack->IsPhysicalPrimary(label);\r
1387   //Float_t vx = particle->Vx(); Float_t vy = particle->Vy(); Float_t vz = particle->Vz();\r
1388 \r
1389   Int_t pid = AlidNdPtHelper::ConvertPdgToPid(particle);\r
1390 \r
1391   //if(prim&&pid==5) printf("pdgcode %d, production mech %d \n",particle->GetPdgCode(),mech);\r
1392   //if(!prim) printf("mother_pdg %d, particle %d, production mech %d\n",mother_pdg, particle->GetPdgCode(),mech);\r
1393   \r
1394   //\r
1395   // fill histogram\r
1396   //\r
1397   Double_t vMCTrackHist1[3] = {gpt,geta,gphi};\r
1398   fMCTrackHist1[trackObj]->Fill(vMCTrackHist1);\r
1399 \r
1400   Double_t vMCPrimTrackHist1[5] = {gpt,geta,pid,mech,mother_pdg};\r
1401   if(prim) fMCPrimTrackHist1[trackObj]->Fill(vMCPrimTrackHist1);\r
1402   else     { \r
1403          fMCSecTrackHist1[trackObj]->Fill(vMCPrimTrackHist1);\r
1404   }\r
1405 }\r
1406 \r
1407 //_____________________________________________________________________________\r
1408 Long64_t AlidNdPtAnalysis::Merge(TCollection* list) \r
1409 {\r
1410   // Merge list of objects (needed by PROOF)\r
1411 \r
1412   if (!list)\r
1413   return 0;\r
1414 \r
1415   if (list->IsEmpty())\r
1416   return 1;\r
1417 \r
1418   TIterator* iter = list->MakeIterator();\r
1419   TObject* obj = 0;\r
1420 \r
1421   // collection of generated histograms\r
1422 \r
1423   Int_t count=0;\r
1424   while((obj = iter->Next()) != 0) {\r
1425     AlidNdPtAnalysis* entry = dynamic_cast<AlidNdPtAnalysis*>(obj);\r
1426     if (entry == 0) continue; \r
1427 \r
1428     //\r
1429     fEventMultCorrelationMatrix->Add(entry->fEventMultCorrelationMatrix);\r
1430     fTrackPtCorrelationMatrix->Add(entry->fTrackPtCorrelationMatrix);\r
1431 \r
1432     //\r
1433     fGenEventMatrix->Add(entry->fGenEventMatrix);\r
1434     fGenSDEventMatrix->Add(entry->fGenSDEventMatrix);\r
1435     fGenDDEventMatrix->Add(entry->fGenDDEventMatrix);\r
1436     fGenNDEventMatrix->Add(entry->fGenNDEventMatrix);\r
1437     fGenNSDEventMatrix->Add(entry->fGenNSDEventMatrix);\r
1438 \r
1439     fTriggerEventMatrix->Add(entry->fTriggerEventMatrix);\r
1440     fTriggerSDEventMatrix->Add(entry->fTriggerSDEventMatrix);\r
1441     fTriggerDDEventMatrix->Add(entry->fTriggerDDEventMatrix);\r
1442     fTriggerNDEventMatrix->Add(entry->fTriggerNDEventMatrix);\r
1443     fTriggerNSDEventMatrix->Add(entry->fTriggerNSDEventMatrix);\r
1444 \r
1445     fRecEventMatrix->Add(entry->fRecEventMatrix);\r
1446     fRecSDEventMatrix->Add(entry->fRecSDEventMatrix);\r
1447     fRecDDEventMatrix->Add(entry->fRecDDEventMatrix);\r
1448     fRecNDEventMatrix->Add(entry->fRecNDEventMatrix);\r
1449     fRecNSDEventMatrix->Add(entry->fRecNSDEventMatrix);\r
1450 \r
1451     //\r
1452     fGenTrackEventMatrix->Add(entry->fGenTrackEventMatrix);\r
1453     fGenTrackSDEventMatrix->Add(entry->fGenTrackSDEventMatrix);\r
1454     fGenTrackDDEventMatrix->Add(entry->fGenTrackDDEventMatrix);\r
1455     fGenTrackNDEventMatrix->Add(entry->fGenTrackNDEventMatrix);\r
1456     fGenTrackNSDEventMatrix->Add(entry->fGenTrackNSDEventMatrix);\r
1457 \r
1458     fTriggerTrackEventMatrix->Add(entry->fTriggerTrackEventMatrix);\r
1459     fTriggerTrackSDEventMatrix->Add(entry->fTriggerTrackSDEventMatrix);\r
1460     fTriggerTrackDDEventMatrix->Add(entry->fTriggerTrackDDEventMatrix);\r
1461     fTriggerTrackNDEventMatrix->Add(entry->fTriggerTrackNDEventMatrix);\r
1462     fTriggerTrackNSDEventMatrix->Add(entry->fTriggerTrackNSDEventMatrix);\r
1463 \r
1464     fRecTrackEventMatrix->Add(entry->fRecTrackEventMatrix);\r
1465     fRecTrackSDEventMatrix->Add(entry->fRecTrackSDEventMatrix);\r
1466     fRecTrackDDEventMatrix->Add(entry->fRecTrackDDEventMatrix);\r
1467     fRecTrackNDEventMatrix->Add(entry->fRecTrackNDEventMatrix);\r
1468     fRecTrackNSDEventMatrix->Add(entry->fRecTrackNSDEventMatrix);\r
1469 \r
1470     //\r
1471     fGenTrackMatrix->Add(entry->fGenTrackMatrix);\r
1472     fGenPrimTrackMatrix->Add(entry->fGenPrimTrackMatrix);\r
1473     fRecPrimTrackMatrix->Add(entry->fRecPrimTrackMatrix);\r
1474     //\r
1475     fRecTrackMatrix->Add(entry->fRecTrackMatrix);\r
1476     fRecSecTrackMatrix->Add(entry->fRecSecTrackMatrix);\r
1477     //\r
1478     fRecMultTrackMatrix->Add(entry->fRecMultTrackMatrix);\r
1479 \r
1480     //\r
1481     // control analysis histograms\r
1482     //\r
1483     fMCEventHist1->Add(entry->fMCEventHist1);\r
1484     fRecEventHist1->Add(entry->fRecEventHist1);\r
1485     fRecEventHist2->Add(entry->fRecEventHist2);\r
1486     fRecMCEventHist1->Add(entry->fRecMCEventHist1);\r
1487     fRecMCEventHist2->Add(entry->fRecMCEventHist2);\r
1488     fRecMCEventHist3->Add(entry->fRecMCEventHist3);\r
1489 \r
1490     for(Int_t i=0; i<AlidNdPtHelper::kCutSteps; i++) {\r
1491       fMCTrackHist1[i]->Add(entry->fMCTrackHist1[i]);\r
1492 \r
1493       fMCPrimTrackHist1[i]->Add(entry->fMCPrimTrackHist1[i]);\r
1494       fMCSecTrackHist1[i]->Add(entry->fMCSecTrackHist1[i]);\r
1495 \r
1496       fRecTrackHist1[i]->Add(entry->fRecTrackHist1[i]);\r
1497       fRecTrackMultHist1[i]->Add(entry->fRecTrackMultHist1[i]);\r
1498     }\r
1499     fRecMCTrackHist1->Add(entry->fRecMCTrackHist1);\r
1500     fMCMultRecTrackHist1->Add(entry->fMCMultRecTrackHist1);\r
1501     fRecTrackHist2->Add(entry->fRecTrackHist2);\r
1502 \r
1503   count++;\r
1504   }\r
1505 \r
1506 return count;\r
1507 }\r
1508  \r
1509 //_____________________________________________________________________________\r
1510 void AlidNdPtAnalysis::Analyse() \r
1511 {\r
1512   // Analyse histograms\r
1513   //\r
1514   TH1::AddDirectory(kFALSE);\r
1515   TH1 *h=0, *h1=0, *h2=0, *h2c = 0; \r
1516   THnSparse *hs=0; \r
1517   TH2 *h2D=0; \r
1518 \r
1519   char name[256];\r
1520   TObjArray *aFolderObj = new TObjArray;\r
1521 \r
1522   //\r
1523   // get cuts\r
1524   //\r
1525   AlidNdPtEventCuts *evtCuts = GetEventCuts(); \r
1526   AlidNdPtAcceptanceCuts *accCuts = GetAcceptanceCuts(); \r
1527   AliESDtrackCuts *esdTrackCuts = GetTrackCuts(); \r
1528 \r
1529   if(!evtCuts || !accCuts || !esdTrackCuts) {\r
1530     Error("AlidNdPtCutAnalysis::Analyse()", "cuts not available");\r
1531     return;\r
1532   }\r
1533 \r
1534   //\r
1535   // set min and max values\r
1536   //\r
1537   Double_t minZv = evtCuts->GetMinZv();\r
1538   Double_t maxZv = evtCuts->GetMaxZv()-0.00001;\r
1539   Double_t minPt = accCuts->GetMinPt();\r
1540   Double_t maxPt = accCuts->GetMaxPt();\r
1541   Double_t minEta = accCuts->GetMinEta();\r
1542   Double_t maxEta = accCuts->GetMaxEta()-0.00001;\r
1543 \r
1544   //\r
1545   // Reconstructed event vertex\r
1546   //\r
1547   h = fRecEventHist1->Projection(0);\r
1548   h->SetName("Xv");\r
1549   aFolderObj->Add(h);\r
1550 \r
1551   h = fRecEventHist1->Projection(1);\r
1552   h->SetName("Yv");\r
1553   aFolderObj->Add(h);\r
1554 \r
1555   h = fRecEventHist1->Projection(2);\r
1556   h->SetName("Zv");\r
1557   aFolderObj->Add(h);\r
1558 \r
1559   //\r
1560   // multiplicity\r
1561   //\r
1562   h = fRecEventHist2->Projection(1);\r
1563   h->SetName("multMB");\r
1564   aFolderObj->Add(h);\r
1565 \r
1566   h = fRecEventHist2->Projection(2);\r
1567   h->SetName("multiplicity");\r
1568   aFolderObj->Add(h);\r
1569 \r
1570   h2D = fRecEventHist2->Projection(0,1); \r
1571   h2D->SetName("Zv_vs_multiplicity_MB");\r
1572   aFolderObj->Add(h2D);\r
1573 \r
1574   //\r
1575   // reconstructed pt histograms\r
1576   //\r
1577   h = fRecTrackHist1[0]->Projection(0);\r
1578   h->Scale(1.,"width");\r
1579   h->SetName("pt_all_ch");\r
1580   aFolderObj->Add(h);\r
1581 \r
1582   h = fRecTrackHist1[1]->Projection(0);\r
1583   h->Scale(1.,"width");\r
1584   h->SetName("pt_acc");\r
1585   aFolderObj->Add(h);\r
1586 \r
1587   h = fRecTrackHist1[2]->Projection(0);\r
1588   h->Scale(1.,"width");\r
1589   h->SetName("pt_rec");\r
1590   aFolderObj->Add(h);\r
1591 \r
1592   //\r
1593   // reconstructed eta histograms\r
1594   //\r
1595   h = fRecTrackHist1[0]->Projection(1);\r
1596   h->SetName("eta_all_ch");\r
1597   aFolderObj->Add(h);\r
1598 \r
1599   h = fRecTrackHist1[1]->Projection(1);\r
1600   h->SetName("eta_acc");\r
1601   aFolderObj->Add(h);\r
1602 \r
1603   h = fRecTrackHist1[2]->Projection(1);\r
1604   h->SetName("eta_rec");\r
1605   aFolderObj->Add(h);\r
1606 \r
1607   //\r
1608   // reconstructed phi histograms\r
1609   //\r
1610   h = fRecTrackHist1[0]->Projection(2);\r
1611   h->SetName("phi_all_ch");\r
1612   aFolderObj->Add(h);\r
1613 \r
1614   h = fRecTrackHist1[1]->Projection(2);\r
1615   h->SetName("phi_acc");\r
1616   aFolderObj->Add(h);\r
1617 \r
1618   h = fRecTrackHist1[2]->Projection(2);\r
1619   h->SetName("phi_rec");\r
1620   aFolderObj->Add(h);\r
1621 \r
1622   //\r
1623   // reconstructed eta:pt histograms\r
1624   //\r
1625   h2D = fRecTrackHist1[0]->Projection(1,0);\r
1626   h2D->SetName("pt_eta_all_ch");\r
1627   aFolderObj->Add(h2D);\r
1628 \r
1629   h2D = fRecTrackHist1[1]->Projection(1,0);\r
1630   h2D->SetName("pt_eta_acc");\r
1631   aFolderObj->Add(h2D);\r
1632 \r
1633   h2D = fRecTrackHist1[2]->Projection(1,0);\r
1634   h2D->SetName("pt_eta_rec");\r
1635   aFolderObj->Add(h2D);\r
1636 \r
1637   //\r
1638   // reconstructed phi:pt histograms\r
1639   //\r
1640   h2D = fRecTrackHist1[0]->Projection(2,0);\r
1641   h2D->SetName("pt_phi_all_ch");\r
1642   aFolderObj->Add(h2D);\r
1643 \r
1644   h2D = fRecTrackHist1[1]->Projection(2,0);\r
1645   h2D->SetName("pt_phi_acc");\r
1646   aFolderObj->Add(h2D);\r
1647 \r
1648   h2D = fRecTrackHist1[2]->Projection(2,0);\r
1649   h2D->SetName("pt_phi_rec");\r
1650   aFolderObj->Add(h2D);\r
1651 \r
1652   //\r
1653   // reconstructed phi:eta histograms\r
1654   //\r
1655   h2D = fRecTrackHist1[0]->Projection(2,1);\r
1656   h2D->SetName("eta_phi_all_ch");\r
1657   aFolderObj->Add(h2D);\r
1658 \r
1659   h2D = fRecTrackHist1[1]->Projection(2,1);\r
1660   h2D->SetName("eta_phi_acc");\r
1661   aFolderObj->Add(h2D);\r
1662 \r
1663   h2D = fRecTrackHist1[2]->Projection(2,1);\r
1664   h2D->SetName("eta_phi_rec");\r
1665   aFolderObj->Add(h2D);\r
1666 \r
1667   //\r
1668   // reconstructed nClust, chi2 vs pt, eta, phi\r
1669   //\r
1670   if(fHistogramsOn) {\r
1671 \r
1672     h2D = fRecTrackHist2->Projection(0,1);\r
1673     h2D->SetName("nClust_chi2_rec");\r
1674     aFolderObj->Add(h2D);\r
1675 \r
1676     h2D = fRecTrackHist2->Projection(0,2);\r
1677     h2D->SetName("nClust_pt_rec");\r
1678     aFolderObj->Add(h2D);\r
1679 \r
1680     h2D = fRecTrackHist2->Projection(0,3);\r
1681     h2D->SetName("nClust_eta_rec");\r
1682     aFolderObj->Add(h2D);\r
1683 \r
1684     h2D = fRecTrackHist2->Projection(0,4);\r
1685     h2D->SetName("nClust_phi_rec");\r
1686     aFolderObj->Add(h2D);\r
1687 \r
1688     h2D = fRecTrackHist2->Projection(1,2);\r
1689     h2D->SetName("chi2_pt_rec");\r
1690     aFolderObj->Add(h2D);\r
1691 \r
1692     h2D = fRecTrackHist2->Projection(1,3);\r
1693     h2D->SetName("chi2_eta_rec");\r
1694     aFolderObj->Add(h2D);\r
1695 \r
1696     h2D = fRecTrackHist2->Projection(1,4);\r
1697     h2D->SetName("chi2_phi_rec");\r
1698     aFolderObj->Add(h2D);\r
1699 \r
1700   }\r
1701 \r
1702   //\r
1703   // calculate corrections for empty events\r
1704   // with multMB==0 \r
1705   //\r
1706 \r
1707   //\r
1708   // normalised zv to generate zv for triggered events\r
1709   //\r
1710   h = fRecEventHist2->Projection(0);\r
1711   if( h->Integral() ) h->Scale(1./h->Integral());\r
1712   h->SetName("zv_distribution_norm");\r
1713   aFolderObj->Add(h);\r
1714  \r
1715   //\r
1716   // MC available\r
1717   //\r
1718   if(IsUseMCInfo()) {\r
1719 \r
1720   //\r
1721   // Event vertex resolution\r
1722   //\r
1723   h2D = fRecMCEventHist2->Projection(0,2);\r
1724   h2D->SetName("DeltaXv_vs_mult");\r
1725   aFolderObj->Add(h2D);\r
1726 \r
1727   h2D = fRecMCEventHist2->Projection(1,2);\r
1728   h2D->SetName("DeltaZv_vs_mult");\r
1729   aFolderObj->Add(h2D);\r
1730 \r
1731   //\r
1732   // normalised zv to get trigger/trigger+vertex event differences\r
1733   // F(zv) = E_trig(zv,0)/Int(E_trig(zv,0) / Sum(E_trigvtx(zv,n))/Sum(Int(E_trigvtx(zv,n))dzv)\r
1734   //\r
1735   fTriggerEventMatrix->GetAxis(1)->SetRangeUser(0.,0.);\r
1736   h = fTriggerEventMatrix->Projection(0);\r
1737   h2D = fTriggerEventMatrix->Projection(0,1);\r
1738   if(h2D->Integral()) h->Scale(1./h2D->Integral());\r
1739 \r
1740   h1 = fRecEventMatrix->Projection(0);\r
1741   h2D = fRecEventMatrix->Projection(0,1);\r
1742   if(h2D->Integral()) h1->Scale(1./h2D->Integral());\r
1743 \r
1744   h->Divide(h1);\r
1745   h->SetName("zv_empty_events_norm");\r
1746   aFolderObj->Add(h);\r
1747   \r
1748   fTriggerEventMatrix->GetAxis(1)->SetRange(1,fTriggerEventMatrix->GetAxis(1)->GetNbins());\r
1749 \r
1750   //\r
1751   // rec. vs true multiplicity correlation matrix\r
1752   //\r
1753   hs = (THnSparse*)fEventMultCorrelationMatrix->Clone("event_mult_correlation_matrix");\r
1754   aFolderObj->Add(hs);\r
1755  \r
1756   //\r
1757   // rec. vs true track pt correlation matrix\r
1758   //\r
1759   hs = (THnSparse*)fTrackPtCorrelationMatrix->Clone("track_pt_correlation_matrix");\r
1760   aFolderObj->Add(hs);\r
1761 \r
1762   //\r
1763   // trigger efficiency for INEL\r
1764   //\r
1765   h = AlidNdPtHelper::GenerateCorrMatrix(fTriggerEventMatrix->Projection(0),fGenEventMatrix->Projection(0),"zv_trig_INEL_eff_matrix");\r
1766   aFolderObj->Add(h);\r
1767 \r
1768   //\r
1769   // trigger efficiency for NSD\r
1770   //\r
1771   h = AlidNdPtHelper::GenerateCorrMatrix(fTriggerNSDEventMatrix->Projection(0),fGenNSDEventMatrix->Projection(0),"zv_trig_NSD_eff_matrix");\r
1772   aFolderObj->Add(h);\r
1773 \r
1774   //\r
1775   // trigger bias correction (MB to ND)\r
1776   //\r
1777   hs = AlidNdPtHelper::GenerateCorrMatrix(fGenNDEventMatrix,fTriggerEventMatrix,"zv_mult_trig_MBtoND_corr_matrix");\r
1778   aFolderObj->Add(hs);\r
1779 \r
1780   h = AlidNdPtHelper::GenerateCorrMatrix(fGenNDEventMatrix->Projection(0),fTriggerEventMatrix->Projection(0),"zv_trig_MBtoND_corr_matrix");\r
1781   aFolderObj->Add(h);\r
1782 \r
1783   fGenNDEventMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
1784   fTriggerEventMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
1785 \r
1786   h = AlidNdPtHelper::GenerateCorrMatrix(fGenNDEventMatrix->Projection(1),fTriggerEventMatrix->Projection(1),"mult_trig_MBtoND_corr_matrix");\r
1787 \r
1788   aFolderObj->Add(h);\r
1789   fGenNDEventMatrix->GetAxis(0)->SetRange(1,fGenNDEventMatrix->GetAxis(0)->GetNbins());\r
1790   fTriggerEventMatrix->GetAxis(0)->SetRange(1,fTriggerEventMatrix->GetAxis(0)->GetNbins());\r
1791 \r
1792   //\r
1793   // trigger bias correction (MB to NSD)\r
1794   //\r
1795   hs = AlidNdPtHelper::GenerateCorrMatrix(fGenNSDEventMatrix,fTriggerEventMatrix,"zv_mult_trig_MBtoNSD_corr_matrix");\r
1796   aFolderObj->Add(hs);\r
1797 \r
1798   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenNSDEventMatrix->Projection(0,1),fTriggerEventMatrix->Projection(0,1),"zv_mult_trig_MBtoNSD_corr_matrix_2D");\r
1799   aFolderObj->Add(h2D);\r
1800 \r
1801   h = AlidNdPtHelper::GenerateCorrMatrix(fGenNSDEventMatrix->Projection(0),fTriggerEventMatrix->Projection(0),"zv_trig_MBtoNSD_corr_matrix");\r
1802   aFolderObj->Add(h);\r
1803 \r
1804   fGenNSDEventMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
1805   fTriggerEventMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
1806 \r
1807   h = AlidNdPtHelper::GenerateCorrMatrix(fGenNSDEventMatrix->Projection(1),fTriggerEventMatrix->Projection(1),"mult_trig_MBtoNSD_corr_matrix");\r
1808   aFolderObj->Add(h);\r
1809 \r
1810   fGenNSDEventMatrix->GetAxis(0)->SetRange(1,fGenNSDEventMatrix->GetAxis(0)->GetNbins());\r
1811   fTriggerEventMatrix->GetAxis(0)->SetRange(1,fTriggerEventMatrix->GetAxis(0)->GetNbins());\r
1812 \r
1813   //\r
1814   // trigger bias correction (MB to INEL)\r
1815   //\r
1816   hs = AlidNdPtHelper::GenerateCorrMatrix(fGenEventMatrix,fTriggerEventMatrix,"zv_mult_trig_MBtoInel_corr_matrix");\r
1817   aFolderObj->Add(hs);\r
1818 \r
1819   h = AlidNdPtHelper::GenerateCorrMatrix(fGenEventMatrix->Projection(0),fTriggerEventMatrix->Projection(0),"zv_trig_MBtoInel_corr_matrix");\r
1820   aFolderObj->Add(h);\r
1821 \r
1822   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenEventMatrix->Projection(0,1),fTriggerEventMatrix->Projection(0,1),"zv_mult_trig_MBtoInel_corr_matrix_2D");\r
1823   aFolderObj->Add(h2D);\r
1824 \r
1825   fGenEventMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
1826   fTriggerEventMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
1827 \r
1828   h = AlidNdPtHelper::GenerateCorrMatrix(fGenEventMatrix->Projection(1),fTriggerEventMatrix->Projection(1),"mult_trig_MBtoInel_corr_matrix");\r
1829   aFolderObj->Add(h);\r
1830 \r
1831   fGenEventMatrix->GetAxis(0)->SetRange(1,fGenEventMatrix->GetAxis(0)->GetNbins());\r
1832   fTriggerEventMatrix->GetAxis(0)->SetRange(1,fTriggerEventMatrix->GetAxis(0)->GetNbins());\r
1833 \r
1834   //\r
1835   // event vertex reconstruction correction (MB)\r
1836   //\r
1837   hs = AlidNdPtHelper::GenerateCorrMatrix(fTriggerEventMatrix,fRecEventMatrix,"zv_mult_event_corr_matrix");\r
1838   aFolderObj->Add(hs);\r
1839 \r
1840   h2D = AlidNdPtHelper::GenerateCorrMatrix(fTriggerEventMatrix->Projection(0,1),fRecEventMatrix->Projection(0,1),"zv_mult_event_corr_matrix_2D");\r
1841   aFolderObj->Add(h2D);\r
1842 \r
1843   fTriggerEventMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
1844   fRecEventMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
1845 \r
1846   h = AlidNdPtHelper::GenerateCorrMatrix(fTriggerEventMatrix->Projection(1),fRecEventMatrix->Projection(1),"mult_event_corr_matrix");\r
1847   aFolderObj->Add(h);\r
1848 \r
1849   fTriggerEventMatrix->GetAxis(0)->SetRange(1,fTriggerEventMatrix->GetAxis(0)->GetNbins());\r
1850   fRecEventMatrix->GetAxis(0)->SetRange(1,fRecEventMatrix->GetAxis(0)->GetNbins());\r
1851 \r
1852   h = AlidNdPtHelper::GenerateCorrMatrix(fTriggerEventMatrix->Projection(0),fRecEventMatrix->Projection(0),"zv_event_corr_matrix");\r
1853   aFolderObj->Add(h);\r
1854 \r
1855   //\r
1856   // track-event trigger bias correction (MB to ND)\r
1857   //\r
1858 \r
1859   hs = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackNDEventMatrix,fTriggerTrackEventMatrix,"zv_pt_eta_track_trig_MBtoND_corr_matrix");\r
1860   aFolderObj->Add(hs);\r
1861 \r
1862   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackNDEventMatrix->Projection(1,2),fTriggerTrackEventMatrix->Projection(1,2),"eta_pt_track_trig_MBtoND_corr_matrix");\r
1863   aFolderObj->Add(h2D);\r
1864 \r
1865   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackNDEventMatrix->Projection(1,0),fTriggerTrackEventMatrix->Projection(1,0),"pt_zv_track_trig_MBtoND_corr_matrix");\r
1866   aFolderObj->Add(h2D);\r
1867 \r
1868   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackNDEventMatrix->Projection(2,0),fTriggerTrackEventMatrix->Projection(2,0),"zv_eta_track_trig_MBtoND_corr_matrix");\r
1869   aFolderObj->Add(h2D);\r
1870 \r
1871   //\r
1872   // track-event trigger bias correction (MB to NSD)\r
1873   //\r
1874   hs = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackNSDEventMatrix,fTriggerTrackEventMatrix,"zv_pt_eta_track_trig_MBtoNSD_corr_matrix");\r
1875   aFolderObj->Add(hs);\r
1876 \r
1877   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackNSDEventMatrix->Projection(1,2),fTriggerTrackEventMatrix->Projection(1,2),"eta_pt_track_trig_MBtoNSD_corr_matrix");\r
1878   aFolderObj->Add(h2D);\r
1879 \r
1880   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackNSDEventMatrix->Projection(1,0),fTriggerTrackEventMatrix->Projection(1,0),"pt_zv_track_trig_MBtoNSD_corr_matrix");\r
1881   aFolderObj->Add(h2D);\r
1882 \r
1883   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackNSDEventMatrix->Projection(2,0),fTriggerTrackEventMatrix->Projection(2,0),"zv_eta_track_trig_MBtoNSD_corr_matrix");\r
1884   aFolderObj->Add(h2D);\r
1885 \r
1886 \r
1887   //\r
1888   // track-event trigger bias correction (MB to INEL)\r
1889   //\r
1890   hs = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackEventMatrix,fTriggerTrackEventMatrix,"zv_pt_eta_track_trig_MBtoInel_corr_matrix");\r
1891   aFolderObj->Add(hs);\r
1892 \r
1893   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackEventMatrix->Projection(1,2),fTriggerTrackEventMatrix->Projection(1,2),"eta_pt_track_trig_MBtoInel_corr_matrix");\r
1894   aFolderObj->Add(h2D);\r
1895 \r
1896   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackEventMatrix->Projection(1,0),fTriggerTrackEventMatrix->Projection(1,0),"pt_zv_track_trig_MBtoInel_corr_matrix");\r
1897   aFolderObj->Add(h2D);\r
1898 \r
1899   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackEventMatrix->Projection(2,0),fTriggerTrackEventMatrix->Projection(2,0),"zv_eta_track_trig_MBtoInel_corr_matrix");\r
1900   aFolderObj->Add(h2D);\r
1901 \r
1902   // efficiency\r
1903   fTriggerTrackEventMatrix->GetAxis(2)->SetRangeUser(minEta,maxEta);\r
1904   fGenTrackEventMatrix->GetAxis(2)->SetRangeUser(minEta,maxEta);\r
1905   fTriggerTrackEventMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
1906   fGenTrackEventMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
1907 \r
1908   h = AlidNdPtHelper::GenerateCorrMatrix(fTriggerTrackEventMatrix->Projection(1),fGenTrackEventMatrix->Projection(1),"pt_track_trig_MBtoInel_eff_matrix");\r
1909   aFolderObj->Add(h);\r
1910 \r
1911   fTriggerTrackEventMatrix->GetAxis(2)->SetRange(1,fTriggerTrackEventMatrix->GetAxis(2)->GetNbins());\r
1912   fGenTrackEventMatrix->GetAxis(2)->SetRange(1,fGenTrackEventMatrix->GetAxis(2)->GetNbins());\r
1913   fTriggerTrackEventMatrix->GetAxis(0)->SetRange(1,fTriggerTrackEventMatrix->GetAxis(0)->GetNbins());\r
1914   fGenTrackEventMatrix->GetAxis(0)->SetRange(1,fGenTrackEventMatrix->GetAxis(0)->GetNbins());\r
1915 \r
1916 \r
1917   //\r
1918   // track-event vertex reconstruction correction (MB)\r
1919   //\r
1920   hs = AlidNdPtHelper::GenerateCorrMatrix(fTriggerTrackEventMatrix,fRecTrackEventMatrix,"zv_pt_eta_track_event_corr_matrix");\r
1921   aFolderObj->Add(hs);\r
1922 \r
1923   h2D = AlidNdPtHelper::GenerateCorrMatrix(fTriggerTrackEventMatrix->Projection(1,2),fRecTrackEventMatrix->Projection(1,2),"eta_pt_track_event_corr_matrix");\r
1924   aFolderObj->Add(h2D);\r
1925 \r
1926   h2D = AlidNdPtHelper::GenerateCorrMatrix(fTriggerTrackEventMatrix->Projection(1,0),fRecTrackEventMatrix->Projection(1,0),"pt_zv_track_event_corr_matrix");\r
1927   aFolderObj->Add(h2D);\r
1928 \r
1929   h2D = AlidNdPtHelper::GenerateCorrMatrix(fTriggerTrackEventMatrix->Projection(2,0),fRecTrackEventMatrix->Projection(2,0),"zv_eta_track_event_corr_matrix");\r
1930   aFolderObj->Add(h2D);\r
1931   \r
1932   // efficiency\r
1933   fTriggerTrackEventMatrix->GetAxis(2)->SetRangeUser(minEta,maxEta);\r
1934   fRecTrackEventMatrix->GetAxis(2)->SetRangeUser(minEta,maxEta);\r
1935   fTriggerTrackEventMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
1936   fRecTrackEventMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
1937 \r
1938   h = AlidNdPtHelper::GenerateCorrMatrix(fRecTrackEventMatrix->Projection(1),fTriggerTrackEventMatrix->Projection(1),"pt_track_event_eff_matrix");\r
1939   aFolderObj->Add(h);\r
1940 \r
1941   fTriggerTrackEventMatrix->GetAxis(2)->SetRange(1,fTriggerTrackEventMatrix->GetAxis(2)->GetNbins());\r
1942   fRecTrackEventMatrix->GetAxis(2)->SetRange(1,fRecTrackEventMatrix->GetAxis(2)->GetNbins());\r
1943   fTriggerTrackEventMatrix->GetAxis(0)->SetRange(1,fTriggerTrackEventMatrix->GetAxis(0)->GetNbins());\r
1944   fRecTrackEventMatrix->GetAxis(0)->SetRange(1,fRecTrackEventMatrix->GetAxis(0)->GetNbins());\r
1945 \r
1946   //\r
1947   // track rec. efficiency correction\r
1948   //\r
1949   hs = AlidNdPtHelper::GenerateCorrMatrix(fGenPrimTrackMatrix,fRecPrimTrackMatrix,"zv_pt_eta_track_corr_matrix");\r
1950   aFolderObj->Add(hs);\r
1951 \r
1952   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenPrimTrackMatrix->Projection(1,2),fRecPrimTrackMatrix->Projection(1,2),"eta_pt_track_corr_matrix");\r
1953   aFolderObj->Add(h2D);\r
1954 \r
1955   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenPrimTrackMatrix->Projection(1,0),fRecPrimTrackMatrix->Projection(1,0),"pt_zv_track_corr_matrix");\r
1956   aFolderObj->Add(h2D);\r
1957 \r
1958   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenPrimTrackMatrix->Projection(2,0),fRecPrimTrackMatrix->Projection(2,0),"zv_eta_track_corr_matrix");\r
1959   aFolderObj->Add(h2D);\r
1960 \r
1961   fGenPrimTrackMatrix->GetAxis(2)->SetRangeUser(minEta,maxEta);\r
1962   fRecPrimTrackMatrix->GetAxis(2)->SetRangeUser(minEta,maxEta);\r
1963   fGenPrimTrackMatrix->GetAxis(1)->SetRangeUser(minPt,maxPt);\r
1964   fRecPrimTrackMatrix->GetAxis(1)->SetRangeUser(minPt,maxPt);\r
1965   \r
1966   h = AlidNdPtHelper::GenerateCorrMatrix(fGenPrimTrackMatrix->Projection(0),fRecPrimTrackMatrix->Projection(0),"zv_track_corr_matrix");\r
1967   aFolderObj->Add(h);\r
1968 \r
1969   fGenPrimTrackMatrix->GetAxis(1)->SetRange(1,fGenPrimTrackMatrix->GetAxis(1)->GetNbins());\r
1970   fRecPrimTrackMatrix->GetAxis(1)->SetRange(1,fRecPrimTrackMatrix->GetAxis(1)->GetNbins());\r
1971   fGenPrimTrackMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
1972   fRecPrimTrackMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
1973 \r
1974   h = AlidNdPtHelper::GenerateCorrMatrix(fGenPrimTrackMatrix->Projection(1),fRecPrimTrackMatrix->Projection(1),"pt_track_corr_matrix");\r
1975   aFolderObj->Add(h);\r
1976 \r
1977   // efficiency\r
1978   h = AlidNdPtHelper::GenerateCorrMatrix(fRecPrimTrackMatrix->Projection(1), fGenPrimTrackMatrix->Projection(1),"pt_track_eff_matrix");\r
1979   aFolderObj->Add(h);\r
1980 \r
1981   fGenPrimTrackMatrix->GetAxis(1)->SetRangeUser(minPt,maxPt);\r
1982   fRecPrimTrackMatrix->GetAxis(1)->SetRangeUser(minPt,maxPt);\r
1983   fGenPrimTrackMatrix->GetAxis(2)->SetRange(1,fGenPrimTrackMatrix->GetAxis(2)->GetNbins());\r
1984   fRecPrimTrackMatrix->GetAxis(2)->SetRange(1,fRecPrimTrackMatrix->GetAxis(2)->GetNbins());\r
1985 \r
1986   h = AlidNdPtHelper::GenerateCorrMatrix(fGenPrimTrackMatrix->Projection(2),fRecPrimTrackMatrix->Projection(2),"eta_track_corr_matrix");\r
1987   aFolderObj->Add(h);\r
1988 \r
1989   fGenPrimTrackMatrix->GetAxis(1)->SetRange(1,fGenPrimTrackMatrix->GetAxis(1)->GetNbins());\r
1990   fRecPrimTrackMatrix->GetAxis(1)->SetRange(1,fRecPrimTrackMatrix->GetAxis(1)->GetNbins());\r
1991   fGenPrimTrackMatrix->GetAxis(0)->SetRange(1,fGenPrimTrackMatrix->GetAxis(0)->GetNbins());\r
1992   fRecPrimTrackMatrix->GetAxis(0)->SetRange(1,fRecPrimTrackMatrix->GetAxis(0)->GetNbins());\r
1993 \r
1994   //\r
1995   // secondary track contamination correction\r
1996   //\r
1997   //hs = AlidNdPtHelper::GenerateContCorrMatrix(fRecSecTrackMatrix,fRecTrackMatrix,"zv_pt_eta_track_cont_matrix");\r
1998   hs = AlidNdPtHelper::GenerateCorrMatrix(fRecSecTrackMatrix,fRecTrackMatrix,"zv_pt_eta_track_cont_matrix");\r
1999   aFolderObj->Add(hs);\r
2000 \r
2001   h2D = AlidNdPtHelper::GenerateCorrMatrix(fRecSecTrackMatrix->Projection(1,2),fRecTrackMatrix->Projection(1,2),"eta_pt_track_cont_matrix");\r
2002   aFolderObj->Add(h2D);\r
2003 \r
2004   h2D = AlidNdPtHelper::GenerateCorrMatrix(fRecSecTrackMatrix->Projection(1,0),fRecTrackMatrix->Projection(1,0),"pt_zv_track_cont_matrix");\r
2005   aFolderObj->Add(h2D);\r
2006 \r
2007   h2D = AlidNdPtHelper::GenerateCorrMatrix(fRecSecTrackMatrix->Projection(2,0),fRecTrackMatrix->Projection(2,0),"zv_eta_track_cont_matrix");\r
2008   aFolderObj->Add(h2D);\r
2009 \r
2010   fRecSecTrackMatrix->GetAxis(2)->SetRangeUser(minEta,maxEta);\r
2011   fRecTrackMatrix->GetAxis(2)->SetRangeUser(minEta,maxEta);\r
2012   fRecSecTrackMatrix->GetAxis(1)->SetRangeUser(minPt,maxPt);\r
2013   fRecTrackMatrix->GetAxis(1)->SetRangeUser(minPt,maxPt);\r
2014   \r
2015   h = AlidNdPtHelper::GenerateCorrMatrix(fRecSecTrackMatrix->Projection(0),fRecTrackMatrix->Projection(0),"zv_track_cont_matrix");\r
2016   aFolderObj->Add(h);\r
2017 \r
2018   fRecSecTrackMatrix->GetAxis(1)->SetRange(1,fRecSecTrackMatrix->GetAxis(1)->GetNbins());\r
2019   fRecTrackMatrix->GetAxis(1)->SetRange(1,fRecTrackMatrix->GetAxis(1)->GetNbins());\r
2020   fRecSecTrackMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
2021   fRecTrackMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
2022 \r
2023   h = AlidNdPtHelper::GenerateCorrMatrix(fRecSecTrackMatrix->Projection(1),fRecTrackMatrix->Projection(1),"pt_track_cont_matrix");\r
2024   aFolderObj->Add(h);\r
2025 \r
2026   fRecSecTrackMatrix->GetAxis(2)->SetRange(1,fRecSecTrackMatrix->GetAxis(2)->GetNbins());\r
2027   fRecTrackMatrix->GetAxis(2)->SetRange(1,fRecTrackMatrix->GetAxis(2)->GetNbins());\r
2028 \r
2029   fRecSecTrackMatrix->GetAxis(1)->SetRangeUser(minPt,maxPt);\r
2030   fRecTrackMatrix->GetAxis(1)->SetRangeUser(minPt,maxPt);\r
2031 \r
2032   h = AlidNdPtHelper::GenerateCorrMatrix(fRecSecTrackMatrix->Projection(2),fRecTrackMatrix->Projection(2),"eta_track_cont_matrix");\r
2033   aFolderObj->Add(h);\r
2034 \r
2035   fRecSecTrackMatrix->GetAxis(0)->SetRange(1,fRecSecTrackMatrix->GetAxis(0)->GetNbins());\r
2036   fRecTrackMatrix->GetAxis(0)->SetRange(1,fRecTrackMatrix->GetAxis(0)->GetNbins());\r
2037   fRecSecTrackMatrix->GetAxis(1)->SetRange(1,fRecSecTrackMatrix->GetAxis(1)->GetNbins());\r
2038   fRecTrackMatrix->GetAxis(1)->SetRange(1,fRecTrackMatrix->GetAxis(1)->GetNbins());\r
2039 \r
2040   //\r
2041   // multiple track reconstruction correction\r
2042   //\r
2043   //hs = AlidNdPtHelper::GenerateContCorrMatrix(fRecMultTrackMatrix,fRecTrackMatrix,"zv_pt_eta_mult_track_cont_matrix");\r
2044   hs = AlidNdPtHelper::GenerateCorrMatrix(fRecMultTrackMatrix,fRecTrackMatrix,"zv_pt_eta_mult_track_cont_matrix");\r
2045   aFolderObj->Add(hs);\r
2046 \r
2047   h2D = AlidNdPtHelper::GenerateCorrMatrix(fRecMultTrackMatrix->Projection(1,2),fRecTrackMatrix->Projection(1,2),"eta_pt_mult_track_cont_matrix");\r
2048   aFolderObj->Add(h2D);\r
2049 \r
2050   h2D = AlidNdPtHelper::GenerateCorrMatrix(fRecMultTrackMatrix->Projection(1,0),fRecTrackMatrix->Projection(1,0),"pt_zv_mult_track_cont_matrix");\r
2051   aFolderObj->Add(h2D);\r
2052 \r
2053   h2D = AlidNdPtHelper::GenerateCorrMatrix(fRecMultTrackMatrix->Projection(2,0),fRecTrackMatrix->Projection(2,0),"zv_eta_mult_track_cont_matrix");\r
2054   aFolderObj->Add(h2D);\r
2055 \r
2056   fRecMultTrackMatrix->GetAxis(2)->SetRangeUser(minEta,maxEta);\r
2057   fRecTrackMatrix->GetAxis(2)->SetRangeUser(minEta,maxEta);\r
2058   fRecMultTrackMatrix->GetAxis(1)->SetRangeUser(minPt,maxPt);\r
2059   fRecTrackMatrix->GetAxis(1)->SetRangeUser(minPt,maxPt);\r
2060   \r
2061   h = AlidNdPtHelper::GenerateCorrMatrix(fRecMultTrackMatrix->Projection(0),fRecTrackMatrix->Projection(0),"zv_mult_track_cont_matrix");\r
2062   aFolderObj->Add(h);\r
2063 \r
2064   fRecMultTrackMatrix->GetAxis(1)->SetRangeUser(0.,maxPt);\r
2065   fRecTrackMatrix->GetAxis(1)->SetRangeUser(0.,maxPt);\r
2066   fRecMultTrackMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
2067   fRecTrackMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
2068 \r
2069   h = AlidNdPtHelper::GenerateCorrMatrix(fRecMultTrackMatrix->Projection(1),fRecTrackMatrix->Projection(1),"pt_mult_track_cont_matrix");\r
2070   aFolderObj->Add(h);\r
2071 \r
2072   fRecMultTrackMatrix->GetAxis(1)->SetRangeUser(minPt,maxPt);\r
2073   fRecTrackMatrix->GetAxis(1)->SetRangeUser(minPt,maxPt);\r
2074 \r
2075   fRecMultTrackMatrix->GetAxis(2)->SetRange(1,fRecMultTrackMatrix->GetAxis(2)->GetNbins());\r
2076   fRecTrackMatrix->GetAxis(2)->SetRange(1,fRecTrackMatrix->GetAxis(2)->GetNbins());\r
2077 \r
2078   h = AlidNdPtHelper::GenerateCorrMatrix(fRecMultTrackMatrix->Projection(2),fRecTrackMatrix->Projection(2),"eta_mult_track_cont_matrix");\r
2079   aFolderObj->Add(h);\r
2080 \r
2081   fRecMultTrackMatrix->GetAxis(1)->SetRangeUser(0.,maxPt);\r
2082   fRecTrackMatrix->GetAxis(1)->SetRangeUser(0.,maxPt);\r
2083 \r
2084   fRecMultTrackMatrix->GetAxis(0)->SetRange(1,fRecMultTrackMatrix->GetAxis(0)->GetNbins());\r
2085   fRecTrackMatrix->GetAxis(0)->SetRange(1,fRecTrackMatrix->GetAxis(0)->GetNbins());\r
2086 \r
2087   //\r
2088   // Control histograms\r
2089   //\r
2090   \r
2091   if(fHistogramsOn) {\r
2092 \r
2093   // Efficiency electrons, muons, pions, kaons, protons, all\r
2094   fMCPrimTrackHist1[1]->GetAxis(1)->SetRangeUser(minEta,maxEta); \r
2095   fMCPrimTrackHist1[2]->GetAxis(1)->SetRangeUser(minEta,maxEta);\r
2096 \r
2097   fMCPrimTrackHist1[1]->GetAxis(2)->SetRange(1,1); \r
2098   fMCPrimTrackHist1[2]->GetAxis(2)->SetRange(1,1); \r
2099   h1 = fMCPrimTrackHist1[1]->Projection(0);\r
2100   h2 = fMCPrimTrackHist1[2]->Projection(0);\r
2101   h2c = (TH1D *)h2->Clone();\r
2102   h2c->Divide(h1);\r
2103   h2c->SetName("eff_pt_electrons");\r
2104   aFolderObj->Add(h2c);\r
2105 \r
2106   fMCPrimTrackHist1[1]->GetAxis(2)->SetRange(2,2); \r
2107   fMCPrimTrackHist1[2]->GetAxis(2)->SetRange(2,2); \r
2108   h1 = fMCPrimTrackHist1[1]->Projection(0);\r
2109   h2 = fMCPrimTrackHist1[2]->Projection(0);\r
2110   h2c = (TH1D *)h2->Clone();\r
2111   h2c->Divide(h1);\r
2112   h2c->SetName("eff_pt_muons");\r
2113   aFolderObj->Add(h2c);\r
2114 \r
2115   fMCPrimTrackHist1[1]->GetAxis(2)->SetRange(3,3); \r
2116   fMCPrimTrackHist1[2]->GetAxis(2)->SetRange(3,3); \r
2117   h1 = fMCPrimTrackHist1[1]->Projection(0);\r
2118   h2 = fMCPrimTrackHist1[2]->Projection(0);\r
2119   h2c = (TH1D *)h2->Clone();\r
2120   h2c->Divide(h1);\r
2121   h2c->SetName("eff_pt_pions");\r
2122   aFolderObj->Add(h2c);\r
2123 \r
2124   fMCPrimTrackHist1[1]->GetAxis(2)->SetRange(4,4); \r
2125   fMCPrimTrackHist1[2]->GetAxis(2)->SetRange(4,4); \r
2126   h1 = fMCPrimTrackHist1[1]->Projection(0);\r
2127   h2 = fMCPrimTrackHist1[2]->Projection(0);\r
2128   h2c = (TH1D *)h2->Clone();\r
2129   h2c->Divide(h1);\r
2130   h2c->SetName("eff_pt_kaons");\r
2131   aFolderObj->Add(h2c);\r
2132 \r
2133   fMCPrimTrackHist1[1]->GetAxis(2)->SetRange(5,5); \r
2134   fMCPrimTrackHist1[2]->GetAxis(2)->SetRange(5,5); \r
2135   h1 = fMCPrimTrackHist1[1]->Projection(0);\r
2136   h2 = fMCPrimTrackHist1[2]->Projection(0);\r
2137   h2c = (TH1D *)h2->Clone();\r
2138   h2c->Divide(h1);\r
2139   h2c->SetName("eff_pt_protons");\r
2140   aFolderObj->Add(h2c);\r
2141 \r
2142   fMCPrimTrackHist1[1]->GetAxis(2)->SetRange(1,6); \r
2143   fMCPrimTrackHist1[2]->GetAxis(2)->SetRange(1,6); \r
2144   h1 = fMCPrimTrackHist1[1]->Projection(0);\r
2145   h2 = fMCPrimTrackHist1[2]->Projection(0);\r
2146   h2c = (TH1D *)h2->Clone();\r
2147   h2c->Divide(h1);\r
2148   h2c->SetName("eff_pt_all");\r
2149   aFolderObj->Add(h2c);\r
2150 \r
2151   fMCPrimTrackHist1[1]->GetAxis(1)->SetRange(1,fMCPrimTrackHist1[1]->GetAxis(1)->GetNbins()); \r
2152   fMCPrimTrackHist1[2]->GetAxis(1)->SetRange(1,fMCPrimTrackHist1[2]->GetAxis(1)->GetNbins());\r
2153 \r
2154   //  pt spetra\r
2155   // - rec, primaries, secondaries\r
2156   // - primaries (pid) \r
2157   // - secondaries (pid)\r
2158   // - secondaries (mech)\r
2159   // - secondaries (mother)\r
2160   //\r
2161 \r
2162   TH1D *mc_pt_acc_all = fMCTrackHist1[1]->Projection(0);\r
2163   mc_pt_acc_all->SetName("mc_pt_acc_all");\r
2164   aFolderObj->Add(mc_pt_acc_all);\r
2165 \r
2166   TH1D *mc_pt_acc_prim = fMCPrimTrackHist1[1]->Projection(0);\r
2167   mc_pt_acc_prim->SetName("mc_pt_acc_prim");\r
2168   aFolderObj->Add(mc_pt_acc_prim);\r
2169 \r
2170   TH1D *mc_pt_rec_all = fMCTrackHist1[2]->Projection(0);\r
2171   mc_pt_rec_all->SetName("mc_pt_rec_all");\r
2172   aFolderObj->Add(mc_pt_rec_all);\r
2173 \r
2174   TH1D *mc_pt_rec_prim = fMCPrimTrackHist1[2]->Projection(0);\r
2175   mc_pt_rec_prim->SetName("mc_pt_rec_prim");\r
2176   aFolderObj->Add(mc_pt_rec_prim);\r
2177 \r
2178   TH1D *mc_pt_rec_sec = fMCSecTrackHist1[2]->Projection(0);\r
2179   mc_pt_rec_sec->SetName("mc_pt_rec_sec");\r
2180   aFolderObj->Add(mc_pt_rec_sec);\r
2181 \r
2182   for(Int_t i = 0; i<6; i++) \r
2183   { \r
2184     sprintf(name,"mc_pt_rec_prim_pid_%d",i); \r
2185     fMCPrimTrackHist1[2]->GetAxis(2)->SetRange(i+1,i+1);\r
2186     h = fMCPrimTrackHist1[2]->Projection(0);\r
2187     h->SetName(name);\r
2188     aFolderObj->Add(h);\r
2189 \r
2190     sprintf(name,"mc_pt_rec_sec_pid_%d",i); \r
2191     fMCSecTrackHist1[2]->GetAxis(2)->SetRange(i+1,i+1);\r
2192     h = fMCSecTrackHist1[2]->Projection(0);\r
2193     h->SetName(name);\r
2194     aFolderObj->Add(h);\r
2195 \r
2196     // production mechanisms for given pid\r
2197     fMCSecTrackHist1[2]->GetAxis(2)->SetRange(i+1,i+1);\r
2198 \r
2199     for(Int_t j=0; j<20; j++) {\r
2200       if(j == 4) {\r
2201         // decay\r
2202         \r
2203         sprintf(name,"mc_pt_rec_sec_pid_%d_decay",i); \r
2204         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2205         h = fMCSecTrackHist1[2]->Projection(0);\r
2206         h->SetName(name);\r
2207         aFolderObj->Add(h);\r
2208 \r
2209         sprintf(name,"mc_eta_rec_sec_pid_%d_decay",i); \r
2210         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2211         h = fMCSecTrackHist1[2]->Projection(1);\r
2212         h->SetName(name);\r
2213         aFolderObj->Add(h);\r
2214 \r
2215         sprintf(name,"mc_mother_rec_sec_pid_%d_decay",i); \r
2216         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2217         h = fMCSecTrackHist1[2]->Projection(4);\r
2218         h->SetName(name);\r
2219         aFolderObj->Add(h);\r
2220 \r
2221       } else if (j == 5) {\r
2222        // conversion\r
2223 \r
2224         sprintf(name,"mc_pt_rec_sec_pid_%d_conv",i); \r
2225         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2226         h = fMCSecTrackHist1[2]->Projection(0);\r
2227         h->SetName(name);\r
2228         aFolderObj->Add(h);\r
2229 \r
2230         sprintf(name,"mc_eta_rec_sec_pid_%d_conv",i); \r
2231         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2232         h = fMCSecTrackHist1[2]->Projection(1);\r
2233         h->SetName(name);\r
2234         aFolderObj->Add(h);\r
2235 \r
2236         sprintf(name,"mc_mother_rec_sec_pid_%d_conv",i); \r
2237         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2238         h = fMCSecTrackHist1[2]->Projection(4);\r
2239         h->SetName(name);\r
2240         aFolderObj->Add(h);\r
2241 \r
2242      } else if (j == 13) {\r
2243        // mat\r
2244        \r
2245         sprintf(name,"mc_pt_rec_sec_pid_%d_mat",i); \r
2246         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2247         h = fMCSecTrackHist1[2]->Projection(0);\r
2248         h->SetName(name);\r
2249         aFolderObj->Add(h);\r
2250 \r
2251         sprintf(name,"mc_eta_rec_sec_pid_%d_mat",i); \r
2252         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2253         h = fMCSecTrackHist1[2]->Projection(1);\r
2254         h->SetName(name);\r
2255         aFolderObj->Add(h);\r
2256 \r
2257         sprintf(name,"mc_eta_mother_rec_sec_pid_%d_mat",i); \r
2258         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2259         h = fMCSecTrackHist1[2]->Projection(4,1);\r
2260         h->SetName(name);\r
2261         aFolderObj->Add(h);\r
2262 \r
2263         sprintf(name,"mc_mother_rec_sec_pid_%d_mat",i); \r
2264         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2265         h = fMCSecTrackHist1[2]->Projection(4);\r
2266         h->SetName(name);\r
2267         aFolderObj->Add(h);\r
2268 \r
2269         sprintf(name,"mc_pt_mother_rec_sec_pid_%d_mat",i); \r
2270         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2271         h = fMCSecTrackHist1[2]->Projection(4,0);\r
2272         h->SetName(name);\r
2273         aFolderObj->Add(h);\r
2274 \r
2275      } else {\r
2276        continue;\r
2277      }\r
2278    }\r
2279 \r
2280   }\r
2281   } // end fHistogramOn\r
2282 \r
2283   //\r
2284   //  resolution histograms\r
2285   //  only for reconstructed tracks\r
2286   //\r
2287 \r
2288   TH2F *h2F=0;\r
2289   TCanvas * c = new TCanvas("resol","resol");\r
2290   c->cd();\r
2291 \r
2292   //\r
2293   fRecMCTrackHist1->GetAxis(1)->SetRangeUser(-0.9,0.89); \r
2294 \r
2295   h2F = (TH2F*)fRecMCTrackHist1->Projection(2,0);\r
2296   h = AlidNdPtHelper::MakeResol(h2F,1,0,kTRUE,10);\r
2297   h->SetXTitle("p_{tmc} (GeV/c)");\r
2298   h->SetYTitle("(p_{t}-p_{tmc})/p_{tmc} resolution");\r
2299   h->Draw();\r
2300   h->SetName("pt_resolution_vs_mcpt");\r
2301   aFolderObj->Add(h);\r
2302 \r
2303   h2F = (TH2F*)fRecMCTrackHist1->Projection(2,0);\r
2304   h = AlidNdPtHelper::MakeResol(h2F,1,1,kTRUE,10);\r
2305   h->SetXTitle("p_{tmc} (GeV/c)");\r
2306   h->SetYTitle("(p_{t}-p_{tmc})/p_{tmc} mean");\r
2307   h->Draw();\r
2308   h->SetName("dpt_mean_vs_mcpt");\r
2309   aFolderObj->Add(h);\r
2310 \r
2311   //\r
2312   h2F = (TH2F*)fRecMCTrackHist1->Projection(3,0);\r
2313   h = AlidNdPtHelper::MakeResol(h2F,1,0,kTRUE,10);\r
2314   h->SetXTitle("p_{tmc} (GeV/c)");\r
2315   h->SetYTitle("(#eta-#eta_{mc}) resolution");\r
2316   h->Draw();\r
2317   h->SetName("eta_resolution_vs_mcpt");\r
2318   aFolderObj->Add(h);\r
2319 \r
2320   h2F = (TH2F*)fRecMCTrackHist1->Projection(3,0);\r
2321   h = AlidNdPtHelper::MakeResol(h2F,1,1,kTRUE,10);\r
2322   h->SetXTitle("p_{tmc} (GeV/c)");\r
2323   h->SetYTitle("(#eta-mc#eta) mean");\r
2324   h->Draw();\r
2325   h->SetName("deta_mean_vs_mcpt");\r
2326   aFolderObj->Add(h);\r
2327   \r
2328   // \r
2329   fRecMCTrackHist1->GetAxis(1)->SetRange(1,fRecMCTrackHist1->GetAxis(1)->GetNbins()); \r
2330   fRecMCTrackHist1->GetAxis(0)->SetRangeUser(minPt,maxPt); \r
2331 \r
2332   h2F = (TH2F*)fRecMCTrackHist1->Projection(2,1);\r
2333   h = AlidNdPtHelper::MakeResol(h2F,1,0,kTRUE,10);\r
2334   h->SetXTitle("#eta_{mc}");\r
2335   h->SetYTitle("(p_{t}-p_{tmc})/p_{tmc} resolution");\r
2336   h->Draw();\r
2337   h->SetName("pt_resolution_vs_mceta");\r
2338   aFolderObj->Add(h);\r
2339 \r
2340   h2F = (TH2F*)fRecMCTrackHist1->Projection(2,1);\r
2341   h = AlidNdPtHelper::MakeResol(h2F,1,1,kTRUE,10);\r
2342   h->SetXTitle("#eta_{mc}");\r
2343   h->SetYTitle("(p_{t}-p_{tmc})/p_{tmc} mean");\r
2344   h->Draw();\r
2345   h->SetName("dpt_mean_vs_mceta");\r
2346   aFolderObj->Add(h);\r
2347 \r
2348   //\r
2349   h2F = (TH2F*)fRecMCTrackHist1->Projection(3,1);\r
2350   h = AlidNdPtHelper::MakeResol(h2F,1,0,kTRUE,10);\r
2351   h->SetXTitle("#eta_{mc}");\r
2352   h->SetYTitle("(#eta-#eta_{mc}) resolution");\r
2353   h->Draw();\r
2354   h->SetName("eta_resolution_vs_mceta");\r
2355   aFolderObj->Add(h);\r
2356 \r
2357   h2F = (TH2F*)fRecMCTrackHist1->Projection(3,1);\r
2358   h = AlidNdPtHelper::MakeResol(h2F,1,1,kTRUE,10);\r
2359   h->SetXTitle("#eta_{mc}");\r
2360   h->SetYTitle("(#eta-mc#eta) mean");\r
2361   h->Draw();\r
2362   h->SetName("deta_mean_vs_mceta");\r
2363   aFolderObj->Add(h);\r
2364 \r
2365   fRecMCTrackHist1->GetAxis(0)->SetRange(1,fRecMCTrackHist1->GetAxis(0)->GetNbins()); \r
2366 \r
2367   } // end use MC info\r
2368 \r
2369   // export objects to analysis folder\r
2370   fAnalysisFolder = ExportToFolder(aFolderObj);\r
2371 \r
2372   // delete only TObjArray\r
2373   if(aFolderObj) delete aFolderObj;\r
2374 }\r
2375 \r
2376 //_____________________________________________________________________________\r
2377 TFolder* AlidNdPtAnalysis::ExportToFolder(TObjArray * array) \r
2378 {\r
2379   // recreate folder avery time and export objects to new one\r
2380   //\r
2381   AlidNdPtAnalysis * comp=this;\r
2382   TFolder *folder = comp->GetAnalysisFolder();\r
2383 \r
2384   TString name, title;\r
2385   TFolder *newFolder = 0;\r
2386   Int_t i = 0;\r
2387   Int_t size = array->GetSize();\r
2388 \r
2389   if(folder) { \r
2390      // get name and title from old folder\r
2391      name = folder->GetName();  \r
2392      title = folder->GetTitle();  \r
2393 \r
2394          // delete old one\r
2395      delete folder;\r
2396 \r
2397          // create new one\r
2398      newFolder = CreateFolder(name.Data(),title.Data());\r
2399      newFolder->SetOwner();\r
2400 \r
2401          // add objects to folder\r
2402      while(i < size) {\r
2403            newFolder->Add(array->At(i));\r
2404            i++;\r
2405          }\r
2406   }\r
2407 \r
2408 return newFolder;\r
2409 }\r
2410 \r
2411 //_____________________________________________________________________________\r
2412 TFolder* AlidNdPtAnalysis::CreateFolder(TString name,TString title) { \r
2413 // create folder for analysed histograms\r
2414 //\r
2415 TFolder *folder = 0;\r
2416   folder = new TFolder(name.Data(),title.Data());\r
2417 \r
2418   return folder;\r
2419 }\r