]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDfeeParam.cxx
TPCNoiseMapComponent included into build (Kelly)
[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)
dfd03fc3 87 ,fTFr1(0)
88 ,fTFr2(0)
89 ,fTFc1(0)
90 ,fTFc2(0)
2ec0bacc 91 ,fEBsglIndThr(5)
92 ,fEBsumIndThr(5)
93 ,fEBindLUT(0xF0)
94 ,fEBignoreNeighbour(0)
ecf39416 95 ,fRAWversion(3)
96 ,fRAWstoreRaw(kTRUE)
022e76c3 97{
98 //
99 // Default constructor
100 //
101
102 // PASA V.4
dfd03fc3 103 if (fgkTFnExp == 1) {
104 fTFr1 = 1.1563;
105 fTFr2 = 0.1299;
106 fTFc1 = 0.0657;
107 fTFc2 = 0.0000;
022e76c3 108 }
dfd03fc3 109 else if (fgkTFnExp == 2) {
110 fTFr1 = 1.1563;
111 fTFr2 = 0.1299;
112 fTFc1 = 0.1141;
113 fTFc2 = 0.6241;
022e76c3 114 }
115
022e76c3 116 fCP = AliTRDCommonParam::Instance();
117
118}
119
ba84a3e3 120//_____________________________________________________________________________
121AliTRDfeeParam::AliTRDfeeParam(TRootIoCtor *)
122 :TObject()
123 ,fCP(0)
124 ,fTFr1(0)
125 ,fTFr2(0)
126 ,fTFc1(0)
127 ,fTFc2(0)
128 ,fEBsglIndThr(0)
129 ,fEBsumIndThr(0)
130 ,fEBindLUT(0)
131 ,fEBignoreNeighbour(0)
132 ,fRAWversion(0)
133 ,fRAWstoreRaw(0)
134{
135 //
136 // IO constructor
137 //
138
139}
140
022e76c3 141//_____________________________________________________________________________
142AliTRDfeeParam::AliTRDfeeParam(const AliTRDfeeParam &p)
143 :TObject(p)
022e76c3 144 ,fCP(p.fCP)
dfd03fc3 145 ,fTFr1(p.fTFr1)
146 ,fTFr2(p.fTFr2)
147 ,fTFc1(p.fTFc1)
148 ,fTFc2(p.fTFc2)
2ec0bacc 149 ,fEBsglIndThr(p.fEBsglIndThr)
150 ,fEBsumIndThr(p.fEBsumIndThr)
151 ,fEBindLUT(p.fEBindLUT)
152 ,fEBignoreNeighbour (p.fEBignoreNeighbour)
ecf39416 153 ,fRAWversion(p.fRAWversion)
154 ,fRAWstoreRaw(p.fRAWstoreRaw)
022e76c3 155{
156 //
157 // AliTRDfeeParam copy constructor
158 //
acc49af9 159
022e76c3 160}
161
162//_____________________________________________________________________________
163AliTRDfeeParam::~AliTRDfeeParam()
164{
165 //
166 // AliTRDfeeParam destructor
167 //
acc49af9 168
022e76c3 169}
170
171//_____________________________________________________________________________
172AliTRDfeeParam &AliTRDfeeParam::operator=(const AliTRDfeeParam &p)
173{
174 //
175 // Assignment operator
176 //
177
178 if (this != &p) {
179 ((AliTRDfeeParam &) p).Copy(*this);
180 }
acc49af9 181
022e76c3 182 return *this;
acc49af9 183
022e76c3 184}
185
186//_____________________________________________________________________________
187void AliTRDfeeParam::Copy(TObject &p) const
188{
189 //
190 // Copy function
191 //
192
ecf39416 193 ((AliTRDfeeParam &) p).fCP = fCP;
194 ((AliTRDfeeParam &) p).fTFr1 = fTFr1;
195 ((AliTRDfeeParam &) p).fTFr2 = fTFr2;
196 ((AliTRDfeeParam &) p).fTFc1 = fTFc1;
197 ((AliTRDfeeParam &) p).fTFc2 = fTFc2;
2ec0bacc 198 ((AliTRDfeeParam &) p).fEBsglIndThr = fEBsglIndThr;
199 ((AliTRDfeeParam &) p).fEBsumIndThr = fEBsumIndThr;
200 ((AliTRDfeeParam &) p).fEBindLUT = fEBindLUT;
201 ((AliTRDfeeParam &) p).fEBignoreNeighbour = fEBignoreNeighbour;
ecf39416 202 ((AliTRDfeeParam &) p).fRAWversion = fRAWversion;
203 ((AliTRDfeeParam &) p).fRAWstoreRaw = fRAWstoreRaw;
022e76c3 204
205 TObject::Copy(p);
acc49af9 206
022e76c3 207}
208
209//_____________________________________________________________________________
210Int_t AliTRDfeeParam::GetPadRowFromMCM(Int_t irob, Int_t imcm) const
211{
212 //
acc49af9 213 // Return on which pad row this mcm sits
022e76c3 214 //
215
216 return fgkNmcmRobInRow*(irob/2) + imcm/fgkNmcmRobInCol;
acc49af9 217
022e76c3 218}
219
220//_____________________________________________________________________________
221Int_t AliTRDfeeParam::GetPadColFromADC(Int_t irob, Int_t imcm, Int_t iadc) const
222{
223 //
ecf39416 224 // Return which pad is connected to this adc channel.
225 //
226 // Return virtual pad number even if ADC is outside chamber
227 // to keep compatibility of data processing at the edge MCM.
228 // User has to check that this is in the chamber if it is essential.
229 // Return -100 if iadc is invalid.
230 //
022e76c3 231 // Caution: ADC ordering in the online data is opposite to the pad column ordering.
232 // And it is not one-by-one correspondence. Precise drawing can be found in:
233 // http://wiki.kip.uni-heidelberg.de/ti/TRD/index.php/Image:ROB_MCM_numbering.pdf
acc49af9 234 //
022e76c3 235
ecf39416 236 if (iadc < 0 || iadc > 19 ) return -100;
022e76c3 237 Int_t mcmcol = imcm%fgkNmcmRobInCol + GetRobSide(irob)*fgkNmcmRobInCol; // MCM column number on ROC [0..7]
238 Int_t padcol = mcmcol*fgkNcolMcm + fgkNcolMcm + 1 - iadc;
ecf39416 239 // if( padcol < 0 || padcol >= fgkNcol ) return -1; // thisi s commented because of reson above KO
acc49af9 240
022e76c3 241 return padcol;
acc49af9 242
022e76c3 243}
244
245//_____________________________________________________________________________
246Int_t AliTRDfeeParam::GetMCMfromPad(Int_t irow, Int_t icol) const
247{
248 //
249 // Return on which MCM this pad is directry connected.
250 // Return -1 for error.
251 //
252
253 if ( irow < 0 || icol < 0 || irow > fgkNrowC1 || icol > fgkNcol ) return -1;
254
255 return (icol%(fgkNcol/2))/fgkNcolMcm + fgkNmcmRobInCol*(irow%fgkNmcmRobInRow);
acc49af9 256
022e76c3 257}
258
259//_____________________________________________________________________________
260Int_t AliTRDfeeParam::GetROBfromPad(Int_t irow, Int_t icol) const
261{
262 //
acc49af9 263 // Return on which rob this pad is
022e76c3 264 //
265
266 return (irow/fgkNmcmRobInRow)*2 + GetColSide(icol);
acc49af9 267
022e76c3 268}
269
270//_____________________________________________________________________________
271Int_t AliTRDfeeParam::GetRobSide(Int_t irob) const
272{
273 //
acc49af9 274 // Return on which side this rob sits (A side = 0, B side = 1)
022e76c3 275 //
276
277 if ( irob < 0 || irob >= fgkNrobC1 ) return -1;
acc49af9 278
022e76c3 279 return irob%2;
acc49af9 280
022e76c3 281}
282
283//_____________________________________________________________________________
284Int_t AliTRDfeeParam::GetColSide(Int_t icol) const
285{
286 //
acc49af9 287 // Return on which side this column sits (A side = 0, B side = 1)
022e76c3 288 //
289
290 if ( icol < 0 || icol >= fgkNcol ) return -1;
acc49af9 291
022e76c3 292 return icol/(fgkNcol/2);
acc49af9 293
022e76c3 294}
295
acc49af9 296//_____________________________________________________________________________
297//void AliTRDfeeParam::GetFilterParam( Float_t &r1, Float_t &r2, Float_t &c1
298// , Float_t &c2, Float_t &ped ) const
022e76c3 299//{
300 //
301 // Return current filter parameter
302 //
303
304 // r1 = fR1;
305 //r2 = fR2;
306 //c1 = fC1;
307 //c2 = fC2;
308 //ped = fPedestal;
309//};
ecf39416 310
2ec0bacc 311//_____________________________________________________________________________
312void AliTRDfeeParam::SetEBsglIndThr(Int_t val)
313{
acc49af9 314 //
2ec0bacc 315 // Set Event Buffer Sngle Indicator Threshold (EBIS in TRAP conf).
316 // Timebin is indicated if ADC value >= val.
acc49af9 317 //
2ec0bacc 318
319 if( val >= 0 && val <= 1023 ) {
320 fEBsglIndThr = val;
321 } else {
322 AliError(Form("EBsglIndThr value %d is out of range, keep previously set value (%d).",
323 val, fEBsglIndThr));
324 }
acc49af9 325
2ec0bacc 326}
327
328//_____________________________________________________________________________
329void AliTRDfeeParam::SetEBsumIndThr(Int_t val)
330{
acc49af9 331 //
2ec0bacc 332 // Set Event Buffer Sum Indicator Threshold (EBIT in TRAP conf).
333 // Timebin is indicated if ADC sum value >= val.
acc49af9 334 //
2ec0bacc 335
336 if( val >= 0 && val <= 4095 ) {
337 fEBsumIndThr = val;
acc49af9 338 }
339 else {
2ec0bacc 340 AliError(Form("EBsumIndThr value %d is out of range, keep previously set value (%d).",
341 val, fEBsumIndThr));
342 }
2ec0bacc 343
acc49af9 344}
2ec0bacc 345
346//_____________________________________________________________________________
347void AliTRDfeeParam::SetEBindLUT(Int_t val)
348{
acc49af9 349 //
2ec0bacc 350 // Set Event Buffer Indicator Look-Up Table (EBIL in TRAP conf).
351 // 8 bits value forms lookup table for combination of three criterions.
acc49af9 352 //
2ec0bacc 353
354 if( val >= 0 && val <= 255 ) {
355 fEBindLUT = val;
acc49af9 356 }
357 else {
2ec0bacc 358 AliError(Form("EBindLUT value %d is out of range, keep previously set value (%d).",
359 val, fEBindLUT));
360 }
acc49af9 361
2ec0bacc 362}
363
364//_____________________________________________________________________________
365void AliTRDfeeParam::SetEBignoreNeighbour(Int_t val)
366{
acc49af9 367 //
2ec0bacc 368 // Set Event Buffer Indicator Neighbor Sensitivity. (EBIN in TRAP conf).
369 // If 0, take account of neigbor's values.
acc49af9 370 //
2ec0bacc 371
372 if( val >= 0 && val <= 1 ) {
373 fEBignoreNeighbour = val;
acc49af9 374 }
375 else {
2ec0bacc 376 AliError(Form("EBignoreNeighbour value %d is out of range, keep previously set value (%d).",
377 val, fEBignoreNeighbour));
378 }
379}
ecf39416 380
381//_____________________________________________________________________________
acc49af9 382void AliTRDfeeParam::SetRAWversion( Int_t rawver )
ecf39416 383{
acc49af9 384 //
ecf39416 385 // Set raw data version (major number only)
386 // Maximum available number is preset in fgkMaxRAWversion
acc49af9 387 //
ecf39416 388
389 if( rawver >= 0 && rawver <= fgkMaxRAWversion ) {
acc49af9 390 fRAWversion = rawver;
391 }
392 else {
ecf39416 393 AliError(Form("Raw version is out of range: %d",rawver));
394 }
ecf39416 395
ecf39416 396}