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