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