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.21 2002/12/03 09:03:06 hristov
19 Changes needed on Itanium (F.Carminati)
21 Revision 1.20 2002/10/22 14:45:42 alibrary
22 Introducing Riostream.h
24 Revision 1.19 2002/10/14 14:57:00 hristov
25 Merging the VirtualMC branch to the main development branch (HEAD)
27 Revision 1.13.6.3 2002/08/28 15:06:50 alibrary
30 Revision 1.18 2002/08/07 18:37:53 nilsen
31 Removed endl from print function. should be supplied by user as wanted.
33 Revision 1.17 2002/06/20 09:10:14 hristov
34 Data member ft0 initialized
36 Revision 1.16 2002/06/19 21:12:37 nilsen
37 Fixed bug with non-zero-ed new data members in constructors. Thanks Jiri
38 for finding it and pointing it out.
40 Revision 1.15 2002/06/12 18:59:47 nilsen
41 Added Starting track location to hit class and related changes to modules.
42 This is at present still fully backwards compatible since starting hits
43 are still written to the file. When aliroot v4.0 will be released, this
44 backwards compatiblity will be broken by removing the enterence hit, and making
45 the nessesary changes to module at that time.
47 Revision 1.14 2002/05/19 18:17:03 hristov
48 Changes needed by ICC/IFC compiler (Intel)
50 Revision 1.13 2002/03/09 18:35:35 nilsen
51 Added functions to print out Hit data members.
53 Revision 1.12 2002/03/08 16:05:05 nilsen
54 Standeard io streamers added to make debugging et al. easier.
56 Revision 1.11 2001/01/30 09:23:13 hristov
57 Streamers removed (R.Brun)
59 Revision 1.10 2001/01/26 20:01:19 hristov
60 Major upgrade of AliRoot code
62 Revision 1.9 2000/10/02 16:32:51 barbera
63 Automatic streamer used and forward declarations added
65 Revision 1.3.4.7 2000/10/02 15:54:49 barbera
66 Automatic streamer used and forward declarations added
68 Revision 1.8 2000/09/22 12:35:21 nilsen
69 Traps placed incase it is used without a properly initilized AliITSgeom class.
71 Revision 1.7 2000/07/10 16:07:18 fca
72 Release version of ITS code
74 Revision 1.3.4.2 2000/03/04 23:43:57 nilsen
75 Fixed up the comments/documentation.
77 Revision 1.3.4.1 2000/01/12 19:03:32 nilsen
78 This is the version of the files after the merging done in December 1999.
79 See the ReadMe110100.txt file for details
81 Revision 1.3 1999/09/29 09:24:20 fca
82 Introduction of the Copyright and cvs Log
86 #include <Riostream.h>
91 #include <TGeometry.h>
94 #include "TParticle.h"
98 #include "AliITSgeom.h"
99 #include "AliITShit.h"
103 ////////////////////////////////////////////////////////////////////////
105 // Written by Rene Brun, Federico Carminati, and Roberto Barbera
108 // Modified and documented by Bjorn S. Nilsen
111 // AliITShit is the hit class for the ITS. Hits are the information
112 // that comes from a Monte Carlo at each step as a particle mass through
113 // sensitive detector elements as particles are transported through a
118 <img src="picts/ITS/AliITShit_Class_Diagram.gif">
121 <font size=+2 color=red>
122 <p>This show the relasionships between the ITS hit class and the rest of Aliroot.
127 ////////////////////////////////////////////////////////////////////////
128 // Inline Member functions:
131 // The default creator of the AliITShit class.
134 // The default destructor of the AliITShit class.
137 // See AliHit for a full description. Returns the track number fTrack
140 // SetTrack(int track)
141 // See AliHit for a full description. Sets the track number fTrack
144 // Int_t GetTrackStatus()
145 // Returns the value of the track status flag fStatus. This flag
146 // indicates the track status at the time of creating this hit. It is
147 // made up of the following 8 status bits from highest order to lowest
149 // 0 : IsTrackAlive(): IsTrackStop():IsTrackDisappeared():
150 // IsTrackOut():IsTrackExiting():IsTrackEntering():IsTrackInside() .
151 // See AliMC for a description of these functions. If the function is
152 // true then the bit is set to one, otherwise it is zero.
154 // Bool_t StatusInside()
155 // Returns kTRUE if the particle producing this hit is still inside
156 // the present volume. Returns kFalse if this particle will be in another
157 // volume. {bit IsTrackInside is set or not}
159 // Bool_t StatusEntering()
160 // Returns kTRUE if the particle producing this hit is has just enterd
161 // the present volume. Returns kFalse otherwise. {bit IsTrackEntering is
164 // Bool_t StatusExiting()
165 // Returns kTRUE if the particle producing this hit is will exit
166 // the present volume. Returns kFalse otherwise. {bit IsTrackExiting is set
169 // Bool_t StatusOut()
170 // Returns kTRUE if the particle producing this hit is goint exit the
171 // simulation. Returns kFalse otherwise. {bit IsTrackOut is set or not}
173 // Bool_t StatusDisappeared()
174 // Returns kTRUE if the particle producing this hit is going to "disappear"
175 // for example it has interacted producing some other particles. Returns
176 // kFalse otherwise. {bit IsTrackOut is set or not}
178 // Bool_t StatusStop()
179 // Returns kTRUE if the particle producing this hit is has dropped below
180 // its energy cut off producing some other particles. Returns kFalse otherwise.
181 // {bit IsTrackOut is set or not}
183 // Bool_t StatuAlives()
184 // Returns kTRUE if the particle producing this hit is going to continue
185 // to be transported. Returns kFalse otherwise. {bit IsTrackOut is set or not}
188 // Returns the layer number, fLayer, for this hit.
191 // Returns the ladder number, fLadder, for this hit.
193 // Int_t GetDetector()
194 // Returns the detector number, fDet, for this hit.
196 // GetDetectorID(Int_t &layer, Int_t &ladder, Int_t &detector)
197 // Returns the layer, ladder, and detector numbers, fLayer fLadder fDet,
200 // Float_t GetIonization()
201 // Returns the energy lost, fDestep, by the particle creating this hit,
202 // in the units defined by the Monte Carlo.
204 // GetPositionG(Float_t &x, Float_t &y, Float_t &z)
205 // Returns the global position, fX fY fZ, of this hit, in the units
206 // define by the Monte Carlo.
208 // GetPositionG(Double_t &x, Double_t &y, Double_t &z)
209 // Returns the global position, fX fY fZ, of this hit, in the units
210 // define by the Monte Carlo.
212 // GetPositionG(Float_t &x, Float_t &y, Float_t &z, Float_t &tof)
213 // Returns the global position and time of flight, fX fY fZ fTof, of
214 // this hit, in the units define by the Monte Carlo.
216 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
217 // Returns the global position and time of flight, fX fY fZ fTof, of
218 // this hit, in the units define by the Monte Carlo.
220 // GetPositionL(Double_t &x,Double_t &y,Double_t &z)
221 // Returns the local position, fX fY fZ, of this hit in the coordiante
222 // of this module, in the units define by the Monte Carlo.
224 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
225 // Returns the local position and time of flight, fX fY fZ fTof, of
226 // this hit in the coordinates of this module, in the units define by the
230 // Returns the global x position in the units defined by the Monte Carlo.
233 // Returns the global y position in the units defined by the Monte Carlo.
236 // Returns the global z position in the units defined by the Monte Carlo.
239 // Returns the time of flight, fTof, of this hit, in the units defined
240 // by the Monte Carlo.
242 // GetMomentumG(Float_t &px, Float_t &py, Float_t &pz)
243 // Returns the global momentum, fPx fPy fPz, of the particle that made
244 // this hit, in the units define by the Monte Carlo.
246 // GetMomentumG(Double_t &px,Double_t &py,Double_t &pz)
247 // Returns the global momentum, fPx fPy fPz, of the particle that made
248 // this hit, in the units define by the Monte Carlo.
250 // GetMomentumL(Double_t &px,Double_t &py,Double_t &pz)
251 // Returns the momentum, fPx fPy fPz in coordinate appropreate for this
252 // specific module, in the units define by the Monte Carlo.
255 // Returns the global X momentum in the units defined by the Monte Carlo.
258 // Returns the global Y momentum in the units defined by the Monte Carlo.
261 // Returns the global Z momentum in the units defined by the Monte Carlo.
263 ////////////////////////////////////////////////////////////////////////
264 //_____________________________________________________________________________
265 AliITShit::AliITShit():AliHit(){
266 // Default Constructor
267 // Zero data member just to be safe.
273 // A default created AliITShit class.
275 fStatus = 0; // Track Status
276 fLayer = 0; // Layer number
277 fLadder = 0; // Ladder number
278 fDet = 0; // Detector number
279 fPx = 0.0; // PX of particle at the point of the hit
280 fPy = 0.0; // PY of particle at the point of the hit
281 fPz = 0.0; // PZ of particle at the point of the hit
282 fDestep = 0.0; // Energy deposited in the current step
283 fTof = 0.0; // Time of flight at the point of the hit
284 fStatus0 = 0; // zero status bit by default.
285 fx0 = 0.0; // Starting point of this step
286 fy0 = 0.0; // Starting point of this step
287 fz0 = 0.0; // Starting point of this step
288 ft0 = 0.0; // Starting point of this step
290 AliITShit::AliITShit(Int_t shunt,Int_t track,Int_t *vol,Float_t edep,
291 Float_t tof,TLorentzVector &x,TLorentzVector &x0,
292 TLorentzVector &p) : AliHit(shunt, track){
293 ////////////////////////////////////////////////////////////////////////
295 // The creator of the AliITShit class. The variables shunt and
296 // track are passed to the creator of the AliHit class. See the AliHit
297 // class for a full description. In the units of the Monte Carlo
298 ////////////////////////////////////////////////////////////////////////
300 // Int_t shunt See AliHit
301 // Int_t track Track number, see AliHit
302 // Int_t *vol Array of integer hit data,
303 // vol[0] Layer where the hit is, 1-6 typicaly
304 // vol[1] Ladder where the hit is.
305 // vol[2] Detector number where the hit is
306 // vol[3] Set of status bits
307 // vol[4] Set of status bits at start
311 // A default created AliITShit class.
313 fLayer = vol[0]; // Layer number
314 fLadder = vol[2]; // Ladder number
315 fDet = vol[1]; // Detector number
316 fStatus = vol[3]; // Track status flags
317 fStatus0 = vol[4]; // Track status flag for start position.
318 fX = x.X(); // Track X global position
319 fY = x.Y(); // Track Y global position
320 fZ = x.Z(); // Track Z global position
321 fPx = p.Px(); // Track X Momentum
322 fPy = p.Py(); // Track Y Momentum
323 fPz = p.Pz(); // Track Z Momentum
324 fDestep = edep; // Track dE/dx for this step
325 fTof = tof ; // Track Time of Flight for this step
326 fx0 = x0.X(); // Track X global position
327 fy0 = x0.Y(); // Track Y global position
328 fz0 = x0.Z(); // Track Z global position
329 ft0 = x0.T(); // Starting point of this step
331 //______________________________________________________________________
332 AliITShit::AliITShit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
333 AliHit(shunt, track){
334 ////////////////////////////////////////////////////////////////////////
336 // The creator of the AliITShit class. The variables shunt and
337 // track are passed to the creator of the AliHit class. See the AliHit
338 // class for a full description. the integer array *vol contains, in order,
339 // fLayer = vol[0], fDet = vol[1], fLadder = vol[2], fStatus = vol[3].
340 // The array *hits contains, in order, fX = hits[0], fY = hits[1],
341 // fZ = hits[2], fPx = hits[3], fPy = hits[4], fPz = hits[5],
342 // fDestep = hits[6], and fTof = hits[7]. In the units of the Monte Carlo
343 ////////////////////////////////////////////////////////////////////////
345 // Int_t shunt See AliHit
346 // Int_t track Track number, see AliHit
347 // Int_t *vol Array of integer hit data,
348 // vol[0] Layer where the hit is, 1-6 typicaly
349 // vol[1] Ladder where the hit is.
350 // vol[2] Detector number where the hit is
351 // vol[3] Set of status bits
352 // Float_t *hits Array of hit information
353 // hits[0] X global position of this hit
354 // hits[1] Y global position of this hit
355 // hits[2] Z global position of this hit
356 // hits[3] Px global position of this hit
357 // hits[4] Py global position of this hit
358 // hits[5] Pz global position of this hit
359 // hits[6] Energy deposited by this step
360 // hits[7] Time of flight of this particle at this step
364 // A standard created AliITShit class.
365 fLayer = vol[0]; // Layer number
366 fLadder = vol[2]; // Ladder number
367 fDet = vol[1]; // Detector number
368 fStatus = vol[3]; // Track status flags
369 fX = hits[0]; // Track X global position
370 fY = hits[1]; // Track Y global position
371 fZ = hits[2]; // Track Z global position
372 fPx = hits[3]; // Track X Momentum
373 fPy = hits[4]; // Track Y Momentum
374 fPz = hits[5]; // Track Z Momentum
375 fDestep = hits[6]; // Track dE/dx for this step
376 fTof = hits[7]; // Track Time of Flight for this step
377 fStatus0 = 0;// Track Status of Starting point
378 fx0 = 0.0; // Starting point of this step
379 fy0 = 0.0; // Starting point of this step
380 fz0 = 0.0; // Starting point of this step
381 ft0 = 0.0; // Starting point of this step
383 //______________________________________________________________________
384 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z){
385 ////////////////////////////////////////////////////////////////////////
386 // Returns the position of this hit in the local coordinates of this
387 // module, and in the units of the Monte Carlo.
388 ////////////////////////////////////////////////////////////////////////
389 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
396 gm->GtoL(fLayer,fLadder,fDet,g,l);
401 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
402 // AliITSv7 - SDD case
409 //______________________________________________________________________
410 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z,Float_t &tof){
411 ////////////////////////////////////////////////////////////////////////
412 // Returns the position and time of flight of this hit in the local
413 // coordinates of this module, and in the units of the Monte Carlo.
414 ////////////////////////////////////////////////////////////////////////
415 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
422 gm->GtoL(fLayer,fLadder,fDet,g,l);
427 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
428 // AliITSv7 - SDD case
436 //______________________________________________________________________
437 void AliITShit::GetPositionL0(Double_t &x,Double_t &y,Double_t &z,
439 ////////////////////////////////////////////////////////////////////////
440 // Returns the initial position and time of flight of this hit in the local
441 // coordinates of this module, and in the units of the Monte Carlo.
442 ////////////////////////////////////////////////////////////////////////
443 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
450 gm->GtoL(fLayer,fLadder,fDet,g,l);
455 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
456 // AliITSv7 - SDD case
464 //______________________________________________________________________
465 Float_t AliITShit::GetXL(){
466 ////////////////////////////////////////////////////////////////////////
467 // Returns the x position of this hit in the local coordinates of this
468 // module, and in the units of the Monte Carlo.
469 ////////////////////////////////////////////////////////////////////////
470 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
477 gm->GtoL(fLayer,fLadder,fDet,g,l);
480 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
484 //______________________________________________________________________
485 Float_t AliITShit::GetYL(){
486 ////////////////////////////////////////////////////////////////////////
487 // Returns the y position of this hit in the local coordinates of this
488 // module, and in the units of the Monte Carlo.
489 ////////////////////////////////////////////////////////////////////////
490 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
497 gm->GtoL(fLayer,fLadder,fDet,g,l);
500 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
504 //______________________________________________________________________
505 Float_t AliITShit::GetZL(){
506 ////////////////////////////////////////////////////////////////////////
507 // Returns the z position of this hit in the local coordinates of this
508 // module, and in the units of the Monte Carlo.
509 ////////////////////////////////////////////////////////////////////////
510 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
517 gm->GtoL(fLayer,fLadder,fDet,g,l);
520 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
524 //______________________________________________________________________
525 void AliITShit::GetMomentumL(Float_t &px,Float_t &py,Float_t &pz){
526 ////////////////////////////////////////////////////////////////////////
527 // Returns the momentum of this hit in the local coordinates of this
528 // module, and in the units of the Monte Carlo.
529 ////////////////////////////////////////////////////////////////////////
530 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
537 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
542 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
549 //______________________________________________________________________
550 Float_t AliITShit::GetPXL(){
551 ////////////////////////////////////////////////////////////////////////
552 // Returns the X momentum of this hit in the local coordinates of this
553 // module, and in the units of the Monte Carlo.
554 ////////////////////////////////////////////////////////////////////////
555 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
562 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
565 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
569 //______________________________________________________________________
570 Float_t AliITShit::GetPYL(){
571 ////////////////////////////////////////////////////////////////////////
572 // Returns the Y momentum of this hit in the local coordinates of this
573 // module, and in the units of the Monte Carlo.
574 ////////////////////////////////////////////////////////////////////////
575 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
582 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
585 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
590 //______________________________________________________________________
591 Float_t AliITShit::GetPZL(){
592 ////////////////////////////////////////////////////////////////////////
593 // Returns the Z momentum of this hit in the local coordinates of this
594 // module, and in the units of the Monte Carlo.
595 ////////////////////////////////////////////////////////////////////////
596 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
603 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
606 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
611 //___________________________________________________________________________;
612 Int_t AliITShit::GetModule(){
613 ////////////////////////////////////////////////////////////////////////
614 // Returns the module index number of the module where this hit was in.
615 ////////////////////////////////////////////////////////////////////////
616 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
618 if (gm) return gm->GetModuleIndex(fLayer,fLadder,fDet);
620 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
624 //______________________________________________________________________
625 TParticle * AliITShit::GetParticle(){
626 ////////////////////////////////////////////////////////////////////////
627 // Returns the pointer to the TParticle for the particle that created
628 // this hit. From the TParticle all kinds of information about this
629 // particle can be found. See the TParticle class.
630 ////////////////////////////////////////////////////////////////////////
631 return gAlice->Particle(GetTrack());
633 //----------------------------------------------------------------------
634 void AliITShit::Print(ostream *os){
635 ////////////////////////////////////////////////////////////////////////
636 // Standard output format for this class.
637 ////////////////////////////////////////////////////////////////////////
645 #if defined __ICC || defined __ECC
652 fmt = os->setf(ios::scientific); // set scientific floating point output
653 *os << fTrack << " " << fX << " " << fY << " " << fZ << " ";
654 fmt = os->setf(ios::hex); // set hex for fStatus only.
655 *os << fStatus << " ";
656 fmt = os->setf(ios::dec); // every thing else decimel.
657 *os << fLayer << " " << fLadder << " " << fDet << " ";;
658 *os << fPx << " " << fPy << " " << fPz << " ";
659 *os << fDestep << " " << fTof;
660 *os << " " << fx0 << " " << fy0 << " " << fz0;
661 // *os << " " << endl;
662 os->flags(fmt); // reset back to old formating.
665 //----------------------------------------------------------------------
666 void AliITShit::Read(istream *is){
667 ////////////////////////////////////////////////////////////////////////
668 // Standard input format for this class.
669 ////////////////////////////////////////////////////////////////////////
672 *is >> fTrack >> fX >> fY >> fZ;
673 *is >> fStatus >> fLayer >> fLadder >> fDet >> fPx >> fPy >> fPz >>
675 *is >> fx0 >> fy0 >> fz0;
678 //----------------------------------------------------------------------
679 ostream &operator<<(ostream &os,AliITShit &p){
680 ////////////////////////////////////////////////////////////////////////
681 // Standard output streaming function.
682 ////////////////////////////////////////////////////////////////////////
687 //----------------------------------------------------------------------
688 istream &operator>>(istream &is,AliITShit &r){
689 ////////////////////////////////////////////////////////////////////////
690 // Standard input streaming function.
691 ////////////////////////////////////////////////////////////////////////
696 //----------------------------------------------------------------------