]>
Commit | Line | Data |
---|---|---|
3551db50 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
17 | ||
18 | /////////////////////////////////////////////////////////////////////////////// | |
19 | // // | |
2745a409 | 20 | // Class containing constant common parameters // |
3551db50 | 21 | // // |
2745a409 | 22 | // Request an instance with AliTRDCommonParam::Instance() // |
3551db50 | 23 | // Then request the needed values // |
24 | // // | |
25 | /////////////////////////////////////////////////////////////////////////////// | |
26 | ||
c965eab1 | 27 | #include <TObjArray.h> |
28 | ||
29 | #include "AliTracker.h" | |
3551db50 | 30 | |
31 | #include "AliTRDCommonParam.h" | |
32 | #include "AliTRDpadPlane.h" | |
33 | ||
3551db50 | 34 | ClassImp(AliTRDCommonParam) |
35 | ||
c965eab1 | 36 | AliTRDCommonParam *AliTRDCommonParam::fgInstance = 0; |
3551db50 | 37 | Bool_t AliTRDCommonParam::fgTerminated = kFALSE; |
38 | ||
39 | //_ singleton implementation __________________________________________________ | |
40 | AliTRDCommonParam* AliTRDCommonParam::Instance() | |
41 | { | |
42 | // | |
43 | // Singleton implementation | |
44 | // Returns an instance of this class, it is created if neccessary | |
45 | // | |
46 | ||
c965eab1 | 47 | if (fgTerminated != kFALSE) { |
3551db50 | 48 | return 0; |
c965eab1 | 49 | } |
3551db50 | 50 | |
c965eab1 | 51 | if (fgInstance == 0) { |
3551db50 | 52 | fgInstance = new AliTRDCommonParam(); |
c965eab1 | 53 | } |
54 | ||
3551db50 | 55 | return fgInstance; |
2745a409 | 56 | |
3551db50 | 57 | } |
58 | ||
2745a409 | 59 | //_____________________________________________________________________________ |
3551db50 | 60 | void AliTRDCommonParam::Terminate() |
61 | { | |
62 | // | |
63 | // Singleton implementation | |
64 | // Deletes the instance of this class and sets the terminated flag, instances cannot be requested anymore | |
65 | // This function can be called several times. | |
66 | // | |
67 | ||
68 | fgTerminated = kTRUE; | |
69 | ||
c965eab1 | 70 | if (fgInstance != 0) { |
3551db50 | 71 | delete fgInstance; |
72 | fgInstance = 0; | |
73 | } | |
2745a409 | 74 | |
3551db50 | 75 | } |
76 | ||
77 | //_____________________________________________________________________________ | |
78 | AliTRDCommonParam::AliTRDCommonParam() | |
2745a409 | 79 | :TObject() |
80 | ,fField(0) | |
81 | ,fExBOn(kFALSE) | |
82 | ,fPadPlaneArray(0) | |
3551db50 | 83 | { |
84 | // | |
2745a409 | 85 | // Default constructor |
3551db50 | 86 | // |
87 | ||
3551db50 | 88 | Init(); |
2745a409 | 89 | |
26db308d | 90 | } |
3551db50 | 91 | |
92 | //_____________________________________________________________________________ | |
93 | void AliTRDCommonParam::Init() | |
94 | { | |
95 | // | |
2745a409 | 96 | // Initialization |
3551db50 | 97 | // |
98 | ||
99 | // E x B effects | |
100 | fExBOn = kTRUE; | |
101 | ||
3551db50 | 102 | // The magnetic field strength in Tesla |
c965eab1 | 103 | fField = AliTracker::GetBz() * 0.1; |
3551db50 | 104 | |
3551db50 | 105 | // ---------------------------------------------------------------------------- |
106 | // The pad planes | |
107 | // ---------------------------------------------------------------------------- | |
108 | ||
109 | fPadPlaneArray = new TObjArray(kNplan * kNcham); | |
110 | ||
111 | for (Int_t iplan = 0; iplan < kNplan; iplan++) { | |
112 | for (Int_t icham = 0; icham < kNcham; icham++) { | |
113 | Int_t ipp = iplan + icham * kNplan; | |
114 | fPadPlaneArray->AddAt(new AliTRDpadPlane(iplan,icham),ipp); | |
115 | } | |
116 | } | |
2745a409 | 117 | |
3551db50 | 118 | } |
119 | ||
120 | //_____________________________________________________________________________ | |
121 | AliTRDCommonParam::~AliTRDCommonParam() | |
122 | { | |
123 | // | |
2745a409 | 124 | // Destructor |
3551db50 | 125 | // |
126 | ||
3551db50 | 127 | if (fPadPlaneArray) { |
128 | fPadPlaneArray->Delete(); | |
129 | delete fPadPlaneArray; | |
130 | fPadPlaneArray = 0; | |
131 | } | |
2745a409 | 132 | |
26db308d | 133 | } |
3551db50 | 134 | |
135 | //_____________________________________________________________________________ | |
2745a409 | 136 | AliTRDCommonParam::AliTRDCommonParam(const AliTRDCommonParam &p) |
137 | :TObject(p) | |
138 | ,fField(p.fField) | |
139 | ,fExBOn(p.fExBOn) | |
140 | ,fPadPlaneArray(0) | |
3551db50 | 141 | { |
142 | // | |
2745a409 | 143 | // Copy constructor |
3551db50 | 144 | // |
145 | ||
3551db50 | 146 | } |
147 | ||
3551db50 | 148 | //_____________________________________________________________________________ |
149 | AliTRDCommonParam &AliTRDCommonParam::operator=(const AliTRDCommonParam &p) | |
150 | { | |
151 | // | |
152 | // Assignment operator | |
153 | // | |
154 | ||
c965eab1 | 155 | if (this != &p) { |
156 | ((AliTRDCommonParam &) p).Copy(*this); | |
157 | } | |
158 | ||
3551db50 | 159 | return *this; |
2745a409 | 160 | |
3551db50 | 161 | } |
162 | ||
163 | //_____________________________________________________________________________ | |
164 | void AliTRDCommonParam::Copy(TObject &p) const | |
165 | { | |
166 | // | |
167 | // Copy function | |
168 | // | |
169 | ||
c965eab1 | 170 | AliTRDCommonParam *target = dynamic_cast<AliTRDCommonParam*> (&p); |
2745a409 | 171 | if (!target) { |
3551db50 | 172 | return; |
2745a409 | 173 | } |
174 | ||
175 | target->fExBOn = fExBOn; | |
176 | target->fField = fField; | |
177 | ||
3551db50 | 178 | } |
179 | ||
180 | //_____________________________________________________________________________ | |
181 | AliTRDpadPlane *AliTRDCommonParam::GetPadPlane(Int_t p, Int_t c) const | |
182 | { | |
183 | // | |
184 | // Returns the pad plane for a given plane <p> and chamber <c> number | |
185 | // | |
186 | ||
187 | Int_t ipp = p + c * kNplan; | |
188 | return ((AliTRDpadPlane *) fPadPlaneArray->At(ipp)); | |
189 | ||
190 | } | |
191 | ||
192 | //_____________________________________________________________________________ | |
193 | Int_t AliTRDCommonParam::GetRowMax(Int_t p, Int_t c, Int_t /*s*/) const | |
194 | { | |
195 | // | |
196 | // Returns the number of rows on the pad plane | |
197 | // | |
198 | ||
199 | return GetPadPlane(p,c)->GetNrows(); | |
200 | ||
201 | } | |
202 | ||
203 | //_____________________________________________________________________________ | |
204 | Int_t AliTRDCommonParam::GetColMax(Int_t p) const | |
205 | { | |
206 | // | |
207 | // Returns the number of rows on the pad plane | |
208 | // | |
209 | ||
210 | return GetPadPlane(p,0)->GetNcols(); | |
211 | ||
212 | } | |
213 | ||
214 | //_____________________________________________________________________________ | |
215 | Double_t AliTRDCommonParam::GetRow0(Int_t p, Int_t c, Int_t /*s*/) const | |
216 | { | |
217 | // | |
218 | // Returns the position of the border of the first pad in a row | |
219 | // | |
220 | ||
221 | return GetPadPlane(p,c)->GetRow0(); | |
222 | ||
223 | } | |
224 | ||
225 | //_____________________________________________________________________________ | |
226 | Double_t AliTRDCommonParam::GetCol0(Int_t p) const | |
227 | { | |
228 | // | |
229 | // Returns the position of the border of the first pad in a column | |
230 | // | |
231 | ||
232 | return GetPadPlane(p,0)->GetCol0(); | |
233 | ||
234 | } |