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.12 2002/03/08 16:05:05 nilsen
19 Standeard io streamers added to make debugging et al. easier.
21 Revision 1.11 2001/01/30 09:23:13 hristov
22 Streamers removed (R.Brun)
24 Revision 1.10 2001/01/26 20:01:19 hristov
25 Major upgrade of AliRoot code
27 Revision 1.9 2000/10/02 16:32:51 barbera
28 Automatic streamer used and forward declarations added
30 Revision 1.3.4.7 2000/10/02 15:54:49 barbera
31 Automatic streamer used and forward declarations added
33 Revision 1.8 2000/09/22 12:35:21 nilsen
34 Traps placed incase it is used without a properly initilized AliITSgeom class.
36 Revision 1.7 2000/07/10 16:07:18 fca
37 Release version of ITS code
39 Revision 1.3.4.2 2000/03/04 23:43:57 nilsen
40 Fixed up the comments/documentation.
42 Revision 1.3.4.1 2000/01/12 19:03:32 nilsen
43 This is the version of the files after the merging done in December 1999.
44 See the ReadMe110100.txt file for details
46 Revision 1.3 1999/09/29 09:24:20 fca
47 Introduction of the Copyright and cvs Log
56 #include <TGeometry.h>
59 #include "TParticle.h"
63 #include "AliITSgeom.h"
64 #include "AliITShit.h"
68 ////////////////////////////////////////////////////////////////////////
70 // Written by Rene Brun, Federico Carminati, and Roberto Barbera
73 // Modified and documented by Bjorn S. Nilsen
76 // AliITShit is the hit class for the ITS. Hits are the information
77 // that comes from a Monte Carlo at each step as a particle mass through
78 // sensitive detector elements as particles are transported through a
83 <img src="picts/ITS/AliITShit_Class_Diagram.gif">
86 <font size=+2 color=red>
87 <p>This show the relasionships between the ITS hit class and the rest of Aliroot.
92 ////////////////////////////////////////////////////////////////////////
93 // Inline Member functions:
96 // The default creator of the AliITShit class.
99 // The default destructor of the AliITShit class.
102 // See AliHit for a full description. Returns the track number fTrack
105 // SetTrack(int track)
106 // See AliHit for a full description. Sets the track number fTrack
109 // Int_t GetTrackStatus()
110 // Returns the value of the track status flag fStatus. This flag
111 // indicates the track status at the time of creating this hit. It is
112 // made up of the following 8 status bits from highest order to lowest
114 // 0 : IsTrackAlive(): IsTrackStop():IsTrackDisappeared():
115 // IsTrackOut():IsTrackExiting():IsTrackEntering():IsTrackInside() .
116 // See AliMC for a description of these functions. If the function is
117 // true then the bit is set to one, otherwise it is zero.
119 // Bool_t StatusInside()
120 // Returns kTRUE if the particle producing this hit is still inside
121 // the present volume. Returns kFalse if this particle will be in another
122 // volume. {bit IsTrackInside is set or not}
124 // Bool_t StatusEntering()
125 // Returns kTRUE if the particle producing this hit is has just enterd
126 // the present volume. Returns kFalse otherwise. {bit IsTrackEntering is
129 // Bool_t StatusExiting()
130 // Returns kTRUE if the particle producing this hit is will exit
131 // the present volume. Returns kFalse otherwise. {bit IsTrackExiting is set
134 // Bool_t StatusOut()
135 // Returns kTRUE if the particle producing this hit is goint exit the
136 // simulation. Returns kFalse otherwise. {bit IsTrackOut is set or not}
138 // Bool_t StatusDisappeared()
139 // Returns kTRUE if the particle producing this hit is going to "disappear"
140 // for example it has interacted producing some other particles. Returns
141 // kFalse otherwise. {bit IsTrackOut is set or not}
143 // Bool_t StatusStop()
144 // Returns kTRUE if the particle producing this hit is has dropped below
145 // its energy cut off producing some other particles. Returns kFalse otherwise.
146 // {bit IsTrackOut is set or not}
148 // Bool_t StatuAlives()
149 // Returns kTRUE if the particle producing this hit is going to continue
150 // to be transported. Returns kFalse otherwise. {bit IsTrackOut is set or not}
153 // Returns the layer number, fLayer, for this hit.
156 // Returns the ladder number, fLadder, for this hit.
158 // Int_t GetDetector()
159 // Returns the detector number, fDet, for this hit.
161 // GetDetectorID(Int_t &layer, Int_t &ladder, Int_t &detector)
162 // Returns the layer, ladder, and detector numbers, fLayer fLadder fDet,
165 // Float_t GetIonization()
166 // Returns the energy lost, fDestep, by the particle creating this hit,
167 // in the units defined by the Monte Carlo.
169 // GetPositionG(Float_t &x, Float_t &y, Float_t &z)
170 // Returns the global position, fX fY fZ, of this hit, in the units
171 // define by the Monte Carlo.
173 // GetPositionG(Double_t &x, Double_t &y, Double_t &z)
174 // Returns the global position, fX fY fZ, of this hit, in the units
175 // define by the Monte Carlo.
177 // GetPositionG(Float_t &x, Float_t &y, Float_t &z, Float_t &tof)
178 // Returns the global position and time of flight, fX fY fZ fTof, of
179 // this hit, in the units define by the Monte Carlo.
181 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
182 // Returns the global position and time of flight, fX fY fZ fTof, of
183 // this hit, in the units define by the Monte Carlo.
185 // GetPositionL(Double_t &x,Double_t &y,Double_t &z)
186 // Returns the local position, fX fY fZ, of this hit in the coordiante
187 // of this module, in the units define by the Monte Carlo.
189 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
190 // Returns the local position and time of flight, fX fY fZ fTof, of
191 // this hit in the coordinates of this module, in the units define by the
195 // Returns the global x position in the units defined by the Monte Carlo.
198 // Returns the global y position in the units defined by the Monte Carlo.
201 // Returns the global z position in the units defined by the Monte Carlo.
204 // Returns the time of flight, fTof, of this hit, in the units defined
205 // by the Monte Carlo.
207 // GetMomentumG(Float_t &px, Float_t &py, Float_t &pz)
208 // Returns the global momentum, fPx fPy fPz, of the particle that made
209 // this hit, in the units define by the Monte Carlo.
211 // GetMomentumG(Double_t &px,Double_t &py,Double_t &pz)
212 // Returns the global momentum, fPx fPy fPz, of the particle that made
213 // this hit, in the units define by the Monte Carlo.
215 // GetMomentumL(Double_t &px,Double_t &py,Double_t &pz)
216 // Returns the momentum, fPx fPy fPz in coordinate appropreate for this
217 // specific module, in the units define by the Monte Carlo.
220 // Returns the global X momentum in the units defined by the Monte Carlo.
223 // Returns the global Y momentum in the units defined by the Monte Carlo.
226 // Returns the global Z momentum in the units defined by the Monte Carlo.
228 ////////////////////////////////////////////////////////////////////////
229 //_____________________________________________________________________________
230 AliITShit::AliITShit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
231 AliHit(shunt, track){
232 ////////////////////////////////////////////////////////////////////////
234 // The creator of the AliITShit class. The variables shunt and
235 // track are passed to the creator of the AliHit class. See the AliHit
236 // class for a full description. the integer array *vol contains, in order,
237 // fLayer = vol[0], fDet = vol[1], fLadder = vol[2], fStatus = vol[3].
238 // The array *hits contains, in order, fX = hits[0], fY = hits[1],
239 // fZ = hits[2], fPx = hits[3], fPy = hits[4], fPz = hits[5],
240 // fDestep = hits[6], and fTof = hits[7]. In the units of the Monte Carlo
241 ////////////////////////////////////////////////////////////////////////
242 fLayer = vol[0]; // Layer number
243 fLadder = vol[2]; // Ladder number
244 fDet = vol[1]; // Detector number
245 fStatus = vol[3]; // Track status flags
246 fX = hits[0]; // Track X position
247 fY = hits[1]; // Track Y position
248 fZ = hits[2]; // Track Z position
249 fPx = hits[3]; // Track X Momentum
250 fPy = hits[4]; // Track Y Momentum
251 fPz = hits[5]; // Track Z Momentum
252 fDestep = hits[6]; // Track dE/dx for this step
253 fTof = hits[7]; // Track Time of Flight for this step
255 //______________________________________________________________________
256 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z){
257 ////////////////////////////////////////////////////////////////////////
258 // Returns the position of this hit in the local coordinates of this
259 // module, and in the units of the Monte Carlo.
260 ////////////////////////////////////////////////////////////////////////
261 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
268 gm->GtoL(fLayer,fLadder,fDet,g,l);
273 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
274 // AliITSv7 - SDD case
281 //______________________________________________________________________
282 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z,Float_t &tof){
283 ////////////////////////////////////////////////////////////////////////
284 // Returns the position and time of flight of this hit in the local
285 // coordinates of this module, and in the units of the Monte Carlo.
286 ////////////////////////////////////////////////////////////////////////
287 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
294 gm->GtoL(fLayer,fLadder,fDet,g,l);
299 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
300 // AliITSv7 - SDD case
308 //______________________________________________________________________
309 Float_t AliITShit::GetXL(){
310 ////////////////////////////////////////////////////////////////////////
311 // Returns the x position of this hit in the local coordinates of this
312 // module, and in the units of the Monte Carlo.
313 ////////////////////////////////////////////////////////////////////////
314 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
321 gm->GtoL(fLayer,fLadder,fDet,g,l);
324 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
328 //______________________________________________________________________
329 Float_t AliITShit::GetYL(){
330 ////////////////////////////////////////////////////////////////////////
331 // Returns the y position of this hit in the local coordinates of this
332 // module, and in the units of the Monte Carlo.
333 ////////////////////////////////////////////////////////////////////////
334 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
341 gm->GtoL(fLayer,fLadder,fDet,g,l);
344 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
348 //______________________________________________________________________
349 Float_t AliITShit::GetZL(){
350 ////////////////////////////////////////////////////////////////////////
351 // Returns the z position of this hit in the local coordinates of this
352 // module, and in the units of the Monte Carlo.
353 ////////////////////////////////////////////////////////////////////////
354 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
361 gm->GtoL(fLayer,fLadder,fDet,g,l);
364 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
368 //______________________________________________________________________
369 void AliITShit::GetMomentumL(Float_t &px,Float_t &py,Float_t &pz){
370 ////////////////////////////////////////////////////////////////////////
371 // Returns the momentum of this hit in the local coordinates of this
372 // module, and in the units of the Monte Carlo.
373 ////////////////////////////////////////////////////////////////////////
374 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
381 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
386 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
393 //______________________________________________________________________
394 Float_t AliITShit::GetPXL(){
395 ////////////////////////////////////////////////////////////////////////
396 // Returns the X momentum of this hit in the local coordinates of this
397 // module, and in the units of the Monte Carlo.
398 ////////////////////////////////////////////////////////////////////////
399 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
406 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
409 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
413 //______________________________________________________________________
414 Float_t AliITShit::GetPYL(){
415 ////////////////////////////////////////////////////////////////////////
416 // Returns the Y momentum of this hit in the local coordinates of this
417 // module, and in the units of the Monte Carlo.
418 ////////////////////////////////////////////////////////////////////////
419 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
426 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
429 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
434 //______________________________________________________________________
435 Float_t AliITShit::GetPZL(){
436 ////////////////////////////////////////////////////////////////////////
437 // Returns the Z momentum of this hit in the local coordinates of this
438 // module, and in the units of the Monte Carlo.
439 ////////////////////////////////////////////////////////////////////////
440 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
447 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
450 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
455 //___________________________________________________________________________;
456 Int_t AliITShit::GetModule(){
457 ////////////////////////////////////////////////////////////////////////
458 // Returns the module index number of the module where this hit was in.
459 ////////////////////////////////////////////////////////////////////////
460 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
462 if (gm) return gm->GetModuleIndex(fLayer,fLadder,fDet);
464 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
468 //______________________________________________________________________
469 TParticle * AliITShit::GetParticle(){
470 ////////////////////////////////////////////////////////////////////////
471 // Returns the pointer to the TParticle for the particle that created
472 // this hit. From the TParticle all kinds of information about this
473 // particle can be found. See the TParticle class.
474 ////////////////////////////////////////////////////////////////////////
475 return gAlice->Particle(GetTrack());
477 //----------------------------------------------------------------------
478 void AliITShit::Print(ostream *os){
479 ////////////////////////////////////////////////////////////////////////
480 // Standard output format for this class.
481 ////////////////////////////////////////////////////////////////////////
492 fmt = os->setf(ios::scientific); // set scientific floating point output
493 *os << fTrack << " " << fX << " " << fY << " " << fZ << " ";
494 fmt = os->setf(ios::hex); // set hex for fStatus only.
495 *os << fStatus << " ";
496 fmt = os->setf(ios::dec); // every thing else decimel.
497 *os << fLayer << " " << fLadder << " " << fDet << " ";;
498 *os << fPx << " " << fPy << " " << fPz << " ";
499 *os << fDestep << " " << fTof;
501 os->flags(fmt); // reset back to old formating.
504 //----------------------------------------------------------------------
505 void AliITShit::Read(istream *is){
506 ////////////////////////////////////////////////////////////////////////
507 // Standard input format for this class.
508 ////////////////////////////////////////////////////////////////////////
511 *is >> fTrack >> fX >> fY >> fZ;
512 *is >> fStatus >> fLayer >> fLadder >> fDet >> fPx >> fPy >> fPz >>
516 //----------------------------------------------------------------------
517 ostream &operator<<(ostream &os,AliITShit &p){
518 ////////////////////////////////////////////////////////////////////////
519 // Standard output streaming function.
520 ////////////////////////////////////////////////////////////////////////
525 //----------------------------------------------------------------------
526 istream &operator>>(istream &is,AliITShit &r){
527 ////////////////////////////////////////////////////////////////////////
528 // Standard input streaming function.
529 ////////////////////////////////////////////////////////////////////////
534 //----------------------------------------------------------------------