]>
Commit | Line | Data |
---|---|---|
4c039060 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
803d1ab0 | 3 | * * |
4c039060 | 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 | ||
803d1ab0 | 16 | /* $Id$ */ |
4c039060 | 17 | |
ff61221e | 18 | #include <TArrayI.h> |
19 | ||
114da3a4 | 20 | #include <stdlib.h> |
3bd79107 | 21 | |
58005f18 | 22 | #include "AliRun.h" |
3bd79107 | 23 | #include "AliITS.h" |
ff61221e | 24 | #include "AliITShit.h" |
25 | #include "AliITSmodule.h" | |
26 | #include "AliITSgeom.h" | |
58005f18 | 27 | |
28 | ClassImp(AliITSmodule) | |
29 | ||
30 | //_______________________________________________________________________ | |
31 | // | |
32 | // Impementation of class AliITSmodule | |
33 | // | |
3bd79107 | 34 | // created by: A. Bouchm, W. Peryt, S. Radomski, P. Skowronski |
58005f18 | 35 | // R. Barbers, B. Batyunia, B. S. Nilsen |
36 | // ver 1.0 CERN 16.09.1999 | |
37 | //_______________________________________________________________________ | |
58005f18 | 38 | //________________________________________________________________________ |
39 | // | |
40 | // Constructors and deconstructor | |
41 | //________________________________________________________________________ | |
42 | // | |
3bd79107 | 43 | AliITSmodule::AliITSmodule() { |
b0f0d5a5 | 44 | // constructor |
45 | ||
3bd79107 | 46 | fHitsM = 0; |
47 | fTrackIndex = 0; | |
48 | fHitIndex = 0; | |
49 | fITS = 0; | |
58005f18 | 50 | |
3bd79107 | 51 | } |
52 | //_________________________________________________________________________ | |
53 | AliITSmodule::AliITSmodule(Int_t index) { | |
54 | // constructor | |
58005f18 | 55 | |
3bd79107 | 56 | fIndex = index; |
57 | fHitsM = new TObjArray(); | |
58 | fTrackIndex = new TArrayI(16); | |
59 | fHitIndex = new TArrayI(16); | |
60 | fITS = (AliITS*)(gAlice->GetDetector("ITS")); | |
61 | } | |
62 | //__________________________________________________________________________ | |
63 | AliITSmodule::~AliITSmodule() { | |
64 | // The destructor for AliITSmodule. Before destoring AliITSmodule | |
65 | // we must first destroy all of it's members. | |
58005f18 | 66 | |
3bd79107 | 67 | if(fHitsM){ |
279a35d7 | 68 | fHitsM->Delete(); |
69 | delete fHitsM; | |
70 | fHitsM = 0; | |
3bd79107 | 71 | } // end if |
72 | delete fTrackIndex; | |
73 | delete fHitIndex; | |
74 | fITS = 0; // We don't delete this pointer since it is just a copy. | |
75 | } | |
76 | //____________________________________________________________________________ | |
ac74f489 | 77 | AliITSmodule::AliITSmodule(const AliITSmodule &source):TObject(source){ |
3bd79107 | 78 | //////////////////////////////////////////////////////////////////////// |
79 | // Copy Constructor | |
80 | //////////////////////////////////////////////////////////////////////// | |
88cb7938 | 81 | Error("AliITSmodule","AliITSmodule class has not to be copied! Exit."); |
3bd79107 | 82 | exit(1); |
58005f18 | 83 | } |
3bd79107 | 84 | //_____________________________________________________________________________ |
85 | AliITSmodule& AliITSmodule::operator=(const AliITSmodule &source){ | |
86 | //////////////////////////////////////////////////////////////////////// | |
87 | // Assignment operator | |
88 | //////////////////////////////////////////////////////////////////////// | |
ac74f489 | 89 | if(&source == this) return *this; |
90 | Error("AliITSmodule","AliITSmodule class has not to be copied! Exit."); | |
91 | exit(1); | |
92 | return *this; // fake return neded on Sun | |
88cb7938 | 93 | } |
58005f18 | 94 | //_________________________________________________________________________ |
3bd79107 | 95 | // |
96 | // Hits management | |
97 | //__________________________________________________________________________ | |
98 | Int_t AliITSmodule::AddHit(AliITShit* hit,Int_t t,Int_t h) { | |
99 | // Hits management | |
58005f18 | 100 | |
ff61221e | 101 | //printf("AddHit: beginning hit %p t h %d %d\n",hit,t,h); |
3bd79107 | 102 | fHitsM->AddLast(new AliITShit(*hit)); |
103 | Int_t fNhitsM = fHitsM->GetEntriesFast(); | |
104 | if(fNhitsM-1>=fTrackIndex->GetSize()){ // need to expand the TArrayI | |
ea008941 | 105 | fTrackIndex->Set(fNhitsM+64); |
3bd79107 | 106 | } // end if |
107 | if(fNhitsM-1>=fHitIndex->GetSize()){ // need to expand the TArrayI | |
ea008941 | 108 | fHitIndex->Set(fNhitsM+64); |
3bd79107 | 109 | } // end if |
110 | (*fTrackIndex)[fNhitsM-1] = t; | |
111 | (*fHitIndex)[fNhitsM-1] = h; | |
112 | return fNhitsM; | |
113 | } | |
3bd79107 | 114 | //___________________________________________________________________________ |
115 | Double_t AliITSmodule::PathLength(Int_t index,AliITShit *itsHit1, | |
7d62fb64 | 116 | AliITShit *itsHit2) { |
3bd79107 | 117 | // path lenght |
118 | Float_t x1g,y1g,z1g; | |
119 | Float_t x2g,y2g,z2g; | |
120 | Double_t s; | |
58005f18 | 121 | |
ac74f489 | 122 | index = 0; |
3bd79107 | 123 | itsHit1->GetPositionG(x1g,y1g,z1g); |
124 | itsHit2->GetPositionG(x2g,y2g,z2g); | |
58005f18 | 125 | |
3bd79107 | 126 | s = TMath::Sqrt( ((Double_t)(x2g-x1g)*(Double_t)(x2g-x1g)) + |
127 | ((Double_t)(y2g-y1g)*(Double_t)(y2g-y1g)) + | |
128 | ((Double_t)(z2g-z1g)*(Double_t)(z2g-z1g)) ); | |
129 | return s; | |
130 | } | |
131 | //___________________________________________________________________________ | |
132 | void AliITSmodule::PathLength(Int_t index, | |
133 | Float_t x,Float_t y,Float_t z, | |
134 | Int_t status,Int_t &nseg, | |
135 | Float_t &x1,Float_t &y1,Float_t &z1, | |
136 | Float_t &dx1,Float_t &dy1,Float_t &dz1, | |
7d62fb64 | 137 | Int_t &flag) const{ |
3bd79107 | 138 | // path length |
139 | static Float_t x0,y0,z0; | |
58005f18 | 140 | |
ac74f489 | 141 | index = 0; |
7e3ded1b | 142 | if ((status&0x0002)!=0){ // entering |
3bd79107 | 143 | x0 = x; |
144 | y0 = y; | |
145 | z0 = z; | |
146 | nseg = 0; | |
147 | flag = 1; | |
148 | }else{ | |
149 | x1 = x0; | |
150 | y1 = y0; | |
151 | z1 = z0; | |
152 | dx1 = x-x1; | |
153 | dy1 = y-y1; | |
154 | dz1 = z-z1; | |
155 | nseg++; | |
7e3ded1b | 156 | if ((status&0x0004)!=0) flag = 0; //exiting |
157 | if ((status&0x0001)!=0) flag = 2; // inside | |
158 | else flag = 2; //inside ? | |
3bd79107 | 159 | x0 = x; |
160 | y0 = y; | |
161 | z0 = z; | |
162 | } // end if | |
58005f18 | 163 | } |
3bd79107 | 164 | //___________________________________________________________________________ |
165 | Bool_t AliITSmodule::LineSegmentL(Int_t hitindex,Double_t &a,Double_t &b, | |
166 | Double_t &c,Double_t &d, | |
167 | Double_t &e,Double_t &f,Double_t &de){ | |
168 | // line segment | |
88cb7938 | 169 | AliITShit *h1; |
170 | Double_t t; | |
58005f18 | 171 | |
3bd79107 | 172 | if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE; |
58005f18 | 173 | |
3bd79107 | 174 | h1 = (AliITShit *) (fHitsM->At(hitindex)); |
175 | if(h1->StatusEntering()){ // if track entering volume, get index for next | |
176 | // step | |
3bd79107 | 177 | return kFALSE; |
178 | } // end if StatusEntering() | |
179 | // else stepping | |
3bd79107 | 180 | de = h1->GetIonization(); |
88cb7938 | 181 | h1->GetPositionL0(a,c,e,t); |
3bd79107 | 182 | h1->GetPositionL(b,d,f); |
183 | b = b - a; | |
184 | d = d - c; | |
185 | f = f - e; | |
3bd79107 | 186 | return kTRUE; |
187 | } | |
188 | //___________________________________________________________________________ | |
189 | Bool_t AliITSmodule::LineSegmentG(Int_t hitindex,Double_t &a,Double_t &b, | |
190 | Double_t &c,Double_t &d, | |
191 | Double_t &e,Double_t &f,Double_t &de){ | |
192 | // line segment | |
88cb7938 | 193 | AliITShit *h1; |
194 | Double_t t; | |
58005f18 | 195 | |
3bd79107 | 196 | if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE; |
197 | ||
198 | h1 = (AliITShit *) (fHitsM->At(hitindex)); | |
199 | if(h1->StatusEntering()){ // if track entering volume, get index for next | |
200 | // step | |
3bd79107 | 201 | return kFALSE; |
202 | } // end if StatusEntering() | |
203 | // else stepping | |
3bd79107 | 204 | de = h1->GetIonization(); |
88cb7938 | 205 | h1->GetPositionG0(a,c,e,t); |
3bd79107 | 206 | h1->GetPositionG(b,d,f); |
207 | b = b - a; | |
208 | d = d - c; | |
209 | f = f - e; | |
3bd79107 | 210 | return kTRUE; |
211 | } | |
212 | //___________________________________________________________________________ | |
213 | Bool_t AliITSmodule::LineSegmentL(Int_t hitindex,Double_t &a,Double_t &b, | |
214 | Double_t &c,Double_t &d, | |
215 | Double_t &e,Double_t &f, | |
216 | Double_t &de,Int_t &track){ | |
217 | // line segmente | |
88cb7938 | 218 | AliITShit *h1; |
219 | Double_t t; | |
3bd79107 | 220 | |
221 | if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE; | |
222 | ||
223 | h1 = (AliITShit *) (fHitsM->At(hitindex)); | |
224 | if(h1->StatusEntering()){ // if track entering volume, get index for next | |
225 | // step | |
3bd79107 | 226 | track = h1->GetTrack(); |
227 | return kFALSE; | |
228 | } // end if StatusEntering() | |
229 | // else stepping | |
3bd79107 | 230 | de = h1->GetIonization(); |
88cb7938 | 231 | h1->GetPositionL0(a,c,e,t); |
3bd79107 | 232 | h1->GetPositionL(b,d,f); |
233 | b = b - a; | |
234 | d = d - c; | |
235 | f = f - e; | |
3bd79107 | 236 | track = h1->GetTrack(); |
237 | return kTRUE; | |
238 | } | |
239 | //___________________________________________________________________________ | |
240 | Bool_t AliITSmodule::LineSegmentG(Int_t hitindex,Double_t &a,Double_t &b, | |
241 | Double_t &c,Double_t &d, | |
242 | Double_t &e,Double_t &f, | |
243 | Double_t &de,Int_t &track){ | |
244 | // line segment | |
88cb7938 | 245 | AliITShit *h1; |
246 | Double_t t; | |
3bd79107 | 247 | |
248 | if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE; | |
249 | ||
250 | h1 = (AliITShit *) (fHitsM->At(hitindex)); | |
251 | if(h1->StatusEntering()){ // if track entering volume, get index for next | |
252 | // step | |
3bd79107 | 253 | track = h1->GetTrack(); |
254 | return kFALSE; | |
255 | } // end if StatusEntering() | |
256 | // else stepping | |
3bd79107 | 257 | de = h1->GetIonization(); |
88cb7938 | 258 | h1->GetPositionG0(a,c,e,t); |
3bd79107 | 259 | h1->GetPositionG(b,d,f); |
260 | b = b - a; | |
261 | d = d - c; | |
262 | f = f - e; | |
3bd79107 | 263 | track = h1->GetTrack(); |
264 | return kTRUE; | |
58005f18 | 265 | } |
7e3ded1b | 266 | //______________________________________________________________________ |
267 | Bool_t AliITSmodule::MedianHitG(AliITShit *h1,AliITShit *h2, | |
268 | Float_t &x,Float_t &y,Float_t &z){ | |
269 | // Computes the mean hit location for a set of hits that make up a track | |
270 | // passing through a volume. Returns kFALSE untill the the track leaves | |
271 | // the volume. | |
272 | // median hit | |
273 | AliITSgeom *gm = fITS->GetITSgeom(); | |
274 | Float_t x1l=0.,y1l=0.,z1l=0.; | |
275 | Float_t x2l=0.,y2l=0.,z2l=0.; | |
276 | Float_t xMl,yMl=0,zMl; | |
277 | Float_t l[3], g[3]; | |
278 | ||
279 | h1->GetPositionG(x1l,y1l,z1l); | |
280 | h2->GetPositionG(x2l,y2l,z2l); | |
281 | ||
6d48704c | 282 | if((y2l*y1l)<0.) { |
7e3ded1b | 283 | xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l; |
284 | zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l; | |
285 | } else { | |
286 | xMl = 0.5*(x1l+x2l); | |
287 | zMl = 0.5*(z1l+z2l); | |
288 | } | |
289 | ||
290 | l[0] = xMl; | |
291 | l[1] = yMl; | |
292 | l[2] = zMl; | |
293 | gm->LtoG(h1->GetModule(),l,g); | |
294 | x = g[0]; | |
295 | y = g[1]; | |
296 | z = g[2]; | |
297 | return kTRUE; | |
298 | } | |
299 | //___________________________________________________________________________ | |
300 | void AliITSmodule::MedianHitG(Int_t index, | |
301 | Float_t hitx1,Float_t hity1,Float_t hitz1, | |
302 | Float_t hitx2,Float_t hity2,Float_t hitz2, | |
303 | Float_t &xMg, Float_t &yMg, Float_t &zMg){ | |
304 | // median hit | |
305 | AliITSgeom *gm = fITS->GetITSgeom(); | |
306 | Float_t x1l,y1l,z1l; | |
307 | Float_t x2l,y2l,z2l; | |
308 | Float_t xMl,yMl=0,zMl; | |
309 | Float_t l[3], g[3]; | |
310 | ||
311 | g[0] = hitx1; | |
312 | g[1] = hity1; | |
313 | g[2] = hitz1; | |
314 | gm->GtoL(index,g,l); | |
315 | x1l = l[0]; | |
316 | y1l = l[1]; | |
317 | z1l = l[2]; | |
318 | ||
319 | g[0] = hitx2; | |
320 | g[1] = hity2; | |
321 | g[2] = hitz2; | |
322 | gm->GtoL(index,g,l); | |
323 | x2l = l[0]; | |
324 | y2l = l[1]; | |
325 | z2l = l[2]; | |
326 | ||
6d48704c | 327 | if((y2l*y1l)<0.) { |
7e3ded1b | 328 | xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l; |
329 | zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l; | |
330 | } else { | |
331 | xMl = 0.5*(x1l+x2l); | |
332 | zMl = 0.5*(z1l+z2l); | |
333 | } | |
334 | ||
335 | l[0] = xMl; | |
336 | l[1] = yMl; | |
337 | l[2] = zMl; | |
338 | gm->LtoG(index,l,g); | |
339 | xMg = g[0]; | |
340 | yMg = g[1]; | |
341 | zMg = g[2]; | |
342 | } | |
3bd79107 | 343 | //___________________________________________________________________________ |
7e3ded1b | 344 | Bool_t AliITSmodule::MedianHitL( AliITShit *itsHit1, |
3bd79107 | 345 | AliITShit *itsHit2, |
7d62fb64 | 346 | Float_t &xMl, Float_t &yMl, Float_t &zMl) const{ |
3bd79107 | 347 | // median hit |
348 | Float_t x1l,y1l,z1l; | |
349 | Float_t x2l,y2l,z2l; | |
350 | ||
351 | itsHit1->GetPositionL(x1l,y1l,z1l); | |
352 | itsHit2->GetPositionL(x2l,y2l,z2l); | |
58005f18 | 353 | |
3bd79107 | 354 | yMl = 0.0; |
6d48704c | 355 | if((y2l*y1l)<0.) { |
37ffef26 | 356 | xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l; |
357 | zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l; | |
358 | } else { | |
359 | xMl = 0.5*(x1l+x2l); | |
360 | zMl = 0.5*(z1l+z2l); | |
361 | } | |
7e3ded1b | 362 | return kTRUE; |
3bd79107 | 363 | } |
58005f18 | 364 | //___________________________________________________________________________ |
3bd79107 | 365 | void AliITSmodule::MedianHit(Int_t index, |
366 | Float_t xg,Float_t yg,Float_t zg, | |
367 | Int_t status, | |
368 | Float_t &xMg,Float_t &yMg,Float_t &zMg, | |
369 | Int_t &flag){ | |
370 | // median hit | |
371 | static Float_t x1,y1,z1; | |
372 | ||
7e3ded1b | 373 | if ((status&0x0002)!=0){ // entering |
3bd79107 | 374 | x1 = xg; |
375 | y1 = yg; | |
376 | z1 = zg; | |
377 | flag = 1; | |
7e3ded1b | 378 | } else if ((status&0x0004)!=0){ // exiting |
3bd79107 | 379 | MedianHitG(index,x1,y1,z1,xg,yg,zg,xMg,yMg,zMg); |
380 | flag = 0; | |
381 | } // end if | |
7e3ded1b | 382 | else flag = 1; |
58005f18 | 383 | } |
3bd79107 | 384 | //___________________________________________________________________________ |
385 | void AliITSmodule::GetID(Int_t &lay,Int_t &lad,Int_t &det){ | |
386 | // get ID | |
387 | fITS->GetITSgeom()->GetModuleId(fIndex,lay,lad,det); | |
388 | return ; | |
389 | } | |
390 |