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 **************************************************************************/
21 New release on 2007/08/17
23 The default raw data version (now fRAWversion ) is set to 3
24 in the constructer because version 3 raw data read and write
29 //////////////////////////////////////////////////
31 // TRD front end electronics parameters class //
32 // Contains all FEE (MCM, TRAP, PASA) related //
33 // parameters, constants, and mapping. //
35 //////////////////////////////////////////////////
40 #include "AliTRDfeeParam.h"
41 #include "AliTRDgeometry.h"
42 #include "AliTRDCommonParam.h"
44 ClassImp(AliTRDfeeParam)
46 AliTRDfeeParam *AliTRDfeeParam::fgInstance = 0;
47 Bool_t AliTRDfeeParam::fgTerminated = kFALSE;
49 //_____________________________________________________________________________
50 AliTRDfeeParam* AliTRDfeeParam::Instance()
52 // Instance constructor
54 if (fgTerminated != kFALSE) {
58 if (fgInstance == 0) {
59 fgInstance = new AliTRDfeeParam();
65 //_____________________________________________________________________________
66 void AliTRDfeeParam::Terminate()
69 // Terminate the class and release memory
74 if (fgInstance != 0) {
80 //_____________________________________________________________________________
81 AliTRDfeeParam::AliTRDfeeParam()
93 // Default constructor
103 else if (fgkTFnExp == 2) {
110 // fGeo = AliTRDgeometry::Instance();
111 fCP = AliTRDCommonParam::Instance();
115 //_____________________________________________________________________________
116 AliTRDfeeParam::AliTRDfeeParam(const AliTRDfeeParam &p)
124 ,fRAWversion(p.fRAWversion)
125 ,fRAWstoreRaw(p.fRAWstoreRaw)
128 // AliTRDfeeParam copy constructor
132 //_____________________________________________________________________________
133 AliTRDfeeParam::~AliTRDfeeParam()
136 // AliTRDfeeParam destructor
140 //_____________________________________________________________________________
141 AliTRDfeeParam &AliTRDfeeParam::operator=(const AliTRDfeeParam &p)
144 // Assignment operator
148 ((AliTRDfeeParam &) p).Copy(*this);
153 //_____________________________________________________________________________
154 void AliTRDfeeParam::Copy(TObject &p) const
160 // ((AliTRDfeeParam &) p).fGeo = fGeo;
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;
172 //_____________________________________________________________________________
173 Int_t AliTRDfeeParam::GetPadRowFromMCM(Int_t irob, Int_t imcm) const
176 // return on which pad row this mcm sits
179 return fgkNmcmRobInRow*(irob/2) + imcm/fgkNmcmRobInCol;
182 //_____________________________________________________________________________
183 Int_t AliTRDfeeParam::GetPadColFromADC(Int_t irob, Int_t imcm, Int_t iadc) const
186 // Return which pad is connected to this adc channel.
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.
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
197 if (iadc < 0 || iadc > 19 ) return -100;
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;
200 // if( padcol < 0 || padcol >= fgkNcol ) return -1; // thisi s commented because of reson above KO
204 //_____________________________________________________________________________
205 Int_t AliTRDfeeParam::GetMCMfromPad(Int_t irow, Int_t icol) const
208 // Return on which MCM this pad is directry connected.
209 // Return -1 for error.
212 if ( irow < 0 || icol < 0 || irow > fgkNrowC1 || icol > fgkNcol ) return -1;
214 return (icol%(fgkNcol/2))/fgkNcolMcm + fgkNmcmRobInCol*(irow%fgkNmcmRobInRow);
217 //_____________________________________________________________________________
218 Int_t AliTRDfeeParam::GetROBfromPad(Int_t irow, Int_t icol) const
221 // return on which rob this pad is
224 return (irow/fgkNmcmRobInRow)*2 + GetColSide(icol);
227 //_____________________________________________________________________________
228 Int_t AliTRDfeeParam::GetRobSide(Int_t irob) const
231 // return on which side this rob sits (A side = 0, B side = 1)
234 if ( irob < 0 || irob >= fgkNrobC1 ) return -1;
238 //_____________________________________________________________________________
239 Int_t AliTRDfeeParam::GetColSide(Int_t icol) const
242 // return on which side this column sits (A side = 0, B side = 1)
245 if ( icol < 0 || icol >= fgkNcol ) return -1;
246 return icol/(fgkNcol/2);
250 //void AliTRDfeeParam::GetFilterParam( Float_t &r1, Float_t &r2, Float_t &c1, Float_t &c2, Float_t &ped ) const
253 // Return current filter parameter
264 //_____________________________________________________________________________
265 Int_t AliTRDfeeParam::GetRAWversion()
267 // Return raw data version (major number only)
272 //_____________________________________________________________________________
273 void AliTRDfeeParam::SetRAWversion( Int_t rawver )
275 // Set raw data version (major number only)
276 // Maximum available number is preset in fgkMaxRAWversion
278 if( rawver >= 0 && rawver <= fgkMaxRAWversion ) {
280 fRAWversion = rawver ;
282 AliError(Form("Raw version is out of range: %d",rawver));
286 //_____________________________________________________________________________
287 Bool_t AliTRDfeeParam::GetRAWstoreRaw()
289 // Returns kTRUE if raw data itself is read instead of filtered data
294 //_____________________________________________________________________________
295 void AliTRDfeeParam::SetRAWstoreRaw( Bool_t storeraw )
297 // If kTRUE is set, raw data itself is read instead of filtered data
299 fRAWstoreRaw = storeraw;