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()
95 ,fEBignoreNeighbour(0)
100 // Default constructor
110 else if (fTFnExp == 2) {
117 fCP = AliTRDCommonParam::Instance();
121 //_____________________________________________________________________________
122 AliTRDfeeParam::AliTRDfeeParam(TRootIoCtor *)
133 ,fEBignoreNeighbour(0)
143 //_____________________________________________________________________________
144 AliTRDfeeParam::AliTRDfeeParam(const AliTRDfeeParam &p)
152 ,fEBsglIndThr(p.fEBsglIndThr)
153 ,fEBsumIndThr(p.fEBsumIndThr)
154 ,fEBindLUT(p.fEBindLUT)
155 ,fEBignoreNeighbour (p.fEBignoreNeighbour)
156 ,fRAWversion(p.fRAWversion)
157 ,fRAWstoreRaw(p.fRAWstoreRaw)
160 // AliTRDfeeParam copy constructor
165 //_____________________________________________________________________________
166 AliTRDfeeParam::~AliTRDfeeParam()
169 // AliTRDfeeParam destructor
174 //_____________________________________________________________________________
175 AliTRDfeeParam &AliTRDfeeParam::operator=(const AliTRDfeeParam &p)
178 // Assignment operator
182 ((AliTRDfeeParam &) p).Copy(*this);
189 //_____________________________________________________________________________
190 void AliTRDfeeParam::Copy(TObject &p) const
196 ((AliTRDfeeParam &) p).fCP = fCP;
197 ((AliTRDfeeParam &) p).fTFnExp = fTFnExp;
198 ((AliTRDfeeParam &) p).fTFr1 = fTFr1;
199 ((AliTRDfeeParam &) p).fTFr2 = fTFr2;
200 ((AliTRDfeeParam &) p).fTFc1 = fTFc1;
201 ((AliTRDfeeParam &) p).fTFc2 = fTFc2;
202 ((AliTRDfeeParam &) p).fEBsglIndThr = fEBsglIndThr;
203 ((AliTRDfeeParam &) p).fEBsumIndThr = fEBsumIndThr;
204 ((AliTRDfeeParam &) p).fEBindLUT = fEBindLUT;
205 ((AliTRDfeeParam &) p).fEBignoreNeighbour = fEBignoreNeighbour;
206 ((AliTRDfeeParam &) p).fRAWversion = fRAWversion;
207 ((AliTRDfeeParam &) p).fRAWstoreRaw = fRAWstoreRaw;
213 //_____________________________________________________________________________
214 Int_t AliTRDfeeParam::GetPadRowFromMCM(Int_t irob, Int_t imcm) const
217 // Return on which pad row this mcm sits
220 return fgkNmcmRobInRow*(irob/2) + imcm/fgkNmcmRobInCol;
224 //_____________________________________________________________________________
225 Int_t AliTRDfeeParam::GetPadColFromADC(Int_t irob, Int_t imcm, Int_t iadc) const
228 // Return which pad is connected to this adc channel.
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.
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
240 if (iadc < 0 || iadc > fgkNadcMcm ) return -100;
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;
243 // if( padcol < 0 || padcol >= fgkNcol ) return -1; // thisi s commented because of reson above KO
249 //_____________________________________________________________________________
250 Int_t AliTRDfeeParam::GetMCMfromPad(Int_t irow, Int_t icol) const
253 // Return on which MCM this pad is directry connected.
254 // Return -1 for error.
257 if ( irow < 0 || icol < 0 || irow > fgkNrowC1 || icol > fgkNcol ) return -1;
259 return (icol%(fgkNcol/2))/fgkNcolMcm + fgkNmcmRobInCol*(irow%fgkNmcmRobInRow);
263 //_____________________________________________________________________________
264 Int_t AliTRDfeeParam::GetROBfromPad(Int_t irow, Int_t icol) const
267 // Return on which rob this pad is
270 return (irow/fgkNmcmRobInRow)*2 + GetColSide(icol);
274 //_____________________________________________________________________________
275 Int_t AliTRDfeeParam::GetRobSide(Int_t irob) const
278 // Return on which side this rob sits (A side = 0, B side = 1)
281 if ( irob < 0 || irob >= fgkNrobC1 ) return -1;
287 //_____________________________________________________________________________
288 Int_t AliTRDfeeParam::GetColSide(Int_t icol) const
291 // Return on which side this column sits (A side = 0, B side = 1)
294 if ( icol < 0 || icol >= fgkNcol ) return -1;
296 return icol/(fgkNcol/2);
300 //_____________________________________________________________________________
301 //void AliTRDfeeParam::GetFilterParam( Float_t &r1, Float_t &r2, Float_t &c1
302 // , Float_t &c2, Float_t &ped ) const
305 // Return current filter parameter
315 //_____________________________________________________________________________
316 void AliTRDfeeParam::SetEBsglIndThr(Int_t val)
319 // Set Event Buffer Sngle Indicator Threshold (EBIS in TRAP conf).
320 // Timebin is indicated if ADC value >= val.
323 if( val >= 0 && val <= 1023 ) {
326 AliError(Form("EBsglIndThr value %d is out of range, keep previously set value (%d).",
332 //_____________________________________________________________________________
333 void AliTRDfeeParam::SetEBsumIndThr(Int_t val)
336 // Set Event Buffer Sum Indicator Threshold (EBIT in TRAP conf).
337 // Timebin is indicated if ADC sum value >= val.
340 if( val >= 0 && val <= 4095 ) {
344 AliError(Form("EBsumIndThr value %d is out of range, keep previously set value (%d).",
350 //_____________________________________________________________________________
351 void AliTRDfeeParam::SetEBindLUT(Int_t val)
354 // Set Event Buffer Indicator Look-Up Table (EBIL in TRAP conf).
355 // 8 bits value forms lookup table for combination of three criterions.
358 if( val >= 0 && val <= 255 ) {
362 AliError(Form("EBindLUT value %d is out of range, keep previously set value (%d).",
368 //_____________________________________________________________________________
369 void AliTRDfeeParam::SetEBignoreNeighbour(Int_t val)
372 // Set Event Buffer Indicator Neighbor Sensitivity. (EBIN in TRAP conf).
373 // If 0, take account of neigbor's values.
376 if( val >= 0 && val <= 1 ) {
377 fEBignoreNeighbour = val;
380 AliError(Form("EBignoreNeighbour value %d is out of range, keep previously set value (%d).",
381 val, fEBignoreNeighbour));
385 //_____________________________________________________________________________
386 void AliTRDfeeParam::SetRAWversion( Int_t rawver )
389 // Set raw data version (major number only)
390 // Maximum available number is preset in fgkMaxRAWversion
393 if( rawver >= 0 && rawver <= fgkMaxRAWversion ) {
394 fRAWversion = rawver;
397 AliError(Form("Raw version is out of range: %d",rawver));
402 //_____________________________________________________________________________
403 void AliTRDfeeParam::SetXenon()
406 // Sets the filter parameters for the Xenon gas mixture
417 //_____________________________________________________________________________
418 void AliTRDfeeParam::SetArgon()
421 // Sets the filter parameters for the Argon gas mixture