New task for k-means clustering
[u/mrichter/AliRoot.git] / PWG0 / dNdPt / AlidNdPtCorrection.cxx
CommitLineData
0aaa8b91 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
00b81913 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
0aaa8b91 30\r
31#include "TFile.h"\r
0aaa8b91 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
d269b0e6 45#include "AliPhysicsSelection.h"\r
0aaa8b91 46\r
bad4ba69 47#include "AliPWG0Helper.h"\r
48#include "AlidNdPtHelper.h"\r
0aaa8b91 49#include "AlidNdPtCorrection.h"\r
50\r
51using namespace std;\r
52\r
53ClassImp(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
0aaa8b91 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
d269b0e6 85 fCorrMatrixFileName(""),\r
86 fCosmicsHisto(0)\r
0aaa8b91 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
106AlidNdPtCorrection::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
0aaa8b91 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
d269b0e6 134 fCorrMatrixFileName(corrMatrixFileName),\r
135 fCosmicsHisto(0)\r
0aaa8b91 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
bad4ba69 144 fPtvsPt[i] = 0;\r
0aaa8b91 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
156AlidNdPtCorrection::~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
d269b0e6 174 if(fCosmicsHisto) delete fCosmicsHisto; fCosmicsHisto=0;\r
0aaa8b91 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
bad4ba69 182 if(fPtvsPt[i]) delete fPtvsPt[i]; fPtvsPt[i]=0;\r
0aaa8b91 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
0aaa8b91 191}\r
192\r
193//_____________________________________________________________________________\r
194void 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
0aaa8b91 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
bad4ba69 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
0aaa8b91 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
bad4ba69 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
0aaa8b91 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
d269b0e6 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
0aaa8b91 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
537void 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
bad4ba69 547 // get selection cuts\r
0aaa8b91 548 AlidNdPtEventCuts *evtCuts = GetEventCuts(); \r
549 AlidNdPtAcceptanceCuts *accCuts = GetAcceptanceCuts(); \r
550 AliESDtrackCuts *esdTrackCuts = GetTrackCuts(); \r
551\r
bad4ba69 552 if(!evtCuts || !accCuts || !esdTrackCuts) {\r
0aaa8b91 553 AliDebug(AliLog::kError, "cuts not available");\r
554 return;\r
555 }\r
556\r
d269b0e6 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
bad4ba69 564 // trigger selection\r
565 Bool_t isEventTriggered = kTRUE;\r
566 if(evtCuts->IsTriggerRequired()) {\r
f537848a 567 if(IsUseMCInfo()) { \r
d269b0e6 568 //static AliTriggerAnalysis* triggerAnalysis = new AliTriggerAnalysis;\r
569 //isEventTriggered = triggerAnalysis->IsTriggerFired(esdEvent, GetTrigger());\r
570 trigSel->SetAnalyzeMC();\r
571 isEventTriggered = trigSel->IsCollisionCandidate(esdEvent);\r
f537848a 572 }\r
573 else {\r
d269b0e6 574 //isEventTriggered = esdEvent->IsTriggerClassFired(GetTriggerClass());\r
575 isEventTriggered = trigSel->IsCollisionCandidate(esdEvent);\r
f537848a 576 }\r
bad4ba69 577 }\r
0aaa8b91 578\r
bad4ba69 579 // use MC information\r
0aaa8b91 580 AliHeader* header = 0;\r
581 AliGenEventHeader* genHeader = 0;\r
582 AliStack* stack = 0;\r
583 TArrayF vtxMC(3);\r
bad4ba69 584 AliPWG0Helper::MCProcessType evtType = AliPWG0Helper::kInvalidProcess;\r
0aaa8b91 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
bad4ba69 608 evtType = AliPWG0Helper::GetEventProcessType(header);\r
0aaa8b91 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
bad4ba69 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
847e74b2 638 isRecVertex = AlidNdPtHelper::TestRecVertex(vtxESD, GetAnalysisMode(), kFALSE); \r
0aaa8b91 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
847e74b2 648 // get multiplicity vertex contributors\r
0aaa8b91 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
847e74b2 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
0aaa8b91 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\r
670 if(isEventOK && isEventTriggered)\r
671 {\r
672 // get all charged tracks\r
bad4ba69 673 allChargedTracks = AlidNdPtHelper::GetAllChargedTracks(esdEvent,GetAnalysisMode());\r
0aaa8b91 674 if(!allChargedTracks) return;\r
675\r
676 Int_t entries = allChargedTracks->GetEntries();\r
677 labelsRec = new Int_t[entries];\r
678\r
679 // calculate mult of reconstructed tracks\r
680 for(Int_t i=0; i<entries;++i) \r
681 {\r
682 AliESDtrack *track = (AliESDtrack*)allChargedTracks->At(i);\r
683 if(!track) continue;\r
847e74b2 684 if(track->Charge()==0) continue;\r
685\r
686 // only postive charged \r
687 if(GetParticleMode() == AlidNdPtHelper::kPlus && track->Charge() < 0) \r
688 continue;\r
689 \r
690 // only negative charged \r
691 if(GetParticleMode() == AlidNdPtHelper::kMinus && track->Charge() > 0) \r
692 continue;\r
693\r
d269b0e6 694 // cosmics analysis\r
695 Bool_t isCosmic = kFALSE;\r
696 if( GetParticleMode()==AlidNdPtHelper::kCosmics )\r
697 {\r
698 for(Int_t j=0; j<entries;++j) \r
699 {\r
700 AliESDtrack *track1 = (AliESDtrack*)allChargedTracks->At(j);\r
701 if(!track1) continue;\r
702 if(track1->Charge()==0) continue;\r
703\r
704 if( esdTrackCuts->AcceptTrack(track) && accCuts->AcceptTrack(track) && \r
705 esdTrackCuts->AcceptTrack(track1) && accCuts->AcceptTrack(track1) ) \r
706 { \r
707 isCosmic = AlidNdPtHelper::IsCosmicTrack(track, track1, i, accCuts, esdTrackCuts);\r
708 }\r
709 if(isCosmic) \r
710 {\r
711 Double_t vCosmicsHisto[3] = {track->Eta()+track1->Eta(), track->Phi()-track1->Phi(), track1->Pt()};\r
712 fCosmicsHisto->Fill(vCosmicsHisto);\r
713 }\r
714 }\r
715 \r
716 if(!isCosmic) continue;\r
717 }\r
718\r
847e74b2 719 if(esdTrackCuts->AcceptTrack(track) && accCuts->AcceptTrack(track)) \r
720 multRecTemp++;\r
0aaa8b91 721 } \r
722\r
847e74b2 723 //\r
0aaa8b91 724 for(Int_t i=0; i<entries;++i) \r
725 {\r
726 AliESDtrack *track = (AliESDtrack*)allChargedTracks->At(i);\r
727 if(!track) continue;\r
847e74b2 728 if(track->Charge()==0) continue;\r
729\r
730 // only postive charged \r
731 if(GetParticleMode() == AlidNdPtHelper::kPlus && track->Charge() < 0) \r
732 continue;\r
733 \r
734 // only negative charged \r
735 if(GetParticleMode() == AlidNdPtHelper::kMinus && track->Charge() > 0) \r
736 continue;\r
0aaa8b91 737 \r
847e74b2 738 // track-level corrections\r
739 if(esdTrackCuts->AcceptTrack(track)) \r
0aaa8b91 740 {\r
847e74b2 741 if (GetAnalysisMode()==AlidNdPtHelper::kTPCSPDvtxUpdate) \r
742 {\r
743 //\r
744 // update track parameters\r
745 //\r
746 AliExternalTrackParam cParam;\r
747 track->RelateToVertexTPC(esdEvent->GetPrimaryVertexSPD(),esdEvent->GetMagneticField(),kVeryBig,&cParam);\r
748 track->Set(cParam.GetX(),cParam.GetAlpha(),cParam.GetParameter(),cParam.GetCovariance());\r
749\r
750 if(accCuts->AcceptTrack(track)) { \r
751 FillHistograms(track,stack,AlidNdPtHelper::kRecTracks,vtxESD->GetZv(),multRecTemp); \r
752 labelsRec[multRec] = TMath::Abs(track->GetLabel());\r
753 multRec++;\r
754 }\r
755 }\r
756 else if (GetAnalysisMode()==AlidNdPtHelper::kMCRec && IsUseMCInfo()) \r
757 { \r
758 //\r
759 // Replace rec with MC\r
760 //\r
761 if(accCuts->AcceptTrack(track)) { \r
762 FillHistograms(track,stack,AlidNdPtHelper::kRecTracks,vtxMC[2],multRecTemp); \r
763 labelsRec[multRec] = TMath::Abs(track->GetLabel());\r
764 multRec++;\r
765 }\r
766 } \r
767 else {\r
768 //\r
769 // all the rest tracking scenarios\r
770 //\r
771 if(accCuts->AcceptTrack(track)) { \r
772 FillHistograms(track,stack,AlidNdPtHelper::kRecTracks,vtxESD->GetZv(),multRecTemp); \r
773 labelsRec[multRec] = TMath::Abs(track->GetLabel());\r
774 multRec++;\r
775 }\r
776 }\r
777 }\r
0aaa8b91 778 }\r
779 // event-level corrections\r
780 if(GetAnalysisMode()==AlidNdPtHelper::kMCRec && IsUseMCInfo()) { \r
781 FillHistograms(AlidNdPtHelper::kRecEvents,vtxMC[2],multMBTracks);\r
782 }\r
783 else {\r
784 FillHistograms(AlidNdPtHelper::kRecEvents,vtxESD->GetZv(),multMBTracks);\r
785 }\r
786\r
787 // control event histograms\r
788 Double_t vRecEventHist1[3] = {vtxESD->GetXv(),vtxESD->GetYv(),vtxESD->GetZv()};\r
789 fRecEventHist1->Fill(vRecEventHist1);\r
790 } \r
791\r
792 // empty events corrections\r
793 // no reconstructed zv\r
794 if(isEventTriggered && multMBTracks==0) {\r
795 if(GetAnalysisMode()==AlidNdPtHelper::kMCRec && IsUseMCInfo()) {\r
796 FillHistograms(AlidNdPtHelper::kTriggeredEvents,vtxMC[2],multMBTracks);\r
797 }\r
798 else {\r
799 Double_t zv = fZvNorm->GetRandom();\r
800 FillHistograms(AlidNdPtHelper::kTriggeredEvents,zv,multMBTracks);\r
801 }\r
802 }\r
803\r
804 if(IsUseMCInfo()) \r
805 {\r
806 // select MC events \r
807 if(evtCuts->AcceptMCEvent(mcEvent))\r
808 {\r
809 //\r
810 // event histograms\r
811 //\r
812 Double_t vMCEventMatrix[2] = {vtxMC[2],multMBTracks};\r
813 fMCAllEventMultHist1->Fill(vMCEventMatrix);\r
bad4ba69 814 if(evtType == AliPWG0Helper::kND) {\r
0aaa8b91 815 fMCAllNDEventMultHist1->Fill(vMCEventMatrix);\r
816 }\r
bad4ba69 817 if(evtType != AliPWG0Helper::kSD) {\r
0aaa8b91 818 fMCAllNSDEventMultHist1->Fill(vMCEventMatrix);\r
819 }\r
820 if(isEventTriggered) fMCTriggerMultHist1->Fill(vMCEventMatrix);\r
821 if(isEventTriggered && isEventOK) fMCEventMultHist1->Fill(vMCEventMatrix);\r
822\r
823 //\r
824 // MC histograms for efficiency studies\r
825 //\r
826 Int_t nPart = stack->GetNtrack();\r
827 for (Int_t iMc = 0; iMc < nPart; ++iMc) \r
828 {\r
829 // print MC stack info\r
830 //AlidNdPtHelper::PrintMCInfo(stack,iMc);\r
831\r
832 TParticle* particle = stack->Particle(iMc);\r
833 if (!particle)\r
834 continue;\r
835\r
836 // only charged particles\r
837 Double_t charge = particle->GetPDG()->Charge()/3.;\r
00b81913 838 if (TMath::Abs(charge) < 0.001)\r
0aaa8b91 839 continue;\r
847e74b2 840\r
841 // only postive charged \r
842 if(GetParticleMode() == AlidNdPtHelper::kPlus && charge < 0.) \r
843 continue;\r
844 \r
845 // only negative charged \r
846 if(GetParticleMode() == AlidNdPtHelper::kMinus && charge > 0.) \r
847 continue;\r
0aaa8b91 848 \r
849 // physical primary\r
850 Bool_t prim = stack->IsPhysicalPrimary(iMc);\r
851\r
852 // all primaries in acceptance\r
853 if(!accCuts->AcceptTrack(particle)) continue;\r
854 if(!prim) continue;\r
855\r
856 Double_t gpt = particle->Pt();\r
857 Double_t geta = particle->Eta();\r
858\r
859 Double_t valMCAllTrackMultHist1[3] = {gpt,geta,multRec}; \r
860 fMCAllPrimTrackMultHist1->Fill(valMCAllTrackMultHist1);\r
bad4ba69 861 if(evtType == AliPWG0Helper::kND) {\r
0aaa8b91 862 fMCNDEventAllPrimTrackMultHist1->Fill(valMCAllTrackMultHist1);\r
863 }\r
bad4ba69 864 if(evtType != AliPWG0Helper::kSD) {\r
0aaa8b91 865 fMCNSDEventAllPrimTrackMultHist1->Fill(valMCAllTrackMultHist1);\r
866 }\r
867 if(isEventTriggered) fMCTriggerPrimTrackMultHist1->Fill(valMCAllTrackMultHist1);\r
868 if(isEventTriggered && isEventOK) fMCEventPrimTrackMultHist1->Fill(valMCAllTrackMultHist1);\r
869 }\r
870 }\r
871 } // end bUseMC\r
872\r
873 if(allChargedTracks) delete allChargedTracks; allChargedTracks = 0;\r
874 if(labelsRec) delete [] labelsRec; labelsRec = 0;\r
875\r
f537848a 876 if(!evtCuts->IsRecVertexRequired() && vtxESD != NULL) delete vtxESD;\r
0aaa8b91 877}\r
878\r
879//_____________________________________________________________________________\r
00b81913 880void AlidNdPtCorrection::FillHistograms(AlidNdPtHelper::EventObject eventObj, Double_t zv, Int_t multMBTracks) const\r
0aaa8b91 881{\r
882 //\r
883 // Fill corrected histograms\r
884 //\r
885\r
886 Double_t vEventMatrix[2] = {zv,multMBTracks};\r
887 //\r
888 // Correct for efficiency \r
889 //\r
890 if(eventObj == AlidNdPtHelper::kRecEvents && multMBTracks>0) \r
891 {\r
892 Double_t corrToMBF = GetCorrFactZvMult(fCorrEventMatrix,zv,multMBTracks);\r
893 Double_t corrToInelF = GetCorrFactZvMult(fCorrTriggerMBtoInelEventMatrix,zv,multMBTracks);\r
894 Double_t corrToNDF = GetCorrFactZvMult(fCorrTriggerMBtoNDEventMatrix,zv,multMBTracks);\r
895 Double_t corrToNSDF = GetCorrFactZvMult(fCorrTriggerMBtoNSDEventMatrix,zv,multMBTracks);\r
896 //printf("corrToMBF %f, corrToInelF %f, corrToNDF %f corrToNSDF %f \n",corrToMBF,corrToInelF,corrToNDF,corrToNSDF);\r
897\r
898 fCorrRecEventHist1[0]->Fill(vEventMatrix);\r
899 fCorrRecEventHist1[1]->Fill(vEventMatrix,corrToMBF);\r
900 fCorrRecEventHist1[2]->Fill(vEventMatrix,corrToMBF*corrToInelF);\r
901 fCorrRecEventHist1[3]->Fill(vEventMatrix,corrToMBF*corrToNDF);\r
902 fCorrRecEventHist1[4]->Fill(vEventMatrix,corrToMBF*corrToNSDF);\r
903 }\r
904\r
905 if(eventObj==AlidNdPtHelper::kTriggeredEvents && multMBTracks==0) // empty triggered events\r
906 {\r
907 Int_t bin = fZvEmptyEventsNorm->FindBin(zv);\r
00b81913 908 Double_t factZ = fZvEmptyEventsNorm->GetBinContent(bin);\r
0aaa8b91 909 Double_t corrToInelF0 = GetCorrFactZvMult(fCorrTriggerMBtoInelEventMatrix,zv,multMBTracks);\r
910 Double_t corrToNDF0 = GetCorrFactZvMult(fCorrTriggerMBtoNDEventMatrix,zv,multMBTracks);\r
911 Double_t corrToNSDF0 = GetCorrFactZvMult(fCorrTriggerMBtoNSDEventMatrix,zv,multMBTracks);\r
00b81913 912 //printf("factZ %f, corrToInelF0 %f, corrToNDF0 %f, corrToNSDF0 %f \n",factZ,corrToInelF0,corrToNDF0,corrToNSDF0);\r
0aaa8b91 913\r
914 fCorrRecEventHist2[0]->Fill(vEventMatrix);\r
00b81913 915 fCorrRecEventHist2[1]->Fill(vEventMatrix,factZ);\r
916 fCorrRecEventHist2[2]->Fill(vEventMatrix,factZ*corrToInelF0);\r
917 fCorrRecEventHist2[3]->Fill(vEventMatrix,factZ*corrToNDF0);\r
918 fCorrRecEventHist2[4]->Fill(vEventMatrix,factZ*corrToNSDF0);\r
0aaa8b91 919 }\r
920}\r
921\r
922//_____________________________________________________________________________\r
00b81913 923void AlidNdPtCorrection::FillHistograms(AliESDtrack * const esdTrack, AliStack * const stack, AlidNdPtHelper::TrackObject trackObj, Double_t zv, Int_t mult) const\r
0aaa8b91 924{\r
925 //\r
926 // Fill ESD track and MC histograms \r
927 //\r
928 if(!esdTrack) return;\r
929\r
930 //Float_t q = esdTrack->Charge();\r
931 Float_t pt = esdTrack->Pt();\r
932 Float_t eta = esdTrack->Eta();\r
933 Float_t phi = esdTrack->Phi();\r
934\r
935 if(stack && GetAnalysisMode() == AlidNdPtHelper::kMCRec) \r
936 {\r
937 Int_t label = TMath::Abs(esdTrack->GetLabel());\r
938 \r
939 TParticle* particle = stack->Particle(label);\r
940 if(!particle) return;\r
941 \r
942 Double_t gq = particle->GetPDG()->Charge()/3.0; // Charge units |e|/3\r
00b81913 943 if(TMath::Abs(gq)<0.001) return;\r
0aaa8b91 944 Float_t gpt = particle->Pt();\r
945 Float_t geta = particle->Eta();\r
946 Float_t gphi = particle->Phi();\r
947\r
948 // replace reconstructed values with MC\r
949 pt = gpt;\r
950 eta = geta;\r
951 phi = gphi;\r
952 }\r
953\r
954 //\r
955 // Fill histograms\r
956 //\r
957 Double_t values[3] = {pt,eta,phi}; \r
958 fRecTrackHist1[trackObj]->Fill(values);\r
959\r
960 //\r
961 // Correct for contamination and efficiency \r
962 //\r
963 if(trackObj == AlidNdPtHelper::kRecTracks || GetAnalysisMode() == AlidNdPtHelper::kMCRec) \r
964 {\r
965 // track level corrections\r
966 Double_t trackEffF = GetCorrFactZvPtEta(fCorrTrackMatrix,zv,pt,eta);\r
967 Double_t trackContF = GetContFactZvPtEta(fContTrackMatrix,zv,pt,eta);\r
968 Double_t multTrackContF = GetContFactZvPtEta(fContMultTrackMatrix,zv,pt,eta);\r
969 //printf("zv %f, pt %f, eta %f \n",zv,pt,eta);\r
970 //printf("trackEffF %f, trackContF %f, multTrackContF %f \n", trackEffF, trackContF, multTrackContF);\r
971 \r
972 // track-event level corrections\r
973 Double_t vertexEffF = GetCorrFactZvPtEta(fCorrTrackEventMatrix,zv,pt,eta);\r
974 Double_t trigMBToInel = GetCorrFactZvPtEta(fCorrTriggerMBtoInelTrackEventMatrix,zv,pt,eta); \r
975 Double_t trigMBToND = GetCorrFactZvPtEta(fCorrTriggerMBtoNDTrackEventMatrix,zv,pt,eta);\r
976 Double_t trigMBToNSD = GetCorrFactZvPtEta(fCorrTriggerMBtoNSDTrackEventMatrix,zv,pt,eta);\r
977 //printf("vertexEffF %f, trigMBToInel %f, trigMBToNSD %f \n", vertexEffF, trigMBToInel, trigMBToNSD);\r
bad4ba69 978 \r
979 Double_t corrF[8] = { 1.0, \r
980 trackContF,\r
981 trackContF*trackEffF,\r
982 trackContF*trackEffF*multTrackContF,\r
983 trackContF*trackEffF*multTrackContF*vertexEffF,\r
984 trackContF*trackEffF*multTrackContF*vertexEffF*trigMBToInel,\r
985 trackContF*trackEffF*multTrackContF*vertexEffF*trigMBToND,\r
986 trackContF*trackEffF*multTrackContF*vertexEffF*trigMBToNSD\r
987 }; \r
988 \r
989 // Fill histograms\r
0aaa8b91 990 Double_t valCorrRecTrackMultHist1[3] = {pt,eta,mult}; \r
bad4ba69 991 Double_t valPtvsPt[2] = {pt,pt}; \r
992 for(Int_t i=0; i<8; i++) {\r
993 fCorrRecTrackMultHist1[i]->Fill(valCorrRecTrackMultHist1,corrF[i]);\r
994 fPtvsPt[i]->Fill(valPtvsPt,corrF[i]);\r
995 }\r
0aaa8b91 996 }\r
997}\r
998\r
999//_____________________________________________________________________________\r
00b81913 1000void AlidNdPtCorrection::FillHistograms(AliStack * const stack, Int_t /*label*/, AlidNdPtHelper::TrackObject /*trackObj*/, Int_t /*mult*/) const\r
0aaa8b91 1001{\r
1002 // Fill MC histograms\r
1003 if(!stack) return;\r
1004\r
1005 /*\r
1006 TParticle* particle = stack->Particle(label);\r
1007 if(!particle) return;\r
1008\r
1009 Int_t mother_pdg = -1;\r
1010 TParticle* mother = 0;\r
1011\r
1012 //TParticle* prim_mother = AlidNdPtHelper::FindPrimaryMother(stack,label);\r
1013 Int_t motherLabel = particle->GetMother(0); \r
1014 if(motherLabel>0) mother = stack->Particle(motherLabel);\r
1015 if(mother) mother_pdg = TMath::Abs(mother->GetPdgCode()); // take abs for visualisation only\r
1016 Int_t mech = particle->GetUniqueID(); // production mechanism\r
1017\r
1018 Double_t gq = particle->GetPDG()->Charge()/3.0; // Charge units |e|/3 \r
1019 Float_t gpt = particle->Pt();\r
1020 Float_t qgpt = particle->Pt() * gq;\r
1021 Float_t geta = particle->Eta();\r
1022 Float_t gphi = particle->Phi();\r
1023 Float_t gpz = particle->Pz();\r
1024\r
1025 Bool_t prim = stack->IsPhysicalPrimary(label);\r
1026 Float_t vx = particle->Vx(); Float_t vy = particle->Vy(); Float_t vz = particle->Vz();\r
1027\r
1028 Int_t pid=-1;\r
1029 if (TMath::Abs(particle->GetPdgCode()) == kElectron) { pid = 0; }\r
1030 else if (TMath::Abs(particle->GetPdgCode()) == kMuonMinus) { pid = 1; }\r
1031 else if (TMath::Abs(particle->GetPdgCode()) == kPiPlus) { pid = 2; }\r
1032 else if (TMath::Abs(particle->GetPdgCode()) == kKPlus) { pid = 3; }\r
1033 else if (TMath::Abs(particle->GetPdgCode()) == kProton) { pid = 4; }\r
1034 else { pid = 5; }\r
1035 */\r
1036\r
1037 //if(!prim) printf("prim_mother %d, mother %d, particle %d, production mech %d\n",prim_mother->GetPdgCode(),mother->GetPdgCode(), particle->GetPdgCode(),mech);\r
1038 \r
1039}\r
1040\r
1041//_____________________________________________________________________________\r
00b81913 1042Double_t AlidNdPtCorrection::GetCorrFactZvPtEta(THnSparse * const hist, Double_t zv, Double_t pt, Double_t eta) const {\r
0aaa8b91 1043// return correction factor F(zv,pt,eta)\r
1044\r
1045 if(!hist) return 1.;\r
1046\r
1047 //\r
1048 TAxis *ax = hist->GetAxis(0);\r
1049 TAxis *ay = hist->GetAxis(1);\r
1050 TAxis *az = hist->GetAxis(2);\r
1051\r
1052 Int_t binx = ax->FindBin(zv);\r
1053 Int_t biny = ay->FindBin(pt);\r
1054 Int_t binz = az->FindBin(eta);\r
1055 Int_t dim[3] = {binx,biny,binz};\r
1056\r
1057 Double_t fact = hist->GetBinContent(dim); \r
1058\r
1059return fact;\r
1060}\r
1061\r
1062//_____________________________________________________________________________\r
00b81913 1063Double_t AlidNdPtCorrection::GetContFactZvPtEta(THnSparse * const hist, Double_t zv, Double_t pt, Double_t eta) const {\r
0aaa8b91 1064// return contamination correction factor F(zv,pt,eta)\r
1065\r
1066 if(!hist) return 1.0;\r
1067\r
1068 //\r
1069 TAxis *ax = hist->GetAxis(0);\r
1070 TAxis *ay = hist->GetAxis(1);\r
1071 TAxis *az = hist->GetAxis(2);\r
1072\r
1073 Int_t binx = ax->FindBin(zv);\r
1074 Int_t biny = ay->FindBin(pt);\r
1075 Int_t binz = az->FindBin(eta);\r
1076 Int_t dim[3] = {binx,biny,binz};\r
1077\r
1078 Double_t fact = 1.0-hist->GetBinContent(dim); \r
1079 //Double_t fact = hist->GetBinContent(dim); \r
1080\r
1081return fact;\r
1082}\r
1083\r
1084//_____________________________________________________________________________\r
00b81913 1085Double_t AlidNdPtCorrection::GetCorrFactZvMult(THnSparse * const hist, Double_t zv, Int_t mult) const {\r
0aaa8b91 1086// return correction factor F(zv,mult)\r
1087\r
1088 if(!hist) return 1.;\r
1089\r
1090 TAxis *ax = hist->GetAxis(0);\r
1091 TAxis *ay = hist->GetAxis(1);\r
1092 Int_t binx = ax->FindBin(zv);\r
1093 Int_t biny = ay->FindBin(mult);\r
1094 Int_t dim[2] = {binx,biny};\r
1095\r
1096 Double_t fact = hist->GetBinContent(dim); \r
1097\r
1098\r
1099return fact;\r
1100}\r
1101\r
1102//_____________________________________________________________________________\r
00b81913 1103Double_t AlidNdPtCorrection::GetContFactZvMult(THnSparse * const hist, Double_t zv, Int_t mult) const {\r
0aaa8b91 1104// return contamination correction factor F(zv,mult)\r
1105\r
1106 if(!hist) return 1.;\r
1107\r
1108 TAxis *ax = hist->GetAxis(0);\r
1109 TAxis *ay = hist->GetAxis(1);\r
1110 Int_t binx = ax->FindBin(zv);\r
1111 Int_t biny = ay->FindBin(mult);\r
1112 Int_t dim[2] = {binx,biny};\r
1113 Double_t fact = 1.0-hist->GetBinContent(dim); \r
1114\r
1115return fact;\r
1116}\r
1117\r
1118//_____________________________________________________________________________\r
00b81913 1119Long64_t AlidNdPtCorrection::Merge(TCollection* const list) \r
0aaa8b91 1120{\r
1121 // Merge list of objects (needed by PROOF)\r
1122\r
1123 if (!list)\r
1124 return 0;\r
1125\r
1126 if (list->IsEmpty())\r
1127 return 1;\r
1128\r
1129 TIterator* iter = list->MakeIterator();\r
1130 TObject* obj = 0;\r
1131\r
1132 // collection of generated histograms\r
1133\r
1134 Int_t count=0;\r
1135 while((obj = iter->Next()) != 0) {\r
1136 AlidNdPtCorrection* entry = dynamic_cast<AlidNdPtCorrection*>(obj);\r
1137 if (entry == 0) continue; \r
1138 \r
1139 fMCEventHist1->Add(entry->fMCEventHist1);\r
1140 fRecEventHist1->Add(entry->fRecEventHist1);\r
1141\r
1142 fMCAllEventMultHist1->Add(entry->fMCAllEventMultHist1);\r
1143 fMCAllNDEventMultHist1->Add(entry->fMCAllNDEventMultHist1);\r
1144 fMCAllNSDEventMultHist1->Add(entry->fMCAllNSDEventMultHist1);\r
1145 fMCTriggerMultHist1->Add(entry->fMCTriggerMultHist1);\r
1146 fMCEventMultHist1->Add(entry->fMCEventMultHist1);\r
1147\r
1148 fMCAllPrimTrackMultHist1->Add(entry->fMCAllPrimTrackMultHist1);\r
1149 fMCNDEventAllPrimTrackMultHist1->Add(entry->fMCNDEventAllPrimTrackMultHist1);\r
1150 fMCNSDEventAllPrimTrackMultHist1->Add(entry->fMCNSDEventAllPrimTrackMultHist1);\r
1151 fMCTriggerPrimTrackMultHist1->Add(entry->fMCTriggerPrimTrackMultHist1);\r
1152 fMCEventPrimTrackMultHist1->Add(entry->fMCEventPrimTrackMultHist1);\r
d269b0e6 1153 fCosmicsHisto->Add(entry->fCosmicsHisto);\r
0aaa8b91 1154\r
1155 for(Int_t i=0; i<AlidNdPtHelper::kCutSteps; i++) {\r
1156 fRecTrackHist1[i]->Add(entry->fRecTrackHist1[i]);\r
1157 }\r
1158\r
1159 for(Int_t i=0; i<8; i++) {\r
1160 fCorrRecTrackMultHist1[i]->Add(entry->fCorrRecTrackMultHist1[i]);\r
bad4ba69 1161 fPtvsPt[i]->Add(entry->fPtvsPt[i]);\r
0aaa8b91 1162 }\r
1163\r
1164 for(Int_t i=0; i<5; i++) {\r
1165 fCorrRecEventHist1[i]->Add(entry->fCorrRecEventHist1[i]);\r
1166 fCorrRecEventHist2[i]->Add(entry->fCorrRecEventHist2[i]);\r
1167 }\r
1168\r
0aaa8b91 1169 count++;\r
1170 }\r
1171\r
1172return count;\r
1173}\r
1174 \r
00b81913 1175//____________________________________________________________________________\r
1176Int_t AlidNdPtCorrection::GetTrueMult(THnSparse * const hist, Int_t mult) const\r
0aaa8b91 1177{\r
00b81913 1178//\r
1179// get multiplicity of primary particles\r
1180//\r
0aaa8b91 1181 if(!hist) return 0;\r
00b81913 1182 Int_t trueMult = 0;\r
0aaa8b91 1183\r
1184 // 0 bins exluded\r
1185 TAxis *ax = hist->GetAxis(0);\r
1186 TAxis *ay = hist->GetAxis(1);\r
1187 ax->SetRange(1,ax->GetNbins());\r
1188 ay->SetRange(1,ay->GetNbins());\r
1189\r
1190 // measured mult\r
1191 ax->SetRangeUser((Float_t)mult,(Float_t)mult); \r
1192\r
1193 // get true multiplicity\r
1194 TH1D *h1 = (TH1D *)hist->Projection(1);\r
00b81913 1195 trueMult = (Int_t)h1->GetMean();\r
0aaa8b91 1196\r
00b81913 1197 return trueMult;\r
0aaa8b91 1198}\r
1199\r
1200//_____________________________________________________________________________\r
1201void AlidNdPtCorrection::Analyse() \r
1202{\r
1203 // Analyse histograms\r
1204 //\r
1205 TH1::AddDirectory(kFALSE);\r
1206 TH1 *h = 0, *hs=0, *hsc=0; \r
1207 TH2 *h2D = 0; \r
1208\r
1209 TObjArray *aFolderObj = new TObjArray;\r
1210\r
1211 //\r
1212 // get cuts\r
1213 //\r
1214 AlidNdPtEventCuts *evtCuts = GetEventCuts(); \r
1215 AlidNdPtAcceptanceCuts *accCuts = GetAcceptanceCuts(); \r
1216 AliESDtrackCuts *esdTrackCuts = GetTrackCuts(); \r
1217\r
1218 if(!evtCuts || !accCuts || !esdTrackCuts) {\r
1219 Error("AlidNdPtCutAnalysis::Analyse()", "cuts not available");\r
1220 return;\r
1221 }\r
1222\r
1223 //\r
1224 // set min and max values\r
1225 //\r
847e74b2 1226 //Double_t minPt = accCuts->GetMinPt();\r
1227 //Double_t maxPt = accCuts->GetMaxPt();\r
00b81913 1228 Double_t minEta = accCuts->GetMinEta();\r
1229 Double_t maxEta = accCuts->GetMaxEta()-0.00001;\r
d269b0e6 1230 \r
00b81913 1231 printf("minEta %f, maxEta %f \n",minEta, maxEta);\r
d269b0e6 1232\r
1233 //\r
1234 // cosmics background histo\r
1235 //\r
1236 h2D = fCosmicsHisto->Projection(0,1);\r
1237 h2D->SetName("deta_vs_dphi_cosmics");\r
1238 aFolderObj->Add(h2D);\r
0aaa8b91 1239\r
1240 //\r
1241 // pt profile\r
1242 //\r
bad4ba69 1243 char name[256];\r
1244 for(Int_t i=0; i<8; i++) {\r
1245 h2D = fPtvsPt[i]->Projection(1,0);\r
1246 sprintf(name,"PtvsMeanPt_%d",i);\r
d269b0e6 1247 h2D->SetName(name);\r
bad4ba69 1248 aFolderObj->Add(h2D);\r
1249 }\r
0aaa8b91 1250\r
1251 //\r
1252 // event level \r
1253 //\r
1254 h = fCorrRecEventHist1[0]->Projection(1);\r
1255 h->SetName("mult_event_not_corrected");\r
1256 aFolderObj->Add(h);\r
1257\r
1258 h = fCorrRecEventHist1[1]->Projection(1);\r
1259 h->SetName("mult_event_vertex_corrected");\r
1260 aFolderObj->Add(h);\r
1261\r
1262 h = fCorrRecEventHist1[2]->Projection(1);\r
1263 h->SetName("mult_trigger_vertex_corrected");\r
1264 aFolderObj->Add(h);\r
1265\r
1266 h = fCorrRecEventHist1[3]->Projection(1);\r
1267 h->SetName("mult_ND_trigger_vertex_corrected");\r
1268 aFolderObj->Add(h);\r
1269\r
1270 h = fCorrRecEventHist1[4]->Projection(1);\r
1271 h->SetName("mult_NSD_trigger_vertex_corrected");\r
1272 aFolderObj->Add(h);\r
1273\r
1274 // empty events\r
1275 h = fCorrRecEventHist2[0]->Projection(1);\r
1276 h->SetName("mult_empty_event_not_corrected");\r
1277 aFolderObj->Add(h);\r
1278\r
1279 h = fCorrRecEventHist2[1]->Projection(1);\r
1280 h->SetName("mult_empty_event_vertex_corrected");\r
1281 aFolderObj->Add(h);\r
1282\r
1283 h = fCorrRecEventHist2[2]->Projection(1);\r
1284 h->SetName("mult_empty_trigger_vertex_corrected");\r
1285 aFolderObj->Add(h);\r
1286\r
1287 h = fCorrRecEventHist2[3]->Projection(1);\r
1288 h->SetName("mult_empty_ND_trigger_vertex_corrected");\r
1289 aFolderObj->Add(h);\r
1290\r
1291 h = fCorrRecEventHist2[4]->Projection(1);\r
1292 h->SetName("mult_empty_NSD_trigger_vertex_corrected");\r
1293 aFolderObj->Add(h);\r
bad4ba69 1294 \r
1295 //\r
1296 // MC available\r
1297 //\r
1298 if(IsUseMCInfo()) {\r
0aaa8b91 1299\r
1300 // mc \r
1301 h = fMCAllEventMultHist1->Projection(1);\r
1302 h->SetName("mc_mult_event_acc_prim");\r
1303 aFolderObj->Add(h);\r
1304\r
1305 h = fMCAllNDEventMultHist1->Projection(1);\r
1306 h->SetName("mc_mult_ND_event_acc_prim");\r
1307 aFolderObj->Add(h);\r
1308\r
1309 h = fMCAllNSDEventMultHist1->Projection(1);\r
1310 h->SetName("mc_mult_NSD_event_acc_prim");\r
1311 aFolderObj->Add(h);\r
1312\r
1313 h = fMCTriggerMultHist1->Projection(1);\r
1314 h->SetName("mc_mult_trigger_acc_prim");\r
1315 aFolderObj->Add(h);\r
1316\r
1317 h = fMCEventMultHist1->Projection(1);\r
1318 h->SetName("mc_mult_trigger_event_acc_prim");\r
1319 aFolderObj->Add(h);\r
1320\r
1321\r
1322 //\r
1323 // track level\r
1324 //\r
1325 \r
1326 // limit eta range\r
1327 for(Int_t i=0;i<8;i++) { \r
3405c7c2 1328 //fCorrRecTrackMultHist1[i]->GetAxis(0)->SetRangeUser(minPt,maxPt);\r
1329 //fCorrRecTrackMultHist1[i]->GetAxis(1)->SetRangeUser(minEta,maxEta);\r
0aaa8b91 1330 }\r
3405c7c2 1331 //fMCAllPrimTrackMultHist1->GetAxis(0)->SetRangeUser(minPt,maxPt);\r
1332 //fMCAllPrimTrackMultHist1->GetAxis(1)->SetRangeUser(minEta,maxEta);\r
0aaa8b91 1333\r
3405c7c2 1334 //fMCNDEventAllPrimTrackMultHist1->GetAxis(0)->SetRangeUser(minPt,maxPt);\r
1335 //fMCNDEventAllPrimTrackMultHist1->GetAxis(1)->SetRangeUser(minEta,maxEta);\r
0aaa8b91 1336\r
3405c7c2 1337 //fMCNSDEventAllPrimTrackMultHist1->GetAxis(0)->SetRangeUser(minPt,maxPt);\r
1338 //fMCNSDEventAllPrimTrackMultHist1->GetAxis(1)->SetRangeUser(minEta,maxEta);\r
0aaa8b91 1339\r
3405c7c2 1340 //fMCTriggerPrimTrackMultHist1->GetAxis(0)->SetRangeUser(minPt,maxPt);\r
1341 //fMCTriggerPrimTrackMultHist1->GetAxis(1)->SetRangeUser(minEta,maxEta);\r
0aaa8b91 1342\r
3405c7c2 1343 //fMCEventPrimTrackMultHist1->GetAxis(0)->SetRangeUser(minPt,maxPt);\r
1344 //fMCEventPrimTrackMultHist1->GetAxis(1)->SetRangeUser(minEta,maxEta);\r
bad4ba69 1345\r
1346 } // end use MC info \r
0aaa8b91 1347 \r
1348 //\r
1349 h2D = fCorrRecTrackMultHist1[3]->Projection(1,0);\r
1350 h2D->SetName("pt_eta_rec_track_mult_eff_cont_corrected");\r
1351 aFolderObj->Add(h2D);\r
1352\r
1353 h2D = fCorrRecTrackMultHist1[4]->Projection(1,0);\r
1354 h2D->SetName("pt_eta_rec_event_track_mult_eff_cont_corrected");\r
1355 aFolderObj->Add(h2D);\r
1356\r
1357 h2D = fCorrRecTrackMultHist1[5]->Projection(1,0);\r
1358 h2D->SetName("pt_eta_rec_trig_event_track_mult_eff_cont_corrected");\r
1359 aFolderObj->Add(h2D);\r
1360\r
1361 h2D = fCorrRecTrackMultHist1[6]->Projection(1,0);\r
1362 h2D->SetName("pt_eta_rec_ND_trig_event_track_mult_eff_cont_corrected");\r
1363 aFolderObj->Add(h2D);\r
1364\r
1365 h2D = fCorrRecTrackMultHist1[7]->Projection(1,0);\r
1366 h2D->SetName("pt_eta_rec_NSD_trig_event_track_mult_eff_cont_corrected");\r
1367 aFolderObj->Add(h2D);\r
1368\r
1369\r
1370 //\r
1371 h2D = fCorrRecTrackMultHist1[3]->Projection(2,0);\r
1372 h2D->SetName("pt_mult_rec_track_mult_eff_cont_corrected");\r
1373 aFolderObj->Add(h2D);\r
1374\r
1375 h2D = fCorrRecTrackMultHist1[4]->Projection(2,0);\r
1376 h2D->SetName("pt_mult_rec_event_track_mult_eff_cont_corrected");\r
1377 aFolderObj->Add(h2D);\r
1378\r
1379 h2D = fCorrRecTrackMultHist1[5]->Projection(2,0);\r
1380 h2D->SetName("pt_mult_rec_trig_event_track_mult_eff_cont_corrected");\r
1381 aFolderObj->Add(h2D);\r
1382\r
1383 h2D = fCorrRecTrackMultHist1[6]->Projection(2,0);\r
1384 h2D->SetName("pt_mult_rec_ND_trig_event_track_mult_eff_cont_corrected");\r
1385 aFolderObj->Add(h2D);\r
1386\r
1387 h2D = fCorrRecTrackMultHist1[7]->Projection(2,0);\r
1388 h2D->SetName("pt_mult_rec_NSD_trig_event_track_mult_eff_cont_corrected");\r
1389 aFolderObj->Add(h2D);\r
1390\r
1391 // pt axis\r
1392\r
1393 h = fCorrRecTrackMultHist1[0]->Projection(0);\r
1394 h->SetName("pt_rec_track_not_corrected");\r
1395 hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1396 hs->SetName("pt_rec_track_not_corrected_s");\r
1397 aFolderObj->Add(hs);\r
1398\r
1399 //\r
1400 h = fCorrRecTrackMultHist1[1]->Projection(0);\r
1401 h->SetName("pt_rec_track_cont_corrected");\r
1402 hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1403 hs->SetName("pt_rec_track_cont_corrected_s");\r
1404 aFolderObj->Add(hs);\r
1405\r
1406 hsc = (TH1D*)hs->Clone("pt_rec_track_cont_corr_fact");\r
1407 hsc->Divide((TH1D*)aFolderObj->FindObject("pt_rec_track_not_corrected_s"));\r
1408 aFolderObj->Add(hsc);\r
1409\r
1410 //\r
1411 h = fCorrRecTrackMultHist1[2]->Projection(0);\r
1412 h->SetName("pt_rec_track_eff_cont_corrected");\r
1413 hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1414 hs->SetName("pt_rec_track_eff_cont_corrected_s");\r
1415 aFolderObj->Add(hs);\r
1416\r
1417 hsc = (TH1D*)hs->Clone("pt_rec_track_eff_corr_fact");\r
1418 hsc->Divide((TH1D*)aFolderObj->FindObject("pt_rec_track_cont_corrected_s"));\r
1419 aFolderObj->Add(hsc);\r
1420\r
1421 //\r
1422 h = fCorrRecTrackMultHist1[3]->Projection(0);\r
1423 h->SetName("pt_rec_track_mult_eff_cont_corrected");\r
1424 hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1425 hs->SetName("pt_rec_track_mult_eff_cont_corrected_s");\r
1426 aFolderObj->Add(hs);\r
1427\r
1428 hsc = (TH1D*)hs->Clone("pt_rec_track_mult_corr_fact");\r
1429 hsc->Divide((TH1D*)aFolderObj->FindObject("pt_rec_track_eff_cont_corrected_s"));\r
1430 aFolderObj->Add(hsc);\r
1431\r
1432 hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1433 hsc = (TH1D*)hs->Clone("pt_rec_track_mult_eff_cont_corr_fact");\r
1434 hsc->Divide((TH1D*)aFolderObj->FindObject("pt_rec_track_not_corrected_s"));\r
1435 aFolderObj->Add(hsc);\r
1436\r
1437 hsc = (TH1D*)hs->Clone();\r
1438 hsc->SetName("pt_rec_track_mult_eff_cont_corrected_s_norm");\r
1439 hsc->Scale(1./(fCorrRecEventHist1[0]->Projection(1)->Integral()));\r
1440 aFolderObj->Add(hsc);\r
1441\r
1442 //\r
1443 h = fCorrRecTrackMultHist1[4]->Projection(0);\r
1444 h->SetName("pt_rec_event_track_mult_eff_cont_corrected");\r
1445 hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1446 hs->SetName("pt_rec_event_track_mult_eff_cont_corrected_s");\r
1447 aFolderObj->Add(hs);\r
1448\r
1449 hsc = (TH1D*)hs->Clone();\r
1450 hsc->SetName("pt_rec_event_track_mult_eff_cont_corrected_s_norm");\r
1451 hsc->Scale(1./(fCorrRecEventHist1[1]->Projection(1)->Integral()+fCorrRecEventHist2[1]->Projection(1)->Integral()));\r
1452 aFolderObj->Add(hsc);\r
1453\r
1454 //\r
1455 h = fCorrRecTrackMultHist1[5]->Projection(0);\r
1456 h->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected");\r
1457 hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1458 hs->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected_s");\r
1459 aFolderObj->Add(hs);\r
1460\r
1461 hsc = (TH1D*)hs->Clone();\r
1462 hsc->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected_s_norm");\r
1463 hsc->Scale(1./(fCorrRecEventHist1[2]->Projection(1)->Integral() + fCorrRecEventHist2[2]->Projection(1)->Integral()));\r
1464 aFolderObj->Add(hsc);\r
1465\r
00b81913 1466 // positive eta\r
1467 fCorrRecTrackMultHist1[5]->GetAxis(1)->SetRangeUser(0., maxEta);\r
1468\r
1469 h = fCorrRecTrackMultHist1[5]->Projection(0);\r
1470 h->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected_posEta");\r
1471 hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1472 hs->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected_s_posEta");\r
1473 aFolderObj->Add(hs);\r
1474\r
1475 hsc = (TH1D*)hs->Clone();\r
1476 hsc->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected_s_norm_posEta");\r
1477 hsc->Scale(1./(fCorrRecEventHist1[2]->Projection(1)->Integral()+fCorrRecEventHist2[2]->Projection(1)->Integral()));\r
1478 aFolderObj->Add(hsc);\r
1479\r
1480 // negative eta\r
1481 fCorrRecTrackMultHist1[5]->GetAxis(1)->SetRangeUser(minEta, -0.00001);\r
1482\r
1483 h = fCorrRecTrackMultHist1[5]->Projection(0);\r
1484 h->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected_negEta");\r
1485 hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1486 hs->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected_s_negEta");\r
1487 aFolderObj->Add(hs);\r
1488\r
1489 hsc = (TH1D*)hs->Clone();\r
1490 hsc->SetName("pt_rec_trig_event_track_mult_eff_cont_corrected_s_norm_negEta");\r
1491 hsc->Scale(1./(fCorrRecEventHist1[2]->Projection(1)->Integral()+fCorrRecEventHist2[2]->Projection(1)->Integral()));\r
1492 aFolderObj->Add(hsc);\r
1493\r
1494 fCorrRecTrackMultHist1[5]->GetAxis(1)->SetRange(1, fCorrRecTrackMultHist1[5]->GetAxis(1)->GetNbins());\r
1495\r
0aaa8b91 1496 //\r
1497 h = fCorrRecTrackMultHist1[6]->Projection(0);\r
1498 h->SetName("pt_rec_ND_trig_event_track_mult_eff_cont_corrected");\r
1499 hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1500 hs->SetName("pt_rec_ND_trig_event_track_mult_eff_cont_corrected_s");\r
1501 aFolderObj->Add(hs);\r
1502\r
1503 hsc = (TH1D*)hs->Clone();\r
1504 hsc->SetName("pt_rec_ND_trig_event_track_mult_eff_cont_corrected_s_norm");\r
1505 hsc->Scale(1./(fCorrRecEventHist1[3]->Projection(1)->Integral()+fCorrRecEventHist2[3]->Projection(1)->Integral()));\r
1506 aFolderObj->Add(hsc);\r
1507\r
1508 //\r
1509 h = fCorrRecTrackMultHist1[7]->Projection(0);\r
1510 h->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected");\r
1511 hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1512 hs->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_s");\r
1513 aFolderObj->Add(hs);\r
1514\r
1515 hsc = (TH1D*)hs->Clone();\r
1516 hsc->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_s_norm");\r
1517 hsc->Scale(1./(fCorrRecEventHist1[4]->Projection(1)->Integral()+fCorrRecEventHist2[4]->Projection(1)->Integral()));\r
1518 aFolderObj->Add(hsc);\r
1519\r
00b81913 1520 //\r
1521 // positive eta\r
1522 //\r
1523 fCorrRecTrackMultHist1[7]->GetAxis(1)->SetRangeUser(0., maxEta);\r
1524\r
1525 h = fCorrRecTrackMultHist1[7]->Projection(0);\r
1526 h->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_posEta");\r
1527 hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1528 hs->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_s_posEta");\r
1529 aFolderObj->Add(hs);\r
1530\r
1531 hsc = (TH1D*)hs->Clone();\r
1532 hsc->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_s_norm_posEta");\r
1533 hsc->Scale(1./(fCorrRecEventHist1[4]->Projection(1)->Integral()+fCorrRecEventHist2[4]->Projection(1)->Integral()));\r
1534 aFolderObj->Add(hsc);\r
1535\r
1536 //\r
1537 // negative eta\r
1538 //\r
1539 fCorrRecTrackMultHist1[7]->GetAxis(1)->SetRangeUser(minEta, -0.00001);\r
1540\r
1541 h = fCorrRecTrackMultHist1[7]->Projection(0);\r
1542 h->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_negEta");\r
1543 hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1544 hs->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_s_negEta");\r
1545 aFolderObj->Add(hs);\r
1546\r
1547 hsc = (TH1D*)hs->Clone();\r
1548 hsc->SetName("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_s_norm_negEta");\r
1549 hsc->Scale(1./(fCorrRecEventHist1[4]->Projection(1)->Integral()+fCorrRecEventHist2[4]->Projection(1)->Integral()));\r
1550 aFolderObj->Add(hsc);\r
1551\r
1552 fCorrRecTrackMultHist1[7]->GetAxis(1)->SetRange(1, fCorrRecTrackMultHist1[7]->GetAxis(1)->GetNbins());\r
1553\r
0aaa8b91 1554 // eta axis\r
1555 h = fCorrRecTrackMultHist1[0]->Projection(1);\r
1556 h->SetName("eta_rec_track_not_corrected");\r
1557 aFolderObj->Add(h);\r
1558 \r
1559 h = fCorrRecTrackMultHist1[1]->Projection(1);\r
1560 h->SetName("eta_rec_track_cont_corrected");\r
1561 aFolderObj->Add(h);\r
1562\r
1563 h = fCorrRecTrackMultHist1[2]->Projection(1);\r
1564 h->SetName("eta_rec_track_eff_cont_corrected");\r
1565 aFolderObj->Add(h);\r
1566\r
1567 h = fCorrRecTrackMultHist1[3]->Projection(1);\r
1568 h->SetName("eta_rec_track_mult_eff_cont_corrected");\r
1569 aFolderObj->Add(h);\r
1570\r
1571 h = fCorrRecTrackMultHist1[4]->Projection(1);\r
1572 h->SetName("eta_rec_event_track_mult_eff_cont_corrected");\r
1573 aFolderObj->Add(h);\r
1574\r
1575 h = fCorrRecTrackMultHist1[5]->Projection(1);\r
1576 h->SetName("eta_rec_trig_event_track_mult_eff_cont_corrected");\r
1577 aFolderObj->Add(h);\r
1578\r
1579 h = fCorrRecTrackMultHist1[6]->Projection(1);\r
1580 h->SetName("eta_rec_ND_trig_event_track_mult_eff_cont_corrected");\r
1581 aFolderObj->Add(h);\r
1582\r
1583 h = fCorrRecTrackMultHist1[7]->Projection(1);\r
1584 h->SetName("eta_rec_NSD_trig_event_track_mult_eff_cont_corrected");\r
1585 aFolderObj->Add(h);\r
1586\r
1587\r
bad4ba69 1588 //\r
1589 // MC available\r
1590 //\r
1591 if(IsUseMCInfo()) {\r
0aaa8b91 1592\r
1593 //\r
1594 h2D = fMCAllPrimTrackMultHist1->Projection(2,0);\r
1595 h2D->SetName("mc_all_pt_mult_acc_prim");\r
1596 aFolderObj->Add(h2D);\r
1597\r
1598 h2D = fMCAllPrimTrackMultHist1->Projection(1,0);\r
1599 h2D->SetName("mc_all_eta_pt_acc_prim");\r
1600 aFolderObj->Add(h2D);\r
1601\r
1602 h2D = fMCNDEventAllPrimTrackMultHist1->Projection(2,0);\r
1603 h2D->SetName("mc_ND_all_pt_mult_acc_prim");\r
1604 aFolderObj->Add(h2D);\r
1605\r
1606 h2D = fMCNDEventAllPrimTrackMultHist1->Projection(1,0);\r
1607 h2D->SetName("mc_ND_all_eta_pt_acc_prim");\r
1608 aFolderObj->Add(h2D);\r
1609\r
1610 h2D = fMCNSDEventAllPrimTrackMultHist1->Projection(2,0);\r
1611 h2D->SetName("mc_NSD_all_pt_mult_acc_prim");\r
1612 aFolderObj->Add(h2D);\r
1613\r
1614 h2D = fMCNSDEventAllPrimTrackMultHist1->Projection(1,0);\r
1615 h2D->SetName("mc_NSD_all_eta_pt_acc_prim");\r
1616 aFolderObj->Add(h2D);\r
1617\r
1618 //\r
1619\r
1620 h = fMCAllPrimTrackMultHist1->Projection(0);\r
1621 h->SetName("mc_all_pt_acc_prim");\r
1622 hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1623 hs->SetName("mc_all_pt_acc_prim_s");\r
1624 aFolderObj->Add(hs);\r
1625\r
1626 hsc = (TH1D*)hs->Clone();\r
1627 hsc->SetName("mc_all_pt_acc_prim_s_norm");\r
1628 hsc->Scale(1./fMCAllEventMultHist1->Projection(1)->Integral());\r
1629 aFolderObj->Add(hsc);\r
1630\r
1631 h = fMCNDEventAllPrimTrackMultHist1->Projection(0);\r
1632 h->SetName("mc_ND_all_pt_acc_prim");\r
1633 hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1634 hs->SetName("mc_ND_all_pt_acc_prim_s");\r
1635 aFolderObj->Add(hs);\r
1636\r
1637 hsc = (TH1D*)hs->Clone();\r
1638 hsc->SetName("mc_ND_all_pt_acc_prim_s_norm");\r
1639 hsc->Scale(1./fMCAllNDEventMultHist1->Projection(1)->Integral());\r
1640 aFolderObj->Add(hsc);\r
1641\r
1642 h = fMCNSDEventAllPrimTrackMultHist1->Projection(0);\r
1643 h->SetName("mc_NSD_all_pt_acc_prim");\r
1644 hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1645 hs->SetName("mc_NSD_all_pt_acc_prim_s");\r
1646 aFolderObj->Add(hs);\r
1647\r
1648 hsc = (TH1D*)hs->Clone();\r
1649 hsc->SetName("mc_NSD_all_pt_acc_prim_s_norm");\r
1650 hsc->Scale(1./fMCAllNSDEventMultHist1->Projection(1)->Integral());\r
1651 aFolderObj->Add(hsc);\r
1652\r
1653 h = fMCTriggerPrimTrackMultHist1->Projection(0);\r
1654 h->SetName("mc_trigger_all_pt_acc_prim");\r
1655 hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1656 hs->SetName("mc_trigger_all_pt_acc_prim_s");\r
1657 aFolderObj->Add(hs);\r
1658\r
1659 hsc = (TH1D*)hs->Clone();\r
1660 hsc->SetName("mc_trigger_all_pt_acc_prim_s_norm");\r
1661 hsc->Scale(1./fMCTriggerMultHist1->Projection(1)->Integral());\r
1662 aFolderObj->Add(hsc);\r
1663\r
1664 h = fMCEventPrimTrackMultHist1->Projection(0);\r
1665 h->SetName("mc_all_pt_acc_trig_event_prim");\r
1666 hs = AlidNdPtHelper::ScaleByBinWidth(h);\r
1667 hs->SetName("mc_all_pt_acc_trig_event_prim_s");\r
1668 aFolderObj->Add(hs);\r
1669\r
1670 hsc = (TH1D*)hs->Clone();\r
1671 hsc->SetName("mc_all_pt_acc_trig_event_prim_s_norm");\r
1672 hsc->Scale(1./fMCEventMultHist1->Projection(1)->Integral());\r
1673 aFolderObj->Add(hsc);\r
1674\r
1675 //\r
1676\r
1677 h = fMCAllPrimTrackMultHist1->Projection(1);\r
1678 h->SetName("mc_all_eta_acc_prim");\r
1679 aFolderObj->Add(h);\r
1680\r
1681 h = fMCNDEventAllPrimTrackMultHist1->Projection(1);\r
1682 h->SetName("mc_ND_all_eta_acc_prim");\r
1683 aFolderObj->Add(h);\r
1684\r
1685 h = fMCNSDEventAllPrimTrackMultHist1->Projection(1);\r
1686 h->SetName("mc_NSD_all_eta_acc_prim");\r
1687 aFolderObj->Add(h);\r
1688\r
1689 h = fMCTriggerPrimTrackMultHist1->Projection(1);\r
1690 h->SetName("mc_trigger_all_eta_acc_prim");\r
1691 aFolderObj->Add(h);\r
1692\r
1693 h = fMCEventPrimTrackMultHist1->Projection(1);\r
1694 h->SetName("mc_all_eta_acc_trig_event_prim");\r
1695 aFolderObj->Add(h);\r
1696\r
1697 //\r
1698 // calculate ratios (rec / mc)\r
1699 //\r
1700 \r
1701 hs = (TH1*)aFolderObj->FindObject("pt_rec_trig_event_track_mult_eff_cont_corrected_s_norm");\r
1702 hsc = (TH1D*)hs->Clone("ratio_pt_rec_to_mc_trig_event_track_mult_eff_cont_corrected"); \r
1703 hsc->Sumw2();\r
1704 hsc->Divide((TH1*)aFolderObj->FindObject("mc_all_pt_acc_prim_s_norm"));\r
1705 aFolderObj->Add(hsc);\r
1706\r
1707 hs = (TH1*)aFolderObj->FindObject("eta_rec_trig_event_track_mult_eff_cont_corrected");\r
1708 hsc = (TH1D*)hs->Clone("ratio_eta_rec_to_mc_trig_event_track_mult_eff_cont_corrected"); \r
1709 hsc->Sumw2();\r
1710 hsc->Divide((TH1*)aFolderObj->FindObject("mc_all_eta_acc_prim"));\r
1711 aFolderObj->Add(hsc);\r
1712\r
1713 //\r
1714 hs = (TH1*)aFolderObj->FindObject("pt_rec_ND_trig_event_track_mult_eff_cont_corrected_s_norm");\r
1715 hsc = (TH1D*)hs->Clone("ratio_pt_rec_to_mc_ND_trig_event_track_mult_eff_cont_corrected"); \r
1716 hsc->Sumw2();\r
1717 hsc->Divide((TH1*)aFolderObj->FindObject("mc_ND_all_pt_acc_prim_s_norm"));\r
1718 aFolderObj->Add(hsc);\r
1719\r
1720 hs = (TH1*)aFolderObj->FindObject("eta_rec_ND_trig_event_track_mult_eff_cont_corrected");\r
1721 hsc = (TH1D*)hs->Clone("ratio_eta_rec_to_mc_ND_trig_event_track_mult_eff_cont_corrected"); \r
1722 hsc->Sumw2();\r
1723 hsc->Divide((TH1*)aFolderObj->FindObject("mc_ND_all_eta_acc_prim"));\r
1724 aFolderObj->Add(hsc);\r
1725\r
1726 //\r
1727 hs = (TH1*)aFolderObj->FindObject("pt_rec_NSD_trig_event_track_mult_eff_cont_corrected_s_norm");\r
1728 hsc = (TH1D*)hs->Clone("ratio_pt_rec_to_mc_NSD_trig_event_track_mult_eff_cont_corrected"); \r
1729 hsc->Sumw2();\r
1730 hsc->Divide((TH1*)aFolderObj->FindObject("mc_NSD_all_pt_acc_prim_s_norm"));\r
1731 aFolderObj->Add(hsc);\r
1732\r
1733 hs = (TH1*)aFolderObj->FindObject("eta_rec_NSD_trig_event_track_mult_eff_cont_corrected");\r
1734 hsc = (TH1D*)hs->Clone("ratio_eta_rec_to_mc_NSD_trig_event_track_mult_eff_cont_corrected"); \r
1735 hsc->Sumw2();\r
1736 hsc->Divide((TH1*)aFolderObj->FindObject("mc_NSD_all_eta_acc_prim"));\r
1737 aFolderObj->Add(hsc);\r
1738\r
1739 //\r
1740 hs = (TH1*)aFolderObj->FindObject("pt_rec_event_track_mult_eff_cont_corrected_s_norm");\r
1741 hsc = (TH1D*)hs->Clone("ratio_pt_rec_to_mc_event_track_mult_eff_cont_corrected"); \r
1742 hsc->Sumw2();\r
1743 hsc->Divide((TH1*)aFolderObj->FindObject("mc_trigger_all_pt_acc_prim_s_norm"));\r
1744 aFolderObj->Add(hsc);\r
1745\r
1746 hs = (TH1*)aFolderObj->FindObject("eta_rec_event_track_mult_eff_cont_corrected");\r
1747 hsc = (TH1D*)hs->Clone("ratio_eta_rec_to_mc_event_track_mult_eff_cont_corrected"); \r
1748 hsc->Sumw2();\r
1749 hsc->Divide((TH1*)aFolderObj->FindObject("mc_trigger_all_eta_acc_prim"));\r
1750 aFolderObj->Add(hsc);\r
1751\r
1752 // track level\r
1753 hs = (TH1*)aFolderObj->FindObject("pt_rec_track_mult_eff_cont_corrected_s_norm");\r
1754 hsc = (TH1D*)hs->Clone("ratio_pt_rec_to_mc_track_mult_eff_cont_corrected"); \r
1755 hsc->Sumw2();\r
1756 hsc->Divide((TH1*)aFolderObj->FindObject("mc_all_pt_acc_trig_event_prim_s_norm"));\r
1757 aFolderObj->Add(hsc);\r
1758\r
1759 hs = (TH1*)aFolderObj->FindObject("eta_rec_track_mult_eff_cont_corrected");\r
1760 hsc = (TH1D*)hs->Clone("ratio_eta_rec_to_mc_track_mult_eff_cont_corrected"); \r
1761 hsc->Sumw2();\r
1762 hsc->Divide((TH1*)aFolderObj->FindObject("mc_all_eta_acc_trig_event_prim"));\r
1763 aFolderObj->Add(hsc);\r
1764\r
bad4ba69 1765 } // end MC infor available\r
1766\r
0aaa8b91 1767 // export objects to analysis folder\r
1768 fCorrectionFolder = ExportToFolder(aFolderObj);\r
1769\r
1770 // delete only TObjArray\r
1771 if(aFolderObj) delete aFolderObj;\r
1772}\r
1773\r
1774//_____________________________________________________________________________\r
c931948b 1775TFolder* AlidNdPtCorrection::ExportToFolder(TObjArray * const array) \r
0aaa8b91 1776{\r
1777 // recreate folder avery time and export objects to new one\r
1778 //\r
1779 AlidNdPtCorrection * comp=this;\r
1780 TFolder *folder = comp->GetCorrectionFolder();\r
1781\r
1782 TString name, title;\r
1783 TFolder *newFolder = 0;\r
1784 Int_t i = 0;\r
1785 Int_t size = array->GetSize();\r
1786\r
1787 if(folder) { \r
1788 // get name and title from old folder\r
1789 name = folder->GetName(); \r
1790 title = folder->GetTitle(); \r
1791\r
1792 // delete old one\r
1793 delete folder;\r
1794\r
1795 // create new one\r
1796 newFolder = CreateFolder(name.Data(),title.Data());\r
1797 newFolder->SetOwner();\r
1798\r
1799 // add objects to folder\r
1800 while(i < size) {\r
1801 newFolder->Add(array->At(i));\r
1802 i++;\r
1803 }\r
1804 }\r
1805\r
1806return newFolder;\r
1807}\r
1808\r
1809//_____________________________________________________________________________\r
1810TFolder* AlidNdPtCorrection::CreateFolder(TString name,TString title) { \r
1811// create folder for analysed histograms\r
1812//\r
1813TFolder *folder = 0;\r
1814 folder = new TFolder(name.Data(),title.Data());\r
1815\r
1816 return folder;\r
1817}\r