f565d89d |
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 | /* $Id$ */ |
17 | |
63b315c5 |
18 | //_________________________________________________________________________ |
19 | ///*-- Author: Yves Schutz (SUBATECH) |
20 | // : Aleksei Pavlinov (WSU); Jun 30, 2006 - ALICE numbering scheme |
df5cea6b |
21 | // : Add decalibration and time calibration arrays: Jul 21, 2011 (GCB) |
f565d89d |
22 | /////////////////////////////////////////////////////////////////////////////// |
23 | // // |
24 | // class for EMCAL calibration // |
25 | // // |
26 | /////////////////////////////////////////////////////////////////////////////// |
27 | |
090026bf |
28 | #include <TMath.h> |
29 | |
f565d89d |
30 | #include "AliEMCALCalibData.h" |
31 | |
32 | ClassImp(AliEMCALCalibData) |
33 | |
aaa41982 |
34 | //__________________________________________________________ |
35 | AliEMCALCalibData::AliEMCALCalibData() : fADCchannelRef(0) |
f565d89d |
36 | { |
37 | // Default constructor |
38 | Reset(); |
39 | } |
40 | |
aaa41982 |
41 | //________________________________________________________________________ |
42 | AliEMCALCalibData::AliEMCALCalibData(const char* name) : fADCchannelRef(0) |
f565d89d |
43 | { |
44 | // Constructor |
45 | TString namst = "Calib_"; |
46 | namst += name; |
aaa41982 |
47 | SetName (namst.Data()); |
f565d89d |
48 | SetTitle(namst.Data()); |
49 | Reset(); |
50 | } |
51 | |
aaa41982 |
52 | //______________________________________________________________________ |
f565d89d |
53 | AliEMCALCalibData::AliEMCALCalibData(const AliEMCALCalibData& calibda) : |
aaa41982 |
54 | TNamed(calibda), fADCchannelRef(calibda.fADCchannelRef) |
f565d89d |
55 | { |
56 | // copy constructor |
aaa41982 |
57 | SetName (calibda.GetName()); |
f565d89d |
58 | SetTitle(calibda.GetName()); |
59 | Reset(); |
60 | |
0c5b726e |
61 | Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; //12 |
62 | Int_t nCol = AliEMCALGeoParams::fgkEMCALCols; //48 |
63 | Int_t nRow = AliEMCALGeoParams::fgkEMCALRows; //24 |
64 | Int_t nRow2 = AliEMCALGeoParams::fgkEMCALRows; //12 - Modules 11 and 12 are half modules |
f565d89d |
65 | |
df5cea6b |
66 | for(Int_t supermodule = 0; supermodule < nSMod; supermodule++) { |
67 | |
9219ceb6 |
68 | if(supermodule >= 10) |
beb28b95 |
69 | nRow = nRow2; |
df5cea6b |
70 | |
71 | for(Int_t column = 0; column<nCol; column++) { |
72 | |
73 | for(Int_t row = 0; row<nRow; row++) { |
74 | |
75 | fADCchannel[supermodule][column][row] = |
76 | calibda.GetADCchannel(supermodule,column,row); |
77 | |
78 | fADCchannelDecal[supermodule][column][row] = |
79 | calibda.GetADCchannelDecal(supermodule,column,row); |
80 | |
81 | fADCpedestal[supermodule][column][row] = |
82 | calibda.GetADCpedestal(supermodule,column,row); |
83 | |
df5cea6b |
84 | fTimeChannelDecal[supermodule][column][row] = |
85 | calibda.GetTimeChannelDecal(supermodule,column,row); |
aaa41982 |
86 | |
87 | for(Int_t bc = 0; bc < 4; bc++) |
88 | fTimeChannel[supermodule][column][row][bc] = |
89 | calibda.GetTimeChannel(supermodule,column,row,bc); |
df5cea6b |
90 | |
f565d89d |
91 | } |
92 | } |
93 | } |
94 | } |
95 | |
96 | |
97 | //________________________________________________________________ |
98 | AliEMCALCalibData &AliEMCALCalibData::operator =(const AliEMCALCalibData& calibda) |
99 | { |
100 | // assignment operator |
aaa41982 |
101 | SetName (calibda.GetName()); |
f565d89d |
102 | SetTitle(calibda.GetName()); |
103 | Reset(); |
104 | |
aaa41982 |
105 | fADCchannelRef = calibda.fADCchannelRef ; |
106 | |
0c5b726e |
107 | Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; //12 |
108 | Int_t nCol = AliEMCALGeoParams::fgkEMCALCols; //48 |
109 | Int_t nRow = AliEMCALGeoParams::fgkEMCALRows; //24 |
110 | Int_t nRow2 = AliEMCALGeoParams::fgkEMCALRows/2; //12 - Modules 11 and 12 are half modules |
f565d89d |
111 | |
df5cea6b |
112 | for(Int_t supermodule = 0; supermodule < nSMod; supermodule++) { |
113 | |
9219ceb6 |
114 | if(supermodule >= 10) |
beb28b95 |
115 | nRow = nRow2; |
df5cea6b |
116 | |
117 | for(Int_t column = 0; column<nCol; column++) { |
118 | |
119 | for(Int_t row = 0; row<nRow; row++) { |
120 | |
121 | fADCchannel[supermodule][column][row] = |
122 | calibda.GetADCchannel(supermodule,column,row); |
123 | |
124 | fADCchannelDecal[supermodule][column][row] = |
125 | calibda.GetADCchannelDecal(supermodule,column,row); |
126 | |
127 | fADCpedestal[supermodule][column][row] = |
128 | calibda.GetADCpedestal(supermodule,column,row); |
df5cea6b |
129 | |
130 | fTimeChannelDecal[supermodule][column][row] = |
131 | calibda.GetTimeChannelDecal(supermodule,column,row); |
132 | |
aaa41982 |
133 | for(Int_t bc = 0; bc < 4; bc++) |
134 | fTimeChannel[supermodule][column][row][bc] = |
135 | calibda.GetTimeChannel(supermodule,column,row,bc); |
136 | |
f565d89d |
137 | } |
138 | } |
139 | } |
f565d89d |
140 | |
aaa41982 |
141 | return *this; |
f565d89d |
142 | } |
143 | |
aaa41982 |
144 | //_____________________________ |
f565d89d |
145 | void AliEMCALCalibData::Reset() |
146 | { |
147 | // Set all pedestals to 0 and all ADC channels widths to 1 |
aaa41982 |
148 | |
149 | fADCchannelRef = 0.0162; |
0e76a7bf |
150 | |
151 | Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; //12 |
152 | Int_t nCol = AliEMCALGeoParams::fgkEMCALCols; //48 |
153 | Int_t nRow = AliEMCALGeoParams::fgkEMCALRows; //24 |
154 | Int_t nRow2 = AliEMCALGeoParams::fgkEMCALRows/2; //12 - Modules 11 and 12 are half modules |
aaa41982 |
155 | |
0e76a7bf |
156 | for (Int_t supermodule=0; supermodule<nSMod; supermodule++){ |
157 | if(supermodule >= 10) |
158 | nRow = nRow2; |
df5cea6b |
159 | for (Int_t column=0; column < nCol; column++){ |
160 | |
161 | for (Int_t row = 0; row < nRow; row++){ |
162 | |
163 | fADCpedestal [supermodule][column][row]=0.; |
164 | |
165 | fADCchannelDecal [supermodule][column][row]=1.; |
166 | fADCchannel [supermodule][column][row]=1.; |
167 | |
df5cea6b |
168 | fTimeChannelDecal[supermodule][column][row]=0.; |
169 | |
aaa41982 |
170 | for(Int_t bc = 0; bc < 4; bc++) |
171 | fTimeChannel[supermodule][column][row][bc]=0; |
172 | |
0e76a7bf |
173 | } |
174 | } |
aaa41982 |
175 | } |
f565d89d |
176 | } |
177 | |
178 | //________________________________________________________________ |
179 | void AliEMCALCalibData::Print(Option_t *option) const |
180 | { |
181 | // Print tables of pedestals and ADC channels widths |
df5cea6b |
182 | // options are: "gain", "ped", "decal", "time", "all" |
183 | |
0c5b726e |
184 | Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; //12 |
185 | Int_t nCol = AliEMCALGeoParams::fgkEMCALCols; //48 |
186 | Int_t nRow = AliEMCALGeoParams::fgkEMCALRows; //24 |
187 | Int_t nRow2 = AliEMCALGeoParams::fgkEMCALRows/2; //12 - Modules 11 and 12 are half modules |
aaa41982 |
188 | |
df5cea6b |
189 | if (strstr(option,"ped") || strstr(option,"all")) { |
f565d89d |
190 | printf("\n ---- Pedestal values ----\n\n"); |
191 | for (Int_t supermodule=0; supermodule<nSMod; supermodule++){ |
9219ceb6 |
192 | if(supermodule >= 10) |
df5cea6b |
193 | nRow = nRow2; |
f565d89d |
194 | printf("============== Supermodule %d\n",supermodule+1); |
195 | for (Int_t column=0; column<nCol; column++){ |
df5cea6b |
196 | for (Int_t row=0; row<nRow; row++){ |
197 | printf(" %2.4f ",fADCpedestal[supermodule][column][row]); |
198 | } |
199 | printf("\n"); |
f565d89d |
200 | } |
201 | } |
202 | } |
df5cea6b |
203 | |
204 | if (strstr(option,"gain") || strstr(option,"all")) { |
f565d89d |
205 | printf("\n ---- ADC channel values ----\n\n"); |
206 | for (Int_t supermodule=0; supermodule<nSMod; supermodule++){ |
9219ceb6 |
207 | if(supermodule >= 10) |
df5cea6b |
208 | nRow = nRow2; |
f565d89d |
209 | printf("============== Supermodule %d\n",supermodule+1); |
210 | for (Int_t column=0; column<nCol; column++){ |
df5cea6b |
211 | for (Int_t row=0; row<nRow; row++){ |
212 | printf(" %2.4f ",fADCchannel[supermodule][column][row]); |
213 | } |
214 | printf("\n"); |
f565d89d |
215 | } |
216 | } |
217 | } |
df5cea6b |
218 | |
219 | if (strstr(option,"adcdecal") || strstr(option,"all")) { |
220 | printf("\n ---- ADC decalibration channel values ----\n\n"); |
221 | for (Int_t supermodule=0; supermodule<nSMod; supermodule++){ |
222 | if(supermodule >= 10) |
223 | nRow = nRow2; |
224 | printf("============== Supermodule %d\n",supermodule+1); |
225 | for (Int_t column=0; column<nCol; column++){ |
226 | for (Int_t row=0; row<nRow; row++){ |
227 | printf(" %2.4f ",fADCchannelDecal[supermodule][column][row]); |
228 | } |
229 | printf("\n"); |
230 | } |
231 | } |
232 | } |
233 | |
234 | if (strstr(option,"time") || strstr(option,"all")) { |
235 | printf("\n ---- time channel values ----\n\n"); |
236 | for (Int_t supermodule=0; supermodule<nSMod; supermodule++){ |
237 | if(supermodule >= 10) |
238 | nRow = nRow2; |
239 | printf("============== Supermodule %d\n",supermodule+1); |
240 | for (Int_t column=0; column<nCol; column++){ |
241 | for (Int_t row=0; row<nRow; row++){ |
aaa41982 |
242 | for(Int_t bc = 0; bc < 4; bc++) |
243 | printf(" %2.4f ",fTimeChannel[supermodule][column][row][bc]); |
df5cea6b |
244 | } |
245 | printf("\n"); |
246 | } |
247 | } |
248 | } |
249 | |
df5cea6b |
250 | if (strstr(option,"time") || strstr(option,"all")) { |
251 | printf("\n ---- time decalibration channel values ----\n\n"); |
252 | for (Int_t supermodule=0; supermodule<nSMod; supermodule++){ |
253 | if(supermodule >= 10) |
254 | nRow = nRow2; |
255 | printf("============== Supermodule %d\n",supermodule+1); |
256 | for (Int_t column=0; column<nCol; column++){ |
257 | for (Int_t row=0; row<nRow; row++){ |
258 | printf(" %2.4f ",fTimeChannelDecal[supermodule][column][row]); |
259 | } |
260 | printf("\n"); |
261 | } |
262 | } |
263 | } |
f565d89d |
264 | } |
265 | |
266 | //________________________________________________________________ |
267 | Float_t AliEMCALCalibData::GetADCchannel(Int_t supermodule, Int_t column, Int_t row) const |
268 | { |
269 | // Set ADC channel witdth values |
63b315c5 |
270 | // All indexes start from 0! |
271 | // Supermodule, column,raw should follow the ALICE convention: |
272 | // supermodule 0:11, column 0:47, row 0:23 |
f565d89d |
273 | |
63b315c5 |
274 | return fADCchannel[supermodule][column][row]; |
f565d89d |
275 | } |
276 | |
df5cea6b |
277 | //________________________________________________________________ |
278 | Float_t AliEMCALCalibData::GetADCchannelDecal(Int_t supermodule, Int_t column, Int_t row) const |
279 | { |
280 | // Set ADC channel decalibration witdth values |
281 | // All indexes start from 0! |
282 | // Supermodule, column,raw should follow the ALICE convention: |
283 | // supermodule 0:11, column 0:47, row 0:23 |
284 | |
285 | return fADCchannelDecal[supermodule][column][row]; |
286 | } |
287 | |
f565d89d |
288 | //________________________________________________________________ |
289 | Float_t AliEMCALCalibData::GetADCpedestal(Int_t supermodule, Int_t column, Int_t row) const |
290 | { |
291 | // Get ADC pedestal values |
63b315c5 |
292 | return fADCpedestal[supermodule][column][row]; |
f565d89d |
293 | } |
294 | |
df5cea6b |
295 | //________________________________________________________________ |
aaa41982 |
296 | Float_t AliEMCALCalibData::GetTimeChannel(Int_t supermodule, Int_t column, Int_t row, Int_t bc) const |
df5cea6b |
297 | { |
298 | // Set channel time witdth values |
aaa41982 |
299 | return fTimeChannel[supermodule][column][row][bc]; |
df5cea6b |
300 | } |
301 | |
302 | //________________________________________________________________ |
303 | Float_t AliEMCALCalibData::GetTimeChannelDecal(Int_t supermodule, Int_t column, Int_t row) const |
304 | { |
305 | // Set channel time witdth values |
306 | return fTimeChannelDecal[supermodule][column][row]; |
307 | } |
308 | |
f565d89d |
309 | //________________________________________________________________ |
310 | void AliEMCALCalibData::SetADCchannel(Int_t supermodule, Int_t column, Int_t row, Float_t value) |
311 | { |
312 | // Set ADC channel width values |
63b315c5 |
313 | fADCchannel[supermodule][column][row] = value; |
f565d89d |
314 | } |
315 | |
df5cea6b |
316 | //________________________________________________________________ |
317 | void AliEMCALCalibData::SetADCchannelDecal(Int_t supermodule, Int_t column, Int_t row, Float_t value) |
318 | { |
319 | // Set ADC channel width values |
320 | fADCchannelDecal[supermodule][column][row] = value; |
321 | } |
322 | |
f565d89d |
323 | //________________________________________________________________ |
324 | void AliEMCALCalibData::SetADCpedestal(Int_t supermodule, Int_t column, Int_t row, Float_t value) |
325 | { |
326 | // Set ADC pedestal values |
63b315c5 |
327 | fADCpedestal[supermodule][column][row] = value; |
f565d89d |
328 | } |
0e76a7bf |
329 | |
df5cea6b |
330 | //________________________________________________________________ |
aaa41982 |
331 | void AliEMCALCalibData::SetTimeChannel(Int_t supermodule, Int_t column, Int_t row, Int_t bc, Float_t value) |
df5cea6b |
332 | { |
333 | // Set ADC pedestal values |
aaa41982 |
334 | fTimeChannel[supermodule][column][row][bc] = value; |
df5cea6b |
335 | } |
336 | |
337 | //________________________________________________________________ |
338 | void AliEMCALCalibData::SetTimeChannelDecal(Int_t supermodule, Int_t column, Int_t row, Float_t value) |
339 | { |
340 | // Set ADC pedestal values |
341 | fTimeChannelDecal[supermodule][column][row] = value; |
342 | } |
343 | |
344 | |
0e76a7bf |
345 | |