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) {
57 fHitsM = new TObjArray();
58 fTrackIndex = new TArrayI(16);
59 fHitIndex = new TArrayI(16);
60 fITS = (AliITS*)(gAlice->GetDetector("ITS"));
62 //__________________________________________________________________________
63 AliITSmodule::~AliITSmodule() {
64 // The destructor for AliITSmodule. Before destoring AliITSmodule
65 // we must first destroy all of it's members.
74 fITS = 0; // We don't delete this pointer since it is just a copy.
76 //____________________________________________________________________________
77 AliITSmodule::AliITSmodule(const AliITSmodule &source):TObject(source){
78 ////////////////////////////////////////////////////////////////////////
80 ////////////////////////////////////////////////////////////////////////
81 Error("AliITSmodule","AliITSmodule class has not to be copied! Exit.");
84 //_____________________________________________________________________________
85 AliITSmodule& AliITSmodule::operator=(const AliITSmodule &source){
86 ////////////////////////////////////////////////////////////////////////
87 // Assignment operator
88 ////////////////////////////////////////////////////////////////////////
89 if(&source == this) return *this;
90 Error("AliITSmodule","AliITSmodule class has not to be copied! Exit.");
92 return *this; // fake return neded on Sun
94 //_________________________________________________________________________
97 //__________________________________________________________________________
98 Int_t AliITSmodule::AddHit(AliITShit* hit,Int_t t,Int_t h) {
101 //printf("AddHit: beginning hit %p t h %d %d\n",hit,t,h);
102 fHitsM->AddLast(new AliITShit(*hit));
103 Int_t fNhitsM = fHitsM->GetEntriesFast();
104 if(fNhitsM-1>=fTrackIndex->GetSize()){ // need to expand the TArrayI
105 fTrackIndex->Set(fNhitsM+64);
107 if(fNhitsM-1>=fHitIndex->GetSize()){ // need to expand the TArrayI
108 fHitIndex->Set(fNhitsM+64);
110 (*fTrackIndex)[fNhitsM-1] = t;
111 (*fHitIndex)[fNhitsM-1] = h;
114 //___________________________________________________________________________
115 Double_t AliITSmodule::PathLength(Int_t index,AliITShit *itsHit1,
116 AliITShit *itsHit2) {
123 itsHit1->GetPositionG(x1g,y1g,z1g);
124 itsHit2->GetPositionG(x2g,y2g,z2g);
126 s = TMath::Sqrt( ((Double_t)(x2g-x1g)*(Double_t)(x2g-x1g)) +
127 ((Double_t)(y2g-y1g)*(Double_t)(y2g-y1g)) +
128 ((Double_t)(z2g-z1g)*(Double_t)(z2g-z1g)) );
131 //___________________________________________________________________________
132 void AliITSmodule::PathLength(Int_t index,
133 Float_t x,Float_t y,Float_t z,
134 Int_t status,Int_t &nseg,
135 Float_t &x1,Float_t &y1,Float_t &z1,
136 Float_t &dx1,Float_t &dy1,Float_t &dz1,
139 static Float_t x0,y0,z0;
142 if ((status&0x0002)!=0){ // entering
156 if ((status&0x0004)!=0) flag = 0; //exiting
157 if ((status&0x0001)!=0) flag = 2; // inside
158 else flag = 2; //inside ?
164 //___________________________________________________________________________
165 Bool_t AliITSmodule::LineSegmentL(Int_t hitindex,Double_t &a,Double_t &b,
166 Double_t &c,Double_t &d,
167 Double_t &e,Double_t &f,Double_t &de){
172 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
174 h1 = (AliITShit *) (fHitsM->At(hitindex));
175 if(h1->StatusEntering()){ // if track entering volume, get index for next
178 } // end if StatusEntering()
180 de = h1->GetIonization();
181 h1->GetPositionL0(a,c,e,t);
182 h1->GetPositionL(b,d,f);
188 //___________________________________________________________________________
189 Bool_t AliITSmodule::LineSegmentG(Int_t hitindex,Double_t &a,Double_t &b,
190 Double_t &c,Double_t &d,
191 Double_t &e,Double_t &f,Double_t &de){
196 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
198 h1 = (AliITShit *) (fHitsM->At(hitindex));
199 if(h1->StatusEntering()){ // if track entering volume, get index for next
202 } // end if StatusEntering()
204 de = h1->GetIonization();
205 h1->GetPositionG0(a,c,e,t);
206 h1->GetPositionG(b,d,f);
212 //___________________________________________________________________________
213 Bool_t AliITSmodule::LineSegmentL(Int_t hitindex,Double_t &a,Double_t &b,
214 Double_t &c,Double_t &d,
215 Double_t &e,Double_t &f,
216 Double_t &de,Int_t &track){
221 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
223 h1 = (AliITShit *) (fHitsM->At(hitindex));
224 if(h1->StatusEntering()){ // if track entering volume, get index for next
226 track = h1->GetTrack();
228 } // end if StatusEntering()
230 de = h1->GetIonization();
231 h1->GetPositionL0(a,c,e,t);
232 h1->GetPositionL(b,d,f);
236 track = h1->GetTrack();
239 //___________________________________________________________________________
240 Bool_t AliITSmodule::LineSegmentG(Int_t hitindex,Double_t &a,Double_t &b,
241 Double_t &c,Double_t &d,
242 Double_t &e,Double_t &f,
243 Double_t &de,Int_t &track){
248 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
250 h1 = (AliITShit *) (fHitsM->At(hitindex));
251 if(h1->StatusEntering()){ // if track entering volume, get index for next
253 track = h1->GetTrack();
255 } // end if StatusEntering()
257 de = h1->GetIonization();
258 h1->GetPositionG0(a,c,e,t);
259 h1->GetPositionG(b,d,f);
263 track = h1->GetTrack();
266 //______________________________________________________________________
267 Bool_t AliITSmodule::MedianHitG(AliITShit *h1,AliITShit *h2,
268 Float_t &x,Float_t &y,Float_t &z){
269 // Computes the mean hit location for a set of hits that make up a track
270 // passing through a volume. Returns kFALSE untill the the track leaves
273 AliITSgeom *gm = fITS->GetITSgeom();
274 Float_t x1l=0.,y1l=0.,z1l=0.;
275 Float_t x2l=0.,y2l=0.,z2l=0.;
276 Float_t xMl,yMl=0,zMl;
279 h1->GetPositionG(x1l,y1l,z1l);
280 h2->GetPositionG(x2l,y2l,z2l);
283 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
284 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
293 gm->LtoG(h1->GetModule(),l,g);
299 //___________________________________________________________________________
300 void AliITSmodule::MedianHitG(Int_t index,
301 Float_t hitx1,Float_t hity1,Float_t hitz1,
302 Float_t hitx2,Float_t hity2,Float_t hitz2,
303 Float_t &xMg, Float_t &yMg, Float_t &zMg){
305 AliITSgeom *gm = fITS->GetITSgeom();
308 Float_t xMl,yMl=0,zMl;
328 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
329 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
343 //___________________________________________________________________________
344 Bool_t AliITSmodule::MedianHitL( AliITShit *itsHit1,
346 Float_t &xMl, Float_t &yMl, Float_t &zMl) const{
351 itsHit1->GetPositionL(x1l,y1l,z1l);
352 itsHit2->GetPositionL(x2l,y2l,z2l);
356 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
357 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
364 //___________________________________________________________________________
365 void AliITSmodule::MedianHit(Int_t index,
366 Float_t xg,Float_t yg,Float_t zg,
368 Float_t &xMg,Float_t &yMg,Float_t &zMg,
371 static Float_t x1,y1,z1;
373 if ((status&0x0002)!=0){ // entering
378 } else if ((status&0x0004)!=0){ // exiting
379 MedianHitG(index,x1,y1,z1,xg,yg,zg,xMg,yMg,zMg);
384 //___________________________________________________________________________
385 void AliITSmodule::GetID(Int_t &lay,Int_t &lad,Int_t &det){
387 fITS->GetITSgeom()->GetModuleId(fIndex,lay,lad,det);