2 /**************************************************************************
3 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * Author: The ALICE Off-line Project. *
6 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
21 New release on 2007/08/17
23 The default raw data version (now fRAWversion ) is set to 3
24 in the constructer because version 3 raw data read and write
29 //////////////////////////////////////////////////
31 // TRD front end electronics parameters class //
32 // Contains all FEE (MCM, TRAP, PASA) related //
33 // parameters, constants, and mapping. //
35 //////////////////////////////////////////////////
40 #include "AliTRDfeeParam.h"
41 #include "AliTRDgeometry.h"
42 #include "AliTRDCommonParam.h"
44 ClassImp(AliTRDfeeParam)
46 AliTRDfeeParam *AliTRDfeeParam::fgInstance = 0;
47 Bool_t AliTRDfeeParam::fgTerminated = kFALSE;
49 //_____________________________________________________________________________
50 AliTRDfeeParam* AliTRDfeeParam::Instance()
52 // Instance constructor
54 if (fgTerminated != kFALSE) {
58 if (fgInstance == 0) {
59 fgInstance = new AliTRDfeeParam();
65 //_____________________________________________________________________________
66 void AliTRDfeeParam::Terminate()
69 // Terminate the class and release memory
74 if (fgInstance != 0) {
80 //_____________________________________________________________________________
81 AliTRDfeeParam::AliTRDfeeParam()
91 ,fEBignoreNeighbour(0)
96 // Default constructor
100 if (fgkTFnExp == 1) {
106 else if (fgkTFnExp == 2) {
113 // fGeo = AliTRDgeometry::Instance();
114 fCP = AliTRDCommonParam::Instance();
118 //_____________________________________________________________________________
119 AliTRDfeeParam::AliTRDfeeParam(const AliTRDfeeParam &p)
127 ,fEBsglIndThr(p.fEBsglIndThr)
128 ,fEBsumIndThr(p.fEBsumIndThr)
129 ,fEBindLUT(p.fEBindLUT)
130 ,fEBignoreNeighbour (p.fEBignoreNeighbour)
131 ,fRAWversion(p.fRAWversion)
132 ,fRAWstoreRaw(p.fRAWstoreRaw)
135 // AliTRDfeeParam copy constructor
139 //_____________________________________________________________________________
140 AliTRDfeeParam::~AliTRDfeeParam()
143 // AliTRDfeeParam destructor
147 //_____________________________________________________________________________
148 AliTRDfeeParam &AliTRDfeeParam::operator=(const AliTRDfeeParam &p)
151 // Assignment operator
155 ((AliTRDfeeParam &) p).Copy(*this);
160 //_____________________________________________________________________________
161 void AliTRDfeeParam::Copy(TObject &p) const
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;
183 //_____________________________________________________________________________
184 Int_t AliTRDfeeParam::GetPadRowFromMCM(Int_t irob, Int_t imcm) const
187 // return on which pad row this mcm sits
190 return fgkNmcmRobInRow*(irob/2) + imcm/fgkNmcmRobInCol;
193 //_____________________________________________________________________________
194 Int_t AliTRDfeeParam::GetPadColFromADC(Int_t irob, Int_t imcm, Int_t iadc) const
197 // Return which pad is connected to this adc channel.
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.
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
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
215 //_____________________________________________________________________________
216 Int_t AliTRDfeeParam::GetMCMfromPad(Int_t irow, Int_t icol) const
219 // Return on which MCM this pad is directry connected.
220 // Return -1 for error.
223 if ( irow < 0 || icol < 0 || irow > fgkNrowC1 || icol > fgkNcol ) return -1;
225 return (icol%(fgkNcol/2))/fgkNcolMcm + fgkNmcmRobInCol*(irow%fgkNmcmRobInRow);
228 //_____________________________________________________________________________
229 Int_t AliTRDfeeParam::GetROBfromPad(Int_t irow, Int_t icol) const
232 // return on which rob this pad is
235 return (irow/fgkNmcmRobInRow)*2 + GetColSide(icol);
238 //_____________________________________________________________________________
239 Int_t AliTRDfeeParam::GetRobSide(Int_t irob) const
242 // return on which side this rob sits (A side = 0, B side = 1)
245 if ( irob < 0 || irob >= fgkNrobC1 ) return -1;
249 //_____________________________________________________________________________
250 Int_t AliTRDfeeParam::GetColSide(Int_t icol) const
253 // return on which side this column sits (A side = 0, B side = 1)
256 if ( icol < 0 || icol >= fgkNcol ) return -1;
257 return icol/(fgkNcol/2);
261 //void AliTRDfeeParam::GetFilterParam( Float_t &r1, Float_t &r2, Float_t &c1, Float_t &c2, Float_t &ped ) const
264 // Return current filter parameter
274 //_____________________________________________________________________________
275 void AliTRDfeeParam::SetEBsglIndThr(Int_t val)
277 // Set Event Buffer Sngle Indicator Threshold (EBIS in TRAP conf).
278 // Timebin is indicated if ADC value >= val.
280 if( val >= 0 && val <= 1023 ) {
283 AliError(Form("EBsglIndThr value %d is out of range, keep previously set value (%d).",
288 //_____________________________________________________________________________
289 void AliTRDfeeParam::SetEBsumIndThr(Int_t val)
291 // Set Event Buffer Sum Indicator Threshold (EBIT in TRAP conf).
292 // Timebin is indicated if ADC sum value >= val.
294 if( val >= 0 && val <= 4095 ) {
297 AliError(Form("EBsumIndThr value %d is out of range, keep previously set value (%d).",
303 //_____________________________________________________________________________
304 void AliTRDfeeParam::SetEBindLUT(Int_t val)
306 // Set Event Buffer Indicator Look-Up Table (EBIL in TRAP conf).
307 // 8 bits value forms lookup table for combination of three criterions.
309 if( val >= 0 && val <= 255 ) {
312 AliError(Form("EBindLUT value %d is out of range, keep previously set value (%d).",
317 //_____________________________________________________________________________
318 void AliTRDfeeParam::SetEBignoreNeighbour(Int_t val)
320 // Set Event Buffer Indicator Neighbor Sensitivity. (EBIN in TRAP conf).
321 // If 0, take account of neigbor's values.
323 if( val >= 0 && val <= 1 ) {
324 fEBignoreNeighbour = val;
326 AliError(Form("EBignoreNeighbour value %d is out of range, keep previously set value (%d).",
327 val, fEBignoreNeighbour));
331 //_____________________________________________________________________________
332 Int_t AliTRDfeeParam::GetRAWversion()
334 // Return raw data version (major number only)
339 //_____________________________________________________________________________
340 void AliTRDfeeParam::SetRAWversion( Int_t rawver )
342 // Set raw data version (major number only)
343 // Maximum available number is preset in fgkMaxRAWversion
345 if( rawver >= 0 && rawver <= fgkMaxRAWversion ) {
347 fRAWversion = rawver ;
349 AliError(Form("Raw version is out of range: %d",rawver));
353 //_____________________________________________________________________________
354 Bool_t AliTRDfeeParam::GetRAWstoreRaw()
356 // Returns kTRUE if raw data itself is read instead of filtered data
361 //_____________________________________________________________________________
362 void AliTRDfeeParam::SetRAWstoreRaw( Bool_t storeraw )
364 // If kTRUE is set, raw data itself is read instead of filtered data
366 fRAWstoreRaw = storeraw;