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.3.4.7 2000/10/02 15:54:49 barbera
19 Automatic streamer used and forward declarations added
21 Revision 1.8 2000/09/22 12:35:21 nilsen
22 Traps placed incase it is used without a properly initilized AliITSgeom class.
24 Revision 1.7 2000/07/10 16:07:18 fca
25 Release version of ITS code
27 Revision 1.3.4.2 2000/03/04 23:43:57 nilsen
28 Fixed up the comments/documentation.
30 Revision 1.3.4.1 2000/01/12 19:03:32 nilsen
31 This is the version of the files after the merging done in December 1999.
32 See the ReadMe110100.txt file for details
34 Revision 1.3 1999/09/29 09:24:20 fca
35 Introduction of the Copyright and cvs Log
43 #include <TGeometry.h>
46 #include "TParticle.h"
50 #include "AliITSgeom.h"
51 #include "AliITShit.h"
55 ////////////////////////////////////////////////////////////////////////
57 // Written by Rene Brun, Federico Carminati, and Roberto Barbera
60 // Modified and documented by Bjorn S. Nilsen
63 // AliITShit is the hit class for the ITS. Hits are the information
64 // that comes from a Monte Carlo at each step as a particle mass through
65 // sensitive detector elements as particles are transported through a
70 <img src="picts/ITS/AliITShit_Class_Diagram.gif">
73 <font size=+2 color=red>
74 <p>This show the relasionships between the ITS hit class and the rest of Aliroot.
79 ////////////////////////////////////////////////////////////////////////
80 // Inline Member functions:
83 // The default creator of the AliITShit class.
86 // The default destructor of the AliITShit class.
89 // See AliHit for a full description. Returns the track number fTrack
92 // SetTrack(int track)
93 // See AliHit for a full description. Sets the track number fTrack
96 // Int_t GetTrackStatus()
97 // Returns the value of the track status flag fStatus. This flag
98 // indicates the track status at the time of creating this hit. It is
99 // made up of the following 8 status bits from highest order to lowest
101 // 0 : IsTrackAlive(): IsTrackStop():IsTrackDisappeared():
102 // IsTrackOut():IsTrackExiting():IsTrackEntering():IsTrackInside() .
103 // See AliMC for a description of these functions. If the function is
104 // true then the bit is set to one, otherwise it is zero.
106 // Bool_t StatusInside()
107 // Returns kTRUE if the particle producing this hit is still inside
108 // the present volume. Returns kFalse if this particle will be in another
109 // volume. {bit IsTrackInside is set or not}
111 // Bool_t StatusEntering()
112 // Returns kTRUE if the particle producing this hit is has just enterd
113 // the present volume. Returns kFalse otherwise. {bit IsTrackEntering is
116 // Bool_t StatusExiting()
117 // Returns kTRUE if the particle producing this hit is will exit
118 // the present volume. Returns kFalse otherwise. {bit IsTrackExiting is set
121 // Bool_t StatusOut()
122 // Returns kTRUE if the particle producing this hit is goint exit the
123 // simulation. Returns kFalse otherwise. {bit IsTrackOut is set or not}
125 // Bool_t StatusDisappeared()
126 // Returns kTRUE if the particle producing this hit is going to "disappear"
127 // for example it has interacted producing some other particles. Returns
128 // kFalse otherwise. {bit IsTrackOut is set or not}
130 // Bool_t StatusStop()
131 // Returns kTRUE if the particle producing this hit is has dropped below
132 // its energy cut off producing some other particles. Returns kFalse otherwise.
133 // {bit IsTrackOut is set or not}
135 // Bool_t StatuAlives()
136 // Returns kTRUE if the particle producing this hit is going to continue
137 // to be transported. Returns kFalse otherwise. {bit IsTrackOut is set or not}
140 // Returns the layer number, fLayer, for this hit.
143 // Returns the ladder number, fLadder, for this hit.
145 // Int_t GetDetector()
146 // Returns the detector number, fDet, for this hit.
148 // GetDetectorID(Int_t &layer, Int_t &ladder, Int_t &detector)
149 // Returns the layer, ladder, and detector numbers, fLayer fLadder fDet,
152 // Float_t GetIonization()
153 // Returns the energy lost, fDestep, by the particle creating this hit,
154 // in the units defined by the Monte Carlo.
156 // GetPositionG(Float_t &x, Float_t &y, Float_t &z)
157 // Returns the global position, fX fY fZ, of this hit, in the units
158 // define by the Monte Carlo.
160 // GetPositionG(Double_t &x, Double_t &y, Double_t &z)
161 // Returns the global position, fX fY fZ, of this hit, in the units
162 // define by the Monte Carlo.
164 // GetPositionG(Float_t &x, Float_t &y, Float_t &z, Float_t &tof)
165 // Returns the global position and time of flight, fX fY fZ fTof, of
166 // this hit, in the units define by the Monte Carlo.
168 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
169 // Returns the global position and time of flight, fX fY fZ fTof, of
170 // this hit, in the units define by the Monte Carlo.
172 // GetPositionL(Double_t &x,Double_t &y,Double_t &z)
173 // Returns the local position, fX fY fZ, of this hit in the coordiante
174 // of this module, in the units define by the Monte Carlo.
176 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
177 // Returns the local position and time of flight, fX fY fZ fTof, of
178 // this hit in the coordinates of this module, in the units define by the
182 // Returns the global x position in the units defined by the Monte Carlo.
185 // Returns the global y position in the units defined by the Monte Carlo.
188 // Returns the global z position in the units defined by the Monte Carlo.
191 // Returns the time of flight, fTof, of this hit, in the units defined
192 // by the Monte Carlo.
194 // GetMomentumG(Float_t &px, Float_t &py, Float_t &pz)
195 // Returns the global momentum, fPx fPy fPz, of the particle that made
196 // this hit, in the units define by the Monte Carlo.
198 // GetMomentumG(Double_t &px,Double_t &py,Double_t &pz)
199 // Returns the global momentum, fPx fPy fPz, of the particle that made
200 // this hit, in the units define by the Monte Carlo.
202 // GetMomentumL(Double_t &px,Double_t &py,Double_t &pz)
203 // Returns the momentum, fPx fPy fPz in coordinate appropreate for this
204 // specific module, in the units define by the Monte Carlo.
207 // Returns the global X momentum in the units defined by the Monte Carlo.
210 // Returns the global Y momentum in the units defined by the Monte Carlo.
213 // Returns the global Z momentum in the units defined by the Monte Carlo.
215 ////////////////////////////////////////////////////////////////////////
216 //_____________________________________________________________________________
217 AliITShit::AliITShit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
218 AliHit(shunt, track){
219 ////////////////////////////////////////////////////////////////////////
221 // The creator of the AliITShit class. The variables shunt and
222 // track are passed to the creator of the AliHit class. See the AliHit
223 // class for a full description. the integer array *vol contains, in order,
224 // fLayer = vol[0], fDet = vol[1], fLadder = vol[2], fStatus = vol[3].
225 // The array *hits contains, in order, fX = hits[0], fY = hits[1],
226 // fZ = hits[2], fPx = hits[3], fPy = hits[4], fPz = hits[5],
227 // fDestep = hits[6], and fTof = hits[7]. In the units of the Monte Carlo
228 ////////////////////////////////////////////////////////////////////////
229 fLayer = vol[0]; // Layer number
230 fLadder = vol[2]; // Ladder number
231 fDet = vol[1]; // Detector number
232 fStatus = vol[3]; // Track status flags
233 fX = hits[0]; // Track X position
234 fY = hits[1]; // Track Y position
235 fZ = hits[2]; // Track Z position
236 fPx = hits[3]; // Track X Momentum
237 fPy = hits[4]; // Track Y Momentum
238 fPz = hits[5]; // Track Z Momentum
239 fDestep = hits[6]; // Track dE/dx for this step
240 fTof = hits[7]; // Track Time of Flight for this step
242 //______________________________________________________________________
243 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z){
244 ////////////////////////////////////////////////////////////////////////
245 // Returns the position of this hit in the local coordinates of this
246 // module, and in the units of the Monte Carlo.
247 ////////////////////////////////////////////////////////////////////////
248 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
255 gm->GtoL(fLayer,fLadder,fDet,g,l);
260 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
261 // AliITSv7 - SDD case
268 //______________________________________________________________________
269 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z,Float_t &tof){
270 ////////////////////////////////////////////////////////////////////////
271 // Returns the position and time of flight of this hit in the local
272 // coordinates of this module, and in the units of the Monte Carlo.
273 ////////////////////////////////////////////////////////////////////////
274 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
281 gm->GtoL(fLayer,fLadder,fDet,g,l);
286 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
287 // AliITSv7 - SDD case
295 //______________________________________________________________________
296 Float_t AliITShit::GetXL(){
297 ////////////////////////////////////////////////////////////////////////
298 // Returns the x position of this hit in the local coordinates of this
299 // module, and in the units of the Monte Carlo.
300 ////////////////////////////////////////////////////////////////////////
301 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
308 gm->GtoL(fLayer,fLadder,fDet,g,l);
311 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
315 //______________________________________________________________________
316 Float_t AliITShit::GetYL(){
317 ////////////////////////////////////////////////////////////////////////
318 // Returns the y position of this hit in the local coordinates of this
319 // module, and in the units of the Monte Carlo.
320 ////////////////////////////////////////////////////////////////////////
321 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
328 gm->GtoL(fLayer,fLadder,fDet,g,l);
331 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
335 //______________________________________________________________________
336 Float_t AliITShit::GetZL(){
337 ////////////////////////////////////////////////////////////////////////
338 // Returns the z position of this hit in the local coordinates of this
339 // module, and in the units of the Monte Carlo.
340 ////////////////////////////////////////////////////////////////////////
341 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
348 gm->GtoL(fLayer,fLadder,fDet,g,l);
351 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
355 //______________________________________________________________________
356 void AliITShit::GetMomentumL(Float_t &px,Float_t &py,Float_t &pz){
357 ////////////////////////////////////////////////////////////////////////
358 // Returns the momentum of this hit in the local coordinates of this
359 // module, and in the units of the Monte Carlo.
360 ////////////////////////////////////////////////////////////////////////
361 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
368 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
373 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
380 //______________________________________________________________________
381 Float_t AliITShit::GetPXL(){
382 ////////////////////////////////////////////////////////////////////////
383 // Returns the X momentum of this hit in the local coordinates of this
384 // module, and in the units of the Monte Carlo.
385 ////////////////////////////////////////////////////////////////////////
386 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
393 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
396 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
400 //______________________________________________________________________
401 Float_t AliITShit::GetPYL(){
402 ////////////////////////////////////////////////////////////////////////
403 // Returns the Y momentum of this hit in the local coordinates of this
404 // module, and in the units of the Monte Carlo.
405 ////////////////////////////////////////////////////////////////////////
406 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
413 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
416 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
421 //______________________________________________________________________
422 Float_t AliITShit::GetPZL(){
423 ////////////////////////////////////////////////////////////////////////
424 // Returns the Z momentum of this hit in the local coordinates of this
425 // module, and in the units of the Monte Carlo.
426 ////////////////////////////////////////////////////////////////////////
427 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
434 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
437 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
442 //___________________________________________________________________________;
443 Int_t AliITShit::GetModule(){
444 ////////////////////////////////////////////////////////////////////////
445 // Returns the module index number of the module where this hit was in.
446 ////////////////////////////////////////////////////////////////////////
447 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
449 if (gm) return gm->GetModuleIndex(fLayer,fLadder,fDet);
451 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
455 //______________________________________________________________________
456 TParticle * AliITShit::GetParticle(){
457 ////////////////////////////////////////////////////////////////////////
458 // Returns the pointer to the TParticle for the particle that created
459 // this hit. From the TParticle all kinds of information about this
460 // particle can be found. See the TParticle class.
461 ////////////////////////////////////////////////////////////////////////
462 TClonesArray *parts = gAlice->Particles();
463 return ((TParticle*)parts->UncheckedAt(this->GetTrack()));
466 //___________________________________________________________________________
467 void AliITShit::Streamer(TBuffer &R__b){
468 ////////////////////////////////////////////////////////////////////////
469 // The streamer function for this AliITShit class. This has been set
470 // up so that future changes to this class can be easly incorporated.
471 ////////////////////////////////////////////////////////////////////////
472 if (R__b.IsReading()) {
473 Version_t R__v = R__b.ReadVersion();
475 AliHit::Streamer(R__b);
485 }else{ // for futrue changes to this class.
488 R__b.WriteVersion(AliITShit::IsA());
489 AliHit::Streamer(R__b);
499 } // end if R__b.IsReading()