]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSEmcCalibData.cxx
Removed PHOS/macros/Trigger/OCDB/readTRUPedestals_C.d
[u/mrichter/AliRoot.git] / PHOS / AliPHOSEmcCalibData.cxx
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
24 ClassImp(AliPHOSEmcCalibData)
25
26 //________________________________________________________________
27 AliPHOSEmcCalibData::AliPHOSEmcCalibData():
28   TNamed(),
29   fSampleTimeStep(0)
30 {
31   // Default constructor
32   Reset();
33 }
34
35 //________________________________________________________________
36 AliPHOSEmcCalibData::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 //________________________________________________________________
49 AliPHOSEmcCalibData::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         fAltroOffsets[module][column][row] = calibda.fAltroOffsets[module][column][row];
65         fDecal[module][column][row]        = calibda.fDecal[module][column][row];
66       }
67     }
68   }
69 }
70
71 //________________________________________________________________
72 AliPHOSEmcCalibData &AliPHOSEmcCalibData::operator =(const AliPHOSEmcCalibData& calibda)
73 {
74   // assignment operator
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];
86           fHighLowRatioEmc[module][column][row] = calibda.fHighLowRatioEmc[module][column][row];
87           fTimeShiftEmc[module][column][row] = calibda.fTimeShiftEmc[module][column][row];
88           fAltroOffsets[module][column][row] = calibda.fAltroOffsets[module][column][row];
89           fDecal[module][column][row]        = calibda.fDecal[module][column][row];
90         }
91       }
92     }
93   }
94
95   return *this;
96 }
97
98 //________________________________________________________________
99 AliPHOSEmcCalibData::~AliPHOSEmcCalibData()
100 {
101   // Destructor
102 }
103
104 //________________________________________________________________
105 void AliPHOSEmcCalibData::Reset()
106 {
107   // Set all pedestals and all ADC channels to its ideal values = 5. (MeV/ADC)
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++){
112         fADCpedestalEmc[module][column][row] = 0.;
113         fADCchannelEmc[module][column][row]  = 0.005;
114         fHighLowRatioEmc[module][column][row] = 16. ;
115         fTimeShiftEmc[module][column][row] = 0. ;
116         fAltroOffsets[module][column][row] = 0 ;
117         fDecal[module][column][row] = 1.;
118       }
119     }
120   }
121   fSampleTimeStep=100.e-9 ; //100 ns
122 }
123
124 //________________________________________________________________
125 void  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   }
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   }
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   }
191 }
192
193 //________________________________________________________________
194 Float_t AliPHOSEmcCalibData::GetADCchannelEmc(Int_t module, Int_t column, Int_t row) const
195 {
196   //Return EMC calibration coefficient
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
203 //________________________________________________________________
204 Float_t AliPHOSEmcCalibData::GetADCpedestalEmc(Int_t module, Int_t column, Int_t row) const
205 {
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
210   return fADCpedestalEmc[module-1][column-1][row-1];
211 }
212
213 //________________________________________________________________
214 Float_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 //________________________________________________________________
224 Float_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 }
232 //________________________________________________________________
233 Float_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 //________________________________________________________________
241 Int_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 }
249 //________________________________________________________________
250 void AliPHOSEmcCalibData::SetADCchannelEmc(Int_t module, Int_t column, Int_t row, Float_t value)
251 {
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
256   fADCchannelEmc[module-1][column-1][row-1] = value;
257 }
258
259 //________________________________________________________________
260 void AliPHOSEmcCalibData::SetADCpedestalEmc(Int_t module, Int_t column, Int_t row, Float_t value)
261 {
262   //Set EMC pedestal
263   //module, column,raw should follow the internal PHOS convention:
264   //module 1:5, column 1:56, row 1:64
265   fADCpedestalEmc[module-1][column-1][row-1] = value;
266 }
267
268 //________________________________________________________________
269 void 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 //________________________________________________________________
277 void 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 }
284 //________________________________________________________________
285 void 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 }
292 //________________________________________________________________
293 void 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
301 //________________________________________________________________
302 Float_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
311 void 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 }