new functionality and data memebers added
[u/mrichter/AliRoot.git] / PWG0 / dNdPt / AlidNdPtCorrection.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 // AlidNdPtCorrection class:\r
17 //\r
18 // a. functionality:\r
19 // - applies corrections on dNdPt spectra\r
20 // - fills corrected dNdPt histograms\r
21 // - fills correction control histograms \r
22 //\r
23 // b. data members:\r
24 // - dNdPt spectra before and after correction procedure\r
25 // - control histograms\r
26 // - correction matrices (must be loaded)\r
27 // \r
28 // Author: J.Otwinowski 04/11/2008 \r
29 //------------------------------------------------------------------------------\r
30 \r
31 #include "TFile.h"\r
32 #include "TH1.h"\r
33 #include "TH2.h"\r
34 \r
35 #include "AliHeader.h"  \r
36 #include "AliGenEventHeader.h"  \r
37 #include "AliStack.h"  \r
38 #include "AliESDEvent.h"  \r
39 #include "AliMCEvent.h"  \r
40 #include "AliESDtrackCuts.h"  \r
41 #include "AliLog.h" \r
42 #include "AliMultiplicity.h"\r
43 #include "AliTracker.h"\r
44 \r
45 #include "AlidNdPtEventCuts.h"\r
46 #include "AlidNdPtAcceptanceCuts.h"\r
47 #include "AliPhysicsSelection.h"\r
48 \r
49 #include "AliPWG0Helper.h"\r
50 #include "AlidNdPtHelper.h"\r
51 #include "AlidNdPtCorrection.h"\r
52 \r
53 using namespace std;\r
54 \r
55 ClassImp(AlidNdPtCorrection)\r
56 \r
57 //_____________________________________________________________________________\r
58 //AlidNdPtCorrection::AlidNdPtCorrection(): TNamed(),\r
59   AlidNdPtCorrection::AlidNdPtCorrection(): AlidNdPt(),\r
60   fCorrectionFolder(0),\r
61   fMCEventHist1(0),\r
62   fRecEventHist1(0),\r
63   fMCAllEventMultHist1(0),\r
64   fMCAllNDEventMultHist1(0),\r
65   fMCAllNSDEventMultHist1(0),\r
66   fMCTriggerMultHist1(0),\r
67   fMCEventMultHist1(0),\r
68   fMCAllPrimTrackMultHist1(0),\r
69   fMCNDEventAllPrimTrackMultHist1(0),\r
70   fMCNSDEventAllPrimTrackMultHist1(0),\r
71   fMCTriggerPrimTrackMultHist1(0),\r
72   fMCEventPrimTrackMultHist1(0),\r
73   fMCAllPrimTrackTrueMultHist1(0),\r
74   fMCNDEventAllPrimTrackTrueMultHist1(0),\r
75   fMCNSDEventAllPrimTrackTrueMultHist1(0),\r
76   fMCTriggerPrimTrackTrueMultHist1(0),\r
77   fMCEventPrimTrackTrueMultHist1(0),\r
78   fMCAllPrimTrackMeanPtMult1(0),\r
79   fMCNDEventAllPrimTrackMeanPtMult1(0),\r
80   fMCNSDEventAllPrimTrackMeanPtMult1(0),\r
81   fMCTriggerPrimTrackMeanPtMult1(0),\r
82   fMCEventPrimTrackMeanPtMult1(0),\r
83   fMCAllPrimTrackMeanPtTrueMult1(0),\r
84   fMCNDEventAllPrimTrackMeanPtTrueMult1(0),\r
85   fMCNSDEventAllPrimTrackMeanPtTrueMult1(0),\r
86   fMCTriggerPrimTrackMeanPtTrueMult1(0),\r
87   fMCEventPrimTrackMeanPtTrueMult1(0),\r
88   fEventMultCorrelationMatrix(0),\r
89   fZvNorm(0),\r
90   fZvEmptyEventsNorm(0),\r
91   fCorrTriggerMBtoInelEventMatrix(0),\r
92   fCorrTriggerMBtoNDEventMatrix(0),\r
93   fCorrTriggerMBtoNSDEventMatrix(0),\r
94   fCorrEventMatrix(0),\r
95   fCorrTriggerMBtoInelTrackEventMatrix(0),\r
96   fCorrTriggerMBtoNDTrackEventMatrix(0),\r
97   fCorrTriggerMBtoNSDTrackEventMatrix(0),\r
98   fCorrTrackEventMatrix(0),\r
99   fCorrTrackMatrix(0),\r
100   fCorrHighPtTrackMatrix(0),\r
101   fContTrackMatrix(0),\r
102   fContMultTrackMatrix(0),\r
103   fCorrMatrixFileName(""),\r
104   fCosmicsHisto(0)\r
105 {\r
106   // default constructor\r
107   for(Int_t i=0; i<AlidNdPtHelper::kCutSteps; i++) { \r
108     fRecTrackHist1[i]=0;     \r
109   }\r
110 \r
111   for(Int_t i=0; i<8; i++) { \r
112     fCorrRecTrackMultHist1[i] = 0;\r
113     fCorrRecTrackTrueMultHist1[i] = 0;\r
114     fCorrRecTrackMeanPtMultHist1[i] = 0;\r
115     fCorrRecTrackMeanPtTrueMultHist1[i] = 0;\r
116     fCorrRecTrackPt1[i] = 0;\r
117   }\r
118 \r
119   for(Int_t i=0; i<5; i++) { \r
120     fCorrRecEventHist1[i] = 0;\r
121     fCorrRecEventHist2[i] = 0;\r
122   }\r
123 \r
124   Init();\r
125 }\r
126 \r
127 //_____________________________________________________________________________\r
128 AlidNdPtCorrection::AlidNdPtCorrection(Char_t* name, Char_t* title, TString corrMatrixFileName): AlidNdPt(name,title),\r
129   fCorrectionFolder(0),\r
130   fMCEventHist1(0),\r
131   fRecEventHist1(0),\r
132   fMCAllEventMultHist1(0),\r
133   fMCAllNDEventMultHist1(0),\r
134   fMCAllNSDEventMultHist1(0),\r
135   fMCTriggerMultHist1(0),\r
136   fMCEventMultHist1(0),\r
137   fMCAllPrimTrackMultHist1(0),\r
138   fMCNDEventAllPrimTrackMultHist1(0),\r
139   fMCNSDEventAllPrimTrackMultHist1(0),\r
140   fMCTriggerPrimTrackMultHist1(0),\r
141   fMCEventPrimTrackMultHist1(0),\r
142   fMCAllPrimTrackTrueMultHist1(0),\r
143   fMCNDEventAllPrimTrackTrueMultHist1(0),\r
144   fMCNSDEventAllPrimTrackTrueMultHist1(0),\r
145   fMCTriggerPrimTrackTrueMultHist1(0),\r
146   fMCEventPrimTrackTrueMultHist1(0),\r
147   fMCAllPrimTrackMeanPtMult1(0),\r
148   fMCNDEventAllPrimTrackMeanPtMult1(0),\r
149   fMCNSDEventAllPrimTrackMeanPtMult1(0),\r
150   fMCTriggerPrimTrackMeanPtMult1(0),\r
151   fMCEventPrimTrackMeanPtMult1(0),\r
152   fMCAllPrimTrackMeanPtTrueMult1(0),\r
153   fMCNDEventAllPrimTrackMeanPtTrueMult1(0),\r
154   fMCNSDEventAllPrimTrackMeanPtTrueMult1(0),\r
155   fMCTriggerPrimTrackMeanPtTrueMult1(0),\r
156   fMCEventPrimTrackMeanPtTrueMult1(0),\r
157   fEventMultCorrelationMatrix(0),\r
158   fZvNorm(0),\r
159   fZvEmptyEventsNorm(0),\r
160   fCorrTriggerMBtoInelEventMatrix(0),\r
161   fCorrTriggerMBtoNDEventMatrix(0),\r
162   fCorrTriggerMBtoNSDEventMatrix(0),\r
163   fCorrEventMatrix(0),\r
164   fCorrTriggerMBtoInelTrackEventMatrix(0),\r
165   fCorrTriggerMBtoNDTrackEventMatrix(0),\r
166   fCorrTriggerMBtoNSDTrackEventMatrix(0),\r
167   fCorrTrackEventMatrix(0),\r
168   fCorrTrackMatrix(0),\r
169   fCorrHighPtTrackMatrix(0),\r
170   fContTrackMatrix(0),\r
171   fContMultTrackMatrix(0),\r
172   fCorrMatrixFileName(corrMatrixFileName),\r
173   fCosmicsHisto(0)\r
174 {\r
175   // constructor\r
176   for(Int_t i=0; i<AlidNdPtHelper::kCutSteps; i++) { \r
177     fRecTrackHist1[i]=0;     \r
178   }\r
179 \r
180   for(Int_t i=0; i<8; i++) { \r
181     fCorrRecTrackMultHist1[i] = 0;\r
182     fCorrRecTrackTrueMultHist1[i] = 0;\r
183     fCorrRecTrackMeanPtMultHist1[i] = 0;\r
184     fCorrRecTrackMeanPtTrueMultHist1[i] = 0;\r
185     fCorrRecTrackPt1[i] = 0;\r
186   }\r
187 \r
188   for(Int_t i=0; i<5; i++) { \r
189     fCorrRecEventHist1[i] = 0;\r
190     fCorrRecEventHist2[i] = 0;\r
191   }\r
192 \r
193   Init();\r
194 }\r
195 \r
196 //_____________________________________________________________________________\r
197 AlidNdPtCorrection::~AlidNdPtCorrection() {\r
198   // \r
199   // destructor\r
200   //\r
201   if(fMCEventHist1) delete fMCEventHist1; fMCEventHist1=0;\r
202   if(fRecEventHist1) delete fRecEventHist1; fRecEventHist1=0;\r
203 \r
204   if(fMCAllEventMultHist1) delete fMCAllEventMultHist1; fMCAllEventMultHist1=0;\r
205   if(fMCAllNDEventMultHist1) delete fMCAllNDEventMultHist1; fMCAllNDEventMultHist1=0;\r
206   if(fMCAllNSDEventMultHist1) delete fMCAllNSDEventMultHist1; fMCAllNSDEventMultHist1=0;\r
207   if(fMCTriggerMultHist1) delete fMCTriggerMultHist1; fMCTriggerMultHist1=0;\r
208   if(fMCEventMultHist1) delete fMCEventMultHist1; fMCEventMultHist1=0;\r
209 \r
210   if(fMCAllPrimTrackMultHist1) delete fMCAllPrimTrackMultHist1; fMCAllPrimTrackMultHist1=0;\r
211   if(fMCNDEventAllPrimTrackMultHist1) delete fMCNDEventAllPrimTrackMultHist1; fMCNDEventAllPrimTrackMultHist1=0;\r
212   if(fMCNSDEventAllPrimTrackMultHist1) delete fMCNSDEventAllPrimTrackMultHist1; fMCNSDEventAllPrimTrackMultHist1=0;\r
213   if(fMCTriggerPrimTrackMultHist1) delete fMCTriggerPrimTrackMultHist1; fMCTriggerPrimTrackMultHist1=0;\r
214   if(fMCEventPrimTrackMultHist1) delete fMCEventPrimTrackMultHist1; fMCEventPrimTrackMultHist1=0;\r
215 \r
216   if(fMCAllPrimTrackTrueMultHist1) delete fMCAllPrimTrackTrueMultHist1; fMCAllPrimTrackTrueMultHist1=0;\r
217   if(fMCNDEventAllPrimTrackTrueMultHist1) delete fMCNDEventAllPrimTrackTrueMultHist1; fMCNDEventAllPrimTrackTrueMultHist1=0;\r
218   if(fMCNSDEventAllPrimTrackTrueMultHist1) delete fMCNSDEventAllPrimTrackTrueMultHist1; fMCNSDEventAllPrimTrackTrueMultHist1=0;\r
219   if(fMCTriggerPrimTrackTrueMultHist1) delete fMCTriggerPrimTrackTrueMultHist1; fMCTriggerPrimTrackTrueMultHist1=0;\r
220   if(fMCEventPrimTrackTrueMultHist1) delete fMCEventPrimTrackTrueMultHist1; fMCEventPrimTrackTrueMultHist1=0;\r
221 \r
222   if(fMCAllPrimTrackMeanPtMult1) delete fMCAllPrimTrackMeanPtMult1; fMCAllPrimTrackMeanPtMult1=0;\r
223   if(fMCNDEventAllPrimTrackMeanPtMult1) delete fMCNDEventAllPrimTrackMeanPtMult1; fMCNDEventAllPrimTrackMeanPtMult1=0;\r
224   if(fMCNSDEventAllPrimTrackMeanPtMult1) delete fMCNSDEventAllPrimTrackMeanPtMult1; fMCNSDEventAllPrimTrackMeanPtMult1=0;\r
225   if(fMCTriggerPrimTrackMeanPtMult1) delete fMCTriggerPrimTrackMeanPtMult1; fMCTriggerPrimTrackMeanPtMult1=0;\r
226   if(fMCEventPrimTrackMeanPtMult1) delete fMCEventPrimTrackMeanPtMult1; fMCEventPrimTrackMeanPtMult1=0;\r
227 \r
228   if(fMCAllPrimTrackMeanPtTrueMult1) delete fMCAllPrimTrackMeanPtTrueMult1; fMCAllPrimTrackMeanPtTrueMult1=0;\r
229   if(fMCNDEventAllPrimTrackMeanPtTrueMult1) delete fMCNDEventAllPrimTrackMeanPtTrueMult1; fMCNDEventAllPrimTrackMeanPtTrueMult1=0;\r
230   if(fMCNSDEventAllPrimTrackMeanPtTrueMult1) delete fMCNSDEventAllPrimTrackMeanPtTrueMult1; fMCNSDEventAllPrimTrackMeanPtTrueMult1=0;\r
231   if(fMCTriggerPrimTrackMeanPtTrueMult1) delete fMCTriggerPrimTrackMeanPtTrueMult1; fMCTriggerPrimTrackMeanPtTrueMult1=0;\r
232   if(fMCEventPrimTrackMeanPtTrueMult1) delete fMCEventPrimTrackMeanPtTrueMult1; fMCEventPrimTrackMeanPtTrueMult1=0;\r
233 \r
234   if(fCosmicsHisto) delete fCosmicsHisto; fCosmicsHisto=0;\r
235 \r
236   for(Int_t i=0; i<AlidNdPtHelper::kCutSteps; i++) { \r
237     if(fRecTrackHist1[i]) delete fRecTrackHist1[i]; fRecTrackHist1[i]=0;\r
238   }\r
239 \r
240   for(Int_t i=0; i<8; i++) { \r
241     if(fCorrRecTrackMultHist1[i]) delete fCorrRecTrackMultHist1[i]; fCorrRecTrackMultHist1[i]=0;\r
242     if(fCorrRecTrackTrueMultHist1[i]) delete fCorrRecTrackTrueMultHist1[i]; fCorrRecTrackTrueMultHist1[i]=0;\r
243     if(fCorrRecTrackMeanPtMultHist1[i]) delete fCorrRecTrackMeanPtMultHist1[i]; fCorrRecTrackMeanPtMultHist1[i]=0;\r
244     if(fCorrRecTrackMeanPtTrueMultHist1[i]) delete fCorrRecTrackMeanPtTrueMultHist1[i]; fCorrRecTrackMeanPtTrueMultHist1[i]=0;\r
245     if(fCorrRecTrackPt1[i]) delete fCorrRecTrackPt1[i]; fCorrRecTrackPt1[i]=0;\r
246   }\r
247 \r
248   for(Int_t i=0; i<5; i++) { \r
249     if(fCorrRecEventHist1[i]) delete fCorrRecEventHist1[i]; fCorrRecEventHist1[i]=0;\r
250     if(fCorrRecEventHist2[i]) delete fCorrRecEventHist2[i]; fCorrRecEventHist2[i]=0;\r
251   }\r
252 \r
253   if(fCorrectionFolder) delete fCorrectionFolder; fCorrectionFolder=0;\r
254 }\r
255 \r
256 //_____________________________________________________________________________\r
257 void AlidNdPtCorrection::Init(){\r
258   //\r
259   // Init histograms\r
260   //\r
261   const Int_t etaNbins = 30; \r
262   const Int_t zvNbins = 12;\r
263 \r
264   // UA1 bining\r
265   //const Int_t ptNbins = 52; \r
266   //Double_t binsPt[ptNbins+1] = { 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90, 1.00, 1.10, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.10, 2.20, 2.30, 2.40, 2.50, 2.60, 2.70, 2.80, 2.90, 3.00, 3.10, 3.20, 3.30, 3.40, 3.50, 3.60, 3.70, 3.80, 3.90, 4.00, 4.20, 4.40, 4.60, 4.80, 5.00, 5.20, 5.40, 5.60, 5.80, 6.00, 7.00, 7.60, 8.80, 9.60 }; \r
267 \r
268   const Int_t ptNbins = 56; \r
269   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
270   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
271   Double_t binsZv[zvNbins+1] = {-30.,-25.,-20.,-15.,-10.,-5.,0.,5.,10.,15.,20.,25.,30.};\r
272 \r
273 \r
274   //\r
275   Int_t binsMCEventHist1[3]={100,100,140};\r
276   Double_t minMCEventHist1[3]={-0.1,-0.1,-35.}; \r
277   Double_t maxMCEventHist1[3]={0.1,0.1,35.}; \r
278   fMCEventHist1 = new THnSparseF("fMCEventHist1","mcXv:mcYv:mcZv",3,binsMCEventHist1,minMCEventHist1,maxMCEventHist1);\r
279   fMCEventHist1->GetAxis(0)->SetTitle("mcXv (cm)");\r
280   fMCEventHist1->GetAxis(1)->SetTitle("mcYv (cm)");\r
281   fMCEventHist1->GetAxis(2)->SetTitle("mcZv (cm)");\r
282   fMCEventHist1->Sumw2();\r
283 \r
284   //\r
285   Int_t binsRecEventHist1[3]={100,100,140};\r
286   Double_t minRecEventHist1[3]={-3.,-3.,-35.}; \r
287   Double_t maxRecEventHist1[3]={3.,3.,35.}; \r
288   fRecEventHist1 = new THnSparseF("fRecEventHist1","Xv:Yv:Zv",3,binsRecEventHist1,minRecEventHist1,maxRecEventHist1);\r
289   fRecEventHist1->GetAxis(0)->SetTitle("Xv (cm)");\r
290   fRecEventHist1->GetAxis(1)->SetTitle("Yv (cm)");\r
291   fRecEventHist1->GetAxis(2)->SetTitle("Zv (cm)");\r
292   fRecEventHist1->Sumw2();\r
293 \r
294   //\r
295   char name[256];\r
296   char title[256];\r
297 \r
298   Int_t binsMCAllPrimTrackMultHist1[3]={ptNbins,etaNbins,150};\r
299   Double_t minMCAllPrimTrackMultHist1[3]={0.,-1.,-0.5}; \r
300   Double_t maxMCAllPrimTrackMultHist1[3]={20.,1.,149.5}; \r
301   sprintf(name,"fMCAllPrimTrackMultHist1");\r
302   sprintf(title,"mcPt:mcEta:multiplicity");\r
303   \r
304   fMCAllPrimTrackMultHist1 = new THnSparseF(name,title,3,binsMCAllPrimTrackMultHist1,minMCAllPrimTrackMultHist1,maxMCAllPrimTrackMultHist1);\r
305   fMCAllPrimTrackMultHist1->SetBinEdges(0,binsPt);\r
306   fMCAllPrimTrackMultHist1->SetBinEdges(1,binsEta);\r
307   fMCAllPrimTrackMultHist1->GetAxis(0)->SetTitle("mcPt (GeV/c)");\r
308   fMCAllPrimTrackMultHist1->GetAxis(1)->SetTitle("mcEta");\r
309   fMCAllPrimTrackMultHist1->GetAxis(2)->SetTitle("multiplicity");\r
310   fMCAllPrimTrackMultHist1->Sumw2();\r
311 \r
312   Int_t binsMCNDEventAllPrimTrackMultHist1[3]={ptNbins,etaNbins,150};\r
313   Double_t minMCNDEventAllPrimTrackMultHist1[3]={0.,-1.,-0.5}; \r
314   Double_t maxMCNDEventAllPrimTrackMultHist1[3]={20.,1.,149.5}; \r
315   sprintf(name,"fMCNDEventAllPrimTrackMultHist1");\r
316   sprintf(title,"mcPt:mcEta:multiplicity");\r
317   \r
318   fMCNDEventAllPrimTrackMultHist1 = new THnSparseF(name,title,3,binsMCNDEventAllPrimTrackMultHist1,minMCNDEventAllPrimTrackMultHist1,maxMCNDEventAllPrimTrackMultHist1);\r
319   fMCNDEventAllPrimTrackMultHist1->SetBinEdges(0,binsPt);\r
320   fMCNDEventAllPrimTrackMultHist1->SetBinEdges(1,binsEta);\r
321   fMCNDEventAllPrimTrackMultHist1->GetAxis(0)->SetTitle("mcPt (GeV/c)");\r
322   fMCNDEventAllPrimTrackMultHist1->GetAxis(1)->SetTitle("mcEta");\r
323   fMCNDEventAllPrimTrackMultHist1->GetAxis(2)->SetTitle("multiplicity");\r
324   fMCNDEventAllPrimTrackMultHist1->Sumw2();\r
325 \r
326   Int_t binsMCNSDEventAllPrimTrackMultHist1[3]={ptNbins,etaNbins,150};\r
327   Double_t minMCNSDEventAllPrimTrackMultHist1[3]={0.,-1.,-0.5}; \r
328   Double_t maxMCNSDEventAllPrimTrackMultHist1[3]={20.,1.,149.5}; \r
329   sprintf(name,"fMCNSDEventAllPrimTrackMultHist1");\r
330   sprintf(title,"mcPt:mcEta:multiplicity");\r
331   \r
332   fMCNSDEventAllPrimTrackMultHist1 = new THnSparseF(name,title,3,binsMCNSDEventAllPrimTrackMultHist1,minMCNSDEventAllPrimTrackMultHist1,maxMCNSDEventAllPrimTrackMultHist1);\r
333   fMCNSDEventAllPrimTrackMultHist1->SetBinEdges(0,binsPt);\r
334   fMCNSDEventAllPrimTrackMultHist1->SetBinEdges(1,binsEta);\r
335   fMCNSDEventAllPrimTrackMultHist1->GetAxis(0)->SetTitle("mcPt (GeV/c)");\r
336   fMCNSDEventAllPrimTrackMultHist1->GetAxis(1)->SetTitle("mcEta");\r
337   fMCNSDEventAllPrimTrackMultHist1->GetAxis(2)->SetTitle("multiplicity");\r
338   fMCNSDEventAllPrimTrackMultHist1->Sumw2();\r
339 \r
340   Int_t binsMCEventTriggerPrimTrackMultHist1[3]={ptNbins,etaNbins,150};\r
341   Double_t minMCEventTriggerPrimTrackMultHist1[3]={0.,-1.,-0.5}; \r
342   Double_t maxMCEventTriggerPrimTrackMultHist1[3]={20.,1.,149.5}; \r
343   sprintf(name,"fMCTriggerPrimTrackMultHist1");\r
344   sprintf(title,"mcPt:mcEta:multiplicity");\r
345   \r
346   fMCTriggerPrimTrackMultHist1 = new THnSparseF(name,title,3,binsMCEventTriggerPrimTrackMultHist1,minMCEventTriggerPrimTrackMultHist1,maxMCEventTriggerPrimTrackMultHist1);\r
347   fMCTriggerPrimTrackMultHist1->SetBinEdges(0,binsPt);\r
348   fMCTriggerPrimTrackMultHist1->SetBinEdges(1,binsEta);\r
349   fMCTriggerPrimTrackMultHist1->GetAxis(0)->SetTitle("mcPt (GeV/c)");\r
350   fMCTriggerPrimTrackMultHist1->GetAxis(1)->SetTitle("mcEta");\r
351   fMCTriggerPrimTrackMultHist1->GetAxis(2)->SetTitle("multiplicity");\r
352   fMCTriggerPrimTrackMultHist1->Sumw2();\r
353 \r
354   Int_t binsMCEventPrimTrackMultHist1[3]={ptNbins,etaNbins,150};\r
355   Double_t minMCEventPrimTrackMultHist1[3]={0.,-1.,-0.5}; \r
356   Double_t maxMCEventPrimTrackMultHist1[3]={20.,1.,149.5}; \r
357   sprintf(name,"fMCEventPrimTrackMultHist1");\r
358   sprintf(title,"mcPt:mcEta:multiplicity");\r
359   \r
360   fMCEventPrimTrackMultHist1 = new THnSparseF(name,title,3,binsMCEventPrimTrackMultHist1,minMCEventPrimTrackMultHist1,maxMCEventPrimTrackMultHist1);\r
361   fMCEventPrimTrackMultHist1->SetBinEdges(0,binsPt);\r
362   fMCEventPrimTrackMultHist1->SetBinEdges(1,binsEta);\r
363   fMCEventPrimTrackMultHist1->GetAxis(0)->SetTitle("mcPt (GeV/c)");\r
364   fMCEventPrimTrackMultHist1->GetAxis(1)->SetTitle("mcEta");\r
365   fMCEventPrimTrackMultHist1->GetAxis(2)->SetTitle("multiplicity");\r
366   fMCEventPrimTrackMultHist1->Sumw2();\r
367 \r
368   //\r
369   // true multiplicity\r
370   //\r
371 \r
372   Int_t binsMCAllPrimTrackTrueMultHist1[3]={ptNbins,etaNbins,150};\r
373   Double_t minMCAllPrimTrackTrueMultHist1[3]={0.,-1.,-0.5}; \r
374   Double_t maxMCAllPrimTrackTrueMultHist1[3]={20.,1.,149.5}; \r
375   sprintf(name,"fMCAllPrimTrackTrueMultHist1");\r
376   sprintf(title,"mcPt:mcEta:true_mult");\r
377   \r
378   fMCAllPrimTrackTrueMultHist1 = new THnSparseF(name,title,3,binsMCAllPrimTrackTrueMultHist1,minMCAllPrimTrackTrueMultHist1,maxMCAllPrimTrackTrueMultHist1);\r
379   fMCAllPrimTrackTrueMultHist1->SetBinEdges(0,binsPt);\r
380   fMCAllPrimTrackTrueMultHist1->SetBinEdges(1,binsEta);\r
381   fMCAllPrimTrackTrueMultHist1->GetAxis(0)->SetTitle("mcPt (GeV/c)");\r
382   fMCAllPrimTrackTrueMultHist1->GetAxis(1)->SetTitle("mcEta");\r
383   fMCAllPrimTrackTrueMultHist1->GetAxis(2)->SetTitle("true_mult");\r
384   fMCAllPrimTrackTrueMultHist1->Sumw2();\r
385 \r
386   Int_t binsMCNDEventAllPrimTrackTrueMultHist1[3]={ptNbins,etaNbins,150};\r
387   Double_t minMCNDEventAllPrimTrackTrueMultHist1[3]={0.,-1.,-0.5}; \r
388   Double_t maxMCNDEventAllPrimTrackTrueMultHist1[3]={20.,1.,149.5}; \r
389   sprintf(name,"fMCNDEventAllPrimTrackTrueMultHist1");\r
390   sprintf(title,"mcPt:mcEta:true_mult");\r
391   \r
392   fMCNDEventAllPrimTrackTrueMultHist1 = new THnSparseF(name,title,3,binsMCNDEventAllPrimTrackTrueMultHist1,minMCNDEventAllPrimTrackTrueMultHist1,maxMCNDEventAllPrimTrackTrueMultHist1);\r
393   fMCNDEventAllPrimTrackTrueMultHist1->SetBinEdges(0,binsPt);\r
394   fMCNDEventAllPrimTrackTrueMultHist1->SetBinEdges(1,binsEta);\r
395   fMCNDEventAllPrimTrackTrueMultHist1->GetAxis(0)->SetTitle("mcPt (GeV/c)");\r
396   fMCNDEventAllPrimTrackTrueMultHist1->GetAxis(1)->SetTitle("mcEta");\r
397   fMCNDEventAllPrimTrackTrueMultHist1->GetAxis(2)->SetTitle("true_mult");\r
398   fMCNDEventAllPrimTrackTrueMultHist1->Sumw2();\r
399 \r
400   Int_t binsMCNSDEventAllPrimTrackTrueMultHist1[3]={ptNbins,etaNbins,150};\r
401   Double_t minMCNSDEventAllPrimTrackTrueMultHist1[3]={0.,-1.,-0.5}; \r
402   Double_t maxMCNSDEventAllPrimTrackTrueMultHist1[3]={20.,1.,149.5}; \r
403   sprintf(name,"fMCNSDEventAllPrimTrackTrueMultHist1");\r
404   sprintf(title,"mcPt:mcEta:true_mult");\r
405   \r
406   fMCNSDEventAllPrimTrackTrueMultHist1 = new THnSparseF(name,title,3,binsMCNSDEventAllPrimTrackTrueMultHist1,minMCNSDEventAllPrimTrackTrueMultHist1,maxMCNSDEventAllPrimTrackTrueMultHist1);\r
407   fMCNSDEventAllPrimTrackTrueMultHist1->SetBinEdges(0,binsPt);\r
408   fMCNSDEventAllPrimTrackTrueMultHist1->SetBinEdges(1,binsEta);\r
409   fMCNSDEventAllPrimTrackTrueMultHist1->GetAxis(0)->SetTitle("mcPt (GeV/c)");\r
410   fMCNSDEventAllPrimTrackTrueMultHist1->GetAxis(1)->SetTitle("mcEta");\r
411   fMCNSDEventAllPrimTrackTrueMultHist1->GetAxis(2)->SetTitle("true_mult");\r
412   fMCNSDEventAllPrimTrackTrueMultHist1->Sumw2();\r
413 \r
414   Int_t binsMCEventTriggerPrimTrackTrueMultHist1[3]={ptNbins,etaNbins,150};\r
415   Double_t minMCEventTriggerPrimTrackTrueMultHist1[3]={0.,-1.,-0.5}; \r
416   Double_t maxMCEventTriggerPrimTrackTrueMultHist1[3]={20.,1.,149.5}; \r
417   sprintf(name,"fMCTriggerPrimTrackTrueMultHist1");\r
418   sprintf(title,"mcPt:mcEta:true_mult");\r
419   \r
420   fMCTriggerPrimTrackTrueMultHist1 = new THnSparseF(name,title,3,binsMCEventTriggerPrimTrackTrueMultHist1,minMCEventTriggerPrimTrackTrueMultHist1,maxMCEventTriggerPrimTrackTrueMultHist1);\r
421   fMCTriggerPrimTrackTrueMultHist1->SetBinEdges(0,binsPt);\r
422   fMCTriggerPrimTrackTrueMultHist1->SetBinEdges(1,binsEta);\r
423   fMCTriggerPrimTrackTrueMultHist1->GetAxis(0)->SetTitle("mcPt (GeV/c)");\r
424   fMCTriggerPrimTrackTrueMultHist1->GetAxis(1)->SetTitle("mcEta");\r
425   fMCTriggerPrimTrackTrueMultHist1->GetAxis(2)->SetTitle("true_mult");\r
426   fMCTriggerPrimTrackTrueMultHist1->Sumw2();\r
427 \r
428   Int_t binsMCEventPrimTrackTrueMultHist1[3]={ptNbins,etaNbins,150};\r
429   Double_t minMCEventPrimTrackTrueMultHist1[3]={0.,-1.,-0.5}; \r
430   Double_t maxMCEventPrimTrackTrueMultHist1[3]={20.,1.,149.5}; \r
431   sprintf(name,"fMCEventPrimTrackTrueMultHist1");\r
432   sprintf(title,"mcPt:mcEta:true_mult");\r
433   \r
434   fMCEventPrimTrackTrueMultHist1 = new THnSparseF(name,title,3,binsMCEventPrimTrackTrueMultHist1,minMCEventPrimTrackTrueMultHist1,maxMCEventPrimTrackTrueMultHist1);\r
435   fMCEventPrimTrackTrueMultHist1->SetBinEdges(0,binsPt);\r
436   fMCEventPrimTrackTrueMultHist1->SetBinEdges(1,binsEta);\r
437   fMCEventPrimTrackTrueMultHist1->GetAxis(0)->SetTitle("mcPt (GeV/c)");\r
438   fMCEventPrimTrackTrueMultHist1->GetAxis(1)->SetTitle("mcEta");\r
439   fMCEventPrimTrackTrueMultHist1->GetAxis(2)->SetTitle("true_mult");\r
440   fMCEventPrimTrackTrueMultHist1->Sumw2();\r
441 \r
442   //\r
443   // mean pt\r
444   //\r
445   Int_t binsMCAllPrimTrackMeanPtTrueMult1[2]={100,150};\r
446   Double_t minMCAllPrimTrackMeanPtTrueMult1[2]={0.,-0.5}; \r
447   Double_t maxMCAllPrimTrackMeanPtTrueMult1[2]={10.,149.5}; \r
448   sprintf(name,"fMCAllPrimTrackMeanPtTrueMult1");\r
449   sprintf(title,"event <mcPt>:true_mult");\r
450   \r
451   fMCAllPrimTrackMeanPtTrueMult1 = new THnSparseF(name,title,2,binsMCAllPrimTrackMeanPtTrueMult1,minMCAllPrimTrackMeanPtTrueMult1,maxMCAllPrimTrackMeanPtTrueMult1);\r
452   fMCAllPrimTrackMeanPtTrueMult1->GetAxis(0)->SetTitle("<mcPt> (GeV/c)");\r
453   fMCAllPrimTrackMeanPtTrueMult1->GetAxis(1)->SetTitle("true_mult");\r
454   fMCAllPrimTrackMeanPtTrueMult1->Sumw2();\r
455 \r
456   Int_t binsMCAllPrimTrackMeanPtMult1[2]={100,150};\r
457   Double_t minMCAllPrimTrackMeanPtMult1[2]={0.,-0.5}; \r
458   Double_t maxMCAllPrimTrackMeanPtMult1[2]={10.,149.5}; \r
459   sprintf(name,"fMCAllPrimTrackMeanPtMult1");\r
460   sprintf(title,"event <mcPt>:mult");\r
461   \r
462   fMCAllPrimTrackMeanPtMult1 = new THnSparseF(name,title,2,binsMCAllPrimTrackMeanPtMult1,minMCAllPrimTrackMeanPtMult1,maxMCAllPrimTrackMeanPtMult1);\r
463   fMCAllPrimTrackMeanPtMult1->GetAxis(0)->SetTitle("<mcPt> (GeV/c)");\r
464   fMCAllPrimTrackMeanPtMult1->GetAxis(1)->SetTitle("multiplicity");\r
465   fMCAllPrimTrackMeanPtMult1->Sumw2();\r
466 \r
467   //\r
468   Int_t binsMCNDEventAllPrimTrackMeanPtTrueMult1[2]={100,150};\r
469   Double_t minMCNDEventAllPrimTrackMeanPtTrueMult1[2]={0.,-0.5}; \r
470   Double_t maxMCNDEventAllPrimTrackMeanPtTrueMult1[2]={10.,149.5}; \r
471   sprintf(name,"fMCNDEventAllPrimTrackMeanPtTrueMult1");\r
472   sprintf(title,"event <mcPt>:true_mult");\r
473   \r
474   fMCNDEventAllPrimTrackMeanPtTrueMult1 = new THnSparseF(name,title,2,binsMCNDEventAllPrimTrackMeanPtTrueMult1,minMCNDEventAllPrimTrackMeanPtTrueMult1,maxMCNDEventAllPrimTrackMeanPtTrueMult1);\r
475   fMCNDEventAllPrimTrackMeanPtTrueMult1->GetAxis(0)->SetTitle("<mcPt> (GeV/c)");\r
476   fMCNDEventAllPrimTrackMeanPtTrueMult1->GetAxis(1)->SetTitle("true_mult");\r
477   fMCNDEventAllPrimTrackMeanPtTrueMult1->Sumw2();\r
478 \r
479   Int_t binsMCNDEventAllPrimTrackMeanPtMult1[2]={100,150};\r
480   Double_t minMCNDEventAllPrimTrackMeanPtMult1[2]={0.,-0.5}; \r
481   Double_t maxMCNDEventAllPrimTrackMeanPtMult1[2]={10.,149.5}; \r
482   sprintf(name,"fMCNDEventAllPrimTrackMeanPtMult1");\r
483   sprintf(title,"event <mcPt>:mult");\r
484   \r
485   fMCNDEventAllPrimTrackMeanPtMult1 = new THnSparseF(name,title,2,binsMCNDEventAllPrimTrackMeanPtMult1,minMCNDEventAllPrimTrackMeanPtMult1,maxMCNDEventAllPrimTrackMeanPtMult1);\r
486   fMCNDEventAllPrimTrackMeanPtMult1->GetAxis(0)->SetTitle("<mcPt> (GeV/c)");\r
487   fMCNDEventAllPrimTrackMeanPtMult1->GetAxis(1)->SetTitle("multiplicity");\r
488   fMCNDEventAllPrimTrackMeanPtMult1->Sumw2();\r
489 \r
490   //\r
491   Int_t binsMCNSDEventAllPrimTrackMeanPtTrueMult1[2]={100,150};\r
492   Double_t minMCNSDEventAllPrimTrackMeanPtTrueMult1[2]={0.,-0.5}; \r
493   Double_t maxMCNSDEventAllPrimTrackMeanPtTrueMult1[2]={10.,149.5}; \r
494   sprintf(name,"fMCNSDEventAllPrimTrackMeanPtTrueMult1");\r
495   sprintf(title,"event <mcPt>:true_mult");\r
496   \r
497   fMCNSDEventAllPrimTrackMeanPtTrueMult1 = new THnSparseF(name,title,2,binsMCNSDEventAllPrimTrackMeanPtTrueMult1,minMCNSDEventAllPrimTrackMeanPtTrueMult1,maxMCNSDEventAllPrimTrackMeanPtTrueMult1);\r
498   fMCNSDEventAllPrimTrackMeanPtTrueMult1->GetAxis(0)->SetTitle("<mcPt> (GeV/c)");\r
499   fMCNSDEventAllPrimTrackMeanPtTrueMult1->GetAxis(1)->SetTitle("true_mult");\r
500   fMCNSDEventAllPrimTrackMeanPtTrueMult1->Sumw2();\r
501 \r
502   Int_t binsMCNSDEventAllPrimTrackMeanPtMult1[2]={100,150};\r
503   Double_t minMCNSDEventAllPrimTrackMeanPtMult1[2]={0.,-0.5}; \r
504   Double_t maxMCNSDEventAllPrimTrackMeanPtMult1[2]={10.,149.5}; \r
505   sprintf(name,"fMCNSDEventAllPrimTrackMeanPtMult1");\r
506   sprintf(title,"event <mcPt>:mult");\r
507   \r
508   fMCNSDEventAllPrimTrackMeanPtMult1 = new THnSparseF(name,title,2,binsMCNSDEventAllPrimTrackMeanPtMult1,minMCNSDEventAllPrimTrackMeanPtMult1,maxMCNSDEventAllPrimTrackMeanPtMult1);\r
509   fMCNSDEventAllPrimTrackMeanPtMult1->GetAxis(0)->SetTitle("<mcPt> (GeV/c)");\r
510   fMCNSDEventAllPrimTrackMeanPtMult1->GetAxis(1)->SetTitle("multiplicity");\r
511   fMCNSDEventAllPrimTrackMeanPtMult1->Sumw2();\r
512 \r
513   //\r
514   Int_t binsMCTriggerPrimTrackMeanPtTrueMult1[2]={100,150};\r
515   Double_t minMCTriggerPrimTrackMeanPtTrueMult1[2]={0.,-0.5}; \r
516   Double_t maxMCTriggerPrimTrackMeanPtTrueMult1[2]={10.,149.5}; \r
517   sprintf(name,"fMCTriggerPrimTrackMeanPtTrueMult1");\r
518   sprintf(title,"event <mcPt>:true_mult");\r
519   \r
520   fMCTriggerPrimTrackMeanPtTrueMult1 = new THnSparseF(name,title,2,binsMCTriggerPrimTrackMeanPtTrueMult1,minMCTriggerPrimTrackMeanPtTrueMult1,maxMCTriggerPrimTrackMeanPtTrueMult1);\r
521   fMCTriggerPrimTrackMeanPtTrueMult1->GetAxis(0)->SetTitle("<mcPt> (GeV/c)");\r
522   fMCTriggerPrimTrackMeanPtTrueMult1->GetAxis(1)->SetTitle("true_mult");\r
523   fMCTriggerPrimTrackMeanPtTrueMult1->Sumw2();\r
524 \r
525   Int_t binsMCTriggerPrimTrackMeanPtMult1[2]={100,150};\r
526   Double_t minMCTriggerPrimTrackMeanPtMult1[2]={0.,-0.5}; \r
527   Double_t maxMCTriggerPrimTrackMeanPtMult1[2]={10.,149.5}; \r
528   sprintf(name,"fMCTriggerPrimTrackMeanPtMult1");\r
529   sprintf(title,"event <mcPt>:mult");\r
530   \r
531   fMCTriggerPrimTrackMeanPtMult1 = new THnSparseF(name,title,2,binsMCTriggerPrimTrackMeanPtMult1,minMCTriggerPrimTrackMeanPtMult1,maxMCTriggerPrimTrackMeanPtMult1);\r
532   fMCTriggerPrimTrackMeanPtMult1->GetAxis(0)->SetTitle("<mcPt> (GeV/c)");\r
533   fMCTriggerPrimTrackMeanPtMult1->GetAxis(1)->SetTitle("multiplicity");\r
534   fMCTriggerPrimTrackMeanPtMult1->Sumw2();\r
535 \r
536   //\r
537   Int_t binsMCEventPrimTrackMeanPtTrueMult1[2]={100,150};\r
538   Double_t minMCEventPrimTrackMeanPtTrueMult1[2]={0.,-0.5}; \r
539   Double_t maxMCEventPrimTrackMeanPtTrueMult1[2]={10.,149.5}; \r
540   sprintf(name,"fMCEventPrimTrackMeanPtTrueMult1");\r
541   sprintf(title,"event <mcPt>:true_mult");\r
542   \r
543   fMCEventPrimTrackMeanPtTrueMult1 = new THnSparseF(name,title,2,binsMCEventPrimTrackMeanPtTrueMult1,minMCEventPrimTrackMeanPtTrueMult1,maxMCEventPrimTrackMeanPtTrueMult1);\r
544   fMCEventPrimTrackMeanPtTrueMult1->GetAxis(0)->SetTitle("<mcPt> (GeV/c)");\r
545   fMCEventPrimTrackMeanPtTrueMult1->GetAxis(1)->SetTitle("true_mult");\r
546   fMCEventPrimTrackMeanPtTrueMult1->Sumw2();\r
547 \r
548   Int_t binsMCEventPrimTrackMeanPtMult1[2]={100,150};\r
549   Double_t minMCEventPrimTrackMeanPtMult1[2]={0.,-0.5}; \r
550   Double_t maxMCEventPrimTrackMeanPtMult1[2]={10.,149.5}; \r
551   sprintf(name,"fMCEventPrimTrackMeanPtMult1");\r
552   sprintf(title,"event <mcPt>:mult");\r
553   \r
554   fMCEventPrimTrackMeanPtMult1 = new THnSparseF(name,title,2,binsMCEventPrimTrackMeanPtMult1,minMCEventPrimTrackMeanPtMult1,maxMCEventPrimTrackMeanPtMult1);\r
555   fMCEventPrimTrackMeanPtMult1->GetAxis(0)->SetTitle("<mcPt> (GeV/c)");\r
556   fMCEventPrimTrackMeanPtMult1->GetAxis(1)->SetTitle("multiplicity");\r
557   fMCEventPrimTrackMeanPtMult1->Sumw2();\r
558 \r
559 \r
560 \r
561 \r
562 \r
563 \r
564   //\r
565   for(Int_t i=0; i<AlidNdPtHelper::kCutSteps; i++) \r
566   {\r
567     // THnSparse track histograms\r
568     //\r
569     Int_t binsRecTrackHist1[3]={ptNbins,etaNbins,90};\r
570     Double_t minRecTrackHist1[3]={0.,-1.,0.}; \r
571     Double_t maxRecTrackHist1[3]={10.,1.,2.*TMath::Pi()};\r
572     sprintf(name,"fRecTrackHist1_%d",i);\r
573     sprintf(title,"Pt:Eta:Phi");\r
574   \r
575     fRecTrackHist1[i] = new THnSparseF(name,title,3,binsRecTrackHist1,minRecTrackHist1,maxRecTrackHist1);\r
576     fRecTrackHist1[i]->SetBinEdges(0,binsPt);\r
577     fRecTrackHist1[i]->SetBinEdges(1,binsEta);\r
578     fRecTrackHist1[i]->GetAxis(0)->SetTitle("Pt (GeV/c)");\r
579     fRecTrackHist1[i]->GetAxis(1)->SetTitle("Eta");\r
580     fRecTrackHist1[i]->GetAxis(2)->SetTitle("Phi (rad)");\r
581     fRecTrackHist1[i]->Sumw2();\r
582   }\r
583 \r
584   //\r
585   Int_t binsCorrRecTrackMultHist1[3]={ptNbins,etaNbins,150};\r
586   Double_t minCorrRecTrackMultHist1[3]={0.,-1.,-0.5}; \r
587   Double_t maxCorrRecTrackMultHist1[3]={20.,1.,149.5};\r
588 \r
589   Int_t binsCorrRecTrackTrueMultHist1[3]={ptNbins,etaNbins,150};\r
590   Double_t minCorrRecTrackTrueMultHist1[3]={0.,-1.,-0.5}; \r
591   Double_t maxCorrRecTrackTrueMultHist1[3]={20.,1.,149.5};\r
592 \r
593   //\r
594   Int_t binsCorrRecTrackMeanPtMultHist1[2]={100,150};\r
595   Double_t minCorrRecTrackMeanPtMultHist1[2]={0.,-0.5}; \r
596   Double_t maxCorrRecTrackMeanPtMultHist1[2]={10.,149.5};\r
597 \r
598   Int_t binsCorrRecTrackMeanPtTrueMultHist1[2]={100,150};\r
599   Double_t minCorrRecTrackMeanPtTrueMultHist1[2]={0.,-0.5}; \r
600   Double_t maxCorrRecTrackMeanPtTrueMultHist1[2]={10.,149.5};\r
601 \r
602   Int_t binsCorrRecTrackPt1[1]={200};\r
603   Double_t minCorrRecTrackPt1[1]={0.}; \r
604   Double_t maxCorrRecTrackPt1[1]={10.};\r
605 \r
606   for(Int_t i=0; i<8; i++) \r
607   {\r
608     // THnSparse track histograms\r
609     sprintf(name,"fCorrRecTrackMultHist1_%d",i);\r
610     sprintf(title,"Pt:Eta:mult");\r
611     fCorrRecTrackMultHist1[i] = new THnSparseF(name,title,3,binsCorrRecTrackMultHist1,minCorrRecTrackMultHist1,maxCorrRecTrackMultHist1);\r
612     fCorrRecTrackMultHist1[i]->SetBinEdges(0,binsPt);\r
613     fCorrRecTrackMultHist1[i]->SetBinEdges(1,binsEta);\r
614     fCorrRecTrackMultHist1[i]->GetAxis(0)->SetTitle("Pt (GeV/c)");\r
615     fCorrRecTrackMultHist1[i]->GetAxis(1)->SetTitle("Eta");\r
616     fCorrRecTrackMultHist1[i]->GetAxis(2)->SetTitle("multiplicity");\r
617     fCorrRecTrackMultHist1[i]->Sumw2();\r
618 \r
619     // THnSparse track histograms\r
620     sprintf(name,"fCorrRecTrackTrueMultHist1_%d",i);\r
621     sprintf(title,"Pt:Eta:true_mult");\r
622     fCorrRecTrackTrueMultHist1[i] = new THnSparseF(name,title,3,binsCorrRecTrackTrueMultHist1,minCorrRecTrackTrueMultHist1,maxCorrRecTrackTrueMultHist1);\r
623     fCorrRecTrackTrueMultHist1[i]->SetBinEdges(0,binsPt);\r
624     fCorrRecTrackTrueMultHist1[i]->SetBinEdges(1,binsEta);\r
625     fCorrRecTrackTrueMultHist1[i]->GetAxis(0)->SetTitle("Pt (GeV/c)");\r
626     fCorrRecTrackTrueMultHist1[i]->GetAxis(1)->SetTitle("Eta");\r
627     fCorrRecTrackTrueMultHist1[i]->GetAxis(2)->SetTitle("true multiplicity");\r
628     fCorrRecTrackTrueMultHist1[i]->Sumw2();\r
629 \r
630 \r
631     // THnSparse track histograms\r
632     sprintf(name,"fCorrRecTrackMeanPtMultHist1_%d",i);\r
633     sprintf(title,"<Pt>:mult");\r
634     fCorrRecTrackMeanPtMultHist1[i] = new THnSparseF(name,title,2,binsCorrRecTrackMeanPtMultHist1,minCorrRecTrackMeanPtMultHist1,maxCorrRecTrackMeanPtMultHist1);\r
635     fCorrRecTrackMeanPtMultHist1[i]->GetAxis(0)->SetTitle("<Pt> (GeV/c)");\r
636     fCorrRecTrackMeanPtMultHist1[i]->GetAxis(1)->SetTitle("multiplicity");\r
637     fCorrRecTrackMeanPtMultHist1[i]->Sumw2();\r
638 \r
639     // THnSparse track histograms\r
640     sprintf(name,"fCorrRecTrackMeanPtTrueMultHist1_%d",i);\r
641     sprintf(title,"<Pt>:true_mult");\r
642     fCorrRecTrackMeanPtTrueMultHist1[i] = new THnSparseF(name,title,2,binsCorrRecTrackMeanPtTrueMultHist1,minCorrRecTrackMeanPtTrueMultHist1,maxCorrRecTrackMeanPtTrueMultHist1);\r
643     fCorrRecTrackMeanPtTrueMultHist1[i]->GetAxis(0)->SetTitle("<Pt> (GeV/c)");\r
644     fCorrRecTrackMeanPtTrueMultHist1[i]->GetAxis(1)->SetTitle("true multiplicity");\r
645     fCorrRecTrackMeanPtTrueMultHist1[i]->Sumw2();\r
646 \r
647     sprintf(name,"fCorrRecTrackPt1_%d",i);\r
648     sprintf(title,"pt small bining");\r
649     fCorrRecTrackPt1[i] = new THnSparseF(name,title,1,binsCorrRecTrackPt1,minCorrRecTrackPt1,maxCorrRecTrackPt1);\r
650     fCorrRecTrackPt1[i]->GetAxis(0)->SetTitle("Pt (GeV/c)");\r
651     fCorrRecTrackPt1[i]->Sumw2();\r
652 \r
653   }\r
654 \r
655   Int_t binsEventMatrix[2]={zvNbins,150};\r
656   Double_t minEventMatrix[2]={-25.,-0.5};\r
657   Double_t maxEventMatrix[2]={25.,149.5};\r
658 \r
659   fMCAllEventMultHist1 = new THnSparseF("fMCAllEventMultHist1","mcZv:mult",2,binsEventMatrix,minEventMatrix,maxEventMatrix);\r
660   fMCAllEventMultHist1->SetBinEdges(0,binsZv);\r
661   fMCAllEventMultHist1->GetAxis(0)->SetTitle("mcZv (cm)");\r
662   fMCAllEventMultHist1->GetAxis(1)->SetTitle("multiplicity");\r
663   fMCAllEventMultHist1->Sumw2();\r
664 \r
665   fMCAllNDEventMultHist1 = new THnSparseF("fMCAllNDEventMultHist1","mcZv:mult",2,binsEventMatrix,minEventMatrix,maxEventMatrix);\r
666   fMCAllNDEventMultHist1->SetBinEdges(0,binsZv);\r
667   fMCAllNDEventMultHist1->GetAxis(0)->SetTitle("mcZv (cm)");\r
668   fMCAllNDEventMultHist1->GetAxis(1)->SetTitle("multiplicity");\r
669   fMCAllNDEventMultHist1->Sumw2();\r
670 \r
671   fMCAllNSDEventMultHist1 = new THnSparseF("fMCAllNSDEventMultHist1","mcZv:mult",2,binsEventMatrix,minEventMatrix,maxEventMatrix);\r
672   fMCAllNSDEventMultHist1->SetBinEdges(0,binsZv);\r
673   fMCAllNSDEventMultHist1->GetAxis(0)->SetTitle("mcZv (cm)");\r
674   fMCAllNSDEventMultHist1->GetAxis(1)->SetTitle("multiplicity");\r
675   fMCAllNSDEventMultHist1->Sumw2();\r
676 \r
677   fMCTriggerMultHist1 = new THnSparseF("fMCTriggerMultHist1","mcZv:mult",2,binsEventMatrix,minEventMatrix,maxEventMatrix);\r
678   fMCTriggerMultHist1->SetBinEdges(0,binsZv);\r
679   fMCTriggerMultHist1->GetAxis(0)->SetTitle("mcZv (cm)");\r
680   fMCTriggerMultHist1->GetAxis(1)->SetTitle("multiplicity");\r
681   fMCTriggerMultHist1->Sumw2();\r
682 \r
683   fMCEventMultHist1 = new THnSparseF("fMCEventMultHist1","mcZv:mult",2,binsEventMatrix,minEventMatrix,maxEventMatrix);\r
684   fMCEventMultHist1->SetBinEdges(0,binsZv);\r
685   fMCEventMultHist1->GetAxis(0)->SetTitle("mcZv (cm)");\r
686   fMCEventMultHist1->GetAxis(1)->SetTitle("multiplicity");\r
687   fMCEventMultHist1->Sumw2();\r
688 \r
689   for(Int_t i=0; i<5; i++) \r
690   {\r
691     // event corrected histograms\r
692     sprintf(name,"fCorrRecEventHist1_%d",i);\r
693     sprintf(title,"mcZv:mult");\r
694     fCorrRecEventHist1[i] = new THnSparseF("fCorrRecEventHist1","mcZv:mult",2,binsEventMatrix,minEventMatrix,maxEventMatrix);\r
695     fCorrRecEventHist1[i]->SetBinEdges(0,binsZv);\r
696     fCorrRecEventHist1[i]->GetAxis(0)->SetTitle("Zv (cm)");\r
697     fCorrRecEventHist1[i]->GetAxis(1)->SetTitle("multiplicity");\r
698     fCorrRecEventHist1[i]->Sumw2();\r
699 \r
700     // empty event corrected histograms\r
701     sprintf(name,"fCorrRecEventHist2_%d",i);\r
702     sprintf(title,"mcZv:mult");\r
703     fCorrRecEventHist2[i] = new THnSparseF("fCorrRecEventHist2","mcZv:mult",2,binsEventMatrix,minEventMatrix,maxEventMatrix);\r
704     fCorrRecEventHist2[i]->SetBinEdges(0,binsZv);\r
705     fCorrRecEventHist2[i]->GetAxis(0)->SetTitle("Zv (cm)");\r
706     fCorrRecEventHist2[i]->GetAxis(1)->SetTitle("multiplicity");\r
707     fCorrRecEventHist2[i]->Sumw2();\r
708   }\r
709   \r
710   //\r
711   // cosmics histo\r
712   //\r
713   Int_t binsCosmicsHisto[3]=  {151, 300, ptNbins};\r
714   Double_t minCosmicsHisto[3]={-1.5, -2.*TMath::Pi(), 0.0}; \r
715   Double_t maxCosmicsHisto[3]={ 1.5, 2.*TMath::Pi(), 16.0}; \r
716   sprintf(name,"fCosmicsHisto");\r
717   sprintf(title,"deta:dphi:pt");\r
718   \r
719   fCosmicsHisto = new THnSparseF(name,title,3,binsCosmicsHisto,minCosmicsHisto,maxCosmicsHisto);\r
720   fCosmicsHisto->SetBinEdges(2,binsPt);\r
721   fCosmicsHisto->GetAxis(0)->SetTitle("#Delta#eta");\r
722   fCosmicsHisto->GetAxis(1)->SetTitle("#Delta#phi (rad)");\r
723   fCosmicsHisto->GetAxis(2)->SetTitle("pt (GV/c)");\r
724   fCosmicsHisto->Sumw2();\r
725 \r
726   // init output folder\r
727   fCorrectionFolder = CreateFolder("folderdNdPt","Correction dNdPt Folder");\r
728 \r
729   // init correction matrices\r
730   TFile *file = (TFile *)TFile::Open(fCorrMatrixFileName.Data()); \r
731   if(!file) { \r
732     AliDebug(AliLog::kError, "file with efficiency matrices not available");\r
733     printf("file with efficiency matrices not available \n");\r
734   } else {\r
735     TFolder *folder = (TFolder *)file->FindObjectAny("folderdNdPt");\r
736     if(!folder) { \r
737       AliDebug(AliLog::kError, "file without folderdNdPt");\r
738       printf("file without folderdNdPt \n");\r
739     } else {\r
740       // rec. event mult vs true multiplicity \r
741       fEventMultCorrelationMatrix = (THnSparseF*)folder->FindObject("event_mult_correlation_matrix");\r
742       if(!fEventMultCorrelationMatrix) {\r
743          Printf("No %s matrix \n", "event_mult_correlation_matrix");\r
744       }\r
745 \r
746       //\r
747       // event level corrections (zv,mult_MB)\r
748       //\r
749  \r
750       // trigger bias correction (MBtoND) \r
751       fCorrTriggerMBtoNDEventMatrix = (THnSparseF*)folder->FindObject("zv_mult_trig_MBtoND_corr_matrix");\r
752       if(!fCorrTriggerMBtoNDEventMatrix) {\r
753          Printf("No %s matrix \n", "zv_mult_trig_MBtoND_corr_matrix");\r
754       }\r
755 \r
756       // trigger bias correction (MBtoNSD)\r
757       fCorrTriggerMBtoNSDEventMatrix = (THnSparseF*)folder->FindObject("zv_mult_trig_MBtoNSD_corr_matrix");\r
758       if(!fCorrTriggerMBtoNSDEventMatrix) {\r
759          Printf("No %s matrix \n", "zv_mult_trig_MBtoNSD_corr_matrix");\r
760       }\r
761 \r
762       // trigger bias correction (MBtoInel)\r
763       fCorrTriggerMBtoInelEventMatrix = (THnSparseF*)folder->FindObject("zv_mult_trig_MBtoInel_corr_matrix");\r
764       if(!fCorrTriggerMBtoInelEventMatrix) {\r
765          Printf("No %s matrix \n", "zv_mult_trig_MBtoInel_corr_matrix"); \r
766       }\r
767      \r
768       // vertex reconstruction efficiency correction\r
769       fCorrEventMatrix = (THnSparseF*)folder->FindObject("zv_mult_event_corr_matrix");\r
770       if(!fCorrEventMatrix) {\r
771          Printf("No %s matrix \n", "zv_mult_event_corr_matrix");\r
772       }\r
773 \r
774       //\r
775       // histogram needed for empty events corrections\r
776       //\r
777       fZvNorm = (TH1D*)folder->FindObject("zv_distribution_norm");\r
778       if(!fZvNorm) {\r
779          Printf("No %s matrix \n", "fZvNorm");\r
780       }\r
781 \r
782       fZvEmptyEventsNorm = (TH1D*)folder->FindObject("zv_empty_events_norm");\r
783       if(!fZvEmptyEventsNorm) {\r
784          Printf("No %s matrix \n", "fZvEmptyEventsNorm");\r
785       }\r
786 \r
787       //\r
788       // track-event level corrections (zv,pt,eta)\r
789       //\r
790 \r
791       // trigger bias correction (MBtoND) \r
792       fCorrTriggerMBtoNDTrackEventMatrix = (THnSparseF*)folder->FindObject("zv_pt_eta_track_trig_MBtoND_corr_matrix");\r
793       if(!fCorrTriggerMBtoNDTrackEventMatrix) {\r
794          Printf("No %s matrix \n", "zv_pt_eta_track_trig_MBtoND_corr_matrix");\r
795       }\r
796 \r
797       // trigger bias correction (MBtoNSD)\r
798       fCorrTriggerMBtoNSDTrackEventMatrix = (THnSparseF*)folder->FindObject("zv_pt_eta_track_trig_MBtoNSD_corr_matrix");\r
799       if(!fCorrTriggerMBtoNSDTrackEventMatrix) {\r
800          Printf("No %s matrix \n", "zv_pt_eta_track_trig_MBtoNSD_corr_matrix");\r
801       }\r
802 \r
803       // trigger bias correction (MBtoInel) \r
804       fCorrTriggerMBtoInelTrackEventMatrix = (THnSparseF*)folder->FindObject("zv_pt_eta_track_trig_MBtoInel_corr_matrix");\r
805       if(!fCorrTriggerMBtoInelTrackEventMatrix) {\r
806          Printf("No %s matrix \n", "zv_pt_eta_track_trig_MBtoInel_corr_matrix");\r
807       }\r
808     \r
809       // vertex reconstruction efficiency correction (zv,pt,eta)\r
810       fCorrTrackEventMatrix = (THnSparseF*)folder->FindObject("zv_pt_eta_track_event_corr_matrix");\r
811       if(!fCorrTrackEventMatrix) {\r
812          Printf("No %s matrix \n", "zv_pt_eta_track_event_corr_matrix");\r
813       }\r
814 \r
815       // track reconstruction efficiency correction (zv,pt,eta)\r
816       fCorrTrackMatrix = (THnSparseF*)folder->FindObject("zv_pt_eta_track_corr_matrix");\r
817       if(!fCorrTrackMatrix) {\r
818          Printf("No %s matrix \n", "zv_pt_eta_track_corr_matrix");\r
819       }\r
820 \r
821       // high pt track reconstruction efficiency correction (zv,pt,eta)\r
822       fCorrHighPtTrackMatrix = (THnSparseF*)folder->FindObject("zv_pt_eta_highPt_track_corr_matrix");\r
823       if(!fCorrHighPtTrackMatrix) {\r
824          Printf("No %s matrix \n", "zv_pt_eta_highPt_track_corr_matrix");\r
825       }\r
826 \r
827       // secondary tracks contamination correction (zv,pt,eta)\r
828       fContTrackMatrix = (THnSparseF*)folder->FindObject("zv_pt_eta_track_cont_matrix");\r
829       if(!fContTrackMatrix) {\r
830          Printf("No %s matrix \n", "zv_pt_eta_track_cont_matrix");\r
831       }\r
832 \r
833       // multiply reconstructed tracks correction\r
834       fContMultTrackMatrix = (THnSparseF*)folder->FindObject("zv_pt_eta_mult_track_cont_matrix");\r
835       if(!fContMultTrackMatrix) {\r
836          Printf("No %s matrix \n", "zv_pt_eta_mult_track_cont_matrix");\r
837       }\r
838     }\r
839   }\r
840 \r
841 }\r
842 \r
843 //_____________________________________________________________________________\r
844 void AlidNdPtCorrection::Process(AliESDEvent *esdEvent, AliMCEvent *mcEvent)\r
845 {\r
846   //\r
847   // Process real and/or simulated events\r
848   //\r
849   if(!esdEvent) {\r
850     AliDebug(AliLog::kError, "esdEvent not available");\r
851     return;\r
852   }\r
853 \r
854   // get selection cuts\r
855   AlidNdPtEventCuts *evtCuts = GetEventCuts(); \r
856   AlidNdPtAcceptanceCuts *accCuts = GetAcceptanceCuts(); \r
857   AliESDtrackCuts *esdTrackCuts = GetTrackCuts(); \r
858 \r
859   if(!evtCuts || !accCuts  || !esdTrackCuts) {\r
860     AliDebug(AliLog::kError, "cuts not available");\r
861     return;\r
862   }\r
863 \r
864   // trigger selection\r
865   Bool_t isEventTriggered = kTRUE;\r
866   if(evtCuts->IsTriggerRequired())  \r
867   {\r
868     AliPhysicsSelection *trigSel = GetPhysicsTriggerSelection();\r
869     if(!trigSel) {\r
870       AliDebug(AliLog::kError, "cannot get trigSel");\r
871       return;\r
872     }\r
873 \r
874     if(IsUseMCInfo()) { \r
875       //static AliTriggerAnalysis* triggerAnalysis = new AliTriggerAnalysis;\r
876       //isEventTriggered = triggerAnalysis->IsTriggerFired(esdEvent, GetTrigger());\r
877       trigSel->SetAnalyzeMC();\r
878       isEventTriggered = trigSel->IsCollisionCandidate(esdEvent);\r
879     }\r
880     else {\r
881       isEventTriggered = trigSel->IsCollisionCandidate(esdEvent);\r
882     }\r
883   }\r
884   \r
885   // use MC information\r
886   AliHeader* header = 0;\r
887   AliGenEventHeader* genHeader = 0;\r
888   AliStack* stack = 0;\r
889   TArrayF vtxMC(3);\r
890   AliPWG0Helper::MCProcessType evtType = AliPWG0Helper::kInvalidProcess;\r
891   Int_t multMCTrueTracks = 0;\r
892 \r
893   if(IsUseMCInfo())\r
894   {\r
895     if(!mcEvent) {\r
896       AliDebug(AliLog::kError, "mcEvent not available");\r
897       return;\r
898     }\r
899 \r
900     // get MC event header\r
901     header = mcEvent->Header();\r
902     if (!header) {\r
903       AliDebug(AliLog::kError, "Header not available");\r
904       return;\r
905     }\r
906     // MC particle stack\r
907     stack = mcEvent->Stack();\r
908     if (!stack) {\r
909       AliDebug(AliLog::kError, "Stack not available");\r
910       return;\r
911     }\r
912 \r
913     // get event type (ND=0x1, DD=0x2, SD=0x4)\r
914     evtType = AliPWG0Helper::GetEventProcessType(header);\r
915     //Printf("evtType %d \n", evtType);\r
916     AliDebug(AliLog::kDebug+1, Form("Found process type %d", evtType));\r
917 \r
918     // get MC vertex\r
919     genHeader = header->GenEventHeader();\r
920     if (!genHeader) {\r
921       AliDebug(AliLog::kError, "Could not retrieve genHeader from Header");\r
922       return;\r
923     }\r
924     genHeader->PrimaryVertex(vtxMC);\r
925 \r
926     // Fill MC event histogram\r
927     Double_t vMCEventHist1[3]={vtxMC[0],vtxMC[1],vtxMC[2]};\r
928     fMCEventHist1->Fill(vMCEventHist1);\r
929 \r
930     // multipliticy of all MC primary tracks\r
931     // in Zvtx, pt and eta ranges\r
932     multMCTrueTracks = AlidNdPtHelper::GetMCTrueTrackMult(mcEvent,evtCuts,accCuts);\r
933 \r
934   } // end bUseMC\r
935 \r
936   // get reconstructed vertex  \r
937   const AliESDVertex* vtxESD = 0; \r
938   Bool_t isRecVertex = kFALSE;\r
939   if(evtCuts->IsRecVertexRequired()) \r
940   {\r
941     Bool_t bRedoTPCVertex = evtCuts->IsRedoTPCVertex();\r
942     Bool_t bUseConstraints = evtCuts->IsUseBeamSpotConstraint();\r
943     vtxESD = AlidNdPtHelper::GetVertex(esdEvent,evtCuts,accCuts,esdTrackCuts,GetAnalysisMode(),kFALSE,bRedoTPCVertex,bUseConstraints); \r
944     isRecVertex = AlidNdPtHelper::TestRecVertex(vtxESD, GetAnalysisMode(), kFALSE); \r
945   }\r
946   if( IsUseMCInfo() &&  !evtCuts->IsRecVertexRequired() ) {\r
947     vtxESD = new AliESDVertex(vtxMC[2],10.,genHeader->NProduced());\r
948     isRecVertex = kTRUE;\r
949   }\r
950   Bool_t isEventOK = evtCuts->AcceptEvent(esdEvent,mcEvent,vtxESD) && isRecVertex; \r
951   //printf("isEventOK %d, isRecVertex %d, nContributors %d, Zv %f\n",isEventOK, isRecVertex, vtxESD->GetNContributors(), vtxESD->GetZv());\r
952 \r
953   //\r
954   // get multiplicity vertex contributors\r
955   //\r
956   Int_t multMBTracks = 0; \r
957   if(GetAnalysisMode() == AlidNdPtHelper::kTPC || GetAnalysisMode() == AlidNdPtHelper::kMCRec) {  \r
958     multMBTracks = AlidNdPtHelper::GetTPCMBTrackMult(esdEvent,evtCuts,accCuts,esdTrackCuts);\r
959   } \r
960   else if(GetAnalysisMode() == AlidNdPtHelper::kTPCITS || GetAnalysisMode() == AlidNdPtHelper::kTPCSPDvtx || \r
961           GetAnalysisMode() == AlidNdPtHelper::kTPCSPDvtxUpdate || GetAnalysisMode() == AlidNdPtHelper::kMCRec || \r
962           GetAnalysisMode()==AlidNdPtHelper::kTPCITSHybrid) {\r
963     //if(vtxESD->GetStatus())\r
964     //   multMBTracks = vtxESD->GetNContributors();\r
965 \r
966     // origin Jan Fiete GO\r
967     const AliMultiplicity* mult = esdEvent->GetMultiplicity();\r
968     if (mult) {\r
969       Int_t trackletCount = 0;\r
970 \r
971       for(Int_t i=0; i<mult->GetNumberOfTracklets(); ++i) {\r
972         Float_t deltaPhi = mult->GetDeltaPhi(i);\r
973         // prevent values to be shifted by 2 Pi()\r
974         if (deltaPhi < -TMath::Pi())\r
975           deltaPhi += TMath::Pi() * 2;\r
976         if (deltaPhi > TMath::Pi())\r
977           deltaPhi -= TMath::Pi() * 2;\r
978 \r
979          //if (fDeltaPhiCut > 0 && TMath::Abs(deltaPhi) > fDeltaPhiCut)\r
980          // continue;\r
981 \r
982        trackletCount++;\r
983        }\r
984        //multMBTracks = mult->GetNumberOfTracklets();\r
985        multMBTracks = trackletCount;\r
986        //printf("trackletCount %d \n", trackletCount);\r
987      }\r
988      else {\r
989        AliDebug(AliLog::kError, Form("Multiplicty %p", mult));\r
990        return; \r
991      }\r
992   } \r
993   else {\r
994     AliDebug(AliLog::kError, Form("Found analysis type %s", GetAnalysisMode()));\r
995     return; \r
996   }\r
997 \r
998   //\r
999   // correct event and track histograms\r
1000   //\r
1001   TObjArray *allChargedTracks=0;\r
1002   Int_t multRec=0, multRecTemp=0;\r
1003   Int_t *labelsRec=0;\r
1004   Bool_t isCosmic = kFALSE;\r
1005 \r
1006   if(isEventOK && isEventTriggered)\r
1007   {\r
1008     // get all charged tracks\r
1009     allChargedTracks = AlidNdPtHelper::GetAllChargedTracks(esdEvent,GetAnalysisMode());\r
1010     if(!allChargedTracks) return;\r
1011 \r
1012     Int_t entries = allChargedTracks->GetEntries();\r
1013     labelsRec = new Int_t[entries];\r
1014 \r
1015     // calculate mult of reconstructed tracks\r
1016 \r
1017     for(Int_t i=0; i<entries;++i) \r
1018     {\r
1019       AliESDtrack *track = (AliESDtrack*)allChargedTracks->At(i);\r
1020       if(!track) continue;\r
1021       if(track->Charge()==0) continue;\r
1022 \r
1023 \r
1024       // only postive charged \r
1025       if(GetParticleMode() == AlidNdPtHelper::kPlus && track->Charge() < 0) \r
1026         continue;\r
1027       \r
1028       // only negative charged \r
1029       if(GetParticleMode() == AlidNdPtHelper::kMinus && track->Charge() > 0) \r
1030         continue;\r
1031 \r
1032       // cosmics analysis\r
1033       isCosmic = kFALSE;\r
1034       if( GetParticleMode()==AlidNdPtHelper::kCosmic )\r
1035       {\r
1036           for(Int_t j=0; j<entries;++j) \r
1037           {\r
1038             AliESDtrack *track1 = (AliESDtrack*)allChargedTracks->At(j);\r
1039             if(!track1) continue;\r
1040             if(track1->Charge()==0) continue;\r
1041 \r
1042             if( esdTrackCuts->AcceptTrack(track) && accCuts->AcceptTrack(track) && \r
1043                 esdTrackCuts->AcceptTrack(track1) && accCuts->AcceptTrack(track1) ) \r
1044             { \r
1045               isCosmic = AlidNdPtHelper::IsCosmicTrack(track, track1);\r
1046             }\r
1047             if(isCosmic) \r
1048             {\r
1049               Double_t vCosmicsHisto[3] = { track->Eta()+track1->Eta(), track->Phi()-track1->Phi(), track1->Pt() };\r
1050               fCosmicsHisto->Fill(vCosmicsHisto);\r
1051             }\r
1052           }\r
1053          \r
1054         if(!isCosmic) continue;\r
1055       }\r
1056 \r
1057       if(esdTrackCuts->AcceptTrack(track) && accCuts->AcceptTrack(track)) \r
1058         multRecTemp++;\r
1059     }  \r
1060 \r
1061     //\r
1062     for(Int_t i=0; i<entries;++i) \r
1063     {\r
1064       AliESDtrack *track = (AliESDtrack*)allChargedTracks->At(i);\r
1065       if(!track) continue;\r
1066       if(track->Charge()==0) continue;\r
1067 \r
1068 \r
1069       // only postive charged \r
1070       if(GetParticleMode() == AlidNdPtHelper::kPlus && track->Charge() < 0) \r
1071       continue;\r
1072       \r
1073       // only negative charged \r
1074       if(GetParticleMode() == AlidNdPtHelper::kMinus && track->Charge() > 0) \r
1075       continue;\r
1076         \r
1077       // track-level corrections\r
1078       if(esdTrackCuts->AcceptTrack(track)) \r
1079       {\r
1080         // cosmics analysis\r
1081         isCosmic = kFALSE;\r
1082         if( GetParticleMode()==AlidNdPtHelper::kCosmic )\r
1083         {\r
1084           for(Int_t j=0; j<entries;++j) \r
1085           {\r
1086             AliESDtrack *track1 = (AliESDtrack*)allChargedTracks->At(j);\r
1087             if(!track1) continue;\r
1088             if(track1->Charge()==0) continue;\r
1089 \r
1090             if( esdTrackCuts->AcceptTrack(track) && accCuts->AcceptTrack(track) && \r
1091                 esdTrackCuts->AcceptTrack(track1) && accCuts->AcceptTrack(track1) ) \r
1092             { \r
1093               isCosmic = AlidNdPtHelper::IsCosmicTrack(track, track1);\r
1094             }\r
1095           }\r
1096           if(!isCosmic) continue;\r
1097         }\r
1098 \r
1099         Bool_t isOK = kFALSE;\r
1100         Double_t x[3]; track->GetXYZ(x);\r
1101         Double_t b[3]; AliTracker::GetBxByBz(x,b);\r
1102 \r
1103         //\r
1104         // if TPC-ITS hybrid tracking (kTPCITSHybrid)\r
1105         // replace track parameters with TPC-ony track parameters\r
1106         //\r
1107         if( GetAnalysisMode() == AlidNdPtHelper::kTPCITSHybrid ) \r
1108         {\r
1109           // Relate TPC-only tracks to SPD vertex\r
1110           isOK = track->RelateToVertexTPCBxByBz(esdEvent->GetPrimaryVertexSPD(), b, kVeryBig);\r
1111           if(!isOK) continue;\r
1112 \r
1113           // replace esd track parameters with TPCinner\r
1114           AliExternalTrackParam  *tpcTrack  = new AliExternalTrackParam(*(track->GetTPCInnerParam()));\r
1115           if (!tpcTrack) return;\r
1116           track->Set(tpcTrack->GetX(),tpcTrack->GetAlpha(),tpcTrack->GetParameter(),tpcTrack->GetCovariance());\r
1117 \r
1118           if(tpcTrack) delete tpcTrack; \r
1119         } \r
1120 \r
1121         //\r
1122         if (GetAnalysisMode()==AlidNdPtHelper::kTPCSPDvtxUpdate) \r
1123         {\r
1124            //\r
1125            // update track parameters\r
1126            //\r
1127            AliExternalTrackParam cParam;\r
1128            isOK = track->RelateToVertexTPC(esdEvent->GetPrimaryVertexSPD(),esdEvent->GetMagneticField(),kVeryBig,&cParam);\r
1129            if(!isOK) continue;\r
1130            track->Set(cParam.GetX(),cParam.GetAlpha(),cParam.GetParameter(),cParam.GetCovariance());\r
1131 \r
1132            if(accCuts->AcceptTrack(track)) { \r
1133              FillHistograms(track,stack,AlidNdPtHelper::kRecTracks,vtxESD->GetZv(),multRecTemp,multMCTrueTracks); \r
1134              labelsRec[multRec] = TMath::Abs(track->GetLabel());\r
1135              multRec++;\r
1136            }\r
1137          }\r
1138          else if (GetAnalysisMode()==AlidNdPtHelper::kMCRec && IsUseMCInfo()) \r
1139          { \r
1140            //\r
1141            // Replace rec with MC\r
1142            //\r
1143            if(accCuts->AcceptTrack(track)) { \r
1144              FillHistograms(track,stack,AlidNdPtHelper::kRecTracks,vtxMC[2],multRecTemp, multMCTrueTracks); \r
1145              labelsRec[multRec] = TMath::Abs(track->GetLabel());\r
1146              multRec++;\r
1147            }\r
1148          } \r
1149          else  {\r
1150            //\r
1151            // all the rest tracking scenarios\r
1152            //\r
1153            if(accCuts->AcceptTrack(track)) { \r
1154              FillHistograms(track,stack,AlidNdPtHelper::kRecTracks,vtxESD->GetZv(),multRecTemp, multMCTrueTracks); \r
1155              labelsRec[multRec] = TMath::Abs(track->GetLabel());\r
1156              multRec++;\r
1157            }\r
1158          }\r
1159        }\r
1160     }\r
1161     // event-level corrections\r
1162     if(GetAnalysisMode()==AlidNdPtHelper::kMCRec && IsUseMCInfo()) { \r
1163       FillHistograms(AlidNdPtHelper::kRecEvents,vtxMC[2],multMBTracks);\r
1164     }\r
1165     else {\r
1166       FillHistograms(AlidNdPtHelper::kRecEvents,vtxESD->GetZv(),multMBTracks);\r
1167     }\r
1168 \r
1169     // calculate meanPt from the event\r
1170     Double_t meanPtMult[8] = {0};  \r
1171     Double_t meanPtTrueMult[8] = {0};  \r
1172     for (Int_t i = 0; i<8; i++) {\r
1173       if(!fCorrRecTrackMultHist1[i]) continue;\r
1174       meanPtMult[i] = fCorrRecTrackPt1[i]->Projection(0)->GetMean();    \r
1175       Double_t vCorrRecTrackMeanPtMultHist1[2] = {meanPtMult[i],multRecTemp};\r
1176       fCorrRecTrackMeanPtMultHist1[i]->Fill(vCorrRecTrackMeanPtMultHist1); \r
1177       \r
1178       if( IsUseMCInfo() ) {\r
1179         if(!fCorrRecTrackTrueMultHist1[i]) continue;\r
1180         meanPtTrueMult[i] = fCorrRecTrackPt1[i]->Projection(0)->GetMean();    \r
1181         Double_t vCorrRecTrackMeanPtTrueMultHist1[2] = {meanPtMult[i],multMCTrueTracks};\r
1182         fCorrRecTrackMeanPtTrueMultHist1[i]->Fill(vCorrRecTrackMeanPtTrueMultHist1); \r
1183       }\r
1184 \r
1185       // reset pt histo for the next event\r
1186       if(fCorrRecTrackPt1[i])  fCorrRecTrackPt1[i]->Reset();\r
1187     }\r
1188 \r
1189     // control event histograms\r
1190     Double_t vRecEventHist1[3] = {vtxESD->GetXv(),vtxESD->GetYv(),vtxESD->GetZv()};\r
1191     fRecEventHist1->Fill(vRecEventHist1);\r
1192   } \r
1193 \r
1194   // empty events corrections\r
1195   // no reconstructed zv\r
1196   if(isEventTriggered && multMBTracks==0) {\r
1197     if(GetAnalysisMode()==AlidNdPtHelper::kMCRec && IsUseMCInfo()) {\r
1198       FillHistograms(AlidNdPtHelper::kTriggeredEvents,vtxMC[2],multMBTracks);\r
1199     }\r
1200     else {\r
1201       Double_t zv = fZvNorm->GetRandom();\r
1202       FillHistograms(AlidNdPtHelper::kTriggeredEvents,zv,multMBTracks);\r
1203     }\r
1204   }\r
1205 \r
1206   if(IsUseMCInfo())  \r
1207   {\r
1208     // select MC events \r
1209     if(evtCuts->AcceptMCEvent(mcEvent))\r
1210     {\r
1211       //\r
1212       // event histograms\r
1213       //\r
1214       Double_t vMCEventMatrix[2] = {vtxMC[2],multMBTracks};\r
1215       fMCAllEventMultHist1->Fill(vMCEventMatrix);\r
1216       if(evtType == AliPWG0Helper::kND) {\r
1217         fMCAllNDEventMultHist1->Fill(vMCEventMatrix);\r
1218       }\r
1219       if(evtType != AliPWG0Helper::kSD) {\r
1220         fMCAllNSDEventMultHist1->Fill(vMCEventMatrix);\r
1221       }\r
1222       if(isEventTriggered) fMCTriggerMultHist1->Fill(vMCEventMatrix);\r
1223       if(isEventTriggered && isEventOK) fMCEventMultHist1->Fill(vMCEventMatrix);\r
1224 \r
1225       //\r
1226       // MC histograms for efficiency studies\r
1227       //\r
1228       Double_t sumPtMC = 0;\r
1229       Int_t nPart  = stack->GetNtrack();\r
1230       for (Int_t iMc = 0; iMc < nPart; ++iMc) \r
1231       {\r
1232         // print MC stack info\r
1233         //AlidNdPtHelper::PrintMCInfo(stack,iMc);\r
1234 \r
1235         TParticle* particle = stack->Particle(iMc);\r
1236         if (!particle)\r
1237         continue;\r
1238 \r
1239         // only charged particles\r
1240         Double_t charge = particle->GetPDG()->Charge()/3.;\r
1241         if (TMath::Abs(charge) < 0.001)\r
1242           continue;\r
1243 \r
1244         // only postive charged \r
1245         if(GetParticleMode() == AlidNdPtHelper::kPlus && charge  < 0.) \r
1246         continue;\r
1247       \r
1248         // only negative charged \r
1249         if(GetParticleMode() == AlidNdPtHelper::kMinus && charge > 0.) \r
1250         continue;\r
1251       \r
1252         // physical primary\r
1253         Bool_t prim = stack->IsPhysicalPrimary(iMc);\r
1254         if(!prim) continue;\r
1255 \r
1256         // all primaries in acceptance\r
1257         if(!accCuts->AcceptTrack(particle)) continue;\r
1258 \r
1259         Double_t gpt = particle->Pt();\r
1260         Double_t geta = particle->Eta();\r
1261 \r
1262         // sum up pt in the event\r
1263         sumPtMC +=gpt; \r
1264 \r
1265         Double_t valMCAllTrackMultHist1[3] = {gpt,geta,multRec};          \r
1266         Double_t valMCAllTrackTrueMultHist1[3] = {gpt,geta,multMCTrueTracks};     \r
1267 \r
1268         fMCAllPrimTrackMultHist1->Fill(valMCAllTrackMultHist1);\r
1269         fMCAllPrimTrackTrueMultHist1->Fill(valMCAllTrackTrueMultHist1);\r
1270 \r
1271         if(evtType == AliPWG0Helper::kND) {\r
1272           fMCNDEventAllPrimTrackMultHist1->Fill(valMCAllTrackMultHist1);\r
1273           fMCNDEventAllPrimTrackTrueMultHist1->Fill(valMCAllTrackTrueMultHist1);\r
1274         }\r
1275         if(evtType != AliPWG0Helper::kSD) {\r
1276           fMCNSDEventAllPrimTrackMultHist1->Fill(valMCAllTrackMultHist1);\r
1277           fMCNSDEventAllPrimTrackTrueMultHist1->Fill(valMCAllTrackTrueMultHist1);\r
1278         }\r
1279         if(isEventTriggered) { \r
1280           fMCTriggerPrimTrackMultHist1->Fill(valMCAllTrackMultHist1);\r
1281           fMCTriggerPrimTrackTrueMultHist1->Fill(valMCAllTrackTrueMultHist1);\r
1282         }\r
1283         if(isEventTriggered && isEventOK) { \r
1284           fMCEventPrimTrackMultHist1->Fill(valMCAllTrackMultHist1);\r
1285           fMCEventPrimTrackTrueMultHist1->Fill(valMCAllTrackTrueMultHist1);\r
1286         }\r
1287       }\r
1288 \r
1289       //\r
1290       // calculate <pt> in the event\r
1291       //\r
1292       Double_t meanPtMCMult = 0;\r
1293       Double_t meanPtMCTrueMult = 0;\r
1294       if(multRec) meanPtMCMult = sumPtMC/multRec; \r
1295       if(multMCTrueTracks) meanPtMCTrueMult = sumPtMC/multMCTrueTracks; \r
1296 \r
1297       Double_t valMCMeanPtMult[2] = {meanPtMCMult,multRec};       \r
1298       Double_t valMCMeanPtTrueMult[2] = {meanPtMCTrueMult,multMCTrueTracks};      \r
1299 \r
1300       fMCAllPrimTrackMeanPtMult1->Fill(valMCMeanPtMult);\r
1301       fMCAllPrimTrackMeanPtTrueMult1->Fill(valMCMeanPtTrueMult);\r
1302 \r
1303       if(evtType == AliPWG0Helper::kND) {\r
1304           fMCNDEventAllPrimTrackMeanPtMult1->Fill(valMCMeanPtMult);\r
1305           fMCNDEventAllPrimTrackMeanPtTrueMult1->Fill(valMCMeanPtTrueMult);\r
1306       }\r
1307       if(evtType != AliPWG0Helper::kSD) {\r
1308           fMCNSDEventAllPrimTrackMeanPtMult1->Fill(valMCMeanPtMult);\r
1309           fMCNSDEventAllPrimTrackMeanPtTrueMult1->Fill(valMCMeanPtTrueMult);\r
1310       }\r
1311       if(isEventTriggered) { \r
1312           fMCTriggerPrimTrackMeanPtMult1->Fill(valMCMeanPtMult);\r
1313           fMCTriggerPrimTrackMeanPtTrueMult1->Fill(valMCMeanPtTrueMult);\r
1314       }\r
1315       if(isEventTriggered && isEventOK) { \r
1316           fMCEventPrimTrackMeanPtMult1->Fill(valMCMeanPtMult);\r
1317           fMCEventPrimTrackMeanPtTrueMult1->Fill(valMCMeanPtTrueMult);\r
1318       }\r
1319 \r
1320     }\r
1321   } // end bUseMC\r
1322 \r
1323   if(allChargedTracks) delete allChargedTracks; allChargedTracks = 0;\r
1324   if(labelsRec) delete [] labelsRec; labelsRec = 0;\r
1325 \r
1326   if(!evtCuts->IsRecVertexRequired() && vtxESD != NULL) delete vtxESD;\r
1327 }\r
1328 \r
1329 //_____________________________________________________________________________\r
1330 void AlidNdPtCorrection::FillHistograms(AlidNdPtHelper::EventObject eventObj, Double_t zv, Int_t multMBTracks) const\r
1331 {\r
1332   //\r
1333   // Fill corrected histograms\r
1334   //\r
1335 \r
1336   Double_t vEventMatrix[2] = {zv,multMBTracks};\r
1337   //\r
1338   // Correct for efficiency \r
1339   //\r
1340   if(eventObj == AlidNdPtHelper::kRecEvents && multMBTracks>0)  \r
1341   {\r
1342     Double_t corrToMBF = GetCorrFactZvMult(fCorrEventMatrix,zv,multMBTracks);\r
1343     Double_t corrToInelF = GetCorrFactZvMult(fCorrTriggerMBtoInelEventMatrix,zv,multMBTracks);\r
1344     Double_t corrToNDF = GetCorrFactZvMult(fCorrTriggerMBtoNDEventMatrix,zv,multMBTracks);\r
1345     Double_t corrToNSDF = GetCorrFactZvMult(fCorrTriggerMBtoNSDEventMatrix,zv,multMBTracks);\r
1346     //printf("corrToMBF %f, corrToInelF %f, corrToNDF %f corrToNSDF %f \n",corrToMBF,corrToInelF,corrToNDF,corrToNSDF);\r
1347 \r
1348     fCorrRecEventHist1[0]->Fill(vEventMatrix);\r
1349     fCorrRecEventHist1[1]->Fill(vEventMatrix,corrToMBF);\r
1350     fCorrRecEventHist1[2]->Fill(vEventMatrix,corrToMBF*corrToInelF);\r
1351     fCorrRecEventHist1[3]->Fill(vEventMatrix,corrToMBF*corrToNDF);\r
1352     fCorrRecEventHist1[4]->Fill(vEventMatrix,corrToMBF*corrToNSDF);\r
1353   }\r
1354 \r
1355   if(eventObj==AlidNdPtHelper::kTriggeredEvents && multMBTracks==0) // empty triggered events\r
1356   {\r
1357     Int_t bin = fZvEmptyEventsNorm->FindBin(zv);\r
1358     Double_t factZ = fZvEmptyEventsNorm->GetBinContent(bin);\r
1359     Double_t corrToInelF0 = GetCorrFactZvMult(fCorrTriggerMBtoInelEventMatrix,zv,multMBTracks);\r
1360     Double_t corrToNDF0 = GetCorrFactZvMult(fCorrTriggerMBtoNDEventMatrix,zv,multMBTracks);\r
1361     Double_t corrToNSDF0 = GetCorrFactZvMult(fCorrTriggerMBtoNSDEventMatrix,zv,multMBTracks);\r
1362     //printf("factZ %f, corrToInelF0 %f, corrToNDF0 %f, corrToNSDF0 %f \n",factZ,corrToInelF0,corrToNDF0,corrToNSDF0);\r
1363 \r
1364     fCorrRecEventHist2[0]->Fill(vEventMatrix);\r
1365     fCorrRecEventHist2[1]->Fill(vEventMatrix,factZ);\r
1366     fCorrRecEventHist2[2]->Fill(vEventMatrix,factZ*corrToInelF0);\r
1367     fCorrRecEventHist2[3]->Fill(vEventMatrix,factZ*corrToNDF0);\r
1368     fCorrRecEventHist2[4]->Fill(vEventMatrix,factZ*corrToNSDF0);\r
1369   }\r
1370 }\r
1371 \r
1372 //_____________________________________________________________________________\r
1373 void AlidNdPtCorrection::FillHistograms(AliESDtrack * const esdTrack, AliStack * const stack, AlidNdPtHelper::TrackObject trackObj, Double_t zv, Int_t mult, Int_t trueMult) const\r
1374 {\r
1375   //\r
1376   // Fill ESD track and MC histograms \r
1377   //\r
1378   if(!esdTrack) return;\r
1379 \r
1380   //Float_t q = esdTrack->Charge();\r
1381   Float_t pt = esdTrack->Pt();\r
1382   Float_t eta = esdTrack->Eta();\r
1383   Float_t phi = esdTrack->Phi();\r
1384 \r
1385   if(stack && GetAnalysisMode() == AlidNdPtHelper::kMCRec) \r
1386   {\r
1387     Int_t label = TMath::Abs(esdTrack->GetLabel());\r
1388    \r
1389     TParticle* particle = stack->Particle(label);\r
1390     if(!particle) return;\r
1391    \r
1392     Double_t gq = particle->GetPDG()->Charge()/3.0; // Charge units |e|/3\r
1393     if(TMath::Abs(gq)<0.001) return;\r
1394     Float_t gpt = particle->Pt();\r
1395     Float_t geta = particle->Eta();\r
1396     Float_t gphi = particle->Phi();\r
1397 \r
1398     // replace reconstructed values with MC\r
1399     pt = gpt;\r
1400     eta = geta;\r
1401     phi = gphi;\r
1402   }\r
1403 \r
1404   //\r
1405   // Fill histograms\r
1406   //\r
1407   Double_t values[3] = {pt,eta,phi};      \r
1408   fRecTrackHist1[trackObj]->Fill(values);\r
1409 \r
1410   //\r
1411   // Correct for contamination and efficiency \r
1412   //\r
1413   if(trackObj == AlidNdPtHelper::kRecTracks || GetAnalysisMode() == AlidNdPtHelper::kMCRec)  \r
1414   {\r
1415     // track level corrections\r
1416     Double_t trackEffF = 1.0;  \r
1417     if(pt < 2.5) trackEffF = GetCorrFactZvPtEta(fCorrTrackMatrix,zv,pt,eta);\r
1418     else trackEffF = GetCorrFactZvPtEta(fCorrHighPtTrackMatrix,zv,pt,eta);\r
1419 \r
1420     Double_t trackContF = GetContFactZvPtEta(fContTrackMatrix,zv,pt,eta);\r
1421     Double_t multTrackContF = GetContFactZvPtEta(fContMultTrackMatrix,zv,pt,eta);\r
1422     //printf("zv %f, pt %f, eta %f \n",zv,pt,eta);\r
1423     //printf("trackEffF %f, trackContF %f, multTrackContF %f \n", trackEffF, trackContF, multTrackContF);\r
1424    \r
1425     // track-event level corrections\r
1426     Double_t vertexEffF = GetCorrFactZvPtEta(fCorrTrackEventMatrix,zv,pt,eta);\r
1427     Double_t trigMBToInel = GetCorrFactZvPtEta(fCorrTriggerMBtoInelTrackEventMatrix,zv,pt,eta);  \r
1428     Double_t trigMBToND = GetCorrFactZvPtEta(fCorrTriggerMBtoNDTrackEventMatrix,zv,pt,eta);\r
1429     Double_t trigMBToNSD = GetCorrFactZvPtEta(fCorrTriggerMBtoNSDTrackEventMatrix,zv,pt,eta);\r
1430     //printf("vertexEffF %f, trigMBToInel %f, trigMBToNSD %f \n", vertexEffF, trigMBToInel, trigMBToNSD);\r
1431     \r
1432     Double_t corrF[8] = { 1.0, \r
1433                           trackContF,\r
1434                           trackContF*trackEffF,\r
1435                           trackContF*trackEffF*multTrackContF,\r
1436                           trackContF*trackEffF*multTrackContF*vertexEffF,\r
1437                           trackContF*trackEffF*multTrackContF*vertexEffF*trigMBToInel,\r
1438                           trackContF*trackEffF*multTrackContF*vertexEffF*trigMBToND,\r
1439                           trackContF*trackEffF*multTrackContF*vertexEffF*trigMBToNSD\r
1440                          }; \r
1441  \r
1442     // Fill histograms\r
1443     Double_t valCorrRecTrackMultHist1[3] = {pt,eta,mult};         \r
1444     Double_t valCorrRecTrackPt1[1] = {pt};        \r
1445     for(Int_t i=0; i<8; i++) {\r
1446       fCorrRecTrackMultHist1[i]->Fill(valCorrRecTrackMultHist1,corrF[i]);\r
1447       fCorrRecTrackPt1[i]->Fill(valCorrRecTrackPt1,corrF[i]);\r
1448 \r
1449       if( IsUseMCInfo() ) {\r
1450         Double_t valCorrRecTrackTrueMultHist1[3] = {pt,eta,trueMult};     \r
1451         fCorrRecTrackTrueMultHist1[i]->Fill(valCorrRecTrackTrueMultHist1,corrF[i]);\r
1452       } \r
1453     }\r
1454   }\r
1455 }\r
1456 \r
1457 void AlidNdPtCorrection::FillHistograms(AliStack * const stack, Int_t /*label*/, AlidNdPtHelper::TrackObject /*trackObj*/, Int_t /*mult*/) const\r
1458 {\r
1459   // Fill MC histograms\r
1460   if(!stack) return;\r
1461 \r
1462   /*\r
1463   TParticle* particle = stack->Particle(label);\r
1464   if(!particle) return;\r
1465 \r
1466   Int_t mother_pdg = -1;\r
1467   TParticle* mother = 0;\r
1468 \r
1469   //TParticle* prim_mother = AlidNdPtHelper::FindPrimaryMother(stack,label);\r
1470   Int_t motherLabel = particle->GetMother(0); \r
1471   if(motherLabel>0) mother = stack->Particle(motherLabel);\r
1472   if(mother) mother_pdg = TMath::Abs(mother->GetPdgCode()); // take abs for visualisation only\r
1473   Int_t mech = particle->GetUniqueID(); // production mechanism\r
1474 \r
1475   Double_t gq = particle->GetPDG()->Charge()/3.0; // Charge units |e|/3 \r
1476   Float_t gpt = particle->Pt();\r
1477   Float_t qgpt = particle->Pt() * gq;\r
1478   Float_t geta = particle->Eta();\r
1479   Float_t gphi = particle->Phi();\r
1480   Float_t gpz = particle->Pz();\r
1481 \r
1482   Bool_t prim = stack->IsPhysicalPrimary(label);\r
1483   Float_t vx = particle->Vx(); Float_t vy = particle->Vy(); Float_t vz = particle->Vz();\r
1484 \r
1485   Int_t pid=-1;\r
1486   if (TMath::Abs(particle->GetPdgCode()) == kElectron)         { pid = 0; }\r
1487     else if (TMath::Abs(particle->GetPdgCode()) == kMuonMinus) { pid = 1; }\r
1488     else if (TMath::Abs(particle->GetPdgCode()) == kPiPlus)    { pid = 2; }\r
1489     else if (TMath::Abs(particle->GetPdgCode()) == kKPlus)     { pid = 3; }\r
1490     else if (TMath::Abs(particle->GetPdgCode()) == kProton)    { pid = 4; }\r
1491     else                                                       { pid = 5; }\r
1492     */\r
1493 \r
1494   //if(!prim) printf("prim_mother %d, mother %d, particle %d, production mech %d\n",prim_mother->GetPdgCode(),mother->GetPdgCode(), particle->GetPdgCode(),mech);\r
1495   \r
1496 }\r
1497 \r
1498 //_____________________________________________________________________________\r
1499 Double_t AlidNdPtCorrection::GetCorrFactZvPtEta(THnSparse * const hist, Double_t zv, Double_t pt, Double_t eta) const {\r
1500 // return correction factor F(zv,pt,eta)\r
1501 \r
1502  if(!hist) return 1.;\r
1503 \r
1504  //\r
1505  TAxis *ax = hist->GetAxis(0);\r
1506  TAxis *ay = hist->GetAxis(1);\r
1507  TAxis *az = hist->GetAxis(2);\r
1508 \r
1509  Int_t binx = ax->FindBin(zv);\r
1510  Int_t biny = ay->FindBin(pt);\r
1511  Int_t binz = az->FindBin(eta);\r
1512  Int_t dim[3] = {binx,biny,binz};\r
1513 \r
1514  Double_t fact  = hist->GetBinContent(dim);  \r
1515 \r
1516 return fact;\r
1517 }\r
1518 \r
1519 //_____________________________________________________________________________\r
1520 Double_t AlidNdPtCorrection::GetContFactZvPtEta(THnSparse * const hist, Double_t zv, Double_t pt, Double_t eta) const {\r
1521 // return contamination correction factor F(zv,pt,eta)\r
1522 \r
1523  if(!hist) return 1.0;\r
1524 \r
1525  //\r
1526  TAxis *ax = hist->GetAxis(0);\r
1527  TAxis *ay = hist->GetAxis(1);\r
1528  TAxis *az = hist->GetAxis(2);\r
1529 \r
1530  Int_t binx = ax->FindBin(zv);\r
1531  Int_t biny = ay->FindBin(pt);\r
1532  Int_t binz = az->FindBin(eta);\r
1533  Int_t dim[3] = {binx,biny,binz};\r
1534 \r
1535  Double_t fact  = 1.0-hist->GetBinContent(dim);  \r
1536  //Double_t fact  = hist->GetBinContent(dim);  \r
1537 \r
1538 return fact;\r
1539 }\r
1540 \r
1541 //_____________________________________________________________________________\r
1542 Double_t AlidNdPtCorrection::GetCorrFactZvMult(THnSparse * const hist, Double_t zv, Int_t mult) const {\r
1543 // return correction factor F(zv,mult)\r
1544 \r
1545  if(!hist) return 1.;\r
1546 \r
1547  TAxis *ax = hist->GetAxis(0);\r
1548  TAxis *ay = hist->GetAxis(1);\r
1549  Int_t binx = ax->FindBin(zv);\r
1550  Int_t biny = ay->FindBin(mult);\r
1551  Int_t dim[2] = {binx,biny};\r
1552 \r
1553  Double_t fact  = hist->GetBinContent(dim);  \r
1554 \r
1555 \r
1556 return fact;\r
1557 }\r
1558 \r
1559 //_____________________________________________________________________________\r
1560 Double_t AlidNdPtCorrection::GetContFactZvMult(THnSparse * const hist, Double_t zv, Int_t mult) const {\r
1561 // return contamination correction factor F(zv,mult)\r
1562 \r
1563  if(!hist) return 1.;\r
1564 \r
1565  TAxis *ax = hist->GetAxis(0);\r
1566  TAxis *ay = hist->GetAxis(1);\r
1567  Int_t binx = ax->FindBin(zv);\r
1568  Int_t biny = ay->FindBin(mult);\r
1569  Int_t dim[2] = {binx,biny};\r
1570  Double_t fact  = 1.0-hist->GetBinContent(dim);  \r
1571 \r
1572 return fact;\r
1573 }\r
1574 \r
1575 //_____________________________________________________________________________\r
1576 Long64_t AlidNdPtCorrection::Merge(TCollection* const list) \r
1577 {\r
1578   // Merge list of objects (needed by PROOF)\r
1579 \r
1580   if (!list)\r
1581   return 0;\r
1582 \r
1583   if (list->IsEmpty())\r
1584   return 1;\r
1585 \r
1586   TIterator* iter = list->MakeIterator();\r
1587   TObject* obj = 0;\r
1588 \r
1589   // collection of generated histograms\r
1590 \r
1591   Int_t count=0;\r
1592   while((obj = iter->Next()) != 0) {\r
1593     AlidNdPtCorrection* entry = dynamic_cast<AlidNdPtCorrection*>(obj);\r
1594     if (entry == 0) continue; \r
1595   \r
1596     fMCEventHist1->Add(entry->fMCEventHist1);\r
1597     fRecEventHist1->Add(entry->fRecEventHist1);\r
1598 \r
1599     fMCAllEventMultHist1->Add(entry->fMCAllEventMultHist1);\r
1600     fMCAllNDEventMultHist1->Add(entry->fMCAllNDEventMultHist1);\r
1601     fMCAllNSDEventMultHist1->Add(entry->fMCAllNSDEventMultHist1);\r
1602     fMCTriggerMultHist1->Add(entry->fMCTriggerMultHist1);\r
1603     fMCEventMultHist1->Add(entry->fMCEventMultHist1);\r
1604 \r
1605     fMCAllPrimTrackMultHist1->Add(entry->fMCAllPrimTrackMultHist1);\r
1606     fMCNDEventAllPrimTrackMultHist1->Add(entry->fMCNDEventAllPrimTrackMultHist1);\r
1607     fMCNSDEventAllPrimTrackMultHist1->Add(entry->fMCNSDEventAllPrimTrackMultHist1);\r
1608     fMCTriggerPrimTrackMultHist1->Add(entry->fMCTriggerPrimTrackMultHist1);\r
1609     fMCEventPrimTrackMultHist1->Add(entry->fMCEventPrimTrackMultHist1);\r
1610 \r
1611     fMCAllPrimTrackTrueMultHist1->Add(entry->fMCAllPrimTrackTrueMultHist1);\r
1612     fMCNDEventAllPrimTrackTrueMultHist1->Add(entry->fMCNDEventAllPrimTrackTrueMultHist1);\r
1613     fMCNSDEventAllPrimTrackTrueMultHist1->Add(entry->fMCNSDEventAllPrimTrackTrueMultHist1);\r
1614     fMCTriggerPrimTrackTrueMultHist1->Add(entry->fMCTriggerPrimTrackTrueMultHist1);\r
1615     fMCEventPrimTrackTrueMultHist1->Add(entry->fMCEventPrimTrackTrueMultHist1);\r
1616 \r
1617     fMCAllPrimTrackMeanPtMult1->Add(entry->fMCAllPrimTrackMeanPtMult1);\r
1618     fMCNDEventAllPrimTrackMeanPtMult1->Add(entry->fMCNDEventAllPrimTrackMeanPtMult1);\r
1619     fMCNSDEventAllPrimTrackMeanPtMult1->Add(entry->fMCNSDEventAllPrimTrackMeanPtMult1);\r
1620     fMCTriggerPrimTrackMeanPtMult1->Add(entry->fMCTriggerPrimTrackMeanPtMult1);\r
1621     fMCEventPrimTrackMeanPtMult1->Add(entry->fMCEventPrimTrackMeanPtMult1);\r
1622 \r
1623     fMCAllPrimTrackMeanPtTrueMult1->Add(entry->fMCAllPrimTrackMeanPtTrueMult1);\r
1624     fMCNDEventAllPrimTrackMeanPtTrueMult1->Add(entry->fMCNDEventAllPrimTrackMeanPtTrueMult1);\r
1625     fMCNSDEventAllPrimTrackMeanPtTrueMult1->Add(entry->fMCNSDEventAllPrimTrackMeanPtTrueMult1);\r
1626     fMCTriggerPrimTrackMeanPtTrueMult1->Add(entry->fMCTriggerPrimTrackMeanPtTrueMult1);\r
1627     fMCEventPrimTrackMeanPtTrueMult1->Add(entry->fMCEventPrimTrackMeanPtTrueMult1);\r
1628 \r
1629     fCosmicsHisto->Add(entry->fCosmicsHisto);\r
1630 \r
1631     for(Int_t i=0; i<AlidNdPtHelper::kCutSteps; i++) {\r
1632       fRecTrackHist1[i]->Add(entry->fRecTrackHist1[i]);\r
1633     }\r
1634 \r
1635     for(Int_t i=0; i<8; i++) {\r
1636       fCorrRecTrackMultHist1[i]->Add(entry->fCorrRecTrackMultHist1[i]);\r
1637       fCorrRecTrackTrueMultHist1[i]->Add(entry->fCorrRecTrackTrueMultHist1[i]);\r
1638 \r
1639       fCorrRecTrackMeanPtMultHist1[i]->Add(entry->fCorrRecTrackMeanPtMultHist1[i]);\r
1640       fCorrRecTrackMeanPtTrueMultHist1[i]->Add(entry->fCorrRecTrackMeanPtTrueMultHist1[i]);\r
1641 \r
1642       fCorrRecTrackPt1[i]->Add(entry->fCorrRecTrackPt1[i]);\r
1643     }\r
1644 \r
1645     for(Int_t i=0; i<5; i++) {\r
1646       fCorrRecEventHist1[i]->Add(entry->fCorrRecEventHist1[i]);\r
1647       fCorrRecEventHist2[i]->Add(entry->fCorrRecEventHist2[i]);\r
1648     }\r
1649 \r
1650   count++;\r
1651   }\r
1652 \r
1653 return count;\r
1654 }\r
1655  \r
1656 //____________________________________________________________________________\r
1657 Int_t AlidNdPtCorrection::GetTrueMult(THnSparse * const hist, Int_t mult) const\r
1658 {\r
1659 //\r
1660 // get multiplicity of primary particles\r
1661 //\r
1662  if(!hist) return 0;\r
1663  Int_t trueMult = 0;\r
1664 \r
1665  // 0 bins exluded\r
1666  TAxis *ax = hist->GetAxis(0);\r
1667  TAxis *ay = hist->GetAxis(1);\r
1668  ax->SetRange(1,ax->GetNbins());\r
1669  ay->SetRange(1,ay->GetNbins());\r
1670 \r
1671  // measured mult\r
1672  ax->SetRangeUser((Float_t)mult,(Float_t)mult); \r
1673 \r
1674  // get true multiplicity\r
1675  TH1D *h1 = (TH1D *)hist->Projection(1);\r
1676  trueMult = (Int_t)h1->GetMean();\r
1677 \r
1678  return trueMult;\r
1679 }\r
1680 \r
1681 //_____________________________________________________________________________\r
1682 void AlidNdPtCorrection::Analyse() \r
1683 {\r
1684   // Analyse histograms\r
1685   //\r
1686   TH1::AddDirectory(kFALSE);\r
1687   TH1 *h = 0, *hs=0, *hsc=0; \r
1688   TH2 *h2D = 0; \r
1689 \r
1690   TObjArray *aFolderObj = new TObjArray;\r
1691 \r
1692   //\r
1693   // get cuts\r
1694   //\r
1695   AlidNdPtEventCuts *evtCuts = GetEventCuts(); \r
1696   AlidNdPtAcceptanceCuts *accCuts = GetAcceptanceCuts(); \r
1697   AliESDtrackCuts *esdTrackCuts = GetTrackCuts(); \r
1698 \r
1699   if(!evtCuts || !accCuts || !esdTrackCuts) {\r
1700     Error("AlidNdPtCutAnalysis::Analyse()", "cuts not available");\r
1701     return;\r
1702   }\r
1703 \r
1704   //\r
1705   // set min and max values\r
1706   //\r
1707   //Double_t minPt = accCuts->GetMinPt();\r
1708   //Double_t maxPt = accCuts->GetMaxPt();\r
1709   Double_t minEta = accCuts->GetMinEta();\r
1710   Double_t maxEta = accCuts->GetMaxEta()-0.00001;\r
1711  \r
1712   printf("minEta %f, maxEta %f \n",minEta, maxEta);\r
1713 \r
1714   //\r
1715   // cosmics background histo\r
1716   //\r
1717   h2D = fCosmicsHisto->Projection(0,1);\r
1718   h2D->SetName("deta_vs_dphi_cosmics");\r
1719   aFolderObj->Add(h2D);\r
1720 \r
1721   //\r
1722   // event level \r
1723   //\r
1724   h = fCorrRecEventHist1[0]->Projection(1);\r
1725   h->SetName("mult_event_not_corrected");\r
1726   aFolderObj->Add(h);\r
1727 \r
1728   h = fCorrRecEventHist1[1]->Projection(1);\r
1729   h->SetName("mult_event_vertex_corrected");\r
1730   aFolderObj->Add(h);\r
1731 \r
1732   h = fCorrRecEventHist1[2]->Projection(1);\r
1733   h->SetName("mult_trigger_vertex_corrected");\r
1734   aFolderObj->Add(h);\r
1735 \r
1736   h = fCorrRecEventHist1[3]->Projection(1);\r
1737   h->SetName("mult_ND_trigger_vertex_corrected");\r
1738   aFolderObj->Add(h);\r
1739 \r
1740   h = fCorrRecEventHist1[4]->Projection(1);\r
1741   h->SetName("mult_NSD_trigger_vertex_corrected");\r
1742   aFolderObj->Add(h);\r
1743 \r
1744   // empty events\r
1745   h = fCorrRecEventHist2[0]->Projection(1);\r
1746   h->SetName("mult_empty_event_not_corrected");\r
1747   aFolderObj->Add(h);\r
1748 \r
1749   h = fCorrRecEventHist2[1]->Projection(1);\r
1750   h->SetName("mult_empty_event_vertex_corrected");\r
1751   aFolderObj->Add(h);\r
1752 \r
1753   h = fCorrRecEventHist2[2]->Projection(1);\r
1754   h->SetName("mult_empty_trigger_vertex_corrected");\r
1755   aFolderObj->Add(h);\r
1756 \r
1757   h = fCorrRecEventHist2[3]->Projection(1);\r
1758   h->SetName("mult_empty_ND_trigger_vertex_corrected");\r
1759   aFolderObj->Add(h);\r
1760 \r
1761   h = fCorrRecEventHist2[4]->Projection(1);\r
1762   h->SetName("mult_empty_NSD_trigger_vertex_corrected");\r
1763   aFolderObj->Add(h);\r
1764  \r
1765   //\r
1766   // MC available\r
1767   //\r
1768   if(IsUseMCInfo()) {\r
1769 \r
1770   // mc \r
1771   h = fMCAllEventMultHist1->Projection(1);\r
1772   h->SetName("mc_mult_event_acc_prim");\r
1773   aFolderObj->Add(h);\r
1774 \r
1775   h = fMCAllNDEventMultHist1->Projection(1);\r
1776   h->SetName("mc_mult_ND_event_acc_prim");\r
1777   aFolderObj->Add(h);\r
1778 \r
1779   h = fMCAllNSDEventMultHist1->Projection(1);\r
1780   h->SetName("mc_mult_NSD_event_acc_prim");\r
1781   aFolderObj->Add(h);\r
1782 \r
1783   h = fMCTriggerMultHist1->Projection(1);\r
1784   h->SetName("mc_mult_trigger_acc_prim");\r
1785   aFolderObj->Add(h);\r
1786 \r
1787   h = fMCEventMultHist1->Projection(1);\r
1788   h->SetName("mc_mult_trigger_event_acc_prim");\r
1789   aFolderObj->Add(h);\r
1790 \r
1791 \r
1792   //\r
1793   // track level\r
1794   //\r
1795   \r
1796   // limit eta range\r
1797   for(Int_t i=0;i<8;i++) { \r
1798       //fCorrRecTrackMultHist1[i]->GetAxis(0)->SetRangeUser(minPt,maxPt);\r
1799       //fCorrRecTrackMultHist1[i]->GetAxis(1)->SetRangeUser(minEta,maxEta);\r
1800   }\r
1801   //fMCAllPrimTrackMultHist1->GetAxis(0)->SetRangeUser(minPt,maxPt);\r
1802   //fMCAllPrimTrackMultHist1->GetAxis(1)->SetRangeUser(minEta,maxEta);\r
1803 \r
1804   //fMCNDEventAllPrimTrackMultHist1->GetAxis(0)->SetRangeUser(minPt,maxPt);\r
1805   //fMCNDEventAllPrimTrackMultHist1->GetAxis(1)->SetRangeUser(minEta,maxEta);\r
1806 \r
1807   //fMCNSDEventAllPrimTrackMultHist1->GetAxis(0)->SetRangeUser(minPt,maxPt);\r
1808   //fMCNSDEventAllPrimTrackMultHist1->GetAxis(1)->SetRangeUser(minEta,maxEta);\r
1809 \r
1810   //fMCTriggerPrimTrackMultHist1->GetAxis(0)->SetRangeUser(minPt,maxPt);\r
1811   //fMCTriggerPrimTrackMultHist1->GetAxis(1)->SetRangeUser(minEta,maxEta);\r
1812 \r
1813   //fMCEventPrimTrackMultHist1->GetAxis(0)->SetRangeUser(minPt,maxPt);\r
1814   //fMCEventPrimTrackMultHist1->GetAxis(1)->SetRangeUser(minEta,maxEta);\r
1815 \r
1816   } // end use MC info \r
1817   \r
1818   //\r
1819   h2D = fCorrRecTrackMultHist1[3]->Projection(1,0);\r
1820   h2D->SetName("pt_eta_rec_track_mult_eff_cont_corrected");\r
1821   aFolderObj->Add(h2D);\r
1822 \r
1823   h2D = fCorrRecTrackMultHist1[4]->Projection(1,0);\r
1824   h2D->SetName("pt_eta_rec_event_track_mult_eff_cont_corrected");\r
1825   aFolderObj->Add(h2D);\r
1826 \r
1827   h2D = fCorrRecTrackMultHist1[5]->Projection(1,0);\r
1828   h2D->SetName("pt_eta_rec_trig_event_track_mult_eff_cont_corrected");\r
1829   aFolderObj->Add(h2D);\r
1830 \r
1831   h2D = fCorrRecTrackMultHist1[6]->Projection(1,0);\r
1832   h2D->SetName("pt_eta_rec_ND_trig_event_track_mult_eff_cont_corrected");\r
1833   aFolderObj->Add(h2D);\r
1834 \r
1835   h2D = fCorrRecTrackMultHist1[7]->Projection(1,0);\r
1836   h2D->SetName("pt_eta_rec_NSD_trig_event_track_mult_eff_cont_corrected");\r
1837   aFolderObj->Add(h2D);\r
1838 \r
1839 \r
1840   //\r
1841   h2D = fCorrRecTrackMultHist1[3]->Projection(2,0);\r
1842   h2D->SetName("pt_mult_rec_track_mult_eff_cont_corrected");\r
1843   aFolderObj->Add(h2D);\r
1844 \r
1845   h2D = fCorrRecTrackMultHist1[4]->Projection(2,0);\r
1846   h2D->SetName("pt_mult_rec_event_track_mult_eff_cont_corrected");\r
1847   aFolderObj->Add(h2D);\r
1848 \r
1849   h2D = fCorrRecTrackMultHist1[5]->Projection(2,0);\r
1850   h2D->SetName("pt_mult_rec_trig_event_track_mult_eff_cont_corrected");\r
1851   aFolderObj->Add(h2D);\r
1852 \r
1853   h2D = fCorrRecTrackMultHist1[6]->Projection(2,0);\r
1854   h2D->SetName("pt_mult_rec_ND_trig_event_track_mult_eff_cont_corrected");\r
1855   aFolderObj->Add(h2D);\r
1856 \r
1857   h2D = fCorrRecTrackMultHist1[7]->Projection(2,0);\r
1858   h2D->SetName("pt_mult_rec_NSD_trig_event_track_mult_eff_cont_corrected");\r
1859   aFolderObj->Add(h2D);\r
1860 \r
1861   // pt axis\r
1862 \r
1863   h = fCorrRecTrackMultHist1[0]->Projection(0);\r
1864   h->SetName("pt_rec_track_not_corrected");\r
1865   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1866   hs->SetName("pt_rec_track_not_corrected_s");\r
1867   aFolderObj->Add(hs);\r
1868 \r
1869   //\r
1870   h = fCorrRecTrackMultHist1[1]->Projection(0);\r
1871   h->SetName("pt_rec_track_cont_corrected");\r
1872   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1873   hs->SetName("pt_rec_track_cont_corrected_s");\r
1874   aFolderObj->Add(hs);\r
1875 \r
1876   hsc = (TH1D*)hs->Clone("pt_rec_track_cont_corr_fact");\r
1877   hsc->Divide((TH1D*)aFolderObj->FindObject("pt_rec_track_not_corrected_s"));\r
1878   aFolderObj->Add(hsc);\r
1879 \r
1880   //\r
1881   h = fCorrRecTrackMultHist1[2]->Projection(0);\r
1882   h->SetName("pt_rec_track_eff_cont_corrected");\r
1883   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1884   hs->SetName("pt_rec_track_eff_cont_corrected_s");\r
1885   aFolderObj->Add(hs);\r
1886 \r
1887   hsc = (TH1D*)hs->Clone("pt_rec_track_eff_corr_fact");\r
1888   hsc->Divide((TH1D*)aFolderObj->FindObject("pt_rec_track_cont_corrected_s"));\r
1889   aFolderObj->Add(hsc);\r
1890 \r
1891   //\r
1892   h = fCorrRecTrackMultHist1[3]->Projection(0);\r
1893   h->SetName("pt_rec_track_mult_eff_cont_corrected");\r
1894   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1895   hs->SetName("pt_rec_track_mult_eff_cont_corrected_s");\r
1896   aFolderObj->Add(hs);\r
1897 \r
1898   hsc = (TH1D*)hs->Clone("pt_rec_track_mult_corr_fact");\r
1899   hsc->Divide((TH1D*)aFolderObj->FindObject("pt_rec_track_eff_cont_corrected_s"));\r
1900   aFolderObj->Add(hsc);\r
1901 \r
1902   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1903   hsc = (TH1D*)hs->Clone("pt_rec_track_mult_eff_cont_corr_fact");\r
1904   hsc->Divide((TH1D*)aFolderObj->FindObject("pt_rec_track_not_corrected_s"));\r
1905   aFolderObj->Add(hsc);\r
1906 \r
1907   hsc = (TH1D*)hs->Clone();\r
1908   hsc->SetName("pt_rec_track_mult_eff_cont_corrected_s_norm");\r
1909   hsc->Scale(1./(fCorrRecEventHist1[0]->Projection(1)->Integral()));\r
1910   aFolderObj->Add(hsc);\r
1911 \r
1912   //\r
1913   h = fCorrRecTrackMultHist1[4]->Projection(0);\r
1914   h->SetName("pt_rec_event_track_mult_eff_cont_corrected");\r
1915   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1916   hs->SetName("pt_rec_event_track_mult_eff_cont_corrected_s");\r
1917   aFolderObj->Add(hs);\r
1918 \r
1919   hsc = (TH1D*)hs->Clone();\r
1920   hsc->SetName("pt_rec_event_track_mult_eff_cont_corrected_s_norm");\r
1921   hsc->Scale(1./(fCorrRecEventHist1[1]->Projection(1)->Integral()+fCorrRecEventHist2[1]->Projection(1)->Integral()));\r
1922   aFolderObj->Add(hsc);\r
1923 \r
1924   //\r
1925   h = fCorrRecTrackMultHist1[5]->Projection(0);\r
1926   h->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected");\r
1927   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1928   hs->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected_s");\r
1929   aFolderObj->Add(hs);\r
1930 \r
1931   hsc = (TH1D*)hs->Clone();\r
1932   hsc->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected_s_norm");\r
1933   hsc->Scale(1./(fCorrRecEventHist1[2]->Projection(1)->Integral() + fCorrRecEventHist2[2]->Projection(1)->Integral()));\r
1934   aFolderObj->Add(hsc);\r
1935 \r
1936    // positive eta\r
1937   fCorrRecTrackMultHist1[5]->GetAxis(1)->SetRangeUser(0., maxEta);\r
1938 \r
1939   h = fCorrRecTrackMultHist1[5]->Projection(0);\r
1940   h->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected_posEta");\r
1941   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1942   hs->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected_s_posEta");\r
1943   aFolderObj->Add(hs);\r
1944 \r
1945   hsc = (TH1D*)hs->Clone();\r
1946   hsc->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected_s_norm_posEta");\r
1947   hsc->Scale(1./(fCorrRecEventHist1[2]->Projection(1)->Integral()+fCorrRecEventHist2[2]->Projection(1)->Integral()));\r
1948   aFolderObj->Add(hsc);\r
1949 \r
1950   // negative eta\r
1951   fCorrRecTrackMultHist1[5]->GetAxis(1)->SetRangeUser(minEta, -0.00001);\r
1952 \r
1953   h = fCorrRecTrackMultHist1[5]->Projection(0);\r
1954   h->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected_negEta");\r
1955   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1956   hs->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected_s_negEta");\r
1957   aFolderObj->Add(hs);\r
1958 \r
1959   hsc = (TH1D*)hs->Clone();\r
1960   hsc->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected_s_norm_negEta");\r
1961   hsc->Scale(1./(fCorrRecEventHist1[2]->Projection(1)->Integral()+fCorrRecEventHist2[2]->Projection(1)->Integral()));\r
1962   aFolderObj->Add(hsc);\r
1963 \r
1964   fCorrRecTrackMultHist1[5]->GetAxis(1)->SetRange(1, fCorrRecTrackMultHist1[5]->GetAxis(1)->GetNbins());\r
1965 \r
1966   //\r
1967   h = fCorrRecTrackMultHist1[6]->Projection(0);\r
1968   h->SetName("pt_rec_ND_trig_event_track_mult_eff_cont_corrected");\r
1969   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1970   hs->SetName("pt_rec_ND_trig_event_track_mult_eff_cont_corrected_s");\r
1971   aFolderObj->Add(hs);\r
1972 \r
1973   hsc = (TH1D*)hs->Clone();\r
1974   hsc->SetName("pt_rec_ND_trig_event_track_mult_eff_cont_corrected_s_norm");\r
1975   hsc->Scale(1./(fCorrRecEventHist1[3]->Projection(1)->Integral()+fCorrRecEventHist2[3]->Projection(1)->Integral()));\r
1976   aFolderObj->Add(hsc);\r
1977 \r
1978   //\r
1979   h = fCorrRecTrackMultHist1[7]->Projection(0);\r
1980   h->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected");\r
1981   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1982   hs->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_s");\r
1983   aFolderObj->Add(hs);\r
1984 \r
1985   hsc = (TH1D*)hs->Clone();\r
1986   hsc->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_s_norm");\r
1987   hsc->Scale(1./(fCorrRecEventHist1[4]->Projection(1)->Integral() + fCorrRecEventHist2[4]->Projection(1)->Integral()));\r
1988   aFolderObj->Add(hsc);\r
1989 \r
1990   //\r
1991   // positive eta\r
1992   //\r
1993   fCorrRecTrackMultHist1[7]->GetAxis(1)->SetRangeUser(0., maxEta);\r
1994 \r
1995   h = fCorrRecTrackMultHist1[7]->Projection(0);\r
1996   h->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_posEta");\r
1997   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1998   hs->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_s_posEta");\r
1999   aFolderObj->Add(hs);\r
2000 \r
2001   hsc = (TH1D*)hs->Clone();\r
2002   hsc->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_s_norm_posEta");\r
2003   hsc->Scale(1./(fCorrRecEventHist1[4]->Projection(1)->Integral()+fCorrRecEventHist2[4]->Projection(1)->Integral()));\r
2004   aFolderObj->Add(hsc);\r
2005 \r
2006   //\r
2007   // negative eta\r
2008   //\r
2009   fCorrRecTrackMultHist1[7]->GetAxis(1)->SetRangeUser(minEta, -0.00001);\r
2010 \r
2011   h = fCorrRecTrackMultHist1[7]->Projection(0);\r
2012   h->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_negEta");\r
2013   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
2014   hs->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_s_negEta");\r
2015   aFolderObj->Add(hs);\r
2016 \r
2017   hsc = (TH1D*)hs->Clone();\r
2018   hsc->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_s_norm_negEta");\r
2019   hsc->Scale(1./(fCorrRecEventHist1[4]->Projection(1)->Integral()+fCorrRecEventHist2[4]->Projection(1)->Integral()));\r
2020   aFolderObj->Add(hsc);\r
2021 \r
2022   fCorrRecTrackMultHist1[7]->GetAxis(1)->SetRange(1, fCorrRecTrackMultHist1[7]->GetAxis(1)->GetNbins());\r
2023 \r
2024   // eta axis\r
2025   h = fCorrRecTrackMultHist1[0]->Projection(1);\r
2026   h->SetName("eta_rec_track_not_corrected");\r
2027   aFolderObj->Add(h);\r
2028   \r
2029   h = fCorrRecTrackMultHist1[1]->Projection(1);\r
2030   h->SetName("eta_rec_track_cont_corrected");\r
2031   aFolderObj->Add(h);\r
2032 \r
2033   h = fCorrRecTrackMultHist1[2]->Projection(1);\r
2034   h->SetName("eta_rec_track_eff_cont_corrected");\r
2035   aFolderObj->Add(h);\r
2036 \r
2037   h = fCorrRecTrackMultHist1[3]->Projection(1);\r
2038   h->SetName("eta_rec_track_mult_eff_cont_corrected");\r
2039   aFolderObj->Add(h);\r
2040 \r
2041   h = fCorrRecTrackMultHist1[4]->Projection(1);\r
2042   h->SetName("eta_rec_event_track_mult_eff_cont_corrected");\r
2043   aFolderObj->Add(h);\r
2044 \r
2045   h = fCorrRecTrackMultHist1[5]->Projection(1);\r
2046   h->SetName("eta_rec_trig_event_track_mult_eff_cont_corrected");\r
2047   aFolderObj->Add(h);\r
2048 \r
2049   h = fCorrRecTrackMultHist1[6]->Projection(1);\r
2050   h->SetName("eta_rec_ND_trig_event_track_mult_eff_cont_corrected");\r
2051   aFolderObj->Add(h);\r
2052 \r
2053   h = fCorrRecTrackMultHist1[7]->Projection(1);\r
2054   h->SetName("eta_rec_NSD_trig_event_track_mult_eff_cont_corrected");\r
2055   aFolderObj->Add(h);\r
2056 \r
2057 \r
2058   //\r
2059   // MC available\r
2060   //\r
2061   if(IsUseMCInfo()) {\r
2062 \r
2063   //\r
2064   h2D = fMCAllPrimTrackMultHist1->Projection(2,0);\r
2065   h2D->SetName("mc_all_pt_mult_acc_prim");\r
2066   aFolderObj->Add(h2D);\r
2067 \r
2068   h2D = fMCAllPrimTrackMultHist1->Projection(1,0);\r
2069   h2D->SetName("mc_all_eta_pt_acc_prim");\r
2070   aFolderObj->Add(h2D);\r
2071 \r
2072   h2D = fMCNDEventAllPrimTrackMultHist1->Projection(2,0);\r
2073   h2D->SetName("mc_ND_all_pt_mult_acc_prim");\r
2074   aFolderObj->Add(h2D);\r
2075 \r
2076   h2D = fMCNDEventAllPrimTrackMultHist1->Projection(1,0);\r
2077   h2D->SetName("mc_ND_all_eta_pt_acc_prim");\r
2078   aFolderObj->Add(h2D);\r
2079 \r
2080   h2D = fMCNSDEventAllPrimTrackMultHist1->Projection(2,0);\r
2081   h2D->SetName("mc_NSD_all_pt_mult_acc_prim");\r
2082   aFolderObj->Add(h2D);\r
2083 \r
2084   h2D = fMCNSDEventAllPrimTrackMultHist1->Projection(1,0);\r
2085   h2D->SetName("mc_NSD_all_eta_pt_acc_prim");\r
2086   aFolderObj->Add(h2D);\r
2087 \r
2088   //\r
2089 \r
2090   h = fMCAllPrimTrackMultHist1->Projection(0);\r
2091   h->SetName("mc_all_pt_acc_prim");\r
2092   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
2093   hs->SetName("mc_all_pt_acc_prim_s");\r
2094   aFolderObj->Add(hs);\r
2095 \r
2096   hsc = (TH1D*)hs->Clone();\r
2097   hsc->SetName("mc_all_pt_acc_prim_s_norm");\r
2098   hsc->Scale(1./fMCAllEventMultHist1->Projection(1)->Integral());\r
2099   aFolderObj->Add(hsc);\r
2100 \r
2101   h = fMCNDEventAllPrimTrackMultHist1->Projection(0);\r
2102   h->SetName("mc_ND_all_pt_acc_prim");\r
2103   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
2104   hs->SetName("mc_ND_all_pt_acc_prim_s");\r
2105   aFolderObj->Add(hs);\r
2106 \r
2107   hsc = (TH1D*)hs->Clone();\r
2108   hsc->SetName("mc_ND_all_pt_acc_prim_s_norm");\r
2109   hsc->Scale(1./fMCAllNDEventMultHist1->Projection(1)->Integral());\r
2110   aFolderObj->Add(hsc);\r
2111 \r
2112   h = fMCNSDEventAllPrimTrackMultHist1->Projection(0);\r
2113   h->SetName("mc_NSD_all_pt_acc_prim");\r
2114   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
2115   hs->SetName("mc_NSD_all_pt_acc_prim_s");\r
2116   aFolderObj->Add(hs);\r
2117 \r
2118   hsc = (TH1D*)hs->Clone();\r
2119   hsc->SetName("mc_NSD_all_pt_acc_prim_s_norm");\r
2120   hsc->Scale(1./fMCAllNSDEventMultHist1->Projection(1)->Integral());\r
2121   aFolderObj->Add(hsc);\r
2122 \r
2123   h = fMCTriggerPrimTrackMultHist1->Projection(0);\r
2124   h->SetName("mc_trigger_all_pt_acc_prim");\r
2125   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
2126   hs->SetName("mc_trigger_all_pt_acc_prim_s");\r
2127   aFolderObj->Add(hs);\r
2128 \r
2129   hsc = (TH1D*)hs->Clone();\r
2130   hsc->SetName("mc_trigger_all_pt_acc_prim_s_norm");\r
2131   hsc->Scale(1./fMCTriggerMultHist1->Projection(1)->Integral());\r
2132   aFolderObj->Add(hsc);\r
2133 \r
2134   h = fMCEventPrimTrackMultHist1->Projection(0);\r
2135   h->SetName("mc_all_pt_acc_trig_event_prim");\r
2136   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
2137   hs->SetName("mc_all_pt_acc_trig_event_prim_s");\r
2138   aFolderObj->Add(hs);\r
2139 \r
2140   hsc = (TH1D*)hs->Clone();\r
2141   hsc->SetName("mc_all_pt_acc_trig_event_prim_s_norm");\r
2142   hsc->Scale(1./fMCEventMultHist1->Projection(1)->Integral());\r
2143   aFolderObj->Add(hsc);\r
2144 \r
2145   //\r
2146 \r
2147   h = fMCAllPrimTrackMultHist1->Projection(1);\r
2148   h->SetName("mc_all_eta_acc_prim");\r
2149   aFolderObj->Add(h);\r
2150 \r
2151   h = fMCNDEventAllPrimTrackMultHist1->Projection(1);\r
2152   h->SetName("mc_ND_all_eta_acc_prim");\r
2153   aFolderObj->Add(h);\r
2154 \r
2155   h = fMCNSDEventAllPrimTrackMultHist1->Projection(1);\r
2156   h->SetName("mc_NSD_all_eta_acc_prim");\r
2157   aFolderObj->Add(h);\r
2158 \r
2159   h = fMCTriggerPrimTrackMultHist1->Projection(1);\r
2160   h->SetName("mc_trigger_all_eta_acc_prim");\r
2161   aFolderObj->Add(h);\r
2162 \r
2163   h = fMCEventPrimTrackMultHist1->Projection(1);\r
2164   h->SetName("mc_all_eta_acc_trig_event_prim");\r
2165   aFolderObj->Add(h);\r
2166 \r
2167   //\r
2168   // calculate ratios (rec / mc)\r
2169   //\r
2170   \r
2171   hs = (TH1*)aFolderObj->FindObject("pt_rec_trig_event_track_mult_eff_cont_corrected_s_norm");\r
2172   hsc = (TH1D*)hs->Clone("ratio_pt_rec_to_mc_trig_event_track_mult_eff_cont_corrected"); \r
2173   hsc->Sumw2();\r
2174   hsc->Divide((TH1*)aFolderObj->FindObject("mc_all_pt_acc_prim_s_norm"));\r
2175   aFolderObj->Add(hsc);\r
2176 \r
2177   hs = (TH1*)aFolderObj->FindObject("eta_rec_trig_event_track_mult_eff_cont_corrected");\r
2178   hsc = (TH1D*)hs->Clone("ratio_eta_rec_to_mc_trig_event_track_mult_eff_cont_corrected"); \r
2179   hsc->Sumw2();\r
2180   hsc->Divide((TH1*)aFolderObj->FindObject("mc_all_eta_acc_prim"));\r
2181   aFolderObj->Add(hsc);\r
2182 \r
2183   //\r
2184   hs = (TH1*)aFolderObj->FindObject("pt_rec_ND_trig_event_track_mult_eff_cont_corrected_s_norm");\r
2185   hsc = (TH1D*)hs->Clone("ratio_pt_rec_to_mc_ND_trig_event_track_mult_eff_cont_corrected"); \r
2186   hsc->Sumw2();\r
2187   hsc->Divide((TH1*)aFolderObj->FindObject("mc_ND_all_pt_acc_prim_s_norm"));\r
2188   aFolderObj->Add(hsc);\r
2189 \r
2190   hs = (TH1*)aFolderObj->FindObject("eta_rec_ND_trig_event_track_mult_eff_cont_corrected");\r
2191   hsc = (TH1D*)hs->Clone("ratio_eta_rec_to_mc_ND_trig_event_track_mult_eff_cont_corrected"); \r
2192   hsc->Sumw2();\r
2193   hsc->Divide((TH1*)aFolderObj->FindObject("mc_ND_all_eta_acc_prim"));\r
2194   aFolderObj->Add(hsc);\r
2195 \r
2196   //\r
2197   hs = (TH1*)aFolderObj->FindObject("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_s_norm");\r
2198   hsc = (TH1D*)hs->Clone("ratio_pt_rec_to_mc_NSD_trig_event_track_mult_eff_cont_corrected"); \r
2199   hsc->Sumw2();\r
2200   hsc->Divide((TH1*)aFolderObj->FindObject("mc_NSD_all_pt_acc_prim_s_norm"));\r
2201   aFolderObj->Add(hsc);\r
2202 \r
2203   hs = (TH1*)aFolderObj->FindObject("eta_rec_NSD_trig_event_track_mult_eff_cont_corrected");\r
2204   hsc = (TH1D*)hs->Clone("ratio_eta_rec_to_mc_NSD_trig_event_track_mult_eff_cont_corrected"); \r
2205   hsc->Sumw2();\r
2206   hsc->Divide((TH1*)aFolderObj->FindObject("mc_NSD_all_eta_acc_prim"));\r
2207   aFolderObj->Add(hsc);\r
2208 \r
2209   //\r
2210   hs = (TH1*)aFolderObj->FindObject("pt_rec_event_track_mult_eff_cont_corrected_s_norm");\r
2211   hsc = (TH1D*)hs->Clone("ratio_pt_rec_to_mc_event_track_mult_eff_cont_corrected"); \r
2212   hsc->Sumw2();\r
2213   hsc->Divide((TH1*)aFolderObj->FindObject("mc_trigger_all_pt_acc_prim_s_norm"));\r
2214   aFolderObj->Add(hsc);\r
2215 \r
2216   hs = (TH1*)aFolderObj->FindObject("eta_rec_event_track_mult_eff_cont_corrected");\r
2217   hsc = (TH1D*)hs->Clone("ratio_eta_rec_to_mc_event_track_mult_eff_cont_corrected"); \r
2218   hsc->Sumw2();\r
2219   hsc->Divide((TH1*)aFolderObj->FindObject("mc_trigger_all_eta_acc_prim"));\r
2220   aFolderObj->Add(hsc);\r
2221 \r
2222   // track level\r
2223   hs = (TH1*)aFolderObj->FindObject("pt_rec_track_mult_eff_cont_corrected_s_norm");\r
2224   hsc = (TH1D*)hs->Clone("ratio_pt_rec_to_mc_track_mult_eff_cont_corrected"); \r
2225   hsc->Sumw2();\r
2226   hsc->Divide((TH1*)aFolderObj->FindObject("mc_all_pt_acc_trig_event_prim_s_norm"));\r
2227   aFolderObj->Add(hsc);\r
2228 \r
2229   hs = (TH1*)aFolderObj->FindObject("eta_rec_track_mult_eff_cont_corrected");\r
2230   hsc = (TH1D*)hs->Clone("ratio_eta_rec_to_mc_track_mult_eff_cont_corrected"); \r
2231   hsc->Sumw2();\r
2232   hsc->Divide((TH1*)aFolderObj->FindObject("mc_all_eta_acc_trig_event_prim"));\r
2233   aFolderObj->Add(hsc);\r
2234 \r
2235   } // end MC infor available\r
2236 \r
2237   // export objects to analysis folder\r
2238   fCorrectionFolder = ExportToFolder(aFolderObj);\r
2239 \r
2240   // delete only TObjArray\r
2241   if(aFolderObj) delete aFolderObj;\r
2242 }\r
2243 \r
2244 //_____________________________________________________________________________\r
2245 TFolder* AlidNdPtCorrection::ExportToFolder(TObjArray * const array) \r
2246 {\r
2247   // recreate folder avery time and export objects to new one\r
2248   //\r
2249   AlidNdPtCorrection * comp=this;\r
2250   TFolder *folder = comp->GetCorrectionFolder();\r
2251 \r
2252   TString name, title;\r
2253   TFolder *newFolder = 0;\r
2254   Int_t i = 0;\r
2255   Int_t size = array->GetSize();\r
2256 \r
2257   if(folder) { \r
2258      // get name and title from old folder\r
2259      name = folder->GetName();  \r
2260      title = folder->GetTitle();  \r
2261 \r
2262          // delete old one\r
2263      delete folder;\r
2264 \r
2265          // create new one\r
2266      newFolder = CreateFolder(name.Data(),title.Data());\r
2267      newFolder->SetOwner();\r
2268 \r
2269          // add objects to folder\r
2270      while(i < size) {\r
2271            newFolder->Add(array->At(i));\r
2272            i++;\r
2273          }\r
2274   }\r
2275 \r
2276 return newFolder;\r
2277 }\r
2278 \r
2279 //_____________________________________________________________________________\r
2280 TFolder* AlidNdPtCorrection::CreateFolder(TString name,TString title) { \r
2281 // create folder for analysed histograms\r
2282 //\r
2283 TFolder *folder = 0;\r
2284   folder = new TFolder(name.Data(),title.Data());\r
2285 \r
2286   return folder;\r
2287 }\r