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"
27 ClassImp(AliITSUModule)
29 //_______________________________________________________________________
31 // Impementation of class AliITSUModule
33 // created by: A. Bouchm, W. Peryt, S. Radomski, P. Skowronski
34 // R. Barbers, B. Batyunia, B. S. Nilsen
35 // ver 1.0 CERN 16.09.1999
36 //_______________________________________________________________________
37 //________________________________________________________________________
39 // Constructors and deconstructor
40 //________________________________________________________________________
42 AliITSUModule::AliITSUModule()
49 //_________________________________________________________________________
50 AliITSUModule::AliITSUModule(Int_t index, AliITSUGeomTGeo* tg)
51 :fHitsM(new TObjArray())
58 //__________________________________________________________________________
59 AliITSUModule::~AliITSUModule()
61 // The destructor for AliITSUModule. Before destoring AliITSUModule
62 // we must first destroy all of it's members.
63 if (fHitsM) fHitsM->Clear();
67 //____________________________________________________________________________
68 AliITSUModule::AliITSUModule(const AliITSUModule &source)
70 ,fHitsM(source.fHitsM)
71 ,fGeomTG(source.fGeomTG)
76 //_____________________________________________________________________________
77 AliITSUModule& AliITSUModule::operator=(const AliITSUModule &source)
79 // Assignment operator
81 this->~AliITSUModule();
82 new(this) AliITSUModule(source);
87 //___________________________________________________________________________
88 Double_t AliITSUModule::PathLength(const AliITSUHit *itsHit1,const AliITSUHit *itsHit2)
95 itsHit1->GetPositionG(x1g,y1g,z1g);
96 itsHit2->GetPositionG(x2g,y2g,z2g);
98 s = TMath::Sqrt( ((Double_t)(x2g-x1g)*(Double_t)(x2g-x1g)) +
99 ((Double_t)(y2g-y1g)*(Double_t)(y2g-y1g)) +
100 ((Double_t)(z2g-z1g)*(Double_t)(z2g-z1g)) );
104 //___________________________________________________________________________
105 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,
106 Float_t &dx1,Float_t &dy1,Float_t &dz1,Int_t &flag) const
109 static Float_t x0,y0,z0;
111 if ((status&0x0002)!=0){ // entering
125 if ((status&0x0004)!=0) flag = 0; //exiting
126 if ((status&0x0001)!=0) flag = 2; // inside
127 else flag = 2; //inside ?
134 //___________________________________________________________________________
135 Bool_t AliITSUModule::LineSegmentL(Int_t hitindex,Double_t &a,Double_t &b,Double_t &c,Double_t &d,
136 Double_t &e,Double_t &f,Double_t &de)
142 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
144 h1 = (AliITSUHit *) (fHitsM->At(hitindex));
145 if(h1->StatusEntering()) return kFALSE; // if track entering volume, get index for next step
146 de = h1->GetIonization();
147 h1->GetPositionL0(a,c,e,t);
148 h1->GetPositionL(b,d,f);
155 //___________________________________________________________________________
156 Bool_t AliITSUModule::LineSegmentG(Int_t hitindex,Double_t &a,Double_t &b,Double_t &c,Double_t &d,
157 Double_t &e,Double_t &f,Double_t &de)
163 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
164 h1 = (AliITSUHit *) (fHitsM->At(hitindex));
165 if(h1->StatusEntering()) return kFALSE; // if track entering volume, get index for next step
166 de = h1->GetIonization();
167 h1->GetPositionG0(a,c,e,t);
168 h1->GetPositionG(b,d,f);
175 //___________________________________________________________________________
176 Bool_t AliITSUModule::LineSegmentL(Int_t hitindex,Double_t &a,Double_t &b,Double_t &c,Double_t &d,
177 Double_t &e,Double_t &f,Double_t &de,Int_t &track)
183 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
185 h1 = (AliITSUHit *) (fHitsM->At(hitindex));
186 if(h1->StatusEntering()){ // if track entering volume, get index for next
188 track = h1->GetTrack();
190 } // end if StatusEntering()
192 de = h1->GetIonization();
193 h1->GetPositionL0(a,c,e,t);
194 h1->GetPositionL(b,d,f);
198 track = h1->GetTrack();
202 //___________________________________________________________________________
203 Bool_t AliITSUModule::LineSegmentG(Int_t hitindex,Double_t &a,Double_t &b,Double_t &c,Double_t &d,
204 Double_t &e,Double_t &f,Double_t &de,Int_t &track)
210 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
212 h1 = (AliITSUHit *) (fHitsM->At(hitindex));
213 if(h1->StatusEntering()){ // if track entering volume, get index for next
215 track = h1->GetTrack();
217 } // end if StatusEntering()
218 de = h1->GetIonization();
219 h1->GetPositionG0(a,c,e,t);
220 h1->GetPositionG(b,d,f);
224 track = h1->GetTrack();
228 //______________________________________________________________________
229 Bool_t AliITSUModule::MedianHitG(AliITSUHit *h1,AliITSUHit *h2,Float_t &x,Float_t &y,Float_t &z)
231 // Computes the mean hit location for a set of hits that make up a track
232 // passing through a volume. Returns kFALSE untill the the track leaves
235 Float_t x1l=0.,y1l=0.,z1l=0.;
236 Float_t x2l=0.,y2l=0.,z2l=0.;
237 Float_t xMl,yMl=0,zMl;
240 h1->GetPositionG(x1l,y1l,z1l);
241 h2->GetPositionG(x2l,y2l,z2l);
244 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
245 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
254 fGeomTG->LocalToGlobal(h1->GetModule(),l,g);
261 //___________________________________________________________________________
262 void AliITSUModule::MedianHitG(Int_t index,Float_t hitx1,Float_t hity1,Float_t hitz1,Float_t hitx2,Float_t hity2,Float_t hitz2,
263 Float_t &xMg, Float_t &yMg, Float_t &zMg)
268 Float_t xMl,yMl=0,zMl;
274 fGeomTG->GlobalToLocal(index,g,l);
282 fGeomTG->GlobalToLocal(index,g,l);
288 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
289 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
298 fGeomTG->LocalToGlobal(index,l,g);
304 //___________________________________________________________________________
305 Bool_t AliITSUModule::MedianHitL( AliITSUHit *itsHit1,AliITSUHit *itsHit2, Float_t &xMl, Float_t &yMl, Float_t &zMl) const
311 itsHit1->GetPositionL(x1l,y1l,z1l);
312 itsHit2->GetPositionL(x2l,y2l,z2l);
316 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
317 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
325 //___________________________________________________________________________
326 void AliITSUModule::MedianHit(Int_t index,Float_t xg,Float_t yg,Float_t zg,Int_t status,
327 Float_t &xMg,Float_t &yMg,Float_t &zMg,Int_t &flag)
330 static Float_t x1,y1,z1;
332 if ((status&0x0002)!=0){ // entering
337 } else if ((status&0x0004)!=0){ // exiting
338 MedianHitG(index,x1,y1,z1,xg,yg,zg,xMg,yMg,zMg);