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