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