change order of bookkeeping events
[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
81 fADCchannelDecal[supermodule][column][row] =
82 calibda.GetADCchannelDecal(supermodule,column,row);
83
84 fADCpedestal[supermodule][column][row] =
85 calibda.GetADCpedestal(supermodule,column,row);
86
df5cea6b 87 fTimeChannelDecal[supermodule][column][row] =
88 calibda.GetTimeChannelDecal(supermodule,column,row);
aae41db5 89
90 for(Int_t bc = 0; bc < 4; bc++)
91 fTimeChannel[supermodule][column][row][bc] =
92 calibda.GetTimeChannel(supermodule,column,row,bc);
df5cea6b 93
f565d89d 94 }
95 }
96 }
97}
98
f565d89d 99//________________________________________________________________
100AliEMCALCalibData &AliEMCALCalibData::operator =(const AliEMCALCalibData& calibda)
101{
102 // assignment operator
aaa41982 103 SetName (calibda.GetName());
f565d89d 104 SetTitle(calibda.GetName());
105 Reset();
aae41db5 106
c7e54b0e 107 fADCchannelRef = calibda.GetADCchannelRef() ;
aae41db5 108
76d23fc0 109 Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules;
0c5b726e 110 Int_t nCol = AliEMCALGeoParams::fgkEMCALCols; //48
111 Int_t nRow = AliEMCALGeoParams::fgkEMCALRows; //24
8cc543cb 112
113 for(Int_t supermodule = 0; supermodule < nSMod; supermodule++) {
114 nCol = AliEMCALGeoParams::fgkEMCALCols; //48
115 nRow = AliEMCALGeoParams::fgkEMCALRows; //24
aae41db5 116 // in reality they are 1/3 but leave them as 1/2
f565d89d 117
8cc543cb 118 if(supermodule /2 == 5)
119 nRow = nRow/2;
120 if(supermodule > 11 && supermodule < 18)
121 nCol = nCol*2/3;
df5cea6b 122
123 for(Int_t column = 0; column<nCol; column++) {
124
125 for(Int_t row = 0; row<nRow; row++) {
126
127 fADCchannel[supermodule][column][row] =
128 calibda.GetADCchannel(supermodule,column,row);
129
130 fADCchannelDecal[supermodule][column][row] =
131 calibda.GetADCchannelDecal(supermodule,column,row);
132
133 fADCpedestal[supermodule][column][row] =
134 calibda.GetADCpedestal(supermodule,column,row);
aae41db5 135
df5cea6b 136 fTimeChannelDecal[supermodule][column][row] =
137 calibda.GetTimeChannelDecal(supermodule,column,row);
138
aae41db5 139 for(Int_t bc = 0; bc < 4; bc++)
140 fTimeChannel[supermodule][column][row][bc] =
141 calibda.GetTimeChannel(supermodule,column,row,bc);
142
f565d89d 143 }
144 }
145 }
aae41db5 146
aaa41982 147 return *this;
f565d89d 148}
149
aaa41982 150//_____________________________
f565d89d 151void AliEMCALCalibData::Reset()
152{
153 // Set all pedestals to 0 and all ADC channels widths to 1
aae41db5 154
aaa41982 155 fADCchannelRef = 0.0162;
aae41db5 156
76d23fc0 157 Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules;
0e76a7bf 158 Int_t nCol = AliEMCALGeoParams::fgkEMCALCols; //48
159 Int_t nRow = AliEMCALGeoParams::fgkEMCALRows; //24
8cc543cb 160
161 for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
162 nCol = AliEMCALGeoParams::fgkEMCALCols; //48
163 nRow = AliEMCALGeoParams::fgkEMCALRows; //24
aae41db5 164 // in reality they are 1/3 but leave them as 1/2
8cc543cb 165
166 if(supermodule /2 == 5)
167 nRow = nRow/2;
168 if(supermodule > 11 && supermodule < 18)
169 nCol = nCol*2/3;
aaa41982 170
df5cea6b 171 for (Int_t column=0; column < nCol; column++){
172
173 for (Int_t row = 0; row < nRow; row++){
174
175 fADCpedestal [supermodule][column][row]=0.;
176
177 fADCchannelDecal [supermodule][column][row]=1.;
178 fADCchannel [supermodule][column][row]=1.;
179
df5cea6b 180 fTimeChannelDecal[supermodule][column][row]=0.;
aae41db5 181
182 for(Int_t bc = 0; bc < 4; bc++)
183 fTimeChannel[supermodule][column][row][bc]=0;
184
0e76a7bf 185 }
186 }
aaa41982 187 }
f565d89d 188}
189
aae41db5 190//____________________________________________________
f565d89d 191void AliEMCALCalibData::Print(Option_t *option) const
192{
193 // Print tables of pedestals and ADC channels widths
df5cea6b 194 // options are: "gain", "ped", "decal", "time", "all"
195
76d23fc0 196 Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules;
0c5b726e 197 Int_t nCol = AliEMCALGeoParams::fgkEMCALCols; //48
198 Int_t nRow = AliEMCALGeoParams::fgkEMCALRows; //24
8cc543cb 199
df5cea6b 200 if (strstr(option,"ped") || strstr(option,"all")) {
f565d89d 201 printf("\n ---- Pedestal values ----\n\n");
202 for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
8cc543cb 203 nCol = AliEMCALGeoParams::fgkEMCALCols; //48
204 nRow = AliEMCALGeoParams::fgkEMCALRows; //24
205 // in reality they are 1/3 but leave them as 1/2
206 if(supermodule /2 == 5)
207 nRow = nRow/2;
208 if(supermodule > 11 && supermodule < 18)
209 nCol = nCol*2/3;
f565d89d 210 printf("============== Supermodule %d\n",supermodule+1);
211 for (Int_t column=0; column<nCol; column++){
df5cea6b 212 for (Int_t row=0; row<nRow; row++){
213 printf(" %2.4f ",fADCpedestal[supermodule][column][row]);
214 }
215 printf("\n");
f565d89d 216 }
217 }
218 }
df5cea6b 219
220 if (strstr(option,"gain") || strstr(option,"all")) {
f565d89d 221 printf("\n ---- ADC channel values ----\n\n");
222 for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
8cc543cb 223 nCol = AliEMCALGeoParams::fgkEMCALCols; //48
224 nRow = AliEMCALGeoParams::fgkEMCALRows; //24
225
226 // in reality they are 1/3 but leave them as 1/2
227 if(supermodule /2 == 5)
228 nRow = nRow/2;
229 if(supermodule > 11 && supermodule < 18)
230 nCol = nCol*2/3;
f565d89d 231 printf("============== Supermodule %d\n",supermodule+1);
232 for (Int_t column=0; column<nCol; column++){
df5cea6b 233 for (Int_t row=0; row<nRow; row++){
234 printf(" %2.4f ",fADCchannel[supermodule][column][row]);
235 }
236 printf("\n");
f565d89d 237 }
238 }
239 }
df5cea6b 240
241 if (strstr(option,"adcdecal") || strstr(option,"all")) {
242 printf("\n ---- ADC decalibration channel values ----\n\n");
243 for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
8cc543cb 244 nCol = AliEMCALGeoParams::fgkEMCALCols; //48
245 nRow = AliEMCALGeoParams::fgkEMCALRows; //24
246 // in reality they are 1/3 but leave them as 1/2
247 if(supermodule /2 == 5)
248 nRow = nRow/2;
249 if(supermodule > 11 && supermodule < 18)
250 nCol = nCol*2/3;
df5cea6b 251 printf("============== Supermodule %d\n",supermodule+1);
252 for (Int_t column=0; column<nCol; column++){
253 for (Int_t row=0; row<nRow; row++){
254 printf(" %2.4f ",fADCchannelDecal[supermodule][column][row]);
255 }
256 printf("\n");
257 }
258 }
259 }
260
261 if (strstr(option,"time") || strstr(option,"all")) {
262 printf("\n ---- time channel values ----\n\n");
263 for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
8cc543cb 264 nCol = AliEMCALGeoParams::fgkEMCALCols; //48
265 nRow = AliEMCALGeoParams::fgkEMCALRows; //24
266 // in reality they are 1/3 but leave them as 1/2
267 if(supermodule /2 == 5)
268 nRow = nRow/2;
269 if(supermodule > 11 && supermodule < 18)
270 nCol = nCol*2/3;
df5cea6b 271 printf("============== Supermodule %d\n",supermodule+1);
272 for (Int_t column=0; column<nCol; column++){
273 for (Int_t row=0; row<nRow; row++){
aae41db5 274 for(Int_t bc = 0; bc < 4; bc++)
275 printf(" %2.4f ",fTimeChannel[supermodule][column][row][bc]);
df5cea6b 276 }
277 printf("\n");
278 }
279 }
280 }
281
df5cea6b 282 if (strstr(option,"time") || strstr(option,"all")) {
283 printf("\n ---- time decalibration channel values ----\n\n");
284 for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
8cc543cb 285 nCol = AliEMCALGeoParams::fgkEMCALCols; //48
286 nRow = AliEMCALGeoParams::fgkEMCALRows; //24
287 // in reality they are 1/3 but leave them as 1/2
288 if(supermodule /2 == 5)
289 nRow = nRow/2;
290 if(supermodule > 11 && supermodule < 18)
291 nCol = nCol*2/3;
df5cea6b 292 printf("============== Supermodule %d\n",supermodule+1);
293 for (Int_t column=0; column<nCol; column++){
294 for (Int_t row=0; row<nRow; row++){
295 printf(" %2.4f ",fTimeChannelDecal[supermodule][column][row]);
296 }
297 printf("\n");
298 }
299 }
300 }
f565d89d 301}
302
303//________________________________________________________________
304Float_t AliEMCALCalibData::GetADCchannel(Int_t supermodule, Int_t column, Int_t row) const
305{
306 // Set ADC channel witdth values
63b315c5 307 // All indexes start from 0!
308 // Supermodule, column,raw should follow the ALICE convention:
309 // supermodule 0:11, column 0:47, row 0:23
aae41db5 310
63b315c5 311 return fADCchannel[supermodule][column][row];
f565d89d 312}
313
314//________________________________________________________________
df5cea6b 315Float_t AliEMCALCalibData::GetADCchannelDecal(Int_t supermodule, Int_t column, Int_t row) const
316{
317 // Set ADC channel decalibration witdth values
318 // All indexes start from 0!
319 // Supermodule, column,raw should follow the ALICE convention:
320 // supermodule 0:11, column 0:47, row 0:23
321
322 return fADCchannelDecal[supermodule][column][row];
323}
324
325//________________________________________________________________
f565d89d 326Float_t AliEMCALCalibData::GetADCpedestal(Int_t supermodule, Int_t column, Int_t row) const
327{
328 // Get ADC pedestal values
aae41db5 329 return fADCpedestal[supermodule][column][row];
f565d89d 330}
331
332//________________________________________________________________
aaa41982 333Float_t AliEMCALCalibData::GetTimeChannel(Int_t supermodule, Int_t column, Int_t row, Int_t bc) const
df5cea6b 334{
335 // Set channel time witdth values
aaa41982 336 return fTimeChannel[supermodule][column][row][bc];
df5cea6b 337}
338
339//________________________________________________________________
340Float_t AliEMCALCalibData::GetTimeChannelDecal(Int_t supermodule, Int_t column, Int_t row) const
341{
342 // Set channel time witdth values
343 return fTimeChannelDecal[supermodule][column][row];
344}
345
346//________________________________________________________________
f565d89d 347void AliEMCALCalibData::SetADCchannel(Int_t supermodule, Int_t column, Int_t row, Float_t value)
348{
349 // Set ADC channel width values
63b315c5 350 fADCchannel[supermodule][column][row] = value;
f565d89d 351}
352
353//________________________________________________________________
df5cea6b 354void AliEMCALCalibData::SetADCchannelDecal(Int_t supermodule, Int_t column, Int_t row, Float_t value)
355{
356 // Set ADC channel width values
357 fADCchannelDecal[supermodule][column][row] = value;
358}
359
360//________________________________________________________________
f565d89d 361void AliEMCALCalibData::SetADCpedestal(Int_t supermodule, Int_t column, Int_t row, Float_t value)
362{
363 // Set ADC pedestal values
63b315c5 364 fADCpedestal[supermodule][column][row] = value;
f565d89d 365}
0e76a7bf 366
367//________________________________________________________________
aaa41982 368void AliEMCALCalibData::SetTimeChannel(Int_t supermodule, Int_t column, Int_t row, Int_t bc, Float_t value)
df5cea6b 369{
370 // Set ADC pedestal values
aaa41982 371 fTimeChannel[supermodule][column][row][bc] = value;
df5cea6b 372}
373
374//________________________________________________________________
375void AliEMCALCalibData::SetTimeChannelDecal(Int_t supermodule, Int_t column, Int_t row, Float_t value)
376{
377 // Set ADC pedestal values
378 fTimeChannelDecal[supermodule][column][row] = value;
379}
380
381
0e76a7bf 382