Line data Source code
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 : #include "AliTRDCalOnlineGainTable.h"
17 :
18 : //////////////////////////////////////////////////////////////////////////////////////////////
19 : //
20 : // Data structure to store gaintables of the online calibration in the OCDB
21 : // consisting of three classes:
22 : // AliTRDCalOnlineGainTable
23 : // AliTRDCalOnlineGainTableROC
24 : // AliTRDCalOnlineGainTableMCM
25 : //
26 : // AliTRDCalOnlineGainTable is the main class from which all stored data can be accessed.
27 : // The two sub-classes AliTRDCalOnlineGainTableROC and AliTRDCalOnlineGainTableMCM
28 : // contain the gaintables on ROC level and on the MCM level respectively.
29 : //
30 : // The online calibration is used to compensate gain deviations on the pad level.
31 : // For the offline reconstruction the online calibration has to be undone.
32 : // The corresponding gain correction factor that was used by the online gain filter can be accessed
33 : // via the functions AliTRDCalOnlineGainTable::GetGainCorrectionFactor(Int_t det, Int_t row, Int_t col)
34 : // and AliTRDCalOnlineGainTable::GetGainCorrectionFactor(Int_t sector, Int_t stack, Int_t layer, Int_t row, Int_t col).
35 : //
36 : //////////////////////////////////////////////////////////////////////////////////////////////
37 :
38 48 : ClassImp(AliTRDCalOnlineGainTable);
39 :
40 : const Float_t AliTRDCalOnlineGainTable::UnDef=-999.;
41 :
42 : //_____________________________________________________________________________
43 : AliTRDCalOnlineGainTable::AliTRDCalOnlineGainTable()
44 21 : :TObject()
45 105 : {
46 : //
47 : // constructor
48 : //
49 :
50 22722 : for (int i=0; i<540; i++) {
51 11340 : fROCGainTables[i] = 0;
52 : }
53 :
54 42 : }
55 :
56 : //_____________________________________________________________________________
57 : AliTRDCalOnlineGainTable::AliTRDCalOnlineGainTable(const AliTRDCalOnlineGainTable& other)
58 0 : :TObject(other)
59 0 : {
60 : //
61 : // copy constructor
62 : //
63 :
64 0 : for (int i=0; i<540; i++) {
65 0 : if (other.GetGainTableROC(i)) {
66 0 : fROCGainTables[i] = new AliTRDCalOnlineGainTableROC( *(other.GetGainTableROC(i)) );
67 0 : } else {
68 0 : fROCGainTables[i] = 0;
69 : }
70 : }
71 :
72 0 : }
73 :
74 : //_____________________________________________________________________________
75 : AliTRDCalOnlineGainTable& AliTRDCalOnlineGainTable::operator=(const AliTRDCalOnlineGainTable& other)
76 : {
77 : //
78 : // assignment operator
79 : //
80 :
81 0 : for (int i=0; i<540; i++) {
82 :
83 0 : if (fROCGainTables[i]) {
84 0 : delete fROCGainTables[i];
85 : }
86 :
87 0 : if (other.GetGainTableROC(i)) {
88 0 : fROCGainTables[i] = new AliTRDCalOnlineGainTableROC( *(other.GetGainTableROC(i)) );
89 0 : } else {
90 0 : fROCGainTables[i] = 0;
91 : }
92 : }
93 :
94 0 : return *this;
95 :
96 0 : }
97 :
98 : //_____________________________________________________________________________
99 : AliTRDCalOnlineGainTable::~AliTRDCalOnlineGainTable()
100 4 : {
101 : //
102 : // destructor
103 : //
104 :
105 1082 : for (int i=0; i<540; i++) {
106 540 : if (fROCGainTables[i]) {
107 0 : delete fROCGainTables[i];
108 : }
109 : }
110 :
111 2 : }
112 :
113 : //_____________________________________________________________________________
114 : Float_t AliTRDCalOnlineGainTable::GetGainCorrectionFactor(Int_t det
115 : , Int_t row
116 : , Int_t col) const
117 : {
118 : //
119 : // returns the Gain Correction Factor of the channel
120 : // given by det, row, col
121 : //
122 :
123 0 : AliTRDCalOnlineGainTableROC* gtbl = GetGainTableROC(det);
124 :
125 0 : if (gtbl) {
126 0 : return gtbl->GetGainCorrectionFactor(row,col);
127 : } else {
128 0 : return AliTRDCalOnlineGainTable::UnDef;
129 : }
130 :
131 0 : }
132 :
133 : //_____________________________________________________________________________
134 : Float_t AliTRDCalOnlineGainTable::GetGainCorrectionFactor(Int_t sector
135 : , Int_t stack
136 : , Int_t layer
137 : , Int_t row
138 : , Int_t col) const
139 : {
140 : //
141 : // returns the Gain Correction Factor of the channel
142 : // given by sector, stack, layer, row, col
143 : //
144 :
145 0 : return GetGainCorrectionFactor(30*sector + 6*stack + layer, row, col);
146 : }
147 :
148 : //_____________________________________________________________________________
149 : Short_t AliTRDCalOnlineGainTable::GetAdcdac(Int_t det, Int_t row, Int_t col)
150 : {
151 : //
152 : // returns the ADC's reference voltage of the channel
153 : // given by det, row, col
154 : //
155 :
156 0 : AliTRDCalOnlineGainTableROC* gtbl = GetGainTableROC(det);
157 :
158 0 : if (gtbl) {
159 0 : return gtbl->GetAdcdac(row,col);
160 : } else {
161 0 : return -999;
162 : }
163 :
164 0 : }
165 :
166 : //_____________________________________________________________________________
167 : Short_t AliTRDCalOnlineGainTable::GetAdcdac(Int_t sector, Int_t stack, Int_t layer,
168 : Int_t row, Int_t col)
169 : {
170 : //
171 : // returns the ADC's reference voltage of the channel
172 : // given by sector, stack, layer, row, col
173 : //
174 :
175 0 : return GetAdcdac(30*sector + 6*stack + layer, row, col);
176 : }
177 :
178 : //_____________________________________________________________________________
179 : Float_t AliTRDCalOnlineGainTable::GetMCMGain(Int_t det, Int_t row, Int_t col)
180 : {
181 : //
182 : // returns the Gain Factor which would lead to a Correction Factor of 1.0
183 : // within the MCM given by det, row, col
184 : //
185 :
186 0 : AliTRDCalOnlineGainTableROC* gtbl = GetGainTableROC(det);
187 :
188 0 : if (gtbl) {
189 0 : return gtbl->GetMCMGain(row,col);
190 : } else {
191 0 : return AliTRDCalOnlineGainTable::UnDef;
192 : }
193 :
194 0 : }
195 :
196 : //_____________________________________________________________________________
197 : Float_t AliTRDCalOnlineGainTable::GetMCMGain(Int_t sector, Int_t stack, Int_t layer,
198 : Int_t row, Int_t col)
199 : {
200 : //
201 : // returns the Gain Factor which would lead to a Correction Factor of 1.0
202 : // within the MCM given by sector, stack, layer, row, col
203 : //
204 :
205 0 : return GetMCMGain(30*sector + 6*stack + layer, row, col);
206 : }
207 :
208 : //_____________________________________________________________________________
209 : Short_t AliTRDCalOnlineGainTable::GetFGAN(Int_t det, Int_t row, Int_t col)
210 : {
211 : //
212 : // returns the Gain Correction Filter Additive of the channel
213 : // given by det, row, col
214 : //
215 :
216 0 : AliTRDCalOnlineGainTableROC* gtbl = GetGainTableROC(det);
217 :
218 0 : if (gtbl) {
219 0 : return gtbl->GetFGAN(row,col);
220 : } else {
221 0 : return -999;
222 : }
223 :
224 0 : }
225 :
226 : //_____________________________________________________________________________
227 : Short_t AliTRDCalOnlineGainTable::GetFGAN(Int_t sector, Int_t stack, Int_t layer,
228 : Int_t row, Int_t col)
229 : {
230 : //
231 : // returns the Gain Correction Filter Additive of the channel
232 : // given by sector, stack, layer, row, col
233 : //
234 :
235 0 : return GetFGAN(30*sector + 6*stack + layer, row, col);
236 : }
237 :
238 : //_____________________________________________________________________________
239 : Short_t AliTRDCalOnlineGainTable::GetFGFN(Int_t det, Int_t row, Int_t col)
240 : {
241 : //
242 : // returns the Gain Correction Filter Factor of the channel
243 : // given by det, row, col
244 : //
245 :
246 0 : AliTRDCalOnlineGainTableROC* gtbl = GetGainTableROC(det);
247 :
248 0 : if (gtbl) {
249 0 : return gtbl->GetFGFN(row,col);
250 : } else {
251 0 : return -999;
252 : }
253 0 : }
254 :
255 : //_____________________________________________________________________________
256 : Short_t AliTRDCalOnlineGainTable::GetFGFN(Int_t sector, Int_t stack, Int_t layer,
257 : Int_t row, Int_t col)
258 : {
259 : //
260 : // returns the Gain Correction Filter Factor of the channel
261 : // given by sector, stack, layer, row, col
262 : //
263 :
264 0 : return GetFGFN(30*sector + 6*stack + layer, row, col);
265 : }
266 :
267 : //_____________________________________________________________________________
268 : void AliTRDCalOnlineGainTable::AllocateGainTableROC(Int_t det)
269 : {
270 : //
271 : // allocates a Gain Table for the given detector
272 : //
273 :
274 0 : if (fROCGainTables[det]) {
275 0 : delete fROCGainTables[det];
276 : }
277 :
278 0 : fROCGainTables[det] = new AliTRDCalOnlineGainTableROC;
279 0 : }
280 :
|