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