This class will be replaced soon. At present it isn't compatible with the
[u/mrichter/AliRoot.git] / ITS / AliITShit.cxx
CommitLineData
4c039060 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
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$
b2340bbf 18Revision 1.3.4.2 2000/03/04 23:43:57 nilsen
19Fixed up the comments/documentation.
20
21Revision 1.3.4.1 2000/01/12 19:03:32 nilsen
22This is the version of the files after the merging done in December 1999.
23See the ReadMe110100.txt file for details
24
25Revision 1.3 1999/09/29 09:24:20 fca
26Introduction of the Copyright and cvs Log
27
4c039060 28*/
29
58005f18 30
31#include <TMath.h>
32#include <TRandom.h>
33#include <TVector.h>
34#include <TGeometry.h>
35#include <TNode.h>
36#include <TTUBE.h>
37
b2340bbf 38#include "AliRun.h"
58005f18 39#include "AliITSgeom.h"
40#include "AliITS.h"
41#include "AliITShit.h"
58005f18 42
43
44ClassImp(AliITShit)
45////////////////////////////////////////////////////////////////////////
46// Version: 0
47// Written by Rene Brun, Federico Carminati, and Roberto Barbera
48//
49// Version: 1
50// Modified and documented by Bjorn S. Nilsen
51// July 11 1999
52//
53// AliITShit is the hit class for the ITS. Hits are the information
54// that comes from a Monte Carlo at each step as a particle mass through
55// sensitive detector elements as particles are transported through a
56// detector.
57//
58//Begin_Html
59/*
a92b2b7d 60<img src="picts/ITS/AliITShit_Class_Diagram.gif">
58005f18 61</pre>
62<br clear=left>
63<font size=+2 color=red>
64<p>This show the relasionships between the ITS hit class and the rest of Aliroot.
65</font>
66<pre>
67*/
68//End_Html
b2340bbf 69////////////////////////////////////////////////////////////////////////
70// Inline Member functions:
71//
72// AliITShit()
73// The default creator of the AliITShit class.
74//
75// ~AliITShit()
76// The default destructor of the AliITShit class.
77//
78// int GetTrack()
79// See AliHit for a full description. Returns the track number fTrack
80// for this hit.
81//
82// SetTrack(int track)
83// See AliHit for a full description. Sets the track number fTrack
84// for this hit.
85//
86// Int_t GetTrackStatus()
87// Returns the value of the track status flag fStatus. This flag
88// indicates the track status at the time of creating this hit. It is
89// made up of the following 8 status bits from highest order to lowest
90// order bits
91// 0 : IsTrackAlive(): IsTrackStop():IsTrackDisappeared():
92// IsTrackOut():IsTrackExiting():IsTrackEntering():IsTrackInside() .
93// See AliMC for a description of these functions. If the function is
94// true then the bit is set to one, otherwise it is zero.
95//
96// Bool_t StatusInside()
97// Returns kTRUE if the particle producing this hit is still inside
98// the present volume. Returns kFalse if this particle will be in another
99// volume. {bit IsTrackInside is set or not}
100//
101// Bool_t StatusEntering()
102// Returns kTRUE if the particle producing this hit is has just enterd
103// the present volume. Returns kFalse otherwise. {bit IsTrackEntering is
104// set or not}
105//
106// Bool_t StatusExiting()
107// Returns kTRUE if the particle producing this hit is will exit
108// the present volume. Returns kFalse otherwise. {bit IsTrackExiting is set
109// or not}
110//
111// Bool_t StatusOut()
112// Returns kTRUE if the particle producing this hit is goint exit the
113// simulation. Returns kFalse otherwise. {bit IsTrackOut is set or not}
114//
115// Bool_t StatusDisappeared()
116// Returns kTRUE if the particle producing this hit is going to "disappear"
117// for example it has interacted producing some other particles. Returns
118// kFalse otherwise. {bit IsTrackOut is set or not}
119//
120// Bool_t StatusStop()
121// Returns kTRUE if the particle producing this hit is has dropped below
122// its energy cut off producing some other particles. Returns kFalse otherwise.
123// {bit IsTrackOut is set or not}
124//
125// Bool_t StatuAlives()
126// Returns kTRUE if the particle producing this hit is going to continue
127// to be transported. Returns kFalse otherwise. {bit IsTrackOut is set or not}
128//
129// Int_t GetLayer()
130// Returns the layer number, fLayer, for this hit.
131//
132// Int_t GetLadder()
133// Returns the ladder number, fLadder, for this hit.
134//
135// Int_t GetDetector()
136// Returns the detector number, fDet, for this hit.
137//
138// GetDetectorID(Int_t &layer, Int_t &ladder, Int_t &detector)
139// Returns the layer, ladder, and detector numbers, fLayer fLadder fDet,
140// in one call.
141//
142// Float_t GetIonization()
143// Returns the energy lost, fDestep, by the particle creating this hit,
144// in the units defined by the Monte Carlo.
145//
146// GetPositionG(Float_t &x, Float_t &y, Float_t &z)
147// Returns the global position, fX fY fZ, of this hit, in the units
148// define by the Monte Carlo.
149//
150// GetPositionG(Double_t &x, Double_t &y, Double_t &z)
151// Returns the global position, fX fY fZ, of this hit, in the units
152// define by the Monte Carlo.
153//
154// GetPositionG(Float_t &x, Float_t &y, Float_t &z, Float_t &tof)
155// Returns the global position and time of flight, fX fY fZ fTof, of
156// this hit, in the units define by the Monte Carlo.
157//
158// GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
159// Returns the global position and time of flight, fX fY fZ fTof, of
160// this hit, in the units define by the Monte Carlo.
161//
162// GetPositionL(Double_t &x,Double_t &y,Double_t &z)
163// Returns the local position, fX fY fZ, of this hit in the coordiante
164// of this module, in the units define by the Monte Carlo.
165//
166// GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
167// Returns the local position and time of flight, fX fY fZ fTof, of
168// this hit in the coordinates of this module, in the units define by the
169// Monte Carlo.
170//
171// Float_t GetXG()
172// Returns the global x position in the units defined by the Monte Carlo.
173//
174// Float_t GetYG()
175// Returns the global y position in the units defined by the Monte Carlo.
176//
177// Float_t GetYG()
178// Returns the global z position in the units defined by the Monte Carlo.
179//
180// Float_t GetTOF()
181// Returns the time of flight, fTof, of this hit, in the units defined
182// by the Monte Carlo.
183//
184// GetMomentumG(Float_t &px, Float_t &py, Float_t &pz)
185// Returns the global momentum, fPx fPy fPz, of the particle that made
186// this hit, in the units define by the Monte Carlo.
187//
188// GetMomentumG(Double_t &px,Double_t &py,Double_t &pz)
189// Returns the global momentum, fPx fPy fPz, of the particle that made
190// this hit, in the units define by the Monte Carlo.
191//
192// GetMomentumL(Double_t &px,Double_t &py,Double_t &pz)
193// Returns the momentum, fPx fPy fPz in coordinate appropreate for this
194// specific module, in the units define by the Monte Carlo.
195//
196// Float_t GetPXG()
197// Returns the global X momentum in the units defined by the Monte Carlo.
198//
199// Float_t GetPYG()
200// Returns the global Y momentum in the units defined by the Monte Carlo.
201//
202// Float_t GetPZG()
203// Returns the global Z momentum in the units defined by the Monte Carlo.
204//
205////////////////////////////////////////////////////////////////////////
58005f18 206//_____________________________________________________________________________
207AliITShit::AliITShit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
b2340bbf 208 AliHit(shunt, track){
209////////////////////////////////////////////////////////////////////////
210// Create ITS hit
211// The creator of the AliITShit class. The variables shunt and
212// track are passed to the creator of the AliHit class. See the AliHit
213// class for a full description. the integer array *vol contains, in order,
214// fLayer = vol[0], fDet = vol[1], fLadder = vol[2], fStatus = vol[3].
215// The array *hits contains, in order, fX = hits[0], fY = hits[1],
216// fZ = hits[2], fPx = hits[3], fPy = hits[4], fPz = hits[5],
217// fDestep = hits[6], and fTof = hits[7]. In the units of the Monte Carlo
218////////////////////////////////////////////////////////////////////////
58005f18 219 fLayer = vol[0]; // Layer number
220 fLadder = vol[2]; // Ladder number
221 fDet = vol[1]; // Detector number
222 fStatus = vol[3]; // Track status flags
223 fX = hits[0]; // Track X position
224 fY = hits[1]; // Track Y position
225 fZ = hits[2]; // Track Z position
226 fPx = hits[3]; // Track X Momentum
227 fPy = hits[4]; // Track Y Momentum
228 fPz = hits[5]; // Track Z Momentum
229 fDestep = hits[6]; // Track dE/dx for this step
230 fTof = hits[7]; // Track Time of Flight for this step
231}
b2340bbf 232//______________________________________________________________________
58005f18 233void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z){
b2340bbf 234////////////////////////////////////////////////////////////////////////
235// Returns the position of this hit in the local coordinates of this
236// module, and in the units of the Monte Carlo.
237////////////////////////////////////////////////////////////////////////
58005f18 238 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
239 Float_t g[3],l[3];
240
241 g[0] = fX;
242 g[1] = fY;
243 g[2] = fZ;
244 gm->GtoL(fLayer,fLadder,fDet,g,l);
245 x = l[0];
246 y = l[1];
247 z = l[2];
248 return;
249}
b2340bbf 250//______________________________________________________________________
58005f18 251void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z,Float_t &tof){
b2340bbf 252////////////////////////////////////////////////////////////////////////
253// Returns the position and time of flight of this hit in the local
254// coordinates of this module, and in the units of the Monte Carlo.
255////////////////////////////////////////////////////////////////////////
58005f18 256 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
257 Float_t g[3],l[3];
258
259 g[0] = fX;
260 g[1] = fY;
261 g[2] = fZ;
262 gm->GtoL(fLayer,fLadder,fDet,g,l);
263 x = l[0];
264 y = l[1];
265 z = l[2];
266 tof = fTof;
267 return;
268}
b2340bbf 269//______________________________________________________________________
58005f18 270Float_t AliITShit::GetXL(){
b2340bbf 271////////////////////////////////////////////////////////////////////////
272// Returns the x position of this hit in the local coordinates of this
273// module, and in the units of the Monte Carlo.
274////////////////////////////////////////////////////////////////////////
58005f18 275 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
276 Float_t g[3],l[3];
277
278 g[0] = fX;
279 g[1] = fY;
280 g[2] = fZ;
281 gm->GtoL(fLayer,fLadder,fDet,g,l);
282 return l[0];
283}
b2340bbf 284//______________________________________________________________________
58005f18 285Float_t AliITShit::GetYL(){
b2340bbf 286////////////////////////////////////////////////////////////////////////
287// Returns the y position of this hit in the local coordinates of this
288// module, and in the units of the Monte Carlo.
289////////////////////////////////////////////////////////////////////////
58005f18 290 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
291 Float_t g[3],l[3];
292
293 g[0] = fX;
294 g[1] = fY;
295 g[2] = fZ;
296 gm->GtoL(fLayer,fLadder,fDet,g,l);
297 return l[1];
298}
b2340bbf 299//______________________________________________________________________
58005f18 300Float_t AliITShit::GetZL(){
b2340bbf 301////////////////////////////////////////////////////////////////////////
302// Returns the z position of this hit in the local coordinates of this
303// module, and in the units of the Monte Carlo.
304////////////////////////////////////////////////////////////////////////
58005f18 305 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
306 Float_t g[3],l[3];
307
308 g[0] = fX;
309 g[1] = fY;
310 g[2] = fZ;
311 gm->GtoL(fLayer,fLadder,fDet,g,l);
312 return l[2];
313}
b2340bbf 314//______________________________________________________________________
58005f18 315void AliITShit::GetMomentumL(Float_t &px,Float_t &py,Float_t &pz){
b2340bbf 316////////////////////////////////////////////////////////////////////////
317// Returns the momentum of this hit in the local coordinates of this
318// module, and in the units of the Monte Carlo.
319////////////////////////////////////////////////////////////////////////
58005f18 320 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
321 Float_t g[3],l[3];
322
323 g[0] = fPx;
324 g[1] = fPy;
325 g[2] = fPz;
326 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
327 px = l[0];
328 py = l[1];
329 pz = l[2];
330 return;
331}
b2340bbf 332//______________________________________________________________________
333Float_t AliITShit::GetPXL(){
334////////////////////////////////////////////////////////////////////////
335// Returns the X momentum of this hit in the local coordinates of this
336// module, and in the units of the Monte Carlo.
337////////////////////////////////////////////////////////////////////////
338 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
339 Float_t g[3],l[3];
340
341 g[0] = fPx;
342 g[1] = fPy;
343 g[2] = fPz;
344 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
345 return l[0];
346}
347//______________________________________________________________________
348Float_t AliITShit::GetPYL(){
349////////////////////////////////////////////////////////////////////////
350// Returns the Y momentum of this hit in the local coordinates of this
351// module, and in the units of the Monte Carlo.
352////////////////////////////////////////////////////////////////////////
353 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
354 Float_t g[3],l[3];
355
356 g[0] = fPx;
357 g[1] = fPy;
358 g[2] = fPz;
359 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
360 return l[1];
361}
362//______________________________________________________________________
363Float_t AliITShit::GetPZL(){
364////////////////////////////////////////////////////////////////////////
365// Returns the Z momentum of this hit in the local coordinates of this
366// module, and in the units of the Monte Carlo.
367////////////////////////////////////////////////////////////////////////
368 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
369 Float_t g[3],l[3];
370
371 g[0] = fPx;
372 g[1] = fPy;
373 g[2] = fPz;
374 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
375 return l[2];
376}
377//___________________________________________________________________________;
378Int_t AliITShit::GetModule(){
379////////////////////////////////////////////////////////////////////////
380// Returns the module index number of the module where this hit was in.
381////////////////////////////////////////////////////////////////////////
382 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
383
384 return gm->GetModuleIndex(fLayer,fLadder,fDet);
385}
386//______________________________________________________________________
387TParticle * AliITShit::GetParticle(){
388////////////////////////////////////////////////////////////////////////
389// Returns the pointer to the TParticle for the particle that created
390// this hit. From the TParticle all kinds of information about this
391// particle can be found. See the TParticle class.
392////////////////////////////////////////////////////////////////////////
fc743205 393 TClonesArray *parts = gAlice->Particles();
394 return ((TParticle*)parts->UncheckedAt(this->GetTrack()));
b2340bbf 395}
396//___________________________________________________________________________
397void AliITShit::Streamer(TBuffer &R__b){
398////////////////////////////////////////////////////////////////////////
399// The streamer function for this AliITShit class. This has been set
400// up so that future changes to this class can be easly incorporated.
401////////////////////////////////////////////////////////////////////////
402 if (R__b.IsReading()) {
403 Version_t R__v = R__b.ReadVersion();
404 if (R__v==1) {
405 AliHit::Streamer(R__b);
406 R__b >> fStatus;
407 R__b >> fLayer;
408 R__b >> fLadder;
409 R__b >> fDet;
410 R__b >> fPx;
411 R__b >> fPy;
412 R__b >> fPz;
413 R__b >> fDestep;
414 R__b >> fTof;
415 }else{ // for futrue changes to this class.
416 } // end if R__v==1
417 } else {
418 R__b.WriteVersion(AliITShit::IsA());
419 AliHit::Streamer(R__b);
420 R__b << fStatus;
421 R__b << fLayer;
422 R__b << fLadder;
423 R__b << fDet;
424 R__b << fPx;
425 R__b << fPy;
426 R__b << fPz;
427 R__b << fDestep;
428 R__b << fTof;
429 } // end if R__b.IsReading()
430}