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.7 2000/07/10 16:07:18 fca
19 Release version of ITS code
21 Revision 1.3.4.2 2000/03/04 23:43:57 nilsen
22 Fixed up the comments/documentation.
24 Revision 1.3.4.1 2000/01/12 19:03:32 nilsen
25 This is the version of the files after the merging done in December 1999.
26 See the ReadMe110100.txt file for details
28 Revision 1.3 1999/09/29 09:24:20 fca
29 Introduction of the Copyright and cvs Log
37 #include <TGeometry.h>
40 #include "TParticle.h"
44 #include "AliITSgeom.h"
45 #include "AliITShit.h"
49 ////////////////////////////////////////////////////////////////////////
51 // Written by Rene Brun, Federico Carminati, and Roberto Barbera
54 // Modified and documented by Bjorn S. Nilsen
57 // AliITShit is the hit class for the ITS. Hits are the information
58 // that comes from a Monte Carlo at each step as a particle mass through
59 // sensitive detector elements as particles are transported through a
64 <img src="picts/ITS/AliITShit_Class_Diagram.gif">
67 <font size=+2 color=red>
68 <p>This show the relasionships between the ITS hit class and the rest of Aliroot.
73 ////////////////////////////////////////////////////////////////////////
74 // Inline Member functions:
77 // The default creator of the AliITShit class.
80 // The default destructor of the AliITShit class.
83 // See AliHit for a full description. Returns the track number fTrack
86 // SetTrack(int track)
87 // See AliHit for a full description. Sets the track number fTrack
90 // Int_t GetTrackStatus()
91 // Returns the value of the track status flag fStatus. This flag
92 // indicates the track status at the time of creating this hit. It is
93 // made up of the following 8 status bits from highest order to lowest
95 // 0 : IsTrackAlive(): IsTrackStop():IsTrackDisappeared():
96 // IsTrackOut():IsTrackExiting():IsTrackEntering():IsTrackInside() .
97 // See AliMC for a description of these functions. If the function is
98 // true then the bit is set to one, otherwise it is zero.
100 // Bool_t StatusInside()
101 // Returns kTRUE if the particle producing this hit is still inside
102 // the present volume. Returns kFalse if this particle will be in another
103 // volume. {bit IsTrackInside is set or not}
105 // Bool_t StatusEntering()
106 // Returns kTRUE if the particle producing this hit is has just enterd
107 // the present volume. Returns kFalse otherwise. {bit IsTrackEntering is
110 // Bool_t StatusExiting()
111 // Returns kTRUE if the particle producing this hit is will exit
112 // the present volume. Returns kFalse otherwise. {bit IsTrackExiting is set
115 // Bool_t StatusOut()
116 // Returns kTRUE if the particle producing this hit is goint exit the
117 // simulation. Returns kFalse otherwise. {bit IsTrackOut is set or not}
119 // Bool_t StatusDisappeared()
120 // Returns kTRUE if the particle producing this hit is going to "disappear"
121 // for example it has interacted producing some other particles. Returns
122 // kFalse otherwise. {bit IsTrackOut is set or not}
124 // Bool_t StatusStop()
125 // Returns kTRUE if the particle producing this hit is has dropped below
126 // its energy cut off producing some other particles. Returns kFalse otherwise.
127 // {bit IsTrackOut is set or not}
129 // Bool_t StatuAlives()
130 // Returns kTRUE if the particle producing this hit is going to continue
131 // to be transported. Returns kFalse otherwise. {bit IsTrackOut is set or not}
134 // Returns the layer number, fLayer, for this hit.
137 // Returns the ladder number, fLadder, for this hit.
139 // Int_t GetDetector()
140 // Returns the detector number, fDet, for this hit.
142 // GetDetectorID(Int_t &layer, Int_t &ladder, Int_t &detector)
143 // Returns the layer, ladder, and detector numbers, fLayer fLadder fDet,
146 // Float_t GetIonization()
147 // Returns the energy lost, fDestep, by the particle creating this hit,
148 // in the units defined by the Monte Carlo.
150 // GetPositionG(Float_t &x, Float_t &y, Float_t &z)
151 // Returns the global position, fX fY fZ, of this hit, in the units
152 // define by the Monte Carlo.
154 // GetPositionG(Double_t &x, Double_t &y, Double_t &z)
155 // Returns the global position, fX fY fZ, of this hit, in the units
156 // define by the Monte Carlo.
158 // GetPositionG(Float_t &x, Float_t &y, Float_t &z, Float_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.
162 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
163 // Returns the global position and time of flight, fX fY fZ fTof, of
164 // this hit, in the units define by the Monte Carlo.
166 // GetPositionL(Double_t &x,Double_t &y,Double_t &z)
167 // Returns the local position, fX fY fZ, of this hit in the coordiante
168 // of this module, in the units define by the Monte Carlo.
170 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
171 // Returns the local position and time of flight, fX fY fZ fTof, of
172 // this hit in the coordinates of this module, in the units define by the
176 // Returns the global x position in the units defined by the Monte Carlo.
179 // Returns the global y position in the units defined by the Monte Carlo.
182 // Returns the global z position in the units defined by the Monte Carlo.
185 // Returns the time of flight, fTof, of this hit, in the units defined
186 // by the Monte Carlo.
188 // GetMomentumG(Float_t &px, Float_t &py, Float_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.
192 // GetMomentumG(Double_t &px,Double_t &py,Double_t &pz)
193 // Returns the global momentum, fPx fPy fPz, of the particle that made
194 // this hit, in the units define by the Monte Carlo.
196 // GetMomentumL(Double_t &px,Double_t &py,Double_t &pz)
197 // Returns the momentum, fPx fPy fPz in coordinate appropreate for this
198 // specific module, in the units define by the Monte Carlo.
201 // Returns the global X momentum in the units defined by the Monte Carlo.
204 // Returns the global Y momentum in the units defined by the Monte Carlo.
207 // Returns the global Z momentum in the units defined by the Monte Carlo.
209 ////////////////////////////////////////////////////////////////////////
210 //_____________________________________________________________________________
211 AliITShit::AliITShit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
212 AliHit(shunt, track){
213 ////////////////////////////////////////////////////////////////////////
215 // The creator of the AliITShit class. The variables shunt and
216 // track are passed to the creator of the AliHit class. See the AliHit
217 // class for a full description. the integer array *vol contains, in order,
218 // fLayer = vol[0], fDet = vol[1], fLadder = vol[2], fStatus = vol[3].
219 // The array *hits contains, in order, fX = hits[0], fY = hits[1],
220 // fZ = hits[2], fPx = hits[3], fPy = hits[4], fPz = hits[5],
221 // fDestep = hits[6], and fTof = hits[7]. In the units of the Monte Carlo
222 ////////////////////////////////////////////////////////////////////////
223 fLayer = vol[0]; // Layer number
224 fLadder = vol[2]; // Ladder number
225 fDet = vol[1]; // Detector number
226 fStatus = vol[3]; // Track status flags
227 fX = hits[0]; // Track X position
228 fY = hits[1]; // Track Y position
229 fZ = hits[2]; // Track Z position
230 fPx = hits[3]; // Track X Momentum
231 fPy = hits[4]; // Track Y Momentum
232 fPz = hits[5]; // Track Z Momentum
233 fDestep = hits[6]; // Track dE/dx for this step
234 fTof = hits[7]; // Track Time of Flight for this step
236 //______________________________________________________________________
237 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z){
238 ////////////////////////////////////////////////////////////////////////
239 // Returns the position of this hit in the local coordinates of this
240 // module, and in the units of the Monte Carlo.
241 ////////////////////////////////////////////////////////////////////////
242 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
249 gm->GtoL(fLayer,fLadder,fDet,g,l);
254 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
255 // AliITSv7 - SDD case
262 //______________________________________________________________________
263 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z,Float_t &tof){
264 ////////////////////////////////////////////////////////////////////////
265 // Returns the position and time of flight of this hit in the local
266 // coordinates of this module, and in the units of the Monte Carlo.
267 ////////////////////////////////////////////////////////////////////////
268 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
275 gm->GtoL(fLayer,fLadder,fDet,g,l);
280 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
281 // AliITSv7 - SDD case
289 //______________________________________________________________________
290 Float_t AliITShit::GetXL(){
291 ////////////////////////////////////////////////////////////////////////
292 // Returns the x position of this hit in the local coordinates of this
293 // module, and in the units of the Monte Carlo.
294 ////////////////////////////////////////////////////////////////////////
295 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
302 gm->GtoL(fLayer,fLadder,fDet,g,l);
305 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
309 //______________________________________________________________________
310 Float_t AliITShit::GetYL(){
311 ////////////////////////////////////////////////////////////////////////
312 // Returns the y position of this hit in the local coordinates of this
313 // module, and in the units of the Monte Carlo.
314 ////////////////////////////////////////////////////////////////////////
315 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
322 gm->GtoL(fLayer,fLadder,fDet,g,l);
325 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
329 //______________________________________________________________________
330 Float_t AliITShit::GetZL(){
331 ////////////////////////////////////////////////////////////////////////
332 // Returns the z position of this hit in the local coordinates of this
333 // module, and in the units of the Monte Carlo.
334 ////////////////////////////////////////////////////////////////////////
335 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
342 gm->GtoL(fLayer,fLadder,fDet,g,l);
345 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
349 //______________________________________________________________________
350 void AliITShit::GetMomentumL(Float_t &px,Float_t &py,Float_t &pz){
351 ////////////////////////////////////////////////////////////////////////
352 // Returns the momentum of this hit in the local coordinates of this
353 // module, and in the units of the Monte Carlo.
354 ////////////////////////////////////////////////////////////////////////
355 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
362 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
367 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
374 //______________________________________________________________________
375 Float_t AliITShit::GetPXL(){
376 ////////////////////////////////////////////////////////////////////////
377 // Returns the X momentum of this hit in the local coordinates of this
378 // module, and in the units of the Monte Carlo.
379 ////////////////////////////////////////////////////////////////////////
380 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
387 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
390 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
394 //______________________________________________________________________
395 Float_t AliITShit::GetPYL(){
396 ////////////////////////////////////////////////////////////////////////
397 // Returns the Y momentum of this hit in the local coordinates of this
398 // module, and in the units of the Monte Carlo.
399 ////////////////////////////////////////////////////////////////////////
400 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
407 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
410 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
415 //______________________________________________________________________
416 Float_t AliITShit::GetPZL(){
417 ////////////////////////////////////////////////////////////////////////
418 // Returns the Z momentum of this hit in the local coordinates of this
419 // module, and in the units of the Monte Carlo.
420 ////////////////////////////////////////////////////////////////////////
421 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
428 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
431 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
436 //___________________________________________________________________________;
437 Int_t AliITShit::GetModule(){
438 ////////////////////////////////////////////////////////////////////////
439 // Returns the module index number of the module where this hit was in.
440 ////////////////////////////////////////////////////////////////////////
441 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
443 if (gm) return gm->GetModuleIndex(fLayer,fLadder,fDet);
445 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
449 //______________________________________________________________________
450 TParticle * AliITShit::GetParticle(){
451 ////////////////////////////////////////////////////////////////////////
452 // Returns the pointer to the TParticle for the particle that created
453 // this hit. From the TParticle all kinds of information about this
454 // particle can be found. See the TParticle class.
455 ////////////////////////////////////////////////////////////////////////
456 TClonesArray *parts = gAlice->Particles();
457 return ((TParticle*)parts->UncheckedAt(this->GetTrack()));
459 //___________________________________________________________________________
460 void AliITShit::Streamer(TBuffer &R__b){
461 ////////////////////////////////////////////////////////////////////////
462 // The streamer function for this AliITShit class. This has been set
463 // up so that future changes to this class can be easly incorporated.
464 ////////////////////////////////////////////////////////////////////////
465 if (R__b.IsReading()) {
466 Version_t R__v = R__b.ReadVersion();
468 AliHit::Streamer(R__b);
478 }else{ // for futrue changes to this class.
481 R__b.WriteVersion(AliITShit::IsA());
482 AliHit::Streamer(R__b);
492 } // end if R__b.IsReading()