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