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.14 2002/05/19 18:17:03 hristov
19 Changes needed by ICC/IFC compiler (Intel)
21 Revision 1.13 2002/03/09 18:35:35 nilsen
22 Added functions to print out Hit data members.
24 Revision 1.12 2002/03/08 16:05:05 nilsen
25 Standeard io streamers added to make debugging et al. easier.
27 Revision 1.11 2001/01/30 09:23:13 hristov
28 Streamers removed (R.Brun)
30 Revision 1.10 2001/01/26 20:01:19 hristov
31 Major upgrade of AliRoot code
33 Revision 1.9 2000/10/02 16:32:51 barbera
34 Automatic streamer used and forward declarations added
36 Revision 1.3.4.7 2000/10/02 15:54:49 barbera
37 Automatic streamer used and forward declarations added
39 Revision 1.8 2000/09/22 12:35:21 nilsen
40 Traps placed incase it is used without a properly initilized AliITSgeom class.
42 Revision 1.7 2000/07/10 16:07:18 fca
43 Release version of ITS code
45 Revision 1.3.4.2 2000/03/04 23:43:57 nilsen
46 Fixed up the comments/documentation.
48 Revision 1.3.4.1 2000/01/12 19:03:32 nilsen
49 This is the version of the files after the merging done in December 1999.
50 See the ReadMe110100.txt file for details
52 Revision 1.3 1999/09/29 09:24:20 fca
53 Introduction of the Copyright and cvs Log
62 #include <TGeometry.h>
65 #include "TParticle.h"
69 #include "AliITSgeom.h"
70 #include "AliITShit.h"
74 ////////////////////////////////////////////////////////////////////////
76 // Written by Rene Brun, Federico Carminati, and Roberto Barbera
79 // Modified and documented by Bjorn S. Nilsen
82 // AliITShit is the hit class for the ITS. Hits are the information
83 // that comes from a Monte Carlo at each step as a particle mass through
84 // sensitive detector elements as particles are transported through a
89 <img src="picts/ITS/AliITShit_Class_Diagram.gif">
92 <font size=+2 color=red>
93 <p>This show the relasionships between the ITS hit class and the rest of Aliroot.
98 ////////////////////////////////////////////////////////////////////////
99 // Inline Member functions:
102 // The default creator of the AliITShit class.
105 // The default destructor of the AliITShit class.
108 // See AliHit for a full description. Returns the track number fTrack
111 // SetTrack(int track)
112 // See AliHit for a full description. Sets the track number fTrack
115 // Int_t GetTrackStatus()
116 // Returns the value of the track status flag fStatus. This flag
117 // indicates the track status at the time of creating this hit. It is
118 // made up of the following 8 status bits from highest order to lowest
120 // 0 : IsTrackAlive(): IsTrackStop():IsTrackDisappeared():
121 // IsTrackOut():IsTrackExiting():IsTrackEntering():IsTrackInside() .
122 // See AliMC for a description of these functions. If the function is
123 // true then the bit is set to one, otherwise it is zero.
125 // Bool_t StatusInside()
126 // Returns kTRUE if the particle producing this hit is still inside
127 // the present volume. Returns kFalse if this particle will be in another
128 // volume. {bit IsTrackInside is set or not}
130 // Bool_t StatusEntering()
131 // Returns kTRUE if the particle producing this hit is has just enterd
132 // the present volume. Returns kFalse otherwise. {bit IsTrackEntering is
135 // Bool_t StatusExiting()
136 // Returns kTRUE if the particle producing this hit is will exit
137 // the present volume. Returns kFalse otherwise. {bit IsTrackExiting is set
140 // Bool_t StatusOut()
141 // Returns kTRUE if the particle producing this hit is goint exit the
142 // simulation. Returns kFalse otherwise. {bit IsTrackOut is set or not}
144 // Bool_t StatusDisappeared()
145 // Returns kTRUE if the particle producing this hit is going to "disappear"
146 // for example it has interacted producing some other particles. Returns
147 // kFalse otherwise. {bit IsTrackOut is set or not}
149 // Bool_t StatusStop()
150 // Returns kTRUE if the particle producing this hit is has dropped below
151 // its energy cut off producing some other particles. Returns kFalse otherwise.
152 // {bit IsTrackOut is set or not}
154 // Bool_t StatuAlives()
155 // Returns kTRUE if the particle producing this hit is going to continue
156 // to be transported. Returns kFalse otherwise. {bit IsTrackOut is set or not}
159 // Returns the layer number, fLayer, for this hit.
162 // Returns the ladder number, fLadder, for this hit.
164 // Int_t GetDetector()
165 // Returns the detector number, fDet, for this hit.
167 // GetDetectorID(Int_t &layer, Int_t &ladder, Int_t &detector)
168 // Returns the layer, ladder, and detector numbers, fLayer fLadder fDet,
171 // Float_t GetIonization()
172 // Returns the energy lost, fDestep, by the particle creating this hit,
173 // in the units defined by the Monte Carlo.
175 // GetPositionG(Float_t &x, Float_t &y, Float_t &z)
176 // Returns the global position, fX fY fZ, of this hit, in the units
177 // define by the Monte Carlo.
179 // GetPositionG(Double_t &x, Double_t &y, Double_t &z)
180 // Returns the global position, fX fY fZ, of this hit, in the units
181 // define by the Monte Carlo.
183 // GetPositionG(Float_t &x, Float_t &y, Float_t &z, Float_t &tof)
184 // Returns the global position and time of flight, fX fY fZ fTof, of
185 // this hit, in the units define by the Monte Carlo.
187 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
188 // Returns the global position and time of flight, fX fY fZ fTof, of
189 // this hit, in the units define by the Monte Carlo.
191 // GetPositionL(Double_t &x,Double_t &y,Double_t &z)
192 // Returns the local position, fX fY fZ, of this hit in the coordiante
193 // of this module, in the units define by the Monte Carlo.
195 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
196 // Returns the local position and time of flight, fX fY fZ fTof, of
197 // this hit in the coordinates of this module, in the units define by the
201 // Returns the global x position in the units defined by the Monte Carlo.
204 // Returns the global y position in the units defined by the Monte Carlo.
207 // Returns the global z position in the units defined by the Monte Carlo.
210 // Returns the time of flight, fTof, of this hit, in the units defined
211 // by the Monte Carlo.
213 // GetMomentumG(Float_t &px, Float_t &py, Float_t &pz)
214 // Returns the global momentum, fPx fPy fPz, of the particle that made
215 // this hit, in the units define by the Monte Carlo.
217 // GetMomentumG(Double_t &px,Double_t &py,Double_t &pz)
218 // Returns the global momentum, fPx fPy fPz, of the particle that made
219 // this hit, in the units define by the Monte Carlo.
221 // GetMomentumL(Double_t &px,Double_t &py,Double_t &pz)
222 // Returns the momentum, fPx fPy fPz in coordinate appropreate for this
223 // specific module, in the units define by the Monte Carlo.
226 // Returns the global X momentum in the units defined by the Monte Carlo.
229 // Returns the global Y momentum in the units defined by the Monte Carlo.
232 // Returns the global Z momentum in the units defined by the Monte Carlo.
234 ////////////////////////////////////////////////////////////////////////
235 //_____________________________________________________________________________
236 AliITShit::AliITShit():AliHit(){
237 // Default Constructor
238 // Zero data member just to be safe.
244 // A default created AliITShit class.
246 fStatus = 0; // Track Status
247 fLayer = 0; // Layer number
248 fLadder = 0; // Ladder number
249 fDet = 0; // Detector number
250 fPx = 0.0; // PX of particle at the point of the hit
251 fPy = 0.0; // PY of particle at the point of the hit
252 fPz = 0.0; // PZ of particle at the point of the hit
253 fDestep = 0.0; // Energy deposited in the current step
254 fTof = 0.0; // Time of flight at the point of the hit
255 fx0 = 0.0; // Starting point of this step
256 fy0 = 0.0; // Starting point of this step
257 fz0 = 0.0; // Starting point of this step
258 ft0 = 0.0; // Starting point of this step
260 AliITShit::AliITShit(Int_t shunt,Int_t track,Int_t *vol,Float_t edep,
261 Float_t tof,TLorentzVector &x,TLorentzVector &x0,
262 TLorentzVector &p) : AliHit(shunt, track){
263 ////////////////////////////////////////////////////////////////////////
265 // The creator of the AliITShit class. The variables shunt and
266 // track are passed to the creator of the AliHit class. See the AliHit
267 // class for a full description. In the units of the Monte Carlo
268 ////////////////////////////////////////////////////////////////////////
270 // Int_t shunt See AliHit
271 // Int_t track Track number, see AliHit
272 // Int_t *vol Array of integer hit data,
273 // vol[0] Layer where the hit is, 1-6 typicaly
274 // vol[1] Ladder where the hit is.
275 // vol[2] Detector number where the hit is
276 // vol[3] Set of status bits
277 // vol[4] Set of status bits at start
281 // A default created AliITShit class.
283 fLayer = vol[0]; // Layer number
284 fLadder = vol[2]; // Ladder number
285 fDet = vol[1]; // Detector number
286 fStatus = vol[3]; // Track status flags
287 fStatus0 = vol[4]; // Track status flag for start position.
288 fX = x.X(); // Track X global position
289 fY = x.Y(); // Track Y global position
290 fZ = x.Z(); // Track Z global position
291 fPx = p.Px(); // Track X Momentum
292 fPy = p.Py(); // Track Y Momentum
293 fPz = p.Pz(); // Track Z Momentum
294 fDestep = edep; // Track dE/dx for this step
295 fTof = tof ; // Track Time of Flight for this step
296 fx0 = x0.X(); // Track X global position
297 fy0 = x0.Y(); // Track Y global position
298 fz0 = x0.Z(); // Track Z global position
300 //______________________________________________________________________
301 AliITShit::AliITShit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
302 AliHit(shunt, track){
303 ////////////////////////////////////////////////////////////////////////
305 // The creator of the AliITShit class. The variables shunt and
306 // track are passed to the creator of the AliHit class. See the AliHit
307 // class for a full description. the integer array *vol contains, in order,
308 // fLayer = vol[0], fDet = vol[1], fLadder = vol[2], fStatus = vol[3].
309 // The array *hits contains, in order, fX = hits[0], fY = hits[1],
310 // fZ = hits[2], fPx = hits[3], fPy = hits[4], fPz = hits[5],
311 // fDestep = hits[6], and fTof = hits[7]. In the units of the Monte Carlo
312 ////////////////////////////////////////////////////////////////////////
314 // Int_t shunt See AliHit
315 // Int_t track Track number, see AliHit
316 // Int_t *vol Array of integer hit data,
317 // vol[0] Layer where the hit is, 1-6 typicaly
318 // vol[1] Ladder where the hit is.
319 // vol[2] Detector number where the hit is
320 // vol[3] Set of status bits
321 // Float_t *hits Array of hit information
322 // hits[0] X global position of this hit
323 // hits[1] Y global position of this hit
324 // hits[2] Z global position of this hit
325 // hits[3] Px global position of this hit
326 // hits[4] Py global position of this hit
327 // hits[5] Pz global position of this hit
328 // hits[6] Energy deposited by this step
329 // hits[7] Time of flight of this particle at this step
333 // A standard created AliITShit class.
334 fLayer = vol[0]; // Layer number
335 fLadder = vol[2]; // Ladder number
336 fDet = vol[1]; // Detector number
337 fStatus = vol[3]; // Track status flags
338 fX = hits[0]; // Track X global position
339 fY = hits[1]; // Track Y global position
340 fZ = hits[2]; // Track Z global position
341 fPx = hits[3]; // Track X Momentum
342 fPy = hits[4]; // Track Y Momentum
343 fPz = hits[5]; // Track Z Momentum
344 fDestep = hits[6]; // Track dE/dx for this step
345 fTof = hits[7]; // Track Time of Flight for this step
347 //______________________________________________________________________
348 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z){
349 ////////////////////////////////////////////////////////////////////////
350 // Returns the position of this hit in the local coordinates of this
351 // module, and in the units of the Monte Carlo.
352 ////////////////////////////////////////////////////////////////////////
353 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
360 gm->GtoL(fLayer,fLadder,fDet,g,l);
365 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
366 // AliITSv7 - SDD case
373 //______________________________________________________________________
374 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z,Float_t &tof){
375 ////////////////////////////////////////////////////////////////////////
376 // Returns the position and time of flight of this hit in the local
377 // coordinates of this module, and in the units of the Monte Carlo.
378 ////////////////////////////////////////////////////////////////////////
379 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
386 gm->GtoL(fLayer,fLadder,fDet,g,l);
391 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
392 // AliITSv7 - SDD case
400 //______________________________________________________________________
401 Float_t AliITShit::GetXL(){
402 ////////////////////////////////////////////////////////////////////////
403 // Returns the x position 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->GtoL(fLayer,fLadder,fDet,g,l);
416 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
420 //______________________________________________________________________
421 Float_t AliITShit::GetYL(){
422 ////////////////////////////////////////////////////////////////////////
423 // Returns the y position of this hit in the local coordinates of this
424 // module, and in the units of the Monte Carlo.
425 ////////////////////////////////////////////////////////////////////////
426 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
433 gm->GtoL(fLayer,fLadder,fDet,g,l);
436 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
440 //______________________________________________________________________
441 Float_t AliITShit::GetZL(){
442 ////////////////////////////////////////////////////////////////////////
443 // Returns the z position of this hit in the local coordinates of this
444 // module, and in the units of the Monte Carlo.
445 ////////////////////////////////////////////////////////////////////////
446 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
453 gm->GtoL(fLayer,fLadder,fDet,g,l);
456 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
460 //______________________________________________________________________
461 void AliITShit::GetMomentumL(Float_t &px,Float_t &py,Float_t &pz){
462 ////////////////////////////////////////////////////////////////////////
463 // Returns the momentum of this hit in the local coordinates of this
464 // module, and in the units of the Monte Carlo.
465 ////////////////////////////////////////////////////////////////////////
466 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
473 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
478 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
485 //______________________________________________________________________
486 Float_t AliITShit::GetPXL(){
487 ////////////////////////////////////////////////////////////////////////
488 // Returns the X momentum of this hit in the local coordinates of this
489 // module, and in the units of the Monte Carlo.
490 ////////////////////////////////////////////////////////////////////////
491 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
498 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
501 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
505 //______________________________________________________________________
506 Float_t AliITShit::GetPYL(){
507 ////////////////////////////////////////////////////////////////////////
508 // Returns the Y momentum of this hit in the local coordinates of this
509 // module, and in the units of the Monte Carlo.
510 ////////////////////////////////////////////////////////////////////////
511 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
518 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
521 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
526 //______________________________________________________________________
527 Float_t AliITShit::GetPZL(){
528 ////////////////////////////////////////////////////////////////////////
529 // Returns the Z momentum of this hit in the local coordinates of this
530 // module, and in the units of the Monte Carlo.
531 ////////////////////////////////////////////////////////////////////////
532 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
539 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
542 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
547 //___________________________________________________________________________;
548 Int_t AliITShit::GetModule(){
549 ////////////////////////////////////////////////////////////////////////
550 // Returns the module index number of the module where this hit was in.
551 ////////////////////////////////////////////////////////////////////////
552 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
554 if (gm) return gm->GetModuleIndex(fLayer,fLadder,fDet);
556 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
560 //______________________________________________________________________
561 TParticle * AliITShit::GetParticle(){
562 ////////////////////////////////////////////////////////////////////////
563 // Returns the pointer to the TParticle for the particle that created
564 // this hit. From the TParticle all kinds of information about this
565 // particle can be found. See the TParticle class.
566 ////////////////////////////////////////////////////////////////////////
567 return gAlice->Particle(GetTrack());
569 //----------------------------------------------------------------------
570 void AliITShit::Print(ostream *os){
571 ////////////////////////////////////////////////////////////////////////
572 // Standard output format for this class.
573 ////////////////////////////////////////////////////////////////////////
588 fmt = os->setf(ios::scientific); // set scientific floating point output
589 *os << fTrack << " " << fX << " " << fY << " " << fZ << " ";
590 fmt = os->setf(ios::hex); // set hex for fStatus only.
591 *os << fStatus << " ";
592 fmt = os->setf(ios::dec); // every thing else decimel.
593 *os << fLayer << " " << fLadder << " " << fDet << " ";;
594 *os << fPx << " " << fPy << " " << fPz << " ";
595 *os << fDestep << " " << fTof;
596 *os << " " << fx0 << " " << fy0 << " " << fz0 << " ";
598 os->flags(fmt); // reset back to old formating.
601 //----------------------------------------------------------------------
602 void AliITShit::Read(istream *is){
603 ////////////////////////////////////////////////////////////////////////
604 // Standard input format for this class.
605 ////////////////////////////////////////////////////////////////////////
608 *is >> fTrack >> fX >> fY >> fZ;
609 *is >> fStatus >> fLayer >> fLadder >> fDet >> fPx >> fPy >> fPz >>
611 *is >> fx0 >> fy0 >> fz0;
614 //----------------------------------------------------------------------
615 ostream &operator<<(ostream &os,AliITShit &p){
616 ////////////////////////////////////////////////////////////////////////
617 // Standard output streaming function.
618 ////////////////////////////////////////////////////////////////////////
623 //----------------------------------------------------------------------
624 istream &operator>>(istream &is,AliITShit &r){
625 ////////////////////////////////////////////////////////////////////////
626 // Standard input streaming function.
627 ////////////////////////////////////////////////////////////////////////
632 //----------------------------------------------------------------------