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){
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 Error("AliITSmodule","AliITSmodule class has not to be copied! Exit.");
91 return *this; // fake return neded on Sun
93 //_________________________________________________________________________
96 //__________________________________________________________________________
97 Int_t AliITSmodule::AddHit(AliITShit* hit,Int_t t,Int_t h) {
100 //printf("AddHit: beginning hit %p t h %d %d\n",hit,t,h);
101 fHitsM->AddLast(new AliITShit(*hit));
102 Int_t fNhitsM = fHitsM->GetEntriesFast();
103 if(fNhitsM-1>=fTrackIndex->GetSize()){ // need to expand the TArrayI
104 fTrackIndex->Set(fNhitsM+64);
106 if(fNhitsM-1>=fHitIndex->GetSize()){ // need to expand the TArrayI
107 fHitIndex->Set(fNhitsM+64);
109 (*fTrackIndex)[fNhitsM-1] = t;
110 (*fHitIndex)[fNhitsM-1] = h;
113 //___________________________________________________________________________
114 Double_t AliITSmodule::PathLength(Int_t index,AliITShit *itsHit1,
121 itsHit1->GetPositionG(x1g,y1g,z1g);
122 itsHit2->GetPositionG(x2g,y2g,z2g);
124 s = TMath::Sqrt( ((Double_t)(x2g-x1g)*(Double_t)(x2g-x1g)) +
125 ((Double_t)(y2g-y1g)*(Double_t)(y2g-y1g)) +
126 ((Double_t)(z2g-z1g)*(Double_t)(z2g-z1g)) );
129 //___________________________________________________________________________
130 void AliITSmodule::PathLength(Int_t index,
131 Float_t x,Float_t y,Float_t z,
132 Int_t status,Int_t &nseg,
133 Float_t &x1,Float_t &y1,Float_t &z1,
134 Float_t &dx1,Float_t &dy1,Float_t &dz1,
137 static Float_t x0,y0,z0;
139 if ((status&0x0002)!=0){ // entering
153 if ((status&0x0004)!=0) flag = 0; //exiting
154 if ((status&0x0001)!=0) flag = 2; // inside
155 else flag = 2; //inside ?
161 //___________________________________________________________________________
162 Bool_t AliITSmodule::LineSegmentL(Int_t hitindex,Double_t &a,Double_t &b,
163 Double_t &c,Double_t &d,
164 Double_t &e,Double_t &f,Double_t &de){
169 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
171 h1 = (AliITShit *) (fHitsM->At(hitindex));
172 if(h1->StatusEntering()){ // if track entering volume, get index for next
175 } // end if StatusEntering()
177 de = h1->GetIonization();
178 h1->GetPositionL0(a,c,e,t);
179 h1->GetPositionL(b,d,f);
185 //___________________________________________________________________________
186 Bool_t AliITSmodule::LineSegmentG(Int_t hitindex,Double_t &a,Double_t &b,
187 Double_t &c,Double_t &d,
188 Double_t &e,Double_t &f,Double_t &de){
193 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
195 h1 = (AliITShit *) (fHitsM->At(hitindex));
196 if(h1->StatusEntering()){ // if track entering volume, get index for next
199 } // end if StatusEntering()
201 de = h1->GetIonization();
202 h1->GetPositionG0(a,c,e,t);
203 h1->GetPositionG(b,d,f);
209 //___________________________________________________________________________
210 Bool_t AliITSmodule::LineSegmentL(Int_t hitindex,Double_t &a,Double_t &b,
211 Double_t &c,Double_t &d,
212 Double_t &e,Double_t &f,
213 Double_t &de,Int_t &track){
218 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
220 h1 = (AliITShit *) (fHitsM->At(hitindex));
221 if(h1->StatusEntering()){ // if track entering volume, get index for next
223 track = h1->GetTrack();
225 } // end if StatusEntering()
227 de = h1->GetIonization();
228 h1->GetPositionL0(a,c,e,t);
229 h1->GetPositionL(b,d,f);
233 track = h1->GetTrack();
236 //___________________________________________________________________________
237 Bool_t AliITSmodule::LineSegmentG(Int_t hitindex,Double_t &a,Double_t &b,
238 Double_t &c,Double_t &d,
239 Double_t &e,Double_t &f,
240 Double_t &de,Int_t &track){
245 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
247 h1 = (AliITShit *) (fHitsM->At(hitindex));
248 if(h1->StatusEntering()){ // if track entering volume, get index for next
250 track = h1->GetTrack();
252 } // end if StatusEntering()
254 de = h1->GetIonization();
255 h1->GetPositionG0(a,c,e,t);
256 h1->GetPositionG(b,d,f);
260 track = h1->GetTrack();
263 //______________________________________________________________________
264 Bool_t AliITSmodule::MedianHitG(AliITShit *h1,AliITShit *h2,
265 Float_t &x,Float_t &y,Float_t &z){
266 // Computes the mean hit location for a set of hits that make up a track
267 // passing through a volume. Returns kFALSE untill the the track leaves
270 AliITSgeom *gm = fITS->GetITSgeom();
271 Float_t x1l=0.,y1l=0.,z1l=0.;
272 Float_t x2l=0.,y2l=0.,z2l=0.;
273 Float_t xMl,yMl=0,zMl;
276 h1->GetPositionG(x1l,y1l,z1l);
277 h2->GetPositionG(x2l,y2l,z2l);
280 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
281 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
290 gm->LtoG(h1->GetModule(),l,g);
296 //___________________________________________________________________________
297 void AliITSmodule::MedianHitG(Int_t index,
298 Float_t hitx1,Float_t hity1,Float_t hitz1,
299 Float_t hitx2,Float_t hity2,Float_t hitz2,
300 Float_t &xMg, Float_t &yMg, Float_t &zMg){
302 AliITSgeom *gm = fITS->GetITSgeom();
305 Float_t xMl,yMl=0,zMl;
325 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
326 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
340 //___________________________________________________________________________
341 Bool_t AliITSmodule::MedianHitL( AliITShit *itsHit1,
343 Float_t &xMl, Float_t &yMl, Float_t &zMl){
348 itsHit1->GetPositionL(x1l,y1l,z1l);
349 itsHit2->GetPositionL(x2l,y2l,z2l);
353 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
354 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
361 //___________________________________________________________________________
362 void AliITSmodule::MedianHit(Int_t index,
363 Float_t xg,Float_t yg,Float_t zg,
365 Float_t &xMg,Float_t &yMg,Float_t &zMg,
368 static Float_t x1,y1,z1;
370 if ((status&0x0002)!=0){ // entering
375 } else if ((status&0x0004)!=0){ // exiting
376 MedianHitG(index,x1,y1,z1,xg,yg,zg,xMg,yMg,zMg);
381 //___________________________________________________________________________
382 void AliITSmodule::GetID(Int_t &lay,Int_t &lad,Int_t &det){
384 fITS->GetITSgeom()->GetModuleId(fIndex,lay,lad,det);