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