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