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 //////////////////////////////////////////////////
29 #include "AliTRDfeeParam.h"
30 #include "AliTRDgeometry.h"
31 #include "AliTRDCommonParam.h"
33 ClassImp(AliTRDfeeParam)
35 AliTRDfeeParam *AliTRDfeeParam::fgInstance = 0;
36 Bool_t AliTRDfeeParam::fgTerminated = kFALSE;
38 //_____________________________________________________________________________
39 AliTRDfeeParam* AliTRDfeeParam::Instance()
41 // Instance constructor
43 if (fgTerminated != kFALSE) {
47 if (fgInstance == 0) {
48 fgInstance = new AliTRDfeeParam();
54 //_____________________________________________________________________________
55 void AliTRDfeeParam::Terminate()
58 // Terminate the class and release memory
63 if (fgInstance != 0) {
69 //_____________________________________________________________________________
70 AliTRDfeeParam::AliTRDfeeParam()
80 // Default constructor
84 if (fgkTFaNExp == 1) {
90 else if (fgkTFaNExp == 2) {
97 // fGeo = AliTRDgeometry::Instance();
98 fCP = AliTRDCommonParam::Instance();
102 //_____________________________________________________________________________
103 AliTRDfeeParam::AliTRDfeeParam(const AliTRDfeeParam &p)
113 // AliTRDfeeParam copy constructor
117 //_____________________________________________________________________________
118 AliTRDfeeParam::~AliTRDfeeParam()
121 // AliTRDfeeParam destructor
125 //_____________________________________________________________________________
126 AliTRDfeeParam &AliTRDfeeParam::operator=(const AliTRDfeeParam &p)
129 // Assignment operator
133 ((AliTRDfeeParam &) p).Copy(*this);
138 //_____________________________________________________________________________
139 void AliTRDfeeParam::Copy(TObject &p) const
145 // ((AliTRDfeeParam &) p).fGeo = fGeo;
146 ((AliTRDfeeParam &) p).fCP = fCP;
147 ((AliTRDfeeParam &) p).fTFaR1 = fTFaR1;
148 ((AliTRDfeeParam &) p).fTFaR2 = fTFaR2;
149 ((AliTRDfeeParam &) p).fTFaC1 = fTFaC1;
150 ((AliTRDfeeParam &) p).fTFaC2 = fTFaC2;
155 //_____________________________________________________________________________
156 Int_t AliTRDfeeParam::GetPadRowFromMCM(Int_t irob, Int_t imcm) const
159 // return on which pad row this mcm sits
162 return fgkNmcmRobInRow*(irob/2) + imcm/fgkNmcmRobInCol;
165 //_____________________________________________________________________________
166 Int_t AliTRDfeeParam::GetPadColFromADC(Int_t irob, Int_t imcm, Int_t iadc) const
169 // return which pad is connected to this adc channel.
170 // Return -1 if no appropriate pad is found.
172 // Caution: ADC ordering in the online data is opposite to the pad column ordering.
173 // And it is not one-by-one correspondence. Precise drawing can be found in:
174 // http://wiki.kip.uni-heidelberg.de/ti/TRD/index.php/Image:ROB_MCM_numbering.pdf
176 if (iadc < 0 || iadc > 19 ) return -1;
177 Int_t mcmcol = imcm%fgkNmcmRobInCol + GetRobSide(irob)*fgkNmcmRobInCol; // MCM column number on ROC [0..7]
178 Int_t padcol = mcmcol*fgkNcolMcm + fgkNcolMcm + 1 - iadc;
179 if( padcol < 0 || padcol >= fgkNcol ) return -1;
183 //_____________________________________________________________________________
184 Int_t AliTRDfeeParam::GetMCMfromPad(Int_t irow, Int_t icol) const
187 // Return on which MCM this pad is directry connected.
188 // Return -1 for error.
191 if ( irow < 0 || icol < 0 || irow > fgkNrowC1 || icol > fgkNcol ) return -1;
193 return (icol%(fgkNcol/2))/fgkNcolMcm + fgkNmcmRobInCol*(irow%fgkNmcmRobInRow);
196 //_____________________________________________________________________________
197 Int_t AliTRDfeeParam::GetROBfromPad(Int_t irow, Int_t icol) const
200 // return on which rob this pad is
203 return (irow/fgkNmcmRobInRow)*2 + GetColSide(icol);
206 //_____________________________________________________________________________
207 Int_t AliTRDfeeParam::GetRobSide(Int_t irob) const
210 // return on which side this rob sits (A side = 0, B side = 1)
213 if ( irob < 0 || irob >= fgkNrobC1 ) return -1;
217 //_____________________________________________________________________________
218 Int_t AliTRDfeeParam::GetColSide(Int_t icol) const
221 // return on which side this column sits (A side = 0, B side = 1)
224 if ( icol < 0 || icol >= fgkNcol ) return -1;
225 return icol/(fgkNcol/2);
229 //void AliTRDfeeParam::GetFilterParam( Float_t &r1, Float_t &r2, Float_t &c1, Float_t &c2, Float_t &ped ) const
232 // Return current filter parameter