Making online tracklets usable in offline reconstruction
[u/mrichter/AliRoot.git] / TRD / AliTRDfeeParam.cxx
CommitLineData
022e76c3 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
acc49af9 19////////////////////////////////////////////////////////////////////////////
20// //
21// TRD front end electronics parameters class //
22// Contains all FEE (MCM, TRAP, PASA) related //
23// parameters, constants, and mapping. //
24// //
25// New release on 2007/08/17: //
26// The default raw data version (now fRAWversion ) is set to 3 //
27// in the constructor because version 3 raw data read and write //
28// are fully debugged. //
29// //
30// Author: //
31// Ken Oyama (oyama@physi.uni-heidelberg.de) //
32// //
33////////////////////////////////////////////////////////////////////////////
022e76c3 34
35#include <TMath.h>
36
ecf39416 37#include "AliLog.h"
ba84a3e3 38
022e76c3 39#include "AliTRDfeeParam.h"
40#include "AliTRDgeometry.h"
41#include "AliTRDCommonParam.h"
42
43ClassImp(AliTRDfeeParam)
44
45AliTRDfeeParam *AliTRDfeeParam::fgInstance = 0;
46Bool_t AliTRDfeeParam::fgTerminated = kFALSE;
47
48//_____________________________________________________________________________
49AliTRDfeeParam* AliTRDfeeParam::Instance()
50{
acc49af9 51 //
022e76c3 52 // Instance constructor
acc49af9 53 //
54
022e76c3 55 if (fgTerminated != kFALSE) {
56 return 0;
57 }
58
59 if (fgInstance == 0) {
60 fgInstance = new AliTRDfeeParam();
61 }
62
63 return fgInstance;
acc49af9 64
022e76c3 65}
66
67//_____________________________________________________________________________
68void AliTRDfeeParam::Terminate()
69{
70 //
71 // Terminate the class and release memory
72 //
73
74 fgTerminated = kTRUE;
75
76 if (fgInstance != 0) {
77 delete fgInstance;
78 fgInstance = 0;
79 }
acc49af9 80
022e76c3 81}
82
83//_____________________________________________________________________________
84AliTRDfeeParam::AliTRDfeeParam()
85 :TObject()
022e76c3 86 ,fCP(0)
f2979d08 87 ,fTFnExp(1)
dfd03fc3 88 ,fTFr1(0)
89 ,fTFr2(0)
90 ,fTFc1(0)
91 ,fTFc2(0)
2ec0bacc 92 ,fEBsglIndThr(5)
93 ,fEBsumIndThr(5)
94 ,fEBindLUT(0xF0)
95 ,fEBignoreNeighbour(0)
ecf39416 96 ,fRAWversion(3)
97 ,fRAWstoreRaw(kTRUE)
022e76c3 98{
99 //
100 // Default constructor
101 //
102
103 // PASA V.4
f2979d08 104 if (fTFnExp == 1) {
dfd03fc3 105 fTFr1 = 1.1563;
106 fTFr2 = 0.1299;
107 fTFc1 = 0.0657;
108 fTFc2 = 0.0000;
022e76c3 109 }
f2979d08 110 else if (fTFnExp == 2) {
dfd03fc3 111 fTFr1 = 1.1563;
112 fTFr2 = 0.1299;
113 fTFc1 = 0.1141;
114 fTFc2 = 0.6241;
022e76c3 115 }
116
022e76c3 117 fCP = AliTRDCommonParam::Instance();
118
119}
120
121//_____________________________________________________________________________
ba84a3e3 122AliTRDfeeParam::AliTRDfeeParam(TRootIoCtor *)
123 :TObject()
124 ,fCP(0)
f2979d08 125 ,fTFnExp(1)
ba84a3e3 126 ,fTFr1(0)
127 ,fTFr2(0)
128 ,fTFc1(0)
129 ,fTFc2(0)
130 ,fEBsglIndThr(0)
131 ,fEBsumIndThr(0)
132 ,fEBindLUT(0)
133 ,fEBignoreNeighbour(0)
134 ,fRAWversion(0)
135 ,fRAWstoreRaw(0)
136{
137 //
138 // IO constructor
139 //
140
141}
142
143//_____________________________________________________________________________
022e76c3 144AliTRDfeeParam::AliTRDfeeParam(const AliTRDfeeParam &p)
145 :TObject(p)
022e76c3 146 ,fCP(p.fCP)
f2979d08 147 ,fTFnExp(p.fTFnExp)
dfd03fc3 148 ,fTFr1(p.fTFr1)
149 ,fTFr2(p.fTFr2)
150 ,fTFc1(p.fTFc1)
151 ,fTFc2(p.fTFc2)
2ec0bacc 152 ,fEBsglIndThr(p.fEBsglIndThr)
153 ,fEBsumIndThr(p.fEBsumIndThr)
154 ,fEBindLUT(p.fEBindLUT)
155 ,fEBignoreNeighbour (p.fEBignoreNeighbour)
ecf39416 156 ,fRAWversion(p.fRAWversion)
157 ,fRAWstoreRaw(p.fRAWstoreRaw)
022e76c3 158{
159 //
160 // AliTRDfeeParam copy constructor
161 //
acc49af9 162
022e76c3 163}
164
165//_____________________________________________________________________________
166AliTRDfeeParam::~AliTRDfeeParam()
167{
168 //
169 // AliTRDfeeParam destructor
170 //
acc49af9 171
022e76c3 172}
173
174//_____________________________________________________________________________
175AliTRDfeeParam &AliTRDfeeParam::operator=(const AliTRDfeeParam &p)
176{
177 //
178 // Assignment operator
179 //
180
181 if (this != &p) {
182 ((AliTRDfeeParam &) p).Copy(*this);
183 }
acc49af9 184
022e76c3 185 return *this;
acc49af9 186
022e76c3 187}
188
189//_____________________________________________________________________________
190void AliTRDfeeParam::Copy(TObject &p) const
191{
192 //
193 // Copy function
194 //
195
ecf39416 196 ((AliTRDfeeParam &) p).fCP = fCP;
f2979d08 197 ((AliTRDfeeParam &) p).fTFnExp = fTFnExp;
ecf39416 198 ((AliTRDfeeParam &) p).fTFr1 = fTFr1;
199 ((AliTRDfeeParam &) p).fTFr2 = fTFr2;
200 ((AliTRDfeeParam &) p).fTFc1 = fTFc1;
201 ((AliTRDfeeParam &) p).fTFc2 = fTFc2;
2ec0bacc 202 ((AliTRDfeeParam &) p).fEBsglIndThr = fEBsglIndThr;
203 ((AliTRDfeeParam &) p).fEBsumIndThr = fEBsumIndThr;
204 ((AliTRDfeeParam &) p).fEBindLUT = fEBindLUT;
205 ((AliTRDfeeParam &) p).fEBignoreNeighbour = fEBignoreNeighbour;
ecf39416 206 ((AliTRDfeeParam &) p).fRAWversion = fRAWversion;
207 ((AliTRDfeeParam &) p).fRAWstoreRaw = fRAWstoreRaw;
022e76c3 208
209 TObject::Copy(p);
acc49af9 210
022e76c3 211}
212
213//_____________________________________________________________________________
214Int_t AliTRDfeeParam::GetPadRowFromMCM(Int_t irob, Int_t imcm) const
215{
216 //
acc49af9 217 // Return on which pad row this mcm sits
022e76c3 218 //
219
220 return fgkNmcmRobInRow*(irob/2) + imcm/fgkNmcmRobInCol;
acc49af9 221
022e76c3 222}
223
224//_____________________________________________________________________________
225Int_t AliTRDfeeParam::GetPadColFromADC(Int_t irob, Int_t imcm, Int_t iadc) const
226{
227 //
ecf39416 228 // Return which pad is connected to this adc channel.
229 //
230 // Return virtual pad number even if ADC is outside chamber
231 // to keep compatibility of data processing at the edge MCM.
232 // User has to check that this is in the chamber if it is essential.
233 // Return -100 if iadc is invalid.
234 //
022e76c3 235 // Caution: ADC ordering in the online data is opposite to the pad column ordering.
236 // And it is not one-by-one correspondence. Precise drawing can be found in:
237 // http://wiki.kip.uni-heidelberg.de/ti/TRD/index.php/Image:ROB_MCM_numbering.pdf
acc49af9 238 //
022e76c3 239
a6d08b7f 240 if (iadc < 0 || iadc > fgkNadcMcm ) return -100;
022e76c3 241 Int_t mcmcol = imcm%fgkNmcmRobInCol + GetRobSide(irob)*fgkNmcmRobInCol; // MCM column number on ROC [0..7]
242 Int_t padcol = mcmcol*fgkNcolMcm + fgkNcolMcm + 1 - iadc;
ecf39416 243 // if( padcol < 0 || padcol >= fgkNcol ) return -1; // thisi s commented because of reson above KO
acc49af9 244
022e76c3 245 return padcol;
acc49af9 246
022e76c3 247}
248
249//_____________________________________________________________________________
250Int_t AliTRDfeeParam::GetMCMfromPad(Int_t irow, Int_t icol) const
251{
252 //
253 // Return on which MCM this pad is directry connected.
254 // Return -1 for error.
255 //
256
257 if ( irow < 0 || icol < 0 || irow > fgkNrowC1 || icol > fgkNcol ) return -1;
258
259 return (icol%(fgkNcol/2))/fgkNcolMcm + fgkNmcmRobInCol*(irow%fgkNmcmRobInRow);
acc49af9 260
022e76c3 261}
262
263//_____________________________________________________________________________
264Int_t AliTRDfeeParam::GetROBfromPad(Int_t irow, Int_t icol) const
265{
266 //
acc49af9 267 // Return on which rob this pad is
022e76c3 268 //
269
270 return (irow/fgkNmcmRobInRow)*2 + GetColSide(icol);
acc49af9 271
022e76c3 272}
273
274//_____________________________________________________________________________
275Int_t AliTRDfeeParam::GetRobSide(Int_t irob) const
276{
277 //
acc49af9 278 // Return on which side this rob sits (A side = 0, B side = 1)
022e76c3 279 //
280
281 if ( irob < 0 || irob >= fgkNrobC1 ) return -1;
acc49af9 282
022e76c3 283 return irob%2;
acc49af9 284
022e76c3 285}
286
287//_____________________________________________________________________________
288Int_t AliTRDfeeParam::GetColSide(Int_t icol) const
289{
290 //
acc49af9 291 // Return on which side this column sits (A side = 0, B side = 1)
022e76c3 292 //
293
294 if ( icol < 0 || icol >= fgkNcol ) return -1;
acc49af9 295
022e76c3 296 return icol/(fgkNcol/2);
acc49af9 297
022e76c3 298}
299
acc49af9 300//_____________________________________________________________________________
301//void AliTRDfeeParam::GetFilterParam( Float_t &r1, Float_t &r2, Float_t &c1
302// , Float_t &c2, Float_t &ped ) const
022e76c3 303//{
304 //
305 // Return current filter parameter
306 //
307
308 // r1 = fR1;
309 //r2 = fR2;
310 //c1 = fC1;
311 //c2 = fC2;
312 //ped = fPedestal;
313//};
ecf39416 314
2ec0bacc 315//_____________________________________________________________________________
316void AliTRDfeeParam::SetEBsglIndThr(Int_t val)
317{
acc49af9 318 //
2ec0bacc 319 // Set Event Buffer Sngle Indicator Threshold (EBIS in TRAP conf).
320 // Timebin is indicated if ADC value >= val.
acc49af9 321 //
2ec0bacc 322
323 if( val >= 0 && val <= 1023 ) {
324 fEBsglIndThr = val;
325 } else {
326 AliError(Form("EBsglIndThr value %d is out of range, keep previously set value (%d).",
327 val, fEBsglIndThr));
328 }
acc49af9 329
2ec0bacc 330}
331
332//_____________________________________________________________________________
333void AliTRDfeeParam::SetEBsumIndThr(Int_t val)
334{
acc49af9 335 //
2ec0bacc 336 // Set Event Buffer Sum Indicator Threshold (EBIT in TRAP conf).
337 // Timebin is indicated if ADC sum value >= val.
acc49af9 338 //
2ec0bacc 339
340 if( val >= 0 && val <= 4095 ) {
341 fEBsumIndThr = val;
acc49af9 342 }
343 else {
2ec0bacc 344 AliError(Form("EBsumIndThr value %d is out of range, keep previously set value (%d).",
345 val, fEBsumIndThr));
346 }
2ec0bacc 347
acc49af9 348}
2ec0bacc 349
350//_____________________________________________________________________________
351void AliTRDfeeParam::SetEBindLUT(Int_t val)
352{
acc49af9 353 //
2ec0bacc 354 // Set Event Buffer Indicator Look-Up Table (EBIL in TRAP conf).
355 // 8 bits value forms lookup table for combination of three criterions.
acc49af9 356 //
2ec0bacc 357
358 if( val >= 0 && val <= 255 ) {
359 fEBindLUT = val;
acc49af9 360 }
361 else {
2ec0bacc 362 AliError(Form("EBindLUT value %d is out of range, keep previously set value (%d).",
363 val, fEBindLUT));
364 }
acc49af9 365
2ec0bacc 366}
367
368//_____________________________________________________________________________
369void AliTRDfeeParam::SetEBignoreNeighbour(Int_t val)
370{
acc49af9 371 //
2ec0bacc 372 // Set Event Buffer Indicator Neighbor Sensitivity. (EBIN in TRAP conf).
373 // If 0, take account of neigbor's values.
acc49af9 374 //
2ec0bacc 375
376 if( val >= 0 && val <= 1 ) {
377 fEBignoreNeighbour = val;
acc49af9 378 }
379 else {
2ec0bacc 380 AliError(Form("EBignoreNeighbour value %d is out of range, keep previously set value (%d).",
381 val, fEBignoreNeighbour));
382 }
383}
ecf39416 384
385//_____________________________________________________________________________
acc49af9 386void AliTRDfeeParam::SetRAWversion( Int_t rawver )
ecf39416 387{
acc49af9 388 //
ecf39416 389 // Set raw data version (major number only)
390 // Maximum available number is preset in fgkMaxRAWversion
acc49af9 391 //
ecf39416 392
393 if( rawver >= 0 && rawver <= fgkMaxRAWversion ) {
acc49af9 394 fRAWversion = rawver;
395 }
396 else {
ecf39416 397 AliError(Form("Raw version is out of range: %d",rawver));
398 }
ecf39416 399
ecf39416 400}
f2979d08 401
402//_____________________________________________________________________________
403void AliTRDfeeParam::SetXenon()
404{
405 //
406 // Sets the filter parameters for the Xenon gas mixture
407 //
408
409 fTFnExp = 1;
410 fTFr1 = 1.1563;
411 fTFr2 = 0.1299;
412 fTFc1 = 0.0657;
413 fTFc2 = 0.0000;
414
415}
416
417//_____________________________________________________________________________
418void AliTRDfeeParam::SetArgon()
419{
420 //
421 // Sets the filter parameters for the Argon gas mixture
422 //
423
424 fTFnExp = 2;
425 fTFr1 = 6.0;
426 fTFr2 = 0.62;
427 fTFc1 = 0.0087;
428 fTFc2 = 0.07;
429
430}
a6d08b7f 431
432