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