modified histo ranges
[u/mrichter/AliRoot.git] / PWG0 / dNdPt / AlidNdPtCorrection.cxx
1 /**************************************************************************\r
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
3  *                                                                        *\r
4  * Author: The ALICE Off-line Project.                                    *\r
5  * Contributors are mentioned in the code where appropriate.              *\r
6  *                                                                        *\r
7  * Permission to use, copy, modify and distribute this software and its   *\r
8  * documentation strictly for non-commercial purposes is hereby granted   *\r
9  * without fee, provided that the above copyright notice appears in all   *\r
10  * copies and that both the copyright notice and this permission notice   *\r
11  * appear in the supporting documentation. The authors make no claims     *\r
12  * about the suitability of this software for any purpose. It is          *\r
13  * provided "as is" without express or implied warranty.                  *\r
14  **************************************************************************/\r
15 //------------------------------------------------------------------------------\r
16 // AlidNdPtCorrection class:\r
17 //\r
18 // a. functionality:\r
19 // - applies corrections on dNdPt spectra\r
20 // - fills corrected dNdPt histograms\r
21 // - fills correction control histograms \r
22 //\r
23 // b. data members:\r
24 // - dNdPt spectra before and after correction procedure\r
25 // - control histograms\r
26 // - correction matrices (must be loaded)\r
27 // \r
28 // Author: J.Otwinowski 04/11/2008 \r
29 //------------------------------------------------------------------------------\r
30 \r
31 #include "TFile.h"\r
32 #include "TH1.h"\r
33 #include "TH2.h"\r
34 \r
35 #include "AliHeader.h"  \r
36 #include "AliGenEventHeader.h"  \r
37 #include "AliStack.h"  \r
38 #include "AliESDEvent.h"  \r
39 #include "AliMCEvent.h"  \r
40 #include "AliESDtrackCuts.h"  \r
41 #include "AliLog.h" \r
42 #include "AliMultiplicity.h"\r
43 #include "AliTracker.h"\r
44 \r
45 #include "AlidNdPtEventCuts.h"\r
46 #include "AlidNdPtAcceptanceCuts.h"\r
47 #include "AliPhysicsSelection.h"\r
48 \r
49 #include "AliPWG0Helper.h"\r
50 #include "AlidNdPtHelper.h"\r
51 #include "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   sprintf(name,"fMCAllPrimTrackMultHist1");\r
352   sprintf(title,"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   sprintf(name,"fMCNDEventAllPrimTrackMultHist1");\r
366   sprintf(title,"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   sprintf(name,"fMCNSDEventAllPrimTrackMultHist1");\r
380   sprintf(title,"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   sprintf(name,"fMCTriggerPrimTrackMultHist1");\r
394   sprintf(title,"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   sprintf(name,"fMCEventPrimTrackMultHist1");\r
408   sprintf(title,"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   sprintf(name,"fMCAllPrimTrackTrueMultHist1");\r
426   sprintf(title,"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   sprintf(name,"fMCNDEventAllPrimTrackTrueMultHist1");\r
440   sprintf(title,"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   sprintf(name,"fMCNSDEventAllPrimTrackTrueMultHist1");\r
454   sprintf(title,"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   sprintf(name,"fMCTriggerPrimTrackTrueMultHist1");\r
468   sprintf(title,"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   sprintf(name,"fMCEventPrimTrackTrueMultHist1");\r
482   sprintf(title,"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   sprintf(name,"fMCAllPrimTrackTrueMultHist2");\r
500   sprintf(title,"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   sprintf(name,"fMCNDEventAllPrimTrackTrueMultHist2");\r
513   sprintf(title,"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   sprintf(name,"fMCNSDEventAllPrimTrackTrueMultHist2");\r
526   sprintf(title,"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   sprintf(name,"fMCTriggerPrimTrackTrueMultHist2");\r
539   sprintf(title,"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   sprintf(name,"fMCEventPrimTrackTrueMultHist2");\r
552   sprintf(title,"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   sprintf(name,"fMCAllPrimTrackMeanPtTrueMult1");\r
569   sprintf(title,"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   sprintf(name,"fMCAllPrimTrackMeanPtMult1");\r
580   sprintf(title,"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   sprintf(name,"fMCNDEventAllPrimTrackMeanPtTrueMult1");\r
592   sprintf(title,"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   sprintf(name,"fMCNDEventAllPrimTrackMeanPtMult1");\r
603   sprintf(title,"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   sprintf(name,"fMCNSDEventAllPrimTrackMeanPtTrueMult1");\r
615   sprintf(title,"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   sprintf(name,"fMCNSDEventAllPrimTrackMeanPtMult1");\r
626   sprintf(title,"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   sprintf(name,"fMCTriggerPrimTrackMeanPtTrueMult1");\r
638   sprintf(title,"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   sprintf(name,"fMCTriggerPrimTrackMeanPtMult1");\r
649   sprintf(title,"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   sprintf(name,"fMCEventPrimTrackMeanPtTrueMult1");\r
661   sprintf(title,"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   sprintf(name,"fMCEventPrimTrackMeanPtMult1");\r
672   sprintf(title,"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     sprintf(name,"fRecTrackHist1_%d",i);\r
693     sprintf(title,"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     sprintf(name,"fCorrRecTrackMultHist1_%d",i);\r
734     sprintf(title,"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     sprintf(name,"fCorrRecTrackTrueMultHist1_%d",i);\r
745     sprintf(title,"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     sprintf(name,"fCorrRecTrackTrueMultHist2_%d",i);\r
756     sprintf(title,"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     sprintf(name,"fCorrRecTrackMeanPtMultHist1_%d",i);\r
766     sprintf(title,"<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     sprintf(name,"fCorrRecTrackMeanPtTrueMultHist1_%d",i);\r
774     sprintf(title,"<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     sprintf(name,"fCorrRecTrackPt1_%d",i);\r
781     sprintf(title,"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     sprintf(name,"fCorrRecEventHist1_%d",i);\r
826     sprintf(title,"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     sprintf(name,"fCorrRecEventHist2_%d",i);\r
835     sprintf(title,"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   sprintf(name,"fCosmicsHisto");\r
850   sprintf(title,"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[2]={2,2};\r
861   Double_t minEventCount[2]={0,0}; \r
862   Double_t maxEventCount[2]={2,2}; \r
863   fEventCount = new THnSparseF("fEventCount","trig vs trig+vertex",2,binsEventCount,minEventCount,maxEventCount);\r
864   fEventCount->GetAxis(0)->SetTitle("trig");\r
865   fEventCount->GetAxis(1)->SetTitle("trig+vert");\r
866   fEventCount->Sumw2();\r
867 \r
868 \r
869   // init output folder\r
870   fCorrectionFolder = CreateFolder("folderdNdPt","Correction dNdPt Folder");\r
871 \r
872   // init correction matrices\r
873   TFile *file = (TFile *)TFile::Open(fCorrMatrixFileName.Data()); \r
874   if(!file) { \r
875     AliDebug(AliLog::kError, "file with efficiency matrices not available");\r
876     printf("file with efficiency matrices not available \n");\r
877   } else {\r
878     TFolder *folder = (TFolder *)file->FindObjectAny("folderdNdPt");\r
879     if(!folder) { \r
880       AliDebug(AliLog::kError, "file without folderdNdPt");\r
881       printf("file without folderdNdPt \n");\r
882     } else {\r
883       // rec. event mult vs true multiplicity \r
884       fEventMultCorrelationMatrix = (THnSparseF*)folder->FindObject("event_mult_correlation_matrix");\r
885       if(!fEventMultCorrelationMatrix) {\r
886          Printf("No %s matrix \n", "event_mult_correlation_matrix");\r
887          return;\r
888       }\r
889 \r
890       //\r
891       // event level corrections (zv,mult_MB)\r
892       //\r
893  \r
894       // trigger bias correction (MBtoND) \r
895       fCorrTriggerMBtoNDEventMatrix = (THnSparseF*)folder->FindObject("zv_mult_trig_MBtoND_corr_matrix");\r
896       if(!fCorrTriggerMBtoNDEventMatrix) {\r
897          Printf("No %s matrix \n", "zv_mult_trig_MBtoND_corr_matrix");\r
898          return;\r
899       }\r
900 \r
901       // trigger bias correction (MBtoNSD)\r
902       fCorrTriggerMBtoNSDEventMatrix = (THnSparseF*)folder->FindObject("zv_mult_trig_MBtoNSD_corr_matrix");\r
903       if(!fCorrTriggerMBtoNSDEventMatrix) {\r
904          Printf("No %s matrix \n", "zv_mult_trig_MBtoNSD_corr_matrix");\r
905          return;\r
906       }\r
907 \r
908       // trigger bias correction (MBtoInel)\r
909       fCorrTriggerMBtoInelEventMatrix = (THnSparseF*)folder->FindObject("zv_mult_trig_MBtoInel_corr_matrix");\r
910       if(!fCorrTriggerMBtoInelEventMatrix) {\r
911          Printf("No %s matrix \n", "zv_mult_trig_MBtoInel_corr_matrix"); \r
912          return;\r
913       }\r
914      \r
915       // vertex reconstruction efficiency correction\r
916       fCorrEventMatrix = (THnSparseF*)folder->FindObject("zv_mult_event_corr_matrix");\r
917       if(!fCorrEventMatrix) {\r
918          Printf("No %s matrix \n", "zv_mult_event_corr_matrix");\r
919          return;\r
920       }\r
921 \r
922       //\r
923       // histogram needed for empty events corrections\r
924       //\r
925       fZvNorm = (TH1D*)folder->FindObject("zv_distribution_norm");\r
926       if(!fZvNorm) {\r
927          Printf("No %s matrix \n", "fZvNorm");\r
928          return;\r
929       }\r
930 \r
931       fZvEmptyEventsNorm = (TH1D*)folder->FindObject("zv_empty_events_norm");\r
932       if(!fZvEmptyEventsNorm) {\r
933          Printf("No %s matrix \n", "fZvEmptyEventsNorm");\r
934          return;\r
935       }\r
936 \r
937       fLHCBin0Background = (TH1D*)folder->FindObject("hLHCBin0Background");\r
938       if(!fLHCBin0Background) {\r
939          Printf("No %s matrix \n", "fLHCBin0Background");\r
940          return;\r
941       }\r
942 \r
943       //\r
944       // track-event level corrections (zv,pt,eta)\r
945       //\r
946 \r
947       // trigger bias correction (MBtoND) \r
948       fCorrTriggerMBtoNDTrackEventMatrix = (THnSparseF*)folder->FindObject("zv_pt_eta_track_trig_MBtoND_corr_matrix");\r
949       if(!fCorrTriggerMBtoNDTrackEventMatrix) {\r
950          Printf("No %s matrix \n", "zv_pt_eta_track_trig_MBtoND_corr_matrix");\r
951          return;\r
952       }\r
953 \r
954       // trigger bias correction (MBtoNSD)\r
955       fCorrTriggerMBtoNSDTrackEventMatrix = (THnSparseF*)folder->FindObject("zv_pt_eta_track_trig_MBtoNSD_corr_matrix");\r
956       if(!fCorrTriggerMBtoNSDTrackEventMatrix) {\r
957          Printf("No %s matrix \n", "zv_pt_eta_track_trig_MBtoNSD_corr_matrix");\r
958          return;\r
959       }\r
960 \r
961       // trigger bias correction (MBtoInel) \r
962       fCorrTriggerMBtoInelTrackEventMatrix = (THnSparseF*)folder->FindObject("zv_pt_eta_track_trig_MBtoInel_corr_matrix");\r
963       if(!fCorrTriggerMBtoInelTrackEventMatrix) {\r
964          Printf("No %s matrix \n", "zv_pt_eta_track_trig_MBtoInel_corr_matrix");\r
965          return;\r
966       }\r
967     \r
968       // vertex reconstruction efficiency correction (zv,pt,eta)\r
969       fCorrTrackEventMatrix = (THnSparseF*)folder->FindObject("zv_pt_eta_track_event_corr_matrix");\r
970       if(!fCorrTrackEventMatrix) {\r
971          Printf("No %s matrix \n", "zv_pt_eta_track_event_corr_matrix");\r
972          return;\r
973       }\r
974 \r
975       // track reconstruction efficiency correction (zv,pt,eta)\r
976       fCorrTrackMatrix = (THnSparseF*)folder->FindObject("zv_pt_eta_track_corr_matrix");\r
977       if(!fCorrTrackMatrix) {\r
978          Printf("No %s matrix \n", "zv_pt_eta_track_corr_matrix");\r
979          return;\r
980       }\r
981 \r
982       // high pt track reconstruction efficiency correction (zv,pt,eta)\r
983       fCorrHighPtTrackMatrix = (THnSparseF*)folder->FindObject("zv_pt_eta_highPt_track_corr_matrix");\r
984       if(!fCorrHighPtTrackMatrix) {\r
985          Printf("No %s matrix \n", "zv_pt_eta_highPt_track_corr_matrix");\r
986          return;\r
987       }\r
988 \r
989       // secondary tracks contamination correction (zv,pt,eta)\r
990       fContTrackMatrix = (THnSparseF*)folder->FindObject("zv_pt_eta_track_cont_matrix");\r
991       if(!fContTrackMatrix) {\r
992          Printf("No %s matrix \n", "zv_pt_eta_track_cont_matrix");\r
993          return;\r
994       }\r
995 \r
996       // multiply reconstructed tracks correction\r
997       fContMultTrackMatrix = (THnSparseF*)folder->FindObject("zv_pt_eta_mult_track_cont_matrix");\r
998       if(!fContMultTrackMatrix) {\r
999          Printf("No %s matrix \n", "zv_pt_eta_mult_track_cont_matrix");\r
1000          return;\r
1001       }\r
1002     }\r
1003   }\r
1004 \r
1005 }\r
1006 \r
1007 //_____________________________________________________________________________\r
1008 void AlidNdPtCorrection::Process(AliESDEvent *esdEvent, AliMCEvent *mcEvent)\r
1009 {\r
1010   //\r
1011   // Process real and/or simulated events\r
1012   //\r
1013   if(!esdEvent) {\r
1014     AliDebug(AliLog::kError, "esdEvent not available");\r
1015     return;\r
1016   }\r
1017 \r
1018   // get selection cuts\r
1019   AlidNdPtEventCuts *evtCuts = GetEventCuts(); \r
1020   AlidNdPtAcceptanceCuts *accCuts = GetAcceptanceCuts(); \r
1021   AliESDtrackCuts *esdTrackCuts = GetTrackCuts(); \r
1022 \r
1023   if(!evtCuts || !accCuts  || !esdTrackCuts) {\r
1024     AliDebug(AliLog::kError, "cuts not available");\r
1025     return;\r
1026   }\r
1027 \r
1028   // trigger selection\r
1029   Bool_t isEventTriggered = kTRUE;\r
1030   AliPhysicsSelection *trigSel = NULL;\r
1031   AliTriggerAnalysis *trigAna = NULL; // needed for andV0\r
1032 \r
1033   if(evtCuts->IsTriggerRequired())  \r
1034   {\r
1035     //\r
1036     trigSel = GetPhysicsTriggerSelection();\r
1037     if(!trigSel) {\r
1038       AliDebug(AliLog::kError, "cannot get trigSel");\r
1039       return;\r
1040     }\r
1041     \r
1042     if(IsUseMCInfo()) \r
1043     { \r
1044       trigSel->SetAnalyzeMC();\r
1045 \r
1046       if(GetParticleMode() == AlidNdPtHelper::kVZEROCase1)\r
1047       {\r
1048         // check V0 systematics (case1)\r
1049         // Initialization done in the macro\r
1050         trigAna = trigSel->GetTriggerAnalysis();\r
1051         if(!trigAna) \r
1052           return;\r
1053 \r
1054         //trigAna->SetV0HwPars(15, 61.5, 86.5);\r
1055         //trigAna->SetV0AdcThr(15);\r
1056 \r
1057         isEventTriggered = trigSel->IsCollisionCandidate(esdEvent);\r
1058         //printf("MB1 & kVZEROCase1  %d \n",isEventTriggered);\r
1059         //isEventTriggered = trigAna->IsOfflineTriggerFired(esdEvent, GetTrigger());\r
1060         \r
1061         if(GetTrigger() == AliTriggerAnalysis::kV0AND) \r
1062         {\r
1063           isEventTriggered = trigAna->IsOfflineTriggerFired(esdEvent, GetTrigger());\r
1064           //printf("V0AND %d \n",isEventTriggered);\r
1065         }\r
1066       }\r
1067       else if(GetParticleMode() == AlidNdPtHelper::kVZEROCase2)\r
1068       {\r
1069         // check V0 systematics (case2 only in MC)\r
1070         // Initialization done in the macro\r
1071 \r
1072         trigAna = trigSel->GetTriggerAnalysis();\r
1073         if(!trigAna) \r
1074           return;\r
1075 \r
1076         //trigAna->SetV0HwPars(0, 0, 125);\r
1077         //trigAna->SetV0AdcThr(0);\r
1078 \r
1079         isEventTriggered = trigSel->IsCollisionCandidate(esdEvent);\r
1080         //isEventTriggered = trigAna->IsOfflineTriggerFired(esdEvent, GetTrigger());\r
1081         \r
1082         if(GetTrigger() == AliTriggerAnalysis::kV0AND) \r
1083         {\r
1084           isEventTriggered = trigAna->IsOfflineTriggerFired(esdEvent, GetTrigger());\r
1085           //printf("V0AND %d \n",isEventTriggered);\r
1086         }\r
1087       }\r
1088       else {\r
1089         isEventTriggered = trigSel->IsCollisionCandidate(esdEvent);\r
1090         //printf("MB1 %d \n",isEventTriggered);\r
1091         \r
1092         if(GetTrigger() == AliTriggerAnalysis::kV0AND) \r
1093         {\r
1094           trigAna = trigSel->GetTriggerAnalysis();\r
1095           if(!trigAna) \r
1096             return;\r
1097 \r
1098           isEventTriggered = trigAna->IsOfflineTriggerFired(esdEvent, GetTrigger());\r
1099           //printf("V0AND %d \n",isEventTriggered);\r
1100         }\r
1101       }\r
1102     }\r
1103     else {\r
1104       //\r
1105       // 0-multiplicity bin for LHC background correction\r
1106       //\r
1107       if( GetAnalysisMode() == AlidNdPtHelper::kTPCITS || \r
1108           GetAnalysisMode() == AlidNdPtHelper::kTPCTrackSPDvtx || \r
1109           GetAnalysisMode() == AlidNdPtHelper::kTPCTrackSPDvtxUpdate || \r
1110           GetAnalysisMode() == AlidNdPtHelper::kTPCITSHybridTrackSPDvtx || \r
1111           GetAnalysisMode() == AlidNdPtHelper::kTPCITSHybridTrackSPDvtxDCArPt ) \r
1112       {\r
1113         trigSel->SetBin0CallbackViaPointer(&AlidNdPtAnalysis::IsBinZeroTrackSPDvtx);\r
1114       } else {\r
1115         trigSel->SetBin0CallbackViaPointer(&AlidNdPtAnalysis::IsBinZeroSPDvtx);\r
1116       }\r
1117 \r
1118       if(GetParticleMode() == AlidNdPtHelper::kVZEROCase1)\r
1119       {\r
1120         // check V0 systematics (case1)\r
1121         // Initialization done in the macro\r
1122         trigAna = trigSel->GetTriggerAnalysis();\r
1123         if(!trigAna) \r
1124           return;\r
1125 \r
1126         //trigAna->SetV0HwPars(15, 61.5, 86.5);\r
1127         //trigAna->SetV0AdcThr(15);\r
1128 \r
1129         isEventTriggered = trigSel->IsCollisionCandidate(esdEvent);\r
1130         //isEventTriggered = trigAna->IsOfflineTriggerFired(esdEvent, GetTrigger());\r
1131         \r
1132         if(GetTrigger() == AliTriggerAnalysis::kV0AND) \r
1133         {\r
1134           isEventTriggered = trigAna->IsOfflineTriggerFired(esdEvent, GetTrigger());\r
1135           //printf("V0AND %d \n",isEventTriggered);\r
1136         }\r
1137       }\r
1138       else {\r
1139         isEventTriggered = trigSel->IsCollisionCandidate(esdEvent);\r
1140         //printf("MB1 %d \n",isEventTriggered);\r
1141         \r
1142         if(GetTrigger() == AliTriggerAnalysis::kV0AND) \r
1143         {\r
1144           trigAna = trigSel->GetTriggerAnalysis();\r
1145           if(!trigAna) \r
1146             return;\r
1147 \r
1148           isEventTriggered = trigAna->IsOfflineTriggerFired(esdEvent, GetTrigger());\r
1149           //printf("V0AND %d \n",isEventTriggered);\r
1150         }\r
1151       }\r
1152     }\r
1153   }\r
1154 \r
1155   // use MC information\r
1156   AliHeader* header = 0;\r
1157   AliGenEventHeader* genHeader = 0;\r
1158   AliStack* stack = 0;\r
1159   TArrayF vtxMC(3);\r
1160   AliPWG0Helper::MCProcessType evtType = AliPWG0Helper::kInvalidProcess;\r
1161   Int_t multMCTrueTracks = 0;\r
1162 \r
1163   if(IsUseMCInfo())\r
1164   {\r
1165     if(!mcEvent) {\r
1166       AliDebug(AliLog::kError, "mcEvent not available");\r
1167       return;\r
1168     }\r
1169 \r
1170     // get MC event header\r
1171     header = mcEvent->Header();\r
1172     if (!header) {\r
1173       AliDebug(AliLog::kError, "Header not available");\r
1174       return;\r
1175     }\r
1176     // MC particle stack\r
1177     stack = mcEvent->Stack();\r
1178     if (!stack) {\r
1179       AliDebug(AliLog::kError, "Stack not available");\r
1180       return;\r
1181     }\r
1182 \r
1183     // get event type (ND=0x1, DD=0x2, SD=0x4)\r
1184     evtType = AliPWG0Helper::GetEventProcessType(header);\r
1185     //Printf("evtType %d \n", evtType);\r
1186     AliDebug(AliLog::kDebug+1, Form("Found process type %d", evtType));\r
1187 \r
1188     // get MC vertex\r
1189     genHeader = header->GenEventHeader();\r
1190     if (!genHeader) {\r
1191       AliDebug(AliLog::kError, "Could not retrieve genHeader from Header");\r
1192       return;\r
1193     }\r
1194     genHeader->PrimaryVertex(vtxMC);\r
1195 \r
1196     // Fill MC event histogram\r
1197     Double_t vMCEventHist1[3]={vtxMC[0],vtxMC[1],vtxMC[2]};\r
1198     fMCEventHist1->Fill(vMCEventHist1);\r
1199 \r
1200     // multipliticy of all MC primary tracks\r
1201     // in Zvtx, eta ranges\r
1202     multMCTrueTracks = AlidNdPtHelper::GetMCTrueTrackMult(mcEvent,evtCuts,accCuts);\r
1203 \r
1204   } // end bUseMC\r
1205 \r
1206   // get reconstructed vertex  \r
1207   const AliESDVertex* vtxESD = 0; \r
1208   Bool_t isRecVertex = kFALSE;\r
1209   if(evtCuts->IsRecVertexRequired()) \r
1210   {\r
1211     Bool_t bRedoTPCVertex = evtCuts->IsRedoTPCVertex();\r
1212     Bool_t bUseConstraints = evtCuts->IsUseBeamSpotConstraint();\r
1213     vtxESD = AlidNdPtHelper::GetVertex(esdEvent,evtCuts,accCuts,esdTrackCuts,GetAnalysisMode(),kFALSE,bRedoTPCVertex,bUseConstraints); \r
1214     isRecVertex = AlidNdPtHelper::TestRecVertex(vtxESD, esdEvent->GetPrimaryVertexSPD(), GetAnalysisMode(), kFALSE);\r
1215   }\r
1216 \r
1217   if( IsUseMCInfo() && !evtCuts->IsRecVertexRequired() ) {\r
1218     vtxESD = new AliESDVertex(vtxMC[2],10.,genHeader->NProduced(),"smearMC");\r
1219     isRecVertex = kTRUE;\r
1220   }\r
1221 \r
1222   Bool_t isEventOK = evtCuts->AcceptEvent(esdEvent,mcEvent,vtxESD) && isRecVertex; \r
1223   //printf("isEventOK %d, isEventTriggered %d \n",isEventOK, isEventTriggered);\r
1224   //printf("GetAnalysisMode() %d \n",GetAnalysisMode());\r
1225 \r
1226   // vertex contributors\r
1227   Int_t multMBTracks = 0; \r
1228   if(GetAnalysisMode() == AlidNdPtHelper::kTPC) \r
1229   {  \r
1230      if(vtxESD->GetStatus() && isRecVertex)\r
1231        multMBTracks = AlidNdPtHelper::GetTPCMBTrackMult(esdEvent,evtCuts,accCuts,esdTrackCuts);\r
1232   } \r
1233   else if( GetAnalysisMode() == AlidNdPtHelper::kTPCITS ||  GetAnalysisMode() == AlidNdPtHelper::kTPCSPDvtx || \r
1234            GetAnalysisMode()==AlidNdPtHelper::kTPCSPDvtxUpdate || GetAnalysisMode()==AlidNdPtHelper::kTPCITSHybrid ) \r
1235   {\r
1236      const AliMultiplicity* mult = esdEvent->GetMultiplicity();\r
1237      //if(mult && vtxESD->GetStatus() && isRecVertex)\r
1238      if(mult)\r
1239        multMBTracks = mult->GetNumberOfTracklets();\r
1240     \r
1241   } \r
1242   else if( GetAnalysisMode() == AlidNdPtHelper::kTPCITS || \r
1243            GetAnalysisMode() == AlidNdPtHelper::kTPCTrackSPDvtx || \r
1244            GetAnalysisMode() == AlidNdPtHelper::kTPCTrackSPDvtxUpdate || \r
1245            GetAnalysisMode() == AlidNdPtHelper::kTPCITSHybridTrackSPDvtx || \r
1246            GetAnalysisMode() == AlidNdPtHelper::kTPCITSHybridTrackSPDvtxDCArPt )\r
1247   {\r
1248      if(vtxESD->GetStatus() && isRecVertex)\r
1249        multMBTracks = vtxESD->GetNContributors();\r
1250 \r
1251   }\r
1252   else {\r
1253     AliDebug(AliLog::kError, Form("Found analysis type %d", GetAnalysisMode()));\r
1254     return; \r
1255   }\r
1256 \r
1257   Bool_t isTrigAndVertex = isEventTriggered && isEventOK;\r
1258   Double_t vEventCount[2] = { isEventTriggered, isTrigAndVertex};\r
1259   fEventCount->Fill(vEventCount);\r
1260 \r
1261   //\r
1262   // correct event and track histograms\r
1263   //\r
1264   TObjArray *allChargedTracks=0;\r
1265   Int_t multRec=0, multRecTemp=0;\r
1266   Int_t *labelsRec=0;\r
1267   Bool_t isCosmic = kFALSE;\r
1268 \r
1269 \r
1270   if(isEventOK && isEventTriggered)\r
1271   {\r
1272     // get all charged tracks\r
1273     allChargedTracks = AlidNdPtHelper::GetAllChargedTracks(esdEvent,GetAnalysisMode());\r
1274     if(!allChargedTracks) return;\r
1275 \r
1276     Int_t entries = allChargedTracks->GetEntries();\r
1277     labelsRec = new Int_t[entries];\r
1278 \r
1279     // calculate mult of reconstructed tracks\r
1280 \r
1281     for(Int_t i=0; i<entries;++i) \r
1282     {\r
1283       AliESDtrack *track = (AliESDtrack*)allChargedTracks->At(i);\r
1284       if(!track) continue;\r
1285       if(track->Charge()==0) continue;\r
1286 \r
1287 \r
1288       // only postive charged \r
1289       if(GetParticleMode() == AlidNdPtHelper::kPlus && track->Charge() < 0) \r
1290         continue;\r
1291       \r
1292       // only negative charged \r
1293       if(GetParticleMode() == AlidNdPtHelper::kMinus && track->Charge() > 0) \r
1294         continue;\r
1295 \r
1296       // cosmics analysis\r
1297       isCosmic = kFALSE;\r
1298       if( GetParticleMode()==AlidNdPtHelper::kCosmic )\r
1299       {\r
1300           for(Int_t j=0; j<entries;++j) \r
1301           {\r
1302             AliESDtrack *track1 = (AliESDtrack*)allChargedTracks->At(j);\r
1303             if(!track1) continue;\r
1304             if(track1->Charge()==0) continue;\r
1305 \r
1306             if( esdTrackCuts->AcceptTrack(track) && accCuts->AcceptTrack(track) && \r
1307                 esdTrackCuts->AcceptTrack(track1) && accCuts->AcceptTrack(track1) ) \r
1308             { \r
1309               isCosmic = AlidNdPtHelper::IsCosmicTrack(track, track1);\r
1310             }\r
1311             if(isCosmic) \r
1312             {\r
1313               Double_t vCosmicsHisto[3] = { track->Eta()+track1->Eta(), track->Phi()-track1->Phi(), track1->Pt() };\r
1314               fCosmicsHisto->Fill(vCosmicsHisto);\r
1315             }\r
1316           }\r
1317          \r
1318         if(!isCosmic) continue;\r
1319       }\r
1320 \r
1321       if(esdTrackCuts->AcceptTrack(track)) \r
1322       {\r
1323           if(accCuts->AcceptTrack(track)) multRecTemp++;\r
1324       }  \r
1325     }\r
1326 \r
1327     //\r
1328     for(Int_t i=0; i<entries;++i) \r
1329     {\r
1330       AliESDtrack *track = (AliESDtrack*)allChargedTracks->At(i);\r
1331       if(!track) continue;\r
1332       if(track->Charge()==0) continue;\r
1333 \r
1334       // only postive charged \r
1335       if(GetParticleMode() == AlidNdPtHelper::kPlus && track->Charge() < 0) \r
1336       continue;\r
1337       \r
1338       // only negative charged \r
1339       if(GetParticleMode() == AlidNdPtHelper::kMinus && track->Charge() > 0) \r
1340       continue;\r
1341         \r
1342       // track-level corrections\r
1343       if(!esdTrackCuts->AcceptTrack(track))  continue;\r
1344       //if(GetAnalysisMode()==AlidNdPtHelper::kTPCITSHybridTrackSPDvtxDCArPt && !AlidNdPtHelper::IsGoodImpPar(track)) continue;\r
1345 \r
1346         // cosmics analysis\r
1347         isCosmic = kFALSE;\r
1348         if( GetParticleMode()==AlidNdPtHelper::kCosmic )\r
1349         {\r
1350           for(Int_t j=0; j<entries;++j) \r
1351           {\r
1352             AliESDtrack *track1 = (AliESDtrack*)allChargedTracks->At(j);\r
1353             if(!track1) continue;\r
1354             if(track1->Charge()==0) continue;\r
1355 \r
1356             if( esdTrackCuts->AcceptTrack(track) && accCuts->AcceptTrack(track) && \r
1357                 esdTrackCuts->AcceptTrack(track1) && accCuts->AcceptTrack(track1) ) \r
1358             { \r
1359               isCosmic = AlidNdPtHelper::IsCosmicTrack(track, track1);\r
1360             }\r
1361           }\r
1362           if(!isCosmic) continue;\r
1363         }\r
1364 \r
1365         Bool_t isOK = kFALSE;\r
1366         Double_t x[3]; track->GetXYZ(x);\r
1367         Double_t b[3]; AliTracker::GetBxByBz(x,b);\r
1368 \r
1369         //\r
1370         // if TPC-ITS hybrid tracking (kTPCITSHybrid)\r
1371         // replace track parameters with TPC-ony track parameters\r
1372         //\r
1373         if( GetAnalysisMode() == AlidNdPtHelper::kTPCITSHybrid || GetAnalysisMode() == AlidNdPtHelper::kTPCITSHybridTrackSPDvtx || GetAnalysisMode() == AlidNdPtHelper::kTPCITSHybridTrackSPDvtxDCArPt) \r
1374         {\r
1375           // Relate TPC-only tracks to Tracks or SPD vertex\r
1376           isOK = track->RelateToVertexTPCBxByBz(vtxESD, b, kVeryBig);\r
1377           if(!isOK) continue;\r
1378 \r
1379           // replace esd track parameters with TPCinner\r
1380           AliExternalTrackParam  *tpcTrack  = new AliExternalTrackParam(*(track->GetTPCInnerParam()));\r
1381           if (!tpcTrack) return;\r
1382           track->Set(tpcTrack->GetX(),tpcTrack->GetAlpha(),tpcTrack->GetParameter(),tpcTrack->GetCovariance());\r
1383 \r
1384           if(tpcTrack) delete tpcTrack; \r
1385         } \r
1386 \r
1387         //\r
1388         if (GetAnalysisMode()==AlidNdPtHelper::kTPCSPDvtxUpdate || GetAnalysisMode()==AlidNdPtHelper::kTPCTrackSPDvtxUpdate) \r
1389         {\r
1390            //\r
1391            // update track parameters\r
1392            //\r
1393            AliExternalTrackParam cParam;\r
1394            isOK = track->RelateToVertexTPC(vtxESD,esdEvent->GetMagneticField(),kVeryBig,&cParam);\r
1395            if(!isOK) continue;\r
1396            track->Set(cParam.GetX(),cParam.GetAlpha(),cParam.GetParameter(),cParam.GetCovariance());\r
1397 \r
1398            if(accCuts->AcceptTrack(track)) { \r
1399              FillHistograms(track,stack,AlidNdPtHelper::kRecTracks,vtxESD->GetZv(),multRecTemp,multMCTrueTracks); \r
1400              labelsRec[multRec] = TMath::Abs(track->GetLabel());\r
1401              multRec++;\r
1402            }\r
1403          }\r
1404          else if (GetAnalysisMode()==AlidNdPtHelper::kMCRec && IsUseMCInfo()) \r
1405          { \r
1406            //\r
1407            // Replace rec with MC\r
1408            //\r
1409            if(accCuts->AcceptTrack(track)) { \r
1410              FillHistograms(track,stack,AlidNdPtHelper::kRecTracks,vtxMC[2],multRecTemp, multMCTrueTracks); \r
1411              labelsRec[multRec] = TMath::Abs(track->GetLabel());\r
1412              multRec++;\r
1413            }\r
1414          } \r
1415          else  {\r
1416            //\r
1417            // all the rest tracking scenarios\r
1418            //\r
1419            if(accCuts->AcceptTrack(track)) { \r
1420              FillHistograms(track,stack,AlidNdPtHelper::kRecTracks,vtxESD->GetZv(),multRecTemp, multMCTrueTracks); \r
1421              labelsRec[multRec] = TMath::Abs(track->GetLabel());\r
1422              multRec++;\r
1423            }\r
1424          }\r
1425       }\r
1426 \r
1427     // event-level corrections\r
1428     if(GetAnalysisMode()==AlidNdPtHelper::kMCRec && IsUseMCInfo()) \r
1429     { \r
1430       FillHistograms(AlidNdPtHelper::kRecEvents,vtxMC[2],multMBTracks);\r
1431     }\r
1432     else {\r
1433       FillHistograms(AlidNdPtHelper::kRecEvents,vtxESD->GetZv(),multMBTracks);\r
1434     }\r
1435 \r
1436     // calculate meanPt from the event\r
1437     Double_t meanPtMult[8] = {0};  \r
1438     for (Int_t i = 0; i<8; i++) {\r
1439       if(!fCorrRecTrackMultHist1[i]) continue;\r
1440       TH1D *hp = (TH1D *)fCorrRecTrackPt1[i]->Projection(0);\r
1441       if(!hp) continue;\r
1442       meanPtMult[i] = hp->GetMean();    \r
1443       Double_t vCorrRecTrackMeanPtMultHist1[2] = {meanPtMult[i],multRecTemp};\r
1444       fCorrRecTrackMeanPtMultHist1[i]->Fill(vCorrRecTrackMeanPtMultHist1); \r
1445       \r
1446       if( IsUseMCInfo() ) {\r
1447         Double_t vCorrRecTrackMeanPtTrueMultHist1[2] = {meanPtMult[i],multMCTrueTracks};\r
1448         fCorrRecTrackMeanPtTrueMultHist1[i]->Fill(vCorrRecTrackMeanPtTrueMultHist1); \r
1449       }\r
1450 \r
1451       // reset pt histo for the next event\r
1452       if(fCorrRecTrackPt1[i])  fCorrRecTrackPt1[i]->Reset();\r
1453       if(hp) delete hp;\r
1454     }\r
1455 \r
1456     // control event histograms\r
1457     Double_t vRecEventHist1[3] = {vtxESD->GetXv(),vtxESD->GetYv(),vtxESD->GetZv()};\r
1458     fRecEventHist1->Fill(vRecEventHist1);\r
1459 \r
1460     // correlation track multiplicity vs MB track multiplicity\r
1461     Double_t vRecEventMultHist1[3] = {multRec, multMBTracks};\r
1462     fRecEventMultHist1->Fill(vRecEventMultHist1);\r
1463   }\r
1464 \r
1465   // empty events corrections\r
1466   // no reconstructed zv\r
1467   if( isEventTriggered && multMBTracks==0 ) \r
1468   {\r
1469     if(GetAnalysisMode()==AlidNdPtHelper::kMCRec && IsUseMCInfo()) \r
1470     {\r
1471       FillHistograms(AlidNdPtHelper::kTriggeredEvents,vtxMC[2],multMBTracks);\r
1472     }\r
1473     else {\r
1474       Double_t zv = fZvNorm->GetRandom();\r
1475       if(zv>evtCuts->GetMinZv() && zv<evtCuts->GetMaxZv())\r
1476         FillHistograms(AlidNdPtHelper::kTriggeredEvents,zv,multMBTracks);\r
1477     }\r
1478   }\r
1479 \r
1480   if(IsUseMCInfo())  \r
1481   {\r
1482     // select MC events \r
1483     if(evtCuts->AcceptMCEvent(mcEvent))\r
1484     {\r
1485       //\r
1486       // event histograms\r
1487       //\r
1488       Double_t vMCEventMatrix[2] = {vtxMC[2],multMBTracks};\r
1489       fMCAllEventMultHist1->Fill(vMCEventMatrix);\r
1490 \r
1491       if(evtType == AliPWG0Helper::kND) {\r
1492         fMCAllNDEventMultHist1->Fill(vMCEventMatrix);\r
1493       }\r
1494       if(evtType != AliPWG0Helper::kSD) {\r
1495         fMCAllNSDEventMultHist1->Fill(vMCEventMatrix);\r
1496       }\r
1497       if(isEventTriggered) {\r
1498         fMCTriggerMultHist1->Fill(vMCEventMatrix);\r
1499       }\r
1500       if(isEventTriggered && isEventOK) {\r
1501         fMCEventMultHist1->Fill(vMCEventMatrix);\r
1502       }\r
1503 \r
1504       //\r
1505       // MC histograms for efficiency studies\r
1506       //\r
1507       Double_t sumPtMC = 0;\r
1508       Int_t nPart  = stack->GetNtrack();\r
1509       for (Int_t iMc = 0; iMc < nPart; ++iMc) \r
1510       {\r
1511         // print MC stack info\r
1512         //AlidNdPtHelper::PrintMCInfo(stack,iMc);\r
1513 \r
1514         TParticle* particle = stack->Particle(iMc);\r
1515         if (!particle)\r
1516         continue;\r
1517 \r
1518         // only charged particles\r
1519           \r
1520         if(!particle->GetPDG()) continue;\r
1521         Double_t charge = particle->GetPDG()->Charge()/3.;\r
1522         if (TMath::Abs(charge) < 0.001)\r
1523           continue;\r
1524 \r
1525         // only postive charged \r
1526         if(GetParticleMode() == AlidNdPtHelper::kPlus && charge  < 0.) \r
1527         continue;\r
1528       \r
1529         // only negative charged \r
1530         if(GetParticleMode() == AlidNdPtHelper::kMinus && charge > 0.) \r
1531         continue;\r
1532       \r
1533         // physical primary\r
1534         Bool_t prim = stack->IsPhysicalPrimary(iMc);\r
1535         if(!prim) continue;\r
1536 \r
1537         // all primaries in acceptance\r
1538         if(!accCuts->AcceptTrack(particle)) continue;\r
1539 \r
1540         Double_t gpt = particle->Pt();\r
1541         Double_t geta = particle->Eta();\r
1542 \r
1543         // sum up pt in the event\r
1544         sumPtMC +=gpt; \r
1545 \r
1546         Double_t valMCAllTrackMultHist1[3] = {gpt,geta,multRecTemp};      \r
1547         Double_t valMCAllTrackTrueMultHist1[3] = {gpt,geta,multMCTrueTracks};     \r
1548         Double_t valMCAllTrackTrueMultHist2[3] = {gpt,multRecTemp,multMCTrueTracks};      \r
1549 \r
1550         fMCAllPrimTrackMultHist1->Fill(valMCAllTrackMultHist1);\r
1551         fMCAllPrimTrackTrueMultHist1->Fill(valMCAllTrackTrueMultHist1);\r
1552         fMCAllPrimTrackTrueMultHist2->Fill(valMCAllTrackTrueMultHist2);\r
1553 \r
1554         if(evtType == AliPWG0Helper::kND) {\r
1555           fMCNDEventAllPrimTrackMultHist1->Fill(valMCAllTrackMultHist1);\r
1556           fMCNDEventAllPrimTrackTrueMultHist1->Fill(valMCAllTrackTrueMultHist1);\r
1557           fMCNDEventAllPrimTrackTrueMultHist2->Fill(valMCAllTrackTrueMultHist2);\r
1558         }\r
1559         if(evtType != AliPWG0Helper::kSD) {\r
1560           fMCNSDEventAllPrimTrackMultHist1->Fill(valMCAllTrackMultHist1);\r
1561           fMCNSDEventAllPrimTrackTrueMultHist1->Fill(valMCAllTrackTrueMultHist1);\r
1562           fMCNSDEventAllPrimTrackTrueMultHist2->Fill(valMCAllTrackTrueMultHist2);\r
1563         }\r
1564         if(isEventTriggered) { \r
1565           fMCTriggerPrimTrackMultHist1->Fill(valMCAllTrackMultHist1);\r
1566           fMCTriggerPrimTrackTrueMultHist1->Fill(valMCAllTrackTrueMultHist1);\r
1567           fMCTriggerPrimTrackTrueMultHist2->Fill(valMCAllTrackTrueMultHist2);\r
1568         }\r
1569         if(isEventTriggered && isEventOK) { \r
1570           fMCEventPrimTrackMultHist1->Fill(valMCAllTrackMultHist1);\r
1571           fMCEventPrimTrackTrueMultHist1->Fill(valMCAllTrackTrueMultHist1);\r
1572           fMCEventPrimTrackTrueMultHist2->Fill(valMCAllTrackTrueMultHist2);\r
1573         }\r
1574       }\r
1575 \r
1576       //\r
1577       // calculate <pt> in the event\r
1578       //\r
1579       Double_t meanPtMCMult = 0;\r
1580       Double_t meanPtMCTrueMult = 0;\r
1581       if(multRecTemp) { \r
1582         meanPtMCMult = sumPtMC/multRecTemp; \r
1583       }\r
1584       if(multMCTrueTracks) { \r
1585         meanPtMCTrueMult = sumPtMC/multMCTrueTracks; \r
1586       }\r
1587 \r
1588       Double_t valMCMeanPtMult[2] = {meanPtMCMult,multRecTemp};   \r
1589       Double_t valMCMeanPtTrueMult[2] = {meanPtMCTrueMult,multMCTrueTracks};      \r
1590 \r
1591       fMCAllPrimTrackMeanPtMult1->Fill(valMCMeanPtMult);\r
1592       fMCAllPrimTrackMeanPtTrueMult1->Fill(valMCMeanPtTrueMult);\r
1593 \r
1594       if(evtType == AliPWG0Helper::kND) {\r
1595           fMCNDEventAllPrimTrackMeanPtMult1->Fill(valMCMeanPtMult);\r
1596           fMCNDEventAllPrimTrackMeanPtTrueMult1->Fill(valMCMeanPtTrueMult);\r
1597       }\r
1598       if(evtType != AliPWG0Helper::kSD) {\r
1599           fMCNSDEventAllPrimTrackMeanPtMult1->Fill(valMCMeanPtMult);\r
1600           fMCNSDEventAllPrimTrackMeanPtTrueMult1->Fill(valMCMeanPtTrueMult);\r
1601       }\r
1602       if(isEventTriggered) { \r
1603           fMCTriggerPrimTrackMeanPtMult1->Fill(valMCMeanPtMult);\r
1604           fMCTriggerPrimTrackMeanPtTrueMult1->Fill(valMCMeanPtTrueMult);\r
1605       }\r
1606       if(isEventTriggered && isEventOK) { \r
1607           fMCEventPrimTrackMeanPtMult1->Fill(valMCMeanPtMult);\r
1608           fMCEventPrimTrackMeanPtTrueMult1->Fill(valMCMeanPtTrueMult);\r
1609       }\r
1610     }\r
1611   } // end bUseMC\r
1612 \r
1613   if(allChargedTracks) delete allChargedTracks; allChargedTracks = 0;\r
1614   if(labelsRec) delete [] labelsRec; labelsRec = 0;\r
1615 \r
1616   if(!evtCuts->IsRecVertexRequired() && vtxESD != NULL) delete vtxESD;\r
1617 }\r
1618 \r
1619 //_____________________________________________________________________________\r
1620 void AlidNdPtCorrection::FillHistograms(AlidNdPtHelper::EventObject eventObj, Double_t zv, Int_t multMBTracks) const\r
1621 {\r
1622   //\r
1623   // Fill corrected histograms\r
1624   //\r
1625 \r
1626   Double_t vEventMatrix[2] = {zv,multMBTracks};\r
1627   //\r
1628   // Correct for efficiency \r
1629   //\r
1630   if(eventObj == AlidNdPtHelper::kRecEvents && multMBTracks>0)  \r
1631   {\r
1632     Double_t corrToMBF = GetCorrFactZvMult(fCorrEventMatrix,zv,multMBTracks);\r
1633     Double_t corrToInelF = GetCorrFactZvMult(fCorrTriggerMBtoInelEventMatrix,zv,multMBTracks);\r
1634     Double_t corrToNDF = GetCorrFactZvMult(fCorrTriggerMBtoNDEventMatrix,zv,multMBTracks);\r
1635     Double_t corrToNSDF = GetCorrFactZvMult(fCorrTriggerMBtoNSDEventMatrix,zv,multMBTracks);\r
1636     //printf("corrToMBF %f, corrToInelF %f, corrToNDF %f corrToNSDF %f \n",corrToMBF,corrToInelF,corrToNDF,corrToNSDF);\r
1637 \r
1638     fCorrRecEventHist1[0]->Fill(vEventMatrix);\r
1639     fCorrRecEventHist1[1]->Fill(vEventMatrix,corrToMBF);\r
1640     fCorrRecEventHist1[2]->Fill(vEventMatrix,corrToMBF*corrToInelF);\r
1641     fCorrRecEventHist1[3]->Fill(vEventMatrix,corrToMBF*corrToNDF);\r
1642     fCorrRecEventHist1[4]->Fill(vEventMatrix,corrToMBF*corrToNSDF);\r
1643   }\r
1644 \r
1645   if(eventObj==AlidNdPtHelper::kTriggeredEvents && multMBTracks==0) // empty triggered events\r
1646   {\r
1647     Double_t factLHCBack = 1.;\r
1648     if(!IsUseMCInfo()) factLHCBack = fLHCBin0Background->GetBinContent(1); \r
1649 \r
1650 \r
1651     Int_t bin = fZvEmptyEventsNorm->FindBin(zv);\r
1652     Double_t factZ = fZvEmptyEventsNorm->GetBinContent(bin);\r
1653 \r
1654     Double_t corrToInelF0 = GetCorrFactZvMult(fCorrTriggerMBtoInelEventMatrix,zv,multMBTracks);\r
1655     Double_t corrToNDF0 = GetCorrFactZvMult(fCorrTriggerMBtoNDEventMatrix,zv,multMBTracks);\r
1656     Double_t corrToNSDF0 = GetCorrFactZvMult(fCorrTriggerMBtoNSDEventMatrix,zv,multMBTracks);\r
1657     //printf("factLHCBack %f, factZ %f, corrToInelF0 %f, corrToNDF0 %f, corrToNSDF0 %f \n",factLHCBack,factZ,corrToInelF0,corrToNDF0,corrToNSDF0);\r
1658 \r
1659     fCorrRecEventHist2[0]->Fill(vEventMatrix);\r
1660     fCorrRecEventHist2[1]->Fill(vEventMatrix,factLHCBack*factZ);\r
1661     fCorrRecEventHist2[2]->Fill(vEventMatrix,factLHCBack*factZ*corrToInelF0);\r
1662     fCorrRecEventHist2[3]->Fill(vEventMatrix,factLHCBack*factZ*corrToNDF0);\r
1663     fCorrRecEventHist2[4]->Fill(vEventMatrix,factLHCBack*factZ*corrToNSDF0);\r
1664   }\r
1665 }\r
1666 \r
1667 //_____________________________________________________________________________\r
1668 void AlidNdPtCorrection::FillHistograms(AliESDtrack * const esdTrack, AliStack * const stack, AlidNdPtHelper::TrackObject trackObj, Double_t zv, Int_t mult, Int_t trueMult) const\r
1669 {\r
1670   //\r
1671   // Fill ESD track and MC histograms \r
1672   //\r
1673   if(!esdTrack) return;\r
1674 \r
1675   //Float_t q = esdTrack->Charge();\r
1676   Float_t pt = esdTrack->Pt();\r
1677   Float_t eta = esdTrack->Eta();\r
1678   Float_t phi = esdTrack->Phi();\r
1679 \r
1680   if(stack && GetAnalysisMode() == AlidNdPtHelper::kMCRec) \r
1681   {\r
1682     Int_t label = TMath::Abs(esdTrack->GetLabel());\r
1683    \r
1684     TParticle* particle = stack->Particle(label);\r
1685     if(!particle) return;\r
1686    \r
1687     if(!particle->GetPDG()) return;\r
1688     Double_t gq = particle->GetPDG()->Charge()/3.0; // Charge units |e|/3\r
1689     if(TMath::Abs(gq)<0.001) return;\r
1690     Float_t gpt = particle->Pt();\r
1691     Float_t geta = particle->Eta();\r
1692     Float_t gphi = particle->Phi();\r
1693 \r
1694     // replace reconstructed values with MC\r
1695     pt = gpt;\r
1696     eta = geta;\r
1697     phi = gphi;\r
1698   }\r
1699 \r
1700   //\r
1701   // Fill histograms\r
1702   //\r
1703   Double_t values[3] = {pt,eta,phi};      \r
1704   fRecTrackHist1[trackObj]->Fill(values);\r
1705 \r
1706   //\r
1707   // Correct for contamination and efficiency \r
1708   //\r
1709   if(trackObj == AlidNdPtHelper::kRecTracks || GetAnalysisMode() == AlidNdPtHelper::kMCRec)  \r
1710   {\r
1711     // track level corrections\r
1712     Double_t trackEffF = 1.0;  \r
1713     if(pt < 2.6) trackEffF = GetCorrFactZvPtEta(fCorrTrackMatrix,zv,pt,eta);\r
1714     else trackEffF = GetCorrFactZvPtEta(fCorrHighPtTrackMatrix,zv,pt,eta);\r
1715 \r
1716     Double_t trackContF = GetContFactZvPtEta(fContTrackMatrix,zv,pt,eta);\r
1717     Double_t multTrackContF = GetContFactZvPtEta(fContMultTrackMatrix,zv,pt,eta);\r
1718     //printf("zv %f, pt %f, eta %f \n",zv,pt,eta);\r
1719     //printf("trackEffF %f, trackContF %f, multTrackContF %f \n", trackEffF, trackContF, multTrackContF);\r
1720    \r
1721     // track-event level corrections\r
1722     Double_t vertexEffF = GetCorrFactZvPtEta(fCorrTrackEventMatrix,zv,pt,eta);\r
1723     Double_t trigMBToInel = GetCorrFactZvPtEta(fCorrTriggerMBtoInelTrackEventMatrix,zv,pt,eta);  \r
1724     Double_t trigMBToND = GetCorrFactZvPtEta(fCorrTriggerMBtoNDTrackEventMatrix,zv,pt,eta);\r
1725     Double_t trigMBToNSD = GetCorrFactZvPtEta(fCorrTriggerMBtoNSDTrackEventMatrix,zv,pt,eta);\r
1726     //printf("vertexEffF %f, trigMBToInel %f, trigMBToNSD %f \n", vertexEffF, trigMBToInel, trigMBToNSD);\r
1727     \r
1728     Double_t corrF[8] = { 1.0, \r
1729                           trackContF,\r
1730                           trackContF*trackEffF,\r
1731                           trackContF*trackEffF*multTrackContF,\r
1732                           trackContF*trackEffF*multTrackContF*vertexEffF,\r
1733                           trackContF*trackEffF*multTrackContF*vertexEffF*trigMBToInel,\r
1734                           trackContF*trackEffF*multTrackContF*vertexEffF*trigMBToND,\r
1735                           trackContF*trackEffF*multTrackContF*vertexEffF*trigMBToNSD\r
1736                          }; \r
1737  \r
1738     // Fill histograms\r
1739     Double_t valCorrRecTrackMultHist1[3] = {pt,eta,mult};         \r
1740     Double_t valCorrRecTrackPt1[1] = {pt};        \r
1741     for(Int_t i=0; i<8; i++) {\r
1742       fCorrRecTrackMultHist1[i]->Fill(valCorrRecTrackMultHist1,corrF[i]);\r
1743       fCorrRecTrackPt1[i]->Fill(valCorrRecTrackPt1,corrF[i]);\r
1744 \r
1745       if( IsUseMCInfo() ) {\r
1746         Double_t valCorrRecTrackTrueMultHist1[3] = {pt,eta,trueMult};     \r
1747         Double_t valCorrRecTrackTrueMultHist2[3] = {pt,mult,trueMult};    \r
1748 \r
1749         fCorrRecTrackTrueMultHist1[i]->Fill(valCorrRecTrackTrueMultHist1,corrF[i]);\r
1750         fCorrRecTrackTrueMultHist2[i]->Fill(valCorrRecTrackTrueMultHist2,corrF[i]);\r
1751       } \r
1752     }\r
1753   }\r
1754 }\r
1755 \r
1756 void AlidNdPtCorrection::FillHistograms(AliStack * const stack, Int_t /*label*/, AlidNdPtHelper::TrackObject /*trackObj*/, Int_t /*mult*/) const\r
1757 {\r
1758   // Fill MC histograms\r
1759   if(!stack) return;\r
1760 \r
1761   /*\r
1762   TParticle* particle = stack->Particle(label);\r
1763   if(!particle) return;\r
1764 \r
1765   Int_t mother_pdg = -1;\r
1766   TParticle* mother = 0;\r
1767 \r
1768   //TParticle* prim_mother = AlidNdPtHelper::FindPrimaryMother(stack,label);\r
1769   Int_t motherLabel = particle->GetMother(0); \r
1770   if(motherLabel>0) mother = stack->Particle(motherLabel);\r
1771   if(mother) mother_pdg = TMath::Abs(mother->GetPdgCode()); // take abs for visualisation only\r
1772   Int_t mech = particle->GetUniqueID(); // production mechanism\r
1773 \r
1774   if(!particle->GetPDG()) return;\r
1775   Double_t gq = particle->GetPDG()->Charge()/3.0; // Charge units |e|/3 \r
1776   Float_t gpt = particle->Pt();\r
1777   Float_t qgpt = particle->Pt() * gq;\r
1778   Float_t geta = particle->Eta();\r
1779   Float_t gphi = particle->Phi();\r
1780   Float_t gpz = particle->Pz();\r
1781 \r
1782   Bool_t prim = stack->IsPhysicalPrimary(label);\r
1783   Float_t vx = particle->Vx(); Float_t vy = particle->Vy(); Float_t vz = particle->Vz();\r
1784 \r
1785   Int_t pid=-1;\r
1786   if (TMath::Abs(particle->GetPdgCode()) == kElectron)         { pid = 0; }\r
1787     else if (TMath::Abs(particle->GetPdgCode()) == kMuonMinus) { pid = 1; }\r
1788     else if (TMath::Abs(particle->GetPdgCode()) == kPiPlus)    { pid = 2; }\r
1789     else if (TMath::Abs(particle->GetPdgCode()) == kKPlus)     { pid = 3; }\r
1790     else if (TMath::Abs(particle->GetPdgCode()) == kProton)    { pid = 4; }\r
1791     else                                                       { pid = 5; }\r
1792     */\r
1793 \r
1794   //if(!prim) printf("prim_mother %d, mother %d, particle %d, production mech %d\n",prim_mother->GetPdgCode(),mother->GetPdgCode(), particle->GetPdgCode(),mech);\r
1795   \r
1796 }\r
1797 \r
1798 //_____________________________________________________________________________\r
1799 Double_t AlidNdPtCorrection::GetCorrFactZvPtEta(THnSparse * const hist, Double_t zv, Double_t pt, Double_t eta) const {\r
1800 // return correction factor F(zv,pt,eta)\r
1801 \r
1802  if(!hist) return 1.;\r
1803 \r
1804  //\r
1805  TAxis *ax = hist->GetAxis(0);\r
1806  TAxis *ay = hist->GetAxis(1);\r
1807  TAxis *az = hist->GetAxis(2);\r
1808 \r
1809  Int_t binx = ax->FindBin(zv);\r
1810  Int_t biny = ay->FindBin(pt);\r
1811  Int_t binz = az->FindBin(eta);\r
1812  Int_t dim[3] = {binx,biny,binz};\r
1813 \r
1814  Double_t fact  = hist->GetBinContent(dim);  \r
1815 \r
1816 return fact;\r
1817 }\r
1818 \r
1819 //_____________________________________________________________________________\r
1820 Double_t AlidNdPtCorrection::GetContFactZvPtEta(THnSparse * const hist, Double_t zv, Double_t pt, Double_t eta) const {\r
1821 // return contamination correction factor F(zv,pt,eta)\r
1822 \r
1823  if(!hist) return 1.0;\r
1824 \r
1825  //\r
1826  TAxis *ax = hist->GetAxis(0);\r
1827  TAxis *ay = hist->GetAxis(1);\r
1828  TAxis *az = hist->GetAxis(2);\r
1829 \r
1830  Int_t binx = ax->FindBin(zv);\r
1831  Int_t biny = ay->FindBin(pt);\r
1832  Int_t binz = az->FindBin(eta);\r
1833  Int_t dim[3] = {binx,biny,binz};\r
1834 \r
1835  //\r
1836  //  additional correction for secondary \r
1837  //  particles with strangeness (data driven)\r
1838  // \r
1839  Double_t corrFact = 1.;\r
1840  if(!IsUseMCInfo()) corrFact = AlidNdPtHelper::GetStrangenessCorrFactor(pt);\r
1841  //printf("pt %f, corrFact %f \n", pt, corrFact);\r
1842 \r
1843  Double_t fact  = 1.0 - corrFact*hist->GetBinContent(dim);  \r
1844  //Double_t fact  = hist->GetBinContent(dim);  \r
1845 \r
1846 return fact;\r
1847 }\r
1848 \r
1849 //_____________________________________________________________________________\r
1850 Double_t AlidNdPtCorrection::GetCorrFactZvMult(THnSparse * const hist, Double_t zv, Int_t mult) const {\r
1851 // return correction factor F(zv,mult)\r
1852 \r
1853  if(!hist) return 1.;\r
1854 \r
1855  TAxis *ax = hist->GetAxis(0);\r
1856  TAxis *ay = hist->GetAxis(1);\r
1857  Int_t binx = ax->FindBin(zv);\r
1858  Int_t biny = ay->FindBin(mult);\r
1859  Int_t dim[2] = {binx,biny};\r
1860 \r
1861  Double_t fact  = hist->GetBinContent(dim);  \r
1862 \r
1863 \r
1864 return fact;\r
1865 }\r
1866 \r
1867 //_____________________________________________________________________________\r
1868 Double_t AlidNdPtCorrection::GetContFactZvMult(THnSparse * const hist, Double_t zv, Int_t mult) const {\r
1869 // return contamination correction factor F(zv,mult)\r
1870 \r
1871  if(!hist) return 1.;\r
1872 \r
1873  TAxis *ax = hist->GetAxis(0);\r
1874  TAxis *ay = hist->GetAxis(1);\r
1875  Int_t binx = ax->FindBin(zv);\r
1876  Int_t biny = ay->FindBin(mult);\r
1877  Int_t dim[2] = {binx,biny};\r
1878  Double_t fact  = 1.0-hist->GetBinContent(dim);  \r
1879 \r
1880 return fact;\r
1881 }\r
1882 \r
1883 //_____________________________________________________________________________\r
1884 Long64_t AlidNdPtCorrection::Merge(TCollection* const list) \r
1885 {\r
1886   // Merge list of objects (needed by PROOF)\r
1887 \r
1888   if (!list)\r
1889   return 0;\r
1890 \r
1891   if (list->IsEmpty())\r
1892   return 1;\r
1893 \r
1894   TIterator* iter = list->MakeIterator();\r
1895   TObject* obj = 0;\r
1896 \r
1897   // collection of generated histograms\r
1898 \r
1899   // physics selection\r
1900   TList *collPhysSelection = new TList;\r
1901 \r
1902   Int_t count=0;\r
1903   while((obj = iter->Next()) != 0) {\r
1904     AlidNdPtCorrection* entry = dynamic_cast<AlidNdPtCorrection*>(obj);\r
1905     if (entry == 0) continue; \r
1906   \r
1907     collPhysSelection->Add(entry->GetPhysicsTriggerSelection());\r
1908 \r
1909     fEventCount->Add(entry->fEventCount);\r
1910 \r
1911     fMCEventHist1->Add(entry->fMCEventHist1);\r
1912     fRecEventHist1->Add(entry->fRecEventHist1);\r
1913     fRecEventMultHist1->Add(entry->fRecEventMultHist1);\r
1914 \r
1915     fMCAllEventMultHist1->Add(entry->fMCAllEventMultHist1);\r
1916     fMCAllNDEventMultHist1->Add(entry->fMCAllNDEventMultHist1);\r
1917     fMCAllNSDEventMultHist1->Add(entry->fMCAllNSDEventMultHist1);\r
1918     fMCTriggerMultHist1->Add(entry->fMCTriggerMultHist1);\r
1919     fMCEventMultHist1->Add(entry->fMCEventMultHist1);\r
1920 \r
1921     fMCAllPrimTrackMultHist1->Add(entry->fMCAllPrimTrackMultHist1);\r
1922     fMCNDEventAllPrimTrackMultHist1->Add(entry->fMCNDEventAllPrimTrackMultHist1);\r
1923     fMCNSDEventAllPrimTrackMultHist1->Add(entry->fMCNSDEventAllPrimTrackMultHist1);\r
1924     fMCTriggerPrimTrackMultHist1->Add(entry->fMCTriggerPrimTrackMultHist1);\r
1925     fMCEventPrimTrackMultHist1->Add(entry->fMCEventPrimTrackMultHist1);\r
1926 \r
1927     fMCAllPrimTrackTrueMultHist1->Add(entry->fMCAllPrimTrackTrueMultHist1);\r
1928     fMCNDEventAllPrimTrackTrueMultHist1->Add(entry->fMCNDEventAllPrimTrackTrueMultHist1);\r
1929     fMCNSDEventAllPrimTrackTrueMultHist1->Add(entry->fMCNSDEventAllPrimTrackTrueMultHist1);\r
1930     fMCTriggerPrimTrackTrueMultHist1->Add(entry->fMCTriggerPrimTrackTrueMultHist1);\r
1931     fMCEventPrimTrackTrueMultHist1->Add(entry->fMCEventPrimTrackTrueMultHist1);\r
1932 \r
1933     fMCAllPrimTrackTrueMultHist2->Add(entry->fMCAllPrimTrackTrueMultHist2);\r
1934     fMCNDEventAllPrimTrackTrueMultHist2->Add(entry->fMCNDEventAllPrimTrackTrueMultHist2);\r
1935     fMCNSDEventAllPrimTrackTrueMultHist2->Add(entry->fMCNSDEventAllPrimTrackTrueMultHist2);\r
1936     fMCTriggerPrimTrackTrueMultHist2->Add(entry->fMCTriggerPrimTrackTrueMultHist2);\r
1937     fMCEventPrimTrackTrueMultHist2->Add(entry->fMCEventPrimTrackTrueMultHist2);\r
1938 \r
1939     fMCAllPrimTrackMeanPtMult1->Add(entry->fMCAllPrimTrackMeanPtMult1);\r
1940     fMCNDEventAllPrimTrackMeanPtMult1->Add(entry->fMCNDEventAllPrimTrackMeanPtMult1);\r
1941     fMCNSDEventAllPrimTrackMeanPtMult1->Add(entry->fMCNSDEventAllPrimTrackMeanPtMult1);\r
1942     fMCTriggerPrimTrackMeanPtMult1->Add(entry->fMCTriggerPrimTrackMeanPtMult1);\r
1943     fMCEventPrimTrackMeanPtMult1->Add(entry->fMCEventPrimTrackMeanPtMult1);\r
1944 \r
1945     fMCAllPrimTrackMeanPtTrueMult1->Add(entry->fMCAllPrimTrackMeanPtTrueMult1);\r
1946     fMCNDEventAllPrimTrackMeanPtTrueMult1->Add(entry->fMCNDEventAllPrimTrackMeanPtTrueMult1);\r
1947     fMCNSDEventAllPrimTrackMeanPtTrueMult1->Add(entry->fMCNSDEventAllPrimTrackMeanPtTrueMult1);\r
1948     fMCTriggerPrimTrackMeanPtTrueMult1->Add(entry->fMCTriggerPrimTrackMeanPtTrueMult1);\r
1949     fMCEventPrimTrackMeanPtTrueMult1->Add(entry->fMCEventPrimTrackMeanPtTrueMult1);\r
1950 \r
1951     fCosmicsHisto->Add(entry->fCosmicsHisto);\r
1952 \r
1953     for(Int_t i=0; i<AlidNdPtHelper::kCutSteps; i++) {\r
1954       fRecTrackHist1[i]->Add(entry->fRecTrackHist1[i]);\r
1955     }\r
1956 \r
1957     for(Int_t i=0; i<8; i++) {\r
1958       fCorrRecTrackMultHist1[i]->Add(entry->fCorrRecTrackMultHist1[i]);\r
1959       fCorrRecTrackTrueMultHist1[i]->Add(entry->fCorrRecTrackTrueMultHist1[i]);\r
1960       fCorrRecTrackTrueMultHist2[i]->Add(entry->fCorrRecTrackTrueMultHist2[i]);\r
1961 \r
1962       fCorrRecTrackMeanPtMultHist1[i]->Add(entry->fCorrRecTrackMeanPtMultHist1[i]);\r
1963       fCorrRecTrackMeanPtTrueMultHist1[i]->Add(entry->fCorrRecTrackMeanPtTrueMultHist1[i]);\r
1964 \r
1965       fCorrRecTrackPt1[i]->Add(entry->fCorrRecTrackPt1[i]);\r
1966     }\r
1967 \r
1968     for(Int_t i=0; i<5; i++) {\r
1969       fCorrRecEventHist1[i]->Add(entry->fCorrRecEventHist1[i]);\r
1970       fCorrRecEventHist2[i]->Add(entry->fCorrRecEventHist2[i]);\r
1971     }\r
1972 \r
1973   count++;\r
1974   }\r
1975 \r
1976   //\r
1977   AliPhysicsSelection *trigSelection = GetPhysicsTriggerSelection();\r
1978   trigSelection->Merge(collPhysSelection);\r
1979   if(collPhysSelection) delete collPhysSelection;\r
1980 \r
1981 return count;\r
1982 }\r
1983  \r
1984 //____________________________________________________________________________\r
1985 Int_t AlidNdPtCorrection::GetTrueMult(THnSparse * const hist, Int_t mult) const\r
1986 {\r
1987 //\r
1988 // get multiplicity of primary particles\r
1989 //\r
1990  if(!hist) return 0;\r
1991  Int_t trueMult = 0;\r
1992 \r
1993  // 0 bins exluded\r
1994  TAxis *ax = hist->GetAxis(0);\r
1995  TAxis *ay = hist->GetAxis(1);\r
1996  ax->SetRange(1,ax->GetNbins());\r
1997  ay->SetRange(1,ay->GetNbins());\r
1998 \r
1999  // measured mult\r
2000  ax->SetRangeUser((Float_t)mult,(Float_t)mult); \r
2001 \r
2002  // get true multiplicity\r
2003  TH1D *h1 = (TH1D *)hist->Projection(1);\r
2004  trueMult = (Int_t)h1->GetMean();\r
2005 \r
2006  return trueMult;\r
2007 }\r
2008 \r
2009 //_____________________________________________________________________________\r
2010 void AlidNdPtCorrection::Analyse() \r
2011 {\r
2012   // Analyse histograms\r
2013   //\r
2014   TH1::AddDirectory(kFALSE);\r
2015   TH1 *h = 0, *hs=0, *hsc=0; \r
2016   TH2 *h2D = 0; \r
2017 \r
2018   TObjArray *aFolderObj = new TObjArray;\r
2019 \r
2020   //\r
2021   // get cuts\r
2022   //\r
2023   AlidNdPtEventCuts *evtCuts = GetEventCuts(); \r
2024   AlidNdPtAcceptanceCuts *accCuts = GetAcceptanceCuts(); \r
2025   AliESDtrackCuts *esdTrackCuts = GetTrackCuts(); \r
2026 \r
2027   if(!evtCuts || !accCuts || !esdTrackCuts) {\r
2028     Error("AlidNdPtCutAnalysis::Analyse()", "cuts not available");\r
2029     return;\r
2030   }\r
2031 \r
2032   //\r
2033   // set min and max values\r
2034   //\r
2035   //Double_t minPt = accCuts->GetMinPt();\r
2036   //Double_t maxPt = accCuts->GetMaxPt();\r
2037   Double_t minEta = accCuts->GetMinEta();\r
2038   Double_t maxEta = accCuts->GetMaxEta()-0.00001;\r
2039  \r
2040   printf("minEta %f, maxEta %f \n",minEta, maxEta);\r
2041 \r
2042   //\r
2043   // LHC backgraund in all and 0-bins\r
2044   //\r
2045   AliPhysicsSelection *trigSel = GetPhysicsTriggerSelection();\r
2046   trigSel->SaveHistograms("physics_selection");\r
2047 \r
2048   //\r
2049   // cosmics background histo\r
2050   //\r
2051   h2D = fCosmicsHisto->Projection(0,1);\r
2052   h2D->SetName("deta_vs_dphi_cosmics");\r
2053   aFolderObj->Add(h2D);\r
2054 \r
2055   //\r
2056   // event level \r
2057   //\r
2058   h = fCorrRecEventHist1[0]->Projection(1);\r
2059   h->SetName("mult_event_not_corrected");\r
2060   aFolderObj->Add(h);\r
2061 \r
2062   h = fCorrRecEventHist1[1]->Projection(1);\r
2063   h->SetName("mult_event_vertex_corrected");\r
2064   aFolderObj->Add(h);\r
2065 \r
2066   h = fCorrRecEventHist1[2]->Projection(1);\r
2067   h->SetName("mult_trigger_vertex_corrected");\r
2068   aFolderObj->Add(h);\r
2069 \r
2070   h = fCorrRecEventHist1[3]->Projection(1);\r
2071   h->SetName("mult_ND_trigger_vertex_corrected");\r
2072   aFolderObj->Add(h);\r
2073 \r
2074   h = fCorrRecEventHist1[4]->Projection(1);\r
2075   h->SetName("mult_NSD_trigger_vertex_corrected");\r
2076   aFolderObj->Add(h);\r
2077 \r
2078   // empty events\r
2079   h = fCorrRecEventHist2[0]->Projection(1);\r
2080   h->SetName("mult_empty_event_not_corrected");\r
2081   aFolderObj->Add(h);\r
2082 \r
2083   h = fCorrRecEventHist2[1]->Projection(1);\r
2084   h->SetName("mult_empty_event_vertex_corrected");\r
2085   aFolderObj->Add(h);\r
2086 \r
2087   h = fCorrRecEventHist2[2]->Projection(1);\r
2088   h->SetName("mult_empty_trigger_vertex_corrected");\r
2089   aFolderObj->Add(h);\r
2090 \r
2091   h = fCorrRecEventHist2[3]->Projection(1);\r
2092   h->SetName("mult_empty_ND_trigger_vertex_corrected");\r
2093   aFolderObj->Add(h);\r
2094 \r
2095   h = fCorrRecEventHist2[4]->Projection(1);\r
2096   h->SetName("mult_empty_NSD_trigger_vertex_corrected");\r
2097   aFolderObj->Add(h);\r
2098  \r
2099   //\r
2100   // MC available\r
2101   //\r
2102   if(IsUseMCInfo()) {\r
2103 \r
2104   // mc \r
2105   h = fMCAllEventMultHist1->Projection(1);\r
2106   h->SetName("mc_mult_event_acc_prim");\r
2107   aFolderObj->Add(h);\r
2108 \r
2109   h = fMCAllNDEventMultHist1->Projection(1);\r
2110   h->SetName("mc_mult_ND_event_acc_prim");\r
2111   aFolderObj->Add(h);\r
2112 \r
2113   h = fMCAllNSDEventMultHist1->Projection(1);\r
2114   h->SetName("mc_mult_NSD_event_acc_prim");\r
2115   aFolderObj->Add(h);\r
2116 \r
2117   h = fMCTriggerMultHist1->Projection(1);\r
2118   h->SetName("mc_mult_trigger_acc_prim");\r
2119   aFolderObj->Add(h);\r
2120 \r
2121   h = fMCEventMultHist1->Projection(1);\r
2122   h->SetName("mc_mult_trigger_event_acc_prim");\r
2123   aFolderObj->Add(h);\r
2124 \r
2125 \r
2126   //\r
2127   // track level\r
2128   //\r
2129   \r
2130   // limit eta range\r
2131   for(Int_t i=0;i<8;i++) { \r
2132       //fCorrRecTrackMultHist1[i]->GetAxis(0)->SetRangeUser(minPt,maxPt);\r
2133       //fCorrRecTrackMultHist1[i]->GetAxis(1)->SetRangeUser(minEta,maxEta);\r
2134   }\r
2135   //fMCAllPrimTrackMultHist1->GetAxis(0)->SetRangeUser(minPt,maxPt);\r
2136   //fMCAllPrimTrackMultHist1->GetAxis(1)->SetRangeUser(minEta,maxEta);\r
2137 \r
2138   //fMCNDEventAllPrimTrackMultHist1->GetAxis(0)->SetRangeUser(minPt,maxPt);\r
2139   //fMCNDEventAllPrimTrackMultHist1->GetAxis(1)->SetRangeUser(minEta,maxEta);\r
2140 \r
2141   //fMCNSDEventAllPrimTrackMultHist1->GetAxis(0)->SetRangeUser(minPt,maxPt);\r
2142   //fMCNSDEventAllPrimTrackMultHist1->GetAxis(1)->SetRangeUser(minEta,maxEta);\r
2143 \r
2144   //fMCTriggerPrimTrackMultHist1->GetAxis(0)->SetRangeUser(minPt,maxPt);\r
2145   //fMCTriggerPrimTrackMultHist1->GetAxis(1)->SetRangeUser(minEta,maxEta);\r
2146 \r
2147   //fMCEventPrimTrackMultHist1->GetAxis(0)->SetRangeUser(minPt,maxPt);\r
2148   //fMCEventPrimTrackMultHist1->GetAxis(1)->SetRangeUser(minEta,maxEta);\r
2149 \r
2150   } // end use MC info \r
2151   \r
2152   //\r
2153   h2D = fCorrRecTrackMultHist1[3]->Projection(1,0);\r
2154   h2D->SetName("pt_eta_rec_track_mult_eff_cont_corrected");\r
2155   aFolderObj->Add(h2D);\r
2156 \r
2157   h2D = fCorrRecTrackMultHist1[4]->Projection(1,0);\r
2158   h2D->SetName("pt_eta_rec_event_track_mult_eff_cont_corrected");\r
2159   aFolderObj->Add(h2D);\r
2160 \r
2161   h2D = fCorrRecTrackMultHist1[5]->Projection(1,0);\r
2162   h2D->SetName("pt_eta_rec_trig_event_track_mult_eff_cont_corrected");\r
2163   aFolderObj->Add(h2D);\r
2164 \r
2165   h2D = fCorrRecTrackMultHist1[6]->Projection(1,0);\r
2166   h2D->SetName("pt_eta_rec_ND_trig_event_track_mult_eff_cont_corrected");\r
2167   aFolderObj->Add(h2D);\r
2168 \r
2169   h2D = fCorrRecTrackMultHist1[7]->Projection(1,0);\r
2170   h2D->SetName("pt_eta_rec_NSD_trig_event_track_mult_eff_cont_corrected");\r
2171   aFolderObj->Add(h2D);\r
2172 \r
2173 \r
2174   //\r
2175   h2D = fCorrRecTrackMultHist1[3]->Projection(2,0);\r
2176   h2D->SetName("pt_mult_rec_track_mult_eff_cont_corrected");\r
2177   aFolderObj->Add(h2D);\r
2178 \r
2179   h2D = fCorrRecTrackMultHist1[4]->Projection(2,0);\r
2180   h2D->SetName("pt_mult_rec_event_track_mult_eff_cont_corrected");\r
2181   aFolderObj->Add(h2D);\r
2182 \r
2183   h2D = fCorrRecTrackMultHist1[5]->Projection(2,0);\r
2184   h2D->SetName("pt_mult_rec_trig_event_track_mult_eff_cont_corrected");\r
2185   aFolderObj->Add(h2D);\r
2186 \r
2187   h2D = fCorrRecTrackMultHist1[6]->Projection(2,0);\r
2188   h2D->SetName("pt_mult_rec_ND_trig_event_track_mult_eff_cont_corrected");\r
2189   aFolderObj->Add(h2D);\r
2190 \r
2191   h2D = fCorrRecTrackMultHist1[7]->Projection(2,0);\r
2192   h2D->SetName("pt_mult_rec_NSD_trig_event_track_mult_eff_cont_corrected");\r
2193   aFolderObj->Add(h2D);\r
2194 \r
2195   // pt axis\r
2196 \r
2197   h = fCorrRecTrackMultHist1[0]->Projection(0);\r
2198   h->SetName("pt_rec_track_not_corrected");\r
2199   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
2200   hs->SetName("pt_rec_track_not_corrected_s");\r
2201   aFolderObj->Add(hs);\r
2202 \r
2203   //\r
2204   h = fCorrRecTrackMultHist1[1]->Projection(0);\r
2205   h->SetName("pt_rec_track_cont_corrected");\r
2206   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
2207   hs->SetName("pt_rec_track_cont_corrected_s");\r
2208   aFolderObj->Add(hs);\r
2209 \r
2210   hsc = (TH1D*)hs->Clone("pt_rec_track_cont_corr_fact");\r
2211   hsc->Divide((TH1D*)aFolderObj->FindObject("pt_rec_track_not_corrected_s"));\r
2212   aFolderObj->Add(hsc);\r
2213 \r
2214   //\r
2215   h = fCorrRecTrackMultHist1[2]->Projection(0);\r
2216   h->SetName("pt_rec_track_eff_cont_corrected");\r
2217   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
2218   hs->SetName("pt_rec_track_eff_cont_corrected_s");\r
2219   aFolderObj->Add(hs);\r
2220 \r
2221   hsc = (TH1D*)hs->Clone("pt_rec_track_eff_corr_fact");\r
2222   hsc->Divide((TH1D*)aFolderObj->FindObject("pt_rec_track_cont_corrected_s"));\r
2223   aFolderObj->Add(hsc);\r
2224 \r
2225   //\r
2226   h = fCorrRecTrackMultHist1[3]->Projection(0);\r
2227   h->SetName("pt_rec_track_mult_eff_cont_corrected");\r
2228   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
2229   hs->SetName("pt_rec_track_mult_eff_cont_corrected_s");\r
2230   aFolderObj->Add(hs);\r
2231 \r
2232   hsc = (TH1D*)hs->Clone("pt_rec_track_mult_corr_fact");\r
2233   hsc->Divide((TH1D*)aFolderObj->FindObject("pt_rec_track_eff_cont_corrected_s"));\r
2234   aFolderObj->Add(hsc);\r
2235 \r
2236   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
2237   hsc = (TH1D*)hs->Clone("pt_rec_track_mult_eff_cont_corr_fact");\r
2238   hsc->Divide((TH1D*)aFolderObj->FindObject("pt_rec_track_not_corrected_s"));\r
2239   aFolderObj->Add(hsc);\r
2240 \r
2241   hsc = (TH1D*)hs->Clone();\r
2242   hsc->SetName("pt_rec_track_mult_eff_cont_corrected_s_norm");\r
2243   hsc->Scale(1./(fCorrRecEventHist1[0]->Projection(1)->Integral()));\r
2244   aFolderObj->Add(hsc);\r
2245 \r
2246   //\r
2247   h = fCorrRecTrackMultHist1[4]->Projection(0);\r
2248   h->SetName("pt_rec_event_track_mult_eff_cont_corrected");\r
2249   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
2250   hs->SetName("pt_rec_event_track_mult_eff_cont_corrected_s");\r
2251   aFolderObj->Add(hs);\r
2252 \r
2253   hsc = (TH1D*)hs->Clone();\r
2254   hsc->SetName("pt_rec_event_track_mult_eff_cont_corrected_s_norm");\r
2255   hsc->Scale(1./(fCorrRecEventHist1[1]->Projection(1)->Integral()+fCorrRecEventHist2[1]->Projection(1)->Integral()));\r
2256   aFolderObj->Add(hsc);\r
2257 \r
2258   //\r
2259   h = fCorrRecTrackMultHist1[5]->Projection(0);\r
2260   h->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected");\r
2261   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
2262   hs->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected_s");\r
2263   aFolderObj->Add(hs);\r
2264 \r
2265   hsc = (TH1D*)hs->Clone();\r
2266   hsc->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected_s_norm");\r
2267   hsc->Scale(1./(fCorrRecEventHist1[2]->Projection(1)->Integral() + fCorrRecEventHist2[2]->Projection(1)->Integral()));\r
2268   aFolderObj->Add(hsc);\r
2269 \r
2270    // positive eta\r
2271   fCorrRecTrackMultHist1[5]->GetAxis(1)->SetRangeUser(0., maxEta);\r
2272 \r
2273   h = fCorrRecTrackMultHist1[5]->Projection(0);\r
2274   h->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected_posEta");\r
2275   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
2276   hs->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected_s_posEta");\r
2277   aFolderObj->Add(hs);\r
2278 \r
2279   hsc = (TH1D*)hs->Clone();\r
2280   hsc->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected_s_norm_posEta");\r
2281   hsc->Scale(1./(fCorrRecEventHist1[2]->Projection(1)->Integral()+fCorrRecEventHist2[2]->Projection(1)->Integral()));\r
2282   aFolderObj->Add(hsc);\r
2283 \r
2284   // negative eta\r
2285   fCorrRecTrackMultHist1[5]->GetAxis(1)->SetRangeUser(minEta, -0.00001);\r
2286 \r
2287   h = fCorrRecTrackMultHist1[5]->Projection(0);\r
2288   h->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected_negEta");\r
2289   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
2290   hs->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected_s_negEta");\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_negEta");\r
2295   hsc->Scale(1./(fCorrRecEventHist1[2]->Projection(1)->Integral()+fCorrRecEventHist2[2]->Projection(1)->Integral()));\r
2296   aFolderObj->Add(hsc);\r
2297 \r
2298   fCorrRecTrackMultHist1[5]->GetAxis(1)->SetRange(1, fCorrRecTrackMultHist1[5]->GetAxis(1)->GetNbins());\r
2299 \r
2300   //\r
2301   h = fCorrRecTrackMultHist1[6]->Projection(0);\r
2302   h->SetName("pt_rec_ND_trig_event_track_mult_eff_cont_corrected");\r
2303   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
2304   hs->SetName("pt_rec_ND_trig_event_track_mult_eff_cont_corrected_s");\r
2305   aFolderObj->Add(hs);\r
2306 \r
2307   hsc = (TH1D*)hs->Clone();\r
2308   hsc->SetName("pt_rec_ND_trig_event_track_mult_eff_cont_corrected_s_norm");\r
2309   hsc->Scale(1./(fCorrRecEventHist1[3]->Projection(1)->Integral()+fCorrRecEventHist2[3]->Projection(1)->Integral()));\r
2310   aFolderObj->Add(hsc);\r
2311 \r
2312   //\r
2313   h = fCorrRecTrackMultHist1[7]->Projection(0);\r
2314   h->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected");\r
2315   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
2316   hs->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_s");\r
2317   aFolderObj->Add(hs);\r
2318 \r
2319   hsc = (TH1D*)hs->Clone();\r
2320   hsc->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_s_norm");\r
2321   hsc->Scale(1./(fCorrRecEventHist1[4]->Projection(1)->Integral() + fCorrRecEventHist2[4]->Projection(1)->Integral()));\r
2322   aFolderObj->Add(hsc);\r
2323 \r
2324   //\r
2325   // positive eta\r
2326   //\r
2327   fCorrRecTrackMultHist1[7]->GetAxis(1)->SetRangeUser(0., maxEta);\r
2328 \r
2329   h = fCorrRecTrackMultHist1[7]->Projection(0);\r
2330   h->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_posEta");\r
2331   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
2332   hs->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_s_posEta");\r
2333   aFolderObj->Add(hs);\r
2334 \r
2335   hsc = (TH1D*)hs->Clone();\r
2336   hsc->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_s_norm_posEta");\r
2337   hsc->Scale(1./(fCorrRecEventHist1[4]->Projection(1)->Integral()+fCorrRecEventHist2[4]->Projection(1)->Integral()));\r
2338   aFolderObj->Add(hsc);\r
2339 \r
2340   //\r
2341   // negative eta\r
2342   //\r
2343   fCorrRecTrackMultHist1[7]->GetAxis(1)->SetRangeUser(minEta, -0.00001);\r
2344 \r
2345   h = fCorrRecTrackMultHist1[7]->Projection(0);\r
2346   h->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_negEta");\r
2347   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
2348   hs->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_s_negEta");\r
2349   aFolderObj->Add(hs);\r
2350 \r
2351   hsc = (TH1D*)hs->Clone();\r
2352   hsc->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_s_norm_negEta");\r
2353   hsc->Scale(1./(fCorrRecEventHist1[4]->Projection(1)->Integral()+fCorrRecEventHist2[4]->Projection(1)->Integral()));\r
2354   aFolderObj->Add(hsc);\r
2355 \r
2356   fCorrRecTrackMultHist1[7]->GetAxis(1)->SetRange(1, fCorrRecTrackMultHist1[7]->GetAxis(1)->GetNbins());\r
2357 \r
2358   // eta axis\r
2359   h = fCorrRecTrackMultHist1[0]->Projection(1);\r
2360   h->SetName("eta_rec_track_not_corrected");\r
2361   aFolderObj->Add(h);\r
2362   \r
2363   h = fCorrRecTrackMultHist1[1]->Projection(1);\r
2364   h->SetName("eta_rec_track_cont_corrected");\r
2365   aFolderObj->Add(h);\r
2366 \r
2367   h = fCorrRecTrackMultHist1[2]->Projection(1);\r
2368   h->SetName("eta_rec_track_eff_cont_corrected");\r
2369   aFolderObj->Add(h);\r
2370 \r
2371   h = fCorrRecTrackMultHist1[3]->Projection(1);\r
2372   h->SetName("eta_rec_track_mult_eff_cont_corrected");\r
2373   aFolderObj->Add(h);\r
2374 \r
2375   h = fCorrRecTrackMultHist1[4]->Projection(1);\r
2376   h->SetName("eta_rec_event_track_mult_eff_cont_corrected");\r
2377   aFolderObj->Add(h);\r
2378 \r
2379   h = fCorrRecTrackMultHist1[5]->Projection(1);\r
2380   h->SetName("eta_rec_trig_event_track_mult_eff_cont_corrected");\r
2381   aFolderObj->Add(h);\r
2382 \r
2383   h = fCorrRecTrackMultHist1[6]->Projection(1);\r
2384   h->SetName("eta_rec_ND_trig_event_track_mult_eff_cont_corrected");\r
2385   aFolderObj->Add(h);\r
2386 \r
2387   h = fCorrRecTrackMultHist1[7]->Projection(1);\r
2388   h->SetName("eta_rec_NSD_trig_event_track_mult_eff_cont_corrected");\r
2389   aFolderObj->Add(h);\r
2390 \r
2391 \r
2392   //\r
2393   // MC available\r
2394   //\r
2395   if(IsUseMCInfo()) {\r
2396 \r
2397   //\r
2398   h2D = fMCAllPrimTrackMultHist1->Projection(2,0);\r
2399   h2D->SetName("mc_all_pt_mult_acc_prim");\r
2400   aFolderObj->Add(h2D);\r
2401 \r
2402   h2D = fMCAllPrimTrackMultHist1->Projection(1,0);\r
2403   h2D->SetName("mc_all_eta_pt_acc_prim");\r
2404   aFolderObj->Add(h2D);\r
2405 \r
2406   h2D = fMCNDEventAllPrimTrackMultHist1->Projection(2,0);\r
2407   h2D->SetName("mc_ND_all_pt_mult_acc_prim");\r
2408   aFolderObj->Add(h2D);\r
2409 \r
2410   h2D = fMCNDEventAllPrimTrackMultHist1->Projection(1,0);\r
2411   h2D->SetName("mc_ND_all_eta_pt_acc_prim");\r
2412   aFolderObj->Add(h2D);\r
2413 \r
2414   h2D = fMCNSDEventAllPrimTrackMultHist1->Projection(2,0);\r
2415   h2D->SetName("mc_NSD_all_pt_mult_acc_prim");\r
2416   aFolderObj->Add(h2D);\r
2417 \r
2418   h2D = fMCNSDEventAllPrimTrackMultHist1->Projection(1,0);\r
2419   h2D->SetName("mc_NSD_all_eta_pt_acc_prim");\r
2420   aFolderObj->Add(h2D);\r
2421 \r
2422   //\r
2423 \r
2424   h = fMCAllPrimTrackMultHist1->Projection(0);\r
2425   h->SetName("mc_all_pt_acc_prim");\r
2426   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
2427   hs->SetName("mc_all_pt_acc_prim_s");\r
2428   aFolderObj->Add(hs);\r
2429 \r
2430   hsc = (TH1D*)hs->Clone();\r
2431   hsc->SetName("mc_all_pt_acc_prim_s_norm");\r
2432   hsc->Scale(1./fMCAllEventMultHist1->Projection(1)->Integral());\r
2433   aFolderObj->Add(hsc);\r
2434 \r
2435   h = fMCNDEventAllPrimTrackMultHist1->Projection(0);\r
2436   h->SetName("mc_ND_all_pt_acc_prim");\r
2437   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
2438   hs->SetName("mc_ND_all_pt_acc_prim_s");\r
2439   aFolderObj->Add(hs);\r
2440 \r
2441   hsc = (TH1D*)hs->Clone();\r
2442   hsc->SetName("mc_ND_all_pt_acc_prim_s_norm");\r
2443   hsc->Scale(1./fMCAllNDEventMultHist1->Projection(1)->Integral());\r
2444   aFolderObj->Add(hsc);\r
2445 \r
2446   h = fMCNSDEventAllPrimTrackMultHist1->Projection(0);\r
2447   h->SetName("mc_NSD_all_pt_acc_prim");\r
2448   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
2449   hs->SetName("mc_NSD_all_pt_acc_prim_s");\r
2450   aFolderObj->Add(hs);\r
2451 \r
2452   hsc = (TH1D*)hs->Clone();\r
2453   hsc->SetName("mc_NSD_all_pt_acc_prim_s_norm");\r
2454   hsc->Scale(1./fMCAllNSDEventMultHist1->Projection(1)->Integral());\r
2455   aFolderObj->Add(hsc);\r
2456 \r
2457   h = fMCTriggerPrimTrackMultHist1->Projection(0);\r
2458   h->SetName("mc_trigger_all_pt_acc_prim");\r
2459   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
2460   hs->SetName("mc_trigger_all_pt_acc_prim_s");\r
2461   aFolderObj->Add(hs);\r
2462 \r
2463   hsc = (TH1D*)hs->Clone();\r
2464   hsc->SetName("mc_trigger_all_pt_acc_prim_s_norm");\r
2465   hsc->Scale(1./fMCTriggerMultHist1->Projection(1)->Integral());\r
2466   aFolderObj->Add(hsc);\r
2467 \r
2468   h = fMCEventPrimTrackMultHist1->Projection(0);\r
2469   h->SetName("mc_all_pt_acc_trig_event_prim");\r
2470   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
2471   hs->SetName("mc_all_pt_acc_trig_event_prim_s");\r
2472   aFolderObj->Add(hs);\r
2473 \r
2474   hsc = (TH1D*)hs->Clone();\r
2475   hsc->SetName("mc_all_pt_acc_trig_event_prim_s_norm");\r
2476   hsc->Scale(1./fMCEventMultHist1->Projection(1)->Integral());\r
2477   aFolderObj->Add(hsc);\r
2478 \r
2479   //\r
2480 \r
2481   h = fMCAllPrimTrackMultHist1->Projection(1);\r
2482   h->SetName("mc_all_eta_acc_prim");\r
2483   aFolderObj->Add(h);\r
2484 \r
2485   h = fMCNDEventAllPrimTrackMultHist1->Projection(1);\r
2486   h->SetName("mc_ND_all_eta_acc_prim");\r
2487   aFolderObj->Add(h);\r
2488 \r
2489   h = fMCNSDEventAllPrimTrackMultHist1->Projection(1);\r
2490   h->SetName("mc_NSD_all_eta_acc_prim");\r
2491   aFolderObj->Add(h);\r
2492 \r
2493   h = fMCTriggerPrimTrackMultHist1->Projection(1);\r
2494   h->SetName("mc_trigger_all_eta_acc_prim");\r
2495   aFolderObj->Add(h);\r
2496 \r
2497   h = fMCEventPrimTrackMultHist1->Projection(1);\r
2498   h->SetName("mc_all_eta_acc_trig_event_prim");\r
2499   aFolderObj->Add(h);\r
2500 \r
2501   //\r
2502   // calculate ratios (rec / mc)\r
2503   //\r
2504   \r
2505   hs = (TH1*)aFolderObj->FindObject("pt_rec_trig_event_track_mult_eff_cont_corrected_s_norm");\r
2506   hsc = (TH1D*)hs->Clone("ratio_pt_rec_to_mc_trig_event_track_mult_eff_cont_corrected"); \r
2507   hsc->Sumw2();\r
2508   hsc->Divide((TH1*)aFolderObj->FindObject("mc_all_pt_acc_prim_s_norm"));\r
2509   aFolderObj->Add(hsc);\r
2510 \r
2511   hs = (TH1*)aFolderObj->FindObject("eta_rec_trig_event_track_mult_eff_cont_corrected");\r
2512   hsc = (TH1D*)hs->Clone("ratio_eta_rec_to_mc_trig_event_track_mult_eff_cont_corrected"); \r
2513   hsc->Sumw2();\r
2514   hsc->Divide((TH1*)aFolderObj->FindObject("mc_all_eta_acc_prim"));\r
2515   aFolderObj->Add(hsc);\r
2516 \r
2517   //\r
2518   hs = (TH1*)aFolderObj->FindObject("pt_rec_ND_trig_event_track_mult_eff_cont_corrected_s_norm");\r
2519   hsc = (TH1D*)hs->Clone("ratio_pt_rec_to_mc_ND_trig_event_track_mult_eff_cont_corrected"); \r
2520   hsc->Sumw2();\r
2521   hsc->Divide((TH1*)aFolderObj->FindObject("mc_ND_all_pt_acc_prim_s_norm"));\r
2522   aFolderObj->Add(hsc);\r
2523 \r
2524   hs = (TH1*)aFolderObj->FindObject("eta_rec_ND_trig_event_track_mult_eff_cont_corrected");\r
2525   hsc = (TH1D*)hs->Clone("ratio_eta_rec_to_mc_ND_trig_event_track_mult_eff_cont_corrected"); \r
2526   hsc->Sumw2();\r
2527   hsc->Divide((TH1*)aFolderObj->FindObject("mc_ND_all_eta_acc_prim"));\r
2528   aFolderObj->Add(hsc);\r
2529 \r
2530   //\r
2531   hs = (TH1*)aFolderObj->FindObject("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_s_norm");\r
2532   hsc = (TH1D*)hs->Clone("ratio_pt_rec_to_mc_NSD_trig_event_track_mult_eff_cont_corrected"); \r
2533   hsc->Sumw2();\r
2534   hsc->Divide((TH1*)aFolderObj->FindObject("mc_NSD_all_pt_acc_prim_s_norm"));\r
2535   aFolderObj->Add(hsc);\r
2536 \r
2537   hs = (TH1*)aFolderObj->FindObject("eta_rec_NSD_trig_event_track_mult_eff_cont_corrected");\r
2538   hsc = (TH1D*)hs->Clone("ratio_eta_rec_to_mc_NSD_trig_event_track_mult_eff_cont_corrected"); \r
2539   hsc->Sumw2();\r
2540   hsc->Divide((TH1*)aFolderObj->FindObject("mc_NSD_all_eta_acc_prim"));\r
2541   aFolderObj->Add(hsc);\r
2542 \r
2543   //\r
2544   hs = (TH1*)aFolderObj->FindObject("pt_rec_event_track_mult_eff_cont_corrected_s_norm");\r
2545   hsc = (TH1D*)hs->Clone("ratio_pt_rec_to_mc_event_track_mult_eff_cont_corrected"); \r
2546   hsc->Sumw2();\r
2547   hsc->Divide((TH1*)aFolderObj->FindObject("mc_trigger_all_pt_acc_prim_s_norm"));\r
2548   aFolderObj->Add(hsc);\r
2549 \r
2550   hs = (TH1*)aFolderObj->FindObject("eta_rec_event_track_mult_eff_cont_corrected");\r
2551   hsc = (TH1D*)hs->Clone("ratio_eta_rec_to_mc_event_track_mult_eff_cont_corrected"); \r
2552   hsc->Sumw2();\r
2553   hsc->Divide((TH1*)aFolderObj->FindObject("mc_trigger_all_eta_acc_prim"));\r
2554   aFolderObj->Add(hsc);\r
2555 \r
2556   // track level\r
2557   hs = (TH1*)aFolderObj->FindObject("pt_rec_track_mult_eff_cont_corrected_s_norm");\r
2558   hsc = (TH1D*)hs->Clone("ratio_pt_rec_to_mc_track_mult_eff_cont_corrected"); \r
2559   hsc->Sumw2();\r
2560   hsc->Divide((TH1*)aFolderObj->FindObject("mc_all_pt_acc_trig_event_prim_s_norm"));\r
2561   aFolderObj->Add(hsc);\r
2562 \r
2563   hs = (TH1*)aFolderObj->FindObject("eta_rec_track_mult_eff_cont_corrected");\r
2564   hsc = (TH1D*)hs->Clone("ratio_eta_rec_to_mc_track_mult_eff_cont_corrected"); \r
2565   hsc->Sumw2();\r
2566   hsc->Divide((TH1*)aFolderObj->FindObject("mc_all_eta_acc_trig_event_prim"));\r
2567   aFolderObj->Add(hsc);\r
2568 \r
2569   } // end MC infor available\r
2570 \r
2571   // export objects to analysis folder\r
2572   fCorrectionFolder = ExportToFolder(aFolderObj);\r
2573 \r
2574   // delete only TObjArray\r
2575   if(aFolderObj) delete aFolderObj;\r
2576 }\r
2577 \r
2578 //_____________________________________________________________________________\r
2579 TFolder* AlidNdPtCorrection::ExportToFolder(TObjArray * const array) \r
2580 {\r
2581   // recreate folder avery time and export objects to new one\r
2582   //\r
2583   AlidNdPtCorrection * comp=this;\r
2584   TFolder *folder = comp->GetCorrectionFolder();\r
2585 \r
2586   TString name, title;\r
2587   TFolder *newFolder = 0;\r
2588   Int_t i = 0;\r
2589   Int_t size = array->GetSize();\r
2590 \r
2591   if(folder) { \r
2592      // get name and title from old folder\r
2593      name = folder->GetName();  \r
2594      title = folder->GetTitle();  \r
2595 \r
2596          // delete old one\r
2597      delete folder;\r
2598 \r
2599          // create new one\r
2600      newFolder = CreateFolder(name.Data(),title.Data());\r
2601      newFolder->SetOwner();\r
2602 \r
2603          // add objects to folder\r
2604      while(i < size) {\r
2605            newFolder->Add(array->At(i));\r
2606            i++;\r
2607          }\r
2608   }\r
2609 \r
2610 return newFolder;\r
2611 }\r
2612 \r
2613 //_____________________________________________________________________________\r
2614 TFolder* AlidNdPtCorrection::CreateFolder(TString name,TString title) { \r
2615 // create folder for analysed histograms\r
2616 //\r
2617 TFolder *folder = 0;\r
2618   folder = new TFolder(name.Data(),title.Data());\r
2619 \r
2620   return folder;\r
2621 }\r