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