removed duplications in AlidNdPtHelper and AliPWG0Helper and small changes
[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     isEventTriggered = AliPWG0Helper::IsEventTriggered(esdEvent->GetTriggerMask(), GetTrigger());\r
831   }\r
832 \r
833   // use MC information\r
834   AliHeader* header = 0;\r
835   AliGenEventHeader* genHeader = 0;\r
836   AliStack* stack = 0;\r
837   TArrayF vtxMC(3);\r
838   //AlidNdPtHelper::MCProcessType evtType = AlidNdPtHelper::kInvalidProcess;\r
839   AliPWG0Helper::MCProcessType evtType = AliPWG0Helper::kInvalidProcess;\r
840 \r
841   Int_t multMCTrueTracks = 0;\r
842   if(IsUseMCInfo())\r
843   {\r
844     //\r
845     if(!mcEvent) {\r
846       AliDebug(AliLog::kError, "mcEvent not available");\r
847       return;\r
848     }\r
849     // get MC event header\r
850     header = mcEvent->Header();\r
851     if (!header) {\r
852       AliDebug(AliLog::kError, "Header not available");\r
853       return;\r
854     }\r
855     // MC particle stack\r
856     stack = mcEvent->Stack();\r
857     if (!stack) {\r
858       AliDebug(AliLog::kError, "Stack not available");\r
859       return;\r
860     }\r
861     // get event type (ND=0x1, DD=0x2, SD=0x4)\r
862     //evtType = AlidNdPtHelper::GetEventProcessType(header);\r
863     evtType = AliPWG0Helper::GetEventProcessType(header);\r
864     AliDebug(AliLog::kDebug+1, Form("Found process type %d", evtType));\r
865 \r
866     // get MC vertex\r
867     genHeader = header->GenEventHeader();\r
868     if (!genHeader) {\r
869       AliDebug(AliLog::kError, "Could not retrieve genHeader from Header");\r
870       return;\r
871     }\r
872     genHeader->PrimaryVertex(vtxMC);\r
873 \r
874     Double_t vMCEventHist1[3]={vtxMC[0],vtxMC[1],vtxMC[2]};\r
875     fMCEventHist1->Fill(vMCEventHist1);\r
876 \r
877     // multipliticy of all MC primary tracks\r
878     // in Zv, pt and eta ranges)\r
879     multMCTrueTracks = AlidNdPtHelper::GetMCTrueTrackMult(mcEvent,evtCuts,accCuts);\r
880 \r
881   } // end bUseMC\r
882 \r
883   // get reconstructed vertex  \r
884   const AliESDVertex* vtxESD = 0; \r
885   Bool_t isRecVertex = kFALSE;\r
886   if(evtCuts->IsRecVertexRequired()) \r
887   {\r
888     Bool_t bRedoTPCVertex = evtCuts->IsRedoTPCVertex();\r
889     Bool_t bUseConstraints = evtCuts->IsUseBeamSpotConstraint();\r
890     vtxESD = AlidNdPtHelper::GetVertex(esdEvent,evtCuts,accCuts,esdTrackCuts,GetAnalysisMode(),kFALSE,bRedoTPCVertex,bUseConstraints); \r
891     isRecVertex = AlidNdPtHelper::TestRecVertex(vtxESD, GetAnalysisMode(), kFALSE);\r
892   }\r
893   if( IsUseMCInfo() && !evtCuts->IsRecVertexRequired() ) {\r
894     vtxESD = new AliESDVertex(vtxMC[2],10.,genHeader->NProduced(),"smearMC");\r
895     isRecVertex = kTRUE;\r
896   }\r
897   Bool_t isEventOK = evtCuts->AcceptEvent(esdEvent,mcEvent,vtxESD) && isRecVertex; \r
898   //printf("isEventOK %d \n",isEventOK);\r
899 \r
900   // MB bias tracks\r
901   Int_t multMBTracks = 0; \r
902   if(GetAnalysisMode() == AlidNdPtHelper::kTPC || GetAnalysisMode() == AlidNdPtHelper::kMCPion ||  \r
903      GetAnalysisMode() == AlidNdPtHelper::kMCKaon ||  GetAnalysisMode() == AlidNdPtHelper::kMCProton || \r
904      GetAnalysisMode() ==AlidNdPtHelper::kPlus || GetAnalysisMode() ==AlidNdPtHelper::kMinus) {  \r
905 \r
906      multMBTracks = AlidNdPtHelper::GetTPCMBTrackMult(esdEvent,evtCuts,accCuts,esdTrackCuts);\r
907   } \r
908   else if(GetAnalysisMode() == AlidNdPtHelper::kTPCSPDvtx || GetAnalysisMode() == AlidNdPtHelper::kMCPion || \r
909           GetAnalysisMode() == AlidNdPtHelper::kMCKaon || GetAnalysisMode() == AlidNdPtHelper::kMCProton || \r
910           GetAnalysisMode() ==AlidNdPtHelper::kPlus || GetAnalysisMode() == AlidNdPtHelper::kMinus) {\r
911 \r
912            multMBTracks = AlidNdPtHelper::GetSPDMBTrackMult(esdEvent,0.0);\r
913   } \r
914   else {\r
915     AliDebug(AliLog::kError, Form("Found analysis type %s", GetAnalysisMode()));\r
916     return; \r
917   }\r
918  \r
919   TObjArray *allChargedTracks=0;\r
920   Int_t multAll=0, multAcc=0, multRec=0;\r
921   Int_t *labelsAll=0, *labelsAcc=0, *labelsRec=0;\r
922 \r
923   // check event cuts\r
924   if(isEventOK && isEventTriggered)\r
925   {\r
926     // get all charged tracks\r
927     //allChargedTracks = AlidNdPtHelper::GetAllChargedTracks(esdEvent,vtxESD,GetAnalysisMode());\r
928     allChargedTracks = AlidNdPtHelper::GetAllChargedTracks(esdEvent,GetAnalysisMode());\r
929     if(!allChargedTracks) return;\r
930 \r
931     Int_t entries = allChargedTracks->GetEntries();\r
932     labelsAll = new Int_t[entries];\r
933     labelsAcc = new Int_t[entries];\r
934     labelsRec = new Int_t[entries];\r
935     for(Int_t i=0; i<entries;++i) \r
936     {\r
937       AliESDtrack *track = (AliESDtrack*)allChargedTracks->At(i);\r
938       if(!track) continue;\r
939       if(track->Charge()==0) continue;\r
940         \r
941        FillHistograms(track,stack,AlidNdPtHelper::kAllTracks); \r
942        labelsAll[multAll] = TMath::Abs(track->GetLabel());\r
943        multAll++;\r
944 \r
945        if(accCuts->AcceptTrack(track)) {\r
946          FillHistograms(track,stack,AlidNdPtHelper::kAccTracks); \r
947          labelsAcc[multAcc] = TMath::Abs(track->GetLabel());\r
948          multAcc++;\r
949 \r
950          if(esdTrackCuts->AcceptTrack(track)) {\r
951            FillHistograms(track,stack,AlidNdPtHelper::kRecTracks); \r
952            labelsRec[multRec] = TMath::Abs(track->GetLabel());\r
953            multRec++;\r
954          }\r
955        }\r
956      } \r
957      // fill track multiplicity histograms\r
958      FillHistograms(allChargedTracks,labelsAll,multAll,labelsAcc,multAcc,labelsRec,multRec);\r
959 \r
960      Double_t vRecEventHist1[3] = {vtxESD->GetXv(),vtxESD->GetYv(),vtxESD->GetZv()};\r
961      fRecEventHist1->Fill(vRecEventHist1);\r
962 \r
963      Double_t vRecEventHist2[3] = {vtxESD->GetZv(),multMBTracks,multRec};\r
964      fRecEventHist2->Fill(vRecEventHist2);\r
965    } \r
966 \r
967    //\r
968    // Determine correction matrices\r
969    //\r
970    if(IsUseMCInfo())  \r
971    {\r
972      //\r
973      // multiplicity correlation matrix\r
974      //\r
975      Double_t vMultTrueEventMatrix[2] = {multRec,multMCTrueTracks};\r
976      fEventMultCorrelationMatrix->Fill(vMultTrueEventMatrix);\r
977 \r
978      // \r
979      // event level corrections (zv,N_MB)\r
980      //\r
981 \r
982      // all inelastic\r
983      Double_t vEventMatrix[2] = {vtxMC[2],multMBTracks};\r
984      fGenEventMatrix->Fill(vEventMatrix); \r
985      if(isEventTriggered) fTriggerEventMatrix->Fill(vEventMatrix);\r
986      if(isEventOK && isEventTriggered) fRecEventMatrix->Fill(vEventMatrix);\r
987 \r
988      // single diffractive\r
989      //if(evtType == AlidNdPtHelper::kSD) {\r
990      if(evtType == AliPWG0Helper::kSD) {\r
991        fGenSDEventMatrix->Fill(vEventMatrix); \r
992        if(isEventTriggered) fTriggerSDEventMatrix->Fill(vEventMatrix);\r
993        if(isEventOK && isEventTriggered) fRecSDEventMatrix->Fill(vEventMatrix);\r
994      }\r
995 \r
996      // double diffractive\r
997      //if(evtType == AlidNdPtHelper::kDD) {\r
998      if(evtType == AliPWG0Helper::kDD) {\r
999        fGenDDEventMatrix->Fill(vEventMatrix); \r
1000        if(isEventTriggered) fTriggerDDEventMatrix->Fill(vEventMatrix);\r
1001        if(isEventOK && isEventTriggered)  fRecDDEventMatrix->Fill(vEventMatrix);\r
1002      }\r
1003 \r
1004      // non diffractive\r
1005      //if(evtType == AlidNdPtHelper::kND) {\r
1006      if(evtType == AliPWG0Helper::kND) {\r
1007        fGenNDEventMatrix->Fill(vEventMatrix); \r
1008        if(isEventTriggered) fTriggerNDEventMatrix->Fill(vEventMatrix);\r
1009        if(isEventOK && isEventTriggered) fRecNDEventMatrix->Fill(vEventMatrix);\r
1010      }\r
1011 \r
1012      // non single diffractive\r
1013      //if(evtType != AlidNdPtHelper::kSD) {\r
1014      if(evtType != AliPWG0Helper::kSD) {\r
1015        fGenNSDEventMatrix->Fill(vEventMatrix); \r
1016        if(isEventTriggered) fTriggerNSDEventMatrix->Fill(vEventMatrix);\r
1017        if(isEventOK && isEventTriggered) fRecNSDEventMatrix->Fill(vEventMatrix);\r
1018      }\r
1019 \r
1020      //\r
1021      // track-event level corrections (zv,pt,eta)\r
1022      //\r
1023      for (Int_t iMc = 0; iMc < stack->GetNtrack(); ++iMc) \r
1024      {\r
1025        TParticle* particle = stack->Particle(iMc);\r
1026        if (!particle)\r
1027        continue;\r
1028 \r
1029        // only charged particles\r
1030        Double_t charge = particle->GetPDG()->Charge()/3.;\r
1031        if (charge == 0.0)\r
1032         continue;\r
1033 \r
1034        // only postive charged \r
1035        if(GetAnalysisMode() == AlidNdPtHelper::kPlus && charge < 0.) \r
1036         continue;\r
1037        \r
1038        // only negative charged \r
1039        if(GetAnalysisMode() == AlidNdPtHelper::kMinus && charge > 0.) \r
1040        continue;\r
1041       \r
1042        // physical primary\r
1043        Bool_t prim = stack->IsPhysicalPrimary(iMc);\r
1044        if(!prim) continue;\r
1045 \r
1046        // checked accepted\r
1047        if(accCuts->AcceptTrack(particle)) \r
1048        {\r
1049          Double_t vTrackEventMatrix[3] = {vtxMC[2], particle->Pt(), particle->Eta()}; \r
1050          fGenTrackEventMatrix->Fill(vTrackEventMatrix);\r
1051 \r
1052          if(evtType == AliPWG0Helper::kSD) {\r
1053            fGenTrackSDEventMatrix->Fill(vTrackEventMatrix);\r
1054          }\r
1055          if(evtType == AliPWG0Helper::kDD) {\r
1056            fGenTrackDDEventMatrix->Fill(vTrackEventMatrix);\r
1057          }\r
1058          if(evtType == AliPWG0Helper::kND) {\r
1059            fGenTrackNDEventMatrix->Fill(vTrackEventMatrix);\r
1060          }\r
1061          if(evtType != AliPWG0Helper::kSD) {\r
1062            fGenTrackNSDEventMatrix->Fill(vTrackEventMatrix);\r
1063          }\r
1064 \r
1065          //\r
1066          if(!isEventTriggered) continue;  \r
1067 \r
1068          fTriggerTrackEventMatrix->Fill(vTrackEventMatrix);\r
1069          if(evtType == AliPWG0Helper::kSD) {\r
1070            fTriggerTrackSDEventMatrix->Fill(vTrackEventMatrix);\r
1071          }\r
1072          if(evtType == AliPWG0Helper::kDD) {\r
1073            fTriggerTrackDDEventMatrix->Fill(vTrackEventMatrix);\r
1074          }\r
1075          if(evtType == AliPWG0Helper::kND) {\r
1076            fTriggerTrackNDEventMatrix->Fill(vTrackEventMatrix);\r
1077          }\r
1078          if(evtType != AliPWG0Helper::kSD) {\r
1079            fTriggerTrackNSDEventMatrix->Fill(vTrackEventMatrix);\r
1080          }\r
1081 \r
1082          //\r
1083          if(!isEventOK) continue;  \r
1084 \r
1085          fRecTrackEventMatrix->Fill(vTrackEventMatrix);\r
1086          if(evtType == AliPWG0Helper::kSD) {\r
1087            fRecTrackSDEventMatrix->Fill(vTrackEventMatrix);\r
1088          }\r
1089          if(evtType == AliPWG0Helper::kDD) {\r
1090            fRecTrackDDEventMatrix->Fill(vTrackEventMatrix);\r
1091          }\r
1092          if(evtType == AliPWG0Helper::kND) {\r
1093            fRecTrackNDEventMatrix->Fill(vTrackEventMatrix);\r
1094          }\r
1095          if(evtType != AliPWG0Helper::kSD) {\r
1096            fRecTrackNSDEventMatrix->Fill(vTrackEventMatrix);\r
1097          }\r
1098        }\r
1099      }\r
1100 \r
1101      // \r
1102      // track-level corrections (zv,pt.eta)\r
1103      //\r
1104      if(isEventOK && isEventTriggered)\r
1105      {\r
1106 \r
1107        // fill MC and rec event control histograms\r
1108        if(fHistogramsOn) {\r
1109          Double_t vRecMCEventHist1[3] = {vtxESD->GetXv()-vtxMC[0],vtxESD->GetYv()-vtxMC[1],vtxESD->GetZv()-vtxMC[2]};\r
1110          fRecMCEventHist1->Fill(vRecMCEventHist1);\r
1111 \r
1112          Double_t vRecMCEventHist2[3] = {vtxESD->GetXv()-vtxMC[0],vtxESD->GetZv()-vtxMC[2],multMBTracks};\r
1113          fRecMCEventHist2->Fill(vRecMCEventHist2);\r
1114 \r
1115          Double_t vRecMCEventHist3[2] = {multRec,evtType};\r
1116          fRecMCEventHist3->Fill(vRecMCEventHist3);\r
1117        }\r
1118 \r
1119        //\r
1120        // MC histograms for track efficiency studies\r
1121        //\r
1122        for (Int_t iMc = 0; iMc < stack->GetNtrack(); ++iMc) \r
1123        {\r
1124          TParticle* particle = stack->Particle(iMc);\r
1125          if (!particle)\r
1126          continue;\r
1127 \r
1128          // only charged particles\r
1129          Double_t charge = particle->GetPDG()->Charge()/3.;\r
1130          if (charge == 0.0)\r
1131          continue;\r
1132 \r
1133          // only postive charged \r
1134          if(GetAnalysisMode() == AlidNdPtHelper::kPlus && charge < 0.) \r
1135          continue;\r
1136        \r
1137          // only negative charged \r
1138          if(GetAnalysisMode() == AlidNdPtHelper::kMinus && charge > 0.) \r
1139          continue;\r
1140       \r
1141          // physical primary\r
1142          Bool_t prim = stack->IsPhysicalPrimary(iMc);\r
1143 \r
1144          // check accepted\r
1145          if(accCuts->AcceptTrack(particle)) \r
1146          {\r
1147            Double_t vTrackMatrix[3] = {vtxMC[2],particle->Pt(),particle->Eta()}; \r
1148            //if(prim) fGenPrimTrackMatrix->Fill(vTrackMatrix);\r
1149            if( AlidNdPtHelper::IsPrimaryParticle(stack, iMc, GetAnalysisMode()) ) fGenPrimTrackMatrix->Fill(vTrackMatrix);\r
1150 \r
1151            // fill control histograms\r
1152            if(fHistogramsOn) \r
1153              FillHistograms(stack,iMc,AlidNdPtHelper::kAccTracks); \r
1154 \r
1155            // check multiple found tracks\r
1156            Int_t mult_count = 0;\r
1157            for(Int_t iRec=0; iRec<multRec; ++iRec)\r
1158            {\r
1159              if(iMc == labelsRec[iRec]) \r
1160              {\r
1161                mult_count++;\r
1162                if(mult_count>1)\r
1163                {  \r
1164                  fRecMultTrackMatrix->Fill(vTrackMatrix);\r
1165 \r
1166                  // fill control histogram\r
1167                  if(fHistogramsOn) {\r
1168                    Int_t pid = AlidNdPtHelper::ConvertPdgToPid(particle);\r
1169                    Double_t vMCMultRecTrackHist1[3] = {particle->Pt(), particle->Eta(), pid};\r
1170                    fMCMultRecTrackHist1->Fill(vMCMultRecTrackHist1);\r
1171                  }\r
1172                }\r
1173              }\r
1174            }\r
1175 \r
1176            // check reconstructed\r
1177            for(Int_t iRec=0; iRec<multRec; ++iRec)\r
1178            {\r
1179              if(iMc == labelsRec[iRec]) \r
1180              {\r
1181                fRecTrackMatrix->Fill(vTrackMatrix);\r
1182                if( AlidNdPtHelper::IsPrimaryParticle(stack, iMc, GetAnalysisMode()) ) fRecPrimTrackMatrix->Fill(vTrackMatrix);\r
1183                if(!prim) fRecSecTrackMatrix->Fill(vTrackMatrix);\r
1184 \r
1185                // fill control histograms\r
1186                if(fHistogramsOn) \r
1187                  FillHistograms(stack,iMc,AlidNdPtHelper::kRecTracks); \r
1188               \r
1189                break;\r
1190              }\r
1191            }\r
1192          }\r
1193        }\r
1194      }\r
1195    } // end bUseMC\r
1196 \r
1197   if(allChargedTracks) delete allChargedTracks; allChargedTracks = 0;\r
1198   if(labelsAll) delete [] labelsAll; labelsAll = 0;\r
1199   if(labelsAcc) delete [] labelsAcc; labelsAcc = 0;\r
1200   if(labelsRec) delete [] labelsRec; labelsRec = 0;\r
1201 \r
1202   if(!evtCuts->IsRecVertexRequired() && vtxESD != NULL) delete vtxESD;\r
1203 \r
1204 }\r
1205 \r
1206 //_____________________________________________________________________________\r
1207 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
1208  // multiplicity  histograms\r
1209  \r
1210   if(!allChargedTracks) return;\r
1211   if(!labelsAll) return;\r
1212   if(!labelsAcc) return;\r
1213   if(!labelsRec) return;\r
1214 \r
1215   Int_t entries = allChargedTracks->GetEntries();\r
1216   for(Int_t i=0; i<entries; ++i)\r
1217   {\r
1218      AliESDtrack *track = (AliESDtrack*)allChargedTracks->At(i);\r
1219      if(!track) continue;\r
1220      if(track->Charge() == 0) continue;\r
1221 \r
1222      Int_t label = TMath::Abs(track->GetLabel());\r
1223      for(Int_t iAll=0; iAll<multAll; ++iAll) {\r
1224        if(label == labelsAll[iAll]) {\r
1225          Double_t v1[2] = {track->Pt(), multAll}; \r
1226          fRecTrackMultHist1[AlidNdPtHelper::kAllTracks]->Fill(v1);\r
1227        }\r
1228      }\r
1229      for(Int_t iAcc=0; iAcc<multAcc; ++iAcc) {\r
1230        if(label == labelsAcc[iAcc]) {\r
1231          Double_t v2[2] = {track->Pt(), multAcc}; \r
1232          fRecTrackMultHist1[AlidNdPtHelper::kAccTracks]->Fill(v2);\r
1233        }\r
1234      }\r
1235      for(Int_t iRec=0; iRec<multRec; ++iRec) {\r
1236        if(label == labelsRec[iRec]) {\r
1237          Double_t v3[2] = {track->Pt(), multRec}; \r
1238          fRecTrackMultHist1[AlidNdPtHelper::kRecTracks]->Fill(v3);\r
1239        }\r
1240      }\r
1241   }\r
1242 }\r
1243 \r
1244 //_____________________________________________________________________________\r
1245 void AlidNdPtAnalysis::FillHistograms(AliESDtrack *const esdTrack, AliStack *const stack, AlidNdPtHelper::TrackObject trackObj)\r
1246 {\r
1247   //\r
1248   // Fill ESD track and MC histograms \r
1249   //\r
1250   if(!esdTrack) return;\r
1251 \r
1252   Float_t q = esdTrack->Charge();\r
1253   if(q==0) return;\r
1254 \r
1255   Float_t pt = esdTrack->Pt();\r
1256   //Float_t qpt = esdTrack->Pt() * q;\r
1257   Float_t eta = esdTrack->Eta();\r
1258   Float_t phi = esdTrack->Phi();\r
1259 \r
1260   Float_t dca[2], bCov[3];\r
1261   esdTrack->GetImpactParameters(dca,bCov);\r
1262 \r
1263 \r
1264   // fill histograms\r
1265   Double_t values[3] = {pt,eta,phi};      \r
1266   fRecTrackHist1[trackObj]->Fill(values);\r
1267  \r
1268   //\r
1269   // Fill rec vs MC information\r
1270   //\r
1271   if(!stack) return;\r
1272 \r
1273   Int_t label = TMath::Abs(esdTrack->GetLabel()); \r
1274   //if(label == 0) return;\r
1275 \r
1276   TParticle* particle = stack->Particle(label);\r
1277   if(!particle) return;\r
1278 \r
1279   //Bool_t prim = stack->IsPhysicalPrimary(label);\r
1280   //Int_t pid = AlidNdPtHelper::ConvertPdgToPid(particle);\r
1281 \r
1282   Int_t mother_pdg = -1;\r
1283   TParticle* mother = 0;\r
1284 \r
1285   //TParticle* prim_mother = AlidNdPtHelper::FindPrimaryMother(stack,label);\r
1286   Int_t motherLabel = particle->GetMother(0); \r
1287   if(motherLabel>0) mother = stack->Particle(motherLabel);\r
1288   if(mother) mother_pdg = TMath::Abs(mother->GetPdgCode()); // take abs for visualisation only\r
1289   //Int_t mech = particle->GetUniqueID(); // production mechanism\r
1290 \r
1291   Double_t gq = particle->GetPDG()->Charge()/3.0; // Charge units |e|/3 \r
1292   if(gq==0) return;\r
1293   Float_t gpt = particle->Pt();\r
1294   Float_t geta = particle->Eta();\r
1295   //Float_t qgpt = particle->Pt() * gq;\r
1296   //Float_t gphi = particle->Phi();\r
1297 \r
1298   Double_t dpt=0;\r
1299   if(gpt) dpt = (pt-gpt)/gpt;\r
1300   Double_t deta = (eta-geta);\r
1301  \r
1302   // fill histograms\r
1303   if(trackObj == AlidNdPtHelper::kRecTracks)  \r
1304   {\r
1305     Double_t vTrackPtCorrelationMatrix[3]={pt,gpt,geta};\r
1306     fTrackPtCorrelationMatrix->Fill(vTrackPtCorrelationMatrix);\r
1307 \r
1308     Double_t vRecMCTrackHist1[4]={gpt,geta,dpt,deta};\r
1309     fRecMCTrackHist1->Fill(vRecMCTrackHist1);\r
1310 \r
1311   }\r
1312 }\r
1313 \r
1314 //_____________________________________________________________________________\r
1315 void AlidNdPtAnalysis::FillHistograms(AliStack *const stack, Int_t label, AlidNdPtHelper::TrackObject trackObj)\r
1316 {\r
1317   // Fill MC histograms\r
1318   if(!stack) return;\r
1319 \r
1320   TParticle* particle = stack->Particle(label);\r
1321   if(!particle) return;\r
1322 \r
1323   Int_t mother_pdg = -1;\r
1324   TParticle* mother = 0;\r
1325 \r
1326   //TParticle* prim_mother = AlidNdPtHelper::FindPrimaryMother(stack,label);\r
1327   Int_t motherLabel = particle->GetMother(0); \r
1328   if(motherLabel>0) mother = stack->Particle(motherLabel);\r
1329   if(mother) mother_pdg = TMath::Abs(mother->GetPdgCode()); // take abs for visualisation only\r
1330   Int_t mech = particle->GetUniqueID(); // production mechanism\r
1331 \r
1332   Double_t gq = particle->GetPDG()->Charge()/3.0; // Charge units |e|/3 \r
1333   if(gq == 0) return;\r
1334   Float_t gpt = particle->Pt();\r
1335   //Float_t qgpt = particle->Pt() * gq;\r
1336   Float_t geta = particle->Eta();\r
1337   Float_t gphi = particle->Phi();\r
1338   //Float_t gpz = particle->Pz();\r
1339 \r
1340   Bool_t prim = stack->IsPhysicalPrimary(label);\r
1341   //Float_t vx = particle->Vx(); Float_t vy = particle->Vy(); Float_t vz = particle->Vz();\r
1342 \r
1343   Int_t pid = AlidNdPtHelper::ConvertPdgToPid(particle);\r
1344 \r
1345   //if(prim&&pid==5) printf("pdgcode %d, production mech %d \n",particle->GetPdgCode(),mech);\r
1346   //if(!prim) printf("mother_pdg %d, particle %d, production mech %d\n",mother_pdg, particle->GetPdgCode(),mech);\r
1347   \r
1348   //\r
1349   // fill histogram\r
1350   //\r
1351   Double_t vMCTrackHist1[3] = {gpt,geta,gphi};\r
1352   fMCTrackHist1[trackObj]->Fill(vMCTrackHist1);\r
1353 \r
1354   Double_t vMCPrimTrackHist1[5] = {gpt,geta,pid,mech,mother_pdg};\r
1355   if(prim) fMCPrimTrackHist1[trackObj]->Fill(vMCPrimTrackHist1);\r
1356   else     { \r
1357          fMCSecTrackHist1[trackObj]->Fill(vMCPrimTrackHist1);\r
1358   }\r
1359 }\r
1360 \r
1361 //_____________________________________________________________________________\r
1362 Long64_t AlidNdPtAnalysis::Merge(TCollection* list) \r
1363 {\r
1364   // Merge list of objects (needed by PROOF)\r
1365 \r
1366   if (!list)\r
1367   return 0;\r
1368 \r
1369   if (list->IsEmpty())\r
1370   return 1;\r
1371 \r
1372   TIterator* iter = list->MakeIterator();\r
1373   TObject* obj = 0;\r
1374 \r
1375   // collection of generated histograms\r
1376 \r
1377   Int_t count=0;\r
1378   while((obj = iter->Next()) != 0) {\r
1379     AlidNdPtAnalysis* entry = dynamic_cast<AlidNdPtAnalysis*>(obj);\r
1380     if (entry == 0) continue; \r
1381 \r
1382     //\r
1383     fEventMultCorrelationMatrix->Add(entry->fEventMultCorrelationMatrix);\r
1384     fTrackPtCorrelationMatrix->Add(entry->fTrackPtCorrelationMatrix);\r
1385 \r
1386     //\r
1387     fGenEventMatrix->Add(entry->fGenEventMatrix);\r
1388     fGenSDEventMatrix->Add(entry->fGenSDEventMatrix);\r
1389     fGenDDEventMatrix->Add(entry->fGenDDEventMatrix);\r
1390     fGenNDEventMatrix->Add(entry->fGenNDEventMatrix);\r
1391     fGenNSDEventMatrix->Add(entry->fGenNSDEventMatrix);\r
1392 \r
1393     fTriggerEventMatrix->Add(entry->fTriggerEventMatrix);\r
1394     fTriggerSDEventMatrix->Add(entry->fTriggerSDEventMatrix);\r
1395     fTriggerDDEventMatrix->Add(entry->fTriggerDDEventMatrix);\r
1396     fTriggerNDEventMatrix->Add(entry->fTriggerNDEventMatrix);\r
1397     fTriggerNSDEventMatrix->Add(entry->fTriggerNSDEventMatrix);\r
1398 \r
1399     fRecEventMatrix->Add(entry->fRecEventMatrix);\r
1400     fRecSDEventMatrix->Add(entry->fRecSDEventMatrix);\r
1401     fRecDDEventMatrix->Add(entry->fRecDDEventMatrix);\r
1402     fRecNDEventMatrix->Add(entry->fRecNDEventMatrix);\r
1403     fRecNSDEventMatrix->Add(entry->fRecNSDEventMatrix);\r
1404 \r
1405     //\r
1406     fGenTrackEventMatrix->Add(entry->fGenTrackEventMatrix);\r
1407     fGenTrackSDEventMatrix->Add(entry->fGenTrackSDEventMatrix);\r
1408     fGenTrackDDEventMatrix->Add(entry->fGenTrackDDEventMatrix);\r
1409     fGenTrackNDEventMatrix->Add(entry->fGenTrackNDEventMatrix);\r
1410     fGenTrackNSDEventMatrix->Add(entry->fGenTrackNSDEventMatrix);\r
1411 \r
1412     fTriggerTrackEventMatrix->Add(entry->fTriggerTrackEventMatrix);\r
1413     fTriggerTrackSDEventMatrix->Add(entry->fTriggerTrackSDEventMatrix);\r
1414     fTriggerTrackDDEventMatrix->Add(entry->fTriggerTrackDDEventMatrix);\r
1415     fTriggerTrackNDEventMatrix->Add(entry->fTriggerTrackNDEventMatrix);\r
1416     fTriggerTrackNSDEventMatrix->Add(entry->fTriggerTrackNSDEventMatrix);\r
1417 \r
1418     fRecTrackEventMatrix->Add(entry->fRecTrackEventMatrix);\r
1419     fRecTrackSDEventMatrix->Add(entry->fRecTrackSDEventMatrix);\r
1420     fRecTrackDDEventMatrix->Add(entry->fRecTrackDDEventMatrix);\r
1421     fRecTrackNDEventMatrix->Add(entry->fRecTrackNDEventMatrix);\r
1422     fRecTrackNSDEventMatrix->Add(entry->fRecTrackNSDEventMatrix);\r
1423 \r
1424     //\r
1425     fGenPrimTrackMatrix->Add(entry->fGenPrimTrackMatrix);\r
1426     fRecPrimTrackMatrix->Add(entry->fRecPrimTrackMatrix);\r
1427     //\r
1428     fRecTrackMatrix->Add(entry->fRecTrackMatrix);\r
1429     fRecSecTrackMatrix->Add(entry->fRecSecTrackMatrix);\r
1430     //\r
1431     fRecMultTrackMatrix->Add(entry->fRecMultTrackMatrix);\r
1432 \r
1433     //\r
1434     // control analysis histograms\r
1435     //\r
1436     fMCEventHist1->Add(entry->fMCEventHist1);\r
1437     fRecEventHist1->Add(entry->fRecEventHist1);\r
1438     fRecEventHist2->Add(entry->fRecEventHist2);\r
1439     fRecMCEventHist1->Add(entry->fRecMCEventHist1);\r
1440     fRecMCEventHist2->Add(entry->fRecMCEventHist2);\r
1441     fRecMCEventHist3->Add(entry->fRecMCEventHist3);\r
1442 \r
1443     for(Int_t i=0; i<AlidNdPtHelper::kCutSteps; i++) {\r
1444       fMCTrackHist1[i]->Add(entry->fMCTrackHist1[i]);\r
1445 \r
1446       fMCPrimTrackHist1[i]->Add(entry->fMCPrimTrackHist1[i]);\r
1447       fMCSecTrackHist1[i]->Add(entry->fMCSecTrackHist1[i]);\r
1448 \r
1449       fRecTrackHist1[i]->Add(entry->fRecTrackHist1[i]);\r
1450       fRecTrackMultHist1[i]->Add(entry->fRecTrackMultHist1[i]);\r
1451     }\r
1452     fRecMCTrackHist1->Add(entry->fRecMCTrackHist1);\r
1453     fMCMultRecTrackHist1->Add(entry->fMCMultRecTrackHist1);\r
1454 \r
1455   count++;\r
1456   }\r
1457 \r
1458 return count;\r
1459 }\r
1460  \r
1461 //_____________________________________________________________________________\r
1462 void AlidNdPtAnalysis::Analyse() \r
1463 {\r
1464   // Analyse histograms\r
1465   //\r
1466   TH1::AddDirectory(kFALSE);\r
1467   TH1 *h=0, *h1=0, *h2=0, *h2c = 0; \r
1468   THnSparse *hs=0; \r
1469   TH2 *h2D=0; \r
1470 \r
1471   char name[256];\r
1472   TObjArray *aFolderObj = new TObjArray;\r
1473 \r
1474   //\r
1475   // get cuts\r
1476   //\r
1477   AlidNdPtEventCuts *evtCuts = GetEventCuts(); \r
1478   AlidNdPtAcceptanceCuts *accCuts = GetAcceptanceCuts(); \r
1479   AliESDtrackCuts *esdTrackCuts = GetTrackCuts(); \r
1480 \r
1481   if(!evtCuts || !accCuts || !esdTrackCuts) {\r
1482     Error("AlidNdPtCutAnalysis::Analyse()", "cuts not available");\r
1483     return;\r
1484   }\r
1485 \r
1486   //\r
1487   // set min and max values\r
1488   //\r
1489   Double_t minZv = evtCuts->GetMinZv();\r
1490   Double_t maxZv = evtCuts->GetMaxZv()-0.00001;\r
1491   Double_t minPt = accCuts->GetMinPt();\r
1492   Double_t maxPt = accCuts->GetMaxPt();\r
1493   Double_t minEta = accCuts->GetMinEta();\r
1494   Double_t maxEta = accCuts->GetMaxEta()-0.00001;\r
1495 \r
1496   //\r
1497   // Reconstructed event vertex\r
1498   //\r
1499   h = fRecEventHist1->Projection(0);\r
1500   h->SetName("Xv");\r
1501   aFolderObj->Add(h);\r
1502 \r
1503   h = fRecEventHist1->Projection(1);\r
1504   h->SetName("Yv");\r
1505   aFolderObj->Add(h);\r
1506 \r
1507   h = fRecEventHist1->Projection(2);\r
1508   h->SetName("Zv");\r
1509   aFolderObj->Add(h);\r
1510 \r
1511   //\r
1512   // multiplicity\r
1513   //\r
1514   h = fRecEventHist2->Projection(1);\r
1515   h->SetName("multMB");\r
1516   aFolderObj->Add(h);\r
1517 \r
1518   h = fRecEventHist2->Projection(2);\r
1519   h->SetName("multiplicity");\r
1520   aFolderObj->Add(h);\r
1521 \r
1522   h2D = fRecEventHist2->Projection(0,1); \r
1523   h2D->SetName("Zv_vs_multiplicity_MB");\r
1524   aFolderObj->Add(h2D);\r
1525 \r
1526   //\r
1527   // reconstructed pt histograms\r
1528   //\r
1529   h = fRecTrackHist1[0]->Projection(0);\r
1530   h->SetName("pt_all_ch");\r
1531   aFolderObj->Add(h);\r
1532 \r
1533   h = fRecTrackHist1[1]->Projection(0);\r
1534   h->SetName("pt_acc");\r
1535   aFolderObj->Add(h);\r
1536 \r
1537   h = fRecTrackHist1[2]->Projection(0);\r
1538   h->SetName("pt_rec");\r
1539   aFolderObj->Add(h);\r
1540 \r
1541   //\r
1542   // reconstructed eta histograms\r
1543   //\r
1544   h = fRecTrackHist1[0]->Projection(1);\r
1545   h->SetName("eta_all_ch");\r
1546   aFolderObj->Add(h);\r
1547 \r
1548   h = fRecTrackHist1[1]->Projection(1);\r
1549   h->SetName("eta_acc");\r
1550   aFolderObj->Add(h);\r
1551 \r
1552   h = fRecTrackHist1[2]->Projection(1);\r
1553   h->SetName("eta_rec");\r
1554   aFolderObj->Add(h);\r
1555 \r
1556   //\r
1557   // reconstructed phi histograms\r
1558   //\r
1559   h = fRecTrackHist1[0]->Projection(2);\r
1560   h->SetName("phi_all_ch");\r
1561   aFolderObj->Add(h);\r
1562 \r
1563   h = fRecTrackHist1[1]->Projection(2);\r
1564   h->SetName("phi_acc");\r
1565   aFolderObj->Add(h);\r
1566 \r
1567   h = fRecTrackHist1[2]->Projection(2);\r
1568   h->SetName("phi_rec");\r
1569   aFolderObj->Add(h);\r
1570 \r
1571   //\r
1572   // reconstructed eta:pt histograms\r
1573   //\r
1574   h2D = fRecTrackHist1[0]->Projection(1,0);\r
1575   h2D->SetName("pt_eta_all_ch");\r
1576   aFolderObj->Add(h2D);\r
1577 \r
1578   h2D = fRecTrackHist1[1]->Projection(1,0);\r
1579   h2D->SetName("pt_eta_acc");\r
1580   aFolderObj->Add(h2D);\r
1581 \r
1582   h2D = fRecTrackHist1[2]->Projection(1,0);\r
1583   h2D->SetName("pt_eta_rec");\r
1584   aFolderObj->Add(h2D);\r
1585 \r
1586   //\r
1587   // reconstructed phi:pt histograms\r
1588   //\r
1589   h2D = fRecTrackHist1[0]->Projection(2,0);\r
1590   h2D->SetName("pt_phi_all_ch");\r
1591   aFolderObj->Add(h2D);\r
1592 \r
1593   h2D = fRecTrackHist1[1]->Projection(2,0);\r
1594   h2D->SetName("pt_phi_acc");\r
1595   aFolderObj->Add(h2D);\r
1596 \r
1597   h2D = fRecTrackHist1[2]->Projection(2,0);\r
1598   h2D->SetName("pt_phi_rec");\r
1599   aFolderObj->Add(h2D);\r
1600 \r
1601   //\r
1602   // reconstructed phi:eta histograms\r
1603   //\r
1604   h2D = fRecTrackHist1[0]->Projection(2,1);\r
1605   h2D->SetName("eta_phi_all_ch");\r
1606   aFolderObj->Add(h2D);\r
1607 \r
1608   h2D = fRecTrackHist1[1]->Projection(2,1);\r
1609   h2D->SetName("eta_phi_acc");\r
1610   aFolderObj->Add(h2D);\r
1611 \r
1612   h2D = fRecTrackHist1[2]->Projection(2,1);\r
1613   h2D->SetName("eta_phi_rec");\r
1614   aFolderObj->Add(h2D);\r
1615 \r
1616   //\r
1617   // calculate corrections for empty events\r
1618   // with multMB==0 \r
1619   //\r
1620 \r
1621   //\r
1622   // normalised zv to generate zv for triggered events\r
1623   //\r
1624   h = fRecEventHist2->Projection(0);\r
1625   if( h->Integral() ) h->Scale(1./h->Integral());\r
1626   h->SetName("zv_distribution_norm");\r
1627   aFolderObj->Add(h);\r
1628  \r
1629   //\r
1630   // MC available\r
1631   //\r
1632   if(IsUseMCInfo()) {\r
1633 \r
1634   //\r
1635   // Event vertex resolution\r
1636   //\r
1637   h2D = fRecMCEventHist2->Projection(0,2);\r
1638   h2D->SetName("DeltaXv_vs_mult");\r
1639   aFolderObj->Add(h2D);\r
1640 \r
1641   h2D = fRecMCEventHist2->Projection(1,2);\r
1642   h2D->SetName("DeltaZv_vs_mult");\r
1643   aFolderObj->Add(h2D);\r
1644 \r
1645   //\r
1646   // normalised zv to get trigger/trigger+vertex event differences\r
1647   // F(zv) = E_trig(zv,0)/Int(E_trig(zv,0) / Sum(E_trigvtx(zv,n))/Sum(Int(E_trigvtx(zv,n))dzv)\r
1648   //\r
1649   fTriggerEventMatrix->GetAxis(1)->SetRangeUser(0.,0.);\r
1650   h = fTriggerEventMatrix->Projection(0);\r
1651   h2D = fTriggerEventMatrix->Projection(0,1);\r
1652   if(h2D->Integral()) h->Scale(1./h2D->Integral());\r
1653 \r
1654   h1 = fRecEventMatrix->Projection(0);\r
1655   h2D = fRecEventMatrix->Projection(0,1);\r
1656   if(h2D->Integral()) h1->Scale(1./h2D->Integral());\r
1657 \r
1658   h->Divide(h1);\r
1659   h->SetName("zv_empty_events_norm");\r
1660   aFolderObj->Add(h);\r
1661   \r
1662   fTriggerEventMatrix->GetAxis(1)->SetRange(1,fTriggerEventMatrix->GetAxis(1)->GetNbins());\r
1663 \r
1664   //\r
1665   // rec. vs true multiplicity correlation matrix\r
1666   //\r
1667   hs = (THnSparse*)fEventMultCorrelationMatrix->Clone("event_mult_correlation_matrix");\r
1668   aFolderObj->Add(hs);\r
1669  \r
1670   //\r
1671   // rec. vs true track pt correlation matrix\r
1672   //\r
1673   hs = (THnSparse*)fTrackPtCorrelationMatrix->Clone("track_pt_correlation_matrix");\r
1674   aFolderObj->Add(hs);\r
1675 \r
1676   //\r
1677   // trigger efficiency for INEL\r
1678   //\r
1679   h = AlidNdPtHelper::GenerateCorrMatrix(fTriggerEventMatrix->Projection(0),fGenEventMatrix->Projection(0),"zv_trig_INEL_eff_matrix");\r
1680   aFolderObj->Add(h);\r
1681 \r
1682   //\r
1683   // trigger efficiency for NSD\r
1684   //\r
1685   h = AlidNdPtHelper::GenerateCorrMatrix(fTriggerNSDEventMatrix->Projection(0),fGenNSDEventMatrix->Projection(0),"zv_trig_NSD_eff_matrix");\r
1686   aFolderObj->Add(h);\r
1687 \r
1688   //\r
1689   // trigger bias correction (MB to ND)\r
1690   //\r
1691   hs = AlidNdPtHelper::GenerateCorrMatrix(fGenNDEventMatrix,fTriggerEventMatrix,"zv_mult_trig_MBtoND_corr_matrix");\r
1692   aFolderObj->Add(hs);\r
1693 \r
1694   h = AlidNdPtHelper::GenerateCorrMatrix(fGenNDEventMatrix->Projection(0),fTriggerEventMatrix->Projection(0),"zv_trig_MBtoND_corr_matrix");\r
1695   aFolderObj->Add(h);\r
1696 \r
1697   fGenNDEventMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
1698   fTriggerEventMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
1699 \r
1700   h = AlidNdPtHelper::GenerateCorrMatrix(fGenNDEventMatrix->Projection(1),fTriggerEventMatrix->Projection(1),"mult_trig_MBtoND_corr_matrix");\r
1701 \r
1702   aFolderObj->Add(h);\r
1703   fGenNDEventMatrix->GetAxis(0)->SetRange(1,fGenNDEventMatrix->GetAxis(0)->GetNbins());\r
1704   fTriggerEventMatrix->GetAxis(0)->SetRange(1,fTriggerEventMatrix->GetAxis(0)->GetNbins());\r
1705 \r
1706   //\r
1707   // trigger bias correction (MB to NSD)\r
1708   //\r
1709   hs = AlidNdPtHelper::GenerateCorrMatrix(fGenNSDEventMatrix,fTriggerEventMatrix,"zv_mult_trig_MBtoNSD_corr_matrix");\r
1710   aFolderObj->Add(hs);\r
1711 \r
1712   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenNSDEventMatrix->Projection(0,1),fTriggerEventMatrix->Projection(0,1),"zv_mult_trig_MBtoNSD_corr_matrix_2D");\r
1713   aFolderObj->Add(h2D);\r
1714 \r
1715   h = AlidNdPtHelper::GenerateCorrMatrix(fGenNSDEventMatrix->Projection(0),fTriggerEventMatrix->Projection(0),"zv_trig_MBtoNSD_corr_matrix");\r
1716   aFolderObj->Add(h);\r
1717 \r
1718   fGenNSDEventMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
1719   fTriggerEventMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
1720 \r
1721   h = AlidNdPtHelper::GenerateCorrMatrix(fGenNSDEventMatrix->Projection(1),fTriggerEventMatrix->Projection(1),"mult_trig_MBtoNSD_corr_matrix");\r
1722   aFolderObj->Add(h);\r
1723 \r
1724   fGenNSDEventMatrix->GetAxis(0)->SetRange(1,fGenNSDEventMatrix->GetAxis(0)->GetNbins());\r
1725   fTriggerEventMatrix->GetAxis(0)->SetRange(1,fTriggerEventMatrix->GetAxis(0)->GetNbins());\r
1726 \r
1727   //\r
1728   // trigger bias correction (MB to INEL)\r
1729   //\r
1730   hs = AlidNdPtHelper::GenerateCorrMatrix(fGenEventMatrix,fTriggerEventMatrix,"zv_mult_trig_MBtoInel_corr_matrix");\r
1731   aFolderObj->Add(hs);\r
1732 \r
1733   h = AlidNdPtHelper::GenerateCorrMatrix(fGenEventMatrix->Projection(0),fTriggerEventMatrix->Projection(0),"zv_trig_MBtoInel_corr_matrix");\r
1734   aFolderObj->Add(h);\r
1735 \r
1736   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenEventMatrix->Projection(0,1),fTriggerEventMatrix->Projection(0,1),"zv_mult_trig_MBtoInel_corr_matrix_2D");\r
1737   aFolderObj->Add(h2D);\r
1738 \r
1739   fGenEventMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
1740   fTriggerEventMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
1741 \r
1742   h = AlidNdPtHelper::GenerateCorrMatrix(fGenEventMatrix->Projection(1),fTriggerEventMatrix->Projection(1),"mult_trig_MBtoInel_corr_matrix");\r
1743   aFolderObj->Add(h);\r
1744 \r
1745   fGenEventMatrix->GetAxis(0)->SetRange(1,fGenEventMatrix->GetAxis(0)->GetNbins());\r
1746   fTriggerEventMatrix->GetAxis(0)->SetRange(1,fTriggerEventMatrix->GetAxis(0)->GetNbins());\r
1747 \r
1748   //\r
1749   // event vertex reconstruction correction (MB)\r
1750   //\r
1751   hs = AlidNdPtHelper::GenerateCorrMatrix(fTriggerEventMatrix,fRecEventMatrix,"zv_mult_event_corr_matrix");\r
1752   aFolderObj->Add(hs);\r
1753 \r
1754   h2D = AlidNdPtHelper::GenerateCorrMatrix(fTriggerEventMatrix->Projection(0,1),fRecEventMatrix->Projection(0,1),"zv_mult_event_corr_matrix_2D");\r
1755   aFolderObj->Add(h2D);\r
1756 \r
1757   fTriggerEventMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
1758   fRecEventMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
1759 \r
1760   h = AlidNdPtHelper::GenerateCorrMatrix(fTriggerEventMatrix->Projection(1),fRecEventMatrix->Projection(1),"mult_event_corr_matrix");\r
1761   aFolderObj->Add(h);\r
1762 \r
1763   fTriggerEventMatrix->GetAxis(0)->SetRange(1,fTriggerEventMatrix->GetAxis(0)->GetNbins());\r
1764   fRecEventMatrix->GetAxis(0)->SetRange(1,fRecEventMatrix->GetAxis(0)->GetNbins());\r
1765 \r
1766   h = AlidNdPtHelper::GenerateCorrMatrix(fTriggerEventMatrix->Projection(0),fRecEventMatrix->Projection(0),"zv_event_corr_matrix");\r
1767   aFolderObj->Add(h);\r
1768 \r
1769   //\r
1770   // track-event trigger bias correction (MB to ND)\r
1771   //\r
1772 \r
1773   hs = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackNDEventMatrix,fTriggerTrackEventMatrix,"zv_pt_eta_track_trig_MBtoND_corr_matrix");\r
1774   aFolderObj->Add(hs);\r
1775 \r
1776   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackNDEventMatrix->Projection(1,2),fTriggerTrackEventMatrix->Projection(1,2),"eta_pt_track_trig_MBtoND_corr_matrix");\r
1777   aFolderObj->Add(h2D);\r
1778 \r
1779   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackNDEventMatrix->Projection(1,0),fTriggerTrackEventMatrix->Projection(1,0),"pt_zv_track_trig_MBtoND_corr_matrix");\r
1780   aFolderObj->Add(h2D);\r
1781 \r
1782   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackNDEventMatrix->Projection(2,0),fTriggerTrackEventMatrix->Projection(2,0),"zv_eta_track_trig_MBtoND_corr_matrix");\r
1783   aFolderObj->Add(h2D);\r
1784 \r
1785   //\r
1786   // track-event trigger bias correction (MB to NSD)\r
1787   //\r
1788   hs = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackNSDEventMatrix,fTriggerTrackEventMatrix,"zv_pt_eta_track_trig_MBtoNSD_corr_matrix");\r
1789   aFolderObj->Add(hs);\r
1790 \r
1791   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackNSDEventMatrix->Projection(1,2),fTriggerTrackEventMatrix->Projection(1,2),"eta_pt_track_trig_MBtoNSD_corr_matrix");\r
1792   aFolderObj->Add(h2D);\r
1793 \r
1794   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackNSDEventMatrix->Projection(1,0),fTriggerTrackEventMatrix->Projection(1,0),"pt_zv_track_trig_MBtoNSD_corr_matrix");\r
1795   aFolderObj->Add(h2D);\r
1796 \r
1797   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackNSDEventMatrix->Projection(2,0),fTriggerTrackEventMatrix->Projection(2,0),"zv_eta_track_trig_MBtoNSD_corr_matrix");\r
1798   aFolderObj->Add(h2D);\r
1799 \r
1800 \r
1801   //\r
1802   // track-event trigger bias correction (MB to INEL)\r
1803   //\r
1804   hs = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackEventMatrix,fTriggerTrackEventMatrix,"zv_pt_eta_track_trig_MBtoInel_corr_matrix");\r
1805   aFolderObj->Add(hs);\r
1806 \r
1807   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackEventMatrix->Projection(1,2),fTriggerTrackEventMatrix->Projection(1,2),"eta_pt_track_trig_MBtoInel_corr_matrix");\r
1808   aFolderObj->Add(h2D);\r
1809 \r
1810   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackEventMatrix->Projection(1,0),fTriggerTrackEventMatrix->Projection(1,0),"pt_zv_track_trig_MBtoInel_corr_matrix");\r
1811   aFolderObj->Add(h2D);\r
1812 \r
1813   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackEventMatrix->Projection(2,0),fTriggerTrackEventMatrix->Projection(2,0),"zv_eta_track_trig_MBtoInel_corr_matrix");\r
1814   aFolderObj->Add(h2D);\r
1815 \r
1816   // efficiency\r
1817   fTriggerTrackEventMatrix->GetAxis(2)->SetRangeUser(minEta,maxEta);\r
1818   fGenTrackEventMatrix->GetAxis(2)->SetRangeUser(minEta,maxEta);\r
1819   fTriggerTrackEventMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
1820   fGenTrackEventMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
1821 \r
1822   h = AlidNdPtHelper::GenerateCorrMatrix(fTriggerTrackEventMatrix->Projection(1),fGenTrackEventMatrix->Projection(1),"pt_track_trig_MBtoInel_eff_matrix");\r
1823   aFolderObj->Add(h);\r
1824 \r
1825   fTriggerTrackEventMatrix->GetAxis(2)->SetRange(1,fTriggerTrackEventMatrix->GetAxis(2)->GetNbins());\r
1826   fGenTrackEventMatrix->GetAxis(2)->SetRange(1,fGenTrackEventMatrix->GetAxis(2)->GetNbins());\r
1827   fTriggerTrackEventMatrix->GetAxis(0)->SetRange(1,fTriggerTrackEventMatrix->GetAxis(0)->GetNbins());\r
1828   fGenTrackEventMatrix->GetAxis(0)->SetRange(1,fGenTrackEventMatrix->GetAxis(0)->GetNbins());\r
1829 \r
1830 \r
1831   //\r
1832   // track-event vertex reconstruction correction (MB)\r
1833   //\r
1834   hs = AlidNdPtHelper::GenerateCorrMatrix(fTriggerTrackEventMatrix,fRecTrackEventMatrix,"zv_pt_eta_track_event_corr_matrix");\r
1835   aFolderObj->Add(hs);\r
1836 \r
1837   h2D = AlidNdPtHelper::GenerateCorrMatrix(fTriggerTrackEventMatrix->Projection(1,2),fRecTrackEventMatrix->Projection(1,2),"eta_pt_track_event_corr_matrix");\r
1838   aFolderObj->Add(h2D);\r
1839 \r
1840   h2D = AlidNdPtHelper::GenerateCorrMatrix(fTriggerTrackEventMatrix->Projection(1,0),fRecTrackEventMatrix->Projection(1,0),"pt_zv_track_event_corr_matrix");\r
1841   aFolderObj->Add(h2D);\r
1842 \r
1843   h2D = AlidNdPtHelper::GenerateCorrMatrix(fTriggerTrackEventMatrix->Projection(2,0),fRecTrackEventMatrix->Projection(2,0),"zv_eta_track_event_corr_matrix");\r
1844   aFolderObj->Add(h2D);\r
1845   \r
1846   // efficiency\r
1847   fTriggerTrackEventMatrix->GetAxis(2)->SetRangeUser(minEta,maxEta);\r
1848   fRecTrackEventMatrix->GetAxis(2)->SetRangeUser(minEta,maxEta);\r
1849   fTriggerTrackEventMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
1850   fRecTrackEventMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
1851 \r
1852   h = AlidNdPtHelper::GenerateCorrMatrix(fRecTrackEventMatrix->Projection(1),fTriggerTrackEventMatrix->Projection(1),"pt_track_event_eff_matrix");\r
1853   aFolderObj->Add(h);\r
1854 \r
1855   fTriggerTrackEventMatrix->GetAxis(2)->SetRange(1,fTriggerTrackEventMatrix->GetAxis(2)->GetNbins());\r
1856   fRecTrackEventMatrix->GetAxis(2)->SetRange(1,fRecTrackEventMatrix->GetAxis(2)->GetNbins());\r
1857   fTriggerTrackEventMatrix->GetAxis(0)->SetRange(1,fTriggerTrackEventMatrix->GetAxis(0)->GetNbins());\r
1858   fRecTrackEventMatrix->GetAxis(0)->SetRange(1,fRecTrackEventMatrix->GetAxis(0)->GetNbins());\r
1859 \r
1860   //\r
1861   // track rec. efficiency correction\r
1862   //\r
1863   hs = AlidNdPtHelper::GenerateCorrMatrix(fGenPrimTrackMatrix,fRecPrimTrackMatrix,"zv_pt_eta_track_corr_matrix");\r
1864   aFolderObj->Add(hs);\r
1865 \r
1866   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenPrimTrackMatrix->Projection(1,2),fRecPrimTrackMatrix->Projection(1,2),"eta_pt_track_corr_matrix");\r
1867   aFolderObj->Add(h2D);\r
1868 \r
1869   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenPrimTrackMatrix->Projection(1,0),fRecPrimTrackMatrix->Projection(1,0),"pt_zv_track_corr_matrix");\r
1870   aFolderObj->Add(h2D);\r
1871 \r
1872   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenPrimTrackMatrix->Projection(2,0),fRecPrimTrackMatrix->Projection(2,0),"zv_eta_track_corr_matrix");\r
1873   aFolderObj->Add(h2D);\r
1874 \r
1875   fGenPrimTrackMatrix->GetAxis(2)->SetRangeUser(minEta,maxEta);\r
1876   fRecPrimTrackMatrix->GetAxis(2)->SetRangeUser(minEta,maxEta);\r
1877   fGenPrimTrackMatrix->GetAxis(1)->SetRangeUser(minPt,maxPt);\r
1878   fRecPrimTrackMatrix->GetAxis(1)->SetRangeUser(minPt,maxPt);\r
1879   \r
1880   h = AlidNdPtHelper::GenerateCorrMatrix(fGenPrimTrackMatrix->Projection(0),fRecPrimTrackMatrix->Projection(0),"zv_track_corr_matrix");\r
1881   aFolderObj->Add(h);\r
1882 \r
1883   fGenPrimTrackMatrix->GetAxis(1)->SetRange(1,fGenPrimTrackMatrix->GetAxis(1)->GetNbins());\r
1884   fRecPrimTrackMatrix->GetAxis(1)->SetRange(1,fRecPrimTrackMatrix->GetAxis(1)->GetNbins());\r
1885   fGenPrimTrackMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
1886   fRecPrimTrackMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
1887 \r
1888   h = AlidNdPtHelper::GenerateCorrMatrix(fGenPrimTrackMatrix->Projection(1),fRecPrimTrackMatrix->Projection(1),"pt_track_corr_matrix");\r
1889   aFolderObj->Add(h);\r
1890 \r
1891   // efficiency\r
1892   h = AlidNdPtHelper::GenerateCorrMatrix(fRecPrimTrackMatrix->Projection(1), fGenPrimTrackMatrix->Projection(1),"pt_track_eff_matrix");\r
1893   aFolderObj->Add(h);\r
1894 \r
1895   fGenPrimTrackMatrix->GetAxis(1)->SetRangeUser(minPt,maxPt);\r
1896   fRecPrimTrackMatrix->GetAxis(1)->SetRangeUser(minPt,maxPt);\r
1897   fGenPrimTrackMatrix->GetAxis(2)->SetRange(1,fGenPrimTrackMatrix->GetAxis(2)->GetNbins());\r
1898   fRecPrimTrackMatrix->GetAxis(2)->SetRange(1,fRecPrimTrackMatrix->GetAxis(2)->GetNbins());\r
1899 \r
1900   h = AlidNdPtHelper::GenerateCorrMatrix(fGenPrimTrackMatrix->Projection(2),fRecPrimTrackMatrix->Projection(2),"eta_track_corr_matrix");\r
1901   aFolderObj->Add(h);\r
1902 \r
1903   fGenPrimTrackMatrix->GetAxis(1)->SetRange(1,fGenPrimTrackMatrix->GetAxis(1)->GetNbins());\r
1904   fRecPrimTrackMatrix->GetAxis(1)->SetRange(1,fRecPrimTrackMatrix->GetAxis(1)->GetNbins());\r
1905   fGenPrimTrackMatrix->GetAxis(0)->SetRange(1,fGenPrimTrackMatrix->GetAxis(0)->GetNbins());\r
1906   fRecPrimTrackMatrix->GetAxis(0)->SetRange(1,fRecPrimTrackMatrix->GetAxis(0)->GetNbins());\r
1907 \r
1908   //\r
1909   // secondary track contamination correction\r
1910   //\r
1911   //hs = AlidNdPtHelper::GenerateContCorrMatrix(fRecSecTrackMatrix,fRecTrackMatrix,"zv_pt_eta_track_cont_matrix");\r
1912   hs = AlidNdPtHelper::GenerateCorrMatrix(fRecSecTrackMatrix,fRecTrackMatrix,"zv_pt_eta_track_cont_matrix");\r
1913   aFolderObj->Add(hs);\r
1914 \r
1915   h2D = AlidNdPtHelper::GenerateCorrMatrix(fRecSecTrackMatrix->Projection(1,2),fRecTrackMatrix->Projection(1,2),"eta_pt_track_cont_matrix");\r
1916   aFolderObj->Add(h2D);\r
1917 \r
1918   h2D = AlidNdPtHelper::GenerateCorrMatrix(fRecSecTrackMatrix->Projection(1,0),fRecTrackMatrix->Projection(1,0),"pt_zv_track_cont_matrix");\r
1919   aFolderObj->Add(h2D);\r
1920 \r
1921   h2D = AlidNdPtHelper::GenerateCorrMatrix(fRecSecTrackMatrix->Projection(2,0),fRecTrackMatrix->Projection(2,0),"zv_eta_track_cont_matrix");\r
1922   aFolderObj->Add(h2D);\r
1923 \r
1924   fRecSecTrackMatrix->GetAxis(2)->SetRangeUser(minEta,maxEta);\r
1925   fRecTrackMatrix->GetAxis(2)->SetRangeUser(minEta,maxEta);\r
1926   fRecSecTrackMatrix->GetAxis(1)->SetRangeUser(minPt,maxPt);\r
1927   fRecTrackMatrix->GetAxis(1)->SetRangeUser(minPt,maxPt);\r
1928   \r
1929   h = AlidNdPtHelper::GenerateCorrMatrix(fRecSecTrackMatrix->Projection(0),fRecTrackMatrix->Projection(0),"zv_track_cont_matrix");\r
1930   aFolderObj->Add(h);\r
1931 \r
1932   fRecSecTrackMatrix->GetAxis(1)->SetRange(1,fRecSecTrackMatrix->GetAxis(1)->GetNbins());\r
1933   fRecTrackMatrix->GetAxis(1)->SetRange(1,fRecTrackMatrix->GetAxis(1)->GetNbins());\r
1934   fRecSecTrackMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
1935   fRecTrackMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
1936 \r
1937   h = AlidNdPtHelper::GenerateCorrMatrix(fRecSecTrackMatrix->Projection(1),fRecTrackMatrix->Projection(1),"pt_track_cont_matrix");\r
1938   aFolderObj->Add(h);\r
1939 \r
1940   fRecSecTrackMatrix->GetAxis(2)->SetRange(1,fRecSecTrackMatrix->GetAxis(2)->GetNbins());\r
1941   fRecTrackMatrix->GetAxis(2)->SetRange(1,fRecTrackMatrix->GetAxis(2)->GetNbins());\r
1942 \r
1943   fRecSecTrackMatrix->GetAxis(1)->SetRangeUser(minPt,maxPt);\r
1944   fRecTrackMatrix->GetAxis(1)->SetRangeUser(minPt,maxPt);\r
1945 \r
1946   h = AlidNdPtHelper::GenerateCorrMatrix(fRecSecTrackMatrix->Projection(2),fRecTrackMatrix->Projection(2),"eta_track_cont_matrix");\r
1947   aFolderObj->Add(h);\r
1948 \r
1949   fRecSecTrackMatrix->GetAxis(0)->SetRange(1,fRecSecTrackMatrix->GetAxis(0)->GetNbins());\r
1950   fRecTrackMatrix->GetAxis(0)->SetRange(1,fRecTrackMatrix->GetAxis(0)->GetNbins());\r
1951   fRecSecTrackMatrix->GetAxis(1)->SetRange(1,fRecSecTrackMatrix->GetAxis(1)->GetNbins());\r
1952   fRecTrackMatrix->GetAxis(1)->SetRange(1,fRecTrackMatrix->GetAxis(1)->GetNbins());\r
1953 \r
1954   //\r
1955   // multiple track reconstruction correction\r
1956   //\r
1957   //hs = AlidNdPtHelper::GenerateContCorrMatrix(fRecMultTrackMatrix,fRecTrackMatrix,"zv_pt_eta_mult_track_cont_matrix");\r
1958   hs = AlidNdPtHelper::GenerateCorrMatrix(fRecMultTrackMatrix,fRecTrackMatrix,"zv_pt_eta_mult_track_cont_matrix");\r
1959   aFolderObj->Add(hs);\r
1960 \r
1961   h2D = AlidNdPtHelper::GenerateCorrMatrix(fRecMultTrackMatrix->Projection(1,2),fRecTrackMatrix->Projection(1,2),"eta_pt_mult_track_cont_matrix");\r
1962   aFolderObj->Add(h2D);\r
1963 \r
1964   h2D = AlidNdPtHelper::GenerateCorrMatrix(fRecMultTrackMatrix->Projection(1,0),fRecTrackMatrix->Projection(1,0),"pt_zv_mult_track_cont_matrix");\r
1965   aFolderObj->Add(h2D);\r
1966 \r
1967   h2D = AlidNdPtHelper::GenerateCorrMatrix(fRecMultTrackMatrix->Projection(2,0),fRecTrackMatrix->Projection(2,0),"zv_eta_mult_track_cont_matrix");\r
1968   aFolderObj->Add(h2D);\r
1969 \r
1970   fRecMultTrackMatrix->GetAxis(2)->SetRangeUser(minEta,maxEta);\r
1971   fRecTrackMatrix->GetAxis(2)->SetRangeUser(minEta,maxEta);\r
1972   fRecMultTrackMatrix->GetAxis(1)->SetRangeUser(minPt,maxPt);\r
1973   fRecTrackMatrix->GetAxis(1)->SetRangeUser(minPt,maxPt);\r
1974   \r
1975   h = AlidNdPtHelper::GenerateCorrMatrix(fRecMultTrackMatrix->Projection(0),fRecTrackMatrix->Projection(0),"zv_mult_track_cont_matrix");\r
1976   aFolderObj->Add(h);\r
1977 \r
1978   fRecMultTrackMatrix->GetAxis(1)->SetRangeUser(0.,maxPt);\r
1979   fRecTrackMatrix->GetAxis(1)->SetRangeUser(0.,maxPt);\r
1980   fRecMultTrackMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
1981   fRecTrackMatrix->GetAxis(0)->SetRangeUser(minZv,maxZv);\r
1982 \r
1983   h = AlidNdPtHelper::GenerateCorrMatrix(fRecMultTrackMatrix->Projection(1),fRecTrackMatrix->Projection(1),"pt_mult_track_cont_matrix");\r
1984   aFolderObj->Add(h);\r
1985 \r
1986   fRecMultTrackMatrix->GetAxis(1)->SetRangeUser(minPt,maxPt);\r
1987   fRecTrackMatrix->GetAxis(1)->SetRangeUser(minPt,maxPt);\r
1988 \r
1989   fRecMultTrackMatrix->GetAxis(2)->SetRange(1,fRecMultTrackMatrix->GetAxis(2)->GetNbins());\r
1990   fRecTrackMatrix->GetAxis(2)->SetRange(1,fRecTrackMatrix->GetAxis(2)->GetNbins());\r
1991 \r
1992   h = AlidNdPtHelper::GenerateCorrMatrix(fRecMultTrackMatrix->Projection(2),fRecTrackMatrix->Projection(2),"eta_mult_track_cont_matrix");\r
1993   aFolderObj->Add(h);\r
1994 \r
1995   fRecMultTrackMatrix->GetAxis(1)->SetRangeUser(0.,maxPt);\r
1996   fRecTrackMatrix->GetAxis(1)->SetRangeUser(0.,maxPt);\r
1997 \r
1998   fRecMultTrackMatrix->GetAxis(0)->SetRange(1,fRecMultTrackMatrix->GetAxis(0)->GetNbins());\r
1999   fRecTrackMatrix->GetAxis(0)->SetRange(1,fRecTrackMatrix->GetAxis(0)->GetNbins());\r
2000 \r
2001   //\r
2002   // Control histograms\r
2003   //\r
2004   \r
2005   if(fHistogramsOn) {\r
2006 \r
2007   // Efficiency electrons, muons, pions, kaons, protons, all\r
2008   fMCPrimTrackHist1[1]->GetAxis(1)->SetRangeUser(minEta,maxEta); \r
2009   fMCPrimTrackHist1[2]->GetAxis(1)->SetRangeUser(minEta,maxEta);\r
2010 \r
2011   fMCPrimTrackHist1[1]->GetAxis(2)->SetRange(1,1); \r
2012   fMCPrimTrackHist1[2]->GetAxis(2)->SetRange(1,1); \r
2013   h1 = fMCPrimTrackHist1[1]->Projection(0);\r
2014   h2 = fMCPrimTrackHist1[2]->Projection(0);\r
2015   h2c = (TH1D *)h2->Clone();\r
2016   h2c->Divide(h1);\r
2017   h2c->SetName("eff_pt_electrons");\r
2018   aFolderObj->Add(h2c);\r
2019 \r
2020   fMCPrimTrackHist1[1]->GetAxis(2)->SetRange(2,2); \r
2021   fMCPrimTrackHist1[2]->GetAxis(2)->SetRange(2,2); \r
2022   h1 = fMCPrimTrackHist1[1]->Projection(0);\r
2023   h2 = fMCPrimTrackHist1[2]->Projection(0);\r
2024   h2c = (TH1D *)h2->Clone();\r
2025   h2c->Divide(h1);\r
2026   h2c->SetName("eff_pt_muons");\r
2027   aFolderObj->Add(h2c);\r
2028 \r
2029   fMCPrimTrackHist1[1]->GetAxis(2)->SetRange(3,3); \r
2030   fMCPrimTrackHist1[2]->GetAxis(2)->SetRange(3,3); \r
2031   h1 = fMCPrimTrackHist1[1]->Projection(0);\r
2032   h2 = fMCPrimTrackHist1[2]->Projection(0);\r
2033   h2c = (TH1D *)h2->Clone();\r
2034   h2c->Divide(h1);\r
2035   h2c->SetName("eff_pt_pions");\r
2036   aFolderObj->Add(h2c);\r
2037 \r
2038   fMCPrimTrackHist1[1]->GetAxis(2)->SetRange(4,4); \r
2039   fMCPrimTrackHist1[2]->GetAxis(2)->SetRange(4,4); \r
2040   h1 = fMCPrimTrackHist1[1]->Projection(0);\r
2041   h2 = fMCPrimTrackHist1[2]->Projection(0);\r
2042   h2c = (TH1D *)h2->Clone();\r
2043   h2c->Divide(h1);\r
2044   h2c->SetName("eff_pt_kaons");\r
2045   aFolderObj->Add(h2c);\r
2046 \r
2047   fMCPrimTrackHist1[1]->GetAxis(2)->SetRange(5,5); \r
2048   fMCPrimTrackHist1[2]->GetAxis(2)->SetRange(5,5); \r
2049   h1 = fMCPrimTrackHist1[1]->Projection(0);\r
2050   h2 = fMCPrimTrackHist1[2]->Projection(0);\r
2051   h2c = (TH1D *)h2->Clone();\r
2052   h2c->Divide(h1);\r
2053   h2c->SetName("eff_pt_protons");\r
2054   aFolderObj->Add(h2c);\r
2055 \r
2056   fMCPrimTrackHist1[1]->GetAxis(2)->SetRange(1,6); \r
2057   fMCPrimTrackHist1[2]->GetAxis(2)->SetRange(1,6); \r
2058   h1 = fMCPrimTrackHist1[1]->Projection(0);\r
2059   h2 = fMCPrimTrackHist1[2]->Projection(0);\r
2060   h2c = (TH1D *)h2->Clone();\r
2061   h2c->Divide(h1);\r
2062   h2c->SetName("eff_pt_all");\r
2063   aFolderObj->Add(h2c);\r
2064 \r
2065   fMCPrimTrackHist1[1]->GetAxis(1)->SetRange(1,fMCPrimTrackHist1[1]->GetAxis(1)->GetNbins()); \r
2066   fMCPrimTrackHist1[2]->GetAxis(1)->SetRange(1,fMCPrimTrackHist1[2]->GetAxis(1)->GetNbins());\r
2067 \r
2068   //  pt spetra\r
2069   // - rec, primaries, secondaries\r
2070   // - primaries (pid) \r
2071   // - secondaries (pid)\r
2072   // - secondaries (mech)\r
2073   // - secondaries (mother)\r
2074   //\r
2075 \r
2076   TH1D *mc_pt_acc_all = fMCTrackHist1[1]->Projection(0);\r
2077   mc_pt_acc_all->SetName("mc_pt_acc_all");\r
2078   aFolderObj->Add(mc_pt_acc_all);\r
2079 \r
2080   TH1D *mc_pt_acc_prim = fMCPrimTrackHist1[1]->Projection(0);\r
2081   mc_pt_acc_prim->SetName("mc_pt_acc_prim");\r
2082   aFolderObj->Add(mc_pt_acc_prim);\r
2083 \r
2084   TH1D *mc_pt_rec_all = fMCTrackHist1[2]->Projection(0);\r
2085   mc_pt_rec_all->SetName("mc_pt_rec_all");\r
2086   aFolderObj->Add(mc_pt_rec_all);\r
2087 \r
2088   TH1D *mc_pt_rec_prim = fMCPrimTrackHist1[2]->Projection(0);\r
2089   mc_pt_rec_prim->SetName("mc_pt_rec_prim");\r
2090   aFolderObj->Add(mc_pt_rec_prim);\r
2091 \r
2092   TH1D *mc_pt_rec_sec = fMCSecTrackHist1[2]->Projection(0);\r
2093   mc_pt_rec_sec->SetName("mc_pt_rec_sec");\r
2094   aFolderObj->Add(mc_pt_rec_sec);\r
2095 \r
2096   for(Int_t i = 0; i<6; i++) \r
2097   { \r
2098     sprintf(name,"mc_pt_rec_prim_pid_%d",i); \r
2099     fMCPrimTrackHist1[2]->GetAxis(2)->SetRange(i+1,i+1);\r
2100     h = fMCPrimTrackHist1[2]->Projection(0);\r
2101     h->SetName(name);\r
2102     aFolderObj->Add(h);\r
2103 \r
2104     sprintf(name,"mc_pt_rec_sec_pid_%d",i); \r
2105     fMCSecTrackHist1[2]->GetAxis(2)->SetRange(i+1,i+1);\r
2106     h = fMCSecTrackHist1[2]->Projection(0);\r
2107     h->SetName(name);\r
2108     aFolderObj->Add(h);\r
2109 \r
2110     // production mechanisms for given pid\r
2111     fMCSecTrackHist1[2]->GetAxis(2)->SetRange(i+1,i+1);\r
2112 \r
2113     for(Int_t j=0; j<20; j++) {\r
2114       if(j == 4) {\r
2115         // decay\r
2116         \r
2117         sprintf(name,"mc_pt_rec_sec_pid_%d_decay",i); \r
2118         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2119         h = fMCSecTrackHist1[2]->Projection(0);\r
2120         h->SetName(name);\r
2121         aFolderObj->Add(h);\r
2122 \r
2123         sprintf(name,"mc_eta_rec_sec_pid_%d_decay",i); \r
2124         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2125         h = fMCSecTrackHist1[2]->Projection(1);\r
2126         h->SetName(name);\r
2127         aFolderObj->Add(h);\r
2128 \r
2129         sprintf(name,"mc_mother_rec_sec_pid_%d_decay",i); \r
2130         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2131         h = fMCSecTrackHist1[2]->Projection(4);\r
2132         h->SetName(name);\r
2133         aFolderObj->Add(h);\r
2134 \r
2135       } else if (j == 5) {\r
2136        // conversion\r
2137 \r
2138         sprintf(name,"mc_pt_rec_sec_pid_%d_conv",i); \r
2139         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2140         h = fMCSecTrackHist1[2]->Projection(0);\r
2141         h->SetName(name);\r
2142         aFolderObj->Add(h);\r
2143 \r
2144         sprintf(name,"mc_eta_rec_sec_pid_%d_conv",i); \r
2145         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2146         h = fMCSecTrackHist1[2]->Projection(1);\r
2147         h->SetName(name);\r
2148         aFolderObj->Add(h);\r
2149 \r
2150         sprintf(name,"mc_mother_rec_sec_pid_%d_conv",i); \r
2151         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2152         h = fMCSecTrackHist1[2]->Projection(4);\r
2153         h->SetName(name);\r
2154         aFolderObj->Add(h);\r
2155 \r
2156      } else if (j == 13) {\r
2157        // mat\r
2158        \r
2159         sprintf(name,"mc_pt_rec_sec_pid_%d_mat",i); \r
2160         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2161         h = fMCSecTrackHist1[2]->Projection(0);\r
2162         h->SetName(name);\r
2163         aFolderObj->Add(h);\r
2164 \r
2165         sprintf(name,"mc_eta_rec_sec_pid_%d_mat",i); \r
2166         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2167         h = fMCSecTrackHist1[2]->Projection(1);\r
2168         h->SetName(name);\r
2169         aFolderObj->Add(h);\r
2170 \r
2171         sprintf(name,"mc_eta_mother_rec_sec_pid_%d_mat",i); \r
2172         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2173         h = fMCSecTrackHist1[2]->Projection(4,1);\r
2174         h->SetName(name);\r
2175         aFolderObj->Add(h);\r
2176 \r
2177         sprintf(name,"mc_mother_rec_sec_pid_%d_mat",i); \r
2178         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2179         h = fMCSecTrackHist1[2]->Projection(4);\r
2180         h->SetName(name);\r
2181         aFolderObj->Add(h);\r
2182 \r
2183         sprintf(name,"mc_pt_mother_rec_sec_pid_%d_mat",i); \r
2184         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2185         h = fMCSecTrackHist1[2]->Projection(4,0);\r
2186         h->SetName(name);\r
2187         aFolderObj->Add(h);\r
2188 \r
2189      } else {\r
2190        continue;\r
2191      }\r
2192    }\r
2193 \r
2194   }\r
2195   } // end fHistogramOn\r
2196 \r
2197   //\r
2198   //  resolution histograms\r
2199   //  only for reconstructed tracks\r
2200   //\r
2201 \r
2202   TH2F *h2F=0;\r
2203   TCanvas * c = new TCanvas("resol","resol");\r
2204   c->cd();\r
2205 \r
2206   //\r
2207   fRecMCTrackHist1->GetAxis(1)->SetRangeUser(-0.9,0.89); \r
2208 \r
2209   h2F = (TH2F*)fRecMCTrackHist1->Projection(2,0);\r
2210   h = AlidNdPtHelper::MakeResol(h2F,1,0,kTRUE,10);\r
2211   h->SetXTitle("p_{tmc} (GeV/c)");\r
2212   h->SetYTitle("(p_{t}-p_{tmc})/p_{tmc} resolution");\r
2213   h->Draw();\r
2214   h->SetName("pt_resolution_vs_mcpt");\r
2215   aFolderObj->Add(h);\r
2216 \r
2217   h2F = (TH2F*)fRecMCTrackHist1->Projection(2,0);\r
2218   h = AlidNdPtHelper::MakeResol(h2F,1,1,kTRUE,10);\r
2219   h->SetXTitle("p_{tmc} (GeV/c)");\r
2220   h->SetYTitle("(p_{t}-p_{tmc})/p_{tmc} mean");\r
2221   h->Draw();\r
2222   h->SetName("dpt_mean_vs_mcpt");\r
2223   aFolderObj->Add(h);\r
2224 \r
2225   //\r
2226   h2F = (TH2F*)fRecMCTrackHist1->Projection(3,0);\r
2227   h = AlidNdPtHelper::MakeResol(h2F,1,0,kTRUE,10);\r
2228   h->SetXTitle("p_{tmc} (GeV/c)");\r
2229   h->SetYTitle("(#eta-#eta_{mc}) resolution");\r
2230   h->Draw();\r
2231   h->SetName("eta_resolution_vs_mcpt");\r
2232   aFolderObj->Add(h);\r
2233 \r
2234   h2F = (TH2F*)fRecMCTrackHist1->Projection(3,0);\r
2235   h = AlidNdPtHelper::MakeResol(h2F,1,1,kTRUE,10);\r
2236   h->SetXTitle("p_{tmc} (GeV/c)");\r
2237   h->SetYTitle("(#eta-mc#eta) mean");\r
2238   h->Draw();\r
2239   h->SetName("deta_mean_vs_mcpt");\r
2240   aFolderObj->Add(h);\r
2241   \r
2242   // \r
2243   fRecMCTrackHist1->GetAxis(1)->SetRange(1,fRecMCTrackHist1->GetAxis(1)->GetNbins()); \r
2244   fRecMCTrackHist1->GetAxis(0)->SetRangeUser(minPt,maxPt); \r
2245 \r
2246   h2F = (TH2F*)fRecMCTrackHist1->Projection(2,1);\r
2247   h = AlidNdPtHelper::MakeResol(h2F,1,0,kTRUE,10);\r
2248   h->SetXTitle("#eta_{mc}");\r
2249   h->SetYTitle("(p_{t}-p_{tmc})/p_{tmc} resolution");\r
2250   h->Draw();\r
2251   h->SetName("pt_resolution_vs_mceta");\r
2252   aFolderObj->Add(h);\r
2253 \r
2254   h2F = (TH2F*)fRecMCTrackHist1->Projection(2,1);\r
2255   h = AlidNdPtHelper::MakeResol(h2F,1,1,kTRUE,10);\r
2256   h->SetXTitle("#eta_{mc}");\r
2257   h->SetYTitle("(p_{t}-p_{tmc})/p_{tmc} mean");\r
2258   h->Draw();\r
2259   h->SetName("dpt_mean_vs_mceta");\r
2260   aFolderObj->Add(h);\r
2261 \r
2262   //\r
2263   h2F = (TH2F*)fRecMCTrackHist1->Projection(3,1);\r
2264   h = AlidNdPtHelper::MakeResol(h2F,1,0,kTRUE,10);\r
2265   h->SetXTitle("#eta_{mc}");\r
2266   h->SetYTitle("(#eta-#eta_{mc}) resolution");\r
2267   h->Draw();\r
2268   h->SetName("eta_resolution_vs_mceta");\r
2269   aFolderObj->Add(h);\r
2270 \r
2271   h2F = (TH2F*)fRecMCTrackHist1->Projection(3,1);\r
2272   h = AlidNdPtHelper::MakeResol(h2F,1,1,kTRUE,10);\r
2273   h->SetXTitle("#eta_{mc}");\r
2274   h->SetYTitle("(#eta-mc#eta) mean");\r
2275   h->Draw();\r
2276   h->SetName("deta_mean_vs_mceta");\r
2277   aFolderObj->Add(h);\r
2278 \r
2279   fRecMCTrackHist1->GetAxis(0)->SetRange(1,fRecMCTrackHist1->GetAxis(0)->GetNbins()); \r
2280 \r
2281   } // end use MC info\r
2282 \r
2283   // export objects to analysis folder\r
2284   fAnalysisFolder = ExportToFolder(aFolderObj);\r
2285 \r
2286   // delete only TObjArray\r
2287   if(aFolderObj) delete aFolderObj;\r
2288 }\r
2289 \r
2290 //_____________________________________________________________________________\r
2291 TFolder* AlidNdPtAnalysis::ExportToFolder(TObjArray * array) \r
2292 {\r
2293   // recreate folder avery time and export objects to new one\r
2294   //\r
2295   AlidNdPtAnalysis * comp=this;\r
2296   TFolder *folder = comp->GetAnalysisFolder();\r
2297 \r
2298   TString name, title;\r
2299   TFolder *newFolder = 0;\r
2300   Int_t i = 0;\r
2301   Int_t size = array->GetSize();\r
2302 \r
2303   if(folder) { \r
2304      // get name and title from old folder\r
2305      name = folder->GetName();  \r
2306      title = folder->GetTitle();  \r
2307 \r
2308          // delete old one\r
2309      delete folder;\r
2310 \r
2311          // create new one\r
2312      newFolder = CreateFolder(name.Data(),title.Data());\r
2313      newFolder->SetOwner();\r
2314 \r
2315          // add objects to folder\r
2316      while(i < size) {\r
2317            newFolder->Add(array->At(i));\r
2318            i++;\r
2319          }\r
2320   }\r
2321 \r
2322 return newFolder;\r
2323 }\r
2324 \r
2325 //_____________________________________________________________________________\r
2326 TFolder* AlidNdPtAnalysis::CreateFolder(TString name,TString title) { \r
2327 // create folder for analysed histograms\r
2328 //\r
2329 TFolder *folder = 0;\r
2330   folder = new TFolder(name.Data(),title.Data());\r
2331 \r
2332   return folder;\r
2333 }\r