]>
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" | |
5f5f7b5e | 30 | #include "AliRun.h" |
3551db50 | 31 | |
32 | #include "AliTRDCommonParam.h" | |
33 | #include "AliTRDpadPlane.h" | |
34 | ||
5f5f7b5e | 35 | |
3551db50 | 36 | ClassImp(AliTRDCommonParam) |
37 | ||
c965eab1 | 38 | AliTRDCommonParam *AliTRDCommonParam::fgInstance = 0; |
3551db50 | 39 | Bool_t AliTRDCommonParam::fgTerminated = kFALSE; |
40 | ||
41 | //_ singleton implementation __________________________________________________ | |
42 | AliTRDCommonParam* AliTRDCommonParam::Instance() | |
43 | { | |
44 | // | |
45 | // Singleton implementation | |
46 | // Returns an instance of this class, it is created if neccessary | |
47 | // | |
48 | ||
c965eab1 | 49 | if (fgTerminated != kFALSE) { |
3551db50 | 50 | return 0; |
c965eab1 | 51 | } |
3551db50 | 52 | |
c965eab1 | 53 | if (fgInstance == 0) { |
3551db50 | 54 | fgInstance = new AliTRDCommonParam(); |
c965eab1 | 55 | } |
56 | ||
3551db50 | 57 | return fgInstance; |
2745a409 | 58 | |
3551db50 | 59 | } |
60 | ||
2745a409 | 61 | //_____________________________________________________________________________ |
3551db50 | 62 | void AliTRDCommonParam::Terminate() |
63 | { | |
64 | // | |
65 | // Singleton implementation | |
4806f526 | 66 | // Deletes the instance of this class and sets the terminated flag, |
67 | // instances cannot be requested anymore | |
3551db50 | 68 | // This function can be called several times. |
69 | // | |
70 | ||
71 | fgTerminated = kTRUE; | |
72 | ||
c965eab1 | 73 | if (fgInstance != 0) { |
3551db50 | 74 | delete fgInstance; |
75 | fgInstance = 0; | |
76 | } | |
2745a409 | 77 | |
3551db50 | 78 | } |
79 | ||
80 | //_____________________________________________________________________________ | |
81 | AliTRDCommonParam::AliTRDCommonParam() | |
2745a409 | 82 | :TObject() |
2745a409 | 83 | ,fExBOn(kFALSE) |
b43a3e17 | 84 | ,fSamplingFrequency(0.0) |
2745a409 | 85 | ,fPadPlaneArray(0) |
3551db50 | 86 | { |
87 | // | |
2745a409 | 88 | // Default constructor |
3551db50 | 89 | // |
90 | ||
3551db50 | 91 | Init(); |
2745a409 | 92 | |
26db308d | 93 | } |
3551db50 | 94 | |
95 | //_____________________________________________________________________________ | |
96 | void AliTRDCommonParam::Init() | |
97 | { | |
98 | // | |
2745a409 | 99 | // Initialization |
3551db50 | 100 | // |
101 | ||
102 | // E x B effects | |
b43a3e17 | 103 | fExBOn = kTRUE; |
104 | ||
105 | // Sampling Frequency in MHz | |
106 | fSamplingFrequency = 10.0; | |
3551db50 | 107 | |
3551db50 | 108 | // ---------------------------------------------------------------------------- |
109 | // The pad planes | |
110 | // ---------------------------------------------------------------------------- | |
111 | ||
112 | fPadPlaneArray = new TObjArray(kNplan * kNcham); | |
113 | ||
114 | for (Int_t iplan = 0; iplan < kNplan; iplan++) { | |
115 | for (Int_t icham = 0; icham < kNcham; icham++) { | |
116 | Int_t ipp = iplan + icham * kNplan; | |
117 | fPadPlaneArray->AddAt(new AliTRDpadPlane(iplan,icham),ipp); | |
118 | } | |
119 | } | |
2745a409 | 120 | |
3551db50 | 121 | } |
122 | ||
123 | //_____________________________________________________________________________ | |
124 | AliTRDCommonParam::~AliTRDCommonParam() | |
125 | { | |
126 | // | |
2745a409 | 127 | // Destructor |
3551db50 | 128 | // |
129 | ||
3551db50 | 130 | if (fPadPlaneArray) { |
131 | fPadPlaneArray->Delete(); | |
132 | delete fPadPlaneArray; | |
133 | fPadPlaneArray = 0; | |
134 | } | |
2745a409 | 135 | |
26db308d | 136 | } |
3551db50 | 137 | |
138 | //_____________________________________________________________________________ | |
2745a409 | 139 | AliTRDCommonParam::AliTRDCommonParam(const AliTRDCommonParam &p) |
140 | :TObject(p) | |
2745a409 | 141 | ,fExBOn(p.fExBOn) |
b43a3e17 | 142 | ,fSamplingFrequency(p.fSamplingFrequency) |
2745a409 | 143 | ,fPadPlaneArray(0) |
3551db50 | 144 | { |
145 | // | |
2745a409 | 146 | // Copy constructor |
3551db50 | 147 | // |
148 | ||
3551db50 | 149 | } |
150 | ||
3551db50 | 151 | //_____________________________________________________________________________ |
152 | AliTRDCommonParam &AliTRDCommonParam::operator=(const AliTRDCommonParam &p) | |
153 | { | |
154 | // | |
155 | // Assignment operator | |
156 | // | |
157 | ||
c965eab1 | 158 | if (this != &p) { |
159 | ((AliTRDCommonParam &) p).Copy(*this); | |
160 | } | |
161 | ||
3551db50 | 162 | return *this; |
2745a409 | 163 | |
3551db50 | 164 | } |
165 | ||
166 | //_____________________________________________________________________________ | |
167 | void AliTRDCommonParam::Copy(TObject &p) const | |
168 | { | |
169 | // | |
170 | // Copy function | |
171 | // | |
172 | ||
c965eab1 | 173 | AliTRDCommonParam *target = dynamic_cast<AliTRDCommonParam*> (&p); |
2745a409 | 174 | if (!target) { |
3551db50 | 175 | return; |
2745a409 | 176 | } |
177 | ||
b43a3e17 | 178 | target->fExBOn = fExBOn; |
179 | target->fSamplingFrequency = fSamplingFrequency; | |
2745a409 | 180 | |
3551db50 | 181 | } |
182 | ||
183 | //_____________________________________________________________________________ | |
184 | AliTRDpadPlane *AliTRDCommonParam::GetPadPlane(Int_t p, Int_t c) const | |
185 | { | |
186 | // | |
187 | // Returns the pad plane for a given plane <p> and chamber <c> number | |
188 | // | |
189 | ||
190 | Int_t ipp = p + c * kNplan; | |
191 | return ((AliTRDpadPlane *) fPadPlaneArray->At(ipp)); | |
192 | ||
193 | } | |
194 | ||
195 | //_____________________________________________________________________________ | |
196 | Int_t AliTRDCommonParam::GetRowMax(Int_t p, Int_t c, Int_t /*s*/) const | |
197 | { | |
198 | // | |
199 | // Returns the number of rows on the pad plane | |
200 | // | |
201 | ||
202 | return GetPadPlane(p,c)->GetNrows(); | |
203 | ||
204 | } | |
205 | ||
206 | //_____________________________________________________________________________ | |
207 | Int_t AliTRDCommonParam::GetColMax(Int_t p) const | |
208 | { | |
209 | // | |
210 | // Returns the number of rows on the pad plane | |
211 | // | |
212 | ||
213 | return GetPadPlane(p,0)->GetNcols(); | |
214 | ||
215 | } | |
216 | ||
217 | //_____________________________________________________________________________ | |
218 | Double_t AliTRDCommonParam::GetRow0(Int_t p, Int_t c, Int_t /*s*/) const | |
219 | { | |
220 | // | |
221 | // Returns the position of the border of the first pad in a row | |
222 | // | |
223 | ||
224 | return GetPadPlane(p,c)->GetRow0(); | |
225 | ||
226 | } | |
227 | ||
228 | //_____________________________________________________________________________ | |
229 | Double_t AliTRDCommonParam::GetCol0(Int_t p) const | |
230 | { | |
231 | // | |
232 | // Returns the position of the border of the first pad in a column | |
233 | // | |
234 | ||
235 | return GetPadPlane(p,0)->GetCol0(); | |
236 | ||
237 | } |