56ddbc2b77546fe72d4c6cab607b0f3cfe99c4d5
[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 \r
43 #include "AlidNdPtEventCuts.h"\r
44 #include "AlidNdPtAcceptanceCuts.h"\r
45 #include "AliPhysicsSelection.h"\r
46 \r
47 #include "AliPWG0Helper.h"\r
48 #include "AlidNdPtHelper.h"\r
49 #include "AlidNdPtCorrection.h"\r
50 \r
51 using namespace std;\r
52 \r
53 ClassImp(AlidNdPtCorrection)\r
54 \r
55 //_____________________________________________________________________________\r
56 //AlidNdPtCorrection::AlidNdPtCorrection(): TNamed(),\r
57   AlidNdPtCorrection::AlidNdPtCorrection(): AlidNdPt(),\r
58   fCorrectionFolder(0),\r
59   fMCEventHist1(0),\r
60   fRecEventHist1(0),\r
61   fMCAllEventMultHist1(0),\r
62   fMCAllNDEventMultHist1(0),\r
63   fMCAllNSDEventMultHist1(0),\r
64   fMCTriggerMultHist1(0),\r
65   fMCEventMultHist1(0),\r
66   fMCAllPrimTrackMultHist1(0),\r
67   fMCNDEventAllPrimTrackMultHist1(0),\r
68   fMCNSDEventAllPrimTrackMultHist1(0),\r
69   fMCTriggerPrimTrackMultHist1(0),\r
70   fMCEventPrimTrackMultHist1(0),\r
71   fEventMultCorrelationMatrix(0),\r
72   fZvNorm(0),\r
73   fZvEmptyEventsNorm(0),\r
74   fCorrTriggerMBtoInelEventMatrix(0),\r
75   fCorrTriggerMBtoNDEventMatrix(0),\r
76   fCorrTriggerMBtoNSDEventMatrix(0),\r
77   fCorrEventMatrix(0),\r
78   fCorrTriggerMBtoInelTrackEventMatrix(0),\r
79   fCorrTriggerMBtoNDTrackEventMatrix(0),\r
80   fCorrTriggerMBtoNSDTrackEventMatrix(0),\r
81   fCorrTrackEventMatrix(0),\r
82   fCorrTrackMatrix(0),\r
83   fContTrackMatrix(0),\r
84   fContMultTrackMatrix(0),\r
85   fCorrMatrixFileName(""),\r
86   fCosmicsHisto(0)\r
87 {\r
88   // default constructor\r
89   for(Int_t i=0; i<AlidNdPtHelper::kCutSteps; i++) { \r
90     fRecTrackHist1[i]=0;     \r
91   }\r
92 \r
93   for(Int_t i=0; i<8; i++) { \r
94     fCorrRecTrackMultHist1[i] = 0;\r
95   }\r
96 \r
97   for(Int_t i=0; i<5; i++) { \r
98     fCorrRecEventHist1[i] = 0;\r
99     fCorrRecEventHist2[i] = 0;\r
100   }\r
101 \r
102   Init();\r
103 }\r
104 \r
105 //_____________________________________________________________________________\r
106 AlidNdPtCorrection::AlidNdPtCorrection(Char_t* name, Char_t* title, TString corrMatrixFileName): AlidNdPt(name,title),\r
107   fCorrectionFolder(0),\r
108   fMCEventHist1(0),\r
109   fRecEventHist1(0),\r
110   fMCAllEventMultHist1(0),\r
111   fMCAllNDEventMultHist1(0),\r
112   fMCAllNSDEventMultHist1(0),\r
113   fMCTriggerMultHist1(0),\r
114   fMCEventMultHist1(0),\r
115   fMCAllPrimTrackMultHist1(0),\r
116   fMCNDEventAllPrimTrackMultHist1(0),\r
117   fMCNSDEventAllPrimTrackMultHist1(0),\r
118   fMCTriggerPrimTrackMultHist1(0),\r
119   fMCEventPrimTrackMultHist1(0),\r
120   fEventMultCorrelationMatrix(0),\r
121   fZvNorm(0),\r
122   fZvEmptyEventsNorm(0),\r
123   fCorrTriggerMBtoInelEventMatrix(0),\r
124   fCorrTriggerMBtoNDEventMatrix(0),\r
125   fCorrTriggerMBtoNSDEventMatrix(0),\r
126   fCorrEventMatrix(0),\r
127   fCorrTriggerMBtoInelTrackEventMatrix(0),\r
128   fCorrTriggerMBtoNDTrackEventMatrix(0),\r
129   fCorrTriggerMBtoNSDTrackEventMatrix(0),\r
130   fCorrTrackEventMatrix(0),\r
131   fCorrTrackMatrix(0),\r
132   fContTrackMatrix(0),\r
133   fContMultTrackMatrix(0),\r
134   fCorrMatrixFileName(corrMatrixFileName),\r
135   fCosmicsHisto(0)\r
136 {\r
137   // constructor\r
138   for(Int_t i=0; i<AlidNdPtHelper::kCutSteps; i++) { \r
139     fRecTrackHist1[i]=0;     \r
140   }\r
141 \r
142   for(Int_t i=0; i<8; i++) { \r
143     fCorrRecTrackMultHist1[i] = 0;\r
144     fPtvsPt[i] = 0;\r
145   }\r
146 \r
147   for(Int_t i=0; i<5; i++) { \r
148     fCorrRecEventHist1[i] = 0;\r
149     fCorrRecEventHist2[i] = 0;\r
150   }\r
151 \r
152   Init();\r
153 }\r
154 \r
155 //_____________________________________________________________________________\r
156 AlidNdPtCorrection::~AlidNdPtCorrection() {\r
157   // \r
158   // destructor\r
159   //\r
160   if(fMCEventHist1) delete fMCEventHist1; fMCEventHist1=0;\r
161   if(fRecEventHist1) delete fRecEventHist1; fRecEventHist1=0;\r
162 \r
163   if(fMCAllEventMultHist1) delete fMCAllEventMultHist1; fMCAllEventMultHist1=0;\r
164   if(fMCAllNDEventMultHist1) delete fMCAllNDEventMultHist1; fMCAllNDEventMultHist1=0;\r
165   if(fMCAllNSDEventMultHist1) delete fMCAllNSDEventMultHist1; fMCAllNSDEventMultHist1=0;\r
166   if(fMCTriggerMultHist1) delete fMCTriggerMultHist1; fMCTriggerMultHist1=0;\r
167   if(fMCEventMultHist1) delete fMCEventMultHist1; fMCEventMultHist1=0;\r
168 \r
169   if(fMCAllPrimTrackMultHist1) delete fMCAllPrimTrackMultHist1; fMCAllPrimTrackMultHist1=0;\r
170   if(fMCNDEventAllPrimTrackMultHist1) delete fMCNDEventAllPrimTrackMultHist1; fMCNDEventAllPrimTrackMultHist1=0;\r
171   if(fMCNSDEventAllPrimTrackMultHist1) delete fMCNSDEventAllPrimTrackMultHist1; fMCNSDEventAllPrimTrackMultHist1=0;\r
172   if(fMCTriggerPrimTrackMultHist1) delete fMCTriggerPrimTrackMultHist1; fMCTriggerPrimTrackMultHist1=0;\r
173   if(fMCEventPrimTrackMultHist1) delete fMCEventPrimTrackMultHist1; fMCEventPrimTrackMultHist1=0;\r
174   if(fCosmicsHisto) delete fCosmicsHisto; fCosmicsHisto=0;\r
175 \r
176   for(Int_t i=0; i<AlidNdPtHelper::kCutSteps; i++) { \r
177     if(fRecTrackHist1[i]) delete fRecTrackHist1[i]; fRecTrackHist1[i]=0;\r
178   }\r
179 \r
180   for(Int_t i=0; i<8; i++) { \r
181     if(fCorrRecTrackMultHist1[i]) delete fCorrRecTrackMultHist1[i]; fCorrRecTrackMultHist1[i]=0;\r
182     if(fPtvsPt[i]) delete fPtvsPt[i]; fPtvsPt[i]=0;\r
183   }\r
184 \r
185   for(Int_t i=0; i<5; i++) { \r
186     if(fCorrRecEventHist1[i]) delete fCorrRecEventHist1[i]; fCorrRecEventHist1[i]=0;\r
187     if(fCorrRecEventHist2[i]) delete fCorrRecEventHist2[i]; fCorrRecEventHist2[i]=0;\r
188   }\r
189 \r
190   if(fCorrectionFolder) delete fCorrectionFolder; fCorrectionFolder=0;\r
191 }\r
192 \r
193 //_____________________________________________________________________________\r
194 void AlidNdPtCorrection::Init(){\r
195   //\r
196   // Init histograms\r
197   //\r
198   const Int_t etaNbins = 30; \r
199   const Int_t zvNbins = 12;\r
200 \r
201   // UA1 bining\r
202   //const Int_t ptNbins = 52; \r
203   //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
204 \r
205   const Int_t ptNbins = 56; \r
206   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
207   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
208   Double_t binsZv[zvNbins+1] = {-30.,-25.,-20.,-15.,-10.,-5.,0.,5.,10.,15.,20.,25.,30.};\r
209 \r
210 \r
211   //\r
212   Int_t binsMCEventHist1[3]={100,100,140};\r
213   Double_t minMCEventHist1[3]={-0.1,-0.1,-35.}; \r
214   Double_t maxMCEventHist1[3]={0.1,0.1,35.}; \r
215   fMCEventHist1 = new THnSparseF("fMCEventHist1","mcXv:mcYv:mcZv",3,binsMCEventHist1,minMCEventHist1,maxMCEventHist1);\r
216   fMCEventHist1->GetAxis(0)->SetTitle("mcXv (cm)");\r
217   fMCEventHist1->GetAxis(1)->SetTitle("mcYv (cm)");\r
218   fMCEventHist1->GetAxis(2)->SetTitle("mcZv (cm)");\r
219   fMCEventHist1->Sumw2();\r
220 \r
221   //\r
222   Int_t binsRecEventHist1[3]={100,100,140};\r
223   Double_t minRecEventHist1[3]={-3.,-3.,-35.}; \r
224   Double_t maxRecEventHist1[3]={3.,3.,35.}; \r
225   fRecEventHist1 = new THnSparseF("fRecEventHist1","Xv:Yv:Zv",3,binsRecEventHist1,minRecEventHist1,maxRecEventHist1);\r
226   fRecEventHist1->GetAxis(0)->SetTitle("Xv (cm)");\r
227   fRecEventHist1->GetAxis(1)->SetTitle("Yv (cm)");\r
228   fRecEventHist1->GetAxis(2)->SetTitle("Zv (cm)");\r
229   fRecEventHist1->Sumw2();\r
230 \r
231   //\r
232   char name[256];\r
233   char title[256];\r
234 \r
235   Int_t binsMCAllPrimTrackMultHist1[3]={ptNbins,etaNbins,150};\r
236   Double_t minMCAllPrimTrackMultHist1[3]={0.,-1.,-0.5}; \r
237   Double_t maxMCAllPrimTrackMultHist1[3]={20.,1.,149.5}; \r
238   sprintf(name,"fMCAllPrimTrackMultHist1");\r
239   sprintf(title,"mcPt:mcEta:multiplicity");\r
240   \r
241   fMCAllPrimTrackMultHist1 = new THnSparseF(name,title,3,binsMCAllPrimTrackMultHist1,minMCAllPrimTrackMultHist1,maxMCAllPrimTrackMultHist1);\r
242   fMCAllPrimTrackMultHist1->SetBinEdges(0,binsPt);\r
243   fMCAllPrimTrackMultHist1->SetBinEdges(1,binsEta);\r
244   fMCAllPrimTrackMultHist1->GetAxis(0)->SetTitle("mcPt (GeV/c)");\r
245   fMCAllPrimTrackMultHist1->GetAxis(1)->SetTitle("mcEta");\r
246   fMCAllPrimTrackMultHist1->GetAxis(2)->SetTitle("multiplicity");\r
247   fMCAllPrimTrackMultHist1->Sumw2();\r
248 \r
249   Int_t binsMCNDEventAllPrimTrackMultHist1[3]={ptNbins,etaNbins,150};\r
250   Double_t minMCNDEventAllPrimTrackMultHist1[3]={0.,-1.,-0.5}; \r
251   Double_t maxMCNDEventAllPrimTrackMultHist1[3]={20.,1.,149.5}; \r
252   sprintf(name,"fMCNDEventAllPrimTrackMultHist1");\r
253   sprintf(title,"mcPt:mcEta:multiplicity");\r
254   \r
255   fMCNDEventAllPrimTrackMultHist1 = new THnSparseF(name,title,3,binsMCNDEventAllPrimTrackMultHist1,minMCNDEventAllPrimTrackMultHist1,maxMCNDEventAllPrimTrackMultHist1);\r
256   fMCNDEventAllPrimTrackMultHist1->SetBinEdges(0,binsPt);\r
257   fMCNDEventAllPrimTrackMultHist1->SetBinEdges(1,binsEta);\r
258   fMCNDEventAllPrimTrackMultHist1->GetAxis(0)->SetTitle("mcPt (GeV/c)");\r
259   fMCNDEventAllPrimTrackMultHist1->GetAxis(1)->SetTitle("mcEta");\r
260   fMCNDEventAllPrimTrackMultHist1->GetAxis(2)->SetTitle("multiplicity");\r
261   fMCNDEventAllPrimTrackMultHist1->Sumw2();\r
262 \r
263   Int_t binsMCNSDEventAllPrimTrackMultHist1[3]={ptNbins,etaNbins,150};\r
264   Double_t minMCNSDEventAllPrimTrackMultHist1[3]={0.,-1.,-0.5}; \r
265   Double_t maxMCNSDEventAllPrimTrackMultHist1[3]={20.,1.,140.9}; \r
266   sprintf(name,"fMCNSDEventAllPrimTrackMultHist1");\r
267   sprintf(title,"mcPt:mcEta:multiplicity");\r
268   \r
269   fMCNSDEventAllPrimTrackMultHist1 = new THnSparseF(name,title,3,binsMCNSDEventAllPrimTrackMultHist1,minMCNSDEventAllPrimTrackMultHist1,maxMCNSDEventAllPrimTrackMultHist1);\r
270   fMCNSDEventAllPrimTrackMultHist1->SetBinEdges(0,binsPt);\r
271   fMCNSDEventAllPrimTrackMultHist1->SetBinEdges(1,binsEta);\r
272   fMCNSDEventAllPrimTrackMultHist1->GetAxis(0)->SetTitle("mcPt (GeV/c)");\r
273   fMCNSDEventAllPrimTrackMultHist1->GetAxis(1)->SetTitle("mcEta");\r
274   fMCNSDEventAllPrimTrackMultHist1->GetAxis(2)->SetTitle("multiplicity");\r
275   fMCNSDEventAllPrimTrackMultHist1->Sumw2();\r
276 \r
277   Int_t binsMCEventTriggerPrimTrackMultHist1[3]={ptNbins,etaNbins,150};\r
278   Double_t minMCEventTriggerPrimTrackMultHist1[3]={0.,-1.,-0.5}; \r
279   Double_t maxMCEventTriggerPrimTrackMultHist1[3]={20.,1.,149.5}; \r
280   sprintf(name,"fMCTriggerPrimTrackMultHist1");\r
281   sprintf(title,"mcPt:mcEta:multiplicity");\r
282   \r
283   fMCTriggerPrimTrackMultHist1 = new THnSparseF(name,title,3,binsMCEventTriggerPrimTrackMultHist1,minMCEventTriggerPrimTrackMultHist1,maxMCEventTriggerPrimTrackMultHist1);\r
284   fMCTriggerPrimTrackMultHist1->SetBinEdges(0,binsPt);\r
285   fMCTriggerPrimTrackMultHist1->SetBinEdges(1,binsEta);\r
286   fMCTriggerPrimTrackMultHist1->GetAxis(0)->SetTitle("mcPt (GeV/c)");\r
287   fMCTriggerPrimTrackMultHist1->GetAxis(1)->SetTitle("mcEta");\r
288   fMCTriggerPrimTrackMultHist1->GetAxis(2)->SetTitle("multiplicity");\r
289   fMCTriggerPrimTrackMultHist1->Sumw2();\r
290 \r
291   Int_t binsMCEventPrimTrackMultHist1[3]={ptNbins,etaNbins,150};\r
292   Double_t minMCEventPrimTrackMultHist1[3]={0.,-1.,-0.5}; \r
293   Double_t maxMCEventPrimTrackMultHist1[3]={20.,1.,149.5}; \r
294   sprintf(name,"fMCEventPrimTrackMultHist1");\r
295   sprintf(title,"mcPt:mcEta:multiplicity");\r
296   \r
297   fMCEventPrimTrackMultHist1 = new THnSparseF(name,title,3,binsMCEventPrimTrackMultHist1,minMCEventPrimTrackMultHist1,maxMCEventPrimTrackMultHist1);\r
298   fMCEventPrimTrackMultHist1->SetBinEdges(0,binsPt);\r
299   fMCEventPrimTrackMultHist1->SetBinEdges(1,binsEta);\r
300   fMCEventPrimTrackMultHist1->GetAxis(0)->SetTitle("mcPt (GeV/c)");\r
301   fMCEventPrimTrackMultHist1->GetAxis(1)->SetTitle("mcEta");\r
302   fMCEventPrimTrackMultHist1->GetAxis(2)->SetTitle("multiplicity");\r
303   fMCEventPrimTrackMultHist1->Sumw2();\r
304 \r
305   for(Int_t i=0; i<AlidNdPtHelper::kCutSteps; i++) \r
306   {\r
307     // THnSparse track histograms\r
308     //\r
309     Int_t binsRecTrackHist1[3]={ptNbins,etaNbins,90};\r
310     Double_t minRecTrackHist1[3]={0.,-1.,0.}; \r
311     Double_t maxRecTrackHist1[3]={10.,1.,2.*TMath::Pi()};\r
312     sprintf(name,"fRecTrackHist1_%d",i);\r
313     sprintf(title,"Pt:Eta:Phi");\r
314   \r
315     fRecTrackHist1[i] = new THnSparseF(name,title,3,binsRecTrackHist1,minRecTrackHist1,maxRecTrackHist1);\r
316     fRecTrackHist1[i]->SetBinEdges(0,binsPt);\r
317     fRecTrackHist1[i]->SetBinEdges(1,binsEta);\r
318     fRecTrackHist1[i]->GetAxis(0)->SetTitle("Pt (GeV/c)");\r
319     fRecTrackHist1[i]->GetAxis(1)->SetTitle("Eta");\r
320     fRecTrackHist1[i]->GetAxis(2)->SetTitle("Phi (rad)");\r
321     fRecTrackHist1[i]->Sumw2();\r
322   }\r
323 \r
324   Int_t binsCorrRecTrackMultHist1[3]={ptNbins,etaNbins,150};\r
325   Double_t minCorrRecTrackMultHist1[3]={0.,-1.,-0.5}; \r
326   Double_t maxCorrRecTrackMultHist1[3]={20.,1.,149.5};\r
327 \r
328   Int_t binsPtvsPt[3]={ptNbins,320};\r
329   Double_t minPtvsPt[3]={0.,0.}; \r
330   Double_t maxPtvsPt[3]={20.,16.};\r
331 \r
332   for(Int_t i=0; i<8; i++) \r
333   {\r
334     // THnSparse track histograms\r
335     sprintf(name,"fCorrRecTrackMultHist1_%d",i);\r
336     sprintf(title,"Pt:Eta:mult");\r
337     fCorrRecTrackMultHist1[i] = new THnSparseF(name,title,3,binsCorrRecTrackMultHist1,minCorrRecTrackMultHist1,maxCorrRecTrackMultHist1);\r
338     fCorrRecTrackMultHist1[i]->SetBinEdges(0,binsPt);\r
339     fCorrRecTrackMultHist1[i]->SetBinEdges(1,binsEta);\r
340     fCorrRecTrackMultHist1[i]->GetAxis(0)->SetTitle("Pt (GeV/c)");\r
341     fCorrRecTrackMultHist1[i]->GetAxis(1)->SetTitle("Eta");\r
342     fCorrRecTrackMultHist1[i]->GetAxis(2)->SetTitle("multiplicity");\r
343     fCorrRecTrackMultHist1[i]->Sumw2();\r
344 \r
345     sprintf(name,"fPtvsPt_%d",i);\r
346     sprintf(title,"Pt:Pt");\r
347     fPtvsPt[i] = new THnSparseF(name,title,2,binsPtvsPt,minPtvsPt,maxPtvsPt);\r
348     fPtvsPt[i]->SetBinEdges(0,binsPt);\r
349     fPtvsPt[i]->GetAxis(0)->SetTitle("Pt (GeV/c)"); \r
350     fPtvsPt[i]->GetAxis(1)->SetTitle("Pt (GeV/c)"); \r
351     fPtvsPt[i]->Sumw2();\r
352   }\r
353 \r
354   Int_t binsEventMatrix[2]={zvNbins,150};\r
355   Double_t minEventMatrix[2]={-25.,-0.5};\r
356   Double_t maxEventMatrix[2]={25.,149.5};\r
357 \r
358   fMCAllEventMultHist1 = new THnSparseF("fMCAllEventMultHist1","mcZv:mult",2,binsEventMatrix,minEventMatrix,maxEventMatrix);\r
359   fMCAllEventMultHist1->SetBinEdges(0,binsZv);\r
360   fMCAllEventMultHist1->GetAxis(0)->SetTitle("mcZv (cm)");\r
361   fMCAllEventMultHist1->GetAxis(1)->SetTitle("multiplicity");\r
362   fMCAllEventMultHist1->Sumw2();\r
363 \r
364   fMCAllNDEventMultHist1 = new THnSparseF("fMCAllNDEventMultHist1","mcZv:mult",2,binsEventMatrix,minEventMatrix,maxEventMatrix);\r
365   fMCAllNDEventMultHist1->SetBinEdges(0,binsZv);\r
366   fMCAllNDEventMultHist1->GetAxis(0)->SetTitle("mcZv (cm)");\r
367   fMCAllNDEventMultHist1->GetAxis(1)->SetTitle("multiplicity");\r
368   fMCAllNDEventMultHist1->Sumw2();\r
369 \r
370   fMCAllNSDEventMultHist1 = new THnSparseF("fMCAllNSDEventMultHist1","mcZv:mult",2,binsEventMatrix,minEventMatrix,maxEventMatrix);\r
371   fMCAllNSDEventMultHist1->SetBinEdges(0,binsZv);\r
372   fMCAllNSDEventMultHist1->GetAxis(0)->SetTitle("mcZv (cm)");\r
373   fMCAllNSDEventMultHist1->GetAxis(1)->SetTitle("multiplicity");\r
374   fMCAllNSDEventMultHist1->Sumw2();\r
375 \r
376   fMCTriggerMultHist1 = new THnSparseF("fMCTriggerMultHist1","mcZv:mult",2,binsEventMatrix,minEventMatrix,maxEventMatrix);\r
377   fMCTriggerMultHist1->SetBinEdges(0,binsZv);\r
378   fMCTriggerMultHist1->GetAxis(0)->SetTitle("mcZv (cm)");\r
379   fMCTriggerMultHist1->GetAxis(1)->SetTitle("multiplicity");\r
380   fMCTriggerMultHist1->Sumw2();\r
381 \r
382   fMCEventMultHist1 = new THnSparseF("fMCEventMultHist1","mcZv:mult",2,binsEventMatrix,minEventMatrix,maxEventMatrix);\r
383   fMCEventMultHist1->SetBinEdges(0,binsZv);\r
384   fMCEventMultHist1->GetAxis(0)->SetTitle("mcZv (cm)");\r
385   fMCEventMultHist1->GetAxis(1)->SetTitle("multiplicity");\r
386   fMCEventMultHist1->Sumw2();\r
387 \r
388   for(Int_t i=0; i<5; i++) \r
389   {\r
390     // event corrected histograms\r
391     sprintf(name,"fCorrRecEventHist1_%d",i);\r
392     sprintf(title,"mcZv:mult");\r
393     fCorrRecEventHist1[i] = new THnSparseF("fCorrRecEventHist1","mcZv:mult",2,binsEventMatrix,minEventMatrix,maxEventMatrix);\r
394     fCorrRecEventHist1[i]->SetBinEdges(0,binsZv);\r
395     fCorrRecEventHist1[i]->GetAxis(0)->SetTitle("Zv (cm)");\r
396     fCorrRecEventHist1[i]->GetAxis(1)->SetTitle("multiplicity");\r
397     fCorrRecEventHist1[i]->Sumw2();\r
398 \r
399     // empty event corrected histograms\r
400     sprintf(name,"fCorrRecEventHist2_%d",i);\r
401     sprintf(title,"mcZv:mult");\r
402     fCorrRecEventHist2[i] = new THnSparseF("fCorrRecEventHist2","mcZv:mult",2,binsEventMatrix,minEventMatrix,maxEventMatrix);\r
403     fCorrRecEventHist2[i]->SetBinEdges(0,binsZv);\r
404     fCorrRecEventHist2[i]->GetAxis(0)->SetTitle("Zv (cm)");\r
405     fCorrRecEventHist2[i]->GetAxis(1)->SetTitle("multiplicity");\r
406     fCorrRecEventHist2[i]->Sumw2();\r
407   }\r
408   \r
409   //\r
410   // cosmics histo\r
411   //\r
412   Int_t binsCosmicsHisto[3]=  {151, 300, ptNbins};\r
413   Double_t minCosmicsHisto[3]={-1.5, -2.*TMath::Pi(), 0.0}; \r
414   Double_t maxCosmicsHisto[3]={ 1.5, 2.*TMath::Pi(), 16.0}; \r
415   sprintf(name,"fCosmicsHisto");\r
416   sprintf(title,"deta:dphi:pt");\r
417   \r
418   fCosmicsHisto = new THnSparseF(name,title,3,binsCosmicsHisto,minCosmicsHisto,maxCosmicsHisto);\r
419   fCosmicsHisto->SetBinEdges(2,binsPt);\r
420   fCosmicsHisto->GetAxis(0)->SetTitle("#Delta#eta");\r
421   fCosmicsHisto->GetAxis(1)->SetTitle("#Delta#phi (rad)");\r
422   fCosmicsHisto->GetAxis(2)->SetTitle("pt (GV/c)");\r
423   fCosmicsHisto->Sumw2();\r
424 \r
425   // init output folder\r
426   fCorrectionFolder = CreateFolder("folderdNdPt","Correction dNdPt Folder");\r
427 \r
428   // init correction matrices\r
429   TFile *file = (TFile *)TFile::Open(fCorrMatrixFileName.Data()); \r
430   if(!file) { \r
431     AliDebug(AliLog::kError, "file with efficiency matrices not available");\r
432     printf("file with efficiency matrices not available \n");\r
433   } else {\r
434     TFolder *folder = (TFolder *)file->FindObjectAny("folderdNdPt");\r
435     if(!folder) { \r
436       AliDebug(AliLog::kError, "file without folderdNdPt");\r
437       printf("file without folderdNdPt \n");\r
438     } else {\r
439       // rec. event mult vs true multiplicity \r
440       fEventMultCorrelationMatrix = (THnSparseF*)folder->FindObject("event_mult_correlation_matrix");\r
441       if(!fEventMultCorrelationMatrix) {\r
442          Printf("No %s matrix \n", "event_mult_correlation_matrix");\r
443       }\r
444 \r
445       //\r
446       // event level corrections (zv,mult_MB)\r
447       //\r
448  \r
449       // trigger bias correction (MBtoND) \r
450       fCorrTriggerMBtoNDEventMatrix = (THnSparseF*)folder->FindObject("zv_mult_trig_MBtoND_corr_matrix");\r
451       if(!fCorrTriggerMBtoNDEventMatrix) {\r
452          Printf("No %s matrix \n", "zv_mult_trig_MBtoND_corr_matrix");\r
453       }\r
454 \r
455       // trigger bias correction (MBtoNSD)\r
456       fCorrTriggerMBtoNSDEventMatrix = (THnSparseF*)folder->FindObject("zv_mult_trig_MBtoNSD_corr_matrix");\r
457       if(!fCorrTriggerMBtoNSDEventMatrix) {\r
458          Printf("No %s matrix \n", "zv_mult_trig_MBtoNSD_corr_matrix");\r
459       }\r
460 \r
461       // trigger bias correction (MBtoInel)\r
462       fCorrTriggerMBtoInelEventMatrix = (THnSparseF*)folder->FindObject("zv_mult_trig_MBtoInel_corr_matrix");\r
463       if(!fCorrTriggerMBtoInelEventMatrix) {\r
464          Printf("No %s matrix \n", "zv_mult_trig_MBtoInel_corr_matrix"); \r
465       }\r
466      \r
467       // vertex reconstruction efficiency correction\r
468       fCorrEventMatrix = (THnSparseF*)folder->FindObject("zv_mult_event_corr_matrix");\r
469       if(!fCorrEventMatrix) {\r
470          Printf("No %s matrix \n", "zv_mult_event_corr_matrix");\r
471       }\r
472 \r
473       //\r
474       // histogram needed for empty events corrections\r
475       //\r
476       fZvNorm = (TH1D*)folder->FindObject("zv_distribution_norm");\r
477       if(!fZvNorm) {\r
478          Printf("No %s matrix \n", "fZvNorm");\r
479       }\r
480 \r
481       fZvEmptyEventsNorm = (TH1D*)folder->FindObject("zv_empty_events_norm");\r
482       if(!fZvEmptyEventsNorm) {\r
483          Printf("No %s matrix \n", "fZvEmptyEventsNorm");\r
484       }\r
485 \r
486       //\r
487       // track-event level corrections (zv,pt,eta)\r
488       //\r
489 \r
490       // trigger bias correction (MBtoND) \r
491       fCorrTriggerMBtoNDTrackEventMatrix = (THnSparseF*)folder->FindObject("zv_pt_eta_track_trig_MBtoND_corr_matrix");\r
492       if(!fCorrTriggerMBtoNDTrackEventMatrix) {\r
493          Printf("No %s matrix \n", "zv_pt_eta_track_trig_MBtoND_corr_matrix");\r
494       }\r
495 \r
496       // trigger bias correction (MBtoNSD)\r
497       fCorrTriggerMBtoNSDTrackEventMatrix = (THnSparseF*)folder->FindObject("zv_pt_eta_track_trig_MBtoNSD_corr_matrix");\r
498       if(!fCorrTriggerMBtoNSDTrackEventMatrix) {\r
499          Printf("No %s matrix \n", "zv_pt_eta_track_trig_MBtoNSD_corr_matrix");\r
500       }\r
501 \r
502       // trigger bias correction (MBtoInel) \r
503       fCorrTriggerMBtoInelTrackEventMatrix = (THnSparseF*)folder->FindObject("zv_pt_eta_track_trig_MBtoInel_corr_matrix");\r
504       if(!fCorrTriggerMBtoInelTrackEventMatrix) {\r
505          Printf("No %s matrix \n", "zv_pt_eta_track_trig_MBtoInel_corr_matrix");\r
506       }\r
507     \r
508       // vertex reconstruction efficiency correction (zv,pt,eta)\r
509       fCorrTrackEventMatrix = (THnSparseF*)folder->FindObject("zv_pt_eta_track_event_corr_matrix");\r
510       if(!fCorrTrackEventMatrix) {\r
511          Printf("No %s matrix \n", "zv_pt_eta_track_event_corr_matrix");\r
512       }\r
513 \r
514       // track reconstruction efficiency correction (zv,pt,eta)\r
515       fCorrTrackMatrix = (THnSparseF*)folder->FindObject("zv_pt_eta_track_corr_matrix");\r
516       if(!fCorrTrackMatrix) {\r
517          Printf("No %s matrix \n", "zv_pt_eta_track_corr_matrix");\r
518       }\r
519 \r
520       // secondary tracks contamination correction (zv,pt,eta)\r
521       fContTrackMatrix = (THnSparseF*)folder->FindObject("zv_pt_eta_track_cont_matrix");\r
522       if(!fContTrackMatrix) {\r
523          Printf("No %s matrix \n", "zv_pt_eta_track_cont_matrix");\r
524       }\r
525 \r
526       // multiply reconstructed tracks correction\r
527       fContMultTrackMatrix = (THnSparseF*)folder->FindObject("zv_pt_eta_mult_track_cont_matrix");\r
528       if(!fContMultTrackMatrix) {\r
529          Printf("No %s matrix \n", "zv_pt_eta_mult_track_cont_matrix");\r
530       }\r
531     }\r
532   }\r
533 \r
534 }\r
535 \r
536 //_____________________________________________________________________________\r
537 void AlidNdPtCorrection::Process(AliESDEvent *esdEvent, AliMCEvent *mcEvent)\r
538 {\r
539   //\r
540   // Process real and/or simulated events\r
541   //\r
542   if(!esdEvent) {\r
543     AliDebug(AliLog::kError, "esdEvent not available");\r
544     return;\r
545   }\r
546 \r
547   // get selection cuts\r
548   AlidNdPtEventCuts *evtCuts = GetEventCuts(); \r
549   AlidNdPtAcceptanceCuts *accCuts = GetAcceptanceCuts(); \r
550   AliESDtrackCuts *esdTrackCuts = GetTrackCuts(); \r
551 \r
552   if(!evtCuts || !accCuts  || !esdTrackCuts) {\r
553     AliDebug(AliLog::kError, "cuts not available");\r
554     return;\r
555   }\r
556 \r
557   // get physics trigger selection \r
558   AliPhysicsSelection *trigSel = GetPhysicsTriggerSelection();\r
559   if(!trigSel) {\r
560     AliDebug(AliLog::kError, "cannot get trigSel");\r
561     return;\r
562   }\r
563 \r
564   // trigger selection\r
565   Bool_t isEventTriggered = kTRUE;\r
566   if(evtCuts->IsTriggerRequired())  {\r
567     if(IsUseMCInfo()) { \r
568       //static AliTriggerAnalysis* triggerAnalysis = new AliTriggerAnalysis;\r
569       //isEventTriggered = triggerAnalysis->IsTriggerFired(esdEvent, GetTrigger());\r
570       trigSel->SetAnalyzeMC();\r
571       isEventTriggered = trigSel->IsCollisionCandidate(esdEvent);\r
572     }\r
573     else {\r
574       //isEventTriggered = esdEvent->IsTriggerClassFired(GetTriggerClass());\r
575       isEventTriggered = trigSel->IsCollisionCandidate(esdEvent);\r
576     }\r
577   }\r
578 \r
579   // use MC information\r
580   AliHeader* header = 0;\r
581   AliGenEventHeader* genHeader = 0;\r
582   AliStack* stack = 0;\r
583   TArrayF vtxMC(3);\r
584   AliPWG0Helper::MCProcessType evtType = AliPWG0Helper::kInvalidProcess;\r
585   Int_t multMCTrueTracks = 0;\r
586 \r
587   if(IsUseMCInfo())\r
588   {\r
589     if(!mcEvent) {\r
590       AliDebug(AliLog::kError, "mcEvent not available");\r
591       return;\r
592     }\r
593 \r
594     // get MC event header\r
595     header = mcEvent->Header();\r
596     if (!header) {\r
597       AliDebug(AliLog::kError, "Header not available");\r
598       return;\r
599     }\r
600     // MC particle stack\r
601     stack = mcEvent->Stack();\r
602     if (!stack) {\r
603       AliDebug(AliLog::kError, "Stack not available");\r
604       return;\r
605     }\r
606 \r
607     // get event type (ND=0x1, DD=0x2, SD=0x4)\r
608     evtType = AliPWG0Helper::GetEventProcessType(header);\r
609     //Printf("evtType %d \n", evtType);\r
610     AliDebug(AliLog::kDebug+1, Form("Found process type %d", evtType));\r
611 \r
612     // get MC vertex\r
613     genHeader = header->GenEventHeader();\r
614     if (!genHeader) {\r
615       AliDebug(AliLog::kError, "Could not retrieve genHeader from Header");\r
616       return;\r
617     }\r
618     genHeader->PrimaryVertex(vtxMC);\r
619 \r
620     // Fill MC event histogram\r
621     Double_t vMCEventHist1[3]={vtxMC[0],vtxMC[1],vtxMC[2]};\r
622     fMCEventHist1->Fill(vMCEventHist1);\r
623 \r
624     // multipliticy of all MC primary tracks\r
625     // in Zvtx, pt and eta ranges\r
626     multMCTrueTracks = AlidNdPtHelper::GetMCTrueTrackMult(mcEvent,evtCuts,accCuts);\r
627 \r
628   } // end bUseMC\r
629 \r
630   // get reconstructed vertex  \r
631   const AliESDVertex* vtxESD = 0; \r
632   Bool_t isRecVertex = kFALSE;\r
633   if(evtCuts->IsRecVertexRequired()) \r
634   {\r
635     Bool_t bRedoTPCVertex = evtCuts->IsRedoTPCVertex();\r
636     Bool_t bUseConstraints = evtCuts->IsUseBeamSpotConstraint();\r
637     vtxESD = AlidNdPtHelper::GetVertex(esdEvent,evtCuts,accCuts,esdTrackCuts,GetAnalysisMode(),kFALSE,bRedoTPCVertex,bUseConstraints); \r
638     isRecVertex = AlidNdPtHelper::TestRecVertex(vtxESD, GetAnalysisMode(), kFALSE); \r
639   }\r
640   if( IsUseMCInfo() &&  !evtCuts->IsRecVertexRequired() ) {\r
641     vtxESD = new AliESDVertex(vtxMC[2],10.,genHeader->NProduced());\r
642     isRecVertex = kTRUE;\r
643   }\r
644   Bool_t isEventOK = evtCuts->AcceptEvent(esdEvent,mcEvent,vtxESD) && isRecVertex; \r
645   //printf("isEventOK %d \n",isEventOK);\r
646 \r
647   //\r
648   // get multiplicity vertex contributors\r
649   //\r
650   Int_t multMBTracks = 0; \r
651   if(GetAnalysisMode() == AlidNdPtHelper::kTPC || GetAnalysisMode() == AlidNdPtHelper::kMCRec) {  \r
652     multMBTracks = AlidNdPtHelper::GetTPCMBTrackMult(esdEvent,evtCuts,accCuts,esdTrackCuts);\r
653   } \r
654   else if(GetAnalysisMode() == AlidNdPtHelper::kTPCSPDvtx || GetAnalysisMode() == AlidNdPtHelper::kTPCSPDvtxUpdate || GetAnalysisMode() == AlidNdPtHelper::kMCRec) {\r
655     //multMBTracks = AlidNdPtHelper::GetSPDMBTrackMult(esdEvent,0.0);\r
656     multMBTracks = vtxESD->GetNContributors();\r
657   } \r
658   else {\r
659     AliDebug(AliLog::kError, Form("Found analysis type %s", GetAnalysisMode()));\r
660     return; \r
661   }\r
662 \r
663   //\r
664   // correct event and track histograms\r
665   //\r
666   TObjArray *allChargedTracks=0;\r
667   Int_t multRec=0, multRecTemp=0;\r
668   Int_t *labelsRec=0;\r
669   Bool_t isCosmic = kFALSE;\r
670 \r
671   if(isEventOK && isEventTriggered)\r
672   {\r
673     // get all charged tracks\r
674     allChargedTracks = AlidNdPtHelper::GetAllChargedTracks(esdEvent,GetAnalysisMode());\r
675     if(!allChargedTracks) return;\r
676 \r
677     Int_t entries = allChargedTracks->GetEntries();\r
678     labelsRec = new Int_t[entries];\r
679 \r
680     // calculate mult of reconstructed tracks\r
681     for(Int_t i=0; i<entries;++i) \r
682     {\r
683       AliESDtrack *track = (AliESDtrack*)allChargedTracks->At(i);\r
684       if(!track) continue;\r
685       if(track->Charge()==0) continue;\r
686 \r
687       // only postive charged \r
688       if(GetParticleMode() == AlidNdPtHelper::kPlus && track->Charge() < 0) \r
689         continue;\r
690       \r
691       // only negative charged \r
692       if(GetParticleMode() == AlidNdPtHelper::kMinus && track->Charge() > 0) \r
693         continue;\r
694 \r
695       // cosmics analysis\r
696       isCosmic = kFALSE;\r
697       if( GetParticleMode()==AlidNdPtHelper::kCosmics )\r
698       {\r
699           for(Int_t j=0; j<entries;++j) \r
700           {\r
701             AliESDtrack *track1 = (AliESDtrack*)allChargedTracks->At(j);\r
702             if(!track1) continue;\r
703             if(track1->Charge()==0) continue;\r
704 \r
705             if( esdTrackCuts->AcceptTrack(track) && accCuts->AcceptTrack(track) && \r
706                 esdTrackCuts->AcceptTrack(track1) && accCuts->AcceptTrack(track1) ) \r
707             { \r
708               isCosmic = AlidNdPtHelper::IsCosmicTrack(track, track1);\r
709             }\r
710             if(isCosmic) \r
711             {\r
712               Double_t vCosmicsHisto[3] = { track->Eta()+track1->Eta(), track->Phi()-track1->Phi(), track1->Pt() };\r
713               fCosmicsHisto->Fill(vCosmicsHisto);\r
714             }\r
715           }\r
716          \r
717         if(!isCosmic) continue;\r
718       }\r
719 \r
720       if(esdTrackCuts->AcceptTrack(track) && accCuts->AcceptTrack(track)) \r
721         multRecTemp++;\r
722     }  \r
723 \r
724     //\r
725     for(Int_t i=0; i<entries;++i) \r
726     {\r
727       AliESDtrack *track = (AliESDtrack*)allChargedTracks->At(i);\r
728       if(!track) continue;\r
729       if(track->Charge()==0) continue;\r
730 \r
731       // only postive charged \r
732       if(GetParticleMode() == AlidNdPtHelper::kPlus && track->Charge() < 0) \r
733       continue;\r
734       \r
735       // only negative charged \r
736       if(GetParticleMode() == AlidNdPtHelper::kMinus && track->Charge() > 0) \r
737       continue;\r
738         \r
739       // track-level corrections\r
740       if(esdTrackCuts->AcceptTrack(track)) \r
741       {\r
742         // cosmics analysis\r
743         isCosmic = kFALSE;\r
744         if( GetParticleMode()==AlidNdPtHelper::kCosmics )\r
745         {\r
746           for(Int_t j=0; j<entries;++j) \r
747           {\r
748             AliESDtrack *track1 = (AliESDtrack*)allChargedTracks->At(j);\r
749             if(!track1) continue;\r
750             if(track1->Charge()==0) continue;\r
751 \r
752             if( esdTrackCuts->AcceptTrack(track) && accCuts->AcceptTrack(track) && \r
753                 esdTrackCuts->AcceptTrack(track1) && accCuts->AcceptTrack(track1) ) \r
754             { \r
755               isCosmic = AlidNdPtHelper::IsCosmicTrack(track, track1);\r
756             }\r
757           }\r
758           if(!isCosmic) continue;\r
759         }\r
760 \r
761          if (GetAnalysisMode()==AlidNdPtHelper::kTPCSPDvtxUpdate) \r
762          {\r
763            //\r
764            // update track parameters\r
765            //\r
766            AliExternalTrackParam cParam;\r
767            track->RelateToVertexTPC(esdEvent->GetPrimaryVertexSPD(),esdEvent->GetMagneticField(),kVeryBig,&cParam);\r
768            track->Set(cParam.GetX(),cParam.GetAlpha(),cParam.GetParameter(),cParam.GetCovariance());\r
769 \r
770            if(accCuts->AcceptTrack(track)) { \r
771              FillHistograms(track,stack,AlidNdPtHelper::kRecTracks,vtxESD->GetZv(),multRecTemp); \r
772              labelsRec[multRec] = TMath::Abs(track->GetLabel());\r
773              multRec++;\r
774            }\r
775          }\r
776          else if (GetAnalysisMode()==AlidNdPtHelper::kMCRec && IsUseMCInfo()) \r
777          { \r
778            //\r
779            // Replace rec with MC\r
780            //\r
781            if(accCuts->AcceptTrack(track)) { \r
782              FillHistograms(track,stack,AlidNdPtHelper::kRecTracks,vtxMC[2],multRecTemp); \r
783              labelsRec[multRec] = TMath::Abs(track->GetLabel());\r
784              multRec++;\r
785            }\r
786          } \r
787          else  {\r
788            //\r
789            // all the rest tracking scenarios\r
790            //\r
791            if(accCuts->AcceptTrack(track)) { \r
792              FillHistograms(track,stack,AlidNdPtHelper::kRecTracks,vtxESD->GetZv(),multRecTemp); \r
793              labelsRec[multRec] = TMath::Abs(track->GetLabel());\r
794              multRec++;\r
795            }\r
796          }\r
797        }\r
798     }\r
799     // event-level corrections\r
800     if(GetAnalysisMode()==AlidNdPtHelper::kMCRec && IsUseMCInfo()) { \r
801       FillHistograms(AlidNdPtHelper::kRecEvents,vtxMC[2],multMBTracks);\r
802     }\r
803     else {\r
804       FillHistograms(AlidNdPtHelper::kRecEvents,vtxESD->GetZv(),multMBTracks);\r
805     }\r
806 \r
807     // control event histograms\r
808     Double_t vRecEventHist1[3] = {vtxESD->GetXv(),vtxESD->GetYv(),vtxESD->GetZv()};\r
809     fRecEventHist1->Fill(vRecEventHist1);\r
810   } \r
811 \r
812   // empty events corrections\r
813   // no reconstructed zv\r
814   if(isEventTriggered && multMBTracks==0) {\r
815     if(GetAnalysisMode()==AlidNdPtHelper::kMCRec && IsUseMCInfo()) {\r
816       FillHistograms(AlidNdPtHelper::kTriggeredEvents,vtxMC[2],multMBTracks);\r
817     }\r
818     else {\r
819       Double_t zv = fZvNorm->GetRandom();\r
820       FillHistograms(AlidNdPtHelper::kTriggeredEvents,zv,multMBTracks);\r
821     }\r
822   }\r
823 \r
824   if(IsUseMCInfo())  \r
825   {\r
826     // select MC events \r
827     if(evtCuts->AcceptMCEvent(mcEvent))\r
828     {\r
829       //\r
830       // event histograms\r
831       //\r
832       Double_t vMCEventMatrix[2] = {vtxMC[2],multMBTracks};\r
833       fMCAllEventMultHist1->Fill(vMCEventMatrix);\r
834       if(evtType == AliPWG0Helper::kND) {\r
835         fMCAllNDEventMultHist1->Fill(vMCEventMatrix);\r
836       }\r
837       if(evtType != AliPWG0Helper::kSD) {\r
838         fMCAllNSDEventMultHist1->Fill(vMCEventMatrix);\r
839       }\r
840       if(isEventTriggered) fMCTriggerMultHist1->Fill(vMCEventMatrix);\r
841       if(isEventTriggered && isEventOK) fMCEventMultHist1->Fill(vMCEventMatrix);\r
842 \r
843       //\r
844       // MC histograms for efficiency studies\r
845       //\r
846       Int_t nPart  = stack->GetNtrack();\r
847       for (Int_t iMc = 0; iMc < nPart; ++iMc) \r
848       {\r
849         // print MC stack info\r
850         //AlidNdPtHelper::PrintMCInfo(stack,iMc);\r
851 \r
852         TParticle* particle = stack->Particle(iMc);\r
853         if (!particle)\r
854         continue;\r
855 \r
856         // only charged particles\r
857         Double_t charge = particle->GetPDG()->Charge()/3.;\r
858         if (TMath::Abs(charge) < 0.001)\r
859           continue;\r
860 \r
861         // only postive charged \r
862         if(GetParticleMode() == AlidNdPtHelper::kPlus && charge  < 0.) \r
863         continue;\r
864       \r
865         // only negative charged \r
866         if(GetParticleMode() == AlidNdPtHelper::kMinus && charge > 0.) \r
867         continue;\r
868       \r
869         // physical primary\r
870         Bool_t prim = stack->IsPhysicalPrimary(iMc);\r
871 \r
872         // all primaries in acceptance\r
873         if(!accCuts->AcceptTrack(particle)) continue;\r
874         if(!prim) continue;\r
875 \r
876         Double_t gpt = particle->Pt();\r
877         Double_t geta = particle->Eta();\r
878 \r
879         Double_t valMCAllTrackMultHist1[3] = {gpt,geta,multRec};          \r
880         fMCAllPrimTrackMultHist1->Fill(valMCAllTrackMultHist1);\r
881         if(evtType == AliPWG0Helper::kND) {\r
882           fMCNDEventAllPrimTrackMultHist1->Fill(valMCAllTrackMultHist1);\r
883         }\r
884         if(evtType != AliPWG0Helper::kSD) {\r
885           fMCNSDEventAllPrimTrackMultHist1->Fill(valMCAllTrackMultHist1);\r
886         }\r
887         if(isEventTriggered) fMCTriggerPrimTrackMultHist1->Fill(valMCAllTrackMultHist1);\r
888         if(isEventTriggered && isEventOK) fMCEventPrimTrackMultHist1->Fill(valMCAllTrackMultHist1);\r
889       }\r
890     }\r
891   } // end bUseMC\r
892 \r
893   if(allChargedTracks) delete allChargedTracks; allChargedTracks = 0;\r
894   if(labelsRec) delete [] labelsRec; labelsRec = 0;\r
895 \r
896   if(!evtCuts->IsRecVertexRequired() && vtxESD != NULL) delete vtxESD;\r
897 }\r
898 \r
899 //_____________________________________________________________________________\r
900 void AlidNdPtCorrection::FillHistograms(AlidNdPtHelper::EventObject eventObj, Double_t zv, Int_t multMBTracks) const\r
901 {\r
902   //\r
903   // Fill corrected histograms\r
904   //\r
905 \r
906   Double_t vEventMatrix[2] = {zv,multMBTracks};\r
907   //\r
908   // Correct for efficiency \r
909   //\r
910   if(eventObj == AlidNdPtHelper::kRecEvents && multMBTracks>0)  \r
911   {\r
912     Double_t corrToMBF = GetCorrFactZvMult(fCorrEventMatrix,zv,multMBTracks);\r
913     Double_t corrToInelF = GetCorrFactZvMult(fCorrTriggerMBtoInelEventMatrix,zv,multMBTracks);\r
914     Double_t corrToNDF = GetCorrFactZvMult(fCorrTriggerMBtoNDEventMatrix,zv,multMBTracks);\r
915     Double_t corrToNSDF = GetCorrFactZvMult(fCorrTriggerMBtoNSDEventMatrix,zv,multMBTracks);\r
916     //printf("corrToMBF %f, corrToInelF %f, corrToNDF %f corrToNSDF %f \n",corrToMBF,corrToInelF,corrToNDF,corrToNSDF);\r
917 \r
918     fCorrRecEventHist1[0]->Fill(vEventMatrix);\r
919     fCorrRecEventHist1[1]->Fill(vEventMatrix,corrToMBF);\r
920     fCorrRecEventHist1[2]->Fill(vEventMatrix,corrToMBF*corrToInelF);\r
921     fCorrRecEventHist1[3]->Fill(vEventMatrix,corrToMBF*corrToNDF);\r
922     fCorrRecEventHist1[4]->Fill(vEventMatrix,corrToMBF*corrToNSDF);\r
923   }\r
924 \r
925   if(eventObj==AlidNdPtHelper::kTriggeredEvents && multMBTracks==0) // empty triggered events\r
926   {\r
927     Int_t bin = fZvEmptyEventsNorm->FindBin(zv);\r
928     Double_t factZ = fZvEmptyEventsNorm->GetBinContent(bin);\r
929     Double_t corrToInelF0 = GetCorrFactZvMult(fCorrTriggerMBtoInelEventMatrix,zv,multMBTracks);\r
930     Double_t corrToNDF0 = GetCorrFactZvMult(fCorrTriggerMBtoNDEventMatrix,zv,multMBTracks);\r
931     Double_t corrToNSDF0 = GetCorrFactZvMult(fCorrTriggerMBtoNSDEventMatrix,zv,multMBTracks);\r
932     //printf("factZ %f, corrToInelF0 %f, corrToNDF0 %f, corrToNSDF0 %f \n",factZ,corrToInelF0,corrToNDF0,corrToNSDF0);\r
933 \r
934     fCorrRecEventHist2[0]->Fill(vEventMatrix);\r
935     fCorrRecEventHist2[1]->Fill(vEventMatrix,factZ);\r
936     fCorrRecEventHist2[2]->Fill(vEventMatrix,factZ*corrToInelF0);\r
937     fCorrRecEventHist2[3]->Fill(vEventMatrix,factZ*corrToNDF0);\r
938     fCorrRecEventHist2[4]->Fill(vEventMatrix,factZ*corrToNSDF0);\r
939   }\r
940 }\r
941 \r
942 //_____________________________________________________________________________\r
943 void AlidNdPtCorrection::FillHistograms(AliESDtrack * const esdTrack, AliStack * const stack, AlidNdPtHelper::TrackObject trackObj, Double_t zv, Int_t mult) const\r
944 {\r
945   //\r
946   // Fill ESD track and MC histograms \r
947   //\r
948   if(!esdTrack) return;\r
949 \r
950   //Float_t q = esdTrack->Charge();\r
951   Float_t pt = esdTrack->Pt();\r
952   Float_t eta = esdTrack->Eta();\r
953   Float_t phi = esdTrack->Phi();\r
954 \r
955   if(stack && GetAnalysisMode() == AlidNdPtHelper::kMCRec) \r
956   {\r
957     Int_t label = TMath::Abs(esdTrack->GetLabel());\r
958    \r
959     TParticle* particle = stack->Particle(label);\r
960     if(!particle) return;\r
961    \r
962     Double_t gq = particle->GetPDG()->Charge()/3.0; // Charge units |e|/3\r
963     if(TMath::Abs(gq)<0.001) return;\r
964     Float_t gpt = particle->Pt();\r
965     Float_t geta = particle->Eta();\r
966     Float_t gphi = particle->Phi();\r
967 \r
968     // replace reconstructed values with MC\r
969     pt = gpt;\r
970     eta = geta;\r
971     phi = gphi;\r
972   }\r
973 \r
974   //\r
975   // Fill histograms\r
976   //\r
977   Double_t values[3] = {pt,eta,phi};      \r
978   fRecTrackHist1[trackObj]->Fill(values);\r
979 \r
980   //\r
981   // Correct for contamination and efficiency \r
982   //\r
983   if(trackObj == AlidNdPtHelper::kRecTracks || GetAnalysisMode() == AlidNdPtHelper::kMCRec)  \r
984   {\r
985     // track level corrections\r
986     Double_t trackEffF = GetCorrFactZvPtEta(fCorrTrackMatrix,zv,pt,eta);\r
987     Double_t trackContF = GetContFactZvPtEta(fContTrackMatrix,zv,pt,eta);\r
988     Double_t multTrackContF = GetContFactZvPtEta(fContMultTrackMatrix,zv,pt,eta);\r
989     //printf("zv %f, pt %f, eta %f \n",zv,pt,eta);\r
990     //printf("trackEffF %f, trackContF %f, multTrackContF %f \n", trackEffF, trackContF, multTrackContF);\r
991    \r
992     // track-event level corrections\r
993     Double_t vertexEffF = GetCorrFactZvPtEta(fCorrTrackEventMatrix,zv,pt,eta);\r
994     Double_t trigMBToInel = GetCorrFactZvPtEta(fCorrTriggerMBtoInelTrackEventMatrix,zv,pt,eta);  \r
995     Double_t trigMBToND = GetCorrFactZvPtEta(fCorrTriggerMBtoNDTrackEventMatrix,zv,pt,eta);\r
996     Double_t trigMBToNSD = GetCorrFactZvPtEta(fCorrTriggerMBtoNSDTrackEventMatrix,zv,pt,eta);\r
997     //printf("vertexEffF %f, trigMBToInel %f, trigMBToNSD %f \n", vertexEffF, trigMBToInel, trigMBToNSD);\r
998     \r
999     Double_t corrF[8] = { 1.0, \r
1000                           trackContF,\r
1001                           trackContF*trackEffF,\r
1002                           trackContF*trackEffF*multTrackContF,\r
1003                           trackContF*trackEffF*multTrackContF*vertexEffF,\r
1004                           trackContF*trackEffF*multTrackContF*vertexEffF*trigMBToInel,\r
1005                           trackContF*trackEffF*multTrackContF*vertexEffF*trigMBToND,\r
1006                           trackContF*trackEffF*multTrackContF*vertexEffF*trigMBToNSD\r
1007                          }; \r
1008  \r
1009     // Fill histograms\r
1010     Double_t valCorrRecTrackMultHist1[3] = {pt,eta,mult};         \r
1011     Double_t valPtvsPt[2] = {pt,pt};      \r
1012     for(Int_t i=0; i<8; i++) {\r
1013       fCorrRecTrackMultHist1[i]->Fill(valCorrRecTrackMultHist1,corrF[i]);\r
1014       fPtvsPt[i]->Fill(valPtvsPt,corrF[i]);\r
1015     }\r
1016   }\r
1017 }\r
1018 \r
1019 //_____________________________________________________________________________\r
1020 void AlidNdPtCorrection::FillHistograms(AliStack * const stack, Int_t /*label*/, AlidNdPtHelper::TrackObject /*trackObj*/, Int_t /*mult*/) const\r
1021 {\r
1022   // Fill MC histograms\r
1023   if(!stack) return;\r
1024 \r
1025   /*\r
1026   TParticle* particle = stack->Particle(label);\r
1027   if(!particle) return;\r
1028 \r
1029   Int_t mother_pdg = -1;\r
1030   TParticle* mother = 0;\r
1031 \r
1032   //TParticle* prim_mother = AlidNdPtHelper::FindPrimaryMother(stack,label);\r
1033   Int_t motherLabel = particle->GetMother(0); \r
1034   if(motherLabel>0) mother = stack->Particle(motherLabel);\r
1035   if(mother) mother_pdg = TMath::Abs(mother->GetPdgCode()); // take abs for visualisation only\r
1036   Int_t mech = particle->GetUniqueID(); // production mechanism\r
1037 \r
1038   Double_t gq = particle->GetPDG()->Charge()/3.0; // Charge units |e|/3 \r
1039   Float_t gpt = particle->Pt();\r
1040   Float_t qgpt = particle->Pt() * gq;\r
1041   Float_t geta = particle->Eta();\r
1042   Float_t gphi = particle->Phi();\r
1043   Float_t gpz = particle->Pz();\r
1044 \r
1045   Bool_t prim = stack->IsPhysicalPrimary(label);\r
1046   Float_t vx = particle->Vx(); Float_t vy = particle->Vy(); Float_t vz = particle->Vz();\r
1047 \r
1048   Int_t pid=-1;\r
1049   if (TMath::Abs(particle->GetPdgCode()) == kElectron)         { pid = 0; }\r
1050     else if (TMath::Abs(particle->GetPdgCode()) == kMuonMinus) { pid = 1; }\r
1051     else if (TMath::Abs(particle->GetPdgCode()) == kPiPlus)    { pid = 2; }\r
1052     else if (TMath::Abs(particle->GetPdgCode()) == kKPlus)     { pid = 3; }\r
1053     else if (TMath::Abs(particle->GetPdgCode()) == kProton)    { pid = 4; }\r
1054     else                                                       { pid = 5; }\r
1055     */\r
1056 \r
1057   //if(!prim) printf("prim_mother %d, mother %d, particle %d, production mech %d\n",prim_mother->GetPdgCode(),mother->GetPdgCode(), particle->GetPdgCode(),mech);\r
1058   \r
1059 }\r
1060 \r
1061 //_____________________________________________________________________________\r
1062 Double_t AlidNdPtCorrection::GetCorrFactZvPtEta(THnSparse * const hist, Double_t zv, Double_t pt, Double_t eta) const {\r
1063 // return correction factor F(zv,pt,eta)\r
1064 \r
1065  if(!hist) return 1.;\r
1066 \r
1067  //\r
1068  TAxis *ax = hist->GetAxis(0);\r
1069  TAxis *ay = hist->GetAxis(1);\r
1070  TAxis *az = hist->GetAxis(2);\r
1071 \r
1072  Int_t binx = ax->FindBin(zv);\r
1073  Int_t biny = ay->FindBin(pt);\r
1074  Int_t binz = az->FindBin(eta);\r
1075  Int_t dim[3] = {binx,biny,binz};\r
1076 \r
1077  Double_t fact  = hist->GetBinContent(dim);  \r
1078 \r
1079 return fact;\r
1080 }\r
1081 \r
1082 //_____________________________________________________________________________\r
1083 Double_t AlidNdPtCorrection::GetContFactZvPtEta(THnSparse * const hist, Double_t zv, Double_t pt, Double_t eta) const {\r
1084 // return contamination correction factor F(zv,pt,eta)\r
1085 \r
1086  if(!hist) return 1.0;\r
1087 \r
1088  //\r
1089  TAxis *ax = hist->GetAxis(0);\r
1090  TAxis *ay = hist->GetAxis(1);\r
1091  TAxis *az = hist->GetAxis(2);\r
1092 \r
1093  Int_t binx = ax->FindBin(zv);\r
1094  Int_t biny = ay->FindBin(pt);\r
1095  Int_t binz = az->FindBin(eta);\r
1096  Int_t dim[3] = {binx,biny,binz};\r
1097 \r
1098  Double_t fact  = 1.0-hist->GetBinContent(dim);  \r
1099  //Double_t fact  = hist->GetBinContent(dim);  \r
1100 \r
1101 return fact;\r
1102 }\r
1103 \r
1104 //_____________________________________________________________________________\r
1105 Double_t AlidNdPtCorrection::GetCorrFactZvMult(THnSparse * const hist, Double_t zv, Int_t mult) const {\r
1106 // return correction factor F(zv,mult)\r
1107 \r
1108  if(!hist) return 1.;\r
1109 \r
1110  TAxis *ax = hist->GetAxis(0);\r
1111  TAxis *ay = hist->GetAxis(1);\r
1112  Int_t binx = ax->FindBin(zv);\r
1113  Int_t biny = ay->FindBin(mult);\r
1114  Int_t dim[2] = {binx,biny};\r
1115 \r
1116  Double_t fact  = hist->GetBinContent(dim);  \r
1117 \r
1118 \r
1119 return fact;\r
1120 }\r
1121 \r
1122 //_____________________________________________________________________________\r
1123 Double_t AlidNdPtCorrection::GetContFactZvMult(THnSparse * const hist, Double_t zv, Int_t mult) const {\r
1124 // return contamination correction factor F(zv,mult)\r
1125 \r
1126  if(!hist) return 1.;\r
1127 \r
1128  TAxis *ax = hist->GetAxis(0);\r
1129  TAxis *ay = hist->GetAxis(1);\r
1130  Int_t binx = ax->FindBin(zv);\r
1131  Int_t biny = ay->FindBin(mult);\r
1132  Int_t dim[2] = {binx,biny};\r
1133  Double_t fact  = 1.0-hist->GetBinContent(dim);  \r
1134 \r
1135 return fact;\r
1136 }\r
1137 \r
1138 //_____________________________________________________________________________\r
1139 Long64_t AlidNdPtCorrection::Merge(TCollection* const list) \r
1140 {\r
1141   // Merge list of objects (needed by PROOF)\r
1142 \r
1143   if (!list)\r
1144   return 0;\r
1145 \r
1146   if (list->IsEmpty())\r
1147   return 1;\r
1148 \r
1149   TIterator* iter = list->MakeIterator();\r
1150   TObject* obj = 0;\r
1151 \r
1152   // collection of generated histograms\r
1153 \r
1154   Int_t count=0;\r
1155   while((obj = iter->Next()) != 0) {\r
1156     AlidNdPtCorrection* entry = dynamic_cast<AlidNdPtCorrection*>(obj);\r
1157     if (entry == 0) continue; \r
1158   \r
1159     fMCEventHist1->Add(entry->fMCEventHist1);\r
1160     fRecEventHist1->Add(entry->fRecEventHist1);\r
1161 \r
1162     fMCAllEventMultHist1->Add(entry->fMCAllEventMultHist1);\r
1163     fMCAllNDEventMultHist1->Add(entry->fMCAllNDEventMultHist1);\r
1164     fMCAllNSDEventMultHist1->Add(entry->fMCAllNSDEventMultHist1);\r
1165     fMCTriggerMultHist1->Add(entry->fMCTriggerMultHist1);\r
1166     fMCEventMultHist1->Add(entry->fMCEventMultHist1);\r
1167 \r
1168     fMCAllPrimTrackMultHist1->Add(entry->fMCAllPrimTrackMultHist1);\r
1169     fMCNDEventAllPrimTrackMultHist1->Add(entry->fMCNDEventAllPrimTrackMultHist1);\r
1170     fMCNSDEventAllPrimTrackMultHist1->Add(entry->fMCNSDEventAllPrimTrackMultHist1);\r
1171     fMCTriggerPrimTrackMultHist1->Add(entry->fMCTriggerPrimTrackMultHist1);\r
1172     fMCEventPrimTrackMultHist1->Add(entry->fMCEventPrimTrackMultHist1);\r
1173     fCosmicsHisto->Add(entry->fCosmicsHisto);\r
1174 \r
1175     for(Int_t i=0; i<AlidNdPtHelper::kCutSteps; i++) {\r
1176       fRecTrackHist1[i]->Add(entry->fRecTrackHist1[i]);\r
1177     }\r
1178 \r
1179     for(Int_t i=0; i<8; i++) {\r
1180       fCorrRecTrackMultHist1[i]->Add(entry->fCorrRecTrackMultHist1[i]);\r
1181       fPtvsPt[i]->Add(entry->fPtvsPt[i]);\r
1182     }\r
1183 \r
1184     for(Int_t i=0; i<5; i++) {\r
1185       fCorrRecEventHist1[i]->Add(entry->fCorrRecEventHist1[i]);\r
1186       fCorrRecEventHist2[i]->Add(entry->fCorrRecEventHist2[i]);\r
1187     }\r
1188 \r
1189   count++;\r
1190   }\r
1191 \r
1192 return count;\r
1193 }\r
1194  \r
1195 //____________________________________________________________________________\r
1196 Int_t AlidNdPtCorrection::GetTrueMult(THnSparse * const hist, Int_t mult) const\r
1197 {\r
1198 //\r
1199 // get multiplicity of primary particles\r
1200 //\r
1201  if(!hist) return 0;\r
1202  Int_t trueMult = 0;\r
1203 \r
1204  // 0 bins exluded\r
1205  TAxis *ax = hist->GetAxis(0);\r
1206  TAxis *ay = hist->GetAxis(1);\r
1207  ax->SetRange(1,ax->GetNbins());\r
1208  ay->SetRange(1,ay->GetNbins());\r
1209 \r
1210  // measured mult\r
1211  ax->SetRangeUser((Float_t)mult,(Float_t)mult); \r
1212 \r
1213  // get true multiplicity\r
1214  TH1D *h1 = (TH1D *)hist->Projection(1);\r
1215  trueMult = (Int_t)h1->GetMean();\r
1216 \r
1217  return trueMult;\r
1218 }\r
1219 \r
1220 //_____________________________________________________________________________\r
1221 void AlidNdPtCorrection::Analyse() \r
1222 {\r
1223   // Analyse histograms\r
1224   //\r
1225   TH1::AddDirectory(kFALSE);\r
1226   TH1 *h = 0, *hs=0, *hsc=0; \r
1227   TH2 *h2D = 0; \r
1228 \r
1229   TObjArray *aFolderObj = new TObjArray;\r
1230 \r
1231   //\r
1232   // get cuts\r
1233   //\r
1234   AlidNdPtEventCuts *evtCuts = GetEventCuts(); \r
1235   AlidNdPtAcceptanceCuts *accCuts = GetAcceptanceCuts(); \r
1236   AliESDtrackCuts *esdTrackCuts = GetTrackCuts(); \r
1237 \r
1238   if(!evtCuts || !accCuts || !esdTrackCuts) {\r
1239     Error("AlidNdPtCutAnalysis::Analyse()", "cuts not available");\r
1240     return;\r
1241   }\r
1242 \r
1243   //\r
1244   // set min and max values\r
1245   //\r
1246   //Double_t minPt = accCuts->GetMinPt();\r
1247   //Double_t maxPt = accCuts->GetMaxPt();\r
1248   Double_t minEta = accCuts->GetMinEta();\r
1249   Double_t maxEta = accCuts->GetMaxEta()-0.00001;\r
1250  \r
1251   printf("minEta %f, maxEta %f \n",minEta, maxEta);\r
1252 \r
1253   //\r
1254   // cosmics background histo\r
1255   //\r
1256   h2D = fCosmicsHisto->Projection(0,1);\r
1257   h2D->SetName("deta_vs_dphi_cosmics");\r
1258   aFolderObj->Add(h2D);\r
1259 \r
1260   //\r
1261   // pt profile\r
1262   //\r
1263   char name[256];\r
1264   for(Int_t i=0; i<8; i++) {\r
1265     h2D = fPtvsPt[i]->Projection(1,0);\r
1266     sprintf(name,"PtvsMeanPt_%d",i);\r
1267     h2D->SetName(name);\r
1268     aFolderObj->Add(h2D);\r
1269   }\r
1270 \r
1271   //\r
1272   // event level \r
1273   //\r
1274   h = fCorrRecEventHist1[0]->Projection(1);\r
1275   h->SetName("mult_event_not_corrected");\r
1276   aFolderObj->Add(h);\r
1277 \r
1278   h = fCorrRecEventHist1[1]->Projection(1);\r
1279   h->SetName("mult_event_vertex_corrected");\r
1280   aFolderObj->Add(h);\r
1281 \r
1282   h = fCorrRecEventHist1[2]->Projection(1);\r
1283   h->SetName("mult_trigger_vertex_corrected");\r
1284   aFolderObj->Add(h);\r
1285 \r
1286   h = fCorrRecEventHist1[3]->Projection(1);\r
1287   h->SetName("mult_ND_trigger_vertex_corrected");\r
1288   aFolderObj->Add(h);\r
1289 \r
1290   h = fCorrRecEventHist1[4]->Projection(1);\r
1291   h->SetName("mult_NSD_trigger_vertex_corrected");\r
1292   aFolderObj->Add(h);\r
1293 \r
1294   // empty events\r
1295   h = fCorrRecEventHist2[0]->Projection(1);\r
1296   h->SetName("mult_empty_event_not_corrected");\r
1297   aFolderObj->Add(h);\r
1298 \r
1299   h = fCorrRecEventHist2[1]->Projection(1);\r
1300   h->SetName("mult_empty_event_vertex_corrected");\r
1301   aFolderObj->Add(h);\r
1302 \r
1303   h = fCorrRecEventHist2[2]->Projection(1);\r
1304   h->SetName("mult_empty_trigger_vertex_corrected");\r
1305   aFolderObj->Add(h);\r
1306 \r
1307   h = fCorrRecEventHist2[3]->Projection(1);\r
1308   h->SetName("mult_empty_ND_trigger_vertex_corrected");\r
1309   aFolderObj->Add(h);\r
1310 \r
1311   h = fCorrRecEventHist2[4]->Projection(1);\r
1312   h->SetName("mult_empty_NSD_trigger_vertex_corrected");\r
1313   aFolderObj->Add(h);\r
1314  \r
1315   //\r
1316   // MC available\r
1317   //\r
1318   if(IsUseMCInfo()) {\r
1319 \r
1320   // mc \r
1321   h = fMCAllEventMultHist1->Projection(1);\r
1322   h->SetName("mc_mult_event_acc_prim");\r
1323   aFolderObj->Add(h);\r
1324 \r
1325   h = fMCAllNDEventMultHist1->Projection(1);\r
1326   h->SetName("mc_mult_ND_event_acc_prim");\r
1327   aFolderObj->Add(h);\r
1328 \r
1329   h = fMCAllNSDEventMultHist1->Projection(1);\r
1330   h->SetName("mc_mult_NSD_event_acc_prim");\r
1331   aFolderObj->Add(h);\r
1332 \r
1333   h = fMCTriggerMultHist1->Projection(1);\r
1334   h->SetName("mc_mult_trigger_acc_prim");\r
1335   aFolderObj->Add(h);\r
1336 \r
1337   h = fMCEventMultHist1->Projection(1);\r
1338   h->SetName("mc_mult_trigger_event_acc_prim");\r
1339   aFolderObj->Add(h);\r
1340 \r
1341 \r
1342   //\r
1343   // track level\r
1344   //\r
1345   \r
1346   // limit eta range\r
1347   for(Int_t i=0;i<8;i++) { \r
1348       //fCorrRecTrackMultHist1[i]->GetAxis(0)->SetRangeUser(minPt,maxPt);\r
1349       //fCorrRecTrackMultHist1[i]->GetAxis(1)->SetRangeUser(minEta,maxEta);\r
1350   }\r
1351   //fMCAllPrimTrackMultHist1->GetAxis(0)->SetRangeUser(minPt,maxPt);\r
1352   //fMCAllPrimTrackMultHist1->GetAxis(1)->SetRangeUser(minEta,maxEta);\r
1353 \r
1354   //fMCNDEventAllPrimTrackMultHist1->GetAxis(0)->SetRangeUser(minPt,maxPt);\r
1355   //fMCNDEventAllPrimTrackMultHist1->GetAxis(1)->SetRangeUser(minEta,maxEta);\r
1356 \r
1357   //fMCNSDEventAllPrimTrackMultHist1->GetAxis(0)->SetRangeUser(minPt,maxPt);\r
1358   //fMCNSDEventAllPrimTrackMultHist1->GetAxis(1)->SetRangeUser(minEta,maxEta);\r
1359 \r
1360   //fMCTriggerPrimTrackMultHist1->GetAxis(0)->SetRangeUser(minPt,maxPt);\r
1361   //fMCTriggerPrimTrackMultHist1->GetAxis(1)->SetRangeUser(minEta,maxEta);\r
1362 \r
1363   //fMCEventPrimTrackMultHist1->GetAxis(0)->SetRangeUser(minPt,maxPt);\r
1364   //fMCEventPrimTrackMultHist1->GetAxis(1)->SetRangeUser(minEta,maxEta);\r
1365 \r
1366   } // end use MC info \r
1367   \r
1368   //\r
1369   h2D = fCorrRecTrackMultHist1[3]->Projection(1,0);\r
1370   h2D->SetName("pt_eta_rec_track_mult_eff_cont_corrected");\r
1371   aFolderObj->Add(h2D);\r
1372 \r
1373   h2D = fCorrRecTrackMultHist1[4]->Projection(1,0);\r
1374   h2D->SetName("pt_eta_rec_event_track_mult_eff_cont_corrected");\r
1375   aFolderObj->Add(h2D);\r
1376 \r
1377   h2D = fCorrRecTrackMultHist1[5]->Projection(1,0);\r
1378   h2D->SetName("pt_eta_rec_trig_event_track_mult_eff_cont_corrected");\r
1379   aFolderObj->Add(h2D);\r
1380 \r
1381   h2D = fCorrRecTrackMultHist1[6]->Projection(1,0);\r
1382   h2D->SetName("pt_eta_rec_ND_trig_event_track_mult_eff_cont_corrected");\r
1383   aFolderObj->Add(h2D);\r
1384 \r
1385   h2D = fCorrRecTrackMultHist1[7]->Projection(1,0);\r
1386   h2D->SetName("pt_eta_rec_NSD_trig_event_track_mult_eff_cont_corrected");\r
1387   aFolderObj->Add(h2D);\r
1388 \r
1389 \r
1390   //\r
1391   h2D = fCorrRecTrackMultHist1[3]->Projection(2,0);\r
1392   h2D->SetName("pt_mult_rec_track_mult_eff_cont_corrected");\r
1393   aFolderObj->Add(h2D);\r
1394 \r
1395   h2D = fCorrRecTrackMultHist1[4]->Projection(2,0);\r
1396   h2D->SetName("pt_mult_rec_event_track_mult_eff_cont_corrected");\r
1397   aFolderObj->Add(h2D);\r
1398 \r
1399   h2D = fCorrRecTrackMultHist1[5]->Projection(2,0);\r
1400   h2D->SetName("pt_mult_rec_trig_event_track_mult_eff_cont_corrected");\r
1401   aFolderObj->Add(h2D);\r
1402 \r
1403   h2D = fCorrRecTrackMultHist1[6]->Projection(2,0);\r
1404   h2D->SetName("pt_mult_rec_ND_trig_event_track_mult_eff_cont_corrected");\r
1405   aFolderObj->Add(h2D);\r
1406 \r
1407   h2D = fCorrRecTrackMultHist1[7]->Projection(2,0);\r
1408   h2D->SetName("pt_mult_rec_NSD_trig_event_track_mult_eff_cont_corrected");\r
1409   aFolderObj->Add(h2D);\r
1410 \r
1411   // pt axis\r
1412 \r
1413   h = fCorrRecTrackMultHist1[0]->Projection(0);\r
1414   h->SetName("pt_rec_track_not_corrected");\r
1415   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1416   hs->SetName("pt_rec_track_not_corrected_s");\r
1417   aFolderObj->Add(hs);\r
1418 \r
1419   //\r
1420   h = fCorrRecTrackMultHist1[1]->Projection(0);\r
1421   h->SetName("pt_rec_track_cont_corrected");\r
1422   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1423   hs->SetName("pt_rec_track_cont_corrected_s");\r
1424   aFolderObj->Add(hs);\r
1425 \r
1426   hsc = (TH1D*)hs->Clone("pt_rec_track_cont_corr_fact");\r
1427   hsc->Divide((TH1D*)aFolderObj->FindObject("pt_rec_track_not_corrected_s"));\r
1428   aFolderObj->Add(hsc);\r
1429 \r
1430   //\r
1431   h = fCorrRecTrackMultHist1[2]->Projection(0);\r
1432   h->SetName("pt_rec_track_eff_cont_corrected");\r
1433   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1434   hs->SetName("pt_rec_track_eff_cont_corrected_s");\r
1435   aFolderObj->Add(hs);\r
1436 \r
1437   hsc = (TH1D*)hs->Clone("pt_rec_track_eff_corr_fact");\r
1438   hsc->Divide((TH1D*)aFolderObj->FindObject("pt_rec_track_cont_corrected_s"));\r
1439   aFolderObj->Add(hsc);\r
1440 \r
1441   //\r
1442   h = fCorrRecTrackMultHist1[3]->Projection(0);\r
1443   h->SetName("pt_rec_track_mult_eff_cont_corrected");\r
1444   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1445   hs->SetName("pt_rec_track_mult_eff_cont_corrected_s");\r
1446   aFolderObj->Add(hs);\r
1447 \r
1448   hsc = (TH1D*)hs->Clone("pt_rec_track_mult_corr_fact");\r
1449   hsc->Divide((TH1D*)aFolderObj->FindObject("pt_rec_track_eff_cont_corrected_s"));\r
1450   aFolderObj->Add(hsc);\r
1451 \r
1452   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1453   hsc = (TH1D*)hs->Clone("pt_rec_track_mult_eff_cont_corr_fact");\r
1454   hsc->Divide((TH1D*)aFolderObj->FindObject("pt_rec_track_not_corrected_s"));\r
1455   aFolderObj->Add(hsc);\r
1456 \r
1457   hsc = (TH1D*)hs->Clone();\r
1458   hsc->SetName("pt_rec_track_mult_eff_cont_corrected_s_norm");\r
1459   hsc->Scale(1./(fCorrRecEventHist1[0]->Projection(1)->Integral()));\r
1460   aFolderObj->Add(hsc);\r
1461 \r
1462   //\r
1463   h = fCorrRecTrackMultHist1[4]->Projection(0);\r
1464   h->SetName("pt_rec_event_track_mult_eff_cont_corrected");\r
1465   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1466   hs->SetName("pt_rec_event_track_mult_eff_cont_corrected_s");\r
1467   aFolderObj->Add(hs);\r
1468 \r
1469   hsc = (TH1D*)hs->Clone();\r
1470   hsc->SetName("pt_rec_event_track_mult_eff_cont_corrected_s_norm");\r
1471   hsc->Scale(1./(fCorrRecEventHist1[1]->Projection(1)->Integral()+fCorrRecEventHist2[1]->Projection(1)->Integral()));\r
1472   aFolderObj->Add(hsc);\r
1473 \r
1474   //\r
1475   h = fCorrRecTrackMultHist1[5]->Projection(0);\r
1476   h->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected");\r
1477   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1478   hs->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected_s");\r
1479   aFolderObj->Add(hs);\r
1480 \r
1481   hsc = (TH1D*)hs->Clone();\r
1482   hsc->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected_s_norm");\r
1483   hsc->Scale(1./(fCorrRecEventHist1[2]->Projection(1)->Integral() + fCorrRecEventHist2[2]->Projection(1)->Integral()));\r
1484   aFolderObj->Add(hsc);\r
1485 \r
1486    // positive eta\r
1487   fCorrRecTrackMultHist1[5]->GetAxis(1)->SetRangeUser(0., maxEta);\r
1488 \r
1489   h = fCorrRecTrackMultHist1[5]->Projection(0);\r
1490   h->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected_posEta");\r
1491   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1492   hs->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected_s_posEta");\r
1493   aFolderObj->Add(hs);\r
1494 \r
1495   hsc = (TH1D*)hs->Clone();\r
1496   hsc->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected_s_norm_posEta");\r
1497   hsc->Scale(1./(fCorrRecEventHist1[2]->Projection(1)->Integral()+fCorrRecEventHist2[2]->Projection(1)->Integral()));\r
1498   aFolderObj->Add(hsc);\r
1499 \r
1500   // negative eta\r
1501   fCorrRecTrackMultHist1[5]->GetAxis(1)->SetRangeUser(minEta, -0.00001);\r
1502 \r
1503   h = fCorrRecTrackMultHist1[5]->Projection(0);\r
1504   h->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected_negEta");\r
1505   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1506   hs->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected_s_negEta");\r
1507   aFolderObj->Add(hs);\r
1508 \r
1509   hsc = (TH1D*)hs->Clone();\r
1510   hsc->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected_s_norm_negEta");\r
1511   hsc->Scale(1./(fCorrRecEventHist1[2]->Projection(1)->Integral()+fCorrRecEventHist2[2]->Projection(1)->Integral()));\r
1512   aFolderObj->Add(hsc);\r
1513 \r
1514   fCorrRecTrackMultHist1[5]->GetAxis(1)->SetRange(1, fCorrRecTrackMultHist1[5]->GetAxis(1)->GetNbins());\r
1515 \r
1516   //\r
1517   h = fCorrRecTrackMultHist1[6]->Projection(0);\r
1518   h->SetName("pt_rec_ND_trig_event_track_mult_eff_cont_corrected");\r
1519   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1520   hs->SetName("pt_rec_ND_trig_event_track_mult_eff_cont_corrected_s");\r
1521   aFolderObj->Add(hs);\r
1522 \r
1523   hsc = (TH1D*)hs->Clone();\r
1524   hsc->SetName("pt_rec_ND_trig_event_track_mult_eff_cont_corrected_s_norm");\r
1525   hsc->Scale(1./(fCorrRecEventHist1[3]->Projection(1)->Integral()+fCorrRecEventHist2[3]->Projection(1)->Integral()));\r
1526   aFolderObj->Add(hsc);\r
1527 \r
1528   //\r
1529   h = fCorrRecTrackMultHist1[7]->Projection(0);\r
1530   h->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected");\r
1531   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1532   hs->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_s");\r
1533   aFolderObj->Add(hs);\r
1534 \r
1535   hsc = (TH1D*)hs->Clone();\r
1536   hsc->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_s_norm");\r
1537   hsc->Scale(1./(fCorrRecEventHist1[4]->Projection(1)->Integral()+fCorrRecEventHist2[4]->Projection(1)->Integral()));\r
1538   aFolderObj->Add(hsc);\r
1539 \r
1540   //\r
1541   // positive eta\r
1542   //\r
1543   fCorrRecTrackMultHist1[7]->GetAxis(1)->SetRangeUser(0., maxEta);\r
1544 \r
1545   h = fCorrRecTrackMultHist1[7]->Projection(0);\r
1546   h->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_posEta");\r
1547   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1548   hs->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_s_posEta");\r
1549   aFolderObj->Add(hs);\r
1550 \r
1551   hsc = (TH1D*)hs->Clone();\r
1552   hsc->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_s_norm_posEta");\r
1553   hsc->Scale(1./(fCorrRecEventHist1[4]->Projection(1)->Integral()+fCorrRecEventHist2[4]->Projection(1)->Integral()));\r
1554   aFolderObj->Add(hsc);\r
1555 \r
1556   //\r
1557   // negative eta\r
1558   //\r
1559   fCorrRecTrackMultHist1[7]->GetAxis(1)->SetRangeUser(minEta, -0.00001);\r
1560 \r
1561   h = fCorrRecTrackMultHist1[7]->Projection(0);\r
1562   h->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_negEta");\r
1563   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1564   hs->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_s_negEta");\r
1565   aFolderObj->Add(hs);\r
1566 \r
1567   hsc = (TH1D*)hs->Clone();\r
1568   hsc->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_s_norm_negEta");\r
1569   hsc->Scale(1./(fCorrRecEventHist1[4]->Projection(1)->Integral()+fCorrRecEventHist2[4]->Projection(1)->Integral()));\r
1570   aFolderObj->Add(hsc);\r
1571 \r
1572   fCorrRecTrackMultHist1[7]->GetAxis(1)->SetRange(1, fCorrRecTrackMultHist1[7]->GetAxis(1)->GetNbins());\r
1573 \r
1574   // eta axis\r
1575   h = fCorrRecTrackMultHist1[0]->Projection(1);\r
1576   h->SetName("eta_rec_track_not_corrected");\r
1577   aFolderObj->Add(h);\r
1578   \r
1579   h = fCorrRecTrackMultHist1[1]->Projection(1);\r
1580   h->SetName("eta_rec_track_cont_corrected");\r
1581   aFolderObj->Add(h);\r
1582 \r
1583   h = fCorrRecTrackMultHist1[2]->Projection(1);\r
1584   h->SetName("eta_rec_track_eff_cont_corrected");\r
1585   aFolderObj->Add(h);\r
1586 \r
1587   h = fCorrRecTrackMultHist1[3]->Projection(1);\r
1588   h->SetName("eta_rec_track_mult_eff_cont_corrected");\r
1589   aFolderObj->Add(h);\r
1590 \r
1591   h = fCorrRecTrackMultHist1[4]->Projection(1);\r
1592   h->SetName("eta_rec_event_track_mult_eff_cont_corrected");\r
1593   aFolderObj->Add(h);\r
1594 \r
1595   h = fCorrRecTrackMultHist1[5]->Projection(1);\r
1596   h->SetName("eta_rec_trig_event_track_mult_eff_cont_corrected");\r
1597   aFolderObj->Add(h);\r
1598 \r
1599   h = fCorrRecTrackMultHist1[6]->Projection(1);\r
1600   h->SetName("eta_rec_ND_trig_event_track_mult_eff_cont_corrected");\r
1601   aFolderObj->Add(h);\r
1602 \r
1603   h = fCorrRecTrackMultHist1[7]->Projection(1);\r
1604   h->SetName("eta_rec_NSD_trig_event_track_mult_eff_cont_corrected");\r
1605   aFolderObj->Add(h);\r
1606 \r
1607 \r
1608   //\r
1609   // MC available\r
1610   //\r
1611   if(IsUseMCInfo()) {\r
1612 \r
1613   //\r
1614   h2D = fMCAllPrimTrackMultHist1->Projection(2,0);\r
1615   h2D->SetName("mc_all_pt_mult_acc_prim");\r
1616   aFolderObj->Add(h2D);\r
1617 \r
1618   h2D = fMCAllPrimTrackMultHist1->Projection(1,0);\r
1619   h2D->SetName("mc_all_eta_pt_acc_prim");\r
1620   aFolderObj->Add(h2D);\r
1621 \r
1622   h2D = fMCNDEventAllPrimTrackMultHist1->Projection(2,0);\r
1623   h2D->SetName("mc_ND_all_pt_mult_acc_prim");\r
1624   aFolderObj->Add(h2D);\r
1625 \r
1626   h2D = fMCNDEventAllPrimTrackMultHist1->Projection(1,0);\r
1627   h2D->SetName("mc_ND_all_eta_pt_acc_prim");\r
1628   aFolderObj->Add(h2D);\r
1629 \r
1630   h2D = fMCNSDEventAllPrimTrackMultHist1->Projection(2,0);\r
1631   h2D->SetName("mc_NSD_all_pt_mult_acc_prim");\r
1632   aFolderObj->Add(h2D);\r
1633 \r
1634   h2D = fMCNSDEventAllPrimTrackMultHist1->Projection(1,0);\r
1635   h2D->SetName("mc_NSD_all_eta_pt_acc_prim");\r
1636   aFolderObj->Add(h2D);\r
1637 \r
1638   //\r
1639 \r
1640   h = fMCAllPrimTrackMultHist1->Projection(0);\r
1641   h->SetName("mc_all_pt_acc_prim");\r
1642   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1643   hs->SetName("mc_all_pt_acc_prim_s");\r
1644   aFolderObj->Add(hs);\r
1645 \r
1646   hsc = (TH1D*)hs->Clone();\r
1647   hsc->SetName("mc_all_pt_acc_prim_s_norm");\r
1648   hsc->Scale(1./fMCAllEventMultHist1->Projection(1)->Integral());\r
1649   aFolderObj->Add(hsc);\r
1650 \r
1651   h = fMCNDEventAllPrimTrackMultHist1->Projection(0);\r
1652   h->SetName("mc_ND_all_pt_acc_prim");\r
1653   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1654   hs->SetName("mc_ND_all_pt_acc_prim_s");\r
1655   aFolderObj->Add(hs);\r
1656 \r
1657   hsc = (TH1D*)hs->Clone();\r
1658   hsc->SetName("mc_ND_all_pt_acc_prim_s_norm");\r
1659   hsc->Scale(1./fMCAllNDEventMultHist1->Projection(1)->Integral());\r
1660   aFolderObj->Add(hsc);\r
1661 \r
1662   h = fMCNSDEventAllPrimTrackMultHist1->Projection(0);\r
1663   h->SetName("mc_NSD_all_pt_acc_prim");\r
1664   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1665   hs->SetName("mc_NSD_all_pt_acc_prim_s");\r
1666   aFolderObj->Add(hs);\r
1667 \r
1668   hsc = (TH1D*)hs->Clone();\r
1669   hsc->SetName("mc_NSD_all_pt_acc_prim_s_norm");\r
1670   hsc->Scale(1./fMCAllNSDEventMultHist1->Projection(1)->Integral());\r
1671   aFolderObj->Add(hsc);\r
1672 \r
1673   h = fMCTriggerPrimTrackMultHist1->Projection(0);\r
1674   h->SetName("mc_trigger_all_pt_acc_prim");\r
1675   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1676   hs->SetName("mc_trigger_all_pt_acc_prim_s");\r
1677   aFolderObj->Add(hs);\r
1678 \r
1679   hsc = (TH1D*)hs->Clone();\r
1680   hsc->SetName("mc_trigger_all_pt_acc_prim_s_norm");\r
1681   hsc->Scale(1./fMCTriggerMultHist1->Projection(1)->Integral());\r
1682   aFolderObj->Add(hsc);\r
1683 \r
1684   h = fMCEventPrimTrackMultHist1->Projection(0);\r
1685   h->SetName("mc_all_pt_acc_trig_event_prim");\r
1686   hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1687   hs->SetName("mc_all_pt_acc_trig_event_prim_s");\r
1688   aFolderObj->Add(hs);\r
1689 \r
1690   hsc = (TH1D*)hs->Clone();\r
1691   hsc->SetName("mc_all_pt_acc_trig_event_prim_s_norm");\r
1692   hsc->Scale(1./fMCEventMultHist1->Projection(1)->Integral());\r
1693   aFolderObj->Add(hsc);\r
1694 \r
1695   //\r
1696 \r
1697   h = fMCAllPrimTrackMultHist1->Projection(1);\r
1698   h->SetName("mc_all_eta_acc_prim");\r
1699   aFolderObj->Add(h);\r
1700 \r
1701   h = fMCNDEventAllPrimTrackMultHist1->Projection(1);\r
1702   h->SetName("mc_ND_all_eta_acc_prim");\r
1703   aFolderObj->Add(h);\r
1704 \r
1705   h = fMCNSDEventAllPrimTrackMultHist1->Projection(1);\r
1706   h->SetName("mc_NSD_all_eta_acc_prim");\r
1707   aFolderObj->Add(h);\r
1708 \r
1709   h = fMCTriggerPrimTrackMultHist1->Projection(1);\r
1710   h->SetName("mc_trigger_all_eta_acc_prim");\r
1711   aFolderObj->Add(h);\r
1712 \r
1713   h = fMCEventPrimTrackMultHist1->Projection(1);\r
1714   h->SetName("mc_all_eta_acc_trig_event_prim");\r
1715   aFolderObj->Add(h);\r
1716 \r
1717   //\r
1718   // calculate ratios (rec / mc)\r
1719   //\r
1720   \r
1721   hs = (TH1*)aFolderObj->FindObject("pt_rec_trig_event_track_mult_eff_cont_corrected_s_norm");\r
1722   hsc = (TH1D*)hs->Clone("ratio_pt_rec_to_mc_trig_event_track_mult_eff_cont_corrected"); \r
1723   hsc->Sumw2();\r
1724   hsc->Divide((TH1*)aFolderObj->FindObject("mc_all_pt_acc_prim_s_norm"));\r
1725   aFolderObj->Add(hsc);\r
1726 \r
1727   hs = (TH1*)aFolderObj->FindObject("eta_rec_trig_event_track_mult_eff_cont_corrected");\r
1728   hsc = (TH1D*)hs->Clone("ratio_eta_rec_to_mc_trig_event_track_mult_eff_cont_corrected"); \r
1729   hsc->Sumw2();\r
1730   hsc->Divide((TH1*)aFolderObj->FindObject("mc_all_eta_acc_prim"));\r
1731   aFolderObj->Add(hsc);\r
1732 \r
1733   //\r
1734   hs = (TH1*)aFolderObj->FindObject("pt_rec_ND_trig_event_track_mult_eff_cont_corrected_s_norm");\r
1735   hsc = (TH1D*)hs->Clone("ratio_pt_rec_to_mc_ND_trig_event_track_mult_eff_cont_corrected"); \r
1736   hsc->Sumw2();\r
1737   hsc->Divide((TH1*)aFolderObj->FindObject("mc_ND_all_pt_acc_prim_s_norm"));\r
1738   aFolderObj->Add(hsc);\r
1739 \r
1740   hs = (TH1*)aFolderObj->FindObject("eta_rec_ND_trig_event_track_mult_eff_cont_corrected");\r
1741   hsc = (TH1D*)hs->Clone("ratio_eta_rec_to_mc_ND_trig_event_track_mult_eff_cont_corrected"); \r
1742   hsc->Sumw2();\r
1743   hsc->Divide((TH1*)aFolderObj->FindObject("mc_ND_all_eta_acc_prim"));\r
1744   aFolderObj->Add(hsc);\r
1745 \r
1746   //\r
1747   hs = (TH1*)aFolderObj->FindObject("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_s_norm");\r
1748   hsc = (TH1D*)hs->Clone("ratio_pt_rec_to_mc_NSD_trig_event_track_mult_eff_cont_corrected"); \r
1749   hsc->Sumw2();\r
1750   hsc->Divide((TH1*)aFolderObj->FindObject("mc_NSD_all_pt_acc_prim_s_norm"));\r
1751   aFolderObj->Add(hsc);\r
1752 \r
1753   hs = (TH1*)aFolderObj->FindObject("eta_rec_NSD_trig_event_track_mult_eff_cont_corrected");\r
1754   hsc = (TH1D*)hs->Clone("ratio_eta_rec_to_mc_NSD_trig_event_track_mult_eff_cont_corrected"); \r
1755   hsc->Sumw2();\r
1756   hsc->Divide((TH1*)aFolderObj->FindObject("mc_NSD_all_eta_acc_prim"));\r
1757   aFolderObj->Add(hsc);\r
1758 \r
1759   //\r
1760   hs = (TH1*)aFolderObj->FindObject("pt_rec_event_track_mult_eff_cont_corrected_s_norm");\r
1761   hsc = (TH1D*)hs->Clone("ratio_pt_rec_to_mc_event_track_mult_eff_cont_corrected"); \r
1762   hsc->Sumw2();\r
1763   hsc->Divide((TH1*)aFolderObj->FindObject("mc_trigger_all_pt_acc_prim_s_norm"));\r
1764   aFolderObj->Add(hsc);\r
1765 \r
1766   hs = (TH1*)aFolderObj->FindObject("eta_rec_event_track_mult_eff_cont_corrected");\r
1767   hsc = (TH1D*)hs->Clone("ratio_eta_rec_to_mc_event_track_mult_eff_cont_corrected"); \r
1768   hsc->Sumw2();\r
1769   hsc->Divide((TH1*)aFolderObj->FindObject("mc_trigger_all_eta_acc_prim"));\r
1770   aFolderObj->Add(hsc);\r
1771 \r
1772   // track level\r
1773   hs = (TH1*)aFolderObj->FindObject("pt_rec_track_mult_eff_cont_corrected_s_norm");\r
1774   hsc = (TH1D*)hs->Clone("ratio_pt_rec_to_mc_track_mult_eff_cont_corrected"); \r
1775   hsc->Sumw2();\r
1776   hsc->Divide((TH1*)aFolderObj->FindObject("mc_all_pt_acc_trig_event_prim_s_norm"));\r
1777   aFolderObj->Add(hsc);\r
1778 \r
1779   hs = (TH1*)aFolderObj->FindObject("eta_rec_track_mult_eff_cont_corrected");\r
1780   hsc = (TH1D*)hs->Clone("ratio_eta_rec_to_mc_track_mult_eff_cont_corrected"); \r
1781   hsc->Sumw2();\r
1782   hsc->Divide((TH1*)aFolderObj->FindObject("mc_all_eta_acc_trig_event_prim"));\r
1783   aFolderObj->Add(hsc);\r
1784 \r
1785   } // end MC infor available\r
1786 \r
1787   // export objects to analysis folder\r
1788   fCorrectionFolder = ExportToFolder(aFolderObj);\r
1789 \r
1790   // delete only TObjArray\r
1791   if(aFolderObj) delete aFolderObj;\r
1792 }\r
1793 \r
1794 //_____________________________________________________________________________\r
1795 TFolder* AlidNdPtCorrection::ExportToFolder(TObjArray * const array) \r
1796 {\r
1797   // recreate folder avery time and export objects to new one\r
1798   //\r
1799   AlidNdPtCorrection * comp=this;\r
1800   TFolder *folder = comp->GetCorrectionFolder();\r
1801 \r
1802   TString name, title;\r
1803   TFolder *newFolder = 0;\r
1804   Int_t i = 0;\r
1805   Int_t size = array->GetSize();\r
1806 \r
1807   if(folder) { \r
1808      // get name and title from old folder\r
1809      name = folder->GetName();  \r
1810      title = folder->GetTitle();  \r
1811 \r
1812          // delete old one\r
1813      delete folder;\r
1814 \r
1815          // create new one\r
1816      newFolder = CreateFolder(name.Data(),title.Data());\r
1817      newFolder->SetOwner();\r
1818 \r
1819          // add objects to folder\r
1820      while(i < size) {\r
1821            newFolder->Add(array->At(i));\r
1822            i++;\r
1823          }\r
1824   }\r
1825 \r
1826 return newFolder;\r
1827 }\r
1828 \r
1829 //_____________________________________________________________________________\r
1830 TFolder* AlidNdPtCorrection::CreateFolder(TString name,TString title) { \r
1831 // create folder for analysed histograms\r
1832 //\r
1833 TFolder *folder = 0;\r
1834   folder = new TFolder(name.Data(),title.Data());\r
1835 \r
1836   return folder;\r
1837 }\r