]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - PHOS/PHOSbase/AliPHOSEmcCalibData.cxx
ALIROOT-5769: Better handling of the error (R. Preghenella)
[u/mrichter/AliRoot.git] / PHOS / PHOSbase / AliPHOSEmcCalibData.cxx
... / ...
CommitLineData
1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 for PHOS EmCal calibration //
19// //
20///////////////////////////////////////////////////////////////////////////////
21
22#include "AliPHOSEmcCalibData.h"
23
24ClassImp(AliPHOSEmcCalibData)
25
26//________________________________________________________________
27AliPHOSEmcCalibData::AliPHOSEmcCalibData():
28 TNamed(),
29 fSampleTimeStep(0)
30{
31 // Default constructor
32 Reset();
33}
34
35//________________________________________________________________
36AliPHOSEmcCalibData::AliPHOSEmcCalibData(const char* name):
37 TNamed(),
38 fSampleTimeStep(0)
39{
40 // Constructor
41 TString namst = "Calib_";
42 namst += name;
43 SetName(namst.Data());
44 SetTitle(namst.Data());
45 Reset();
46}
47
48//________________________________________________________________
49AliPHOSEmcCalibData::AliPHOSEmcCalibData(const AliPHOSEmcCalibData& calibda) :
50 TNamed(calibda),
51 fSampleTimeStep(calibda.fSampleTimeStep)
52{
53 // copy constructor
54 SetName(calibda.GetName());
55 SetTitle(calibda.GetName());
56
57 for(Int_t module=0; module<5; module++) {
58 for(Int_t column=0; column<56; column++) {
59 for(Int_t row=0; row<64; row++) {
60 fADCchannelEmc[module][column][row] = calibda.fADCchannelEmc[module][column][row];
61 fADCpedestalEmc[module][column][row] = calibda.fADCpedestalEmc[module][column][row];
62 fHighLowRatioEmc[module][column][row] = calibda.fHighLowRatioEmc[module][column][row];
63 fTimeShiftEmc[module][column][row] = calibda.fTimeShiftEmc[module][column][row];
64 fLGTimeShiftEmc[module][column][row] = calibda.fLGTimeShiftEmc[module][column][row];
65 fAltroOffsets[module][column][row] = calibda.fAltroOffsets[module][column][row];
66 fDecal[module][column][row] = calibda.fDecal[module][column][row];
67 }
68 }
69 }
70}
71
72//________________________________________________________________
73AliPHOSEmcCalibData &AliPHOSEmcCalibData::operator =(const AliPHOSEmcCalibData& calibda)
74{
75 // assignment operator
76
77 if(this != &calibda) {
78
79 SetName(calibda.GetName());
80 SetTitle(calibda.GetName());
81
82 for(Int_t module=0; module<5; module++) {
83 for(Int_t column=0; column<56; column++) {
84 for(Int_t row=0; row<64; row++) {
85 fADCchannelEmc[module][column][row] = calibda.fADCchannelEmc[module][column][row];
86 fADCpedestalEmc[module][column][row] = calibda.fADCpedestalEmc[module][column][row];
87 fHighLowRatioEmc[module][column][row] = calibda.fHighLowRatioEmc[module][column][row];
88 fTimeShiftEmc[module][column][row] = calibda.fTimeShiftEmc[module][column][row];
89 fLGTimeShiftEmc[module][column][row] = calibda.fLGTimeShiftEmc[module][column][row];
90 fAltroOffsets[module][column][row] = calibda.fAltroOffsets[module][column][row];
91 fDecal[module][column][row] = calibda.fDecal[module][column][row];
92 }
93 }
94 }
95 }
96
97 return *this;
98}
99
100//________________________________________________________________
101AliPHOSEmcCalibData::~AliPHOSEmcCalibData()
102{
103 // Destructor
104}
105
106//________________________________________________________________
107void AliPHOSEmcCalibData::Reset()
108{
109 // Set all pedestals and all ADC channels to its ideal values = 5. (MeV/ADC)
110
111 for (Int_t module=0; module<5; module++){
112 for (Int_t column=0; column<56; column++){
113 for (Int_t row=0; row<64; row++){
114 fADCpedestalEmc[module][column][row] = 0.;
115 fADCchannelEmc[module][column][row] = 0.005;
116 fHighLowRatioEmc[module][column][row] = 16. ;
117 fTimeShiftEmc[module][column][row] = 0. ;
118 fLGTimeShiftEmc[module][column][row] = 0. ;
119 fAltroOffsets[module][column][row] = 0 ;
120 fDecal[module][column][row] = 1.;
121 }
122 }
123 }
124 fSampleTimeStep=100.e-9 ; //100 ns
125}
126
127//________________________________________________________________
128void AliPHOSEmcCalibData::Print(Option_t *option) const
129{
130 // Print tables of pedestals and ADC channels
131
132 if (strstr(option,"ped")) {
133 printf("\n ---- EMC Pedestal values ----\n\n");
134 for (Int_t module=0; module<5; module++){
135 printf("============== Module %d\n",module+1);
136 for (Int_t column=0; column<56; column++){
137 for (Int_t row=0; row<64; row++){
138 printf("%4.1f",fADCpedestalEmc[module][column][row]);
139 }
140 printf("\n");
141 }
142 }
143 }
144
145 if (strstr(option,"gain")) {
146 printf("\n ---- EMC ADC channel values ----\n\n");
147 for (Int_t module=0; module<5; module++){
148 printf("============== Module %d\n",module+1);
149 for (Int_t column=0; column<56; column++){
150 for (Int_t row=0; row<64; row++){
151 printf("%4.1f",fADCchannelEmc[module][column][row]);
152 }
153 printf("\n");
154 }
155 }
156 }
157
158 if (strstr(option,"hilo")) {
159 printf("\n ---- EMC High/Low ratio ----\n\n");
160 for (Int_t module=0; module<5; module++){
161 printf("============== Module %d\n",module+1);
162 for (Int_t column=0; column<56; column++){
163 for (Int_t row=0; row<64; row++){
164 printf("%4.1f",fHighLowRatioEmc[module][column][row]);
165 }
166 printf("\n");
167 }
168 }
169 }
170 if (strstr(option,"time")) {
171 printf("\n ---- EMC t0 shifts ----\n\n");
172 for (Int_t module=0; module<5; module++){
173 printf("============== Module %d\n",module+1);
174 for (Int_t column=0; column<56; column++){
175 for (Int_t row=0; row<64; row++){
176 printf("%6.3e (%6.3e)",fTimeShiftEmc[module][column][row],fLGTimeShiftEmc[module][column][row]);
177 }
178 printf("\n");
179 }
180 }
181 }
182 if (strstr(option,"altro")) {
183 printf("\n ---- EMC altro offsets ----\n\n");
184 for (Int_t module=0; module<5; module++){
185 printf("============== Module %d\n",module+1);
186 for (Int_t column=0; column<56; column++){
187 for (Int_t row=0; row<64; row++){
188 printf("%5d",fAltroOffsets[module][column][row]);
189 }
190 printf("\n");
191 }
192 }
193 }
194}
195
196//________________________________________________________________
197Float_t AliPHOSEmcCalibData::GetADCchannelEmc(Int_t module, Int_t column, Int_t row) const
198{
199 //Return EMC calibration coefficient
200 //module, column,raw should follow the internal PHOS convention:
201 //module 1:5, column 1:56, row 1:64
202
203 return fADCchannelEmc[module-1][column-1][row-1];
204}
205
206//________________________________________________________________
207Float_t AliPHOSEmcCalibData::GetADCpedestalEmc(Int_t module, Int_t column, Int_t row) const
208{
209 //Return EMC pedestal
210 //module, column,raw should follow the internal PHOS convention:
211 //module 1:5, column 1:56, row 1:64
212
213 return fADCpedestalEmc[module-1][column-1][row-1];
214}
215
216//________________________________________________________________
217Float_t AliPHOSEmcCalibData::GetHighLowRatioEmc(Int_t module, Int_t column, Int_t row) const
218{
219 //Return EMC pedestal
220 //module, column,raw should follow the internal PHOS convention:
221 //module 1:5, column 1:56, row 1:64
222
223 return fHighLowRatioEmc[module-1][column-1][row-1];
224}
225
226//________________________________________________________________
227Float_t AliPHOSEmcCalibData::GetTimeShiftEmc(Int_t module, Int_t column, Int_t row) const
228{
229 //Return EMC time offset for high gain channel
230 //module, column,raw should follow the internal PHOS convention:
231 //module 1:5, column 1:56, row 1:64
232
233 return fTimeShiftEmc[module-1][column-1][row-1];
234}
235//________________________________________________________________
236Float_t AliPHOSEmcCalibData::GetLGTimeShiftEmc(Int_t module, Int_t column, Int_t row) const
237{
238 //Return EMC time offset for LowGain channel
239 //module, column,raw should follow the internal PHOS convention:
240 //module 1:5, column 1:56, row 1:64
241
242 return fLGTimeShiftEmc[module-1][column-1][row-1];
243}
244//________________________________________________________________
245Float_t AliPHOSEmcCalibData::GetSampleTimeStep()const
246{
247 //Returns conversion coefficient from ALTRO smaple time step and secods
248 //Negative value not used in reconstruction (conversion taken from TRU trailer)
249 //and only in raw simulation
250 return fSampleTimeStep ;
251}
252//________________________________________________________________
253Int_t AliPHOSEmcCalibData::GetAltroOffsetEmc(Int_t module, Int_t column, Int_t row) const
254{
255 //Return EMC altro offsets
256 //module, column,raw should follow the internal PHOS convention:
257 //module 1:5, column 1:56, row 1:64
258
259 return fAltroOffsets[module-1][column-1][row-1];
260}
261//________________________________________________________________
262void AliPHOSEmcCalibData::SetADCchannelEmc(Int_t module, Int_t column, Int_t row, Float_t value)
263{
264 //Set EMC calibration coefficient
265 //module, column,raw should follow the internal PHOS convention:
266 //module 1:5, column 1:56, row 1:64
267
268 fADCchannelEmc[module-1][column-1][row-1] = value;
269}
270
271//________________________________________________________________
272void AliPHOSEmcCalibData::SetADCpedestalEmc(Int_t module, Int_t column, Int_t row, Float_t value)
273{
274 //Set EMC pedestal
275 //module, column,raw should follow the internal PHOS convention:
276 //module 1:5, column 1:56, row 1:64
277 fADCpedestalEmc[module-1][column-1][row-1] = value;
278}
279
280//________________________________________________________________
281void AliPHOSEmcCalibData::SetHighLowRatioEmc(Int_t module, Int_t column, Int_t row, Float_t value)
282{
283 //Set EMC pedestal
284 //module, column,raw should follow the internal PHOS convention:
285 //module 1:5, column 1:56, row 1:64
286 fHighLowRatioEmc[module-1][column-1][row-1] = value;
287}
288//________________________________________________________________
289void AliPHOSEmcCalibData::SetTimeShiftEmc(Int_t module, Int_t column, Int_t row, Float_t value)
290{
291 //Set EMC time offset for high gain channel
292 //module, column,raw should follow the internal PHOS convention:
293 //module 1:5, column 1:56, row 1:64
294 fTimeShiftEmc[module-1][column-1][row-1] = value;
295}
296//________________________________________________________________
297void AliPHOSEmcCalibData::SetLGTimeShiftEmc(Int_t module, Int_t column, Int_t row, Float_t value)
298{
299 //Set EMC time offset for low gain channel
300 //module, column,raw should follow the internal PHOS convention:
301 //module 1:5, column 1:56, row 1:64
302 fLGTimeShiftEmc[module-1][column-1][row-1] = value;
303}
304//________________________________________________________________
305void AliPHOSEmcCalibData::SetAltroOffsetEmc(Int_t module, Int_t column, Int_t row, Int_t value)
306{
307 //Set EMC pedestal
308 //module, column,raw should follow the internal PHOS convention:
309 //module 1:5, column 1:56, row 1:64
310 fAltroOffsets[module-1][column-1][row-1] = value;
311}
312//________________________________________________________________
313void AliPHOSEmcCalibData::SetSampleTimeStep(Float_t step)
314{
315 //Sets conversion coefficient from ALTRO smaple time step and secods
316 //Negative value not used in reconstruction (conversion taken from TRU trailer)
317 //and only in raw simulation
318 fSampleTimeStep = step ;
319}
320
321//________________________________________________________________
322Float_t AliPHOSEmcCalibData::GetADCchannelEmcDecalib(Int_t module, Int_t column, Int_t row) const
323{
324 //Return EMC random (de)calibration coefficient O(1). Used in simulation.
325 //module, column,raw should follow the internal PHOS convention:
326 //module 1:5, column 1:56, row 1:64
327
328 return fDecal[module-1][column-1][row-1];
329}
330
331void AliPHOSEmcCalibData::SetADCchannelEmcDecalib(Int_t module, Int_t column, Int_t row, Float_t value)
332{
333 //Set EMC (de)calibration coefficient O(1). Used in simulation.
334 //module, column,raw should follow the internal PHOS convention:
335 //module 1:5, column 1:56, row 1:64
336
337 fDecal[module-1][column-1][row-1] = value;
338}