Updating limits to cope both with p-A and A-p ZDC timing
[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];
f1731579 64 fLGTimeShiftEmc[module][column][row] = calibda.fLGTimeShiftEmc[module][column][row];
bafc1087 65 fAltroOffsets[module][column][row] = calibda.fAltroOffsets[module][column][row];
d5b302a6 66 fDecal[module][column][row] = calibda.fDecal[module][column][row];
fc6706cb 67 }
68 }
69 }
70}
71
72//________________________________________________________________
73AliPHOSEmcCalibData &AliPHOSEmcCalibData::operator =(const AliPHOSEmcCalibData& calibda)
74{
75 // assignment operator
27f8cf68 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];
e3310625 87 fHighLowRatioEmc[module][column][row] = calibda.fHighLowRatioEmc[module][column][row];
88 fTimeShiftEmc[module][column][row] = calibda.fTimeShiftEmc[module][column][row];
f1731579 89 fLGTimeShiftEmc[module][column][row] = calibda.fLGTimeShiftEmc[module][column][row];
d5b302a6 90 fAltroOffsets[module][column][row] = calibda.fAltroOffsets[module][column][row];
91 fDecal[module][column][row] = calibda.fDecal[module][column][row];
27f8cf68 92 }
fc6706cb 93 }
94 }
95 }
27f8cf68 96
fc6706cb 97 return *this;
98}
99
100//________________________________________________________________
101AliPHOSEmcCalibData::~AliPHOSEmcCalibData()
102{
103 // Destructor
104}
105
106//________________________________________________________________
107void AliPHOSEmcCalibData::Reset()
108{
e3310625 109 // Set all pedestals and all ADC channels to its ideal values = 5. (MeV/ADC)
fc6706cb 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++){
72e5feac 114 fADCpedestalEmc[module][column][row] = 0.;
e3310625 115 fADCchannelEmc[module][column][row] = 0.005;
116 fHighLowRatioEmc[module][column][row] = 16. ;
117 fTimeShiftEmc[module][column][row] = 0. ;
f1731579 118 fLGTimeShiftEmc[module][column][row] = 0. ;
bafc1087 119 fAltroOffsets[module][column][row] = 0 ;
d5b302a6 120 fDecal[module][column][row] = 1.;
fc6706cb 121 }
122 }
123 }
6f47f50d 124 fSampleTimeStep=100.e-9 ; //100 ns
fc6706cb 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 }
e3310625 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++){
f1731579 176 printf("%6.3e (%6.3e)",fTimeShiftEmc[module][column][row],fLGTimeShiftEmc[module][column][row]);
e3310625 177 }
178 printf("\n");
179 }
180 }
181 }
bafc1087 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 }
fc6706cb 194}
195
1fdb1c5e 196//________________________________________________________________
fc6706cb 197Float_t AliPHOSEmcCalibData::GetADCchannelEmc(Int_t module, Int_t column, Int_t row) const
198{
1fdb1c5e 199 //Return EMC calibration coefficient
fc6706cb 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
1fdb1c5e 206//________________________________________________________________
fc6706cb 207Float_t AliPHOSEmcCalibData::GetADCpedestalEmc(Int_t module, Int_t column, Int_t row) const
208{
1fdb1c5e 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
fc6706cb 213 return fADCpedestalEmc[module-1][column-1][row-1];
214}
215
1fdb1c5e 216//________________________________________________________________
e3310625 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{
f1731579 229 //Return EMC time offset for high gain channel
e3310625 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}
bafc1087 235//________________________________________________________________
f1731579 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//________________________________________________________________
6f47f50d 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//________________________________________________________________
bafc1087 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}
e3310625 261//________________________________________________________________
fc6706cb 262void AliPHOSEmcCalibData::SetADCchannelEmc(Int_t module, Int_t column, Int_t row, Float_t value)
263{
1fdb1c5e 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
fc6706cb 268 fADCchannelEmc[module-1][column-1][row-1] = value;
269}
270
1fdb1c5e 271//________________________________________________________________
fc6706cb 272void AliPHOSEmcCalibData::SetADCpedestalEmc(Int_t module, Int_t column, Int_t row, Float_t value)
273{
1fdb1c5e 274 //Set EMC pedestal
275 //module, column,raw should follow the internal PHOS convention:
276 //module 1:5, column 1:56, row 1:64
fc6706cb 277 fADCpedestalEmc[module-1][column-1][row-1] = value;
278}
e3310625 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{
f1731579 291 //Set EMC time offset for high gain channel
e3310625 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}
bafc1087 296//________________________________________________________________
f1731579 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//________________________________________________________________
bafc1087 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}
6f47f50d 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
d5b302a6 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}