]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSmodule.cxx
Correction of the inheritance scheme
[u/mrichter/AliRoot.git] / ITS / AliITSmodule.cxx
CommitLineData
4c039060 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3bd79107 3 * *
4c039060 4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16/*
17$Log$
5a62ee96 18Revision 1.4 2000/06/12 23:49:02 nilsen
19New ITS code replacing the old structure and simulations code.
20
3bd79107 21Revision 1.3.4.4 2000/06/12 18:10:32 barbera
22fixed posible compilation errors on HP unix
23
24Revision 1.3.4.3 2000/06/11 20:34:20 barbera
25Update class for the new structures.
26
27Revision 1.3.4.2 2000/03/02 21:42:29 nilsen
28Linked AliDetector::fDigit to AliITSmodule::fDigitsM and AliITS::fITSRecPoints
29to AliITSmodule::fRecPointsM. Renamed AliITSmodule::fPointsM to fRecPointsM.
30Removed the deletion of fDigitsM from the distructor since it is only a copy
31of what is in AliDetector. Fixed a bug in the functions LineSegmentL and
32LineSegmentG. Added two new versions of LineSegmentL and LineSegmentG to
33additionaly return track number from the hit. Removed FastPoint function,
34haven't found anywere it was used, also it had very many problems, should
35just call FastPointSPD... .
36
37Revision 1.3.4.1 2000/01/12 19:03:32 nilsen
38This is the version of the files after the merging done in December 1999.
39See the ReadMe110100.txt file for details
40
41Revision 1.3 1999/10/04 15:20:12 fca
42Correct syntax accepted by g++ but not standard for static members, remove minor warnings
43
ad0e60d9 44Revision 1.2 1999/09/29 09:24:20 fca
45Introduction of the Copyright and cvs Log
46
4c039060 47*/
48
58005f18 49#include "AliITSmodule.h"
3bd79107 50
58005f18 51#include "AliRun.h"
3bd79107 52#include "AliITS.h"
53#include "AliITShit.h"
58005f18 54
55ClassImp(AliITSmodule)
56
57//_______________________________________________________________________
58//
59// Impementation of class AliITSmodule
60//
3bd79107 61// created by: A. Bouchm, W. Peryt, S. Radomski, P. Skowronski
58005f18 62// R. Barbers, B. Batyunia, B. S. Nilsen
63// ver 1.0 CERN 16.09.1999
64//_______________________________________________________________________
58005f18 65//________________________________________________________________________
66//
67// Constructors and deconstructor
68//________________________________________________________________________
69//
3bd79107 70AliITSmodule::AliITSmodule() {
71 // constructor
72 fIndex = 0;
73 fHitsM = 0;
74 fTrackIndex = 0;
75 fHitIndex = 0;
76 fITS = 0;
58005f18 77
3bd79107 78}
79//_________________________________________________________________________
80AliITSmodule::AliITSmodule(Int_t index) {
81 // constructor
58005f18 82
3bd79107 83 fIndex = index;
84 fHitsM = new TObjArray();
85 fTrackIndex = new TArrayI(16);
86 fHitIndex = new TArrayI(16);
87 fITS = (AliITS*)(gAlice->GetDetector("ITS"));
88}
89//__________________________________________________________________________
90AliITSmodule::~AliITSmodule() {
91 // The destructor for AliITSmodule. Before destoring AliITSmodule
92 // we must first destroy all of it's members.
58005f18 93
3bd79107 94 fIndex = 0;
95 Int_t i;
96 if(fHitsM){
97 for(i=0;i<fHitsM->GetEntriesFast();i++)
98 delete ((AliITShit *)(fHitsM->At(i)));
99 // must delete each object in the TObjArray.
100 delete fHitsM;
101 } // end if
102 delete fTrackIndex;
103 delete fHitIndex;
104 fITS = 0; // We don't delete this pointer since it is just a copy.
105}
106//____________________________________________________________________________
107AliITSmodule::AliITSmodule(const AliITSmodule &source){
108////////////////////////////////////////////////////////////////////////
109// Copy Constructor
110////////////////////////////////////////////////////////////////////////
111 printf("AliITSmodule error: AliITSmodule class has not to be copied! Exit.\n");
112 exit(1);
58005f18 113}
114
3bd79107 115//_____________________________________________________________________________
116AliITSmodule& AliITSmodule::operator=(const AliITSmodule &source){
117////////////////////////////////////////////////////////////////////////
118// Assignment operator
119////////////////////////////////////////////////////////////////////////
120 printf("AliITSmodule error: AliITSmodule class has not to be copied! Exit.\n");
121 exit(1);
5a62ee96 122 return *this;
3bd79107 123}
58005f18 124
125//_________________________________________________________________________
3bd79107 126//
127// Hits management
128//__________________________________________________________________________
129Int_t AliITSmodule::AddHit(AliITShit* hit,Int_t t,Int_t h) {
130// Hits management
58005f18 131
3bd79107 132 Int_t i;
133 fHitsM->AddLast(new AliITShit(*hit));
134 Int_t fNhitsM = fHitsM->GetEntriesFast();
135 if(fNhitsM-1>=fTrackIndex->GetSize()){ // need to expand the TArrayI
136 TArrayI *p = new TArrayI(fNhitsM+64);
137 for(i=0;i<fTrackIndex->GetSize();i++)
138 (*p)[i] = fTrackIndex->At(i);
139 delete fTrackIndex;
140 fTrackIndex = p;
141 } // end if
142 if(fNhitsM-1>=fHitIndex->GetSize()){ // need to expand the TArrayI
143 TArrayI *p = new TArrayI(fNhitsM+64);
144 for(i=0;i<fHitIndex->GetSize();i++)
145 (*p)[i] = fHitIndex->At(i);
146 delete fHitIndex;
147 fHitIndex = p;
148 } // end if
149 (*fTrackIndex)[fNhitsM-1] = t;
150 (*fHitIndex)[fNhitsM-1] = h;
151 return fNhitsM;
152}
153
154//___________________________________________________________________________
155void AliITSmodule::MedianHitG(Int_t index,
156 Float_t hitx1,Float_t hity1,Float_t hitz1,
157 Float_t hitx2,Float_t hity2,Float_t hitz2,
158 Float_t &xMg, Float_t &yMg, Float_t &zMg){
159 // median hit
160 AliITSgeom *gm = fITS->GetITSgeom();
161 Float_t x1l,y1l,z1l;
162 Float_t x2l,y2l,z2l;
163 Float_t xMl,yMl=0,zMl;
164 Float_t l[3], g[3];
165
166 g[0] = hitx1;
167 g[1] = hity1;
168 g[2] = hitz1;
169 gm->GtoL(index,g,l);
170 x1l = l[0];
171 y1l = l[1];
172 z1l = l[2];
173
174 g[0] = hitx2;
175 g[1] = hity2;
176 g[2] = hitz2;
177 gm->GtoL(index,g,l);
178 x2l = l[0];
179 y2l = l[1];
180 z2l = l[2];
181
182 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
183 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
58005f18 184
3bd79107 185 l[0] = xMl;
186 l[1] = yMl;
187 l[2] = zMl;
188 gm->LtoG(index,l,g);
189 xMg = g[0];
190 yMg = g[1];
191 zMg = g[2];
58005f18 192}
3bd79107 193//___________________________________________________________________________
194Double_t AliITSmodule::PathLength(Int_t index,AliITShit *itsHit1,
195 AliITShit *itsHit2){
196 // path lenght
197 Float_t x1g,y1g,z1g;
198 Float_t x2g,y2g,z2g;
199 Double_t s;
58005f18 200
3bd79107 201 itsHit1->GetPositionG(x1g,y1g,z1g);
202 itsHit2->GetPositionG(x2g,y2g,z2g);
58005f18 203
3bd79107 204 s = TMath::Sqrt( ((Double_t)(x2g-x1g)*(Double_t)(x2g-x1g)) +
205 ((Double_t)(y2g-y1g)*(Double_t)(y2g-y1g)) +
206 ((Double_t)(z2g-z1g)*(Double_t)(z2g-z1g)) );
207 return s;
208}
209//___________________________________________________________________________
210void AliITSmodule::PathLength(Int_t index,
211 Float_t x,Float_t y,Float_t z,
212 Int_t status,Int_t &nseg,
213 Float_t &x1,Float_t &y1,Float_t &z1,
214 Float_t &dx1,Float_t &dy1,Float_t &dz1,
215 Int_t &flag){
216 // path length
217 static Float_t x0,y0,z0;
58005f18 218
3bd79107 219 if (status == 66){ // entering
220 x0 = x;
221 y0 = y;
222 z0 = z;
223 nseg = 0;
224 flag = 1;
225 }else{
226 x1 = x0;
227 y1 = y0;
228 z1 = z0;
229 dx1 = x-x1;
230 dy1 = y-y1;
231 dz1 = z-z1;
232 nseg++;
233 if (status == 68) flag = 0; //exiting
234 else flag = 2; //inside
235 x0 = x;
236 y0 = y;
237 z0 = z;
238 } // end if
58005f18 239}
3bd79107 240//___________________________________________________________________________
241Bool_t AliITSmodule::LineSegmentL(Int_t hitindex,Double_t &a,Double_t &b,
242 Double_t &c,Double_t &d,
243 Double_t &e,Double_t &f,Double_t &de){
244 // line segment
245 static Int_t hitindex0;
246 AliITShit *h0,*h1;
58005f18 247
3bd79107 248 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
58005f18 249
3bd79107 250 h1 = (AliITShit *) (fHitsM->At(hitindex));
251 if(h1->StatusEntering()){ // if track entering volume, get index for next
252 // step
253 hitindex0 = hitindex;
254 return kFALSE;
255 } // end if StatusEntering()
256 // else stepping
257 h0 = (AliITShit *) (fHitsM->At(hitindex0));
258 de = h1->GetIonization();
259 h0->GetPositionL(a,c,e);
260 h1->GetPositionL(b,d,f);
261 b = b - a;
262 d = d - c;
263 f = f - e;
264 hitindex0 = hitindex;
265 return kTRUE;
266}
267//___________________________________________________________________________
268Bool_t AliITSmodule::LineSegmentG(Int_t hitindex,Double_t &a,Double_t &b,
269 Double_t &c,Double_t &d,
270 Double_t &e,Double_t &f,Double_t &de){
271 // line segment
272 static Int_t hitindex0;
273 AliITShit *h0,*h1;
58005f18 274
3bd79107 275 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
276
277 h1 = (AliITShit *) (fHitsM->At(hitindex));
278 if(h1->StatusEntering()){ // if track entering volume, get index for next
279 // step
280 hitindex0 = hitindex;
281 return kFALSE;
282 } // end if StatusEntering()
283 // else stepping
284 h0 = (AliITShit *) (fHitsM->At(hitindex0));
285 de = h1->GetIonization();
286 h0->GetPositionG(a,c,e);
287 h1->GetPositionG(b,d,f);
288 b = b - a;
289 d = d - c;
290 f = f - e;
291 hitindex0 = hitindex;
292 return kTRUE;
293}
294//___________________________________________________________________________
295Bool_t AliITSmodule::LineSegmentL(Int_t hitindex,Double_t &a,Double_t &b,
296 Double_t &c,Double_t &d,
297 Double_t &e,Double_t &f,
298 Double_t &de,Int_t &track){
299 // line segmente
300 static Int_t hitindex0;
301 AliITShit *h0,*h1;
302
303 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
304
305 h1 = (AliITShit *) (fHitsM->At(hitindex));
306 if(h1->StatusEntering()){ // if track entering volume, get index for next
307 // step
308 hitindex0 = hitindex;
309 track = h1->GetTrack();
310 return kFALSE;
311 } // end if StatusEntering()
312 // else stepping
313 h0 = (AliITShit *) (fHitsM->At(hitindex0));
314 de = h1->GetIonization();
315 h0->GetPositionL(a,c,e);
316 h1->GetPositionL(b,d,f);
317 b = b - a;
318 d = d - c;
319 f = f - e;
320 hitindex0 = hitindex;
321 track = h1->GetTrack();
322 return kTRUE;
323}
324//___________________________________________________________________________
325Bool_t AliITSmodule::LineSegmentG(Int_t hitindex,Double_t &a,Double_t &b,
326 Double_t &c,Double_t &d,
327 Double_t &e,Double_t &f,
328 Double_t &de,Int_t &track){
329 // line segment
330 static Int_t hitindex0;
331 AliITShit *h0,*h1;
332
333 if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
334
335 h1 = (AliITShit *) (fHitsM->At(hitindex));
336 if(h1->StatusEntering()){ // if track entering volume, get index for next
337 // step
338 hitindex0 = hitindex;
339 track = h1->GetTrack();
340 return kFALSE;
341 } // end if StatusEntering()
342 // else stepping
343 h0 = (AliITShit *) (fHitsM->At(hitindex0));
344 de = h1->GetIonization();
345 h0->GetPositionG(a,c,e);
346 h1->GetPositionG(b,d,f);
347 b = b - a;
348 d = d - c;
349 f = f - e;
350 hitindex0 = hitindex;
351 track = h1->GetTrack();
352 return kTRUE;
58005f18 353}
3bd79107 354//___________________________________________________________________________
355void AliITSmodule::MedianHitL(Int_t index,
356 AliITShit *itsHit1,
357 AliITShit *itsHit2,
358 Float_t &xMl, Float_t &yMl, Float_t &zMl){
359 // median hit
360 Float_t x1l,y1l,z1l;
361 Float_t x2l,y2l,z2l;
362
363 itsHit1->GetPositionL(x1l,y1l,z1l);
364 itsHit2->GetPositionL(x2l,y2l,z2l);
58005f18 365
3bd79107 366 xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
367 yMl = 0.0;
368 zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
369}
58005f18 370//___________________________________________________________________________
3bd79107 371void AliITSmodule::MedianHit(Int_t index,
372 Float_t xg,Float_t yg,Float_t zg,
373 Int_t status,
374 Float_t &xMg,Float_t &yMg,Float_t &zMg,
375 Int_t &flag){
376 // median hit
377 static Float_t x1,y1,z1;
378
379 if (status == 66){ // entering
380 x1 = xg;
381 y1 = yg;
382 z1 = zg;
383 flag = 1;
384 } // end if
385 if (status == 68){ // exiting
386 MedianHitG(index,x1,y1,z1,xg,yg,zg,xMg,yMg,zMg);
387 flag = 0;
388 } // end if
389 if ((status != 66) && (status != 68)) flag = 1;
58005f18 390}
3bd79107 391//___________________________________________________________________________
392void AliITSmodule::GetID(Int_t &lay,Int_t &lad,Int_t &det){
393 // get ID
394 fITS->GetITSgeom()->GetModuleId(fIndex,lay,lad,det);
395 return ;
396}
397