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.13 2002/03/09 18:35:35 nilsen
19 Added functions to print out Hit data members.
21 Revision 1.12 2002/03/08 16:05:05 nilsen
22 Standeard io streamers added to make debugging et al. easier.
24 Revision 1.11 2001/01/30 09:23:13 hristov
25 Streamers removed (R.Brun)
27 Revision 1.10 2001/01/26 20:01:19 hristov
28 Major upgrade of AliRoot code
30 Revision 1.9 2000/10/02 16:32:51 barbera
31 Automatic streamer used and forward declarations added
33 Revision 1.3.4.7 2000/10/02 15:54:49 barbera
34 Automatic streamer used and forward declarations added
36 Revision 1.8 2000/09/22 12:35:21 nilsen
37 Traps placed incase it is used without a properly initilized AliITSgeom class.
39 Revision 1.7 2000/07/10 16:07:18 fca
40 Release version of ITS code
42 Revision 1.3.4.2 2000/03/04 23:43:57 nilsen
43 Fixed up the comments/documentation.
45 Revision 1.3.4.1 2000/01/12 19:03:32 nilsen
46 This is the version of the files after the merging done in December 1999.
47 See the ReadMe110100.txt file for details
49 Revision 1.3 1999/09/29 09:24:20 fca
50 Introduction of the Copyright and cvs Log
59 #include <TGeometry.h>
62 #include "TParticle.h"
66 #include "AliITSgeom.h"
67 #include "AliITShit.h"
71 ////////////////////////////////////////////////////////////////////////
73 // Written by Rene Brun, Federico Carminati, and Roberto Barbera
76 // Modified and documented by Bjorn S. Nilsen
79 // AliITShit is the hit class for the ITS. Hits are the information
80 // that comes from a Monte Carlo at each step as a particle mass through
81 // sensitive detector elements as particles are transported through a
86 <img src="picts/ITS/AliITShit_Class_Diagram.gif">
89 <font size=+2 color=red>
90 <p>This show the relasionships between the ITS hit class and the rest of Aliroot.
95 ////////////////////////////////////////////////////////////////////////
96 // Inline Member functions:
99 // The default creator of the AliITShit class.
102 // The default destructor of the AliITShit class.
105 // See AliHit for a full description. Returns the track number fTrack
108 // SetTrack(int track)
109 // See AliHit for a full description. Sets the track number fTrack
112 // Int_t GetTrackStatus()
113 // Returns the value of the track status flag fStatus. This flag
114 // indicates the track status at the time of creating this hit. It is
115 // made up of the following 8 status bits from highest order to lowest
117 // 0 : IsTrackAlive(): IsTrackStop():IsTrackDisappeared():
118 // IsTrackOut():IsTrackExiting():IsTrackEntering():IsTrackInside() .
119 // See AliMC for a description of these functions. If the function is
120 // true then the bit is set to one, otherwise it is zero.
122 // Bool_t StatusInside()
123 // Returns kTRUE if the particle producing this hit is still inside
124 // the present volume. Returns kFalse if this particle will be in another
125 // volume. {bit IsTrackInside is set or not}
127 // Bool_t StatusEntering()
128 // Returns kTRUE if the particle producing this hit is has just enterd
129 // the present volume. Returns kFalse otherwise. {bit IsTrackEntering is
132 // Bool_t StatusExiting()
133 // Returns kTRUE if the particle producing this hit is will exit
134 // the present volume. Returns kFalse otherwise. {bit IsTrackExiting is set
137 // Bool_t StatusOut()
138 // Returns kTRUE if the particle producing this hit is goint exit the
139 // simulation. Returns kFalse otherwise. {bit IsTrackOut is set or not}
141 // Bool_t StatusDisappeared()
142 // Returns kTRUE if the particle producing this hit is going to "disappear"
143 // for example it has interacted producing some other particles. Returns
144 // kFalse otherwise. {bit IsTrackOut is set or not}
146 // Bool_t StatusStop()
147 // Returns kTRUE if the particle producing this hit is has dropped below
148 // its energy cut off producing some other particles. Returns kFalse otherwise.
149 // {bit IsTrackOut is set or not}
151 // Bool_t StatuAlives()
152 // Returns kTRUE if the particle producing this hit is going to continue
153 // to be transported. Returns kFalse otherwise. {bit IsTrackOut is set or not}
156 // Returns the layer number, fLayer, for this hit.
159 // Returns the ladder number, fLadder, for this hit.
161 // Int_t GetDetector()
162 // Returns the detector number, fDet, for this hit.
164 // GetDetectorID(Int_t &layer, Int_t &ladder, Int_t &detector)
165 // Returns the layer, ladder, and detector numbers, fLayer fLadder fDet,
168 // Float_t GetIonization()
169 // Returns the energy lost, fDestep, by the particle creating this hit,
170 // in the units defined by the Monte Carlo.
172 // GetPositionG(Float_t &x, Float_t &y, Float_t &z)
173 // Returns the global position, fX fY fZ, of this hit, in the units
174 // define by the Monte Carlo.
176 // GetPositionG(Double_t &x, Double_t &y, Double_t &z)
177 // Returns the global position, fX fY fZ, of this hit, in the units
178 // define by the Monte Carlo.
180 // GetPositionG(Float_t &x, Float_t &y, Float_t &z, Float_t &tof)
181 // Returns the global position and time of flight, fX fY fZ fTof, of
182 // this hit, in the units define by the Monte Carlo.
184 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
185 // Returns the global position and time of flight, fX fY fZ fTof, of
186 // this hit, in the units define by the Monte Carlo.
188 // GetPositionL(Double_t &x,Double_t &y,Double_t &z)
189 // Returns the local position, fX fY fZ, of this hit in the coordiante
190 // of this module, in the units define by the Monte Carlo.
192 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
193 // Returns the local position and time of flight, fX fY fZ fTof, of
194 // this hit in the coordinates of this module, in the units define by the
198 // Returns the global x position in the units defined by the Monte Carlo.
201 // Returns the global y position in the units defined by the Monte Carlo.
204 // Returns the global z position in the units defined by the Monte Carlo.
207 // Returns the time of flight, fTof, of this hit, in the units defined
208 // by the Monte Carlo.
210 // GetMomentumG(Float_t &px, Float_t &py, Float_t &pz)
211 // Returns the global momentum, fPx fPy fPz, of the particle that made
212 // this hit, in the units define by the Monte Carlo.
214 // GetMomentumG(Double_t &px,Double_t &py,Double_t &pz)
215 // Returns the global momentum, fPx fPy fPz, of the particle that made
216 // this hit, in the units define by the Monte Carlo.
218 // GetMomentumL(Double_t &px,Double_t &py,Double_t &pz)
219 // Returns the momentum, fPx fPy fPz in coordinate appropreate for this
220 // specific module, in the units define by the Monte Carlo.
223 // Returns the global X momentum in the units defined by the Monte Carlo.
226 // Returns the global Y momentum in the units defined by the Monte Carlo.
229 // Returns the global Z momentum in the units defined by the Monte Carlo.
231 ////////////////////////////////////////////////////////////////////////
232 //_____________________________________________________________________________
233 AliITShit::AliITShit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
234 AliHit(shunt, track){
235 ////////////////////////////////////////////////////////////////////////
237 // The creator of the AliITShit class. The variables shunt and
238 // track are passed to the creator of the AliHit class. See the AliHit
239 // class for a full description. the integer array *vol contains, in order,
240 // fLayer = vol[0], fDet = vol[1], fLadder = vol[2], fStatus = vol[3].
241 // The array *hits contains, in order, fX = hits[0], fY = hits[1],
242 // fZ = hits[2], fPx = hits[3], fPy = hits[4], fPz = hits[5],
243 // fDestep = hits[6], and fTof = hits[7]. In the units of the Monte Carlo
244 ////////////////////////////////////////////////////////////////////////
245 fLayer = vol[0]; // Layer number
246 fLadder = vol[2]; // Ladder number
247 fDet = vol[1]; // Detector number
248 fStatus = vol[3]; // Track status flags
249 fX = hits[0]; // Track X position
250 fY = hits[1]; // Track Y position
251 fZ = hits[2]; // Track Z position
252 fPx = hits[3]; // Track X Momentum
253 fPy = hits[4]; // Track Y Momentum
254 fPz = hits[5]; // Track Z Momentum
255 fDestep = hits[6]; // Track dE/dx for this step
256 fTof = hits[7]; // Track Time of Flight for this step
258 //______________________________________________________________________
259 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z){
260 ////////////////////////////////////////////////////////////////////////
261 // Returns the position of this hit in the local coordinates of this
262 // module, and in the units of the Monte Carlo.
263 ////////////////////////////////////////////////////////////////////////
264 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
271 gm->GtoL(fLayer,fLadder,fDet,g,l);
276 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
277 // AliITSv7 - SDD case
284 //______________________________________________________________________
285 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z,Float_t &tof){
286 ////////////////////////////////////////////////////////////////////////
287 // Returns the position and time of flight of this hit in the local
288 // coordinates of this module, and in the units of the Monte Carlo.
289 ////////////////////////////////////////////////////////////////////////
290 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
297 gm->GtoL(fLayer,fLadder,fDet,g,l);
302 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
303 // AliITSv7 - SDD case
311 //______________________________________________________________________
312 Float_t AliITShit::GetXL(){
313 ////////////////////////////////////////////////////////////////////////
314 // Returns the x position of this hit in the local coordinates of this
315 // module, and in the units of the Monte Carlo.
316 ////////////////////////////////////////////////////////////////////////
317 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
324 gm->GtoL(fLayer,fLadder,fDet,g,l);
327 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
331 //______________________________________________________________________
332 Float_t AliITShit::GetYL(){
333 ////////////////////////////////////////////////////////////////////////
334 // Returns the y position of this hit in the local coordinates of this
335 // module, and in the units of the Monte Carlo.
336 ////////////////////////////////////////////////////////////////////////
337 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
344 gm->GtoL(fLayer,fLadder,fDet,g,l);
347 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
351 //______________________________________________________________________
352 Float_t AliITShit::GetZL(){
353 ////////////////////////////////////////////////////////////////////////
354 // Returns the z position of this hit in the local coordinates of this
355 // module, and in the units of the Monte Carlo.
356 ////////////////////////////////////////////////////////////////////////
357 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
364 gm->GtoL(fLayer,fLadder,fDet,g,l);
367 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
371 //______________________________________________________________________
372 void AliITShit::GetMomentumL(Float_t &px,Float_t &py,Float_t &pz){
373 ////////////////////////////////////////////////////////////////////////
374 // Returns the momentum of this hit in the local coordinates of this
375 // module, and in the units of the Monte Carlo.
376 ////////////////////////////////////////////////////////////////////////
377 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
384 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
389 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
396 //______________________________________________________________________
397 Float_t AliITShit::GetPXL(){
398 ////////////////////////////////////////////////////////////////////////
399 // Returns the X momentum of this hit in the local coordinates of this
400 // module, and in the units of the Monte Carlo.
401 ////////////////////////////////////////////////////////////////////////
402 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
409 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
412 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
416 //______________________________________________________________________
417 Float_t AliITShit::GetPYL(){
418 ////////////////////////////////////////////////////////////////////////
419 // Returns the Y momentum of this hit in the local coordinates of this
420 // module, and in the units of the Monte Carlo.
421 ////////////////////////////////////////////////////////////////////////
422 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
429 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
432 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
437 //______________________________________________________________________
438 Float_t AliITShit::GetPZL(){
439 ////////////////////////////////////////////////////////////////////////
440 // Returns the Z momentum of this hit in the local coordinates of this
441 // module, and in the units of the Monte Carlo.
442 ////////////////////////////////////////////////////////////////////////
443 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
450 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
453 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
458 //___________________________________________________________________________;
459 Int_t AliITShit::GetModule(){
460 ////////////////////////////////////////////////////////////////////////
461 // Returns the module index number of the module where this hit was in.
462 ////////////////////////////////////////////////////////////////////////
463 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
465 if (gm) return gm->GetModuleIndex(fLayer,fLadder,fDet);
467 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
471 //______________________________________________________________________
472 TParticle * AliITShit::GetParticle(){
473 ////////////////////////////////////////////////////////////////////////
474 // Returns the pointer to the TParticle for the particle that created
475 // this hit. From the TParticle all kinds of information about this
476 // particle can be found. See the TParticle class.
477 ////////////////////////////////////////////////////////////////////////
478 return gAlice->Particle(GetTrack());
480 //----------------------------------------------------------------------
481 void AliITShit::Print(ostream *os){
482 ////////////////////////////////////////////////////////////////////////
483 // Standard output format for this class.
484 ////////////////////////////////////////////////////////////////////////
499 fmt = os->setf(ios::scientific); // set scientific floating point output
500 *os << fTrack << " " << fX << " " << fY << " " << fZ << " ";
501 fmt = os->setf(ios::hex); // set hex for fStatus only.
502 *os << fStatus << " ";
503 fmt = os->setf(ios::dec); // every thing else decimel.
504 *os << fLayer << " " << fLadder << " " << fDet << " ";;
505 *os << fPx << " " << fPy << " " << fPz << " ";
506 *os << fDestep << " " << fTof;
508 os->flags(fmt); // reset back to old formating.
511 //----------------------------------------------------------------------
512 void AliITShit::Read(istream *is){
513 ////////////////////////////////////////////////////////////////////////
514 // Standard input format for this class.
515 ////////////////////////////////////////////////////////////////////////
518 *is >> fTrack >> fX >> fY >> fZ;
519 *is >> fStatus >> fLayer >> fLadder >> fDet >> fPx >> fPy >> fPz >>
523 //----------------------------------------------------------------------
524 ostream &operator<<(ostream &os,AliITShit &p){
525 ////////////////////////////////////////////////////////////////////////
526 // Standard output streaming function.
527 ////////////////////////////////////////////////////////////////////////
532 //----------------------------------------------------------------------
533 istream &operator>>(istream &is,AliITShit &r){
534 ////////////////////////////////////////////////////////////////////////
535 // Standard input streaming function.
536 ////////////////////////////////////////////////////////////////////////
541 //----------------------------------------------------------------------