]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCALCalibData.cxx
Corrected DigitizeEnergy, amplitud calculation put outside calibration parameters IF
[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
18///////////////////////////////////////////////////////////////////////////////
19// //
20// class for EMCAL calibration //
21// //
22///////////////////////////////////////////////////////////////////////////////
23
24#include "AliEMCALCalibData.h"
25
26ClassImp(AliEMCALCalibData)
27
28//________________________________________________________________
29AliEMCALCalibData::AliEMCALCalibData()
30{
31 // Default constructor
32 Reset();
33}
34
35//________________________________________________________________
36AliEMCALCalibData::AliEMCALCalibData(const char* name)
37{
38 // Constructor
39 TString namst = "Calib_";
40 namst += name;
41 SetName(namst.Data());
42 SetTitle(namst.Data());
43 Reset();
44}
45
46//________________________________________________________________
47AliEMCALCalibData::AliEMCALCalibData(const AliEMCALCalibData& calibda) :
48 TNamed(calibda)
49{
50 // copy constructor
51 SetName(calibda.GetName());
52 SetTitle(calibda.GetName());
53 Reset();
54
55 Int_t nSMod = 12;
56 Int_t nCol = 48;
57 Int_t nRow = 24;
beb28b95 58 Int_t nRow2 = 12; //Modules 11 and 12 are half modules
f565d89d 59
60 for(Int_t supermodule=0; supermodule<nSMod; supermodule++) {
61 if(supermodule > 10)
beb28b95 62 nRow = nRow2;
f565d89d 63 for(Int_t column=0; column<nCol; column++) {
64 for(Int_t row=0; row<nRow; row++) {
65 fADCchannel[supermodule][column][row] =
66 calibda.GetADCchannel(supermodule,column,row);
67 fADCpedestal[supermodule][column][row] =
68 calibda.GetADCpedestal(supermodule,column,row);
69 }
70 }
71 }
72}
73
74
75//________________________________________________________________
76AliEMCALCalibData &AliEMCALCalibData::operator =(const AliEMCALCalibData& calibda)
77{
78 // assignment operator
79 SetName(calibda.GetName());
80 SetTitle(calibda.GetName());
81 Reset();
82
83 Int_t nSMod = 12;
84 Int_t nCol = 48;
85 Int_t nRow = 24;
beb28b95 86 Int_t nRow2 = 12; //Modules 11 and 12 are half modules
f565d89d 87
88 for(Int_t supermodule=0; supermodule<nSMod; supermodule++) {
89 if(supermodule > 10)
beb28b95 90 nRow = nRow2;
f565d89d 91 for(Int_t column=0; column<nCol; column++) {
92 for(Int_t row=0; row<nRow; row++) {
93 fADCchannel[supermodule][column][row] =
94 calibda.GetADCchannel(supermodule,column,row);
95 fADCpedestal[supermodule][column][row] =
96 calibda.GetADCpedestal(supermodule,column,row);
97 }
98 }
99 }
100 return *this;
101}
102
103//________________________________________________________________
104AliEMCALCalibData::~AliEMCALCalibData()
105{
106 // Destructor
107}
108
109//________________________________________________________________
110void AliEMCALCalibData::Reset()
111{
112 // Set all pedestals to 0 and all ADC channels widths to 1
113 memset(fADCchannel ,1,12*48*24*sizeof(Float_t));
114 memset(fADCpedestal,0,12*48*24*sizeof(Float_t));
115}
116
117//________________________________________________________________
118void AliEMCALCalibData::Print(Option_t *option) const
119{
120 // Print tables of pedestals and ADC channels widths
121
122 Int_t nSMod = 12;
123 Int_t nCol = 48;
124 Int_t nRow = 24;
beb28b95 125 Int_t nRow2 = 12; //Modules 11 and 12 are half modules
f565d89d 126 if (strstr(option,"ped")) {
127 printf("\n ---- Pedestal values ----\n\n");
128 for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
129 if(supermodule > 10)
beb28b95 130 nRow = nRow2;
f565d89d 131 printf("============== Supermodule %d\n",supermodule+1);
132 for (Int_t column=0; column<nCol; column++){
133 for (Int_t row=0; row<nRow; row++){
134 printf("%4.1f",fADCpedestal[supermodule][column][row]);
135 }
136 printf("\n");
137 }
138 }
139 }
140
141
142 if (strstr(option,"gain")) {
143 printf("\n ---- ADC channel values ----\n\n");
144 for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
145 if(supermodule > 10)
beb28b95 146 nRow = nRow2;
f565d89d 147 printf("============== Supermodule %d\n",supermodule+1);
148 for (Int_t column=0; column<nCol; column++){
149 for (Int_t row=0; row<nRow; row++){
150 printf("%4.1f",fADCchannel[supermodule][column][row]);
151 }
152 printf("\n");
153 }
154 }
155 }
156}
157
158//________________________________________________________________
159Float_t AliEMCALCalibData::GetADCchannel(Int_t supermodule, Int_t column, Int_t row) const
160{
161 // Set ADC channel witdth values
162 //supermodule, column,raw should follow the internal EMCAL convention:
163 //supermodule 1:12, column 1:48, row 1:24
164
165 return fADCchannel[supermodule-1][column-1][row-1];
166}
167
168//________________________________________________________________
169Float_t AliEMCALCalibData::GetADCpedestal(Int_t supermodule, Int_t column, Int_t row) const
170{
171 // Get ADC pedestal values
172 return fADCpedestal[supermodule-1][column-1][row-1];
173}
174
175//________________________________________________________________
176void AliEMCALCalibData::SetADCchannel(Int_t supermodule, Int_t column, Int_t row, Float_t value)
177{
178 // Set ADC channel width values
179 fADCchannel[supermodule-1][column-1][row-1] = value;
180}
181
182//________________________________________________________________
183void AliEMCALCalibData::SetADCpedestal(Int_t supermodule, Int_t column, Int_t row, Float_t value)
184{
185 // Set ADC pedestal values
186 fADCpedestal[supermodule-1][column-1][row-1] = value;
187}