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