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.4 2000/06/12 18:10:32 barbera
19 fixed posible compilation errors on HP unix
21 Revision 1.3.4.3 2000/06/11 20:34:20 barbera
22 Update class for the new structures.
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... .
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
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
41 Revision 1.2 1999/09/29 09:24:20 fca
42 Introduction of the Copyright and cvs Log
46 #include "AliITSmodule.h"
50 #include "AliITShit.h"
52 ClassImp(AliITSmodule)
54 //_______________________________________________________________________
56 // Impementation of class AliITSmodule
58 // created by: A. Bouchm, W. Peryt, S. Radomski, P. Skowronski
59 // R. Barbers, B. Batyunia, B. S. Nilsen
60 // ver 1.0 CERN 16.09.1999
61 //_______________________________________________________________________
62 //________________________________________________________________________
64 // Constructors and deconstructor
65 //________________________________________________________________________
67 AliITSmodule::AliITSmodule() {
76 //_________________________________________________________________________
77 AliITSmodule::AliITSmodule(Int_t index) {
81 fHitsM = new TObjArray();
82 fTrackIndex = new TArrayI(16);
83 fHitIndex = new TArrayI(16);
84 fITS = (AliITS*)(gAlice->GetDetector("ITS"));
86 //__________________________________________________________________________
87 AliITSmodule::~AliITSmodule() {
88 // The destructor for AliITSmodule. Before destoring AliITSmodule
89 // we must first destroy all of it's members.
94 for(i=0;i<fHitsM->GetEntriesFast();i++)
95 delete ((AliITShit *)(fHitsM->At(i)));
96 // must delete each object in the TObjArray.
101 fITS = 0; // We don't delete this pointer since it is just a copy.
103 //____________________________________________________________________________
104 AliITSmodule::AliITSmodule(const AliITSmodule &source){
105 ////////////////////////////////////////////////////////////////////////
107 ////////////////////////////////////////////////////////////////////////
108 printf("AliITSmodule error: AliITSmodule class has not to be copied! Exit.\n");
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");
121 //_________________________________________________________________________
124 //__________________________________________________________________________
125 Int_t AliITSmodule::AddHit(AliITShit* hit,Int_t t,Int_t h) {
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);
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);
145 (*fTrackIndex)[fNhitsM-1] = t;
146 (*fHitIndex)[fNhitsM-1] = h;
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){
156 AliITSgeom *gm = fITS->GetITSgeom();
159 Float_t xMl,yMl=0,zMl;
178 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
179 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
189 //___________________________________________________________________________
190 Double_t AliITSmodule::PathLength(Int_t index,AliITShit *itsHit1,
197 itsHit1->GetPositionG(x1g,y1g,z1g);
198 itsHit2->GetPositionG(x2g,y2g,z2g);
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)) );
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,
213 static Float_t x0,y0,z0;
215 if (status == 66){ // entering
229 if (status == 68) flag = 0; //exiting
230 else flag = 2; //inside
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){
241 static Int_t hitindex0;
244 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
246 h1 = (AliITShit *) (fHitsM->At(hitindex));
247 if(h1->StatusEntering()){ // if track entering volume, get index for next
249 hitindex0 = hitindex;
251 } // end if StatusEntering()
253 h0 = (AliITShit *) (fHitsM->At(hitindex0));
254 de = h1->GetIonization();
255 h0->GetPositionL(a,c,e);
256 h1->GetPositionL(b,d,f);
260 hitindex0 = hitindex;
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){
268 static Int_t hitindex0;
271 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
273 h1 = (AliITShit *) (fHitsM->At(hitindex));
274 if(h1->StatusEntering()){ // if track entering volume, get index for next
276 hitindex0 = hitindex;
278 } // end if StatusEntering()
280 h0 = (AliITShit *) (fHitsM->At(hitindex0));
281 de = h1->GetIonization();
282 h0->GetPositionG(a,c,e);
283 h1->GetPositionG(b,d,f);
287 hitindex0 = hitindex;
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){
296 static Int_t hitindex0;
299 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
301 h1 = (AliITShit *) (fHitsM->At(hitindex));
302 if(h1->StatusEntering()){ // if track entering volume, get index for next
304 hitindex0 = hitindex;
305 track = h1->GetTrack();
307 } // end if StatusEntering()
309 h0 = (AliITShit *) (fHitsM->At(hitindex0));
310 de = h1->GetIonization();
311 h0->GetPositionL(a,c,e);
312 h1->GetPositionL(b,d,f);
316 hitindex0 = hitindex;
317 track = h1->GetTrack();
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){
326 static Int_t hitindex0;
329 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
331 h1 = (AliITShit *) (fHitsM->At(hitindex));
332 if(h1->StatusEntering()){ // if track entering volume, get index for next
334 hitindex0 = hitindex;
335 track = h1->GetTrack();
337 } // end if StatusEntering()
339 h0 = (AliITShit *) (fHitsM->At(hitindex0));
340 de = h1->GetIonization();
341 h0->GetPositionG(a,c,e);
342 h1->GetPositionG(b,d,f);
346 hitindex0 = hitindex;
347 track = h1->GetTrack();
350 //___________________________________________________________________________
351 void AliITSmodule::MedianHitL(Int_t index,
354 Float_t &xMl, Float_t &yMl, Float_t &zMl){
359 itsHit1->GetPositionL(x1l,y1l,z1l);
360 itsHit2->GetPositionL(x2l,y2l,z2l);
362 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
364 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
366 //___________________________________________________________________________
367 void AliITSmodule::MedianHit(Int_t index,
368 Float_t xg,Float_t yg,Float_t zg,
370 Float_t &xMg,Float_t &yMg,Float_t &zMg,
373 static Float_t x1,y1,z1;
375 if (status == 66){ // entering
381 if (status == 68){ // exiting
382 MedianHitG(index,x1,y1,z1,xg,yg,zg,xMg,yMg,zMg);
385 if ((status != 66) && (status != 68)) flag = 1;
387 //___________________________________________________________________________
388 void AliITSmodule::GetID(Int_t &lay,Int_t &lad,Int_t &det){
390 fITS->GetITSgeom()->GetModuleId(fIndex,lay,lad,det);