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 **************************************************************************/
18 Revision 1.9 2000/10/02 16:32:51 barbera
19 Automatic streamer used and forward declarations added
21 Revision 1.3.4.7 2000/10/02 15:54:49 barbera
22 Automatic streamer used and forward declarations added
24 Revision 1.8 2000/09/22 12:35:21 nilsen
25 Traps placed incase it is used without a properly initilized AliITSgeom class.
27 Revision 1.7 2000/07/10 16:07:18 fca
28 Release version of ITS code
30 Revision 1.3.4.2 2000/03/04 23:43:57 nilsen
31 Fixed up the comments/documentation.
33 Revision 1.3.4.1 2000/01/12 19:03:32 nilsen
34 This is the version of the files after the merging done in December 1999.
35 See the ReadMe110100.txt file for details
37 Revision 1.3 1999/09/29 09:24:20 fca
38 Introduction of the Copyright and cvs Log
46 #include <TGeometry.h>
49 #include "TParticle.h"
53 #include "AliITSgeom.h"
54 #include "AliITShit.h"
58 ////////////////////////////////////////////////////////////////////////
60 // Written by Rene Brun, Federico Carminati, and Roberto Barbera
63 // Modified and documented by Bjorn S. Nilsen
66 // AliITShit is the hit class for the ITS. Hits are the information
67 // that comes from a Monte Carlo at each step as a particle mass through
68 // sensitive detector elements as particles are transported through a
73 <img src="picts/ITS/AliITShit_Class_Diagram.gif">
76 <font size=+2 color=red>
77 <p>This show the relasionships between the ITS hit class and the rest of Aliroot.
82 ////////////////////////////////////////////////////////////////////////
83 // Inline Member functions:
86 // The default creator of the AliITShit class.
89 // The default destructor of the AliITShit class.
92 // See AliHit for a full description. Returns the track number fTrack
95 // SetTrack(int track)
96 // See AliHit for a full description. Sets the track number fTrack
99 // Int_t GetTrackStatus()
100 // Returns the value of the track status flag fStatus. This flag
101 // indicates the track status at the time of creating this hit. It is
102 // made up of the following 8 status bits from highest order to lowest
104 // 0 : IsTrackAlive(): IsTrackStop():IsTrackDisappeared():
105 // IsTrackOut():IsTrackExiting():IsTrackEntering():IsTrackInside() .
106 // See AliMC for a description of these functions. If the function is
107 // true then the bit is set to one, otherwise it is zero.
109 // Bool_t StatusInside()
110 // Returns kTRUE if the particle producing this hit is still inside
111 // the present volume. Returns kFalse if this particle will be in another
112 // volume. {bit IsTrackInside is set or not}
114 // Bool_t StatusEntering()
115 // Returns kTRUE if the particle producing this hit is has just enterd
116 // the present volume. Returns kFalse otherwise. {bit IsTrackEntering is
119 // Bool_t StatusExiting()
120 // Returns kTRUE if the particle producing this hit is will exit
121 // the present volume. Returns kFalse otherwise. {bit IsTrackExiting is set
124 // Bool_t StatusOut()
125 // Returns kTRUE if the particle producing this hit is goint exit the
126 // simulation. Returns kFalse otherwise. {bit IsTrackOut is set or not}
128 // Bool_t StatusDisappeared()
129 // Returns kTRUE if the particle producing this hit is going to "disappear"
130 // for example it has interacted producing some other particles. Returns
131 // kFalse otherwise. {bit IsTrackOut is set or not}
133 // Bool_t StatusStop()
134 // Returns kTRUE if the particle producing this hit is has dropped below
135 // its energy cut off producing some other particles. Returns kFalse otherwise.
136 // {bit IsTrackOut is set or not}
138 // Bool_t StatuAlives()
139 // Returns kTRUE if the particle producing this hit is going to continue
140 // to be transported. Returns kFalse otherwise. {bit IsTrackOut is set or not}
143 // Returns the layer number, fLayer, for this hit.
146 // Returns the ladder number, fLadder, for this hit.
148 // Int_t GetDetector()
149 // Returns the detector number, fDet, for this hit.
151 // GetDetectorID(Int_t &layer, Int_t &ladder, Int_t &detector)
152 // Returns the layer, ladder, and detector numbers, fLayer fLadder fDet,
155 // Float_t GetIonization()
156 // Returns the energy lost, fDestep, by the particle creating this hit,
157 // in the units defined by the Monte Carlo.
159 // GetPositionG(Float_t &x, Float_t &y, Float_t &z)
160 // Returns the global position, fX fY fZ, of this hit, in the units
161 // define by the Monte Carlo.
163 // GetPositionG(Double_t &x, Double_t &y, Double_t &z)
164 // Returns the global position, fX fY fZ, of this hit, in the units
165 // define by the Monte Carlo.
167 // GetPositionG(Float_t &x, Float_t &y, Float_t &z, Float_t &tof)
168 // Returns the global position and time of flight, fX fY fZ fTof, of
169 // this hit, in the units define by the Monte Carlo.
171 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
172 // Returns the global position and time of flight, fX fY fZ fTof, of
173 // this hit, in the units define by the Monte Carlo.
175 // GetPositionL(Double_t &x,Double_t &y,Double_t &z)
176 // Returns the local position, fX fY fZ, of this hit in the coordiante
177 // of this module, in the units define by the Monte Carlo.
179 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
180 // Returns the local position and time of flight, fX fY fZ fTof, of
181 // this hit in the coordinates of this module, in the units define by the
185 // Returns the global x position in the units defined by the Monte Carlo.
188 // Returns the global y position in the units defined by the Monte Carlo.
191 // Returns the global z position in the units defined by the Monte Carlo.
194 // Returns the time of flight, fTof, of this hit, in the units defined
195 // by the Monte Carlo.
197 // GetMomentumG(Float_t &px, Float_t &py, Float_t &pz)
198 // Returns the global momentum, fPx fPy fPz, of the particle that made
199 // this hit, in the units define by the Monte Carlo.
201 // GetMomentumG(Double_t &px,Double_t &py,Double_t &pz)
202 // Returns the global momentum, fPx fPy fPz, of the particle that made
203 // this hit, in the units define by the Monte Carlo.
205 // GetMomentumL(Double_t &px,Double_t &py,Double_t &pz)
206 // Returns the momentum, fPx fPy fPz in coordinate appropreate for this
207 // specific module, in the units define by the Monte Carlo.
210 // Returns the global X momentum in the units defined by the Monte Carlo.
213 // Returns the global Y momentum in the units defined by the Monte Carlo.
216 // Returns the global Z momentum in the units defined by the Monte Carlo.
218 ////////////////////////////////////////////////////////////////////////
219 //_____________________________________________________________________________
220 AliITShit::AliITShit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
221 AliHit(shunt, track){
222 ////////////////////////////////////////////////////////////////////////
224 // The creator of the AliITShit class. The variables shunt and
225 // track are passed to the creator of the AliHit class. See the AliHit
226 // class for a full description. the integer array *vol contains, in order,
227 // fLayer = vol[0], fDet = vol[1], fLadder = vol[2], fStatus = vol[3].
228 // The array *hits contains, in order, fX = hits[0], fY = hits[1],
229 // fZ = hits[2], fPx = hits[3], fPy = hits[4], fPz = hits[5],
230 // fDestep = hits[6], and fTof = hits[7]. In the units of the Monte Carlo
231 ////////////////////////////////////////////////////////////////////////
232 fLayer = vol[0]; // Layer number
233 fLadder = vol[2]; // Ladder number
234 fDet = vol[1]; // Detector number
235 fStatus = vol[3]; // Track status flags
236 fX = hits[0]; // Track X position
237 fY = hits[1]; // Track Y position
238 fZ = hits[2]; // Track Z position
239 fPx = hits[3]; // Track X Momentum
240 fPy = hits[4]; // Track Y Momentum
241 fPz = hits[5]; // Track Z Momentum
242 fDestep = hits[6]; // Track dE/dx for this step
243 fTof = hits[7]; // Track Time of Flight for this step
245 //______________________________________________________________________
246 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z){
247 ////////////////////////////////////////////////////////////////////////
248 // Returns the position of this hit in the local coordinates of this
249 // module, and in the units of the Monte Carlo.
250 ////////////////////////////////////////////////////////////////////////
251 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
258 gm->GtoL(fLayer,fLadder,fDet,g,l);
263 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
264 // AliITSv7 - SDD case
271 //______________________________________________________________________
272 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z,Float_t &tof){
273 ////////////////////////////////////////////////////////////////////////
274 // Returns the position and time of flight of this hit in the local
275 // coordinates of this module, and in the units of the Monte Carlo.
276 ////////////////////////////////////////////////////////////////////////
277 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
284 gm->GtoL(fLayer,fLadder,fDet,g,l);
289 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
290 // AliITSv7 - SDD case
298 //______________________________________________________________________
299 Float_t AliITShit::GetXL(){
300 ////////////////////////////////////////////////////////////////////////
301 // Returns the x position of this hit in the local coordinates of this
302 // module, and in the units of the Monte Carlo.
303 ////////////////////////////////////////////////////////////////////////
304 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
311 gm->GtoL(fLayer,fLadder,fDet,g,l);
314 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
318 //______________________________________________________________________
319 Float_t AliITShit::GetYL(){
320 ////////////////////////////////////////////////////////////////////////
321 // Returns the y position of this hit in the local coordinates of this
322 // module, and in the units of the Monte Carlo.
323 ////////////////////////////////////////////////////////////////////////
324 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
331 gm->GtoL(fLayer,fLadder,fDet,g,l);
334 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
338 //______________________________________________________________________
339 Float_t AliITShit::GetZL(){
340 ////////////////////////////////////////////////////////////////////////
341 // Returns the z position of this hit in the local coordinates of this
342 // module, and in the units of the Monte Carlo.
343 ////////////////////////////////////////////////////////////////////////
344 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
351 gm->GtoL(fLayer,fLadder,fDet,g,l);
354 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
358 //______________________________________________________________________
359 void AliITShit::GetMomentumL(Float_t &px,Float_t &py,Float_t &pz){
360 ////////////////////////////////////////////////////////////////////////
361 // Returns the momentum of this hit in the local coordinates of this
362 // module, and in the units of the Monte Carlo.
363 ////////////////////////////////////////////////////////////////////////
364 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
371 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
376 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
383 //______________________________________________________________________
384 Float_t AliITShit::GetPXL(){
385 ////////////////////////////////////////////////////////////////////////
386 // Returns the X momentum of this hit in the local coordinates of this
387 // module, and in the units of the Monte Carlo.
388 ////////////////////////////////////////////////////////////////////////
389 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
396 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
399 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
403 //______________________________________________________________________
404 Float_t AliITShit::GetPYL(){
405 ////////////////////////////////////////////////////////////////////////
406 // Returns the Y momentum of this hit in the local coordinates of this
407 // module, and in the units of the Monte Carlo.
408 ////////////////////////////////////////////////////////////////////////
409 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
416 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
419 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
424 //______________________________________________________________________
425 Float_t AliITShit::GetPZL(){
426 ////////////////////////////////////////////////////////////////////////
427 // Returns the Z momentum of this hit in the local coordinates of this
428 // module, and in the units of the Monte Carlo.
429 ////////////////////////////////////////////////////////////////////////
430 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
437 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
440 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
445 //___________________________________________________________________________;
446 Int_t AliITShit::GetModule(){
447 ////////////////////////////////////////////////////////////////////////
448 // Returns the module index number of the module where this hit was in.
449 ////////////////////////////////////////////////////////////////////////
450 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
452 if (gm) return gm->GetModuleIndex(fLayer,fLadder,fDet);
454 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
458 //______________________________________________________________________
459 TParticle * AliITShit::GetParticle(){
460 ////////////////////////////////////////////////////////////////////////
461 // Returns the pointer to the TParticle for the particle that created
462 // this hit. From the TParticle all kinds of information about this
463 // particle can be found. See the TParticle class.
464 ////////////////////////////////////////////////////////////////////////
465 return gAlice->Particle(GetTrack());
468 //___________________________________________________________________________
469 void AliITShit::Streamer(TBuffer &R__b){
470 ////////////////////////////////////////////////////////////////////////
471 // The streamer function for this AliITShit class. This has been set
472 // up so that future changes to this class can be easly incorporated.
473 ////////////////////////////////////////////////////////////////////////
474 if (R__b.IsReading()) {
475 Version_t R__v = R__b.ReadVersion();
477 AliHit::Streamer(R__b);
487 }else{ // for futrue changes to this class.
490 R__b.WriteVersion(AliITShit::IsA());
491 AliHit::Streamer(R__b);
501 } // end if R__b.IsReading()