]>
Commit | Line | Data |
---|---|---|
3c538586 | 1 | /**************************************************************************\r |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r | |
3 | * *\r | |
4 | * Author: Ana Marin, Kathrin Koch, Kenneth Aamodt *\r | |
a19c3402 | 5 | * Version 1.1 *\r |
3c538586 | 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 | ////////////////////////////////////////////////\r | |
17 | //--------------------------------------------- \r | |
18 | // Class used to do analysis on conversion pairs\r | |
19 | //---------------------------------------------\r | |
20 | ////////////////////////////////////////////////\r | |
21 | \r | |
22 | #include "AliGammaConversionHistograms.h"\r | |
23 | #include "TMath.h"\r | |
24 | #include "TObjString.h"\r | |
25 | #include "TMap.h"\r | |
26 | #include "TList.h"\r | |
27 | #include "TH1F.h"\r | |
28 | #include "TH2F.h"\r | |
29 | \r | |
30 | \r | |
31 | using namespace std;\r | |
32 | \r | |
33 | ClassImp(AliGammaConversionHistograms)\r | |
34 | \r | |
35 | \r | |
36 | AliGammaConversionHistograms::AliGammaConversionHistograms() :\r | |
37 | fHistogramMap(new TMap()),\r | |
38 | fNPhiIndex(0),\r | |
39 | fNRIndex(0),\r | |
40 | fMinRadius(0.),\r | |
41 | fMaxRadius(0.),\r | |
42 | fDeltaR(0.),\r | |
43 | fMinPhi(0.),\r | |
44 | fMaxPhi(0.),\r | |
45 | fDeltaPhi(0.),\r | |
a19c3402 | 46 | fMappingContainer(NULL),\r |
47 | fBackgroundContainer(NULL),\r | |
48 | fDebugContainer(NULL),\r | |
49 | fResolutionContainer(NULL),\r | |
50 | fMatchContainer(NULL),\r | |
51 | fESDContainer(NULL),\r | |
52 | fMCContainer(NULL),\r | |
00a6a31a | 53 | fTableContainer(NULL), \r |
a19c3402 | 54 | fOtherContainer(NULL)\r |
3c538586 | 55 | {\r |
56 | // see header file for documenation\r | |
57 | }\r | |
58 | \r | |
59 | \r | |
60 | AliGammaConversionHistograms::AliGammaConversionHistograms(const AliGammaConversionHistograms & original) :\r | |
61 | fHistogramMap(original.fHistogramMap),\r | |
62 | fNPhiIndex(original.fNPhiIndex),\r | |
63 | fNRIndex(original.fNRIndex),\r | |
64 | fMinRadius(original.fMinRadius),\r | |
65 | fMaxRadius(original.fMaxRadius),\r | |
66 | fDeltaR(original.fDeltaR),\r | |
67 | fMinPhi(original.fMinPhi),\r | |
68 | fMaxPhi(original.fMaxPhi),\r | |
69 | fDeltaPhi(original.fDeltaPhi),\r | |
a19c3402 | 70 | fMappingContainer(original.fMappingContainer),\r |
71 | fBackgroundContainer(original.fBackgroundContainer),\r | |
72 | fDebugContainer(original.fDebugContainer),\r | |
73 | fResolutionContainer(original.fResolutionContainer),\r | |
74 | fMatchContainer(original.fMatchContainer),\r | |
75 | fESDContainer(original.fESDContainer),\r | |
76 | fMCContainer(original.fMCContainer),\r | |
00a6a31a | 77 | fTableContainer(original.fTableContainer), \r |
a19c3402 | 78 | fOtherContainer(original.fOtherContainer)\r |
3c538586 | 79 | { \r |
80 | //see header file for documentation\r | |
81 | }\r | |
82 | \r | |
83 | \r | |
84 | AliGammaConversionHistograms & AliGammaConversionHistograms::operator = (const AliGammaConversionHistograms & /*original*/)\r | |
85 | {\r | |
86 | // assignment operator\r | |
87 | return *this;\r | |
88 | }\r | |
89 | \r | |
90 | \r | |
91 | AliGammaConversionHistograms::~AliGammaConversionHistograms() {\r | |
92 | //destructor\r | |
32a6d407 | 93 | \r |
94 | \r | |
3c538586 | 95 | }\r |
96 | \r | |
97 | void AliGammaConversionHistograms::AddHistogram(TString histogramName, TString histogramTitle, Int_t nXBins, Double_t firstX,Double_t lastX,TString xAxisTitle, TString yAxisTitle){\r | |
98 | // see header file for documentation\r | |
99 | TH1F *tmp = new TH1F(histogramName, histogramTitle,nXBins,firstX,lastX);\r | |
100 | tmp->GetXaxis()->SetTitle(xAxisTitle);\r | |
101 | tmp->GetYaxis()->SetTitle(yAxisTitle);\r | |
102 | TObjString* tobjstring = new TObjString(histogramName.Data());\r | |
103 | fHistogramMap->Add((TObject*)tobjstring,(TObject*)tmp);\r | |
104 | }\r | |
105 | \r | |
106 | void AliGammaConversionHistograms::AddHistogram(TString histogramName, TString histogramTitle, Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle){\r | |
107 | // see header file for documentation\r | |
108 | TH2F *tmp = new TH2F(histogramName, histogramTitle,nXBins,firstX,lastX,nYBins,firstY,lastY);\r | |
109 | tmp->GetXaxis()->SetTitle(xAxisTitle);\r | |
110 | tmp->GetYaxis()->SetTitle(yAxisTitle);\r | |
111 | TObjString *tobjstring = new TObjString(histogramName.Data());\r | |
112 | fHistogramMap->Add((TObject*)tobjstring,(TObject*)tmp);\r | |
113 | }\r | |
114 | \r | |
00a6a31a | 115 | void AliGammaConversionHistograms::AddTable(TString tableName,TString tableTitle,Int_t nXBins,const char * axesLabel[]){\r |
116 | \r | |
117 | \r | |
118 | TH1F *tmp = new TH1F(tableName,tableTitle,nXBins,0,nXBins);\r | |
119 | for(Int_t xbin=1; xbin<=nXBins; xbin++){\r | |
120 | tmp->GetXaxis()->SetBinLabel(xbin,axesLabel[xbin-1]);\r | |
121 | }\r | |
122 | tmp->SetStats(0);\r | |
123 | \r | |
124 | TObjString *tobjstring = new TObjString(tableName.Data());\r | |
125 | fHistogramMap->Add((TObject*)tobjstring,(TObject*)tmp);\r | |
126 | }\r | |
127 | \r | |
128 | void AliGammaConversionHistograms::FillTable(TString tableName,Double_t xValue) const {\r | |
129 | TH1 *tmp = (TH1*)fHistogramMap->GetValue(tableName.Data());\r | |
130 | if(tmp){\r | |
131 | tmp->Fill(xValue);\r | |
132 | }\r | |
133 | }\r | |
134 | \r | |
3c538586 | 135 | void AliGammaConversionHistograms::FillHistogram(TString histogramName, Double_t xValue) const{\r |
136 | //see header file for documentation\r | |
137 | TH1 *tmp = (TH1*)fHistogramMap->GetValue(histogramName.Data());\r | |
138 | if(tmp){\r | |
32a6d407 | 139 | tmp->Fill(xValue);\r |
3c538586 | 140 | }\r |
3c538586 | 141 | }\r |
142 | \r | |
143 | void AliGammaConversionHistograms::FillHistogram(TString histogramName, Double_t xValue, Double_t yValue) const{\r | |
144 | //see header file for documentation\r | |
145 | TH1 *tmp = (TH1*)fHistogramMap->GetValue(histogramName.Data());\r | |
146 | if(tmp){\r | |
147 | tmp->Fill(xValue, yValue);\r | |
148 | }\r | |
3c538586 | 149 | }\r |
150 | \r | |
151 | void AliGammaConversionHistograms::GetOutputContainer(TList *fOutputContainer){\r | |
152 | //checking if the container is alrerady created\r | |
32a6d407 | 153 | \r |
3c538586 | 154 | if(fOutputContainer == NULL){\r |
155 | //print warning\r | |
156 | return;\r | |
157 | }\r | |
32a6d407 | 158 | \r |
3c538586 | 159 | if(fHistogramMap != NULL){\r |
160 | TIter iter(fHistogramMap);\r | |
161 | TObjString *histogramName;\r | |
162 | while ((histogramName = (TObjString*) iter.Next())) {\r | |
163 | TString histogramString = histogramName->GetString();\r | |
164 | if(histogramString.Contains("Mapping")){// means it should be put in the mapping folder\r | |
165 | if(fMappingContainer == NULL){\r | |
166 | fMappingContainer = new TList();\r | |
167 | fMappingContainer->SetName("Mapping histograms");\r | |
168 | }\r | |
169 | if(fMappingContainer != NULL){\r | |
170 | fMappingContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));\r | |
171 | }\r | |
172 | }\r | |
a19c3402 | 173 | else if(histogramString.Contains("Background")){// means it should be put in the background folder\r |
174 | if(fBackgroundContainer == NULL){\r | |
175 | fBackgroundContainer = new TList();\r | |
176 | fBackgroundContainer->SetName("Background histograms");\r | |
177 | }\r | |
178 | if(fBackgroundContainer != NULL){\r | |
179 | fBackgroundContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));\r | |
180 | }\r | |
181 | }\r | |
182 | else if(histogramString.Contains("Debug")){// means it should be put in the debug folder\r | |
183 | if(fDebugContainer == NULL){\r | |
184 | fDebugContainer = new TList();\r | |
185 | fDebugContainer->SetName("Debug histograms");\r | |
186 | }\r | |
187 | if(fDebugContainer != NULL){\r | |
188 | fDebugContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));\r | |
189 | }\r | |
190 | }\r | |
191 | else if(histogramString.Contains("Resolution")){// means it should be put in the resolution folder\r | |
192 | if(fResolutionContainer == NULL){\r | |
193 | fResolutionContainer = new TList();\r | |
194 | fResolutionContainer->SetName("Resolution histograms");\r | |
195 | }\r | |
196 | if(fResolutionContainer != NULL){\r | |
197 | fResolutionContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));\r | |
198 | }\r | |
199 | }\r | |
200 | else if(histogramString.Contains("Match")){// means it should be put in the mapping folder\r | |
201 | if(fMatchContainer == NULL){\r | |
202 | fMatchContainer = new TList();\r | |
203 | fMatchContainer->SetName("Match histograms");\r | |
204 | }\r | |
205 | if(fMatchContainer != NULL){\r | |
206 | fMatchContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));\r | |
207 | }\r | |
208 | }\r | |
209 | else if(histogramString.Contains("ESD")){// means it should be put in the ESD folder\r | |
210 | if(fESDContainer == NULL){\r | |
211 | fESDContainer = new TList();\r | |
212 | fESDContainer->SetName("ESD histograms");\r | |
213 | }\r | |
214 | if(fESDContainer != NULL){\r | |
215 | fESDContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));\r | |
216 | }\r | |
217 | }\r | |
218 | else if(histogramString.Contains("MC")){// means it should be put in the MC folder\r | |
219 | if(fMCContainer == NULL){\r | |
220 | fMCContainer = new TList();\r | |
221 | fMCContainer->SetName("MC histograms");\r | |
222 | }\r | |
223 | if(fMCContainer != NULL){\r | |
224 | fMCContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));\r | |
225 | }\r | |
226 | }\r | |
00a6a31a | 227 | else if(histogramString.Contains("Table")){// means it should be put in the Table Folder\r |
228 | if(fTableContainer == NULL){\r | |
229 | fTableContainer = new TList();\r | |
230 | fTableContainer->SetName("Tables");\r | |
231 | }\r | |
232 | if(fTableContainer != NULL){\r | |
233 | fTableContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));\r | |
234 | }\r | |
235 | } \r | |
a19c3402 | 236 | else{\r |
237 | if(fOtherContainer == NULL){\r | |
238 | fOtherContainer = new TList();\r | |
239 | fOtherContainer->SetName("Other histograms");\r | |
240 | }\r | |
241 | if(fOtherContainer != NULL){\r | |
242 | fOtherContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));\r | |
243 | }\r | |
244 | }\r | |
3c538586 | 245 | histogramName = NULL;\r |
246 | } // end while\r | |
a19c3402 | 247 | if(fMappingContainer != NULL){\r |
248 | fOutputContainer->Add(fMappingContainer);\r | |
249 | }\r | |
250 | if(fBackgroundContainer != NULL){\r | |
251 | fOutputContainer->Add(fBackgroundContainer);\r | |
252 | }\r | |
253 | if(fDebugContainer != NULL){\r | |
254 | fOutputContainer->Add(fDebugContainer);\r | |
255 | }\r | |
256 | if(fResolutionContainer != NULL){\r | |
257 | fOutputContainer->Add(fResolutionContainer);\r | |
258 | }\r | |
259 | if(fMatchContainer != NULL){\r | |
260 | fOutputContainer->Add(fMatchContainer);\r | |
261 | }\r | |
262 | if(fESDContainer != NULL){\r | |
263 | fOutputContainer->Add(fESDContainer);\r | |
264 | }\r | |
265 | if(fMCContainer != NULL){\r | |
266 | fOutputContainer->Add(fMCContainer);\r | |
267 | }\r | |
00a6a31a | 268 | if(fTableContainer != NULL){\r |
269 | fOutputContainer->Add(fTableContainer); \r | |
270 | } \r | |
a19c3402 | 271 | if(fOtherContainer != NULL){\r |
272 | fOutputContainer->Add(fMCContainer);\r | |
273 | }\r | |
3c538586 | 274 | }\r |
275 | }\r | |
276 | \r | |
277 | Int_t AliGammaConversionHistograms::GetRBin(Double_t radius) const{\r | |
278 | // see header file for documentation\r | |
279 | Int_t iResult=0;\r | |
280 | if(fDeltaR>0){\r | |
281 | iResult = (Int_t)((radius - fMinRadius)/fDeltaR);\r | |
282 | }\r | |
283 | return iResult;\r | |
284 | }\r | |
285 | \r | |
286 | Int_t AliGammaConversionHistograms::GetPhiBin(Double_t phi) const{\r | |
287 | // see header file for documentation\r | |
288 | Int_t iResult=0;\r | |
289 | if(fDeltaPhi>0){\r | |
290 | if(phi>TMath::Pi()){\r | |
291 | phi-=2*TMath::Pi();\r | |
292 | }\r | |
293 | iResult = (Int_t)((phi - fMinPhi)/fDeltaPhi);\r | |
294 | }\r | |
295 | return iResult;\r | |
296 | }\r | |
297 | \r | |
298 | \r | |
299 | \r | |
300 | void AliGammaConversionHistograms::InitializeMappingValues(Int_t nPhiIndex, Int_t nRIndex, Int_t nBinsR, Double_t minRadius, Double_t maxRadius,Int_t nBinsPhi, Double_t minPhi, Double_t maxPhi){\r | |
301 | // Initializing the valuse for the mapping\r | |
32a6d407 | 302 | \r |
3c538586 | 303 | fNPhiIndex = nPhiIndex;\r |
304 | fNRIndex = nRIndex;\r | |
305 | fMinRadius = minRadius;\r | |
306 | fMaxRadius = maxRadius;\r | |
307 | if(nBinsR>0 && nRIndex!=0){\r | |
308 | fDeltaR = (fMaxRadius - fMinRadius)/nRIndex;\r | |
309 | }\r | |
310 | fMinPhi = minPhi;\r | |
311 | fMaxPhi = maxPhi;\r | |
312 | if(nBinsPhi>0 && nPhiIndex!=0){\r | |
313 | fDeltaPhi = (fMaxPhi-fMinPhi)/nPhiIndex;\r | |
314 | }\r | |
315 | }\r | |
316 | \r | |
317 | \r | |
318 | //mapping\r | |
319 | void AliGammaConversionHistograms::AddMappingHistograms(Int_t nPhiIndex, Int_t nRIndex,Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle){\r | |
320 | // see header file for documentation\r | |
32a6d407 | 321 | \r |
3c538586 | 322 | for(Int_t phi =0; phi<=fNPhiIndex;phi++){\r |
32a6d407 | 323 | \r |
3c538586 | 324 | for(Int_t r =0; r<fNRIndex;r++){\r |
32a6d407 | 325 | \r |
3c538586 | 326 | // setting axis to "" changes below\r |
327 | xAxisTitle="";\r | |
328 | yAxisTitle="";\r | |
329 | //Creating the axis titles\r | |
330 | if(xAxisTitle.Length() == 0){\r | |
331 | xAxisTitle.Form("Phi %02d",phi);\r | |
332 | }\r | |
32a6d407 | 333 | \r |
3c538586 | 334 | if(yAxisTitle.Length() == 0){\r |
335 | yAxisTitle.Form("R %02d",phi);\r | |
336 | }\r | |
32a6d407 | 337 | \r |
3c538586 | 338 | //MC\r |
339 | TString nameMC="";\r | |
32a6d407 | 340 | nameMC.Form("MC_Conversion_Mapping-Phi%02d-R%02d",phi,r);\r |
3c538586 | 341 | TString titleMC="";\r |
342 | titleMC.Form("Electron-Positron MC Mapping-Phi%02d-R%02d",phi,r);\r | |
32a6d407 | 343 | \r |
3c538586 | 344 | AddHistogram(nameMC, titleMC, nXBins, firstX, lastX, nYBins, firstY, lastY, xAxisTitle, yAxisTitle);\r |
32a6d407 | 345 | \r |
3c538586 | 346 | //ESD\r |
347 | TString nameESD="";\r | |
32a6d407 | 348 | nameESD.Form("ESD_Conversion_Mapping-Phi%02d-R%02d",phi,r);\r |
3c538586 | 349 | TString titleESD="";\r |
350 | titleESD.Form("Electron-Positron ESD Mapping-Phi%02d-R%02d",phi,r);\r | |
32a6d407 | 351 | \r |
3c538586 | 352 | AddHistogram(nameESD, titleESD, nXBins, firstX, lastX, nYBins, firstY, lastY, xAxisTitle, yAxisTitle);\r |
353 | }\r | |
354 | }\r | |
32a6d407 | 355 | \r |
356 | \r | |
3c538586 | 357 | for(Int_t phi =0; phi<=nPhiIndex;phi++){ \r |
32a6d407 | 358 | \r |
3c538586 | 359 | // setting axis to "" changes below\r |
360 | xAxisTitle="";\r | |
361 | yAxisTitle="";\r | |
362 | //Creating the axis titles\r | |
363 | if(xAxisTitle.Length() == 0){\r | |
364 | xAxisTitle.Form("Phi %02d",phi);\r | |
365 | }\r | |
366 | if(yAxisTitle.Length() == 0){\r | |
367 | yAxisTitle = "Counts";\r | |
368 | }\r | |
32a6d407 | 369 | \r |
3c538586 | 370 | //MC\r |
371 | TString nameMC="";\r | |
32a6d407 | 372 | nameMC.Form("MC_Conversion_Mapping-Phi%02d",phi);\r |
3c538586 | 373 | TString titleMC="";\r |
374 | titleMC.Form("Electron-Positron MC Mapping-Phi%02d",phi);\r | |
32a6d407 | 375 | \r |
3c538586 | 376 | AddHistogram(nameMC, titleMC, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);\r |
32a6d407 | 377 | \r |
3c538586 | 378 | //MC\r |
379 | TString nameESD="";\r | |
32a6d407 | 380 | nameESD.Form("ESD_Conversion_Mapping-Phi%02d",phi);\r |
3c538586 | 381 | TString titleESD="";\r |
382 | titleESD.Form("Electron-Positron ESD Mapping-Phi%02d",phi);\r | |
32a6d407 | 383 | \r |
3c538586 | 384 | AddHistogram(nameESD, titleESD, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);\r |
385 | }\r | |
32a6d407 | 386 | \r |
387 | \r | |
3c538586 | 388 | for(Int_t r =0; r<=nRIndex;r++){\r |
32a6d407 | 389 | \r |
3c538586 | 390 | // setting axis to "" changes below\r |
391 | xAxisTitle="";\r | |
392 | yAxisTitle="";\r | |
393 | //Creating the axis titles\r | |
394 | if(xAxisTitle.Length() == 0){\r | |
395 | xAxisTitle.Form("R %02d",r);\r | |
396 | }\r | |
397 | if(yAxisTitle.Length() == 0){\r | |
398 | yAxisTitle = "Counts";\r | |
399 | }\r | |
32a6d407 | 400 | \r |
3c538586 | 401 | //MC\r |
402 | TString nameMC="";\r | |
32a6d407 | 403 | nameMC.Form("MC_Conversion_Mapping-R%02d",r);\r |
3c538586 | 404 | TString titleMC="";\r |
405 | titleMC.Form("Electron-Positron MC Mapping-R%02d",r);\r | |
32a6d407 | 406 | \r |
3c538586 | 407 | AddHistogram(nameMC, titleMC, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);\r |
32a6d407 | 408 | \r |
3c538586 | 409 | //ESD\r |
410 | TString nameESD="";\r | |
32a6d407 | 411 | nameESD.Form("ESD_Conversion_Mapping-R%02d",r);\r |
3c538586 | 412 | TString titleESD="";\r |
413 | titleESD.Form("Electron-Positron ESD Mapping-R%02d",r);\r | |
32a6d407 | 414 | \r |
3c538586 | 415 | AddHistogram(nameESD, titleESD, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);\r |
32a6d407 | 416 | \r |
3c538586 | 417 | //Mapping Phi in R\r |
418 | TString nameMCPhiInR="";\r | |
32a6d407 | 419 | nameMCPhiInR.Form("MC_Conversion_Mapping_Phi_R-%02d",r);\r |
3c538586 | 420 | TString titleMCPhiInR="";\r |
421 | titleMCPhiInR.Form("MC Mapping of Phi in R%02d",r);\r | |
422 | AddHistogram(nameMCPhiInR, titleMCPhiInR, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);\r | |
32a6d407 | 423 | \r |
3c538586 | 424 | //Mapping Phi in R\r |
425 | TString nameESDPhiInR="";\r | |
32a6d407 | 426 | nameESDPhiInR.Form("ESD_Conversion_Mapping_Phi_R-%02d",r);\r |
3c538586 | 427 | TString titleESDPhiInR="";\r |
428 | titleESDPhiInR.Form("ESD Mapping of Phi in R%02d",r);\r | |
429 | AddHistogram(nameESDPhiInR, titleESDPhiInR, nXBins, firstX, lastX, xAxisTitle, yAxisTitle); \r | |
430 | }\r | |
431 | }\r |