1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.10 2002/03/15 17:21:54 nilsen
19 Removed zero-ing of fModules variable in constructors.
21 Revision 1.9 2000/10/04 19:46:39 barbera
22 Corrected by F. Carminati for v3.04
24 Revision 1.8 2000/10/02 16:32:57 barbera
25 Forward declarations added and formatting
27 Revision 1.3.4.8 2000/10/02 15:55:26 barbera
28 Forward declarations added and formatting
30 Revision 1.7 2000/09/22 12:36:38 nilsen
31 Minor changes to improve compilation and create less NOISE.
33 Revision 1.6 2000/07/10 16:07:18 fca
34 Release version of ITS code
36 Revision 1.3.4.2 2000/03/02 21:42:29 nilsen
37 Linked AliDetector::fDigit to AliITSmodule::fDigitsM and AliITS::fITSRecPoints
38 to AliITSmodule::fRecPointsM. Renamed AliITSmodule::fPointsM to fRecPointsM.
39 Removed the deletion of fDigitsM from the distructor since it is only a copy
40 of what is in AliDetector. Fixed a bug in the functions LineSegmentL and
41 LineSegmentG. Added two new versions of LineSegmentL and LineSegmentG to
42 additionaly return track number from the hit. Removed FastPoint function,
43 haven't found anywere it was used, also it had very many problems, should
44 just call FastPointSPD... .
46 Revision 1.3.4.1 2000/01/12 19:03:32 nilsen
47 This is the version of the files after the merging done in December 1999.
48 See the ReadMe110100.txt file for details
50 Revision 1.3 1999/10/04 15:20:12 fca
51 Correct syntax accepted by g++ but not standard for static members, remove minor warnings
53 Revision 1.2 1999/09/29 09:24:20 fca
54 Introduction of the Copyright and cvs Log
64 #include "AliITShit.h"
65 #include "AliITSmodule.h"
66 #include "AliITSgeom.h"
68 ClassImp(AliITSmodule)
70 //_______________________________________________________________________
72 // Impementation of class AliITSmodule
74 // created by: A. Bouchm, W. Peryt, S. Radomski, P. Skowronski
75 // R. Barbers, B. Batyunia, B. S. Nilsen
76 // ver 1.0 CERN 16.09.1999
77 //_______________________________________________________________________
78 //________________________________________________________________________
80 // Constructors and deconstructor
81 //________________________________________________________________________
83 AliITSmodule::AliITSmodule() {
92 //_________________________________________________________________________
93 AliITSmodule::AliITSmodule(Int_t index) {
97 fHitsM = new TObjArray();
98 fTrackIndex = new TArrayI(16);
99 fHitIndex = new TArrayI(16);
100 fITS = (AliITS*)(gAlice->GetDetector("ITS"));
102 //__________________________________________________________________________
103 AliITSmodule::~AliITSmodule() {
104 // The destructor for AliITSmodule. Before destoring AliITSmodule
105 // we must first destroy all of it's members.
108 for(Int_t i=0;i<fHitsM->GetEntriesFast();i++)
109 delete ((AliITShit *)(fHitsM->At(i)));
110 // must delete each object in the TObjArray.
115 fITS = 0; // We don't delete this pointer since it is just a copy.
117 //____________________________________________________________________________
118 AliITSmodule::AliITSmodule(const AliITSmodule &source){
119 ////////////////////////////////////////////////////////////////////////
121 ////////////////////////////////////////////////////////////////////////
122 printf("AliITSmodule error: AliITSmodule class has not to be copied! Exit.\n");
126 //_____________________________________________________________________________
127 AliITSmodule& AliITSmodule::operator=(const AliITSmodule &source){
128 ////////////////////////////////////////////////////////////////////////
129 // Assignment operator
130 ////////////////////////////////////////////////////////////////////////
131 printf("AliITSmodule error: AliITSmodule class has not to be copied! Exit.\n");
133 return *this; // fake return neded on Sun
136 //_________________________________________________________________________
139 //__________________________________________________________________________
140 Int_t AliITSmodule::AddHit(AliITShit* hit,Int_t t,Int_t h) {
143 //printf("AddHit: beginning hit %p t h %d %d\n",hit,t,h);
144 fHitsM->AddLast(new AliITShit(*hit));
145 Int_t fNhitsM = fHitsM->GetEntriesFast();
146 if(fNhitsM-1>=fTrackIndex->GetSize()){ // need to expand the TArrayI
147 TArrayI *p = new TArrayI(fNhitsM+64);
148 for(Int_t i=0;i<fTrackIndex->GetSize();i++)
149 (*p)[i] = fTrackIndex->At(i);
153 if(fNhitsM-1>=fHitIndex->GetSize()){ // need to expand the TArrayI
154 TArrayI *p = new TArrayI(fNhitsM+64);
155 for(Int_t i=0;i<fHitIndex->GetSize();i++)
156 (*p)[i] = fHitIndex->At(i);
160 (*fTrackIndex)[fNhitsM-1] = t;
161 (*fHitIndex)[fNhitsM-1] = h;
165 //___________________________________________________________________________
166 void AliITSmodule::MedianHitG(Int_t index,
167 Float_t hitx1,Float_t hity1,Float_t hitz1,
168 Float_t hitx2,Float_t hity2,Float_t hitz2,
169 Float_t &xMg, Float_t &yMg, Float_t &zMg){
171 AliITSgeom *gm = fITS->GetITSgeom();
174 Float_t xMl,yMl=0,zMl;
193 // Modified by N.Carrer. In very rare occasions the track may be just
194 // tangent to the module. Therefore the entrance and exit points have the
196 if( (y2l-y1l) != 0.0 ) {
197 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
198 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
212 //___________________________________________________________________________
213 Double_t AliITSmodule::PathLength(Int_t index,AliITShit *itsHit1,
220 itsHit1->GetPositionG(x1g,y1g,z1g);
221 itsHit2->GetPositionG(x2g,y2g,z2g);
223 s = TMath::Sqrt( ((Double_t)(x2g-x1g)*(Double_t)(x2g-x1g)) +
224 ((Double_t)(y2g-y1g)*(Double_t)(y2g-y1g)) +
225 ((Double_t)(z2g-z1g)*(Double_t)(z2g-z1g)) );
228 //___________________________________________________________________________
229 void AliITSmodule::PathLength(Int_t index,
230 Float_t x,Float_t y,Float_t z,
231 Int_t status,Int_t &nseg,
232 Float_t &x1,Float_t &y1,Float_t &z1,
233 Float_t &dx1,Float_t &dy1,Float_t &dz1,
236 static Float_t x0,y0,z0;
238 if (status == 66){ // entering
252 if (status == 68) flag = 0; //exiting
253 else flag = 2; //inside
259 //___________________________________________________________________________
260 Bool_t AliITSmodule::LineSegmentL(Int_t hitindex,Double_t &a,Double_t &b,
261 Double_t &c,Double_t &d,
262 Double_t &e,Double_t &f,Double_t &de){
264 static Int_t hitindex0;
267 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
269 h1 = (AliITShit *) (fHitsM->At(hitindex));
270 if(h1->StatusEntering()){ // if track entering volume, get index for next
272 hitindex0 = hitindex;
274 } // end if StatusEntering()
276 h0 = (AliITShit *) (fHitsM->At(hitindex0));
277 de = h1->GetIonization();
278 h0->GetPositionL(a,c,e);
279 h1->GetPositionL(b,d,f);
283 hitindex0 = hitindex;
286 //___________________________________________________________________________
287 Bool_t AliITSmodule::LineSegmentG(Int_t hitindex,Double_t &a,Double_t &b,
288 Double_t &c,Double_t &d,
289 Double_t &e,Double_t &f,Double_t &de){
291 static Int_t hitindex0;
294 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
296 h1 = (AliITShit *) (fHitsM->At(hitindex));
297 if(h1->StatusEntering()){ // if track entering volume, get index for next
299 hitindex0 = hitindex;
301 } // end if StatusEntering()
303 h0 = (AliITShit *) (fHitsM->At(hitindex0));
304 de = h1->GetIonization();
305 h0->GetPositionG(a,c,e);
306 h1->GetPositionG(b,d,f);
310 hitindex0 = hitindex;
313 //___________________________________________________________________________
314 Bool_t AliITSmodule::LineSegmentL(Int_t hitindex,Double_t &a,Double_t &b,
315 Double_t &c,Double_t &d,
316 Double_t &e,Double_t &f,
317 Double_t &de,Int_t &track){
319 static Int_t hitindex0;
322 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
324 h1 = (AliITShit *) (fHitsM->At(hitindex));
325 if(h1->StatusEntering()){ // if track entering volume, get index for next
327 hitindex0 = hitindex;
328 track = h1->GetTrack();
330 } // end if StatusEntering()
332 h0 = (AliITShit *) (fHitsM->At(hitindex0));
333 de = h1->GetIonization();
334 h0->GetPositionL(a,c,e);
335 h1->GetPositionL(b,d,f);
339 hitindex0 = hitindex;
340 track = h1->GetTrack();
343 //___________________________________________________________________________
344 Bool_t AliITSmodule::LineSegmentG(Int_t hitindex,Double_t &a,Double_t &b,
345 Double_t &c,Double_t &d,
346 Double_t &e,Double_t &f,
347 Double_t &de,Int_t &track){
349 static Int_t hitindex0;
352 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
354 h1 = (AliITShit *) (fHitsM->At(hitindex));
355 if(h1->StatusEntering()){ // if track entering volume, get index for next
357 hitindex0 = hitindex;
358 track = h1->GetTrack();
360 } // end if StatusEntering()
362 h0 = (AliITShit *) (fHitsM->At(hitindex0));
363 de = h1->GetIonization();
364 h0->GetPositionG(a,c,e);
365 h1->GetPositionG(b,d,f);
369 hitindex0 = hitindex;
370 track = h1->GetTrack();
373 //___________________________________________________________________________
374 void AliITSmodule::MedianHitL(Int_t index,
377 Float_t &xMl, Float_t &yMl, Float_t &zMl){
382 itsHit1->GetPositionL(x1l,y1l,z1l);
383 itsHit2->GetPositionL(x2l,y2l,z2l);
386 // Modified by N.Carrer. In very rare occasions the track may be just
387 // tangent to the module. Therefore the entrance and exit points have the
389 if( (y2l-y1l) != 0.0 ) {
390 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
391 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
397 //___________________________________________________________________________
398 void AliITSmodule::MedianHit(Int_t index,
399 Float_t xg,Float_t yg,Float_t zg,
401 Float_t &xMg,Float_t &yMg,Float_t &zMg,
404 static Float_t x1,y1,z1;
406 if (status == 66){ // entering
412 if (status == 68){ // exiting
413 MedianHitG(index,x1,y1,z1,xg,yg,zg,xMg,yMg,zMg);
416 if ((status != 66) && (status != 68)) flag = 1;
418 //___________________________________________________________________________
419 void AliITSmodule::GetID(Int_t &lay,Int_t &lad,Int_t &det){
421 fITS->GetITSgeom()->GetModuleId(fIndex,lay,lad,det);