]>
Commit | Line | Data |
---|---|---|
1 | ||
2 | /************************************************************************** | |
3 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * * | |
5 | * Author: The ALICE Off-line Project. * | |
6 | * Contributors are mentioned in the code where appropriate. * | |
7 | * * | |
8 | * Permission to use, copy, modify and distribute this software and its * | |
9 | * documentation strictly for non-commercial purposes is hereby granted * | |
10 | * without fee, provided that the above copyright notice appears in all * | |
11 | * copies and that both the copyright notice and this permission notice * | |
12 | * appear in the supporting documentation. The authors make no claims * | |
13 | * about the suitability of this software for any purpose. It is * | |
14 | * provided "as is" without express or implied warranty. * | |
15 | **************************************************************************/ | |
16 | ||
17 | /* $Id$ */ | |
18 | ||
19 | /* | |
20 | ||
21 | New release on 2007/08/17 | |
22 | ||
23 | The default raw data version (now fRAWversion ) is set to 3 | |
24 | in the constructer because version 3 raw data read and write | |
25 | are fully debugged. | |
26 | ||
27 | */ | |
28 | ||
29 | ////////////////////////////////////////////////// | |
30 | // // | |
31 | // TRD front end electronics parameters class // | |
32 | // Contains all FEE (MCM, TRAP, PASA) related // | |
33 | // parameters, constants, and mapping. // | |
34 | // // | |
35 | ////////////////////////////////////////////////// | |
36 | ||
37 | #include <TMath.h> | |
38 | ||
39 | #include "AliLog.h" | |
40 | #include "AliTRDfeeParam.h" | |
41 | #include "AliTRDgeometry.h" | |
42 | #include "AliTRDCommonParam.h" | |
43 | ||
44 | ClassImp(AliTRDfeeParam) | |
45 | ||
46 | AliTRDfeeParam *AliTRDfeeParam::fgInstance = 0; | |
47 | Bool_t AliTRDfeeParam::fgTerminated = kFALSE; | |
48 | ||
49 | //_____________________________________________________________________________ | |
50 | AliTRDfeeParam* AliTRDfeeParam::Instance() | |
51 | { | |
52 | // Instance constructor | |
53 | ||
54 | if (fgTerminated != kFALSE) { | |
55 | return 0; | |
56 | } | |
57 | ||
58 | if (fgInstance == 0) { | |
59 | fgInstance = new AliTRDfeeParam(); | |
60 | } | |
61 | ||
62 | return fgInstance; | |
63 | } | |
64 | ||
65 | //_____________________________________________________________________________ | |
66 | void AliTRDfeeParam::Terminate() | |
67 | { | |
68 | // | |
69 | // Terminate the class and release memory | |
70 | // | |
71 | ||
72 | fgTerminated = kTRUE; | |
73 | ||
74 | if (fgInstance != 0) { | |
75 | delete fgInstance; | |
76 | fgInstance = 0; | |
77 | } | |
78 | } | |
79 | ||
80 | //_____________________________________________________________________________ | |
81 | AliTRDfeeParam::AliTRDfeeParam() | |
82 | :TObject() | |
83 | ,fCP(0) | |
84 | ,fTFr1(0) | |
85 | ,fTFr2(0) | |
86 | ,fTFc1(0) | |
87 | ,fTFc2(0) | |
88 | ,fEBsglIndThr(5) | |
89 | ,fEBsumIndThr(5) | |
90 | ,fEBindLUT(0xF0) | |
91 | ,fEBignoreNeighbour(0) | |
92 | ,fRAWversion(3) | |
93 | ,fRAWstoreRaw(kTRUE) | |
94 | { | |
95 | // | |
96 | // Default constructor | |
97 | // | |
98 | ||
99 | // PASA V.4 | |
100 | if (fgkTFnExp == 1) { | |
101 | fTFr1 = 1.1563; | |
102 | fTFr2 = 0.1299; | |
103 | fTFc1 = 0.0657; | |
104 | fTFc2 = 0.0000; | |
105 | } | |
106 | else if (fgkTFnExp == 2) { | |
107 | fTFr1 = 1.1563; | |
108 | fTFr2 = 0.1299; | |
109 | fTFc1 = 0.1141; | |
110 | fTFc2 = 0.6241; | |
111 | } | |
112 | ||
113 | // fGeo = AliTRDgeometry::Instance(); | |
114 | fCP = AliTRDCommonParam::Instance(); | |
115 | ||
116 | } | |
117 | ||
118 | //_____________________________________________________________________________ | |
119 | AliTRDfeeParam::AliTRDfeeParam(const AliTRDfeeParam &p) | |
120 | :TObject(p) | |
121 | // ,fGeo(p.fGeo) | |
122 | ,fCP(p.fCP) | |
123 | ,fTFr1(p.fTFr1) | |
124 | ,fTFr2(p.fTFr2) | |
125 | ,fTFc1(p.fTFc1) | |
126 | ,fTFc2(p.fTFc2) | |
127 | ,fEBsglIndThr(p.fEBsglIndThr) | |
128 | ,fEBsumIndThr(p.fEBsumIndThr) | |
129 | ,fEBindLUT(p.fEBindLUT) | |
130 | ,fEBignoreNeighbour (p.fEBignoreNeighbour) | |
131 | ,fRAWversion(p.fRAWversion) | |
132 | ,fRAWstoreRaw(p.fRAWstoreRaw) | |
133 | { | |
134 | // | |
135 | // AliTRDfeeParam copy constructor | |
136 | // | |
137 | } | |
138 | ||
139 | //_____________________________________________________________________________ | |
140 | AliTRDfeeParam::~AliTRDfeeParam() | |
141 | { | |
142 | // | |
143 | // AliTRDfeeParam destructor | |
144 | // | |
145 | } | |
146 | ||
147 | //_____________________________________________________________________________ | |
148 | AliTRDfeeParam &AliTRDfeeParam::operator=(const AliTRDfeeParam &p) | |
149 | { | |
150 | // | |
151 | // Assignment operator | |
152 | // | |
153 | ||
154 | if (this != &p) { | |
155 | ((AliTRDfeeParam &) p).Copy(*this); | |
156 | } | |
157 | return *this; | |
158 | } | |
159 | ||
160 | //_____________________________________________________________________________ | |
161 | void AliTRDfeeParam::Copy(TObject &p) const | |
162 | { | |
163 | // | |
164 | // Copy function | |
165 | // | |
166 | ||
167 | // ((AliTRDfeeParam &) p).fGeo = fGeo; | |
168 | ((AliTRDfeeParam &) p).fCP = fCP; | |
169 | ((AliTRDfeeParam &) p).fTFr1 = fTFr1; | |
170 | ((AliTRDfeeParam &) p).fTFr2 = fTFr2; | |
171 | ((AliTRDfeeParam &) p).fTFc1 = fTFc1; | |
172 | ((AliTRDfeeParam &) p).fTFc2 = fTFc2; | |
173 | ((AliTRDfeeParam &) p).fEBsglIndThr = fEBsglIndThr; | |
174 | ((AliTRDfeeParam &) p).fEBsumIndThr = fEBsumIndThr; | |
175 | ((AliTRDfeeParam &) p).fEBindLUT = fEBindLUT; | |
176 | ((AliTRDfeeParam &) p).fEBignoreNeighbour = fEBignoreNeighbour; | |
177 | ((AliTRDfeeParam &) p).fRAWversion = fRAWversion; | |
178 | ((AliTRDfeeParam &) p).fRAWstoreRaw = fRAWstoreRaw; | |
179 | ||
180 | TObject::Copy(p); | |
181 | } | |
182 | ||
183 | //_____________________________________________________________________________ | |
184 | Int_t AliTRDfeeParam::GetPadRowFromMCM(Int_t irob, Int_t imcm) const | |
185 | { | |
186 | // | |
187 | // return on which pad row this mcm sits | |
188 | // | |
189 | ||
190 | return fgkNmcmRobInRow*(irob/2) + imcm/fgkNmcmRobInCol; | |
191 | } | |
192 | ||
193 | //_____________________________________________________________________________ | |
194 | Int_t AliTRDfeeParam::GetPadColFromADC(Int_t irob, Int_t imcm, Int_t iadc) const | |
195 | { | |
196 | // | |
197 | // Return which pad is connected to this adc channel. | |
198 | // | |
199 | // Return virtual pad number even if ADC is outside chamber | |
200 | // to keep compatibility of data processing at the edge MCM. | |
201 | // User has to check that this is in the chamber if it is essential. | |
202 | // Return -100 if iadc is invalid. | |
203 | // | |
204 | // Caution: ADC ordering in the online data is opposite to the pad column ordering. | |
205 | // And it is not one-by-one correspondence. Precise drawing can be found in: | |
206 | // http://wiki.kip.uni-heidelberg.de/ti/TRD/index.php/Image:ROB_MCM_numbering.pdf | |
207 | ||
208 | if (iadc < 0 || iadc > 19 ) return -100; | |
209 | Int_t mcmcol = imcm%fgkNmcmRobInCol + GetRobSide(irob)*fgkNmcmRobInCol; // MCM column number on ROC [0..7] | |
210 | Int_t padcol = mcmcol*fgkNcolMcm + fgkNcolMcm + 1 - iadc; | |
211 | // if( padcol < 0 || padcol >= fgkNcol ) return -1; // thisi s commented because of reson above KO | |
212 | return padcol; | |
213 | } | |
214 | ||
215 | //_____________________________________________________________________________ | |
216 | Int_t AliTRDfeeParam::GetMCMfromPad(Int_t irow, Int_t icol) const | |
217 | { | |
218 | // | |
219 | // Return on which MCM this pad is directry connected. | |
220 | // Return -1 for error. | |
221 | // | |
222 | ||
223 | if ( irow < 0 || icol < 0 || irow > fgkNrowC1 || icol > fgkNcol ) return -1; | |
224 | ||
225 | return (icol%(fgkNcol/2))/fgkNcolMcm + fgkNmcmRobInCol*(irow%fgkNmcmRobInRow); | |
226 | } | |
227 | ||
228 | //_____________________________________________________________________________ | |
229 | Int_t AliTRDfeeParam::GetROBfromPad(Int_t irow, Int_t icol) const | |
230 | { | |
231 | // | |
232 | // return on which rob this pad is | |
233 | // | |
234 | ||
235 | return (irow/fgkNmcmRobInRow)*2 + GetColSide(icol); | |
236 | } | |
237 | ||
238 | //_____________________________________________________________________________ | |
239 | Int_t AliTRDfeeParam::GetRobSide(Int_t irob) const | |
240 | { | |
241 | // | |
242 | // return on which side this rob sits (A side = 0, B side = 1) | |
243 | // | |
244 | ||
245 | if ( irob < 0 || irob >= fgkNrobC1 ) return -1; | |
246 | return irob%2; | |
247 | } | |
248 | ||
249 | //_____________________________________________________________________________ | |
250 | Int_t AliTRDfeeParam::GetColSide(Int_t icol) const | |
251 | { | |
252 | // | |
253 | // return on which side this column sits (A side = 0, B side = 1) | |
254 | // | |
255 | ||
256 | if ( icol < 0 || icol >= fgkNcol ) return -1; | |
257 | return icol/(fgkNcol/2); | |
258 | } | |
259 | ||
260 | // | |
261 | //void AliTRDfeeParam::GetFilterParam( Float_t &r1, Float_t &r2, Float_t &c1, Float_t &c2, Float_t &ped ) const | |
262 | //{ | |
263 | // | |
264 | // Return current filter parameter | |
265 | // | |
266 | ||
267 | // r1 = fR1; | |
268 | //r2 = fR2; | |
269 | //c1 = fC1; | |
270 | //c2 = fC2; | |
271 | //ped = fPedestal; | |
272 | //}; | |
273 | ||
274 | //_____________________________________________________________________________ | |
275 | void AliTRDfeeParam::SetEBsglIndThr(Int_t val) | |
276 | { | |
277 | // Set Event Buffer Sngle Indicator Threshold (EBIS in TRAP conf). | |
278 | // Timebin is indicated if ADC value >= val. | |
279 | ||
280 | if( val >= 0 && val <= 1023 ) { | |
281 | fEBsglIndThr = val; | |
282 | } else { | |
283 | AliError(Form("EBsglIndThr value %d is out of range, keep previously set value (%d).", | |
284 | val, fEBsglIndThr)); | |
285 | } | |
286 | } | |
287 | ||
288 | //_____________________________________________________________________________ | |
289 | void AliTRDfeeParam::SetEBsumIndThr(Int_t val) | |
290 | { | |
291 | // Set Event Buffer Sum Indicator Threshold (EBIT in TRAP conf). | |
292 | // Timebin is indicated if ADC sum value >= val. | |
293 | ||
294 | if( val >= 0 && val <= 4095 ) { | |
295 | fEBsumIndThr = val; | |
296 | } else { | |
297 | AliError(Form("EBsumIndThr value %d is out of range, keep previously set value (%d).", | |
298 | val, fEBsumIndThr)); | |
299 | } | |
300 | } | |
301 | ||
302 | ||
303 | //_____________________________________________________________________________ | |
304 | void AliTRDfeeParam::SetEBindLUT(Int_t val) | |
305 | { | |
306 | // Set Event Buffer Indicator Look-Up Table (EBIL in TRAP conf). | |
307 | // 8 bits value forms lookup table for combination of three criterions. | |
308 | ||
309 | if( val >= 0 && val <= 255 ) { | |
310 | fEBindLUT = val; | |
311 | } else { | |
312 | AliError(Form("EBindLUT value %d is out of range, keep previously set value (%d).", | |
313 | val, fEBindLUT)); | |
314 | } | |
315 | } | |
316 | ||
317 | //_____________________________________________________________________________ | |
318 | void AliTRDfeeParam::SetEBignoreNeighbour(Int_t val) | |
319 | { | |
320 | // Set Event Buffer Indicator Neighbor Sensitivity. (EBIN in TRAP conf). | |
321 | // If 0, take account of neigbor's values. | |
322 | ||
323 | if( val >= 0 && val <= 1 ) { | |
324 | fEBignoreNeighbour = val; | |
325 | } else { | |
326 | AliError(Form("EBignoreNeighbour value %d is out of range, keep previously set value (%d).", | |
327 | val, fEBignoreNeighbour)); | |
328 | } | |
329 | } | |
330 | ||
331 | //_____________________________________________________________________________ | |
332 | Int_t AliTRDfeeParam::GetRAWversion() | |
333 | { | |
334 | // Return raw data version (major number only) | |
335 | ||
336 | return fRAWversion; | |
337 | } | |
338 | ||
339 | //_____________________________________________________________________________ | |
340 | void AliTRDfeeParam::SetRAWversion( Int_t rawver ) | |
341 | { | |
342 | // Set raw data version (major number only) | |
343 | // Maximum available number is preset in fgkMaxRAWversion | |
344 | ||
345 | if( rawver >= 0 && rawver <= fgkMaxRAWversion ) { | |
346 | ||
347 | fRAWversion = rawver ; | |
348 | } else { | |
349 | AliError(Form("Raw version is out of range: %d",rawver)); | |
350 | } | |
351 | } | |
352 | ||
353 | //_____________________________________________________________________________ | |
354 | Bool_t AliTRDfeeParam::GetRAWstoreRaw() | |
355 | { | |
356 | // Returns kTRUE if raw data itself is read instead of filtered data | |
357 | ||
358 | return fRAWstoreRaw; | |
359 | } | |
360 | ||
361 | //_____________________________________________________________________________ | |
362 | void AliTRDfeeParam::SetRAWstoreRaw( Bool_t storeraw ) | |
363 | { | |
364 | // If kTRUE is set, raw data itself is read instead of filtered data | |
365 | ||
366 | fRAWstoreRaw = storeraw; | |
367 | } |