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