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