comment slow function
[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      // terribly slow\r
1394      // FillHistograms(allChargedTracks,labelsAll,multAll,labelsAcc,multAcc,labelsRec,multRec);\r
1395 \r
1396      Double_t vRecEventHist1[3] = {vtxESD->GetXv(),vtxESD->GetYv(),vtxESD->GetZv()};\r
1397      fRecEventHist1->Fill(vRecEventHist1);\r
1398 \r
1399      Double_t vRecEventHist2[3] = {vtxESD->GetZv(),multMBTracks,multRec};\r
1400      fRecEventHist2->Fill(vRecEventHist2);\r
1401 \r
1402      // \r
1403      Double_t vRecEventHist[2] = {vtxESD->GetZv(),multMBTracks};\r
1404      fRecEventHist->Fill(vRecEventHist);\r
1405    } \r
1406 \r
1407    if(IsUseMCInfo())  \r
1408    {\r
1409      if(!mcEvent) return; \r
1410 \r
1411      if(evtCuts->IsEventSelectedRequired()) \r
1412      { \r
1413        // select events with at least \r
1414        // one MC primary track in acceptance\r
1415        // pT>0.5 GeV/c, |eta|<0.8 for the Cross Section studies\r
1416 \r
1417        Bool_t isMCEventSelected = AlidNdPtHelper::SelectMCEvent(mcEvent);\r
1418        //printf("isMCEventSelected %d \n", isMCEventSelected);\r
1419        if(!isMCEventSelected) return;  \r
1420      }\r
1421 \r
1422      Double_t vMultTrueEventMatrix[3] = { multRec, multMCTrueTracks, multMBTracks};\r
1423      if(isEventOK && isEventTriggered) {   \r
1424        if(TMath::Abs(vtxMC[2]) < 10.0) // both Rec. and corresponding MC events must be accepted\r
1425          fEventMultCorrelationMatrix->Fill(vMultTrueEventMatrix);\r
1426      }\r
1427 \r
1428      // \r
1429      // event level corrections (zv,N_MB)\r
1430      //\r
1431 \r
1432      // all inelastic\r
1433      Double_t vEventMatrix[2] = {vtxMC[2],multMBTracks};\r
1434      fGenEventMatrix->Fill(vEventMatrix); \r
1435      if(isEventTriggered) fTriggerEventMatrix->Fill(vEventMatrix);\r
1436      if(isEventOK && isEventTriggered) fRecEventMatrix->Fill(vEventMatrix);\r
1437 \r
1438      // single diffractive\r
1439      if(evtType == AliPWG0Helper::kSD) {\r
1440        fGenSDEventMatrix->Fill(vEventMatrix); \r
1441        if(isEventTriggered) fTriggerSDEventMatrix->Fill(vEventMatrix);\r
1442        if(isEventOK && isEventTriggered) fRecSDEventMatrix->Fill(vEventMatrix);\r
1443      }\r
1444 \r
1445      // double diffractive\r
1446      if(evtType == AliPWG0Helper::kDD) {\r
1447        fGenDDEventMatrix->Fill(vEventMatrix); \r
1448        if(isEventTriggered) fTriggerDDEventMatrix->Fill(vEventMatrix);\r
1449        if(isEventOK && isEventTriggered)  fRecDDEventMatrix->Fill(vEventMatrix);\r
1450      }\r
1451 \r
1452      // non diffractive\r
1453      if(evtType == AliPWG0Helper::kND) {\r
1454        fGenNDEventMatrix->Fill(vEventMatrix); \r
1455        if(isEventTriggered) fTriggerNDEventMatrix->Fill(vEventMatrix);\r
1456        if(isEventOK && isEventTriggered) fRecNDEventMatrix->Fill(vEventMatrix);\r
1457      }\r
1458 \r
1459      // non single diffractive\r
1460      if(evtType != AliPWG0Helper::kSD) {\r
1461        fGenNSDEventMatrix->Fill(vEventMatrix); \r
1462        if(isEventTriggered) fTriggerNSDEventMatrix->Fill(vEventMatrix);\r
1463        if(isEventOK && isEventTriggered) fRecNSDEventMatrix->Fill(vEventMatrix);\r
1464      }\r
1465 \r
1466      //\r
1467      // track-event level corrections (zv,pt,eta)\r
1468      //\r
1469      for (Int_t iMc = 0; iMc < stack->GetNtrack(); ++iMc) \r
1470      {\r
1471        TParticle* particle = stack->Particle(iMc);\r
1472        if (!particle)\r
1473        continue;\r
1474 \r
1475        // only charged particles\r
1476        if(!particle->GetPDG()) continue;\r
1477        Double_t charge = particle->GetPDG()->Charge()/3.;\r
1478        if ( TMath::Abs(charge) < 0.001 )\r
1479         continue;\r
1480 \r
1481        // only postive charged \r
1482        if(GetParticleMode() == AlidNdPtHelper::kPlus && charge < 0.) \r
1483         continue;\r
1484        \r
1485        // only negative charged \r
1486        if(GetParticleMode() == AlidNdPtHelper::kMinus && charge > 0.) \r
1487        continue;\r
1488       \r
1489        // physical primary\r
1490        Bool_t prim = stack->IsPhysicalPrimary(iMc);\r
1491        if(!prim) continue;\r
1492 \r
1493        // checked accepted\r
1494        if(accCuts->AcceptTrack(particle)) \r
1495        {\r
1496          Double_t vTrackEventMatrix[3] = {vtxMC[2], particle->Pt(), particle->Eta()}; \r
1497          fGenTrackEventMatrix->Fill(vTrackEventMatrix);\r
1498 \r
1499          if(evtType == AliPWG0Helper::kSD) {\r
1500            fGenTrackSDEventMatrix->Fill(vTrackEventMatrix);\r
1501          }\r
1502          if(evtType == AliPWG0Helper::kDD) {\r
1503            fGenTrackDDEventMatrix->Fill(vTrackEventMatrix);\r
1504          }\r
1505          if(evtType == AliPWG0Helper::kND) {\r
1506            fGenTrackNDEventMatrix->Fill(vTrackEventMatrix);\r
1507          }\r
1508          if(evtType != AliPWG0Helper::kSD) {\r
1509            fGenTrackNSDEventMatrix->Fill(vTrackEventMatrix);\r
1510          }\r
1511 \r
1512          //\r
1513          if(!isEventTriggered) continue;  \r
1514 \r
1515          fTriggerTrackEventMatrix->Fill(vTrackEventMatrix);\r
1516          if(evtType == AliPWG0Helper::kSD) {\r
1517            fTriggerTrackSDEventMatrix->Fill(vTrackEventMatrix);\r
1518          }\r
1519          if(evtType == AliPWG0Helper::kDD) {\r
1520            fTriggerTrackDDEventMatrix->Fill(vTrackEventMatrix);\r
1521          }\r
1522          if(evtType == AliPWG0Helper::kND) {\r
1523            fTriggerTrackNDEventMatrix->Fill(vTrackEventMatrix);\r
1524          }\r
1525          if(evtType != AliPWG0Helper::kSD) {\r
1526            fTriggerTrackNSDEventMatrix->Fill(vTrackEventMatrix);\r
1527          }\r
1528 \r
1529          //\r
1530          if(!isEventOK) continue;  \r
1531 \r
1532          fRecTrackEventMatrix->Fill(vTrackEventMatrix);\r
1533          if(evtType == AliPWG0Helper::kSD) {\r
1534            fRecTrackSDEventMatrix->Fill(vTrackEventMatrix);\r
1535          }\r
1536          if(evtType == AliPWG0Helper::kDD) {\r
1537            fRecTrackDDEventMatrix->Fill(vTrackEventMatrix);\r
1538          }\r
1539          if(evtType == AliPWG0Helper::kND) {\r
1540            fRecTrackNDEventMatrix->Fill(vTrackEventMatrix);\r
1541          }\r
1542          if(evtType != AliPWG0Helper::kSD) {\r
1543            fRecTrackNSDEventMatrix->Fill(vTrackEventMatrix);\r
1544          }\r
1545        }\r
1546      }\r
1547 \r
1548      // \r
1549      // track-level corrections (zv,pt,eta)\r
1550      //\r
1551      if(isEventOK && isEventTriggered)\r
1552      {\r
1553 \r
1554        // fill MC and rec event control histograms\r
1555        if(fHistogramsOn) {\r
1556          Double_t vRecMCEventHist1[3] = {vtxESD->GetXv()-vtxMC[0],vtxESD->GetYv()-vtxMC[1],vtxESD->GetZv()-vtxMC[2]};\r
1557          fRecMCEventHist1->Fill(vRecMCEventHist1);\r
1558 \r
1559          Double_t vRecMCEventHist2[3] = {vtxESD->GetXv()-vtxMC[0],vtxESD->GetZv()-vtxMC[2],multMBTracks};\r
1560          fRecMCEventHist2->Fill(vRecMCEventHist2);\r
1561 \r
1562          Double_t vRecMCEventHist3[2] = {multRec,evtType};\r
1563          fRecMCEventHist3->Fill(vRecMCEventHist3);\r
1564        }\r
1565 \r
1566        //\r
1567        // MC histograms for track efficiency studies\r
1568        //\r
1569        Int_t countRecCandle = 0;\r
1570        for (Int_t iMc = 0; iMc < stack->GetNtrack(); ++iMc) \r
1571        {\r
1572          TParticle* particle = stack->Particle(iMc);\r
1573          if (!particle)\r
1574          continue;\r
1575 \r
1576          Double_t vTrackMatrix[3] = {vtxMC[2],particle->Pt(),particle->Eta()}; \r
1577 \r
1578          // all genertated primaries including neutral\r
1579          //if( iMc < stack->GetNprimary() ) {\r
1580          //fGenTrackMatrix->Fill(vTrackMatrix);\r
1581          //}\r
1582 \r
1583          // only charged particles\r
1584          if(!particle->GetPDG()) continue;\r
1585          Double_t charge = particle->GetPDG()->Charge()/3.;\r
1586          if (TMath::Abs(charge) < 0.001)\r
1587          continue;\r
1588 \r
1589          // only postive charged \r
1590          if(GetParticleMode() == AlidNdPtHelper::kPlus && charge < 0.) \r
1591          continue;\r
1592        \r
1593          // only negative charged \r
1594          if(GetParticleMode() == AlidNdPtHelper::kMinus && charge > 0.) \r
1595          continue;\r
1596       \r
1597          // physical primary\r
1598          Bool_t prim = stack->IsPhysicalPrimary(iMc);\r
1599 \r
1600          // check accepted\r
1601          if(accCuts->AcceptTrack(particle)) \r
1602          {\r
1603 \r
1604            if( AlidNdPtHelper::IsPrimaryParticle(stack, iMc, GetParticleMode()) ) \r
1605              fGenPrimTrackMatrix->Fill(vTrackMatrix);\r
1606 \r
1607            // fill control histograms\r
1608            if(fHistogramsOn) \r
1609              FillHistograms(stack,iMc,AlidNdPtHelper::kAccTracks); \r
1610 \r
1611            // check multiple found tracks\r
1612            Int_t multCount = 0;\r
1613            for(Int_t iRec=0; iRec<multRec; ++iRec)\r
1614            {\r
1615              if(iMc == labelsRec[iRec]) \r
1616              {\r
1617                multCount++;\r
1618                if(multCount>1)\r
1619                {  \r
1620                  fRecMultTrackMatrix->Fill(vTrackMatrix);\r
1621 \r
1622                  // fill control histogram\r
1623                  if(fHistogramsOn) {\r
1624                    Int_t pid = AlidNdPtHelper::ConvertPdgToPid(particle);\r
1625                    Double_t vMCMultRecTrackHist1[3] = {particle->Pt(), particle->Eta(), pid};\r
1626                    fMCMultRecTrackHist1->Fill(vMCMultRecTrackHist1);\r
1627                  }\r
1628                }\r
1629              }\r
1630            }\r
1631 \r
1632            // check reconstructed\r
1633            for(Int_t iRec=0; iRec<multRec; ++iRec)\r
1634            {\r
1635              if(iMc == labelsRec[iRec]) \r
1636              {\r
1637                fRecTrackMatrix->Fill(vTrackMatrix);\r
1638                  \r
1639                if( AlidNdPtHelper::IsPrimaryParticle(stack, iMc, GetParticleMode()) ) {\r
1640                  fRecPrimTrackMatrix->Fill(vTrackMatrix);\r
1641                  //AliESDtrack *track = esdEvent->GetTrack(iRec);\r
1642                  //if(track && track->GetKinkIndex(0) < 0) \r
1643                  //  printf("prim kink \n");\r
1644                  countRecCandle++;\r
1645                }\r
1646 \r
1647                if(!prim) fRecSecTrackMatrix->Fill(vTrackMatrix);\r
1648 \r
1649                // fill control histograms\r
1650                if(fHistogramsOn) \r
1651                  FillHistograms(stack,iMc,AlidNdPtHelper::kRecTracks); \r
1652               \r
1653                break;\r
1654              }\r
1655            }\r
1656          }\r
1657        }\r
1658 \r
1659        if(countRecCandle>0) fRecCandleEventMatrix->Fill(vEventMatrix);\r
1660      }\r
1661 \r
1662 \r
1663    } // end bUseMC\r
1664 \r
1665   if(allChargedTracks) delete allChargedTracks; allChargedTracks = 0;\r
1666   if(labelsAll) delete [] labelsAll; labelsAll = 0;\r
1667   if(labelsAcc) delete [] labelsAcc; labelsAcc = 0;\r
1668   if(labelsRec) delete [] labelsRec; labelsRec = 0;\r
1669 \r
1670   if(!evtCuts->IsRecVertexRequired() && vtxESD != NULL) delete vtxESD;\r
1671   //if(trigAna) delete trigAna;\r
1672 \r
1673 }\r
1674 \r
1675 //_____________________________________________________________________________\r
1676 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
1677  // multiplicity  histograms\r
1678  \r
1679   if(!allChargedTracks) return;\r
1680   if(!labelsAll) return;\r
1681   if(!labelsAcc) return;\r
1682   if(!labelsRec) return;\r
1683 \r
1684   Int_t entries = allChargedTracks->GetEntries();\r
1685   for(Int_t i=0; i<entries; ++i)\r
1686   {\r
1687      AliESDtrack *track = (AliESDtrack*)allChargedTracks->At(i);\r
1688      if(!track) continue;\r
1689      if(track->Charge() == 0) continue;\r
1690 \r
1691      Int_t label = TMath::Abs(track->GetLabel());\r
1692      for(Int_t iAll=0; iAll<multAll; ++iAll) {\r
1693        if(label == labelsAll[iAll]) {\r
1694          Double_t v1[2] = {track->Pt(), multAll}; \r
1695          fRecTrackMultHist1[AlidNdPtHelper::kAllTracks]->Fill(v1);\r
1696        }\r
1697      }\r
1698      for(Int_t iAcc=0; iAcc<multAcc; ++iAcc) {\r
1699        if(label == labelsAcc[iAcc]) {\r
1700          Double_t v2[2] = {track->Pt(), multAcc}; \r
1701          fRecTrackMultHist1[AlidNdPtHelper::kAccTracks]->Fill(v2);\r
1702        }\r
1703      }\r
1704      for(Int_t iRec=0; iRec<multRec; ++iRec) {\r
1705        if(label == labelsRec[iRec]) {\r
1706          Double_t v3[2] = {track->Pt(), multRec}; \r
1707          fRecTrackMultHist1[AlidNdPtHelper::kRecTracks]->Fill(v3);\r
1708        }\r
1709      }\r
1710   }\r
1711 }\r
1712 \r
1713 //_____________________________________________________________________________\r
1714 void AlidNdPtAnalysis::FillHistograms(AliESDtrack *const esdTrack, AliStack *const stack, const Double_t zv, AlidNdPtHelper::TrackObject trackObj, Int_t multMB)\r
1715 {\r
1716   //\r
1717   // Fill ESD track and MC histograms \r
1718   //\r
1719   if(!esdTrack) return;\r
1720 \r
1721   Float_t q = esdTrack->Charge();\r
1722   if(TMath::Abs(q) < 0.001) return;\r
1723 \r
1724   Float_t pt = esdTrack->Pt();\r
1725   //Float_t qpt = esdTrack->Pt() * q;\r
1726   Float_t eta = esdTrack->Eta();\r
1727   Float_t phi = esdTrack->Phi();\r
1728 \r
1729   Float_t dca[2], bCov[3];\r
1730   esdTrack->GetImpactParameters(dca,bCov);\r
1731 \r
1732   Int_t nClust = esdTrack->GetTPCclusters(0);\r
1733   Float_t chi2PerCluster = 0.;\r
1734   if(nClust>0.) chi2PerCluster = esdTrack->GetTPCchi2()/Float_t(nClust);\r
1735 \r
1736 \r
1737   // fill histograms\r
1738   Double_t values1[3] = {pt,eta,phi};     \r
1739   fRecTrackHist1[trackObj]->Fill(values1);\r
1740 \r
1741   Double_t values[4] = {zv, pt,eta, multMB};      \r
1742   if(trackObj == AlidNdPtHelper::kRecTracks) {\r
1743     fRecTrackHist->Fill(values);\r
1744   }\r
1745 \r
1746   /*\r
1747   Double_t values2[5] = {nClust,chi2PerCluster,pt,eta,phi};       \r
1748   if(trackObj == AlidNdPtHelper::kRecTracks)  \r
1749   {\r
1750     if(fHistogramsOn)\r
1751       fRecTrackHist2->Fill(values2);\r
1752   }\r
1753   */\r
1754  \r
1755   //\r
1756   // Fill rec vs MC information\r
1757   //\r
1758   if(!stack) return;\r
1759 \r
1760   Int_t label = TMath::Abs(esdTrack->GetLabel()); \r
1761   //if(label == 0) return;\r
1762 \r
1763   if(label > stack->GetNtrack()) return;\r
1764   TParticle* particle = stack->Particle(label);\r
1765   if(!particle) return;\r
1766 \r
1767   //Bool_t prim = stack->IsPhysicalPrimary(label);\r
1768   //Int_t pid = AlidNdPtHelper::ConvertPdgToPid(particle);\r
1769 \r
1770   Int_t motherPdg = -1;\r
1771   TParticle* mother = 0;\r
1772 \r
1773   //TParticle* prim_mother = AlidNdPtHelper::FindPrimaryMother(stack,label);\r
1774   Int_t motherLabel = particle->GetMother(0); \r
1775   if(motherLabel>0) mother = stack->Particle(motherLabel);\r
1776   if(mother) motherPdg = TMath::Abs(mother->GetPdgCode()); // take abs for visualisation only\r
1777   //Int_t mech = particle->GetUniqueID(); // production mechanism\r
1778 \r
1779   if(!particle->GetPDG()) return;\r
1780   Double_t gq = particle->GetPDG()->Charge()/3.0; // Charge units |e|/3 \r
1781   if(TMath::Abs(gq)<0.001) return;\r
1782   Float_t gpt = particle->Pt();\r
1783   Float_t geta = particle->Eta();\r
1784   //Float_t qgpt = particle->Pt() * gq;\r
1785   //Float_t gphi = particle->Phi();\r
1786 \r
1787   Double_t dpt=0;\r
1788   //printf("pt %f, gpt %f \n",pt,gpt);\r
1789   if(gpt) dpt = (pt-gpt)/gpt;\r
1790   Double_t deta = (eta-geta);\r
1791  \r
1792   // fill histograms\r
1793   if(trackObj == AlidNdPtHelper::kRecTracks)  \r
1794   {\r
1795     Double_t vTrackPtCorrelationMatrix[3]={pt,gpt,geta};\r
1796     fTrackPtCorrelationMatrix->Fill(vTrackPtCorrelationMatrix);\r
1797 \r
1798     Double_t vRecMCTrackHist1[4]={gpt,geta,dpt,deta};\r
1799     fRecMCTrackHist1->Fill(vRecMCTrackHist1);\r
1800   }\r
1801 }\r
1802 \r
1803 //_____________________________________________________________________________\r
1804 void AlidNdPtAnalysis::FillHistograms(AliStack *const stack, Int_t label, AlidNdPtHelper::TrackObject trackObj)\r
1805 {\r
1806   // Fill MC histograms\r
1807   if(!stack) return;\r
1808 \r
1809   if(label > stack->GetNtrack()) return;\r
1810   TParticle* particle = stack->Particle(label);\r
1811   if(!particle) return;\r
1812 \r
1813   Int_t motherPdg = -1;\r
1814   TParticle* mother = 0;\r
1815 \r
1816   //TParticle* prim_mother = AlidNdPtHelper::FindPrimaryMother(stack,label);\r
1817   Int_t motherLabel = particle->GetMother(0); \r
1818   if(motherLabel>0) mother = stack->Particle(motherLabel);\r
1819   if(mother) motherPdg = TMath::Abs(mother->GetPdgCode()); // take abs for visualisation only\r
1820   Int_t mech = particle->GetUniqueID(); // production mechanism\r
1821 \r
1822   if(!particle->GetPDG()) return;\r
1823   Double_t gq = particle->GetPDG()->Charge()/3.0; // Charge units |e|/3 \r
1824   if(TMath::Abs(gq) < 0.001) return;\r
1825 \r
1826   Float_t gpt = particle->Pt();\r
1827   //Float_t qgpt = particle->Pt() * gq;\r
1828   Float_t geta = particle->Eta();\r
1829   Float_t gphi = particle->Phi();\r
1830   //Float_t gpz = particle->Pz();\r
1831 \r
1832   Bool_t prim = stack->IsPhysicalPrimary(label);\r
1833   //Float_t vx = particle->Vx(); Float_t vy = particle->Vy(); Float_t vz = particle->Vz();\r
1834 \r
1835   Int_t pid = AlidNdPtHelper::ConvertPdgToPid(particle);\r
1836 \r
1837   //if(prim&&pid==5) printf("pdgcode %d, production mech %d \n",particle->GetPdgCode(),mech);\r
1838   //if(!prim) printf("motherPdg %d, particle %d, production mech %d\n",motherPdg, particle->GetPdgCode(),mech);\r
1839   \r
1840   //\r
1841   // fill histogram\r
1842   //\r
1843   Double_t vMCTrackHist1[3] = {gpt,geta,gphi};\r
1844   fMCTrackHist1[trackObj]->Fill(vMCTrackHist1);\r
1845 \r
1846   Double_t vMCPrimTrackHist1[5] = {gpt,geta,pid,mech,motherPdg};\r
1847   Double_t vMCPrimTrackHist2[5] = {TMath::Abs(particle->GetPdgCode()),mech,motherPdg};\r
1848   //if(prim && AliPWG0Helper::IsPrimaryCharged(particle, label)) fMCPrimTrackHist1[trackObj]->Fill(vMCPrimTrackHist1);\r
1849   if(prim) { \r
1850     fMCPrimTrackHist1[trackObj]->Fill(vMCPrimTrackHist1);\r
1851     if(pid == 5) fMCPrimTrackHist2[trackObj]->Fill(vMCPrimTrackHist2);\r
1852   }\r
1853   else { \r
1854     fMCSecTrackHist1[trackObj]->Fill(vMCPrimTrackHist1);\r
1855   }\r
1856 \r
1857 }\r
1858 \r
1859 //_____________________________________________________________________________\r
1860 Long64_t AlidNdPtAnalysis::Merge(TCollection* const list) \r
1861 {\r
1862   //  init if not done already\r
1863   if (!fIsInit) { Init(); }\r
1864   \r
1865   // Merge list of objects (needed by PROOF)\r
1866 \r
1867   if (!list)\r
1868   return 0;\r
1869 \r
1870   if (list->IsEmpty())\r
1871   return 1;\r
1872 \r
1873   TIterator* iter = list->MakeIterator();\r
1874   TObject* obj = 0;\r
1875 \r
1876   //\r
1877   //TList *collPhysSelection = new TList;\r
1878 \r
1879   // collection of generated histograms\r
1880 \r
1881   Int_t count=0;\r
1882   while((obj = iter->Next()) != 0) {\r
1883     AlidNdPtAnalysis* entry = dynamic_cast<AlidNdPtAnalysis*>(obj);\r
1884     if (entry == 0) continue; \r
1885 \r
1886     // physics selection\r
1887     //printf("entry->GetPhysicsTriggerSelection() %p \n", entry->GetPhysicsTriggerSelection());\r
1888     //collPhysSelection->Add(entry->GetPhysicsTriggerSelection());\r
1889     \r
1890     //\r
1891     fRecEventHist->Add(entry->fRecEventHist);\r
1892     fRecTrackHist->Add(entry->fRecTrackHist);\r
1893 \r
1894     //\r
1895     fEventMultCorrelationMatrix->Add(entry->fEventMultCorrelationMatrix);\r
1896     fTrackPtCorrelationMatrix->Add(entry->fTrackPtCorrelationMatrix);\r
1897 \r
1898     //\r
1899     fGenEventMatrix->Add(entry->fGenEventMatrix);\r
1900     fGenSDEventMatrix->Add(entry->fGenSDEventMatrix);\r
1901     fGenDDEventMatrix->Add(entry->fGenDDEventMatrix);\r
1902     fGenNDEventMatrix->Add(entry->fGenNDEventMatrix);\r
1903     fGenNSDEventMatrix->Add(entry->fGenNSDEventMatrix);\r
1904 \r
1905     fTriggerEventMatrix->Add(entry->fTriggerEventMatrix);\r
1906     fTriggerSDEventMatrix->Add(entry->fTriggerSDEventMatrix);\r
1907     fTriggerDDEventMatrix->Add(entry->fTriggerDDEventMatrix);\r
1908     fTriggerNDEventMatrix->Add(entry->fTriggerNDEventMatrix);\r
1909     fTriggerNSDEventMatrix->Add(entry->fTriggerNSDEventMatrix);\r
1910 \r
1911     fRecEventMatrix->Add(entry->fRecEventMatrix);\r
1912     fRecSDEventMatrix->Add(entry->fRecSDEventMatrix);\r
1913     fRecDDEventMatrix->Add(entry->fRecDDEventMatrix);\r
1914     fRecNDEventMatrix->Add(entry->fRecNDEventMatrix);\r
1915     fRecNSDEventMatrix->Add(entry->fRecNSDEventMatrix);\r
1916 \r
1917     fRecCandleEventMatrix->Add(entry->fRecCandleEventMatrix);\r
1918     //\r
1919     fGenTrackEventMatrix->Add(entry->fGenTrackEventMatrix);\r
1920     fGenTrackSDEventMatrix->Add(entry->fGenTrackSDEventMatrix);\r
1921     fGenTrackDDEventMatrix->Add(entry->fGenTrackDDEventMatrix);\r
1922     fGenTrackNDEventMatrix->Add(entry->fGenTrackNDEventMatrix);\r
1923     fGenTrackNSDEventMatrix->Add(entry->fGenTrackNSDEventMatrix);\r
1924 \r
1925     fTriggerTrackEventMatrix->Add(entry->fTriggerTrackEventMatrix);\r
1926     fTriggerTrackSDEventMatrix->Add(entry->fTriggerTrackSDEventMatrix);\r
1927     fTriggerTrackDDEventMatrix->Add(entry->fTriggerTrackDDEventMatrix);\r
1928     fTriggerTrackNDEventMatrix->Add(entry->fTriggerTrackNDEventMatrix);\r
1929     fTriggerTrackNSDEventMatrix->Add(entry->fTriggerTrackNSDEventMatrix);\r
1930 \r
1931     fRecTrackEventMatrix->Add(entry->fRecTrackEventMatrix);\r
1932     fRecTrackSDEventMatrix->Add(entry->fRecTrackSDEventMatrix);\r
1933     fRecTrackDDEventMatrix->Add(entry->fRecTrackDDEventMatrix);\r
1934     fRecTrackNDEventMatrix->Add(entry->fRecTrackNDEventMatrix);\r
1935     fRecTrackNSDEventMatrix->Add(entry->fRecTrackNSDEventMatrix);\r
1936 \r
1937     //\r
1938     fGenTrackMatrix->Add(entry->fGenTrackMatrix);\r
1939     fGenPrimTrackMatrix->Add(entry->fGenPrimTrackMatrix);\r
1940     fRecPrimTrackMatrix->Add(entry->fRecPrimTrackMatrix);\r
1941     //\r
1942     fRecTrackMatrix->Add(entry->fRecTrackMatrix);\r
1943     fRecSecTrackMatrix->Add(entry->fRecSecTrackMatrix);\r
1944     //\r
1945     fRecMultTrackMatrix->Add(entry->fRecMultTrackMatrix);\r
1946 \r
1947     //\r
1948     // control analysis histograms\r
1949     //\r
1950     fMCEventHist1->Add(entry->fMCEventHist1);\r
1951     fRecEventHist1->Add(entry->fRecEventHist1);\r
1952     fRecEventHist2->Add(entry->fRecEventHist2);\r
1953     fRecMCEventHist1->Add(entry->fRecMCEventHist1);\r
1954     fRecMCEventHist2->Add(entry->fRecMCEventHist2);\r
1955     fRecMCEventHist3->Add(entry->fRecMCEventHist3);\r
1956 \r
1957     for(Int_t i=0; i<AlidNdPtHelper::kCutSteps; i++) {\r
1958       fMCTrackHist1[i]->Add(entry->fMCTrackHist1[i]);\r
1959 \r
1960       fMCPrimTrackHist1[i]->Add(entry->fMCPrimTrackHist1[i]);\r
1961       fMCPrimTrackHist2[i]->Add(entry->fMCPrimTrackHist2[i]);\r
1962       fMCSecTrackHist1[i]->Add(entry->fMCSecTrackHist1[i]);\r
1963 \r
1964       fRecTrackHist1[i]->Add(entry->fRecTrackHist1[i]);\r
1965       fRecTrackMultHist1[i]->Add(entry->fRecTrackMultHist1[i]);\r
1966     }\r
1967     fRecMCTrackHist1->Add(entry->fRecMCTrackHist1);\r
1968     fMCMultRecTrackHist1->Add(entry->fMCMultRecTrackHist1);\r
1969     fRecTrackHist2->Add(entry->fRecTrackHist2);\r
1970     fEventCount->Add(entry->fEventCount);\r
1971 \r
1972   count++;\r
1973   }\r
1974 \r
1975   //AliPhysicsSelection *trigSelection = GetPhysicsTriggerSelection();\r
1976   //trigSelection->Merge(collPhysSelection);\r
1977   //if(collPhysSelection) delete collPhysSelection;\r
1978 \r
1979 return count;\r
1980 }\r
1981 \r
1982 //____________________________________________________________________\r
1983 Bool_t AlidNdPtAnalysis::IsBinZeroTrackSPDvtx(const AliESDEvent* esdEvent) {\r
1984 //\r
1985 // check 0-bin\r
1986 // for LHC background calculation\r
1987 // return kTRUE if vertex not reconstructed or\r
1988 // track multiplicity == 0\r
1989 //\r
1990 if(!esdEvent) return kFALSE;\r
1991 \r
1992   // check vertex\r
1993   const AliESDVertex *vertex = esdEvent->GetPrimaryVertexTracks();\r
1994   if(!vertex) return kTRUE;\r
1995 \r
1996   if(vertex->GetNContributors() < 1) {\r
1997     // SPD vertex\r
1998     vertex = esdEvent->GetPrimaryVertexSPD();\r
1999     if(!vertex) return kTRUE;\r
2000   }\r
2001   if(TMath::Abs(vertex->GetZv()) > 15.0) return kTRUE; \r
2002   if( !AlidNdPtHelper::TestRecVertex(vertex, esdEvent->GetPrimaryVertexSPD(), AlidNdPtHelper::kTPCITSHybridTrackSPDvtx) ) \r
2003     return kTRUE;\r
2004  \r
2005 return kFALSE;\r
2006 }\r
2007 \r
2008 //____________________________________________________________________\r
2009 Bool_t AlidNdPtAnalysis::IsBinZeroSPDvtx(const AliESDEvent* esdEvent) {\r
2010 //\r
2011 // check 0-bin\r
2012 // for LHC background calculation\r
2013 // return kTRUE if vertex not reconstructed or\r
2014 // tracklet multiplicity == 0\r
2015 //\r
2016 if(!esdEvent) return kFALSE;\r
2017 \r
2018   // check vertex\r
2019   const AliESDVertex* vertex = esdEvent->GetPrimaryVertexSPD();\r
2020   if(!vertex) return kTRUE;\r
2021   if(TMath::Abs(vertex->GetZv()) > 15.0) return kTRUE; \r
2022   if( !AlidNdPtHelper::TestRecVertex(vertex, esdEvent->GetPrimaryVertexSPD(), AlidNdPtHelper::kTPCSPDvtx) ) return kTRUE;\r
2023  \r
2024 return kFALSE;\r
2025 }\r
2026 \r
2027 //_____________________________________________________________________________\r
2028 void AlidNdPtAnalysis::Analyse() \r
2029 {\r
2030   //  init if not done already\r
2031   if (!fIsInit) { Init(); }\r
2032   \r
2033   // Analyse histograms\r
2034   //\r
2035   TH1::AddDirectory(kFALSE);\r
2036   TH1 *h=0, *h1=0, *h2=0, *h2c = 0; \r
2037   THnSparse *hs=0; \r
2038   TH2 *h2D=0; \r
2039 \r
2040   char name[256];\r
2041   TObjArray *aFolderObj = new TObjArray;\r
2042   if(!aFolderObj) return;\r
2043   \r
2044   //\r
2045   // LHC backgraund in all and 0-bins\r
2046   //\r
2047   //AliPhysicsSelection *trigSel = GetPhysicsTriggerSelection();\r
2048   //trigSel->SaveHistograms("physics_selection");\r
2049 \r
2050   //\r
2051   // Reconstructed event vertex\r
2052   //\r
2053   h = fRecEventHist1->Projection(0);\r
2054   h->SetName("Xv");\r
2055   aFolderObj->Add(h);\r
2056 \r
2057   h = fRecEventHist1->Projection(1);\r
2058   h->SetName("Yv");\r
2059   aFolderObj->Add(h);\r
2060 \r
2061   h = fRecEventHist1->Projection(2);\r
2062   h->SetName("Zv");\r
2063   aFolderObj->Add(h);\r
2064 \r
2065   //\r
2066   // multiplicity\r
2067   //\r
2068   h = fRecEventHist2->Projection(1);\r
2069   h->SetName("multMB");\r
2070   aFolderObj->Add(h);\r
2071 \r
2072   h = fRecEventHist2->Projection(2);\r
2073   h->SetName("multiplicity");\r
2074   aFolderObj->Add(h);\r
2075 \r
2076   h2D = fRecEventHist2->Projection(0,1); \r
2077   h2D->SetName("Zv_vs_multiplicity_MB");\r
2078   aFolderObj->Add(h2D);\r
2079 \r
2080   //\r
2081   // reconstructed pt histograms\r
2082   //\r
2083   h = fRecTrackHist1[0]->Projection(0);\r
2084   h->Scale(1.,"width");\r
2085   h->SetName("pt_all_ch");\r
2086   aFolderObj->Add(h);\r
2087 \r
2088   h = fRecTrackHist1[1]->Projection(0);\r
2089   h->Scale(1.,"width");\r
2090   h->SetName("pt_acc");\r
2091   aFolderObj->Add(h);\r
2092 \r
2093   h = fRecTrackHist1[2]->Projection(0);\r
2094   h->Scale(1.,"width");\r
2095   h->SetName("pt_rec");\r
2096   aFolderObj->Add(h);\r
2097 \r
2098   //\r
2099   // reconstructed eta histograms\r
2100   //\r
2101   h = fRecTrackHist1[0]->Projection(1);\r
2102   h->SetName("eta_all_ch");\r
2103   aFolderObj->Add(h);\r
2104 \r
2105   h = fRecTrackHist1[1]->Projection(1);\r
2106   h->SetName("eta_acc");\r
2107   aFolderObj->Add(h);\r
2108 \r
2109   h = fRecTrackHist1[2]->Projection(1);\r
2110   h->SetName("eta_rec");\r
2111   aFolderObj->Add(h);\r
2112 \r
2113   //\r
2114   // reconstructed phi histograms\r
2115   //\r
2116   h = fRecTrackHist1[0]->Projection(2);\r
2117   h->SetName("phi_all_ch");\r
2118   aFolderObj->Add(h);\r
2119 \r
2120   h = fRecTrackHist1[1]->Projection(2);\r
2121   h->SetName("phi_acc");\r
2122   aFolderObj->Add(h);\r
2123 \r
2124   h = fRecTrackHist1[2]->Projection(2);\r
2125   h->SetName("phi_rec");\r
2126   aFolderObj->Add(h);\r
2127 \r
2128   //\r
2129   // reconstructed eta:pt histograms\r
2130   //\r
2131   h2D = fRecTrackHist1[0]->Projection(1,0);\r
2132   h2D->SetName("pt_eta_all_ch");\r
2133   aFolderObj->Add(h2D);\r
2134 \r
2135   h2D = fRecTrackHist1[1]->Projection(1,0);\r
2136   h2D->SetName("pt_eta_acc");\r
2137   aFolderObj->Add(h2D);\r
2138 \r
2139   h2D = fRecTrackHist1[2]->Projection(1,0);\r
2140   h2D->SetName("pt_eta_rec");\r
2141   aFolderObj->Add(h2D);\r
2142 \r
2143   //\r
2144   // reconstructed phi:pt histograms\r
2145   //\r
2146   h2D = fRecTrackHist1[0]->Projection(2,0);\r
2147   h2D->SetName("pt_phi_all_ch");\r
2148   aFolderObj->Add(h2D);\r
2149 \r
2150   h2D = fRecTrackHist1[1]->Projection(2,0);\r
2151   h2D->SetName("pt_phi_acc");\r
2152   aFolderObj->Add(h2D);\r
2153 \r
2154   h2D = fRecTrackHist1[2]->Projection(2,0);\r
2155   h2D->SetName("pt_phi_rec");\r
2156   aFolderObj->Add(h2D);\r
2157 \r
2158   //\r
2159   // reconstructed phi:eta histograms\r
2160   //\r
2161   h2D = fRecTrackHist1[0]->Projection(2,1);\r
2162   h2D->SetName("eta_phi_all_ch");\r
2163   aFolderObj->Add(h2D);\r
2164 \r
2165   h2D = fRecTrackHist1[1]->Projection(2,1);\r
2166   h2D->SetName("eta_phi_acc");\r
2167   aFolderObj->Add(h2D);\r
2168 \r
2169   h2D = fRecTrackHist1[2]->Projection(2,1);\r
2170   h2D->SetName("eta_phi_rec");\r
2171   aFolderObj->Add(h2D);\r
2172 \r
2173   //\r
2174   // reconstructed nClust, chi2 vs pt, eta, phi\r
2175   //\r
2176   if(fHistogramsOn) {\r
2177 \r
2178     h2D = fRecTrackHist2->Projection(0,1);\r
2179     h2D->SetName("nClust_chi2_rec");\r
2180     aFolderObj->Add(h2D);\r
2181 \r
2182     h2D = fRecTrackHist2->Projection(0,2);\r
2183     h2D->SetName("nClust_pt_rec");\r
2184     aFolderObj->Add(h2D);\r
2185 \r
2186     h2D = fRecTrackHist2->Projection(0,3);\r
2187     h2D->SetName("nClust_eta_rec");\r
2188     aFolderObj->Add(h2D);\r
2189 \r
2190     h2D = fRecTrackHist2->Projection(0,4);\r
2191     h2D->SetName("nClust_phi_rec");\r
2192     aFolderObj->Add(h2D);\r
2193 \r
2194     h2D = fRecTrackHist2->Projection(1,2);\r
2195     h2D->SetName("chi2_pt_rec");\r
2196     aFolderObj->Add(h2D);\r
2197 \r
2198     h2D = fRecTrackHist2->Projection(1,3);\r
2199     h2D->SetName("chi2_eta_rec");\r
2200     aFolderObj->Add(h2D);\r
2201 \r
2202     h2D = fRecTrackHist2->Projection(1,4);\r
2203     h2D->SetName("chi2_phi_rec");\r
2204     aFolderObj->Add(h2D);\r
2205 \r
2206   }\r
2207 \r
2208   //\r
2209   // calculate corrections for empty events\r
2210   // with multMB==0 \r
2211   //\r
2212 \r
2213   //\r
2214   // normalised zv to generate zv for triggered events\r
2215   //\r
2216   h = fRecEventHist2->Projection(0);\r
2217   if( h->Integral() ) h->Scale(1./h->Integral());\r
2218   h->SetName("zv_distribution_norm");\r
2219   aFolderObj->Add(h);\r
2220  \r
2221   //\r
2222   // MC available\r
2223   //\r
2224   if(IsUseMCInfo()) {\r
2225 \r
2226   //\r
2227   // Event vertex resolution\r
2228   //\r
2229   h2D = fRecMCEventHist2->Projection(0,2);\r
2230   h2D->SetName("DeltaXv_vs_mult");\r
2231   aFolderObj->Add(h2D);\r
2232 \r
2233   h2D = fRecMCEventHist2->Projection(1,2);\r
2234   h2D->SetName("DeltaZv_vs_mult");\r
2235   aFolderObj->Add(h2D);\r
2236 \r
2237   //\r
2238   // normalised zv to get trigger/trigger+vertex event differences\r
2239   // F(zv) = E_trig(zv,0)/Int(E_trig(zv,0) / Sum(E_trigvtx(zv,n))/Sum(Int(E_trigvtx(zv,n))dzv)\r
2240   //\r
2241   fTriggerEventMatrix->GetAxis(1)->SetRangeUser(0.,0.);\r
2242   h = fTriggerEventMatrix->Projection(0);\r
2243   h2D = fTriggerEventMatrix->Projection(0,1);\r
2244   if(h2D->Integral()) h->Scale(1./h2D->Integral());\r
2245 \r
2246   h1 = fRecEventMatrix->Projection(0);\r
2247   h2D = fRecEventMatrix->Projection(0,1);\r
2248   if(h2D->Integral()) h1->Scale(1./h2D->Integral());\r
2249 \r
2250   h->Divide(h1);\r
2251   h->SetName("zv_empty_events_norm");\r
2252   aFolderObj->Add(h);\r
2253   \r
2254   fTriggerEventMatrix->GetAxis(1)->SetRange(1,fTriggerEventMatrix->GetAxis(1)->GetNbins());\r
2255 \r
2256   //\r
2257   // rec. vs true multiplicity correlation matrix\r
2258   //\r
2259   hs = (THnSparse*)fEventMultCorrelationMatrix->Clone("event_mult_correlation_matrix");\r
2260   aFolderObj->Add(hs);\r
2261  \r
2262   //\r
2263   // rec. vs true track pt correlation matrix\r
2264   //\r
2265   hs = (THnSparse*)fTrackPtCorrelationMatrix->Clone("track_pt_correlation_matrix");\r
2266   aFolderObj->Add(hs);\r
2267 \r
2268   //\r
2269   // trigger efficiency for INEL\r
2270   //\r
2271   h = AlidNdPtHelper::GenerateCorrMatrix(fTriggerEventMatrix->Projection(0),fGenEventMatrix->Projection(0),"zv_trig_INEL_eff_matrix");\r
2272   aFolderObj->Add(h);\r
2273 \r
2274   //\r
2275   // trigger efficiency for NSD\r
2276   //\r
2277   h = AlidNdPtHelper::GenerateCorrMatrix(fTriggerNSDEventMatrix->Projection(0),fGenNSDEventMatrix->Projection(0),"zv_trig_NSD_eff_matrix");\r
2278   aFolderObj->Add(h);\r
2279 \r
2280   //\r
2281   // trigger bias correction (MB to ND)\r
2282   //\r
2283   hs = AlidNdPtHelper::GenerateCorrMatrix(fGenNDEventMatrix,fTriggerEventMatrix,"zv_mult_trig_MBtoND_corr_matrix");\r
2284   aFolderObj->Add(hs);\r
2285 \r
2286   h = AlidNdPtHelper::GenerateCorrMatrix(fGenNDEventMatrix->Projection(0),fTriggerEventMatrix->Projection(0),"zv_trig_MBtoND_corr_matrix");\r
2287   aFolderObj->Add(h);\r
2288 \r
2289 \r
2290   h = AlidNdPtHelper::GenerateCorrMatrix(fGenNDEventMatrix->Projection(1),fTriggerEventMatrix->Projection(1),"mult_trig_MBtoND_corr_matrix");\r
2291 \r
2292   aFolderObj->Add(h);\r
2293 \r
2294   //\r
2295   // trigger bias correction (MB to NSD)\r
2296   //\r
2297   hs = AlidNdPtHelper::GenerateCorrMatrix(fGenNSDEventMatrix,fTriggerEventMatrix,"zv_mult_trig_MBtoNSD_corr_matrix");\r
2298   aFolderObj->Add(hs);\r
2299 \r
2300   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenNSDEventMatrix->Projection(0,1),fTriggerEventMatrix->Projection(0,1),"zv_mult_trig_MBtoNSD_corr_matrix_2D");\r
2301   aFolderObj->Add(h2D);\r
2302 \r
2303   h = AlidNdPtHelper::GenerateCorrMatrix(fGenNSDEventMatrix->Projection(0),fTriggerEventMatrix->Projection(0),"zv_trig_MBtoNSD_corr_matrix");\r
2304   aFolderObj->Add(h);\r
2305 \r
2306 \r
2307   h = AlidNdPtHelper::GenerateCorrMatrix(fGenNSDEventMatrix->Projection(1),fTriggerEventMatrix->Projection(1),"mult_trig_MBtoNSD_corr_matrix");\r
2308   aFolderObj->Add(h);\r
2309 \r
2310 \r
2311   //\r
2312   // trigger bias correction (MB to INEL)\r
2313   //\r
2314   hs = AlidNdPtHelper::GenerateCorrMatrix(fGenEventMatrix,fTriggerEventMatrix,"zv_mult_trig_MBtoInel_corr_matrix");\r
2315   aFolderObj->Add(hs);\r
2316 \r
2317   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenEventMatrix->Projection(0,1),fTriggerEventMatrix->Projection(0,1),"zv_mult_trig_MBtoInel_corr_matrix_2D");\r
2318   aFolderObj->Add(h2D);\r
2319 \r
2320   h = AlidNdPtHelper::GenerateCorrMatrix(fGenEventMatrix->Projection(0),fTriggerEventMatrix->Projection(0),"zv_trig_MBtoInel_corr_matrix");\r
2321   aFolderObj->Add(h);\r
2322 \r
2323   h = AlidNdPtHelper::GenerateCorrMatrix(fGenEventMatrix->Projection(1),fTriggerEventMatrix->Projection(1),"mult_trig_MBtoInel_corr_matrix");\r
2324   aFolderObj->Add(h);\r
2325 \r
2326 \r
2327   //\r
2328   // event vertex reconstruction correction (MB)\r
2329   //\r
2330   hs = AlidNdPtHelper::GenerateCorrMatrix(fTriggerEventMatrix,fRecEventMatrix,"zv_mult_event_corr_matrix");\r
2331   aFolderObj->Add(hs);\r
2332 \r
2333   h2D = AlidNdPtHelper::GenerateCorrMatrix(fTriggerEventMatrix->Projection(0,1),fRecEventMatrix->Projection(0,1),"zv_mult_event_corr_matrix_2D");\r
2334   aFolderObj->Add(h2D);\r
2335 \r
2336 \r
2337   h = AlidNdPtHelper::GenerateCorrMatrix(fTriggerEventMatrix->Projection(1),fRecEventMatrix->Projection(1),"mult_event_corr_matrix");\r
2338   aFolderObj->Add(h);\r
2339 \r
2340 \r
2341   h = AlidNdPtHelper::GenerateCorrMatrix(fTriggerEventMatrix->Projection(0),fRecEventMatrix->Projection(0),"zv_event_corr_matrix");\r
2342   aFolderObj->Add(h);\r
2343 \r
2344   //\r
2345   // track-event trigger bias correction (MB to ND)\r
2346   //\r
2347 \r
2348   hs = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackNDEventMatrix,fTriggerTrackEventMatrix,"zv_pt_eta_track_trig_MBtoND_corr_matrix");\r
2349   aFolderObj->Add(hs);\r
2350 \r
2351   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackNDEventMatrix->Projection(1,2),fTriggerTrackEventMatrix->Projection(1,2),"eta_pt_track_trig_MBtoND_corr_matrix");\r
2352   aFolderObj->Add(h2D);\r
2353 \r
2354   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackNDEventMatrix->Projection(1,0),fTriggerTrackEventMatrix->Projection(1,0),"pt_zv_track_trig_MBtoND_corr_matrix");\r
2355   aFolderObj->Add(h2D);\r
2356 \r
2357   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackNDEventMatrix->Projection(2,0),fTriggerTrackEventMatrix->Projection(2,0),"zv_eta_track_trig_MBtoND_corr_matrix");\r
2358   aFolderObj->Add(h2D);\r
2359 \r
2360   //\r
2361   // track-event trigger bias correction (MB to NSD)\r
2362   //\r
2363   hs = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackNSDEventMatrix,fTriggerTrackEventMatrix,"zv_pt_eta_track_trig_MBtoNSD_corr_matrix");\r
2364   aFolderObj->Add(hs);\r
2365 \r
2366   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackNSDEventMatrix->Projection(1,2),fTriggerTrackEventMatrix->Projection(1,2),"eta_pt_track_trig_MBtoNSD_corr_matrix");\r
2367   aFolderObj->Add(h2D);\r
2368 \r
2369   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackNSDEventMatrix->Projection(1,0),fTriggerTrackEventMatrix->Projection(1,0),"pt_zv_track_trig_MBtoNSD_corr_matrix");\r
2370   aFolderObj->Add(h2D);\r
2371 \r
2372   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackNSDEventMatrix->Projection(2,0),fTriggerTrackEventMatrix->Projection(2,0),"zv_eta_track_trig_MBtoNSD_corr_matrix");\r
2373   aFolderObj->Add(h2D);\r
2374 \r
2375 \r
2376   //\r
2377   // track-event trigger bias correction (MB to INEL)\r
2378   //\r
2379   hs = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackEventMatrix,fTriggerTrackEventMatrix,"zv_pt_eta_track_trig_MBtoInel_corr_matrix");\r
2380   aFolderObj->Add(hs);\r
2381 \r
2382   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackEventMatrix->Projection(1,2),fTriggerTrackEventMatrix->Projection(1,2),"eta_pt_track_trig_MBtoInel_corr_matrix");\r
2383   aFolderObj->Add(h2D);\r
2384 \r
2385   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackEventMatrix->Projection(1,0),fTriggerTrackEventMatrix->Projection(1,0),"pt_zv_track_trig_MBtoInel_corr_matrix");\r
2386   aFolderObj->Add(h2D);\r
2387 \r
2388   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenTrackEventMatrix->Projection(2,0),fTriggerTrackEventMatrix->Projection(2,0),"zv_eta_track_trig_MBtoInel_corr_matrix");\r
2389   aFolderObj->Add(h2D);\r
2390 \r
2391   // efficiency\r
2392 \r
2393   h = AlidNdPtHelper::GenerateCorrMatrix(fTriggerTrackEventMatrix->Projection(1),fGenTrackEventMatrix->Projection(1),"pt_track_trig_MBtoInel_eff_matrix");\r
2394   aFolderObj->Add(h);\r
2395 \r
2396 \r
2397   //\r
2398   // track-event vertex reconstruction correction (MB)\r
2399   //\r
2400   hs = AlidNdPtHelper::GenerateCorrMatrix(fTriggerTrackEventMatrix,fRecTrackEventMatrix,"zv_pt_eta_track_event_corr_matrix");\r
2401   aFolderObj->Add(hs);\r
2402 \r
2403   h2D = AlidNdPtHelper::GenerateCorrMatrix(fTriggerTrackEventMatrix->Projection(1,2),fRecTrackEventMatrix->Projection(1,2),"eta_pt_track_event_corr_matrix");\r
2404   aFolderObj->Add(h2D);\r
2405 \r
2406   h2D = AlidNdPtHelper::GenerateCorrMatrix(fTriggerTrackEventMatrix->Projection(1,0),fRecTrackEventMatrix->Projection(1,0),"pt_zv_track_event_corr_matrix");\r
2407   aFolderObj->Add(h2D);\r
2408 \r
2409   h2D = AlidNdPtHelper::GenerateCorrMatrix(fTriggerTrackEventMatrix->Projection(2,0),fRecTrackEventMatrix->Projection(2,0),"zv_eta_track_event_corr_matrix");\r
2410   aFolderObj->Add(h2D);\r
2411   \r
2412   // efficiency\r
2413 \r
2414   h = AlidNdPtHelper::GenerateCorrMatrix(fRecTrackEventMatrix->Projection(1),fTriggerTrackEventMatrix->Projection(1),"pt_track_event_eff_matrix");\r
2415   aFolderObj->Add(h);\r
2416 \r
2417 \r
2418   //\r
2419   // track rec. efficiency correction\r
2420   //\r
2421   hs = AlidNdPtHelper::GenerateCorrMatrix(fGenPrimTrackMatrix,fRecPrimTrackMatrix,"zv_pt_eta_track_corr_matrix");\r
2422   aFolderObj->Add(hs);\r
2423 \r
2424   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenPrimTrackMatrix->Projection(1,2),fRecPrimTrackMatrix->Projection(1,2),"eta_pt_track_corr_matrix");\r
2425   aFolderObj->Add(h2D);\r
2426 \r
2427   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenPrimTrackMatrix->Projection(1,0),fRecPrimTrackMatrix->Projection(1,0),"pt_zv_track_corr_matrix");\r
2428   aFolderObj->Add(h2D);\r
2429 \r
2430   h2D = AlidNdPtHelper::GenerateCorrMatrix(fGenPrimTrackMatrix->Projection(2,0),fRecPrimTrackMatrix->Projection(2,0),"zv_eta_track_corr_matrix");\r
2431   aFolderObj->Add(h2D);\r
2432 \r
2433   \r
2434   h = AlidNdPtHelper::GenerateCorrMatrix(fGenPrimTrackMatrix->Projection(0),fRecPrimTrackMatrix->Projection(0),"zv_track_corr_matrix");\r
2435   aFolderObj->Add(h);\r
2436 \r
2437   h = AlidNdPtHelper::GenerateCorrMatrix(fGenPrimTrackMatrix->Projection(1),fRecPrimTrackMatrix->Projection(1),"pt_track_corr_matrix");\r
2438   aFolderObj->Add(h);\r
2439 \r
2440   // efficiency\r
2441 \r
2442   h = AlidNdPtHelper::GenerateCorrMatrix(fRecPrimTrackMatrix->Projection(1), fGenPrimTrackMatrix->Projection(1),"pt_track_eff_matrix");\r
2443   aFolderObj->Add(h);\r
2444 \r
2445   h = AlidNdPtHelper::GenerateCorrMatrix(fGenPrimTrackMatrix->Projection(2),fRecPrimTrackMatrix->Projection(2),"eta_track_corr_matrix");\r
2446   aFolderObj->Add(h);\r
2447 \r
2448   //\r
2449   // secondary track contamination correction\r
2450   //\r
2451   //hs = AlidNdPtHelper::GenerateContCorrMatrix(fRecSecTrackMatrix,fRecTrackMatrix,"zv_pt_eta_track_cont_matrix");\r
2452   hs = AlidNdPtHelper::GenerateCorrMatrix(fRecSecTrackMatrix,fRecTrackMatrix,"zv_pt_eta_track_cont_matrix");\r
2453   aFolderObj->Add(hs);\r
2454 \r
2455   h2D = AlidNdPtHelper::GenerateCorrMatrix(fRecSecTrackMatrix->Projection(1,2),fRecTrackMatrix->Projection(1,2),"eta_pt_track_cont_matrix");\r
2456   aFolderObj->Add(h2D);\r
2457 \r
2458   h2D = AlidNdPtHelper::GenerateCorrMatrix(fRecSecTrackMatrix->Projection(1,0),fRecTrackMatrix->Projection(1,0),"pt_zv_track_cont_matrix");\r
2459   aFolderObj->Add(h2D);\r
2460 \r
2461   h2D = AlidNdPtHelper::GenerateCorrMatrix(fRecSecTrackMatrix->Projection(2,0),fRecTrackMatrix->Projection(2,0),"zv_eta_track_cont_matrix");\r
2462   aFolderObj->Add(h2D);\r
2463 \r
2464   h = AlidNdPtHelper::GenerateCorrMatrix(fRecSecTrackMatrix->Projection(0),fRecTrackMatrix->Projection(0),"zv_track_cont_matrix");\r
2465   aFolderObj->Add(h);\r
2466 \r
2467 \r
2468   h = AlidNdPtHelper::GenerateCorrMatrix(fRecSecTrackMatrix->Projection(1),fRecTrackMatrix->Projection(1),"pt_track_cont_matrix");\r
2469   aFolderObj->Add(h);\r
2470 \r
2471   h = AlidNdPtHelper::GenerateCorrMatrix(fRecSecTrackMatrix->Projection(2),fRecTrackMatrix->Projection(2),"eta_track_cont_matrix");\r
2472   aFolderObj->Add(h);\r
2473 \r
2474   //\r
2475   // multiple track reconstruction correction\r
2476   //\r
2477   //hs = AlidNdPtHelper::GenerateContCorrMatrix(fRecMultTrackMatrix,fRecTrackMatrix,"zv_pt_eta_mult_track_cont_matrix");\r
2478   hs = AlidNdPtHelper::GenerateCorrMatrix(fRecMultTrackMatrix,fRecTrackMatrix,"zv_pt_eta_mult_track_cont_matrix");\r
2479   aFolderObj->Add(hs);\r
2480 \r
2481   h2D = AlidNdPtHelper::GenerateCorrMatrix(fRecMultTrackMatrix->Projection(1,2),fRecTrackMatrix->Projection(1,2),"eta_pt_mult_track_cont_matrix");\r
2482   aFolderObj->Add(h2D);\r
2483 \r
2484   h2D = AlidNdPtHelper::GenerateCorrMatrix(fRecMultTrackMatrix->Projection(1,0),fRecTrackMatrix->Projection(1,0),"pt_zv_mult_track_cont_matrix");\r
2485   aFolderObj->Add(h2D);\r
2486 \r
2487   h2D = AlidNdPtHelper::GenerateCorrMatrix(fRecMultTrackMatrix->Projection(2,0),fRecTrackMatrix->Projection(2,0),"zv_eta_mult_track_cont_matrix");\r
2488   aFolderObj->Add(h2D);\r
2489 \r
2490   h = AlidNdPtHelper::GenerateCorrMatrix(fRecMultTrackMatrix->Projection(0),fRecTrackMatrix->Projection(0),"zv_mult_track_cont_matrix");\r
2491   aFolderObj->Add(h);\r
2492 \r
2493   h = AlidNdPtHelper::GenerateCorrMatrix(fRecMultTrackMatrix->Projection(1),fRecTrackMatrix->Projection(1),"pt_mult_track_cont_matrix");\r
2494   aFolderObj->Add(h);\r
2495 \r
2496   h = AlidNdPtHelper::GenerateCorrMatrix(fRecMultTrackMatrix->Projection(2),fRecTrackMatrix->Projection(2),"eta_mult_track_cont_matrix");\r
2497   aFolderObj->Add(h);\r
2498 \r
2499   //\r
2500   // Control histograms\r
2501   //\r
2502   \r
2503   if(fHistogramsOn) {\r
2504 \r
2505   // Efficiency electrons, muons, pions, kaons, protons, all\r
2506   fMCPrimTrackHist1[1]->GetAxis(2)->SetRange(1,1); \r
2507   fMCPrimTrackHist1[2]->GetAxis(2)->SetRange(1,1); \r
2508   h1 = fMCPrimTrackHist1[1]->Projection(0);\r
2509   h2 = fMCPrimTrackHist1[2]->Projection(0);\r
2510   h2c = (TH1D *)h2->Clone();\r
2511   h2c->Divide(h1);\r
2512   h2c->SetName("eff_pt_electrons");\r
2513   aFolderObj->Add(h2c);\r
2514 \r
2515   fMCPrimTrackHist1[1]->GetAxis(2)->SetRange(2,2); \r
2516   fMCPrimTrackHist1[2]->GetAxis(2)->SetRange(2,2); \r
2517   h1 = fMCPrimTrackHist1[1]->Projection(0);\r
2518   h2 = fMCPrimTrackHist1[2]->Projection(0);\r
2519   h2c = (TH1D *)h2->Clone();\r
2520   h2c->Divide(h1);\r
2521   h2c->SetName("eff_pt_muons");\r
2522   aFolderObj->Add(h2c);\r
2523 \r
2524   fMCPrimTrackHist1[1]->GetAxis(2)->SetRange(3,3); \r
2525   fMCPrimTrackHist1[2]->GetAxis(2)->SetRange(3,3); \r
2526   h1 = fMCPrimTrackHist1[1]->Projection(0);\r
2527   h2 = fMCPrimTrackHist1[2]->Projection(0);\r
2528   h2c = (TH1D *)h2->Clone();\r
2529   h2c->Divide(h1);\r
2530   h2c->SetName("eff_pt_pions");\r
2531   aFolderObj->Add(h2c);\r
2532 \r
2533   fMCPrimTrackHist1[1]->GetAxis(2)->SetRange(4,4); \r
2534   fMCPrimTrackHist1[2]->GetAxis(2)->SetRange(4,4); \r
2535   h1 = fMCPrimTrackHist1[1]->Projection(0);\r
2536   h2 = fMCPrimTrackHist1[2]->Projection(0);\r
2537   h2c = (TH1D *)h2->Clone();\r
2538   h2c->Divide(h1);\r
2539   h2c->SetName("eff_pt_kaons");\r
2540   aFolderObj->Add(h2c);\r
2541 \r
2542   fMCPrimTrackHist1[1]->GetAxis(2)->SetRange(5,5); \r
2543   fMCPrimTrackHist1[2]->GetAxis(2)->SetRange(5,5); \r
2544   h1 = fMCPrimTrackHist1[1]->Projection(0);\r
2545   h2 = fMCPrimTrackHist1[2]->Projection(0);\r
2546   h2c = (TH1D *)h2->Clone();\r
2547   h2c->Divide(h1);\r
2548   h2c->SetName("eff_pt_protons");\r
2549   aFolderObj->Add(h2c);\r
2550 \r
2551   fMCPrimTrackHist1[1]->GetAxis(2)->SetRange(1,5); \r
2552   fMCPrimTrackHist1[2]->GetAxis(2)->SetRange(1,5); \r
2553   h1 = fMCPrimTrackHist1[1]->Projection(0);\r
2554   h2 = fMCPrimTrackHist1[2]->Projection(0);\r
2555   h2c = (TH1D *)h2->Clone();\r
2556   h2c->Divide(h1);\r
2557   h2c->SetName("eff_pt_selected");\r
2558   aFolderObj->Add(h2c);\r
2559 \r
2560   fMCPrimTrackHist1[1]->GetAxis(2)->SetRange(1,6); \r
2561   fMCPrimTrackHist1[2]->GetAxis(2)->SetRange(1,6); \r
2562   h1 = fMCPrimTrackHist1[1]->Projection(0);\r
2563   h2 = fMCPrimTrackHist1[2]->Projection(0);\r
2564   h2c = (TH1D *)h2->Clone();\r
2565   h2c->Divide(h1);\r
2566   h2c->SetName("eff_pt_all");\r
2567   aFolderObj->Add(h2c);\r
2568 \r
2569   fMCPrimTrackHist1[1]->GetAxis(1)->SetRange(1,fMCPrimTrackHist1[1]->GetAxis(1)->GetNbins()); \r
2570   fMCPrimTrackHist1[2]->GetAxis(1)->SetRange(1,fMCPrimTrackHist1[2]->GetAxis(1)->GetNbins());\r
2571 \r
2572   //  pt spetra\r
2573   // - rec, primaries, secondaries\r
2574   // - primaries (pid) \r
2575   // - secondaries (pid)\r
2576   // - secondaries (mech)\r
2577   // - secondaries (mother)\r
2578   //\r
2579 \r
2580   TH1D *mcPtAccall = fMCTrackHist1[1]->Projection(0);\r
2581   mcPtAccall->SetName("mc_pt_acc_all");\r
2582   aFolderObj->Add(mcPtAccall);\r
2583 \r
2584   TH1D *mcPtAccprim = fMCPrimTrackHist1[1]->Projection(0);\r
2585   mcPtAccprim->SetName("mc_pt_acc_prim");\r
2586   aFolderObj->Add(mcPtAccprim);\r
2587 \r
2588   TH1D *mcPtRecall = fMCTrackHist1[2]->Projection(0);\r
2589   mcPtRecall->SetName("mc_pt_rec_all");\r
2590   aFolderObj->Add(mcPtRecall);\r
2591 \r
2592   TH1D *mcPtRecprim = fMCPrimTrackHist1[2]->Projection(0);\r
2593   mcPtRecprim->SetName("mc_pt_rec_prim");\r
2594   aFolderObj->Add(mcPtRecprim);\r
2595 \r
2596   TH1D *mcPtRecsec = fMCSecTrackHist1[2]->Projection(0);\r
2597   mcPtRecsec->SetName("mc_pt_rec_sec");\r
2598   aFolderObj->Add(mcPtRecsec);\r
2599 \r
2600   for(Int_t i = 0; i<6; i++) \r
2601   { \r
2602     snprintf(name,256,"mc_pt_rec_prim_pid_%d",i); \r
2603     fMCPrimTrackHist1[2]->GetAxis(2)->SetRange(i+1,i+1);\r
2604     h = fMCPrimTrackHist1[2]->Projection(0);\r
2605     h->SetName(name);\r
2606     aFolderObj->Add(h);\r
2607 \r
2608     snprintf(name,256,"mc_pt_rec_sec_pid_%d",i); \r
2609     fMCSecTrackHist1[2]->GetAxis(2)->SetRange(i+1,i+1);\r
2610     h = fMCSecTrackHist1[2]->Projection(0);\r
2611     h->SetName(name);\r
2612     aFolderObj->Add(h);\r
2613 \r
2614     // production mechanisms for given pid\r
2615     fMCSecTrackHist1[2]->GetAxis(2)->SetRange(i+1,i+1);\r
2616 \r
2617     for(Int_t j=0; j<20; j++) {\r
2618       if(j == 4) {\r
2619         // decay\r
2620         \r
2621         snprintf(name,256,"mc_pt_rec_sec_pid_%d_decay",i); \r
2622         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2623         h = fMCSecTrackHist1[2]->Projection(0);\r
2624         h->SetName(name);\r
2625         aFolderObj->Add(h);\r
2626 \r
2627         snprintf(name,256,"mc_eta_rec_sec_pid_%d_decay",i); \r
2628         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2629         h = fMCSecTrackHist1[2]->Projection(1);\r
2630         h->SetName(name);\r
2631         aFolderObj->Add(h);\r
2632 \r
2633         snprintf(name,256,"mc_mother_rec_sec_pid_%d_decay",i); \r
2634         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2635         h = fMCSecTrackHist1[2]->Projection(4);\r
2636         h->SetName(name);\r
2637         aFolderObj->Add(h);\r
2638 \r
2639       } else if (j == 5) {\r
2640        // conversion\r
2641 \r
2642         snprintf(name,256,"mc_pt_rec_sec_pid_%d_conv",i); \r
2643         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2644         h = fMCSecTrackHist1[2]->Projection(0);\r
2645         h->SetName(name);\r
2646         aFolderObj->Add(h);\r
2647 \r
2648         snprintf(name,256,"mc_eta_rec_sec_pid_%d_conv",i); \r
2649         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2650         h = fMCSecTrackHist1[2]->Projection(1);\r
2651         h->SetName(name);\r
2652         aFolderObj->Add(h);\r
2653 \r
2654         snprintf(name,256,"mc_mother_rec_sec_pid_%d_conv",i); \r
2655         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2656         h = fMCSecTrackHist1[2]->Projection(4);\r
2657         h->SetName(name);\r
2658         aFolderObj->Add(h);\r
2659 \r
2660      } else if (j == 13) {\r
2661        // mat\r
2662        \r
2663         snprintf(name,256,"mc_pt_rec_sec_pid_%d_mat",i); \r
2664         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2665         h = fMCSecTrackHist1[2]->Projection(0);\r
2666         h->SetName(name);\r
2667         aFolderObj->Add(h);\r
2668 \r
2669         snprintf(name,256,"mc_eta_rec_sec_pid_%d_mat",i); \r
2670         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2671         h = fMCSecTrackHist1[2]->Projection(1);\r
2672         h->SetName(name);\r
2673         aFolderObj->Add(h);\r
2674 \r
2675         snprintf(name,256,"mc_eta_mother_rec_sec_pid_%d_mat",i); \r
2676         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2677         h = fMCSecTrackHist1[2]->Projection(4,1);\r
2678         h->SetName(name);\r
2679         aFolderObj->Add(h);\r
2680 \r
2681         snprintf(name,256,"mc_mother_rec_sec_pid_%d_mat",i); \r
2682         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2683         h = fMCSecTrackHist1[2]->Projection(4);\r
2684         h->SetName(name);\r
2685         aFolderObj->Add(h);\r
2686 \r
2687         snprintf(name,256,"mc_pt_mother_rec_sec_pid_%d_mat",i); \r
2688         fMCSecTrackHist1[2]->GetAxis(3)->SetRange(j+1,j+1);\r
2689         h = fMCSecTrackHist1[2]->Projection(4,0);\r
2690         h->SetName(name);\r
2691         aFolderObj->Add(h);\r
2692 \r
2693      } else {\r
2694        continue;\r
2695      }\r
2696    }\r
2697 \r
2698   }\r
2699   } // end fHistogramOn\r
2700 \r
2701   //\r
2702   //  resolution histograms\r
2703   //  only for reconstructed tracks\r
2704   //\r
2705 \r
2706   TH2F *h2F=0;\r
2707   TCanvas * c = new TCanvas("resol","resol");\r
2708   c->cd();\r
2709 \r
2710   //\r
2711   fRecMCTrackHist1->GetAxis(1)->SetRangeUser(-0.8,0.79); \r
2712 \r
2713   h2F = (TH2F*)fRecMCTrackHist1->Projection(2,0);\r
2714   h = AlidNdPtHelper::MakeResol(h2F,1,0,kTRUE,10);\r
2715   h->SetXTitle("p_{tmc} (GeV/c)");\r
2716   h->SetYTitle("(p_{t}-p_{tmc})/p_{tmc} resolution");\r
2717   h->Draw();\r
2718   h->SetName("pt_resolution_vs_mcpt");\r
2719   aFolderObj->Add(h);\r
2720 \r
2721   h2F = (TH2F*)fRecMCTrackHist1->Projection(2,0);\r
2722   h = AlidNdPtHelper::MakeResol(h2F,1,1,kTRUE,10);\r
2723   h->SetXTitle("p_{tmc} (GeV/c)");\r
2724   h->SetYTitle("(p_{t}-p_{tmc})/p_{tmc} mean");\r
2725   h->Draw();\r
2726   h->SetName("dpt_mean_vs_mcpt");\r
2727   aFolderObj->Add(h);\r
2728 \r
2729   //\r
2730   h2F = (TH2F*)fRecMCTrackHist1->Projection(3,0);\r
2731   h = AlidNdPtHelper::MakeResol(h2F,1,0,kTRUE,10);\r
2732   h->SetXTitle("p_{tmc} (GeV/c)");\r
2733   h->SetYTitle("(#eta-#eta_{mc}) resolution");\r
2734   h->Draw();\r
2735   h->SetName("eta_resolution_vs_mcpt");\r
2736   aFolderObj->Add(h);\r
2737 \r
2738   h2F = (TH2F*)fRecMCTrackHist1->Projection(3,0);\r
2739   h = AlidNdPtHelper::MakeResol(h2F,1,1,kTRUE,10);\r
2740   h->SetXTitle("p_{tmc} (GeV/c)");\r
2741   h->SetYTitle("(#eta-mc#eta) mean");\r
2742   h->Draw();\r
2743   h->SetName("deta_mean_vs_mcpt");\r
2744   aFolderObj->Add(h);\r
2745   \r
2746   // \r
2747   fRecMCTrackHist1->GetAxis(1)->SetRange(1,fRecMCTrackHist1->GetAxis(1)->GetNbins()); \r
2748 \r
2749   h2F = (TH2F*)fRecMCTrackHist1->Projection(2,1);\r
2750   h = AlidNdPtHelper::MakeResol(h2F,1,0,kTRUE,10);\r
2751   h->SetXTitle("#eta_{mc}");\r
2752   h->SetYTitle("(p_{t}-p_{tmc})/p_{tmc} resolution");\r
2753   h->Draw();\r
2754   h->SetName("pt_resolution_vs_mceta");\r
2755   aFolderObj->Add(h);\r
2756 \r
2757   h2F = (TH2F*)fRecMCTrackHist1->Projection(2,1);\r
2758   h = AlidNdPtHelper::MakeResol(h2F,1,1,kTRUE,10);\r
2759   h->SetXTitle("#eta_{mc}");\r
2760   h->SetYTitle("(p_{t}-p_{tmc})/p_{tmc} mean");\r
2761   h->Draw();\r
2762   h->SetName("dpt_mean_vs_mceta");\r
2763   aFolderObj->Add(h);\r
2764 \r
2765   //\r
2766   h2F = (TH2F*)fRecMCTrackHist1->Projection(3,1);\r
2767   h = AlidNdPtHelper::MakeResol(h2F,1,0,kTRUE,10);\r
2768   h->SetXTitle("#eta_{mc}");\r
2769   h->SetYTitle("(#eta-#eta_{mc}) resolution");\r
2770   h->Draw();\r
2771   h->SetName("eta_resolution_vs_mceta");\r
2772   aFolderObj->Add(h);\r
2773 \r
2774   h2F = (TH2F*)fRecMCTrackHist1->Projection(3,1);\r
2775   h = AlidNdPtHelper::MakeResol(h2F,1,1,kTRUE,10);\r
2776   h->SetXTitle("#eta_{mc}");\r
2777   h->SetYTitle("(#eta-mc#eta) mean");\r
2778   h->Draw();\r
2779   h->SetName("deta_mean_vs_mceta");\r
2780   aFolderObj->Add(h);\r
2781 \r
2782   fRecMCTrackHist1->GetAxis(0)->SetRange(1,fRecMCTrackHist1->GetAxis(0)->GetNbins()); \r
2783 \r
2784   } // end use MC info\r
2785 \r
2786   // export objects to analysis folder\r
2787   fAnalysisFolder = ExportToFolder(aFolderObj);\r
2788 \r
2789   // delete only TObjArray\r
2790   if(aFolderObj) delete aFolderObj;\r
2791 }\r
2792 \r
2793 //_____________________________________________________________________________\r
2794 TFolder* AlidNdPtAnalysis::ExportToFolder(TObjArray * const array) \r
2795 {\r
2796   // recreate folder avery time and export objects to new one\r
2797   //\r
2798   AlidNdPtAnalysis * comp=this;\r
2799   TFolder *folder = comp->GetAnalysisFolder();\r
2800 \r
2801   TString name, title;\r
2802   TFolder *newFolder = 0;\r
2803   Int_t i = 0;\r
2804   Int_t size = array->GetSize();\r
2805 \r
2806   if(folder) { \r
2807      // get name and title from old folder\r
2808      name = folder->GetName();  \r
2809      title = folder->GetTitle();  \r
2810 \r
2811          // delete old one\r
2812      delete folder;\r
2813 \r
2814          // create new one\r
2815      newFolder = CreateFolder(name.Data(),title.Data());\r
2816      newFolder->SetOwner();\r
2817 \r
2818          // add objects to folder\r
2819      while(i < size) {\r
2820            newFolder->Add(array->At(i));\r
2821            i++;\r
2822          }\r
2823   }\r
2824 \r
2825 return newFolder;\r
2826 }\r
2827 \r
2828 //_____________________________________________________________________________\r
2829 TFolder* AlidNdPtAnalysis::CreateFolder(TString name,TString title) { \r
2830 // create folder for analysed histograms\r
2831 //\r
2832 TFolder *folder = 0;\r
2833   folder = new TFolder(name.Data(),title.Data());\r
2834 \r
2835   return folder;\r
2836 }\r