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.2 2000/03/02 21:42:29 nilsen
19 Linked AliDetector::fDigit to AliITSmodule::fDigitsM and AliITS::fITSRecPoints
20 to AliITSmodule::fRecPointsM. Renamed AliITSmodule::fPointsM to fRecPointsM.
21 Removed the deletion of fDigitsM from the distructor since it is only a copy
22 of what is in AliDetector. Fixed a bug in the functions LineSegmentL and
23 LineSegmentG. Added two new versions of LineSegmentL and LineSegmentG to
24 additionaly return track number from the hit. Removed FastPoint function,
25 haven't found anywere it was used, also it had very many problems, should
26 just call FastPointSPD... .
28 Revision 1.3.4.1 2000/01/12 19:03:32 nilsen
29 This is the version of the files after the merging done in December 1999.
30 See the ReadMe110100.txt file for details
32 Revision 1.3 1999/10/04 15:20:12 fca
33 Correct syntax accepted by g++ but not standard for static members, remove minor warnings
35 Revision 1.2 1999/09/29 09:24:20 fca
36 Introduction of the Copyright and cvs Log
44 ClassImp(AliITSmodule)
46 //_______________________________________________________________________
48 // Impementation of class AliITSmodule
50 // created by: A. Bouchm, W. Peryt, S. Radomski, P. Skowronski
51 // R. Barbers, B. Batyunia, B. S. Nilsen
52 // ver 1.0 CERN 16.09.1999
53 //_______________________________________________________________________
54 //________________________________________________________________________
56 // Constructors and deconstructor
57 //________________________________________________________________________
59 AliITSmodule::AliITSmodule() {
68 //_________________________________________________________________________
69 AliITSmodule::AliITSmodule(Int_t index) {
73 fHitsM = new TObjArray();
74 fTrackIndex = new TArrayI(16);
75 fHitIndex = new TArrayI(16);
76 fITS = (AliITS*)(gAlice->GetDetector("ITS"));
78 //__________________________________________________________________________
79 AliITSmodule::~AliITSmodule() {
80 // The destructor for AliITSmodule. Before destoring AliITSmodule
81 // we must first destroy all of it's members.
85 for(Int_t i=0;i<fHitsM->GetEntriesFast();i++)
86 delete ((AliITShit *)(fHitsM->At(i)));
87 // must delete each object in the TObjArray.
92 fITS = 0; // We don't delete this pointer since it is just a copy.
94 //____________________________________________________________________________
95 AliITSmodule::AliITSmodule(const AliITSmodule &source){
96 ////////////////////////////////////////////////////////////////////////
98 ////////////////////////////////////////////////////////////////////////
99 printf("AliITSmodule error: AliITSmodule class has not to be copied! Exit.\n");
103 //_____________________________________________________________________________
104 AliITSmodule& AliITSmodule::operator=(const AliITSmodule &source){
105 ////////////////////////////////////////////////////////////////////////
106 // Assignment operator
107 ////////////////////////////////////////////////////////////////////////
108 printf("AliITSmodule error: AliITSmodule class has not to be copied! Exit.\n");
110 return *this; // fake return neded on Sun
113 //_________________________________________________________________________
116 //__________________________________________________________________________
117 Int_t AliITSmodule::AddHit(AliITShit* hit,Int_t t,Int_t h) {
120 fHitsM->AddLast(new AliITShit(*hit));
121 Int_t fNhitsM = fHitsM->GetEntriesFast();
122 if(fNhitsM-1>=fTrackIndex->GetSize()){ // need to expand the TArrayI
123 TArrayI *p = new TArrayI(fNhitsM+64);
124 for(Int_t i=0;i<fTrackIndex->GetSize();i++)
125 (*p)[i] = fTrackIndex->At(i);
129 if(fNhitsM-1>=fHitIndex->GetSize()){ // need to expand the TArrayI
130 TArrayI *p = new TArrayI(fNhitsM+64);
131 for(Int_t i=0;i<fHitIndex->GetSize();i++)
132 (*p)[i] = fHitIndex->At(i);
136 (*fTrackIndex)[fNhitsM-1] = t;
137 (*fHitIndex)[fNhitsM-1] = h;
141 //___________________________________________________________________________
142 void AliITSmodule::MedianHitG(Int_t index,
143 Float_t hitx1,Float_t hity1,Float_t hitz1,
144 Float_t hitx2,Float_t hity2,Float_t hitz2,
145 Float_t &xMg, Float_t &yMg, Float_t &zMg){
147 AliITSgeom *gm = fITS->GetITSgeom();
150 Float_t xMl,yMl=0,zMl;
169 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
170 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
180 //___________________________________________________________________________
181 Double_t AliITSmodule::PathLength(Int_t index,AliITShit *itsHit1,
188 itsHit1->GetPositionG(x1g,y1g,z1g);
189 itsHit2->GetPositionG(x2g,y2g,z2g);
191 s = TMath::Sqrt( ((Double_t)(x2g-x1g)*(Double_t)(x2g-x1g)) +
192 ((Double_t)(y2g-y1g)*(Double_t)(y2g-y1g)) +
193 ((Double_t)(z2g-z1g)*(Double_t)(z2g-z1g)) );
196 //___________________________________________________________________________
197 void AliITSmodule::PathLength(Int_t index,
198 Float_t x,Float_t y,Float_t z,
199 Int_t status,Int_t &nseg,
200 Float_t &x1,Float_t &y1,Float_t &z1,
201 Float_t &dx1,Float_t &dy1,Float_t &dz1,
204 static Float_t x0,y0,z0;
206 if (status == 66){ // entering
220 if (status == 68) flag = 0; //exiting
221 else flag = 2; //inside
227 //___________________________________________________________________________
228 Bool_t AliITSmodule::LineSegmentL(Int_t hitindex,Double_t &a,Double_t &b,
229 Double_t &c,Double_t &d,
230 Double_t &e,Double_t &f,Double_t &de){
232 static Int_t hitindex0;
235 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
237 h1 = (AliITShit *) (fHitsM->At(hitindex));
238 if(h1->StatusEntering()){ // if track entering volume, get index for next
240 hitindex0 = hitindex;
242 } // end if StatusEntering()
244 h0 = (AliITShit *) (fHitsM->At(hitindex0));
245 de = h1->GetIonization();
246 h0->GetPositionL(a,c,e);
247 h1->GetPositionL(b,d,f);
251 hitindex0 = hitindex;
254 //___________________________________________________________________________
255 Bool_t AliITSmodule::LineSegmentG(Int_t hitindex,Double_t &a,Double_t &b,
256 Double_t &c,Double_t &d,
257 Double_t &e,Double_t &f,Double_t &de){
259 static Int_t hitindex0;
262 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
264 h1 = (AliITShit *) (fHitsM->At(hitindex));
265 if(h1->StatusEntering()){ // if track entering volume, get index for next
267 hitindex0 = hitindex;
269 } // end if StatusEntering()
271 h0 = (AliITShit *) (fHitsM->At(hitindex0));
272 de = h1->GetIonization();
273 h0->GetPositionG(a,c,e);
274 h1->GetPositionG(b,d,f);
278 hitindex0 = hitindex;
281 //___________________________________________________________________________
282 Bool_t AliITSmodule::LineSegmentL(Int_t hitindex,Double_t &a,Double_t &b,
283 Double_t &c,Double_t &d,
284 Double_t &e,Double_t &f,
285 Double_t &de,Int_t &track){
287 static Int_t hitindex0;
290 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
292 h1 = (AliITShit *) (fHitsM->At(hitindex));
293 if(h1->StatusEntering()){ // if track entering volume, get index for next
295 hitindex0 = hitindex;
296 track = h1->GetTrack();
298 } // end if StatusEntering()
300 h0 = (AliITShit *) (fHitsM->At(hitindex0));
301 de = h1->GetIonization();
302 h0->GetPositionL(a,c,e);
303 h1->GetPositionL(b,d,f);
307 hitindex0 = hitindex;
308 track = h1->GetTrack();
311 //___________________________________________________________________________
312 Bool_t AliITSmodule::LineSegmentG(Int_t hitindex,Double_t &a,Double_t &b,
313 Double_t &c,Double_t &d,
314 Double_t &e,Double_t &f,
315 Double_t &de,Int_t &track){
317 static Int_t hitindex0;
320 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
322 h1 = (AliITShit *) (fHitsM->At(hitindex));
323 if(h1->StatusEntering()){ // if track entering volume, get index for next
325 hitindex0 = hitindex;
326 track = h1->GetTrack();
328 } // end if StatusEntering()
330 h0 = (AliITShit *) (fHitsM->At(hitindex0));
331 de = h1->GetIonization();
332 h0->GetPositionG(a,c,e);
333 h1->GetPositionG(b,d,f);
337 hitindex0 = hitindex;
338 track = h1->GetTrack();
341 //___________________________________________________________________________
342 void AliITSmodule::MedianHitL(Int_t index,
345 Float_t &xMl, Float_t &yMl, Float_t &zMl){
350 itsHit1->GetPositionL(x1l,y1l,z1l);
351 itsHit2->GetPositionL(x2l,y2l,z2l);
353 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
355 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
357 //___________________________________________________________________________
358 void AliITSmodule::MedianHit(Int_t index,
359 Float_t xg,Float_t yg,Float_t zg,
361 Float_t &xMg,Float_t &yMg,Float_t &zMg,
364 static Float_t x1,y1,z1;
366 if (status == 66){ // entering
372 if (status == 68){ // exiting
373 MedianHitG(index,x1,y1,z1,xg,yg,zg,xMg,yMg,zMg);
376 if ((status != 66) && (status != 68)) flag = 1;
378 //___________________________________________________________________________
379 void AliITSmodule::GetID(Int_t &lay,Int_t &lad,Int_t &det){
381 fITS->GetITSgeom()->GetModuleId(fIndex,lay,lad,det);