]>
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) |
84 | ,fPadPlaneArray(0) | |
3551db50 | 85 | { |
86 | // | |
2745a409 | 87 | // Default constructor |
3551db50 | 88 | // |
89 | ||
3551db50 | 90 | Init(); |
2745a409 | 91 | |
26db308d | 92 | } |
3551db50 | 93 | |
94 | //_____________________________________________________________________________ | |
95 | void AliTRDCommonParam::Init() | |
96 | { | |
97 | // | |
2745a409 | 98 | // Initialization |
3551db50 | 99 | // |
100 | ||
101 | // E x B effects | |
4e009ce4 | 102 | fExBOn = kTRUE; |
3551db50 | 103 | |
3551db50 | 104 | // ---------------------------------------------------------------------------- |
105 | // The pad planes | |
106 | // ---------------------------------------------------------------------------- | |
107 | ||
108 | fPadPlaneArray = new TObjArray(kNplan * kNcham); | |
109 | ||
110 | for (Int_t iplan = 0; iplan < kNplan; iplan++) { | |
111 | for (Int_t icham = 0; icham < kNcham; icham++) { | |
112 | Int_t ipp = iplan + icham * kNplan; | |
113 | fPadPlaneArray->AddAt(new AliTRDpadPlane(iplan,icham),ipp); | |
114 | } | |
115 | } | |
2745a409 | 116 | |
3551db50 | 117 | } |
118 | ||
119 | //_____________________________________________________________________________ | |
120 | AliTRDCommonParam::~AliTRDCommonParam() | |
121 | { | |
122 | // | |
2745a409 | 123 | // Destructor |
3551db50 | 124 | // |
125 | ||
3551db50 | 126 | if (fPadPlaneArray) { |
127 | fPadPlaneArray->Delete(); | |
128 | delete fPadPlaneArray; | |
129 | fPadPlaneArray = 0; | |
130 | } | |
2745a409 | 131 | |
26db308d | 132 | } |
3551db50 | 133 | |
134 | //_____________________________________________________________________________ | |
2745a409 | 135 | AliTRDCommonParam::AliTRDCommonParam(const AliTRDCommonParam &p) |
136 | :TObject(p) | |
2745a409 | 137 | ,fExBOn(p.fExBOn) |
138 | ,fPadPlaneArray(0) | |
3551db50 | 139 | { |
140 | // | |
2745a409 | 141 | // Copy constructor |
3551db50 | 142 | // |
143 | ||
3551db50 | 144 | } |
145 | ||
3551db50 | 146 | //_____________________________________________________________________________ |
147 | AliTRDCommonParam &AliTRDCommonParam::operator=(const AliTRDCommonParam &p) | |
148 | { | |
149 | // | |
150 | // Assignment operator | |
151 | // | |
152 | ||
c965eab1 | 153 | if (this != &p) { |
154 | ((AliTRDCommonParam &) p).Copy(*this); | |
155 | } | |
156 | ||
3551db50 | 157 | return *this; |
2745a409 | 158 | |
3551db50 | 159 | } |
160 | ||
161 | //_____________________________________________________________________________ | |
162 | void AliTRDCommonParam::Copy(TObject &p) const | |
163 | { | |
164 | // | |
165 | // Copy function | |
166 | // | |
167 | ||
c965eab1 | 168 | AliTRDCommonParam *target = dynamic_cast<AliTRDCommonParam*> (&p); |
2745a409 | 169 | if (!target) { |
3551db50 | 170 | return; |
2745a409 | 171 | } |
172 | ||
173 | target->fExBOn = fExBOn; | |
2745a409 | 174 | |
3551db50 | 175 | } |
176 | ||
177 | //_____________________________________________________________________________ | |
178 | AliTRDpadPlane *AliTRDCommonParam::GetPadPlane(Int_t p, Int_t c) const | |
179 | { | |
180 | // | |
181 | // Returns the pad plane for a given plane <p> and chamber <c> number | |
182 | // | |
183 | ||
184 | Int_t ipp = p + c * kNplan; | |
185 | return ((AliTRDpadPlane *) fPadPlaneArray->At(ipp)); | |
186 | ||
187 | } | |
188 | ||
189 | //_____________________________________________________________________________ | |
190 | Int_t AliTRDCommonParam::GetRowMax(Int_t p, Int_t c, Int_t /*s*/) const | |
191 | { | |
192 | // | |
193 | // Returns the number of rows on the pad plane | |
194 | // | |
195 | ||
196 | return GetPadPlane(p,c)->GetNrows(); | |
197 | ||
198 | } | |
199 | ||
200 | //_____________________________________________________________________________ | |
201 | Int_t AliTRDCommonParam::GetColMax(Int_t p) const | |
202 | { | |
203 | // | |
204 | // Returns the number of rows on the pad plane | |
205 | // | |
206 | ||
207 | return GetPadPlane(p,0)->GetNcols(); | |
208 | ||
209 | } | |
210 | ||
211 | //_____________________________________________________________________________ | |
212 | Double_t AliTRDCommonParam::GetRow0(Int_t p, Int_t c, Int_t /*s*/) const | |
213 | { | |
214 | // | |
215 | // Returns the position of the border of the first pad in a row | |
216 | // | |
217 | ||
218 | return GetPadPlane(p,c)->GetRow0(); | |
219 | ||
220 | } | |
221 | ||
222 | //_____________________________________________________________________________ | |
223 | Double_t AliTRDCommonParam::GetCol0(Int_t p) const | |
224 | { | |
225 | // | |
226 | // Returns the position of the border of the first pad in a column | |
227 | // | |
228 | ||
229 | return GetPadPlane(p,0)->GetCol0(); | |
230 | ||
231 | } |