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 **************************************************************************/
24 #include "AliITShit.h"
25 #include "AliITSmodule.h"
26 #include "AliITSgeom.h"
28 ClassImp(AliITSmodule)
30 //_______________________________________________________________________
32 // Impementation of class AliITSmodule
34 // created by: A. Bouchm, W. Peryt, S. Radomski, P. Skowronski
35 // R. Barbers, B. Batyunia, B. S. Nilsen
36 // ver 1.0 CERN 16.09.1999
37 //_______________________________________________________________________
38 //________________________________________________________________________
40 // Constructors and deconstructor
41 //________________________________________________________________________
43 AliITSmodule::AliITSmodule():
52 //_________________________________________________________________________
53 AliITSmodule::AliITSmodule(Int_t index):
61 fHitsM = new TObjArray();
62 fTrackIndex = new TArrayI(16);
63 fHitIndex = new TArrayI(16);
64 fITS = (AliITS*)(gAlice->GetDetector("ITS"));
66 //__________________________________________________________________________
67 AliITSmodule::~AliITSmodule() {
68 // The destructor for AliITSmodule. Before destoring AliITSmodule
69 // we must first destroy all of it's members.
78 fITS = 0; // We don't delete this pointer since it is just a copy.
80 //____________________________________________________________________________
81 AliITSmodule::AliITSmodule(const AliITSmodule &source):TObject(source),
83 fIndex(source.fIndex),
84 fHitsM(source.fHitsM),
85 fTrackIndex(source.fTrackIndex),
86 fHitIndex(source.fHitIndex){
87 ////////////////////////////////////////////////////////////////////////
89 ////////////////////////////////////////////////////////////////////////
92 //_____________________________________________________________________________
93 AliITSmodule& AliITSmodule::operator=(const AliITSmodule &source){
94 ////////////////////////////////////////////////////////////////////////
95 // Assignment operator
96 ////////////////////////////////////////////////////////////////////////
97 this->~AliITSmodule();
98 new(this) AliITSmodule(source);
101 //_________________________________________________________________________
104 //__________________________________________________________________________
105 Int_t AliITSmodule::AddHit(AliITShit* hit,Int_t t,Int_t h) {
108 //printf("AddHit: beginning hit %p t h %d %d\n",hit,t,h);
109 fHitsM->AddLast(new AliITShit(*hit));
110 Int_t fNhitsM = fHitsM->GetEntriesFast();
111 if(fNhitsM-1>=fTrackIndex->GetSize()){ // need to expand the TArrayI
112 fTrackIndex->Set(fNhitsM+64);
114 if(fNhitsM-1>=fHitIndex->GetSize()){ // need to expand the TArrayI
115 fHitIndex->Set(fNhitsM+64);
117 (*fTrackIndex)[fNhitsM-1] = t;
118 (*fHitIndex)[fNhitsM-1] = h;
121 //___________________________________________________________________________
122 Double_t AliITSmodule::PathLength(Int_t index,AliITShit *itsHit1,
123 AliITShit *itsHit2) {
130 itsHit1->GetPositionG(x1g,y1g,z1g);
131 itsHit2->GetPositionG(x2g,y2g,z2g);
133 s = TMath::Sqrt( ((Double_t)(x2g-x1g)*(Double_t)(x2g-x1g)) +
134 ((Double_t)(y2g-y1g)*(Double_t)(y2g-y1g)) +
135 ((Double_t)(z2g-z1g)*(Double_t)(z2g-z1g)) );
138 //___________________________________________________________________________
139 void AliITSmodule::PathLength(Int_t index,
140 Float_t x,Float_t y,Float_t z,
141 Int_t status,Int_t &nseg,
142 Float_t &x1,Float_t &y1,Float_t &z1,
143 Float_t &dx1,Float_t &dy1,Float_t &dz1,
146 static Float_t x0,y0,z0;
149 if ((status&0x0002)!=0){ // entering
163 if ((status&0x0004)!=0) flag = 0; //exiting
164 if ((status&0x0001)!=0) flag = 2; // inside
165 else flag = 2; //inside ?
171 //___________________________________________________________________________
172 Bool_t AliITSmodule::LineSegmentL(Int_t hitindex,Double_t &a,Double_t &b,
173 Double_t &c,Double_t &d,
174 Double_t &e,Double_t &f,Double_t &de){
179 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
181 h1 = (AliITShit *) (fHitsM->At(hitindex));
182 if(h1->StatusEntering()){ // if track entering volume, get index for next
185 } // end if StatusEntering()
187 de = h1->GetIonization();
188 h1->GetPositionL0(a,c,e,t);
189 h1->GetPositionL(b,d,f);
195 //___________________________________________________________________________
196 Bool_t AliITSmodule::LineSegmentG(Int_t hitindex,Double_t &a,Double_t &b,
197 Double_t &c,Double_t &d,
198 Double_t &e,Double_t &f,Double_t &de){
203 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
205 h1 = (AliITShit *) (fHitsM->At(hitindex));
206 if(h1->StatusEntering()){ // if track entering volume, get index for next
209 } // end if StatusEntering()
211 de = h1->GetIonization();
212 h1->GetPositionG0(a,c,e,t);
213 h1->GetPositionG(b,d,f);
219 //___________________________________________________________________________
220 Bool_t AliITSmodule::LineSegmentL(Int_t hitindex,Double_t &a,Double_t &b,
221 Double_t &c,Double_t &d,
222 Double_t &e,Double_t &f,
223 Double_t &de,Int_t &track){
228 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
230 h1 = (AliITShit *) (fHitsM->At(hitindex));
231 if(h1->StatusEntering()){ // if track entering volume, get index for next
233 track = h1->GetTrack();
235 } // end if StatusEntering()
237 de = h1->GetIonization();
238 h1->GetPositionL0(a,c,e,t);
239 h1->GetPositionL(b,d,f);
243 track = h1->GetTrack();
246 //___________________________________________________________________________
247 Bool_t AliITSmodule::LineSegmentG(Int_t hitindex,Double_t &a,Double_t &b,
248 Double_t &c,Double_t &d,
249 Double_t &e,Double_t &f,
250 Double_t &de,Int_t &track){
255 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
257 h1 = (AliITShit *) (fHitsM->At(hitindex));
258 if(h1->StatusEntering()){ // if track entering volume, get index for next
260 track = h1->GetTrack();
262 } // end if StatusEntering()
264 de = h1->GetIonization();
265 h1->GetPositionG0(a,c,e,t);
266 h1->GetPositionG(b,d,f);
270 track = h1->GetTrack();
273 //______________________________________________________________________
274 Bool_t AliITSmodule::MedianHitG(AliITShit *h1,AliITShit *h2,
275 Float_t &x,Float_t &y,Float_t &z){
276 // Computes the mean hit location for a set of hits that make up a track
277 // passing through a volume. Returns kFALSE untill the the track leaves
280 AliITSgeom *gm = fITS->GetITSgeom();
281 Float_t x1l=0.,y1l=0.,z1l=0.;
282 Float_t x2l=0.,y2l=0.,z2l=0.;
283 Float_t xMl,yMl=0,zMl;
286 h1->GetPositionG(x1l,y1l,z1l);
287 h2->GetPositionG(x2l,y2l,z2l);
290 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
291 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
300 gm->LtoG(h1->GetModule(),l,g);
306 //___________________________________________________________________________
307 void AliITSmodule::MedianHitG(Int_t index,
308 Float_t hitx1,Float_t hity1,Float_t hitz1,
309 Float_t hitx2,Float_t hity2,Float_t hitz2,
310 Float_t &xMg, Float_t &yMg, Float_t &zMg){
312 AliITSgeom *gm = fITS->GetITSgeom();
315 Float_t xMl,yMl=0,zMl;
335 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
336 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
350 //___________________________________________________________________________
351 Bool_t AliITSmodule::MedianHitL( AliITShit *itsHit1,
353 Float_t &xMl, Float_t &yMl, Float_t &zMl) const{
358 itsHit1->GetPositionL(x1l,y1l,z1l);
359 itsHit2->GetPositionL(x2l,y2l,z2l);
363 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
364 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
371 //___________________________________________________________________________
372 void AliITSmodule::MedianHit(Int_t index,
373 Float_t xg,Float_t yg,Float_t zg,
375 Float_t &xMg,Float_t &yMg,Float_t &zMg,
378 static Float_t x1,y1,z1;
380 if ((status&0x0002)!=0){ // entering
385 } else if ((status&0x0004)!=0){ // exiting
386 MedianHitG(index,x1,y1,z1,xg,yg,zg,xMg,yMg,zMg);
391 //___________________________________________________________________________
392 void AliITSmodule::GetID(Int_t &lay,Int_t &lad,Int_t &det){
394 fITS->GetITSgeom()->GetModuleId(fIndex,lay,lad,det);