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