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.15 2003/03/21 13:58:14 masera
19 Fix to avoid out-of-detector fast rec points (problem occurring for tracks entering and exiting the same side of a sensitive volume)
21 Revision 1.14 2002/10/14 14:57:00 hristov
22 Merging the VirtualMC branch to the main development branch (HEAD)
24 Revision 1.10.4.2 2002/07/24 09:27:50 alibrary
27 Revision 1.13 2002/06/12 18:59:47 nilsen
28 Added Starting track location to hit class and related changes to modules.
29 This is at present still fully backwards compatible since starting hits
30 are still written to the file. When aliroot v4.0 will be released, this
31 backwards compatiblity will be broken by removing the enterence hit, and making
32 the nessesary changes to module at that time.
34 Revision 1.12 2002/06/10 17:31:03 nilsen
35 Replaced TArrayI expansion with Root version.
37 Revision 1.11 2002/06/04 18:43:15 nilsen
38 Fix to avoid divide by zero problem in MedianHitG and MedianHitL for track
39 that enter and exit the same side of a detector sensitive volume. Needed
40 for Fast simulation. Thanks to Nicola Carrer.
42 Revision 1.10 2002/03/15 17:21:54 nilsen
43 Removed zero-ing of fModules variable in constructors.
45 Revision 1.9 2000/10/04 19:46:39 barbera
46 Corrected by F. Carminati for v3.04
48 Revision 1.8 2000/10/02 16:32:57 barbera
49 Forward declarations added and formatting
51 Revision 1.3.4.8 2000/10/02 15:55:26 barbera
52 Forward declarations added and formatting
54 Revision 1.7 2000/09/22 12:36:38 nilsen
55 Minor changes to improve compilation and create less NOISE.
57 Revision 1.6 2000/07/10 16:07:18 fca
58 Release version of ITS code
60 Revision 1.3.4.2 2000/03/02 21:42:29 nilsen
61 Linked AliDetector::fDigit to AliITSmodule::fDigitsM and AliITS::fITSRecPoints
62 to AliITSmodule::fRecPointsM. Renamed AliITSmodule::fPointsM to fRecPointsM.
63 Removed the deletion of fDigitsM from the distructor since it is only a copy
64 of what is in AliDetector. Fixed a bug in the functions LineSegmentL and
65 LineSegmentG. Added two new versions of LineSegmentL and LineSegmentG to
66 additionaly return track number from the hit. Removed FastPoint function,
67 haven't found anywere it was used, also it had very many problems, should
68 just call FastPointSPD... .
70 Revision 1.3.4.1 2000/01/12 19:03:32 nilsen
71 This is the version of the files after the merging done in December 1999.
72 See the ReadMe110100.txt file for details
74 Revision 1.3 1999/10/04 15:20:12 fca
75 Correct syntax accepted by g++ but not standard for static members, remove minor warnings
77 Revision 1.2 1999/09/29 09:24:20 fca
78 Introduction of the Copyright and cvs Log
88 #include "AliITShit.h"
89 #include "AliITSmodule.h"
90 #include "AliITSgeom.h"
92 ClassImp(AliITSmodule)
94 //_______________________________________________________________________
96 // Impementation of class AliITSmodule
98 // created by: A. Bouchm, W. Peryt, S. Radomski, P. Skowronski
99 // R. Barbers, B. Batyunia, B. S. Nilsen
100 // ver 1.0 CERN 16.09.1999
101 //_______________________________________________________________________
102 //________________________________________________________________________
104 // Constructors and deconstructor
105 //________________________________________________________________________
107 AliITSmodule::AliITSmodule() {
116 //_________________________________________________________________________
117 AliITSmodule::AliITSmodule(Int_t index) {
121 fHitsM = new TObjArray();
122 fTrackIndex = new TArrayI(16);
123 fHitIndex = new TArrayI(16);
124 fITS = (AliITS*)(gAlice->GetDetector("ITS"));
126 //__________________________________________________________________________
127 AliITSmodule::~AliITSmodule() {
128 // The destructor for AliITSmodule. Before destoring AliITSmodule
129 // we must first destroy all of it's members.
138 fITS = 0; // We don't delete this pointer since it is just a copy.
140 //____________________________________________________________________________
141 AliITSmodule::AliITSmodule(const AliITSmodule &source){
142 ////////////////////////////////////////////////////////////////////////
144 ////////////////////////////////////////////////////////////////////////
145 printf("AliITSmodule error: AliITSmodule class has not to be copied! Exit.\n");
149 //_____________________________________________________________________________
150 AliITSmodule& AliITSmodule::operator=(const AliITSmodule &source){
151 ////////////////////////////////////////////////////////////////////////
152 // Assignment operator
153 ////////////////////////////////////////////////////////////////////////
154 printf("AliITSmodule error: AliITSmodule class has not to be copied! Exit.\n");
156 return *this; // fake return neded on Sun
159 //_________________________________________________________________________
162 //__________________________________________________________________________
163 Int_t AliITSmodule::AddHit(AliITShit* hit,Int_t t,Int_t h) {
166 //printf("AddHit: beginning hit %p t h %d %d\n",hit,t,h);
167 fHitsM->AddLast(new AliITShit(*hit));
168 Int_t fNhitsM = fHitsM->GetEntriesFast();
169 if(fNhitsM-1>=fTrackIndex->GetSize()){ // need to expand the TArrayI
170 fTrackIndex->Set(fNhitsM+64);
172 if(fNhitsM-1>=fHitIndex->GetSize()){ // need to expand the TArrayI
173 fHitIndex->Set(fNhitsM+64);
175 (*fTrackIndex)[fNhitsM-1] = t;
176 (*fHitIndex)[fNhitsM-1] = h;
179 //___________________________________________________________________________
180 Double_t AliITSmodule::PathLength(Int_t index,AliITShit *itsHit1,
187 itsHit1->GetPositionG(x1g,y1g,z1g);
188 itsHit2->GetPositionG(x2g,y2g,z2g);
190 s = TMath::Sqrt( ((Double_t)(x2g-x1g)*(Double_t)(x2g-x1g)) +
191 ((Double_t)(y2g-y1g)*(Double_t)(y2g-y1g)) +
192 ((Double_t)(z2g-z1g)*(Double_t)(z2g-z1g)) );
195 //___________________________________________________________________________
196 void AliITSmodule::PathLength(Int_t index,
197 Float_t x,Float_t y,Float_t z,
198 Int_t status,Int_t &nseg,
199 Float_t &x1,Float_t &y1,Float_t &z1,
200 Float_t &dx1,Float_t &dy1,Float_t &dz1,
203 static Float_t x0,y0,z0;
205 if ((status&0x0002)!=0){ // entering
219 if ((status&0x0004)!=0) flag = 0; //exiting
220 if ((status&0x0001)!=0) flag = 2; // inside
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 Bool_t AliITSmodule::MedianHitG(AliITShit *h1,AliITShit *h2,
343 Float_t &x,Float_t &y,Float_t &z){
344 // Computes the mean hit location for a set of hits that make up a track
345 // passing through a volume. Returns kFALSE untill the the track leaves
348 AliITSgeom *gm = fITS->GetITSgeom();
349 Float_t x1l=0.,y1l=0.,z1l=0.;
350 Float_t x2l=0.,y2l=0.,z2l=0.;
351 Float_t xMl,yMl=0,zMl;
354 h1->GetPositionG(x1l,y1l,z1l);
355 h2->GetPositionG(x2l,y2l,z2l);
358 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
359 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
368 gm->LtoG(h1->GetModule(),l,g);
374 //___________________________________________________________________________
375 void AliITSmodule::MedianHitG(Int_t index,
376 Float_t hitx1,Float_t hity1,Float_t hitz1,
377 Float_t hitx2,Float_t hity2,Float_t hitz2,
378 Float_t &xMg, Float_t &yMg, Float_t &zMg){
380 AliITSgeom *gm = fITS->GetITSgeom();
383 Float_t xMl,yMl=0,zMl;
403 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
404 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
418 //___________________________________________________________________________
419 Bool_t AliITSmodule::MedianHitL( AliITShit *itsHit1,
421 Float_t &xMl, Float_t &yMl, Float_t &zMl){
426 itsHit1->GetPositionL(x1l,y1l,z1l);
427 itsHit2->GetPositionL(x2l,y2l,z2l);
431 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
432 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
439 //___________________________________________________________________________
440 void AliITSmodule::MedianHit(Int_t index,
441 Float_t xg,Float_t yg,Float_t zg,
443 Float_t &xMg,Float_t &yMg,Float_t &zMg,
446 static Float_t x1,y1,z1;
448 if ((status&0x0002)!=0){ // entering
453 } else if ((status&0x0004)!=0){ // exiting
454 MedianHitG(index,x1,y1,z1,xg,yg,zg,xMg,yMg,zMg);
459 //___________________________________________________________________________
460 void AliITSmodule::GetID(Int_t &lay,Int_t &lad,Int_t &det){
462 fITS->GetITSgeom()->GetModuleId(fIndex,lay,lad,det);