]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCALCalibData.cxx
Corrected compilation options
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALCalibData.cxx
CommitLineData
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)
8cc543cb 22// : adapted for DCAL by M.L. Wang CCNU & Subatech Oct-18-2012
f565d89d 23///////////////////////////////////////////////////////////////////////////////
24// //
25// class for EMCAL calibration //
26// //
27///////////////////////////////////////////////////////////////////////////////
28
090026bf 29#include <TMath.h>
30
f565d89d 31#include "AliEMCALCalibData.h"
32
33ClassImp(AliEMCALCalibData)
34
aaa41982 35//__________________________________________________________
aae41db5 36AliEMCALCalibData::AliEMCALCalibData() :
37TNamed(), fADCchannelRef(0)
f565d89d 38{
39 // Default constructor
40 Reset();
41}
42
aaa41982 43//________________________________________________________________________
aae41db5 44AliEMCALCalibData::AliEMCALCalibData(const char* name) :
45TNamed(name,name),fADCchannelRef(0)
f565d89d 46{
47 // Constructor
f565d89d 48 Reset();
49}
50
aaa41982 51//______________________________________________________________________
f565d89d 52AliEMCALCalibData::AliEMCALCalibData(const AliEMCALCalibData& calibda) :
aae41db5 53TNamed(calibda), fADCchannelRef(calibda.fADCchannelRef)
f565d89d 54{
55 // copy constructor
aaa41982 56 SetName (calibda.GetName());
f565d89d 57 SetTitle(calibda.GetName());
58 Reset();
aae41db5 59
76d23fc0 60 Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules;
0c5b726e 61 Int_t nCol = AliEMCALGeoParams::fgkEMCALCols; //48
62 Int_t nRow = AliEMCALGeoParams::fgkEMCALRows; //24
f565d89d 63
8cc543cb 64 for(Int_t supermodule = 0; supermodule < nSMod; supermodule++) {
65 nCol = AliEMCALGeoParams::fgkEMCALCols; //48
66 nRow = AliEMCALGeoParams::fgkEMCALRows; //24
67 // in reality they are 1/3 but leave them as 1/2
68
69 if(supermodule /2 == 5)
70 nRow = nRow/2;
71 if(supermodule > 11 && supermodule < 18)
72 nCol = nCol*2/3;
df5cea6b 73
74 for(Int_t column = 0; column<nCol; column++) {
75
76 for(Int_t row = 0; row<nRow; row++) {
77
78 fADCchannel[supermodule][column][row] =
79 calibda.GetADCchannel(supermodule,column,row);
80
3730689d 81 fADCchannelOnline[supermodule][column][row] =
82 calibda.GetADCchannelOnline(supermodule,column,row);
83
84 fADCchannelDecal[supermodule][column][row] =
df5cea6b 85 calibda.GetADCchannelDecal(supermodule,column,row);
86
87 fADCpedestal[supermodule][column][row] =
88 calibda.GetADCpedestal(supermodule,column,row);
89
df5cea6b 90 fTimeChannelDecal[supermodule][column][row] =
91 calibda.GetTimeChannelDecal(supermodule,column,row);
aae41db5 92
93 for(Int_t bc = 0; bc < 4; bc++)
94 fTimeChannel[supermodule][column][row][bc] =
95 calibda.GetTimeChannel(supermodule,column,row,bc);
df5cea6b 96
f565d89d 97 }
98 }
99 }
100}
101
f565d89d 102//________________________________________________________________
103AliEMCALCalibData &AliEMCALCalibData::operator =(const AliEMCALCalibData& calibda)
104{
105 // assignment operator
aaa41982 106 SetName (calibda.GetName());
f565d89d 107 SetTitle(calibda.GetName());
108 Reset();
aae41db5 109
c7e54b0e 110 fADCchannelRef = calibda.GetADCchannelRef() ;
aae41db5 111
76d23fc0 112 Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules;
0c5b726e 113 Int_t nCol = AliEMCALGeoParams::fgkEMCALCols; //48
114 Int_t nRow = AliEMCALGeoParams::fgkEMCALRows; //24
8cc543cb 115
116 for(Int_t supermodule = 0; supermodule < nSMod; supermodule++) {
117 nCol = AliEMCALGeoParams::fgkEMCALCols; //48
118 nRow = AliEMCALGeoParams::fgkEMCALRows; //24
aae41db5 119 // in reality they are 1/3 but leave them as 1/2
f565d89d 120
8cc543cb 121 if(supermodule /2 == 5)
122 nRow = nRow/2;
123 if(supermodule > 11 && supermodule < 18)
124 nCol = nCol*2/3;
df5cea6b 125
126 for(Int_t column = 0; column<nCol; column++) {
127
128 for(Int_t row = 0; row<nRow; row++) {
129
130 fADCchannel[supermodule][column][row] =
131 calibda.GetADCchannel(supermodule,column,row);
3730689d 132
133 fADCchannelOnline[supermodule][column][row] =
134 calibda.GetADCchannelOnline(supermodule,column,row);
df5cea6b 135
136 fADCchannelDecal[supermodule][column][row] =
137 calibda.GetADCchannelDecal(supermodule,column,row);
138
139 fADCpedestal[supermodule][column][row] =
140 calibda.GetADCpedestal(supermodule,column,row);
aae41db5 141
df5cea6b 142 fTimeChannelDecal[supermodule][column][row] =
143 calibda.GetTimeChannelDecal(supermodule,column,row);
144
aae41db5 145 for(Int_t bc = 0; bc < 4; bc++)
146 fTimeChannel[supermodule][column][row][bc] =
147 calibda.GetTimeChannel(supermodule,column,row,bc);
148
f565d89d 149 }
150 }
151 }
aae41db5 152
aaa41982 153 return *this;
f565d89d 154}
155
aaa41982 156//_____________________________
f565d89d 157void AliEMCALCalibData::Reset()
158{
159 // Set all pedestals to 0 and all ADC channels widths to 1
aae41db5 160
aaa41982 161 fADCchannelRef = 0.0162;
aae41db5 162
76d23fc0 163 Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules;
0e76a7bf 164 Int_t nCol = AliEMCALGeoParams::fgkEMCALCols; //48
165 Int_t nRow = AliEMCALGeoParams::fgkEMCALRows; //24
8cc543cb 166
167 for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
168 nCol = AliEMCALGeoParams::fgkEMCALCols; //48
169 nRow = AliEMCALGeoParams::fgkEMCALRows; //24
aae41db5 170 // in reality they are 1/3 but leave them as 1/2
8cc543cb 171
172 if(supermodule /2 == 5)
173 nRow = nRow/2;
174 if(supermodule > 11 && supermodule < 18)
175 nCol = nCol*2/3;
aaa41982 176
df5cea6b 177 for (Int_t column=0; column < nCol; column++){
178
179 for (Int_t row = 0; row < nRow; row++){
180
181 fADCpedestal [supermodule][column][row]=0.;
182
183 fADCchannelDecal [supermodule][column][row]=1.;
3730689d 184 fADCchannel [supermodule][column][row]=fADCchannelRef;
185 fADCchannelOnline[supermodule][column][row]=fADCchannelRef;
df5cea6b 186
df5cea6b 187 fTimeChannelDecal[supermodule][column][row]=0.;
aae41db5 188
189 for(Int_t bc = 0; bc < 4; bc++)
190 fTimeChannel[supermodule][column][row][bc]=0;
191
0e76a7bf 192 }
193 }
aaa41982 194 }
f565d89d 195}
196
aae41db5 197//____________________________________________________
f565d89d 198void AliEMCALCalibData::Print(Option_t *option) const
199{
200 // Print tables of pedestals and ADC channels widths
df5cea6b 201 // options are: "gain", "ped", "decal", "time", "all"
202
76d23fc0 203 Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules;
0c5b726e 204 Int_t nCol = AliEMCALGeoParams::fgkEMCALCols; //48
205 Int_t nRow = AliEMCALGeoParams::fgkEMCALRows; //24
8cc543cb 206
df5cea6b 207 if (strstr(option,"ped") || strstr(option,"all")) {
f565d89d 208 printf("\n ---- Pedestal values ----\n\n");
209 for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
8cc543cb 210 nCol = AliEMCALGeoParams::fgkEMCALCols; //48
211 nRow = AliEMCALGeoParams::fgkEMCALRows; //24
212 // in reality they are 1/3 but leave them as 1/2
213 if(supermodule /2 == 5)
214 nRow = nRow/2;
215 if(supermodule > 11 && supermodule < 18)
216 nCol = nCol*2/3;
f565d89d 217 printf("============== Supermodule %d\n",supermodule+1);
218 for (Int_t column=0; column<nCol; column++){
df5cea6b 219 for (Int_t row=0; row<nRow; row++){
af60537e 220 printf("[c%d,r%d] %2.4f ",column, row, fADCpedestal[supermodule][column][row]);
df5cea6b 221 }
222 printf("\n");
f565d89d 223 }
224 }
225 }
df5cea6b 226
227 if (strstr(option,"gain") || strstr(option,"all")) {
f565d89d 228 printf("\n ---- ADC channel values ----\n\n");
229 for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
8cc543cb 230 nCol = AliEMCALGeoParams::fgkEMCALCols; //48
231 nRow = AliEMCALGeoParams::fgkEMCALRows; //24
232
233 // in reality they are 1/3 but leave them as 1/2
234 if(supermodule /2 == 5)
235 nRow = nRow/2;
236 if(supermodule > 11 && supermodule < 18)
237 nCol = nCol*2/3;
f565d89d 238 printf("============== Supermodule %d\n",supermodule+1);
239 for (Int_t column=0; column<nCol; column++){
df5cea6b 240 for (Int_t row=0; row<nRow; row++){
af60537e 241 printf("[c%d,r%d] %2.4f ",column, row, fADCchannel[supermodule][column][row]);
df5cea6b 242 }
243 printf("\n");
f565d89d 244 }
245 }
246 }
df5cea6b 247
3730689d 248 if (strstr(option,"adconline") || strstr(option,"all")) {
249 printf("\n ---- ADC online channel values ----\n\n");
250 for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
251 nCol = AliEMCALGeoParams::fgkEMCALCols; //48
252 nRow = AliEMCALGeoParams::fgkEMCALRows; //24
253 // in reality they are 1/3 but leave them as 1/2
254 if(supermodule /2 == 5)
255 nRow = nRow/2;
256 if(supermodule > 11 && supermodule < 18)
257 nCol = nCol*2/3;
258 printf("============== Supermodule %d\n",supermodule+1);
259 for (Int_t column=0; column<nCol; column++){
260 for (Int_t row=0; row<nRow; row++){
261 printf("[c%d,r%d] %2.4f ",column, row,fADCchannelOnline[supermodule][column][row]);
262 }
263 printf("\n");
264 }
265 }
266 }
267
df5cea6b 268 if (strstr(option,"adcdecal") || strstr(option,"all")) {
269 printf("\n ---- ADC decalibration channel values ----\n\n");
270 for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
8cc543cb 271 nCol = AliEMCALGeoParams::fgkEMCALCols; //48
272 nRow = AliEMCALGeoParams::fgkEMCALRows; //24
273 // in reality they are 1/3 but leave them as 1/2
274 if(supermodule /2 == 5)
275 nRow = nRow/2;
276 if(supermodule > 11 && supermodule < 18)
277 nCol = nCol*2/3;
df5cea6b 278 printf("============== Supermodule %d\n",supermodule+1);
279 for (Int_t column=0; column<nCol; column++){
280 for (Int_t row=0; row<nRow; row++){
af60537e 281 printf("[c%d,r%d] %2.4f ",column, row,fADCchannelDecal[supermodule][column][row]);
df5cea6b 282 }
283 printf("\n");
284 }
285 }
286 }
287
288 if (strstr(option,"time") || strstr(option,"all")) {
289 printf("\n ---- time channel values ----\n\n");
290 for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
8cc543cb 291 nCol = AliEMCALGeoParams::fgkEMCALCols; //48
292 nRow = AliEMCALGeoParams::fgkEMCALRows; //24
293 // in reality they are 1/3 but leave them as 1/2
294 if(supermodule /2 == 5)
295 nRow = nRow/2;
296 if(supermodule > 11 && supermodule < 18)
297 nCol = nCol*2/3;
df5cea6b 298 printf("============== Supermodule %d\n",supermodule+1);
299 for (Int_t column=0; column<nCol; column++){
300 for (Int_t row=0; row<nRow; row++){
aae41db5 301 for(Int_t bc = 0; bc < 4; bc++)
302 printf(" %2.4f ",fTimeChannel[supermodule][column][row][bc]);
df5cea6b 303 }
304 printf("\n");
305 }
306 }
307 }
308
df5cea6b 309 if (strstr(option,"time") || strstr(option,"all")) {
310 printf("\n ---- time decalibration channel values ----\n\n");
311 for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
8cc543cb 312 nCol = AliEMCALGeoParams::fgkEMCALCols; //48
313 nRow = AliEMCALGeoParams::fgkEMCALRows; //24
314 // in reality they are 1/3 but leave them as 1/2
315 if(supermodule /2 == 5)
316 nRow = nRow/2;
317 if(supermodule > 11 && supermodule < 18)
318 nCol = nCol*2/3;
df5cea6b 319 printf("============== Supermodule %d\n",supermodule+1);
320 for (Int_t column=0; column<nCol; column++){
321 for (Int_t row=0; row<nRow; row++){
322 printf(" %2.4f ",fTimeChannelDecal[supermodule][column][row]);
323 }
324 printf("\n");
325 }
326 }
327 }
f565d89d 328}
329
330//________________________________________________________________
331Float_t AliEMCALCalibData::GetADCchannel(Int_t supermodule, Int_t column, Int_t row) const
332{
333 // Set ADC channel witdth values
63b315c5 334 // All indexes start from 0!
335 // Supermodule, column,raw should follow the ALICE convention:
336 // supermodule 0:11, column 0:47, row 0:23
aae41db5 337
63b315c5 338 return fADCchannel[supermodule][column][row];
f565d89d 339}
340
3730689d 341//________________________________________________________________
342Float_t AliEMCALCalibData::GetADCchannelOnline(Int_t supermodule, Int_t column, Int_t row) const
343{
344 // Set ADC channel witdth values, first online calibration parameter
345 // All indexes start from 0!
346 // Supermodule, column,raw should follow the ALICE convention:
347 // supermodule 0:11, column 0:47, row 0:23
348
349 return fADCchannelOnline[supermodule][column][row];
350}
351
df5cea6b 352//________________________________________________________________
353Float_t AliEMCALCalibData::GetADCchannelDecal(Int_t supermodule, Int_t column, Int_t row) const
354{
355 // Set ADC channel decalibration witdth values
356 // All indexes start from 0!
357 // Supermodule, column,raw should follow the ALICE convention:
358 // supermodule 0:11, column 0:47, row 0:23
359
360 return fADCchannelDecal[supermodule][column][row];
361}
362
f565d89d 363//________________________________________________________________
364Float_t AliEMCALCalibData::GetADCpedestal(Int_t supermodule, Int_t column, Int_t row) const
365{
366 // Get ADC pedestal values
aae41db5 367 return fADCpedestal[supermodule][column][row];
f565d89d 368}
369
df5cea6b 370//________________________________________________________________
aaa41982 371Float_t AliEMCALCalibData::GetTimeChannel(Int_t supermodule, Int_t column, Int_t row, Int_t bc) const
df5cea6b 372{
373 // Set channel time witdth values
aaa41982 374 return fTimeChannel[supermodule][column][row][bc];
df5cea6b 375}
376
377//________________________________________________________________
378Float_t AliEMCALCalibData::GetTimeChannelDecal(Int_t supermodule, Int_t column, Int_t row) const
379{
380 // Set channel time witdth values
381 return fTimeChannelDecal[supermodule][column][row];
382}
383
f565d89d 384//________________________________________________________________
385void AliEMCALCalibData::SetADCchannel(Int_t supermodule, Int_t column, Int_t row, Float_t value)
386{
387 // Set ADC channel width values
63b315c5 388 fADCchannel[supermodule][column][row] = value;
f565d89d 389}
390
3730689d 391//________________________________________________________________
392void AliEMCALCalibData::SetADCchannelOnline(Int_t supermodule, Int_t column, Int_t row, Float_t value)
393{
394 // Set ADC channel online width values
395 fADCchannelOnline[supermodule][column][row] = value;
396}
397
df5cea6b 398//________________________________________________________________
399void AliEMCALCalibData::SetADCchannelDecal(Int_t supermodule, Int_t column, Int_t row, Float_t value)
400{
3730689d 401 // Set ADC channel width values, decalibration
df5cea6b 402 fADCchannelDecal[supermodule][column][row] = value;
403}
404
f565d89d 405//________________________________________________________________
406void AliEMCALCalibData::SetADCpedestal(Int_t supermodule, Int_t column, Int_t row, Float_t value)
407{
408 // Set ADC pedestal values
63b315c5 409 fADCpedestal[supermodule][column][row] = value;
f565d89d 410}
0e76a7bf 411
df5cea6b 412//________________________________________________________________
aaa41982 413void AliEMCALCalibData::SetTimeChannel(Int_t supermodule, Int_t column, Int_t row, Int_t bc, Float_t value)
df5cea6b 414{
415 // Set ADC pedestal values
aaa41982 416 fTimeChannel[supermodule][column][row][bc] = value;
df5cea6b 417}
418
419//________________________________________________________________
420void AliEMCALCalibData::SetTimeChannelDecal(Int_t supermodule, Int_t column, Int_t row, Float_t value)
421{
422 // Set ADC pedestal values
423 fTimeChannelDecal[supermodule][column][row] = value;
424}
425
426
0e76a7bf 427