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;
47 Bool_t AliTRDfeeParam::fgTracklet = kFALSE;
49 //_____________________________________________________________________________
50 AliTRDfeeParam* AliTRDfeeParam::Instance()
53 // Instance constructor
56 if (fgTerminated != kFALSE) {
60 if (fgInstance == 0) {
61 fgInstance = new AliTRDfeeParam();
68 //_____________________________________________________________________________
69 void AliTRDfeeParam::Terminate()
72 // Terminate the class and release memory
77 if (fgInstance != 0) {
84 //_____________________________________________________________________________
85 AliTRDfeeParam::AliTRDfeeParam()
96 ,fEBignoreNeighbour(0)
101 // Default constructor
111 else if (fTFnExp == 2) {
118 fCP = AliTRDCommonParam::Instance();
122 //_____________________________________________________________________________
123 AliTRDfeeParam::AliTRDfeeParam(TRootIoCtor *)
134 ,fEBignoreNeighbour(0)
144 //_____________________________________________________________________________
145 AliTRDfeeParam::AliTRDfeeParam(const AliTRDfeeParam &p)
153 ,fEBsglIndThr(p.fEBsglIndThr)
154 ,fEBsumIndThr(p.fEBsumIndThr)
155 ,fEBindLUT(p.fEBindLUT)
156 ,fEBignoreNeighbour (p.fEBignoreNeighbour)
157 ,fRAWversion(p.fRAWversion)
158 ,fRAWstoreRaw(p.fRAWstoreRaw)
161 // AliTRDfeeParam copy constructor
166 //_____________________________________________________________________________
167 AliTRDfeeParam::~AliTRDfeeParam()
170 // AliTRDfeeParam destructor
175 //_____________________________________________________________________________
176 AliTRDfeeParam &AliTRDfeeParam::operator=(const AliTRDfeeParam &p)
179 // Assignment operator
183 ((AliTRDfeeParam &) p).Copy(*this);
190 //_____________________________________________________________________________
191 void AliTRDfeeParam::Copy(TObject &p) const
197 ((AliTRDfeeParam &) p).fCP = fCP;
198 ((AliTRDfeeParam &) p).fTFnExp = fTFnExp;
199 ((AliTRDfeeParam &) p).fTFr1 = fTFr1;
200 ((AliTRDfeeParam &) p).fTFr2 = fTFr2;
201 ((AliTRDfeeParam &) p).fTFc1 = fTFc1;
202 ((AliTRDfeeParam &) p).fTFc2 = fTFc2;
203 ((AliTRDfeeParam &) p).fEBsglIndThr = fEBsglIndThr;
204 ((AliTRDfeeParam &) p).fEBsumIndThr = fEBsumIndThr;
205 ((AliTRDfeeParam &) p).fEBindLUT = fEBindLUT;
206 ((AliTRDfeeParam &) p).fEBignoreNeighbour = fEBignoreNeighbour;
207 ((AliTRDfeeParam &) p).fRAWversion = fRAWversion;
208 ((AliTRDfeeParam &) p).fRAWstoreRaw = fRAWstoreRaw;
214 //_____________________________________________________________________________
215 Int_t AliTRDfeeParam::GetPadRowFromMCM(Int_t irob, Int_t imcm) const
218 // Return on which pad row this mcm sits
221 return fgkNmcmRobInRow*(irob/2) + imcm/fgkNmcmRobInCol;
225 //_____________________________________________________________________________
226 Int_t AliTRDfeeParam::GetPadColFromADC(Int_t irob, Int_t imcm, Int_t iadc) const
229 // Return which pad is connected to this adc channel.
231 // Return virtual pad number even if ADC is outside chamber
232 // to keep compatibility of data processing at the edge MCM.
233 // User has to check that this is in the chamber if it is essential.
234 // Return -100 if iadc is invalid.
236 // Caution: ADC ordering in the online data is opposite to the pad column ordering.
237 // And it is not one-by-one correspondence. Precise drawing can be found in:
238 // http://wiki.kip.uni-heidelberg.de/ti/TRD/index.php/Image:ROB_MCM_numbering.pdf
241 if (iadc < 0 || iadc > fgkNadcMcm ) return -100;
242 Int_t mcmcol = imcm%fgkNmcmRobInCol + GetRobSide(irob)*fgkNmcmRobInCol; // MCM column number on ROC [0..7]
243 Int_t padcol = mcmcol*fgkNcolMcm + fgkNcolMcm + 1 - iadc;
244 if( padcol < 0 || padcol >= fgkNcol ) return -1; // this is commented because of reason above OK
250 //_____________________________________________________________________________
251 Int_t AliTRDfeeParam::GetExtendedPadColFromADC(Int_t irob, Int_t imcm, Int_t iadc) const
254 // Return which pad coresponds to the extended digit container pad numbering
255 // Extended digit container is designed to store all pad data including shared pad,
256 // so we have to introduce new virtual pad numbering scheme for this purpose.
259 if (iadc < 0 || iadc > fgkNadcMcm ) return -100;
260 Int_t mcmcol = imcm%fgkNmcmRobInCol + GetRobSide(irob)*fgkNmcmRobInCol; // MCM column number on ROC [0..7]
261 Int_t padcol = mcmcol*fgkNadcMcm + fgkNcolMcm + 2 - iadc;
267 //_____________________________________________________________________________
268 Int_t AliTRDfeeParam::GetMCMfromPad(Int_t irow, Int_t icol) const
271 // Return on which MCM this pad is directry connected.
272 // Return -1 for error.
275 if ( irow < 0 || icol < 0 || irow > fgkNrowC1 || icol > fgkNcol ) return -1;
277 return (icol%(fgkNcol/2))/fgkNcolMcm + fgkNmcmRobInCol*(irow%fgkNmcmRobInRow);
281 //_____________________________________________________________________________
282 Int_t AliTRDfeeParam::GetROBfromPad(Int_t irow, Int_t icol) const
285 // Return on which rob this pad is
288 return (irow/fgkNmcmRobInRow)*2 + GetColSide(icol);
292 //_____________________________________________________________________________
293 Int_t AliTRDfeeParam::GetRobSide(Int_t irob) const
296 // Return on which side this rob sits (A side = 0, B side = 1)
299 if ( irob < 0 || irob >= fgkNrobC1 ) return -1;
305 //_____________________________________________________________________________
306 Int_t AliTRDfeeParam::GetColSide(Int_t icol) const
309 // Return on which side this column sits (A side = 0, B side = 1)
312 if ( icol < 0 || icol >= fgkNcol ) return -1;
314 return icol/(fgkNcol/2);
318 //_____________________________________________________________________________
319 //void AliTRDfeeParam::GetFilterParam( Float_t &r1, Float_t &r2, Float_t &c1
320 // , Float_t &c2, Float_t &ped ) const
323 // Return current filter parameter
333 //_____________________________________________________________________________
334 void AliTRDfeeParam::SetEBsglIndThr(Int_t val)
337 // Set Event Buffer Sngle Indicator Threshold (EBIS in TRAP conf).
338 // Timebin is indicated if ADC value >= val.
341 if( val >= 0 && val <= 1023 ) {
344 AliError(Form("EBsglIndThr value %d is out of range, keep previously set value (%d).",
350 //_____________________________________________________________________________
351 void AliTRDfeeParam::SetEBsumIndThr(Int_t val)
354 // Set Event Buffer Sum Indicator Threshold (EBIT in TRAP conf).
355 // Timebin is indicated if ADC sum value >= val.
358 if( val >= 0 && val <= 4095 ) {
362 AliError(Form("EBsumIndThr value %d is out of range, keep previously set value (%d).",
368 //_____________________________________________________________________________
369 void AliTRDfeeParam::SetEBindLUT(Int_t val)
372 // Set Event Buffer Indicator Look-Up Table (EBIL in TRAP conf).
373 // 8 bits value forms lookup table for combination of three criterions.
376 if( val >= 0 && val <= 255 ) {
380 AliError(Form("EBindLUT value %d is out of range, keep previously set value (%d).",
386 //_____________________________________________________________________________
387 void AliTRDfeeParam::SetEBignoreNeighbour(Int_t val)
390 // Set Event Buffer Indicator Neighbor Sensitivity. (EBIN in TRAP conf).
391 // If 0, take account of neigbor's values.
394 if( val >= 0 && val <= 1 ) {
395 fEBignoreNeighbour = val;
398 AliError(Form("EBignoreNeighbour value %d is out of range, keep previously set value (%d).",
399 val, fEBignoreNeighbour));
403 //_____________________________________________________________________________
404 void AliTRDfeeParam::SetRAWversion( Int_t rawver )
407 // Set raw data version (major number only)
408 // Maximum available number is preset in fgkMaxRAWversion
411 if( rawver >= 0 && rawver <= fgkMaxRAWversion ) {
412 fRAWversion = rawver;
415 AliError(Form("Raw version is out of range: %d",rawver));
420 //_____________________________________________________________________________
421 void AliTRDfeeParam::SetXenon()
424 // Sets the filter parameters for the Xenon gas mixture
435 //_____________________________________________________________________________
436 void AliTRDfeeParam::SetArgon()
439 // Sets the filter parameters for the Argon gas mixture