]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDfeeParam.cxx
Latest version of zero suppressed raw data by Ken and Mateusz
[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
ecf39416 19/*
20
21 New release on 2007/08/17
22
23The default raw data version (now fRAWversion ) is set to 3
24in the constructer because version 3 raw data read and write
25are fully debugged.
26
27*/
28
022e76c3 29//////////////////////////////////////////////////
30// //
31// TRD front end electronics parameters class //
32// Contains all FEE (MCM, TRAP, PASA) related //
33// parameters, constants, and mapping. //
34// //
35//////////////////////////////////////////////////
36
37#include <TMath.h>
38
ecf39416 39#include "AliLog.h"
022e76c3 40#include "AliTRDfeeParam.h"
41#include "AliTRDgeometry.h"
42#include "AliTRDCommonParam.h"
43
44ClassImp(AliTRDfeeParam)
45
46AliTRDfeeParam *AliTRDfeeParam::fgInstance = 0;
47Bool_t AliTRDfeeParam::fgTerminated = kFALSE;
48
49//_____________________________________________________________________________
50AliTRDfeeParam* AliTRDfeeParam::Instance()
51{
52 // Instance constructor
53
54 if (fgTerminated != kFALSE) {
55 return 0;
56 }
57
58 if (fgInstance == 0) {
59 fgInstance = new AliTRDfeeParam();
60 }
61
62 return fgInstance;
63}
64
65//_____________________________________________________________________________
66void AliTRDfeeParam::Terminate()
67{
68 //
69 // Terminate the class and release memory
70 //
71
72 fgTerminated = kTRUE;
73
74 if (fgInstance != 0) {
75 delete fgInstance;
76 fgInstance = 0;
77 }
78}
79
80//_____________________________________________________________________________
81AliTRDfeeParam::AliTRDfeeParam()
82 :TObject()
83 // ,fGeo(0)
84 ,fCP(0)
dfd03fc3 85 ,fTFr1(0)
86 ,fTFr2(0)
87 ,fTFc1(0)
88 ,fTFc2(0)
ecf39416 89 ,fRAWversion(3)
90 ,fRAWstoreRaw(kTRUE)
022e76c3 91{
92 //
93 // Default constructor
94 //
95
96 // PASA V.4
dfd03fc3 97 if (fgkTFnExp == 1) {
98 fTFr1 = 1.1563;
99 fTFr2 = 0.1299;
100 fTFc1 = 0.0657;
101 fTFc2 = 0.0000;
022e76c3 102 }
dfd03fc3 103 else if (fgkTFnExp == 2) {
104 fTFr1 = 1.1563;
105 fTFr2 = 0.1299;
106 fTFc1 = 0.1141;
107 fTFc2 = 0.6241;
022e76c3 108 }
109
110 // fGeo = AliTRDgeometry::Instance();
111 fCP = AliTRDCommonParam::Instance();
112
113}
114
115//_____________________________________________________________________________
116AliTRDfeeParam::AliTRDfeeParam(const AliTRDfeeParam &p)
117 :TObject(p)
118 // ,fGeo(p.fGeo)
119 ,fCP(p.fCP)
dfd03fc3 120 ,fTFr1(p.fTFr1)
121 ,fTFr2(p.fTFr2)
122 ,fTFc1(p.fTFc1)
123 ,fTFc2(p.fTFc2)
ecf39416 124 ,fRAWversion(p.fRAWversion)
125 ,fRAWstoreRaw(p.fRAWstoreRaw)
022e76c3 126{
127 //
128 // AliTRDfeeParam copy constructor
129 //
130}
131
132//_____________________________________________________________________________
133AliTRDfeeParam::~AliTRDfeeParam()
134{
135 //
136 // AliTRDfeeParam destructor
137 //
138}
139
140//_____________________________________________________________________________
141AliTRDfeeParam &AliTRDfeeParam::operator=(const AliTRDfeeParam &p)
142{
143 //
144 // Assignment operator
145 //
146
147 if (this != &p) {
148 ((AliTRDfeeParam &) p).Copy(*this);
149 }
150 return *this;
151}
152
153//_____________________________________________________________________________
154void AliTRDfeeParam::Copy(TObject &p) const
155{
156 //
157 // Copy function
158 //
159
160 // ((AliTRDfeeParam &) p).fGeo = fGeo;
ecf39416 161 ((AliTRDfeeParam &) p).fCP = fCP;
162 ((AliTRDfeeParam &) p).fTFr1 = fTFr1;
163 ((AliTRDfeeParam &) p).fTFr2 = fTFr2;
164 ((AliTRDfeeParam &) p).fTFc1 = fTFc1;
165 ((AliTRDfeeParam &) p).fTFc2 = fTFc2;
166 ((AliTRDfeeParam &) p).fRAWversion = fRAWversion;
167 ((AliTRDfeeParam &) p).fRAWstoreRaw = fRAWstoreRaw;
022e76c3 168
169 TObject::Copy(p);
170}
171
172//_____________________________________________________________________________
173Int_t AliTRDfeeParam::GetPadRowFromMCM(Int_t irob, Int_t imcm) const
174{
175 //
176 // return on which pad row this mcm sits
177 //
178
179 return fgkNmcmRobInRow*(irob/2) + imcm/fgkNmcmRobInCol;
180}
181
182//_____________________________________________________________________________
183Int_t AliTRDfeeParam::GetPadColFromADC(Int_t irob, Int_t imcm, Int_t iadc) const
184{
185 //
ecf39416 186 // Return which pad is connected to this adc channel.
187 //
188 // Return virtual pad number even if ADC is outside chamber
189 // to keep compatibility of data processing at the edge MCM.
190 // User has to check that this is in the chamber if it is essential.
191 // Return -100 if iadc is invalid.
192 //
022e76c3 193 // Caution: ADC ordering in the online data is opposite to the pad column ordering.
194 // And it is not one-by-one correspondence. Precise drawing can be found in:
195 // http://wiki.kip.uni-heidelberg.de/ti/TRD/index.php/Image:ROB_MCM_numbering.pdf
196
ecf39416 197 if (iadc < 0 || iadc > 19 ) return -100;
022e76c3 198 Int_t mcmcol = imcm%fgkNmcmRobInCol + GetRobSide(irob)*fgkNmcmRobInCol; // MCM column number on ROC [0..7]
199 Int_t padcol = mcmcol*fgkNcolMcm + fgkNcolMcm + 1 - iadc;
ecf39416 200 // if( padcol < 0 || padcol >= fgkNcol ) return -1; // thisi s commented because of reson above KO
022e76c3 201 return padcol;
202}
203
204//_____________________________________________________________________________
205Int_t AliTRDfeeParam::GetMCMfromPad(Int_t irow, Int_t icol) const
206{
207 //
208 // Return on which MCM this pad is directry connected.
209 // Return -1 for error.
210 //
211
212 if ( irow < 0 || icol < 0 || irow > fgkNrowC1 || icol > fgkNcol ) return -1;
213
214 return (icol%(fgkNcol/2))/fgkNcolMcm + fgkNmcmRobInCol*(irow%fgkNmcmRobInRow);
215}
216
217//_____________________________________________________________________________
218Int_t AliTRDfeeParam::GetROBfromPad(Int_t irow, Int_t icol) const
219{
220 //
221 // return on which rob this pad is
222 //
223
224 return (irow/fgkNmcmRobInRow)*2 + GetColSide(icol);
225}
226
227//_____________________________________________________________________________
228Int_t AliTRDfeeParam::GetRobSide(Int_t irob) const
229{
230 //
231 // return on which side this rob sits (A side = 0, B side = 1)
232 //
233
234 if ( irob < 0 || irob >= fgkNrobC1 ) return -1;
235 return irob%2;
236}
237
238//_____________________________________________________________________________
239Int_t AliTRDfeeParam::GetColSide(Int_t icol) const
240{
241 //
242 // return on which side this column sits (A side = 0, B side = 1)
243 //
244
245 if ( icol < 0 || icol >= fgkNcol ) return -1;
246 return icol/(fgkNcol/2);
247}
248
249//
250//void AliTRDfeeParam::GetFilterParam( Float_t &r1, Float_t &r2, Float_t &c1, Float_t &c2, Float_t &ped ) const
251//{
252 //
253 // Return current filter parameter
254 //
255
256 // r1 = fR1;
257 //r2 = fR2;
258 //c1 = fC1;
259 //c2 = fC2;
260 //ped = fPedestal;
261//};
ecf39416 262
263
264//_____________________________________________________________________________
265Int_t AliTRDfeeParam::GetRAWversion()
266{
267 // Return raw data version (major number only)
268
269 return fRAWversion;
270}
271
272//_____________________________________________________________________________
273void AliTRDfeeParam::SetRAWversion( Int_t rawver )
274{
275 // Set raw data version (major number only)
276 // Maximum available number is preset in fgkMaxRAWversion
277
278 if( rawver >= 0 && rawver <= fgkMaxRAWversion ) {
279
280 fRAWversion = rawver ;
281 } else {
282 AliError(Form("Raw version is out of range: %d",rawver));
283 }
284}
285
286//_____________________________________________________________________________
287Bool_t AliTRDfeeParam::GetRAWstoreRaw()
288{
289 // Returns kTRUE if raw data itself is read instead of filtered data
290
291 return fRAWstoreRaw;
292}
293
294//_____________________________________________________________________________
295void AliTRDfeeParam::SetRAWstoreRaw( Bool_t storeraw )
296{
297 // If kTRUE is set, raw data itself is read instead of filtered data
298
299 fRAWstoreRaw = storeraw;
300}