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 **************************************************************************/
16 /* $Id: AliITSUModule.cxx 53509 2011-12-10 18:55:52Z masera $ */
24 #include "AliITSUModule.h"
25 #include "AliITSUGeomTGeo.h"
26 using namespace TMath;
28 ClassImp(AliITSUModule)
30 //_______________________________________________________________________
32 // Impementation of class AliITSUModule
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 AliITSUModule::AliITSUModule()
50 //_________________________________________________________________________
51 AliITSUModule::AliITSUModule(Int_t index, AliITSUGeomTGeo* tg)
52 :fHitsM(new TObjArray())
59 //__________________________________________________________________________
60 AliITSUModule::~AliITSUModule()
62 // The destructor for AliITSUModule. Before destoring AliITSUModule
63 // we must first destroy all of it's members.
64 if (fHitsM) fHitsM->Clear();
68 //____________________________________________________________________________
69 AliITSUModule::AliITSUModule(const AliITSUModule &source)
71 ,fHitsM(source.fHitsM)
72 ,fGeomTG(source.fGeomTG)
77 //_____________________________________________________________________________
78 AliITSUModule& AliITSUModule::operator=(const AliITSUModule &source)
80 // Assignment operator
82 this->~AliITSUModule();
83 new(this) AliITSUModule(source);
88 //___________________________________________________________________________
89 Double_t AliITSUModule::PathLength(const AliITSUHit *itsHit1,const AliITSUHit *itsHit2)
96 itsHit1->GetPositionG(x1g,y1g,z1g);
97 itsHit2->GetPositionG(x2g,y2g,z2g);
99 s = Sqrt( ((Double_t)(x2g-x1g)*(Double_t)(x2g-x1g)) +
100 ((Double_t)(y2g-y1g)*(Double_t)(y2g-y1g)) +
101 ((Double_t)(z2g-z1g)*(Double_t)(z2g-z1g)) );
105 //___________________________________________________________________________
106 void AliITSUModule::PathLength(Float_t x,Float_t y,Float_t z,Int_t status,Int_t &nseg,Float_t &x1,Float_t &y1,Float_t &z1,
107 Float_t &dx1,Float_t &dy1,Float_t &dz1,Int_t &flag) const
110 static Float_t x0,y0,z0;
112 if ((status&0x0002)!=0){ // entering
126 if ((status&0x0004)!=0) flag = 0; //exiting
127 if ((status&0x0001)!=0) flag = 2; // inside
128 else flag = 2; //inside ?
135 //___________________________________________________________________________
136 Bool_t AliITSUModule::LineSegmentL(Int_t hitindex,Double_t &a,Double_t &b,Double_t &c,Double_t &d,
137 Double_t &e,Double_t &f,Double_t &de)
143 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
145 h1 = (AliITSUHit *) (fHitsM->At(hitindex));
146 if(h1->StatusEntering()) return kFALSE; // if track entering volume, get index for next step
147 de = h1->GetIonization();
148 h1->GetPositionL0(a,c,e,t);
149 h1->GetPositionL(b,d,f);
156 //___________________________________________________________________________
157 Bool_t AliITSUModule::LineSegmentG(Int_t hitindex,Double_t &a,Double_t &b,Double_t &c,Double_t &d,
158 Double_t &e,Double_t &f,Double_t &de)
164 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
165 h1 = (AliITSUHit *) (fHitsM->At(hitindex));
166 if(h1->StatusEntering()) return kFALSE; // if track entering volume, get index for next step
167 de = h1->GetIonization();
168 h1->GetPositionG0(a,c,e,t);
169 h1->GetPositionG(b,d,f);
176 //___________________________________________________________________________
177 Bool_t AliITSUModule::LineSegmentL(Int_t hitindex,Double_t &a,Double_t &b,Double_t &c,Double_t &d,
178 Double_t &e,Double_t &f,Double_t &de,Double_t &tof, Int_t &track)
182 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
184 h1 = (AliITSUHit *) (fHitsM->At(hitindex));
185 if(h1->StatusEntering()){ // if track entering volume, get index for next
187 track = h1->GetTrack();
189 } // end if StatusEntering()
191 de = h1->GetIonization();
192 h1->GetPositionL0(a,c,e,tof);
193 h1->GetPositionL(b,d,f);
197 track = h1->GetTrack();
201 //___________________________________________________________________________
202 Bool_t AliITSUModule::LineSegmentG(Int_t hitindex,Double_t &a,Double_t &b,Double_t &c,Double_t &d,
203 Double_t &e,Double_t &f,Double_t &de,Double_t &tof, Int_t &track)
207 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
209 h1 = (AliITSUHit *) (fHitsM->At(hitindex));
210 if(h1->StatusEntering()){ // if track entering volume, get index for next
212 track = h1->GetTrack();
214 } // end if StatusEntering()
215 de = h1->GetIonization();
216 h1->GetPositionG0(a,c,e,tof);
217 h1->GetPositionG(b,d,f);
221 track = h1->GetTrack();
225 //______________________________________________________________________
226 Bool_t AliITSUModule::MedianHitG(AliITSUHit *h1,AliITSUHit *h2,Float_t &x,Float_t &y,Float_t &z)
228 // Computes the mean hit location for a set of hits that make up a track
229 // passing through a volume. Returns kFALSE untill the the track leaves
232 Float_t x1l=0.,y1l=0.,z1l=0.;
233 Float_t x2l=0.,y2l=0.,z2l=0.;
234 Float_t xMl,yMl=0,zMl;
237 h1->GetPositionG(x1l,y1l,z1l);
238 h2->GetPositionG(x2l,y2l,z2l);
241 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
242 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
251 fGeomTG->LocalToGlobal(h1->GetModule(),l,g);
258 //___________________________________________________________________________
259 void AliITSUModule::MedianHitG(Int_t index,Float_t hitx1,Float_t hity1,Float_t hitz1,Float_t hitx2,Float_t hity2,Float_t hitz2,
260 Float_t &xMg, Float_t &yMg, Float_t &zMg)
265 Float_t xMl,yMl=0,zMl;
271 fGeomTG->GlobalToLocal(index,g,l);
279 fGeomTG->GlobalToLocal(index,g,l);
285 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
286 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
295 fGeomTG->LocalToGlobal(index,l,g);
301 //___________________________________________________________________________
302 Bool_t AliITSUModule::MedianHitL( AliITSUHit *itsHit1,AliITSUHit *itsHit2, Float_t &xMl, Float_t &yMl, Float_t &zMl) const
308 itsHit1->GetPositionL(x1l,y1l,z1l);
309 itsHit2->GetPositionL(x2l,y2l,z2l);
313 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
314 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
322 //___________________________________________________________________________
323 void AliITSUModule::MedianHit(Int_t index,Float_t xg,Float_t yg,Float_t zg,Int_t status,
324 Float_t &xMg,Float_t &yMg,Float_t &zMg,Int_t &flag)
327 static Float_t x1,y1,z1;
329 if ((status&0x0002)!=0){ // entering
334 } else if ((status&0x0004)!=0){ // exiting
335 MedianHitG(index,x1,y1,z1,xg,yg,zg,xMg,yMg,zMg);