]>
Commit | Line | Data |
---|---|---|
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: AliITSUChip.cxx 53509 2011-12-10 18:55:52Z masera $ */ | |
17 | ||
18 | #include <TArrayI.h> | |
19 | ||
20 | #include <stdlib.h> | |
21 | ||
22 | #include "AliRun.h" | |
23 | #include "AliITS.h" | |
24 | #include "AliITSUChip.h" | |
25 | #include "AliITSUGeomTGeo.h" | |
26 | using namespace TMath; | |
27 | ||
28 | ClassImp(AliITSUChip) | |
29 | ||
30 | //_______________________________________________________________________ | |
31 | // | |
32 | // Impementation of class AliITSUChip | |
33 | // | |
34 | //_______________________________________________________________________ | |
35 | //________________________________________________________________________ | |
36 | // | |
37 | // Constructors and deconstructor | |
38 | //________________________________________________________________________ | |
39 | // | |
40 | AliITSUChip::AliITSUChip() | |
41 | : fHitsM(0) | |
42 | ,fGeomTG(0) | |
43 | { | |
44 | // constructor | |
45 | } | |
46 | ||
47 | //_________________________________________________________________________ | |
48 | AliITSUChip::AliITSUChip(Int_t index, AliITSUGeomTGeo* tg) | |
49 | :fHitsM(new TObjArray()) | |
50 | ,fGeomTG(tg) | |
51 | { | |
52 | // constructor | |
53 | SetIndex(index); | |
54 | } | |
55 | ||
56 | //__________________________________________________________________________ | |
57 | AliITSUChip::~AliITSUChip() | |
58 | { | |
59 | // The destructor for AliITSUChip. Before destoring AliITSUChip | |
60 | // we must first destroy all of it's members. | |
61 | if (fHitsM) fHitsM->Clear(); | |
62 | delete fHitsM; | |
63 | } | |
64 | ||
65 | //____________________________________________________________________________ | |
66 | AliITSUChip::AliITSUChip(const AliITSUChip &source) | |
67 | :TObject(source) | |
68 | ,fHitsM(source.fHitsM) | |
69 | ,fGeomTG(source.fGeomTG) | |
70 | { | |
71 | // Copy Constructor | |
72 | } | |
73 | ||
74 | //_____________________________________________________________________________ | |
75 | AliITSUChip& AliITSUChip::operator=(const AliITSUChip &source) | |
76 | { | |
77 | // Assignment operator | |
78 | if (this!=&source) { | |
79 | this->~AliITSUChip(); | |
80 | new(this) AliITSUChip(source); | |
81 | } | |
82 | return *this; | |
83 | } | |
84 | ||
85 | //___________________________________________________________________________ | |
86 | Double_t AliITSUChip::PathLength(const AliITSUHit *itsHit1,const AliITSUHit *itsHit2) | |
87 | { | |
88 | // path lenght | |
89 | Float_t x1g,y1g,z1g; | |
90 | Float_t x2g,y2g,z2g; | |
91 | Double_t s; | |
92 | // | |
93 | itsHit1->GetPositionG(x1g,y1g,z1g); | |
94 | itsHit2->GetPositionG(x2g,y2g,z2g); | |
95 | // | |
96 | s = Sqrt( ((Double_t)(x2g-x1g)*(Double_t)(x2g-x1g)) + | |
97 | ((Double_t)(y2g-y1g)*(Double_t)(y2g-y1g)) + | |
98 | ((Double_t)(z2g-z1g)*(Double_t)(z2g-z1g)) ); | |
99 | return s; | |
100 | } | |
101 | ||
102 | //___________________________________________________________________________ | |
103 | void AliITSUChip::PathLength(Float_t x,Float_t y,Float_t z,Int_t status,Int_t &nseg,Float_t &x1,Float_t &y1,Float_t &z1, | |
104 | Float_t &dx1,Float_t &dy1,Float_t &dz1,Int_t &flag) const | |
105 | { | |
106 | // path length | |
107 | static Float_t x0,y0,z0; | |
108 | // | |
109 | if ((status&0x0002)!=0){ // entering | |
110 | x0 = x; | |
111 | y0 = y; | |
112 | z0 = z; | |
113 | nseg = 0; | |
114 | flag = 1; | |
115 | }else{ | |
116 | x1 = x0; | |
117 | y1 = y0; | |
118 | z1 = z0; | |
119 | dx1 = x-x1; | |
120 | dy1 = y-y1; | |
121 | dz1 = z-z1; | |
122 | nseg++; | |
123 | if ((status&0x0004)!=0) flag = 0; //exiting | |
124 | if ((status&0x0001)!=0) flag = 2; // inside | |
125 | else flag = 2; //inside ? | |
126 | x0 = x; | |
127 | y0 = y; | |
128 | z0 = z; | |
129 | } // end if | |
130 | } | |
131 | ||
132 | //___________________________________________________________________________ | |
133 | Bool_t AliITSUChip::LineSegmentL(Int_t hitindex,Double_t &a,Double_t &b,Double_t &c,Double_t &d, | |
134 | Double_t &e,Double_t &f,Double_t &de) | |
135 | { | |
136 | // line segment | |
137 | AliITSUHit *h1; | |
138 | Double_t t; | |
139 | // | |
140 | if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE; | |
141 | // | |
142 | h1 = (AliITSUHit *) (fHitsM->At(hitindex)); | |
143 | if(h1->StatusEntering()) return kFALSE; // if track entering volume, get index for next step | |
144 | de = h1->GetIonization(); | |
145 | h1->GetPositionL0(a,c,e,t); | |
146 | h1->GetPositionL(b,d,f); | |
147 | b = b - a; | |
148 | d = d - c; | |
149 | f = f - e; | |
150 | return kTRUE; | |
151 | } | |
152 | ||
153 | //___________________________________________________________________________ | |
154 | Bool_t AliITSUChip::LineSegmentG(Int_t hitindex,Double_t &a,Double_t &b,Double_t &c,Double_t &d, | |
155 | Double_t &e,Double_t &f,Double_t &de) | |
156 | { | |
157 | // line segment | |
158 | AliITSUHit *h1; | |
159 | Double_t t; | |
160 | // | |
161 | if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE; | |
162 | h1 = (AliITSUHit *) (fHitsM->At(hitindex)); | |
163 | if(h1->StatusEntering()) return kFALSE; // if track entering volume, get index for next step | |
164 | de = h1->GetIonization(); | |
165 | h1->GetPositionG0(a,c,e,t); | |
166 | h1->GetPositionG(b,d,f); | |
167 | b = b - a; | |
168 | d = d - c; | |
169 | f = f - e; | |
170 | return kTRUE; | |
171 | } | |
172 | ||
173 | //___________________________________________________________________________ | |
174 | Bool_t AliITSUChip::LineSegmentL(Int_t hitindex,Double_t &a,Double_t &b,Double_t &c,Double_t &d, | |
175 | Double_t &e,Double_t &f,Double_t &de,Double_t &tof, Int_t &track) | |
176 | { | |
177 | // line segmente | |
178 | AliITSUHit *h1; | |
179 | if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE; | |
180 | // | |
181 | h1 = (AliITSUHit *) (fHitsM->At(hitindex)); | |
182 | if(h1->StatusEntering()){ // if track entering volume, get index for next | |
183 | // step | |
184 | track = h1->GetTrack(); | |
185 | return kFALSE; | |
186 | } // end if StatusEntering() | |
187 | // else stepping | |
188 | de = h1->GetIonization(); | |
189 | h1->GetPositionL0(a,c,e,tof); | |
190 | h1->GetPositionL(b,d,f); | |
191 | b = b - a; | |
192 | d = d - c; | |
193 | f = f - e; | |
194 | track = h1->GetTrack(); | |
195 | return kTRUE; | |
196 | } | |
197 | ||
198 | //___________________________________________________________________________ | |
199 | Bool_t AliITSUChip::LineSegmentG(Int_t hitindex,Double_t &a,Double_t &b,Double_t &c,Double_t &d, | |
200 | Double_t &e,Double_t &f,Double_t &de,Double_t &tof, Int_t &track) | |
201 | { | |
202 | // line segment | |
203 | AliITSUHit *h1; | |
204 | if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE; | |
205 | // | |
206 | h1 = (AliITSUHit *) (fHitsM->At(hitindex)); | |
207 | if(h1->StatusEntering()){ // if track entering volume, get index for next | |
208 | // step | |
209 | track = h1->GetTrack(); | |
210 | return kFALSE; | |
211 | } // end if StatusEntering() | |
212 | de = h1->GetIonization(); | |
213 | h1->GetPositionG0(a,c,e,tof); | |
214 | h1->GetPositionG(b,d,f); | |
215 | b = b - a; | |
216 | d = d - c; | |
217 | f = f - e; | |
218 | track = h1->GetTrack(); | |
219 | return kTRUE; | |
220 | } | |
221 | ||
222 | //______________________________________________________________________ | |
223 | Bool_t AliITSUChip::MedianHitG(AliITSUHit *h1,AliITSUHit *h2,Float_t &x,Float_t &y,Float_t &z) | |
224 | { | |
225 | // Computes the mean hit location for a set of hits that make up a track | |
226 | // passing through a volume. Returns kFALSE untill the the track leaves | |
227 | // the volume. | |
228 | // median hit | |
229 | Float_t x1l=0.,y1l=0.,z1l=0.; | |
230 | Float_t x2l=0.,y2l=0.,z2l=0.; | |
231 | Float_t xMl,yMl=0,zMl; | |
232 | Double_t l[3], g[3]; | |
233 | ||
234 | h1->GetPositionG(x1l,y1l,z1l); | |
235 | h2->GetPositionG(x2l,y2l,z2l); | |
236 | ||
237 | if((y2l*y1l)<0.) { | |
238 | xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l; | |
239 | zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l; | |
240 | } else { | |
241 | xMl = 0.5*(x1l+x2l); | |
242 | zMl = 0.5*(z1l+z2l); | |
243 | } | |
244 | ||
245 | l[0] = xMl; | |
246 | l[1] = yMl; | |
247 | l[2] = zMl; | |
248 | fGeomTG->LocalToGlobal(h1->GetChip(),l,g); | |
249 | x = g[0]; | |
250 | y = g[1]; | |
251 | z = g[2]; | |
252 | return kTRUE; | |
253 | } | |
254 | ||
255 | //___________________________________________________________________________ | |
256 | void AliITSUChip::MedianHitG(Int_t index,Float_t hitx1,Float_t hity1,Float_t hitz1,Float_t hitx2,Float_t hity2,Float_t hitz2, | |
257 | Float_t &xMg, Float_t &yMg, Float_t &zMg) | |
258 | { | |
259 | // median hit | |
260 | Float_t x1l,y1l,z1l; | |
261 | Float_t x2l,y2l,z2l; | |
262 | Float_t xMl,yMl=0,zMl; | |
263 | Double_t l[3], g[3]; | |
264 | ||
265 | g[0] = hitx1; | |
266 | g[1] = hity1; | |
267 | g[2] = hitz1; | |
268 | fGeomTG->GlobalToLocal(index,g,l); | |
269 | x1l = l[0]; | |
270 | y1l = l[1]; | |
271 | z1l = l[2]; | |
272 | ||
273 | g[0] = hitx2; | |
274 | g[1] = hity2; | |
275 | g[2] = hitz2; | |
276 | fGeomTG->GlobalToLocal(index,g,l); | |
277 | x2l = l[0]; | |
278 | y2l = l[1]; | |
279 | z2l = l[2]; | |
280 | ||
281 | if((y2l*y1l)<0.) { | |
282 | xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l; | |
283 | zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l; | |
284 | } else { | |
285 | xMl = 0.5*(x1l+x2l); | |
286 | zMl = 0.5*(z1l+z2l); | |
287 | } | |
288 | ||
289 | l[0] = xMl; | |
290 | l[1] = yMl; | |
291 | l[2] = zMl; | |
292 | fGeomTG->LocalToGlobal(index,l,g); | |
293 | xMg = g[0]; | |
294 | yMg = g[1]; | |
295 | zMg = g[2]; | |
296 | } | |
297 | ||
298 | //___________________________________________________________________________ | |
299 | Bool_t AliITSUChip::MedianHitL( AliITSUHit *itsHit1,AliITSUHit *itsHit2, Float_t &xMl, Float_t &yMl, Float_t &zMl) const | |
300 | { | |
301 | // median hit | |
302 | Float_t x1l,y1l,z1l; | |
303 | Float_t x2l,y2l,z2l; | |
304 | ||
305 | itsHit1->GetPositionL(x1l,y1l,z1l); | |
306 | itsHit2->GetPositionL(x2l,y2l,z2l); | |
307 | ||
308 | yMl = 0.0; | |
309 | if((y2l*y1l)<0.) { | |
310 | xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l; | |
311 | zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l; | |
312 | } else { | |
313 | xMl = 0.5*(x1l+x2l); | |
314 | zMl = 0.5*(z1l+z2l); | |
315 | } | |
316 | return kTRUE; | |
317 | } | |
318 | ||
319 | //___________________________________________________________________________ | |
320 | void AliITSUChip::MedianHit(Int_t index,Float_t xg,Float_t yg,Float_t zg,Int_t status, | |
321 | Float_t &xMg,Float_t &yMg,Float_t &zMg,Int_t &flag) | |
322 | { | |
323 | // median hit | |
324 | static Float_t x1,y1,z1; | |
325 | // | |
326 | if ((status&0x0002)!=0){ // entering | |
327 | x1 = xg; | |
328 | y1 = yg; | |
329 | z1 = zg; | |
330 | flag = 1; | |
331 | } else if ((status&0x0004)!=0){ // exiting | |
332 | MedianHitG(index,x1,y1,z1,xg,yg,zg,xMg,yMg,zMg); | |
333 | flag = 0; | |
334 | } // end if | |
335 | else flag = 1; | |
336 | } | |
337 | ||
338 |