]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDfeeParam.cxx
Small modifications by Raphaelle
[u/mrichter/AliRoot.git] / TRD / AliTRDfeeParam.cxx
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
33 ClassImp(AliTRDfeeParam)
34
35 AliTRDfeeParam *AliTRDfeeParam::fgInstance   = 0;
36 Bool_t          AliTRDfeeParam::fgTerminated = kFALSE;
37
38 //_____________________________________________________________________________
39 AliTRDfeeParam* 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 //_____________________________________________________________________________
55 void 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 //_____________________________________________________________________________
70 AliTRDfeeParam::AliTRDfeeParam()
71   :TObject()
72   //  ,fGeo(0)
73   ,fCP(0)
74   ,fTFaR1(0)
75   ,fTFaR2(0)
76   ,fTFaC1(0)
77   ,fTFaC2(0)
78 {
79   //
80   // Default constructor
81   //
82   
83   // PASA V.4
84   if      (fgkTFaNExp == 1) {
85     fTFaR1 = 1.1563;
86     fTFaR2 = 0.1299;
87     fTFaC1 = 0.0657;
88     fTFaC2 = 0.0000;
89   }
90   else if (fgkTFaNExp == 2) {
91     fTFaR1 = 1.1563;
92     fTFaR2 = 0.1299;
93     fTFaC1 = 0.1141;
94     fTFaC2 = 0.6241;
95   }
96
97   //  fGeo = AliTRDgeometry::Instance();
98   fCP  = AliTRDCommonParam::Instance();
99
100 }
101
102 //_____________________________________________________________________________
103 AliTRDfeeParam::AliTRDfeeParam(const AliTRDfeeParam &p)
104   :TObject(p)
105   //  ,fGeo(p.fGeo)
106   ,fCP(p.fCP)
107   ,fTFaR1(p.fTFaR1)
108   ,fTFaR2(p.fTFaR2)
109   ,fTFaC1(p.fTFaC1)
110   ,fTFaC2(p.fTFaC2)
111 {
112   //
113   // AliTRDfeeParam copy constructor
114   //
115 }
116
117 //_____________________________________________________________________________
118 AliTRDfeeParam::~AliTRDfeeParam()
119 {
120   //
121   // AliTRDfeeParam destructor
122   //
123 }
124
125 //_____________________________________________________________________________
126 AliTRDfeeParam &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 //_____________________________________________________________________________
139 void AliTRDfeeParam::Copy(TObject &p) const
140 {
141   //
142   // Copy function
143   //
144
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;
151   
152   TObject::Copy(p);
153 }
154
155 //_____________________________________________________________________________
156 Int_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 //_____________________________________________________________________________
166 Int_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 //_____________________________________________________________________________
184 Int_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 //_____________________________________________________________________________
197 Int_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 //_____________________________________________________________________________
207 Int_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 //_____________________________________________________________________________
218 Int_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 //};