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.8 2000/10/02 16:32:57 barbera
19 Forward declarations added and formatting
21 Revision 1.3.4.8 2000/10/02 15:55:26 barbera
22 Forward declarations added and formatting
24 Revision 1.7 2000/09/22 12:36:38 nilsen
25 Minor changes to improve compilation and create less NOISE.
27 Revision 1.6 2000/07/10 16:07:18 fca
28 Release version of ITS code
30 Revision 1.3.4.2 2000/03/02 21:42:29 nilsen
31 Linked AliDetector::fDigit to AliITSmodule::fDigitsM and AliITS::fITSRecPoints
32 to AliITSmodule::fRecPointsM. Renamed AliITSmodule::fPointsM to fRecPointsM.
33 Removed the deletion of fDigitsM from the distructor since it is only a copy
34 of what is in AliDetector. Fixed a bug in the functions LineSegmentL and
35 LineSegmentG. Added two new versions of LineSegmentL and LineSegmentG to
36 additionaly return track number from the hit. Removed FastPoint function,
37 haven't found anywere it was used, also it had very many problems, should
38 just call FastPointSPD... .
40 Revision 1.3.4.1 2000/01/12 19:03:32 nilsen
41 This is the version of the files after the merging done in December 1999.
42 See the ReadMe110100.txt file for details
44 Revision 1.3 1999/10/04 15:20:12 fca
45 Correct syntax accepted by g++ but not standard for static members, remove minor warnings
47 Revision 1.2 1999/09/29 09:24:20 fca
48 Introduction of the Copyright and cvs Log
58 #include "AliITShit.h"
59 #include "AliITSmodule.h"
60 #include "AliITSgeom.h"
62 ClassImp(AliITSmodule)
64 //_______________________________________________________________________
66 // Impementation of class AliITSmodule
68 // created by: A. Bouchm, W. Peryt, S. Radomski, P. Skowronski
69 // R. Barbers, B. Batyunia, B. S. Nilsen
70 // ver 1.0 CERN 16.09.1999
71 //_______________________________________________________________________
72 //________________________________________________________________________
74 // Constructors and deconstructor
75 //________________________________________________________________________
77 AliITSmodule::AliITSmodule() {
86 //_________________________________________________________________________
87 AliITSmodule::AliITSmodule(Int_t index) {
91 fHitsM = new TObjArray();
92 fTrackIndex = new TArrayI(16);
93 fHitIndex = new TArrayI(16);
94 fITS = (AliITS*)(gAlice->GetDetector("ITS"));
96 //__________________________________________________________________________
97 AliITSmodule::~AliITSmodule() {
98 // The destructor for AliITSmodule. Before destoring AliITSmodule
99 // we must first destroy all of it's members.
103 for(Int_t i=0;i<fHitsM->GetEntriesFast();i++)
104 delete ((AliITShit *)(fHitsM->At(i)));
105 // must delete each object in the TObjArray.
110 fITS = 0; // We don't delete this pointer since it is just a copy.
112 //____________________________________________________________________________
113 AliITSmodule::AliITSmodule(const AliITSmodule &source){
114 ////////////////////////////////////////////////////////////////////////
116 ////////////////////////////////////////////////////////////////////////
117 printf("AliITSmodule error: AliITSmodule class has not to be copied! Exit.\n");
121 //_____________________________________________________________________________
122 AliITSmodule& AliITSmodule::operator=(const AliITSmodule &source){
123 ////////////////////////////////////////////////////////////////////////
124 // Assignment operator
125 ////////////////////////////////////////////////////////////////////////
126 printf("AliITSmodule error: AliITSmodule class has not to be copied! Exit.\n");
128 return *this; // fake return neded on Sun
131 //_________________________________________________________________________
134 //__________________________________________________________________________
135 Int_t AliITSmodule::AddHit(AliITShit* hit,Int_t t,Int_t h) {
138 //printf("AddHit: beginning hit %p t h %d %d\n",hit,t,h);
139 fHitsM->AddLast(new AliITShit(*hit));
140 Int_t fNhitsM = fHitsM->GetEntriesFast();
141 if(fNhitsM-1>=fTrackIndex->GetSize()){ // need to expand the TArrayI
142 TArrayI *p = new TArrayI(fNhitsM+64);
143 for(Int_t i=0;i<fTrackIndex->GetSize();i++)
144 (*p)[i] = fTrackIndex->At(i);
148 if(fNhitsM-1>=fHitIndex->GetSize()){ // need to expand the TArrayI
149 TArrayI *p = new TArrayI(fNhitsM+64);
150 for(Int_t i=0;i<fHitIndex->GetSize();i++)
151 (*p)[i] = fHitIndex->At(i);
155 (*fTrackIndex)[fNhitsM-1] = t;
156 (*fHitIndex)[fNhitsM-1] = h;
160 //___________________________________________________________________________
161 void AliITSmodule::MedianHitG(Int_t index,
162 Float_t hitx1,Float_t hity1,Float_t hitz1,
163 Float_t hitx2,Float_t hity2,Float_t hitz2,
164 Float_t &xMg, Float_t &yMg, Float_t &zMg){
166 AliITSgeom *gm = fITS->GetITSgeom();
169 Float_t xMl,yMl=0,zMl;
188 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
189 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
199 //___________________________________________________________________________
200 Double_t AliITSmodule::PathLength(Int_t index,AliITShit *itsHit1,
207 itsHit1->GetPositionG(x1g,y1g,z1g);
208 itsHit2->GetPositionG(x2g,y2g,z2g);
210 s = TMath::Sqrt( ((Double_t)(x2g-x1g)*(Double_t)(x2g-x1g)) +
211 ((Double_t)(y2g-y1g)*(Double_t)(y2g-y1g)) +
212 ((Double_t)(z2g-z1g)*(Double_t)(z2g-z1g)) );
215 //___________________________________________________________________________
216 void AliITSmodule::PathLength(Int_t index,
217 Float_t x,Float_t y,Float_t z,
218 Int_t status,Int_t &nseg,
219 Float_t &x1,Float_t &y1,Float_t &z1,
220 Float_t &dx1,Float_t &dy1,Float_t &dz1,
223 static Float_t x0,y0,z0;
225 if (status == 66){ // entering
239 if (status == 68) flag = 0; //exiting
240 else flag = 2; //inside
246 //___________________________________________________________________________
247 Bool_t AliITSmodule::LineSegmentL(Int_t hitindex,Double_t &a,Double_t &b,
248 Double_t &c,Double_t &d,
249 Double_t &e,Double_t &f,Double_t &de){
251 static Int_t hitindex0;
254 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
256 h1 = (AliITShit *) (fHitsM->At(hitindex));
257 if(h1->StatusEntering()){ // if track entering volume, get index for next
259 hitindex0 = hitindex;
261 } // end if StatusEntering()
263 h0 = (AliITShit *) (fHitsM->At(hitindex0));
264 de = h1->GetIonization();
265 h0->GetPositionL(a,c,e);
266 h1->GetPositionL(b,d,f);
270 hitindex0 = hitindex;
273 //___________________________________________________________________________
274 Bool_t AliITSmodule::LineSegmentG(Int_t hitindex,Double_t &a,Double_t &b,
275 Double_t &c,Double_t &d,
276 Double_t &e,Double_t &f,Double_t &de){
278 static Int_t hitindex0;
281 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
283 h1 = (AliITShit *) (fHitsM->At(hitindex));
284 if(h1->StatusEntering()){ // if track entering volume, get index for next
286 hitindex0 = hitindex;
288 } // end if StatusEntering()
290 h0 = (AliITShit *) (fHitsM->At(hitindex0));
291 de = h1->GetIonization();
292 h0->GetPositionG(a,c,e);
293 h1->GetPositionG(b,d,f);
297 hitindex0 = hitindex;
300 //___________________________________________________________________________
301 Bool_t AliITSmodule::LineSegmentL(Int_t hitindex,Double_t &a,Double_t &b,
302 Double_t &c,Double_t &d,
303 Double_t &e,Double_t &f,
304 Double_t &de,Int_t &track){
306 static Int_t hitindex0;
309 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
311 h1 = (AliITShit *) (fHitsM->At(hitindex));
312 if(h1->StatusEntering()){ // if track entering volume, get index for next
314 hitindex0 = hitindex;
315 track = h1->GetTrack();
317 } // end if StatusEntering()
319 h0 = (AliITShit *) (fHitsM->At(hitindex0));
320 de = h1->GetIonization();
321 h0->GetPositionL(a,c,e);
322 h1->GetPositionL(b,d,f);
326 hitindex0 = hitindex;
327 track = h1->GetTrack();
330 //___________________________________________________________________________
331 Bool_t AliITSmodule::LineSegmentG(Int_t hitindex,Double_t &a,Double_t &b,
332 Double_t &c,Double_t &d,
333 Double_t &e,Double_t &f,
334 Double_t &de,Int_t &track){
336 static Int_t hitindex0;
339 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
341 h1 = (AliITShit *) (fHitsM->At(hitindex));
342 if(h1->StatusEntering()){ // if track entering volume, get index for next
344 hitindex0 = hitindex;
345 track = h1->GetTrack();
347 } // end if StatusEntering()
349 h0 = (AliITShit *) (fHitsM->At(hitindex0));
350 de = h1->GetIonization();
351 h0->GetPositionG(a,c,e);
352 h1->GetPositionG(b,d,f);
356 hitindex0 = hitindex;
357 track = h1->GetTrack();
360 //___________________________________________________________________________
361 void AliITSmodule::MedianHitL(Int_t index,
364 Float_t &xMl, Float_t &yMl, Float_t &zMl){
369 itsHit1->GetPositionL(x1l,y1l,z1l);
370 itsHit2->GetPositionL(x2l,y2l,z2l);
372 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
374 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
376 //___________________________________________________________________________
377 void AliITSmodule::MedianHit(Int_t index,
378 Float_t xg,Float_t yg,Float_t zg,
380 Float_t &xMg,Float_t &yMg,Float_t &zMg,
383 static Float_t x1,y1,z1;
385 if (status == 66){ // entering
391 if (status == 68){ // exiting
392 MedianHitG(index,x1,y1,z1,xg,yg,zg,xMg,yMg,zMg);
395 if ((status != 66) && (status != 68)) flag = 1;
397 //___________________________________________________________________________
398 void AliITSmodule::GetID(Int_t &lay,Int_t &lad,Int_t &det){
400 fITS->GetITSgeom()->GetModuleId(fIndex,lay,lad,det);