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.9 2000/10/04 19:46:39 barbera
19 Corrected by F. Carminati for v3.04
21 Revision 1.8 2000/10/02 16:32:57 barbera
22 Forward declarations added and formatting
24 Revision 1.3.4.8 2000/10/02 15:55:26 barbera
25 Forward declarations added and formatting
27 Revision 1.7 2000/09/22 12:36:38 nilsen
28 Minor changes to improve compilation and create less NOISE.
30 Revision 1.6 2000/07/10 16:07:18 fca
31 Release version of ITS code
33 Revision 1.3.4.2 2000/03/02 21:42:29 nilsen
34 Linked AliDetector::fDigit to AliITSmodule::fDigitsM and AliITS::fITSRecPoints
35 to AliITSmodule::fRecPointsM. Renamed AliITSmodule::fPointsM to fRecPointsM.
36 Removed the deletion of fDigitsM from the distructor since it is only a copy
37 of what is in AliDetector. Fixed a bug in the functions LineSegmentL and
38 LineSegmentG. Added two new versions of LineSegmentL and LineSegmentG to
39 additionaly return track number from the hit. Removed FastPoint function,
40 haven't found anywere it was used, also it had very many problems, should
41 just call FastPointSPD... .
43 Revision 1.3.4.1 2000/01/12 19:03:32 nilsen
44 This is the version of the files after the merging done in December 1999.
45 See the ReadMe110100.txt file for details
47 Revision 1.3 1999/10/04 15:20:12 fca
48 Correct syntax accepted by g++ but not standard for static members, remove minor warnings
50 Revision 1.2 1999/09/29 09:24:20 fca
51 Introduction of the Copyright and cvs Log
61 #include "AliITShit.h"
62 #include "AliITSmodule.h"
63 #include "AliITSgeom.h"
65 ClassImp(AliITSmodule)
67 //_______________________________________________________________________
69 // Impementation of class AliITSmodule
71 // created by: A. Bouchm, W. Peryt, S. Radomski, P. Skowronski
72 // R. Barbers, B. Batyunia, B. S. Nilsen
73 // ver 1.0 CERN 16.09.1999
74 //_______________________________________________________________________
75 //________________________________________________________________________
77 // Constructors and deconstructor
78 //________________________________________________________________________
80 AliITSmodule::AliITSmodule() {
89 //_________________________________________________________________________
90 AliITSmodule::AliITSmodule(Int_t index) {
94 fHitsM = new TObjArray();
95 fTrackIndex = new TArrayI(16);
96 fHitIndex = new TArrayI(16);
97 fITS = (AliITS*)(gAlice->GetDetector("ITS"));
99 //__________________________________________________________________________
100 AliITSmodule::~AliITSmodule() {
101 // The destructor for AliITSmodule. Before destoring AliITSmodule
102 // we must first destroy all of it's members.
105 for(Int_t i=0;i<fHitsM->GetEntriesFast();i++)
106 delete ((AliITShit *)(fHitsM->At(i)));
107 // must delete each object in the TObjArray.
112 fITS = 0; // We don't delete this pointer since it is just a copy.
114 //____________________________________________________________________________
115 AliITSmodule::AliITSmodule(const AliITSmodule &source){
116 ////////////////////////////////////////////////////////////////////////
118 ////////////////////////////////////////////////////////////////////////
119 printf("AliITSmodule error: AliITSmodule class has not to be copied! Exit.\n");
123 //_____________________________________________________________________________
124 AliITSmodule& AliITSmodule::operator=(const AliITSmodule &source){
125 ////////////////////////////////////////////////////////////////////////
126 // Assignment operator
127 ////////////////////////////////////////////////////////////////////////
128 printf("AliITSmodule error: AliITSmodule class has not to be copied! Exit.\n");
130 return *this; // fake return neded on Sun
133 //_________________________________________________________________________
136 //__________________________________________________________________________
137 Int_t AliITSmodule::AddHit(AliITShit* hit,Int_t t,Int_t h) {
140 //printf("AddHit: beginning hit %p t h %d %d\n",hit,t,h);
141 fHitsM->AddLast(new AliITShit(*hit));
142 Int_t fNhitsM = fHitsM->GetEntriesFast();
143 if(fNhitsM-1>=fTrackIndex->GetSize()){ // need to expand the TArrayI
144 TArrayI *p = new TArrayI(fNhitsM+64);
145 for(Int_t i=0;i<fTrackIndex->GetSize();i++)
146 (*p)[i] = fTrackIndex->At(i);
150 if(fNhitsM-1>=fHitIndex->GetSize()){ // need to expand the TArrayI
151 TArrayI *p = new TArrayI(fNhitsM+64);
152 for(Int_t i=0;i<fHitIndex->GetSize();i++)
153 (*p)[i] = fHitIndex->At(i);
157 (*fTrackIndex)[fNhitsM-1] = t;
158 (*fHitIndex)[fNhitsM-1] = h;
162 //___________________________________________________________________________
163 void AliITSmodule::MedianHitG(Int_t index,
164 Float_t hitx1,Float_t hity1,Float_t hitz1,
165 Float_t hitx2,Float_t hity2,Float_t hitz2,
166 Float_t &xMg, Float_t &yMg, Float_t &zMg){
168 AliITSgeom *gm = fITS->GetITSgeom();
171 Float_t xMl,yMl=0,zMl;
190 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
191 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
201 //___________________________________________________________________________
202 Double_t AliITSmodule::PathLength(Int_t index,AliITShit *itsHit1,
209 itsHit1->GetPositionG(x1g,y1g,z1g);
210 itsHit2->GetPositionG(x2g,y2g,z2g);
212 s = TMath::Sqrt( ((Double_t)(x2g-x1g)*(Double_t)(x2g-x1g)) +
213 ((Double_t)(y2g-y1g)*(Double_t)(y2g-y1g)) +
214 ((Double_t)(z2g-z1g)*(Double_t)(z2g-z1g)) );
217 //___________________________________________________________________________
218 void AliITSmodule::PathLength(Int_t index,
219 Float_t x,Float_t y,Float_t z,
220 Int_t status,Int_t &nseg,
221 Float_t &x1,Float_t &y1,Float_t &z1,
222 Float_t &dx1,Float_t &dy1,Float_t &dz1,
225 static Float_t x0,y0,z0;
227 if (status == 66){ // entering
241 if (status == 68) flag = 0; //exiting
242 else flag = 2; //inside
248 //___________________________________________________________________________
249 Bool_t AliITSmodule::LineSegmentL(Int_t hitindex,Double_t &a,Double_t &b,
250 Double_t &c,Double_t &d,
251 Double_t &e,Double_t &f,Double_t &de){
253 static Int_t hitindex0;
256 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
258 h1 = (AliITShit *) (fHitsM->At(hitindex));
259 if(h1->StatusEntering()){ // if track entering volume, get index for next
261 hitindex0 = hitindex;
263 } // end if StatusEntering()
265 h0 = (AliITShit *) (fHitsM->At(hitindex0));
266 de = h1->GetIonization();
267 h0->GetPositionL(a,c,e);
268 h1->GetPositionL(b,d,f);
272 hitindex0 = hitindex;
275 //___________________________________________________________________________
276 Bool_t AliITSmodule::LineSegmentG(Int_t hitindex,Double_t &a,Double_t &b,
277 Double_t &c,Double_t &d,
278 Double_t &e,Double_t &f,Double_t &de){
280 static Int_t hitindex0;
283 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
285 h1 = (AliITShit *) (fHitsM->At(hitindex));
286 if(h1->StatusEntering()){ // if track entering volume, get index for next
288 hitindex0 = hitindex;
290 } // end if StatusEntering()
292 h0 = (AliITShit *) (fHitsM->At(hitindex0));
293 de = h1->GetIonization();
294 h0->GetPositionG(a,c,e);
295 h1->GetPositionG(b,d,f);
299 hitindex0 = hitindex;
302 //___________________________________________________________________________
303 Bool_t AliITSmodule::LineSegmentL(Int_t hitindex,Double_t &a,Double_t &b,
304 Double_t &c,Double_t &d,
305 Double_t &e,Double_t &f,
306 Double_t &de,Int_t &track){
308 static Int_t hitindex0;
311 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
313 h1 = (AliITShit *) (fHitsM->At(hitindex));
314 if(h1->StatusEntering()){ // if track entering volume, get index for next
316 hitindex0 = hitindex;
317 track = h1->GetTrack();
319 } // end if StatusEntering()
321 h0 = (AliITShit *) (fHitsM->At(hitindex0));
322 de = h1->GetIonization();
323 h0->GetPositionL(a,c,e);
324 h1->GetPositionL(b,d,f);
328 hitindex0 = hitindex;
329 track = h1->GetTrack();
332 //___________________________________________________________________________
333 Bool_t AliITSmodule::LineSegmentG(Int_t hitindex,Double_t &a,Double_t &b,
334 Double_t &c,Double_t &d,
335 Double_t &e,Double_t &f,
336 Double_t &de,Int_t &track){
338 static Int_t hitindex0;
341 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
343 h1 = (AliITShit *) (fHitsM->At(hitindex));
344 if(h1->StatusEntering()){ // if track entering volume, get index for next
346 hitindex0 = hitindex;
347 track = h1->GetTrack();
349 } // end if StatusEntering()
351 h0 = (AliITShit *) (fHitsM->At(hitindex0));
352 de = h1->GetIonization();
353 h0->GetPositionG(a,c,e);
354 h1->GetPositionG(b,d,f);
358 hitindex0 = hitindex;
359 track = h1->GetTrack();
362 //___________________________________________________________________________
363 void AliITSmodule::MedianHitL(Int_t index,
366 Float_t &xMl, Float_t &yMl, Float_t &zMl){
371 itsHit1->GetPositionL(x1l,y1l,z1l);
372 itsHit2->GetPositionL(x2l,y2l,z2l);
374 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
376 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
378 //___________________________________________________________________________
379 void AliITSmodule::MedianHit(Int_t index,
380 Float_t xg,Float_t yg,Float_t zg,
382 Float_t &xMg,Float_t &yMg,Float_t &zMg,
385 static Float_t x1,y1,z1;
387 if (status == 66){ // entering
393 if (status == 68){ // exiting
394 MedianHitG(index,x1,y1,z1,xg,yg,zg,xMg,yMg,zMg);
397 if ((status != 66) && (status != 68)) flag = 1;
399 //___________________________________________________________________________
400 void AliITSmodule::GetID(Int_t &lay,Int_t &lad,Int_t &det){
402 fITS->GetITSgeom()->GetModuleId(fIndex,lay,lad,det);