]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSEmcCalibData.cxx
ClassDef is incremented
[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(): TNamed()
28 {
29   // Default constructor
30   Reset();
31 }
32
33 //________________________________________________________________
34 AliPHOSEmcCalibData::AliPHOSEmcCalibData(const char* name)
35 {
36   // Constructor
37   TString namst = "Calib_";
38   namst += name;
39   SetName(namst.Data());
40   SetTitle(namst.Data());
41   Reset();
42 }
43
44 //________________________________________________________________
45 AliPHOSEmcCalibData::AliPHOSEmcCalibData(const AliPHOSEmcCalibData& calibda) :
46   TNamed(calibda)
47 {
48   // copy constructor
49   SetName(calibda.GetName());
50   SetTitle(calibda.GetName());
51
52   for(Int_t module=0; module<5; module++) {
53     for(Int_t column=0; column<56; column++) {
54       for(Int_t row=0; row<64; row++) {
55         fADCchannelEmc[module][column][row] = calibda.fADCchannelEmc[module][column][row];
56         fADCpedestalEmc[module][column][row] = calibda.fADCpedestalEmc[module][column][row];
57         fHighLowRatioEmc[module][column][row] = calibda.fHighLowRatioEmc[module][column][row];
58         fTimeShiftEmc[module][column][row] = calibda.fTimeShiftEmc[module][column][row];
59         fAltroOffsets[module][column][row] = calibda.fAltroOffsets[module][column][row];
60       }
61     }
62   }
63 }
64
65 //________________________________________________________________
66 AliPHOSEmcCalibData &AliPHOSEmcCalibData::operator =(const AliPHOSEmcCalibData& calibda)
67 {
68   // assignment operator
69
70   if(this != &calibda) { 
71
72     SetName(calibda.GetName());
73     SetTitle(calibda.GetName());
74
75     for(Int_t module=0; module<5; module++) {
76       for(Int_t column=0; column<56; column++) {
77         for(Int_t row=0; row<64; row++) {
78           fADCchannelEmc[module][column][row] = calibda.fADCchannelEmc[module][column][row];
79           fADCpedestalEmc[module][column][row] = calibda.fADCpedestalEmc[module][column][row];
80           fHighLowRatioEmc[module][column][row] = calibda.fHighLowRatioEmc[module][column][row];
81           fTimeShiftEmc[module][column][row] = calibda.fTimeShiftEmc[module][column][row];
82           fAltroOffsets[module][column][row] = calibda.fAltroOffsets[module][column][row]; 
83         }
84       }
85     }
86   }
87
88   return *this;
89 }
90
91 //________________________________________________________________
92 AliPHOSEmcCalibData::~AliPHOSEmcCalibData()
93 {
94   // Destructor
95 }
96
97 //________________________________________________________________
98 void AliPHOSEmcCalibData::Reset()
99 {
100   // Set all pedestals and all ADC channels to its ideal values = 5. (MeV/ADC)
101
102   for (Int_t module=0; module<5; module++){
103     for (Int_t column=0; column<56; column++){
104       for (Int_t row=0; row<64; row++){
105         fADCpedestalEmc[module][column][row] = 0.;
106         fADCchannelEmc[module][column][row]  = 0.005;
107         fHighLowRatioEmc[module][column][row] = 16. ;
108         fTimeShiftEmc[module][column][row] = 0. ;
109         fAltroOffsets[module][column][row] = 0 ;
110       }
111     }
112   }
113
114 }
115
116 //________________________________________________________________
117 void  AliPHOSEmcCalibData::Print(Option_t *option) const
118 {
119   // Print tables of pedestals and ADC channels
120
121   if (strstr(option,"ped")) {
122     printf("\n  ----    EMC Pedestal values     ----\n\n");
123     for (Int_t module=0; module<5; module++){
124       printf("============== Module %d\n",module+1);
125       for (Int_t column=0; column<56; column++){
126         for (Int_t row=0; row<64; row++){
127           printf("%4.1f",fADCpedestalEmc[module][column][row]);
128         }
129         printf("\n");
130       }
131     }
132   }
133
134   if (strstr(option,"gain")) {
135     printf("\n  ----    EMC ADC channel values  ----\n\n");
136     for (Int_t module=0; module<5; module++){
137       printf("============== Module %d\n",module+1);
138       for (Int_t column=0; column<56; column++){
139         for (Int_t row=0; row<64; row++){
140           printf("%4.1f",fADCchannelEmc[module][column][row]);
141         }
142         printf("\n");
143       }
144     }
145   }
146
147   if (strstr(option,"hilo")) {
148     printf("\n  ----    EMC High/Low ratio      ----\n\n");
149     for (Int_t module=0; module<5; module++){
150       printf("============== Module %d\n",module+1);
151       for (Int_t column=0; column<56; column++){
152         for (Int_t row=0; row<64; row++){
153           printf("%4.1f",fHighLowRatioEmc[module][column][row]);
154         }
155         printf("\n");
156       }
157     }
158   }
159   if (strstr(option,"time")) {
160     printf("\n  ----    EMC t0 shifts   ----\n\n");
161     for (Int_t module=0; module<5; module++){
162       printf("============== Module %d\n",module+1);
163       for (Int_t column=0; column<56; column++){
164         for (Int_t row=0; row<64; row++){
165           printf("%6.3e",fTimeShiftEmc[module][column][row]);
166         }
167         printf("\n");
168       }
169     }
170   }
171   if (strstr(option,"altro")) {
172     printf("\n  ----    EMC altro offsets   ----\n\n");
173     for (Int_t module=0; module<5; module++){
174       printf("============== Module %d\n",module+1);
175       for (Int_t column=0; column<56; column++){
176         for (Int_t row=0; row<64; row++){
177           printf("%5d",fAltroOffsets[module][column][row]);
178         }
179         printf("\n");
180       }
181     }
182   }
183 }
184
185 //________________________________________________________________
186 Float_t AliPHOSEmcCalibData::GetADCchannelEmc(Int_t module, Int_t column, Int_t row) const
187 {
188   //Return EMC calibration coefficient
189   //module, column,raw should follow the internal PHOS convention:
190   //module 1:5, column 1:56, row 1:64
191
192   return fADCchannelEmc[module-1][column-1][row-1];
193 }
194
195 //________________________________________________________________
196 Float_t AliPHOSEmcCalibData::GetADCpedestalEmc(Int_t module, Int_t column, Int_t row) const
197 {
198   //Return EMC pedestal
199   //module, column,raw should follow the internal PHOS convention:
200   //module 1:5, column 1:56, row 1:64
201
202   return fADCpedestalEmc[module-1][column-1][row-1];
203 }
204
205 //________________________________________________________________
206 Float_t AliPHOSEmcCalibData::GetHighLowRatioEmc(Int_t module, Int_t column, Int_t row) const
207 {
208   //Return EMC pedestal
209   //module, column,raw should follow the internal PHOS convention:
210   //module 1:5, column 1:56, row 1:64
211
212   return fHighLowRatioEmc[module-1][column-1][row-1];
213 }
214
215 //________________________________________________________________
216 Float_t AliPHOSEmcCalibData::GetTimeShiftEmc(Int_t module, Int_t column, Int_t row) const
217 {
218   //Return EMC pedestal
219   //module, column,raw should follow the internal PHOS convention:
220   //module 1:5, column 1:56, row 1:64
221
222   return fTimeShiftEmc[module-1][column-1][row-1];
223 }
224 //________________________________________________________________
225 Int_t AliPHOSEmcCalibData::GetAltroOffsetEmc(Int_t module, Int_t column, Int_t row) const
226 {
227   //Return EMC altro offsets
228   //module, column,raw should follow the internal PHOS convention:
229   //module 1:5, column 1:56, row 1:64
230  
231   return fAltroOffsets[module-1][column-1][row-1];
232 }
233 //________________________________________________________________
234 void AliPHOSEmcCalibData::SetADCchannelEmc(Int_t module, Int_t column, Int_t row, Float_t value)
235 {
236   //Set EMC calibration coefficient
237   //module, column,raw should follow the internal PHOS convention:
238   //module 1:5, column 1:56, row 1:64
239
240   fADCchannelEmc[module-1][column-1][row-1] = value;
241 }
242
243 //________________________________________________________________
244 void AliPHOSEmcCalibData::SetADCpedestalEmc(Int_t module, Int_t column, Int_t row, Float_t value)
245 {
246   //Set EMC pedestal
247   //module, column,raw should follow the internal PHOS convention:
248   //module 1:5, column 1:56, row 1:64
249   fADCpedestalEmc[module-1][column-1][row-1] = value;
250 }
251
252 //________________________________________________________________
253 void AliPHOSEmcCalibData::SetHighLowRatioEmc(Int_t module, Int_t column, Int_t row, Float_t value)
254 {
255   //Set EMC pedestal
256   //module, column,raw should follow the internal PHOS convention:
257   //module 1:5, column 1:56, row 1:64
258   fHighLowRatioEmc[module-1][column-1][row-1] = value;
259 }
260 //________________________________________________________________
261 void AliPHOSEmcCalibData::SetTimeShiftEmc(Int_t module, Int_t column, Int_t row, Float_t value)
262 {
263   //Set EMC pedestal
264   //module, column,raw should follow the internal PHOS convention:
265   //module 1:5, column 1:56, row 1:64
266   fTimeShiftEmc[module-1][column-1][row-1] = value;
267 }
268 //________________________________________________________________
269 void AliPHOSEmcCalibData::SetAltroOffsetEmc(Int_t module, Int_t column, Int_t row, Int_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   fAltroOffsets[module-1][column-1][row-1] = value;
275 }