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 | |
26 | ClassImp(AliEMCALCalibData) |
27 | |
28 | //________________________________________________________________ |
29 | AliEMCALCalibData::AliEMCALCalibData() |
30 | { |
31 | // Default constructor |
32 | Reset(); |
33 | } |
34 | |
35 | //________________________________________________________________ |
36 | AliEMCALCalibData::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 | //________________________________________________________________ |
47 | AliEMCALCalibData::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; |
58 | |
59 | for(Int_t supermodule=0; supermodule<nSMod; supermodule++) { |
60 | if(supermodule > 10) |
61 | nRow = nRow/2; |
62 | for(Int_t column=0; column<nCol; column++) { |
63 | for(Int_t row=0; row<nRow; row++) { |
64 | fADCchannel[supermodule][column][row] = |
65 | calibda.GetADCchannel(supermodule,column,row); |
66 | fADCpedestal[supermodule][column][row] = |
67 | calibda.GetADCpedestal(supermodule,column,row); |
68 | } |
69 | } |
70 | } |
71 | } |
72 | |
73 | |
74 | //________________________________________________________________ |
75 | AliEMCALCalibData &AliEMCALCalibData::operator =(const AliEMCALCalibData& calibda) |
76 | { |
77 | // assignment operator |
78 | SetName(calibda.GetName()); |
79 | SetTitle(calibda.GetName()); |
80 | Reset(); |
81 | |
82 | Int_t nSMod = 12; |
83 | Int_t nCol = 48; |
84 | Int_t nRow = 24; |
85 | |
86 | for(Int_t supermodule=0; supermodule<nSMod; supermodule++) { |
87 | if(supermodule > 10) |
88 | nRow = nRow/2; |
89 | for(Int_t column=0; column<nCol; column++) { |
90 | for(Int_t row=0; row<nRow; row++) { |
91 | fADCchannel[supermodule][column][row] = |
92 | calibda.GetADCchannel(supermodule,column,row); |
93 | fADCpedestal[supermodule][column][row] = |
94 | calibda.GetADCpedestal(supermodule,column,row); |
95 | } |
96 | } |
97 | } |
98 | return *this; |
99 | } |
100 | |
101 | //________________________________________________________________ |
102 | AliEMCALCalibData::~AliEMCALCalibData() |
103 | { |
104 | // Destructor |
105 | } |
106 | |
107 | //________________________________________________________________ |
108 | void AliEMCALCalibData::Reset() |
109 | { |
110 | // Set all pedestals to 0 and all ADC channels widths to 1 |
111 | memset(fADCchannel ,1,12*48*24*sizeof(Float_t)); |
112 | memset(fADCpedestal,0,12*48*24*sizeof(Float_t)); |
113 | } |
114 | |
115 | //________________________________________________________________ |
116 | void AliEMCALCalibData::Print(Option_t *option) const |
117 | { |
118 | // Print tables of pedestals and ADC channels widths |
119 | |
120 | Int_t nSMod = 12; |
121 | Int_t nCol = 48; |
122 | Int_t nRow = 24; |
123 | |
124 | if (strstr(option,"ped")) { |
125 | printf("\n ---- Pedestal values ----\n\n"); |
126 | for (Int_t supermodule=0; supermodule<nSMod; supermodule++){ |
127 | if(supermodule > 10) |
128 | nRow = nRow/2; |
129 | printf("============== Supermodule %d\n",supermodule+1); |
130 | for (Int_t column=0; column<nCol; column++){ |
131 | for (Int_t row=0; row<nRow; row++){ |
132 | printf("%4.1f",fADCpedestal[supermodule][column][row]); |
133 | } |
134 | printf("\n"); |
135 | } |
136 | } |
137 | } |
138 | |
139 | |
140 | if (strstr(option,"gain")) { |
141 | printf("\n ---- ADC channel values ----\n\n"); |
142 | for (Int_t supermodule=0; supermodule<nSMod; supermodule++){ |
143 | if(supermodule > 10) |
144 | nRow = nRow/2; |
145 | printf("============== Supermodule %d\n",supermodule+1); |
146 | for (Int_t column=0; column<nCol; column++){ |
147 | for (Int_t row=0; row<nRow; row++){ |
148 | printf("%4.1f",fADCchannel[supermodule][column][row]); |
149 | } |
150 | printf("\n"); |
151 | } |
152 | } |
153 | } |
154 | } |
155 | |
156 | //________________________________________________________________ |
157 | Float_t AliEMCALCalibData::GetADCchannel(Int_t supermodule, Int_t column, Int_t row) const |
158 | { |
159 | // Set ADC channel witdth values |
160 | //supermodule, column,raw should follow the internal EMCAL convention: |
161 | //supermodule 1:12, column 1:48, row 1:24 |
162 | |
163 | return fADCchannel[supermodule-1][column-1][row-1]; |
164 | } |
165 | |
166 | //________________________________________________________________ |
167 | Float_t AliEMCALCalibData::GetADCpedestal(Int_t supermodule, Int_t column, Int_t row) const |
168 | { |
169 | // Get ADC pedestal values |
170 | return fADCpedestal[supermodule-1][column-1][row-1]; |
171 | } |
172 | |
173 | //________________________________________________________________ |
174 | void AliEMCALCalibData::SetADCchannel(Int_t supermodule, Int_t column, Int_t row, Float_t value) |
175 | { |
176 | // Set ADC channel width values |
177 | fADCchannel[supermodule-1][column-1][row-1] = value; |
178 | } |
179 | |
180 | //________________________________________________________________ |
181 | void AliEMCALCalibData::SetADCpedestal(Int_t supermodule, Int_t column, Int_t row, Float_t value) |
182 | { |
183 | // Set ADC pedestal values |
184 | fADCpedestal[supermodule-1][column-1][row-1] = value; |
185 | } |