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 **************************************************************************/
21 Revision 1.9.8.4 2003/06/13 16:31:00 nilsen
22 Introducing a backward incompatibility to hit files created before June 12
23 2002. The enterance hit is no longer recorded. The starting position of
24 every hit is used instead. Added GetPositionL0 to AliITShit, fixed up
25 AliITSmodule to use starting location of hit and not enterance hits, and
26 StepManager in AliITSvPPRasymm no longer records enterence hit to hit file.
35 #include "AliITShit.h"
36 #include "AliITSmodule.h"
37 #include "AliITSgeom.h"
39 ClassImp(AliITSmodule)
41 //_______________________________________________________________________
43 // Impementation of class AliITSmodule
45 // created by: A. Bouchm, W. Peryt, S. Radomski, P. Skowronski
46 // R. Barbers, B. Batyunia, B. S. Nilsen
47 // ver 1.0 CERN 16.09.1999
48 //_______________________________________________________________________
49 //________________________________________________________________________
51 // Constructors and deconstructor
52 //________________________________________________________________________
54 AliITSmodule::AliITSmodule() {
63 //_________________________________________________________________________
64 AliITSmodule::AliITSmodule(Int_t index) {
68 fHitsM = new TObjArray();
69 fTrackIndex = new TArrayI(16);
70 fHitIndex = new TArrayI(16);
71 fITS = (AliITS*)(gAlice->GetDetector("ITS"));
73 //__________________________________________________________________________
74 AliITSmodule::~AliITSmodule() {
75 // The destructor for AliITSmodule. Before destoring AliITSmodule
76 // we must first destroy all of it's members.
85 fITS = 0; // We don't delete this pointer since it is just a copy.
87 //____________________________________________________________________________
88 AliITSmodule::AliITSmodule(const AliITSmodule &source){
89 ////////////////////////////////////////////////////////////////////////
91 ////////////////////////////////////////////////////////////////////////
92 Error("AliITSmodule","AliITSmodule class has not to be copied! Exit.");
95 //_____________________________________________________________________________
96 AliITSmodule& AliITSmodule::operator=(const AliITSmodule &source){
97 ////////////////////////////////////////////////////////////////////////
98 // Assignment operator
99 ////////////////////////////////////////////////////////////////////////
100 Error("AliITSmodule","AliITSmodule class has not to be copied! Exit.");
102 return *this; // fake return neded on Sun
104 //_________________________________________________________________________
107 //__________________________________________________________________________
108 Int_t AliITSmodule::AddHit(AliITShit* hit,Int_t t,Int_t h) {
111 //printf("AddHit: beginning hit %p t h %d %d\n",hit,t,h);
112 fHitsM->AddLast(new AliITShit(*hit));
113 Int_t fNhitsM = fHitsM->GetEntriesFast();
114 if(fNhitsM-1>=fTrackIndex->GetSize()){ // need to expand the TArrayI
115 fTrackIndex->Set(fNhitsM+64);
117 if(fNhitsM-1>=fHitIndex->GetSize()){ // need to expand the TArrayI
118 fHitIndex->Set(fNhitsM+64);
120 (*fTrackIndex)[fNhitsM-1] = t;
121 (*fHitIndex)[fNhitsM-1] = h;
124 //___________________________________________________________________________
125 Double_t AliITSmodule::PathLength(Int_t index,AliITShit *itsHit1,
132 itsHit1->GetPositionG(x1g,y1g,z1g);
133 itsHit2->GetPositionG(x2g,y2g,z2g);
135 s = TMath::Sqrt( ((Double_t)(x2g-x1g)*(Double_t)(x2g-x1g)) +
136 ((Double_t)(y2g-y1g)*(Double_t)(y2g-y1g)) +
137 ((Double_t)(z2g-z1g)*(Double_t)(z2g-z1g)) );
140 //___________________________________________________________________________
141 void AliITSmodule::PathLength(Int_t index,
142 Float_t x,Float_t y,Float_t z,
143 Int_t status,Int_t &nseg,
144 Float_t &x1,Float_t &y1,Float_t &z1,
145 Float_t &dx1,Float_t &dy1,Float_t &dz1,
148 static Float_t x0,y0,z0;
150 if ((status&0x0002)!=0){ // entering
164 if ((status&0x0004)!=0) flag = 0; //exiting
165 if ((status&0x0001)!=0) flag = 2; // inside
166 else flag = 2; //inside ?
172 //___________________________________________________________________________
173 Bool_t AliITSmodule::LineSegmentL(Int_t hitindex,Double_t &a,Double_t &b,
174 Double_t &c,Double_t &d,
175 Double_t &e,Double_t &f,Double_t &de){
180 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
182 h1 = (AliITShit *) (fHitsM->At(hitindex));
183 if(h1->StatusEntering()){ // if track entering volume, get index for next
186 } // end if StatusEntering()
188 de = h1->GetIonization();
189 h1->GetPositionL0(a,c,e,t);
190 h1->GetPositionL(b,d,f);
196 //___________________________________________________________________________
197 Bool_t AliITSmodule::LineSegmentG(Int_t hitindex,Double_t &a,Double_t &b,
198 Double_t &c,Double_t &d,
199 Double_t &e,Double_t &f,Double_t &de){
204 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
206 h1 = (AliITShit *) (fHitsM->At(hitindex));
207 if(h1->StatusEntering()){ // if track entering volume, get index for next
210 } // end if StatusEntering()
212 de = h1->GetIonization();
213 h1->GetPositionG0(a,c,e,t);
214 h1->GetPositionG(b,d,f);
220 //___________________________________________________________________________
221 Bool_t AliITSmodule::LineSegmentL(Int_t hitindex,Double_t &a,Double_t &b,
222 Double_t &c,Double_t &d,
223 Double_t &e,Double_t &f,
224 Double_t &de,Int_t &track){
229 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
231 h1 = (AliITShit *) (fHitsM->At(hitindex));
232 if(h1->StatusEntering()){ // if track entering volume, get index for next
234 track = h1->GetTrack();
236 } // end if StatusEntering()
238 de = h1->GetIonization();
239 h1->GetPositionL0(a,c,e,t);
240 h1->GetPositionL(b,d,f);
244 track = h1->GetTrack();
247 //___________________________________________________________________________
248 Bool_t AliITSmodule::LineSegmentG(Int_t hitindex,Double_t &a,Double_t &b,
249 Double_t &c,Double_t &d,
250 Double_t &e,Double_t &f,
251 Double_t &de,Int_t &track){
256 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
258 h1 = (AliITShit *) (fHitsM->At(hitindex));
259 if(h1->StatusEntering()){ // if track entering volume, get index for next
261 track = h1->GetTrack();
263 } // end if StatusEntering()
265 de = h1->GetIonization();
266 h1->GetPositionG0(a,c,e,t);
267 h1->GetPositionG(b,d,f);
271 track = h1->GetTrack();
274 //______________________________________________________________________
275 Bool_t AliITSmodule::MedianHitG(AliITShit *h1,AliITShit *h2,
276 Float_t &x,Float_t &y,Float_t &z){
277 // Computes the mean hit location for a set of hits that make up a track
278 // passing through a volume. Returns kFALSE untill the the track leaves
281 AliITSgeom *gm = fITS->GetITSgeom();
282 Float_t x1l=0.,y1l=0.,z1l=0.;
283 Float_t x2l=0.,y2l=0.,z2l=0.;
284 Float_t xMl,yMl=0,zMl;
287 h1->GetPositionG(x1l,y1l,z1l);
288 h2->GetPositionG(x2l,y2l,z2l);
291 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
292 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
301 gm->LtoG(h1->GetModule(),l,g);
307 //___________________________________________________________________________
308 void AliITSmodule::MedianHitG(Int_t index,
309 Float_t hitx1,Float_t hity1,Float_t hitz1,
310 Float_t hitx2,Float_t hity2,Float_t hitz2,
311 Float_t &xMg, Float_t &yMg, Float_t &zMg){
313 AliITSgeom *gm = fITS->GetITSgeom();
316 Float_t xMl,yMl=0,zMl;
336 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
337 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
351 //___________________________________________________________________________
352 Bool_t AliITSmodule::MedianHitL( AliITShit *itsHit1,
354 Float_t &xMl, Float_t &yMl, Float_t &zMl){
359 itsHit1->GetPositionL(x1l,y1l,z1l);
360 itsHit2->GetPositionL(x2l,y2l,z2l);
364 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
365 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
372 //___________________________________________________________________________
373 void AliITSmodule::MedianHit(Int_t index,
374 Float_t xg,Float_t yg,Float_t zg,
376 Float_t &xMg,Float_t &yMg,Float_t &zMg,
379 static Float_t x1,y1,z1;
381 if ((status&0x0002)!=0){ // entering
386 } else if ((status&0x0004)!=0){ // exiting
387 MedianHitG(index,x1,y1,z1,xg,yg,zg,xMg,yMg,zMg);
392 //___________________________________________________________________________
393 void AliITSmodule::GetID(Int_t &lay,Int_t &lad,Int_t &det){
395 fITS->GetITSgeom()->GetModuleId(fIndex,lay,lad,det);