]>
Commit | Line | Data |
---|---|---|
dbadb4c4 | 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 | ClassImp(AliTRDCalOnlineGainTable); | |
39 | ||
40 | const Float_t AliTRDCalOnlineGainTable::UnDef=-999.; | |
41 | ||
42 | //_____________________________________________________________________________ | |
43 | AliTRDCalOnlineGainTable::AliTRDCalOnlineGainTable() | |
44 | :TObject() | |
45 | { | |
46 | // | |
47 | // constructor | |
48 | // | |
49 | ||
50 | for (int i=0; i<540; i++) { | |
51 | fROCGainTables[i] = 0; | |
52 | } | |
53 | ||
54 | } | |
55 | ||
56 | //_____________________________________________________________________________ | |
57 | AliTRDCalOnlineGainTable::AliTRDCalOnlineGainTable(const AliTRDCalOnlineGainTable& other) | |
58 | :TObject(other) | |
59 | { | |
60 | // | |
61 | // copy constructor | |
62 | // | |
63 | ||
64 | for (int i=0; i<540; i++) { | |
65 | if (other.GetGainTableROC(i)) { | |
66 | fROCGainTables[i] = new AliTRDCalOnlineGainTableROC( *(other.GetGainTableROC(i)) ); | |
67 | } else { | |
68 | fROCGainTables[i] = 0; | |
69 | } | |
70 | } | |
71 | ||
72 | } | |
73 | ||
74 | //_____________________________________________________________________________ | |
75 | AliTRDCalOnlineGainTable& AliTRDCalOnlineGainTable::operator=(const AliTRDCalOnlineGainTable& other) | |
76 | { | |
77 | // | |
78 | // assignment operator | |
79 | // | |
80 | ||
81 | for (int i=0; i<540; i++) { | |
82 | ||
83 | if (fROCGainTables[i]) { | |
84 | delete fROCGainTables[i]; | |
85 | } | |
86 | ||
87 | if (other.GetGainTableROC(i)) { | |
88 | fROCGainTables[i] = new AliTRDCalOnlineGainTableROC( *(other.GetGainTableROC(i)) ); | |
89 | } else { | |
90 | fROCGainTables[i] = 0; | |
91 | } | |
92 | } | |
93 | ||
94 | return *this; | |
95 | ||
96 | } | |
97 | ||
98 | //_____________________________________________________________________________ | |
99 | AliTRDCalOnlineGainTable::~AliTRDCalOnlineGainTable() | |
100 | { | |
101 | // | |
102 | // destructor | |
103 | // | |
104 | ||
105 | for (int i=0; i<540; i++) { | |
106 | if (fROCGainTables[i]) { | |
107 | delete fROCGainTables[i]; | |
108 | } | |
109 | } | |
110 | ||
111 | } | |
112 | ||
113 | //_____________________________________________________________________________ | |
114 | Float_t AliTRDCalOnlineGainTable::GetGainCorrectionFactor(Int_t det, Int_t row, Int_t col) | |
115 | { | |
116 | // | |
117 | // returns the Gain Correction Factor of the channel | |
118 | // given by det, row, col | |
119 | // | |
120 | ||
121 | AliTRDCalOnlineGainTableROC* gtbl = GetGainTableROC(det); | |
122 | ||
123 | if (gtbl) { | |
124 | return gtbl->GetGainCorrectionFactor(row,col); | |
125 | } else { | |
126 | return AliTRDCalOnlineGainTable::UnDef; | |
127 | } | |
128 | ||
129 | } | |
130 | ||
131 | //_____________________________________________________________________________ | |
132 | Float_t AliTRDCalOnlineGainTable::GetGainCorrectionFactor(Int_t sector, Int_t stack, Int_t layer, | |
133 | Int_t row, Int_t col) | |
134 | { | |
135 | // | |
136 | // returns the Gain Correction Factor of the channel | |
137 | // given by sector, stack, layer, row, col | |
138 | // | |
139 | ||
140 | return GetGainCorrectionFactor(30*sector + 6*stack + layer, row, col); | |
141 | } | |
142 | ||
143 | //_____________________________________________________________________________ | |
144 | Short_t AliTRDCalOnlineGainTable::GetAdcdac(Int_t det, Int_t row, Int_t col) | |
145 | { | |
146 | // | |
147 | // returns the ADC's reference voltage of the channel | |
148 | // given by det, row, col | |
149 | // | |
150 | ||
151 | AliTRDCalOnlineGainTableROC* gtbl = GetGainTableROC(det); | |
152 | ||
153 | if (gtbl) { | |
154 | return gtbl->GetAdcdac(row,col); | |
155 | } else { | |
156 | return -999; | |
157 | } | |
158 | ||
159 | } | |
160 | ||
161 | //_____________________________________________________________________________ | |
162 | Short_t AliTRDCalOnlineGainTable::GetAdcdac(Int_t sector, Int_t stack, Int_t layer, | |
163 | Int_t row, Int_t col) | |
164 | { | |
165 | // | |
166 | // returns the ADC's reference voltage of the channel | |
167 | // given by sector, stack, layer, row, col | |
168 | // | |
169 | ||
170 | return GetAdcdac(30*sector + 6*stack + layer, row, col); | |
171 | } | |
172 | ||
173 | //_____________________________________________________________________________ | |
174 | Float_t AliTRDCalOnlineGainTable::GetMCMGain(Int_t det, Int_t row, Int_t col) | |
175 | { | |
176 | // | |
177 | // returns the Gain Factor which would lead to a Correction Factor of 1.0 | |
178 | // within the MCM given by det, row, col | |
179 | // | |
180 | ||
181 | AliTRDCalOnlineGainTableROC* gtbl = GetGainTableROC(det); | |
182 | ||
183 | if (gtbl) { | |
184 | return gtbl->GetMCMGain(row,col); | |
185 | } else { | |
186 | return AliTRDCalOnlineGainTable::UnDef; | |
187 | } | |
188 | ||
189 | } | |
190 | ||
191 | //_____________________________________________________________________________ | |
192 | Float_t AliTRDCalOnlineGainTable::GetMCMGain(Int_t sector, Int_t stack, Int_t layer, | |
193 | Int_t row, Int_t col) | |
194 | { | |
195 | // | |
196 | // returns the Gain Factor which would lead to a Correction Factor of 1.0 | |
197 | // within the MCM given by sector, stack, layer, row, col | |
198 | // | |
199 | ||
200 | return GetMCMGain(30*sector + 6*stack + layer, row, col); | |
201 | } | |
202 | ||
203 | //_____________________________________________________________________________ | |
204 | Short_t AliTRDCalOnlineGainTable::GetFGAN(Int_t det, Int_t row, Int_t col) | |
205 | { | |
206 | // | |
207 | // returns the Gain Correction Filter Additive of the channel | |
208 | // given by det, row, col | |
209 | // | |
210 | ||
211 | AliTRDCalOnlineGainTableROC* gtbl = GetGainTableROC(det); | |
212 | ||
213 | if (gtbl) { | |
214 | return gtbl->GetFGAN(row,col); | |
215 | } else { | |
216 | return -999; | |
217 | } | |
218 | ||
219 | } | |
220 | ||
221 | //_____________________________________________________________________________ | |
222 | Short_t AliTRDCalOnlineGainTable::GetFGAN(Int_t sector, Int_t stack, Int_t layer, | |
223 | Int_t row, Int_t col) | |
224 | { | |
225 | // | |
226 | // returns the Gain Correction Filter Additive of the channel | |
227 | // given by sector, stack, layer, row, col | |
228 | // | |
229 | ||
230 | return GetFGAN(30*sector + 6*stack + layer, row, col); | |
231 | } | |
232 | ||
233 | //_____________________________________________________________________________ | |
234 | Short_t AliTRDCalOnlineGainTable::GetFGFN(Int_t det, Int_t row, Int_t col) | |
235 | { | |
236 | // | |
237 | // returns the Gain Correction Filter Factor of the channel | |
238 | // given by det, row, col | |
239 | // | |
240 | ||
241 | AliTRDCalOnlineGainTableROC* gtbl = GetGainTableROC(det); | |
242 | ||
243 | if (gtbl) { | |
244 | return gtbl->GetFGFN(row,col); | |
245 | } else { | |
246 | return -999; | |
247 | } | |
248 | } | |
249 | ||
250 | //_____________________________________________________________________________ | |
251 | Short_t AliTRDCalOnlineGainTable::GetFGFN(Int_t sector, Int_t stack, Int_t layer, | |
252 | Int_t row, Int_t col) | |
253 | { | |
254 | // | |
255 | // returns the Gain Correction Filter Factor of the channel | |
256 | // given by sector, stack, layer, row, col | |
257 | // | |
258 | ||
259 | return GetFGFN(30*sector + 6*stack + layer, row, col); | |
260 | } | |
261 | ||
262 | //_____________________________________________________________________________ | |
263 | void AliTRDCalOnlineGainTable::AllocateGainTableROC(Int_t det) | |
264 | { | |
265 | // | |
266 | // allocates a Gain Table for the given detector | |
267 | // | |
268 | ||
269 | if (fROCGainTables[det]) { | |
270 | delete fROCGainTables[det]; | |
271 | } | |
272 | ||
273 | fROCGainTables[det] = new AliTRDCalOnlineGainTableROC; | |
274 | } | |
275 |