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.3.4.8 2000/10/02 15:55:26 barbera
19 Forward declarations added and formatting
21 Revision 1.7 2000/09/22 12:36:38 nilsen
22 Minor changes to improve compilation and create less NOISE.
24 Revision 1.6 2000/07/10 16:07:18 fca
25 Release version of ITS code
27 Revision 1.3.4.2 2000/03/02 21:42:29 nilsen
28 Linked AliDetector::fDigit to AliITSmodule::fDigitsM and AliITS::fITSRecPoints
29 to AliITSmodule::fRecPointsM. Renamed AliITSmodule::fPointsM to fRecPointsM.
30 Removed the deletion of fDigitsM from the distructor since it is only a copy
31 of what is in AliDetector. Fixed a bug in the functions LineSegmentL and
32 LineSegmentG. Added two new versions of LineSegmentL and LineSegmentG to
33 additionaly return track number from the hit. Removed FastPoint function,
34 haven't found anywere it was used, also it had very many problems, should
35 just call FastPointSPD... .
37 Revision 1.3.4.1 2000/01/12 19:03:32 nilsen
38 This is the version of the files after the merging done in December 1999.
39 See the ReadMe110100.txt file for details
41 Revision 1.3 1999/10/04 15:20:12 fca
42 Correct syntax accepted by g++ but not standard for static members, remove minor warnings
44 Revision 1.2 1999/09/29 09:24:20 fca
45 Introduction of the Copyright and cvs Log
54 #include "AliITShit.h"
55 #include "AliITSmodule.h"
56 #include "AliITSgeom.h"
58 ClassImp(AliITSmodule)
60 //_______________________________________________________________________
62 // Impementation of class AliITSmodule
64 // created by: A. Bouchm, W. Peryt, S. Radomski, P. Skowronski
65 // R. Barbers, B. Batyunia, B. S. Nilsen
66 // ver 1.0 CERN 16.09.1999
67 //_______________________________________________________________________
68 //________________________________________________________________________
70 // Constructors and deconstructor
71 //________________________________________________________________________
73 AliITSmodule::AliITSmodule() {
82 //_________________________________________________________________________
83 AliITSmodule::AliITSmodule(Int_t index) {
87 fHitsM = new TObjArray();
88 fTrackIndex = new TArrayI(16);
89 fHitIndex = new TArrayI(16);
90 fITS = (AliITS*)(gAlice->GetDetector("ITS"));
92 //__________________________________________________________________________
93 AliITSmodule::~AliITSmodule() {
94 // The destructor for AliITSmodule. Before destoring AliITSmodule
95 // we must first destroy all of it's members.
99 for(Int_t i=0;i<fHitsM->GetEntriesFast();i++)
100 delete ((AliITShit *)(fHitsM->At(i)));
101 // must delete each object in the TObjArray.
106 fITS = 0; // We don't delete this pointer since it is just a copy.
108 //____________________________________________________________________________
109 AliITSmodule::AliITSmodule(const AliITSmodule &source){
110 ////////////////////////////////////////////////////////////////////////
112 ////////////////////////////////////////////////////////////////////////
113 printf("AliITSmodule error: AliITSmodule class has not to be copied! Exit.\n");
117 //_____________________________________________________________________________
118 AliITSmodule& AliITSmodule::operator=(const AliITSmodule &source){
119 ////////////////////////////////////////////////////////////////////////
120 // Assignment operator
121 ////////////////////////////////////////////////////////////////////////
122 printf("AliITSmodule error: AliITSmodule class has not to be copied! Exit.\n");
124 return *this; // fake return neded on Sun
127 //_________________________________________________________________________
130 //__________________________________________________________________________
131 Int_t AliITSmodule::AddHit(AliITShit* hit,Int_t t,Int_t h) {
134 //printf("AddHit: beginning hit %p t h %d %d\n",hit,t,h);
135 fHitsM->AddLast(new AliITShit(*hit));
136 Int_t fNhitsM = fHitsM->GetEntriesFast();
137 if(fNhitsM-1>=fTrackIndex->GetSize()){ // need to expand the TArrayI
138 TArrayI *p = new TArrayI(fNhitsM+64);
139 for(Int_t i=0;i<fTrackIndex->GetSize();i++)
140 (*p)[i] = fTrackIndex->At(i);
144 if(fNhitsM-1>=fHitIndex->GetSize()){ // need to expand the TArrayI
145 TArrayI *p = new TArrayI(fNhitsM+64);
146 for(Int_t i=0;i<fHitIndex->GetSize();i++)
147 (*p)[i] = fHitIndex->At(i);
151 (*fTrackIndex)[fNhitsM-1] = t;
152 (*fHitIndex)[fNhitsM-1] = h;
156 //___________________________________________________________________________
157 void AliITSmodule::MedianHitG(Int_t index,
158 Float_t hitx1,Float_t hity1,Float_t hitz1,
159 Float_t hitx2,Float_t hity2,Float_t hitz2,
160 Float_t &xMg, Float_t &yMg, Float_t &zMg){
162 AliITSgeom *gm = fITS->GetITSgeom();
165 Float_t xMl,yMl=0,zMl;
184 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
185 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
195 //___________________________________________________________________________
196 Double_t AliITSmodule::PathLength(Int_t index,AliITShit *itsHit1,
203 itsHit1->GetPositionG(x1g,y1g,z1g);
204 itsHit2->GetPositionG(x2g,y2g,z2g);
206 s = TMath::Sqrt( ((Double_t)(x2g-x1g)*(Double_t)(x2g-x1g)) +
207 ((Double_t)(y2g-y1g)*(Double_t)(y2g-y1g)) +
208 ((Double_t)(z2g-z1g)*(Double_t)(z2g-z1g)) );
211 //___________________________________________________________________________
212 void AliITSmodule::PathLength(Int_t index,
213 Float_t x,Float_t y,Float_t z,
214 Int_t status,Int_t &nseg,
215 Float_t &x1,Float_t &y1,Float_t &z1,
216 Float_t &dx1,Float_t &dy1,Float_t &dz1,
219 static Float_t x0,y0,z0;
221 if (status == 66){ // entering
235 if (status == 68) flag = 0; //exiting
236 else flag = 2; //inside
242 //___________________________________________________________________________
243 Bool_t AliITSmodule::LineSegmentL(Int_t hitindex,Double_t &a,Double_t &b,
244 Double_t &c,Double_t &d,
245 Double_t &e,Double_t &f,Double_t &de){
247 static Int_t hitindex0;
250 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
252 h1 = (AliITShit *) (fHitsM->At(hitindex));
253 if(h1->StatusEntering()){ // if track entering volume, get index for next
255 hitindex0 = hitindex;
257 } // end if StatusEntering()
259 h0 = (AliITShit *) (fHitsM->At(hitindex0));
260 de = h1->GetIonization();
261 h0->GetPositionL(a,c,e);
262 h1->GetPositionL(b,d,f);
266 hitindex0 = hitindex;
269 //___________________________________________________________________________
270 Bool_t AliITSmodule::LineSegmentG(Int_t hitindex,Double_t &a,Double_t &b,
271 Double_t &c,Double_t &d,
272 Double_t &e,Double_t &f,Double_t &de){
274 static Int_t hitindex0;
277 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
279 h1 = (AliITShit *) (fHitsM->At(hitindex));
280 if(h1->StatusEntering()){ // if track entering volume, get index for next
282 hitindex0 = hitindex;
284 } // end if StatusEntering()
286 h0 = (AliITShit *) (fHitsM->At(hitindex0));
287 de = h1->GetIonization();
288 h0->GetPositionG(a,c,e);
289 h1->GetPositionG(b,d,f);
293 hitindex0 = hitindex;
296 //___________________________________________________________________________
297 Bool_t AliITSmodule::LineSegmentL(Int_t hitindex,Double_t &a,Double_t &b,
298 Double_t &c,Double_t &d,
299 Double_t &e,Double_t &f,
300 Double_t &de,Int_t &track){
302 static Int_t hitindex0;
305 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
307 h1 = (AliITShit *) (fHitsM->At(hitindex));
308 if(h1->StatusEntering()){ // if track entering volume, get index for next
310 hitindex0 = hitindex;
311 track = h1->GetTrack();
313 } // end if StatusEntering()
315 h0 = (AliITShit *) (fHitsM->At(hitindex0));
316 de = h1->GetIonization();
317 h0->GetPositionL(a,c,e);
318 h1->GetPositionL(b,d,f);
322 hitindex0 = hitindex;
323 track = h1->GetTrack();
326 //___________________________________________________________________________
327 Bool_t AliITSmodule::LineSegmentG(Int_t hitindex,Double_t &a,Double_t &b,
328 Double_t &c,Double_t &d,
329 Double_t &e,Double_t &f,
330 Double_t &de,Int_t &track){
332 static Int_t hitindex0;
335 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
337 h1 = (AliITShit *) (fHitsM->At(hitindex));
338 if(h1->StatusEntering()){ // if track entering volume, get index for next
340 hitindex0 = hitindex;
341 track = h1->GetTrack();
343 } // end if StatusEntering()
345 h0 = (AliITShit *) (fHitsM->At(hitindex0));
346 de = h1->GetIonization();
347 h0->GetPositionG(a,c,e);
348 h1->GetPositionG(b,d,f);
352 hitindex0 = hitindex;
353 track = h1->GetTrack();
356 //___________________________________________________________________________
357 void AliITSmodule::MedianHitL(Int_t index,
360 Float_t &xMl, Float_t &yMl, Float_t &zMl){
365 itsHit1->GetPositionL(x1l,y1l,z1l);
366 itsHit2->GetPositionL(x2l,y2l,z2l);
368 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
370 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
372 //___________________________________________________________________________
373 void AliITSmodule::MedianHit(Int_t index,
374 Float_t xg,Float_t yg,Float_t zg,
376 Float_t &xMg,Float_t &yMg,Float_t &zMg,
379 static Float_t x1,y1,z1;
381 if (status == 66){ // entering
387 if (status == 68){ // exiting
388 MedianHitG(index,x1,y1,z1,xg,yg,zg,xMg,yMg,zMg);
391 if ((status != 66) && (status != 68)) flag = 1;
393 //___________________________________________________________________________
394 void AliITSmodule::GetID(Int_t &lay,Int_t &lad,Int_t &det){
396 fITS->GetITSgeom()->GetModuleId(fIndex,lay,lad,det);