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