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 **************************************************************************/
19 ////////////////////////////////////////////////////////////////////////////
21 // TRD front end electronics parameters class //
22 // Contains all FEE (MCM, TRAP, PASA) related //
23 // parameters, constants, and mapping. //
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. //
31 // Ken Oyama (oyama@physi.uni-heidelberg.de) //
33 ////////////////////////////////////////////////////////////////////////////
39 #include "AliTRDfeeParam.h"
40 #include "AliTRDgeometry.h"
41 #include "AliTRDCommonParam.h"
43 ClassImp(AliTRDfeeParam)
45 AliTRDfeeParam *AliTRDfeeParam::fgInstance = 0;
46 Bool_t AliTRDfeeParam::fgTerminated = kFALSE;
48 //_____________________________________________________________________________
49 AliTRDfeeParam* AliTRDfeeParam::Instance()
52 // Instance constructor
55 if (fgTerminated != kFALSE) {
59 if (fgInstance == 0) {
60 fgInstance = new AliTRDfeeParam();
67 //_____________________________________________________________________________
68 void AliTRDfeeParam::Terminate()
71 // Terminate the class and release memory
76 if (fgInstance != 0) {
83 //_____________________________________________________________________________
84 AliTRDfeeParam::AliTRDfeeParam()
94 ,fEBignoreNeighbour(0)
99 // Default constructor
103 if (fgkTFnExp == 1) {
109 else if (fgkTFnExp == 2) {
116 fCP = AliTRDCommonParam::Instance();
120 //_____________________________________________________________________________
121 AliTRDfeeParam::AliTRDfeeParam(TRootIoCtor *)
131 ,fEBignoreNeighbour(0)
141 //_____________________________________________________________________________
142 AliTRDfeeParam::AliTRDfeeParam(const AliTRDfeeParam &p)
149 ,fEBsglIndThr(p.fEBsglIndThr)
150 ,fEBsumIndThr(p.fEBsumIndThr)
151 ,fEBindLUT(p.fEBindLUT)
152 ,fEBignoreNeighbour (p.fEBignoreNeighbour)
153 ,fRAWversion(p.fRAWversion)
154 ,fRAWstoreRaw(p.fRAWstoreRaw)
157 // AliTRDfeeParam copy constructor
162 //_____________________________________________________________________________
163 AliTRDfeeParam::~AliTRDfeeParam()
166 // AliTRDfeeParam destructor
171 //_____________________________________________________________________________
172 AliTRDfeeParam &AliTRDfeeParam::operator=(const AliTRDfeeParam &p)
175 // Assignment operator
179 ((AliTRDfeeParam &) p).Copy(*this);
186 //_____________________________________________________________________________
187 void AliTRDfeeParam::Copy(TObject &p) const
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;
198 ((AliTRDfeeParam &) p).fEBsglIndThr = fEBsglIndThr;
199 ((AliTRDfeeParam &) p).fEBsumIndThr = fEBsumIndThr;
200 ((AliTRDfeeParam &) p).fEBindLUT = fEBindLUT;
201 ((AliTRDfeeParam &) p).fEBignoreNeighbour = fEBignoreNeighbour;
202 ((AliTRDfeeParam &) p).fRAWversion = fRAWversion;
203 ((AliTRDfeeParam &) p).fRAWstoreRaw = fRAWstoreRaw;
209 //_____________________________________________________________________________
210 Int_t AliTRDfeeParam::GetPadRowFromMCM(Int_t irob, Int_t imcm) const
213 // Return on which pad row this mcm sits
216 return fgkNmcmRobInRow*(irob/2) + imcm/fgkNmcmRobInCol;
220 //_____________________________________________________________________________
221 Int_t AliTRDfeeParam::GetPadColFromADC(Int_t irob, Int_t imcm, Int_t iadc) const
224 // Return which pad is connected to this adc channel.
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.
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
236 if (iadc < 0 || iadc > 19 ) return -100;
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;
239 // if( padcol < 0 || padcol >= fgkNcol ) return -1; // thisi s commented because of reson above KO
245 //_____________________________________________________________________________
246 Int_t AliTRDfeeParam::GetMCMfromPad(Int_t irow, Int_t icol) const
249 // Return on which MCM this pad is directry connected.
250 // Return -1 for error.
253 if ( irow < 0 || icol < 0 || irow > fgkNrowC1 || icol > fgkNcol ) return -1;
255 return (icol%(fgkNcol/2))/fgkNcolMcm + fgkNmcmRobInCol*(irow%fgkNmcmRobInRow);
259 //_____________________________________________________________________________
260 Int_t AliTRDfeeParam::GetROBfromPad(Int_t irow, Int_t icol) const
263 // Return on which rob this pad is
266 return (irow/fgkNmcmRobInRow)*2 + GetColSide(icol);
270 //_____________________________________________________________________________
271 Int_t AliTRDfeeParam::GetRobSide(Int_t irob) const
274 // Return on which side this rob sits (A side = 0, B side = 1)
277 if ( irob < 0 || irob >= fgkNrobC1 ) return -1;
283 //_____________________________________________________________________________
284 Int_t AliTRDfeeParam::GetColSide(Int_t icol) const
287 // Return on which side this column sits (A side = 0, B side = 1)
290 if ( icol < 0 || icol >= fgkNcol ) return -1;
292 return icol/(fgkNcol/2);
296 //_____________________________________________________________________________
297 //void AliTRDfeeParam::GetFilterParam( Float_t &r1, Float_t &r2, Float_t &c1
298 // , Float_t &c2, Float_t &ped ) const
301 // Return current filter parameter
311 //_____________________________________________________________________________
312 void AliTRDfeeParam::SetEBsglIndThr(Int_t val)
315 // Set Event Buffer Sngle Indicator Threshold (EBIS in TRAP conf).
316 // Timebin is indicated if ADC value >= val.
319 if( val >= 0 && val <= 1023 ) {
322 AliError(Form("EBsglIndThr value %d is out of range, keep previously set value (%d).",
328 //_____________________________________________________________________________
329 void AliTRDfeeParam::SetEBsumIndThr(Int_t val)
332 // Set Event Buffer Sum Indicator Threshold (EBIT in TRAP conf).
333 // Timebin is indicated if ADC sum value >= val.
336 if( val >= 0 && val <= 4095 ) {
340 AliError(Form("EBsumIndThr value %d is out of range, keep previously set value (%d).",
346 //_____________________________________________________________________________
347 void AliTRDfeeParam::SetEBindLUT(Int_t val)
350 // Set Event Buffer Indicator Look-Up Table (EBIL in TRAP conf).
351 // 8 bits value forms lookup table for combination of three criterions.
354 if( val >= 0 && val <= 255 ) {
358 AliError(Form("EBindLUT value %d is out of range, keep previously set value (%d).",
364 //_____________________________________________________________________________
365 void AliTRDfeeParam::SetEBignoreNeighbour(Int_t val)
368 // Set Event Buffer Indicator Neighbor Sensitivity. (EBIN in TRAP conf).
369 // If 0, take account of neigbor's values.
372 if( val >= 0 && val <= 1 ) {
373 fEBignoreNeighbour = val;
376 AliError(Form("EBignoreNeighbour value %d is out of range, keep previously set value (%d).",
377 val, fEBignoreNeighbour));
381 //_____________________________________________________________________________
382 void AliTRDfeeParam::SetRAWversion( Int_t rawver )
385 // Set raw data version (major number only)
386 // Maximum available number is preset in fgkMaxRAWversion
389 if( rawver >= 0 && rawver <= fgkMaxRAWversion ) {
390 fRAWversion = rawver;
393 AliError(Form("Raw version is out of range: %d",rawver));