Classes moved to STEERBase.
[u/mrichter/AliRoot.git] / TRD / AliTRDfeeParam.cxx
CommitLineData
022e76c3 1
2/**************************************************************************
3 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * *
5 * Author: The ALICE Off-line Project. *
6 * Contributors are mentioned in the code where appropriate. *
7 * *
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 **************************************************************************/
16
17/* $Id$ */
18
19//////////////////////////////////////////////////
20// //
21// TRD front end electronics parameters class //
22// Contains all FEE (MCM, TRAP, PASA) related //
23// parameters, constants, and mapping. //
24// //
25//////////////////////////////////////////////////
26
27#include <TMath.h>
28
29#include "AliTRDfeeParam.h"
30#include "AliTRDgeometry.h"
31#include "AliTRDCommonParam.h"
32
33ClassImp(AliTRDfeeParam)
34
35AliTRDfeeParam *AliTRDfeeParam::fgInstance = 0;
36Bool_t AliTRDfeeParam::fgTerminated = kFALSE;
37
38//_____________________________________________________________________________
39AliTRDfeeParam* AliTRDfeeParam::Instance()
40{
41 // Instance constructor
42
43 if (fgTerminated != kFALSE) {
44 return 0;
45 }
46
47 if (fgInstance == 0) {
48 fgInstance = new AliTRDfeeParam();
49 }
50
51 return fgInstance;
52}
53
54//_____________________________________________________________________________
55void AliTRDfeeParam::Terminate()
56{
57 //
58 // Terminate the class and release memory
59 //
60
61 fgTerminated = kTRUE;
62
63 if (fgInstance != 0) {
64 delete fgInstance;
65 fgInstance = 0;
66 }
67}
68
69//_____________________________________________________________________________
70AliTRDfeeParam::AliTRDfeeParam()
71 :TObject()
72 // ,fGeo(0)
73 ,fCP(0)
dfd03fc3 74 ,fTFr1(0)
75 ,fTFr2(0)
76 ,fTFc1(0)
77 ,fTFc2(0)
022e76c3 78{
79 //
80 // Default constructor
81 //
82
83 // PASA V.4
dfd03fc3 84 if (fgkTFnExp == 1) {
85 fTFr1 = 1.1563;
86 fTFr2 = 0.1299;
87 fTFc1 = 0.0657;
88 fTFc2 = 0.0000;
022e76c3 89 }
dfd03fc3 90 else if (fgkTFnExp == 2) {
91 fTFr1 = 1.1563;
92 fTFr2 = 0.1299;
93 fTFc1 = 0.1141;
94 fTFc2 = 0.6241;
022e76c3 95 }
96
97 // fGeo = AliTRDgeometry::Instance();
98 fCP = AliTRDCommonParam::Instance();
99
100}
101
102//_____________________________________________________________________________
103AliTRDfeeParam::AliTRDfeeParam(const AliTRDfeeParam &p)
104 :TObject(p)
105 // ,fGeo(p.fGeo)
106 ,fCP(p.fCP)
dfd03fc3 107 ,fTFr1(p.fTFr1)
108 ,fTFr2(p.fTFr2)
109 ,fTFc1(p.fTFc1)
110 ,fTFc2(p.fTFc2)
022e76c3 111{
112 //
113 // AliTRDfeeParam copy constructor
114 //
115}
116
117//_____________________________________________________________________________
118AliTRDfeeParam::~AliTRDfeeParam()
119{
120 //
121 // AliTRDfeeParam destructor
122 //
123}
124
125//_____________________________________________________________________________
126AliTRDfeeParam &AliTRDfeeParam::operator=(const AliTRDfeeParam &p)
127{
128 //
129 // Assignment operator
130 //
131
132 if (this != &p) {
133 ((AliTRDfeeParam &) p).Copy(*this);
134 }
135 return *this;
136}
137
138//_____________________________________________________________________________
139void AliTRDfeeParam::Copy(TObject &p) const
140{
141 //
142 // Copy function
143 //
144
145 // ((AliTRDfeeParam &) p).fGeo = fGeo;
146 ((AliTRDfeeParam &) p).fCP = fCP;
dfd03fc3 147 ((AliTRDfeeParam &) p).fTFr1 = fTFr1;
148 ((AliTRDfeeParam &) p).fTFr2 = fTFr2;
149 ((AliTRDfeeParam &) p).fTFc1 = fTFc1;
150 ((AliTRDfeeParam &) p).fTFc2 = fTFc2;
022e76c3 151
152 TObject::Copy(p);
153}
154
155//_____________________________________________________________________________
156Int_t AliTRDfeeParam::GetPadRowFromMCM(Int_t irob, Int_t imcm) const
157{
158 //
159 // return on which pad row this mcm sits
160 //
161
162 return fgkNmcmRobInRow*(irob/2) + imcm/fgkNmcmRobInCol;
163}
164
165//_____________________________________________________________________________
166Int_t AliTRDfeeParam::GetPadColFromADC(Int_t irob, Int_t imcm, Int_t iadc) const
167{
168 //
169 // return which pad is connected to this adc channel.
170 // Return -1 if no appropriate pad is found.
171
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
175
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;
180 return padcol;
181}
182
183//_____________________________________________________________________________
184Int_t AliTRDfeeParam::GetMCMfromPad(Int_t irow, Int_t icol) const
185{
186 //
187 // Return on which MCM this pad is directry connected.
188 // Return -1 for error.
189 //
190
191 if ( irow < 0 || icol < 0 || irow > fgkNrowC1 || icol > fgkNcol ) return -1;
192
193 return (icol%(fgkNcol/2))/fgkNcolMcm + fgkNmcmRobInCol*(irow%fgkNmcmRobInRow);
194}
195
196//_____________________________________________________________________________
197Int_t AliTRDfeeParam::GetROBfromPad(Int_t irow, Int_t icol) const
198{
199 //
200 // return on which rob this pad is
201 //
202
203 return (irow/fgkNmcmRobInRow)*2 + GetColSide(icol);
204}
205
206//_____________________________________________________________________________
207Int_t AliTRDfeeParam::GetRobSide(Int_t irob) const
208{
209 //
210 // return on which side this rob sits (A side = 0, B side = 1)
211 //
212
213 if ( irob < 0 || irob >= fgkNrobC1 ) return -1;
214 return irob%2;
215}
216
217//_____________________________________________________________________________
218Int_t AliTRDfeeParam::GetColSide(Int_t icol) const
219{
220 //
221 // return on which side this column sits (A side = 0, B side = 1)
222 //
223
224 if ( icol < 0 || icol >= fgkNcol ) return -1;
225 return icol/(fgkNcol/2);
226}
227
228//
229//void AliTRDfeeParam::GetFilterParam( Float_t &r1, Float_t &r2, Float_t &c1, Float_t &c2, Float_t &ped ) const
230//{
231 //
232 // Return current filter parameter
233 //
234
235 // r1 = fR1;
236 //r2 = fR2;
237 //c1 = fC1;
238 //c2 = fC2;
239 //ped = fPedestal;
240//};