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.19 2002/10/14 14:57:00 hristov
19 Merging the VirtualMC branch to the main development branch (HEAD)
21 Revision 1.13.6.3 2002/08/28 15:06:50 alibrary
24 Revision 1.18 2002/08/07 18:37:53 nilsen
25 Removed endl from print function. should be supplied by user as wanted.
27 Revision 1.17 2002/06/20 09:10:14 hristov
28 Data member ft0 initialized
30 Revision 1.16 2002/06/19 21:12:37 nilsen
31 Fixed bug with non-zero-ed new data members in constructors. Thanks Jiri
32 for finding it and pointing it out.
34 Revision 1.15 2002/06/12 18:59:47 nilsen
35 Added Starting track location to hit class and related changes to modules.
36 This is at present still fully backwards compatible since starting hits
37 are still written to the file. When aliroot v4.0 will be released, this
38 backwards compatiblity will be broken by removing the enterence hit, and making
39 the nessesary changes to module at that time.
41 Revision 1.14 2002/05/19 18:17:03 hristov
42 Changes needed by ICC/IFC compiler (Intel)
44 Revision 1.13 2002/03/09 18:35:35 nilsen
45 Added functions to print out Hit data members.
47 Revision 1.12 2002/03/08 16:05:05 nilsen
48 Standeard io streamers added to make debugging et al. easier.
50 Revision 1.11 2001/01/30 09:23:13 hristov
51 Streamers removed (R.Brun)
53 Revision 1.10 2001/01/26 20:01:19 hristov
54 Major upgrade of AliRoot code
56 Revision 1.9 2000/10/02 16:32:51 barbera
57 Automatic streamer used and forward declarations added
59 Revision 1.3.4.7 2000/10/02 15:54:49 barbera
60 Automatic streamer used and forward declarations added
62 Revision 1.8 2000/09/22 12:35:21 nilsen
63 Traps placed incase it is used without a properly initilized AliITSgeom class.
65 Revision 1.7 2000/07/10 16:07:18 fca
66 Release version of ITS code
68 Revision 1.3.4.2 2000/03/04 23:43:57 nilsen
69 Fixed up the comments/documentation.
71 Revision 1.3.4.1 2000/01/12 19:03:32 nilsen
72 This is the version of the files after the merging done in December 1999.
73 See the ReadMe110100.txt file for details
75 Revision 1.3 1999/09/29 09:24:20 fca
76 Introduction of the Copyright and cvs Log
80 #include <Riostream.h>
85 #include <TGeometry.h>
88 #include "TParticle.h"
92 #include "AliITSgeom.h"
93 #include "AliITShit.h"
97 ////////////////////////////////////////////////////////////////////////
99 // Written by Rene Brun, Federico Carminati, and Roberto Barbera
102 // Modified and documented by Bjorn S. Nilsen
105 // AliITShit is the hit class for the ITS. Hits are the information
106 // that comes from a Monte Carlo at each step as a particle mass through
107 // sensitive detector elements as particles are transported through a
112 <img src="picts/ITS/AliITShit_Class_Diagram.gif">
115 <font size=+2 color=red>
116 <p>This show the relasionships between the ITS hit class and the rest of Aliroot.
121 ////////////////////////////////////////////////////////////////////////
122 // Inline Member functions:
125 // The default creator of the AliITShit class.
128 // The default destructor of the AliITShit class.
131 // See AliHit for a full description. Returns the track number fTrack
134 // SetTrack(int track)
135 // See AliHit for a full description. Sets the track number fTrack
138 // Int_t GetTrackStatus()
139 // Returns the value of the track status flag fStatus. This flag
140 // indicates the track status at the time of creating this hit. It is
141 // made up of the following 8 status bits from highest order to lowest
143 // 0 : IsTrackAlive(): IsTrackStop():IsTrackDisappeared():
144 // IsTrackOut():IsTrackExiting():IsTrackEntering():IsTrackInside() .
145 // See AliMC for a description of these functions. If the function is
146 // true then the bit is set to one, otherwise it is zero.
148 // Bool_t StatusInside()
149 // Returns kTRUE if the particle producing this hit is still inside
150 // the present volume. Returns kFalse if this particle will be in another
151 // volume. {bit IsTrackInside is set or not}
153 // Bool_t StatusEntering()
154 // Returns kTRUE if the particle producing this hit is has just enterd
155 // the present volume. Returns kFalse otherwise. {bit IsTrackEntering is
158 // Bool_t StatusExiting()
159 // Returns kTRUE if the particle producing this hit is will exit
160 // the present volume. Returns kFalse otherwise. {bit IsTrackExiting is set
163 // Bool_t StatusOut()
164 // Returns kTRUE if the particle producing this hit is goint exit the
165 // simulation. Returns kFalse otherwise. {bit IsTrackOut is set or not}
167 // Bool_t StatusDisappeared()
168 // Returns kTRUE if the particle producing this hit is going to "disappear"
169 // for example it has interacted producing some other particles. Returns
170 // kFalse otherwise. {bit IsTrackOut is set or not}
172 // Bool_t StatusStop()
173 // Returns kTRUE if the particle producing this hit is has dropped below
174 // its energy cut off producing some other particles. Returns kFalse otherwise.
175 // {bit IsTrackOut is set or not}
177 // Bool_t StatuAlives()
178 // Returns kTRUE if the particle producing this hit is going to continue
179 // to be transported. Returns kFalse otherwise. {bit IsTrackOut is set or not}
182 // Returns the layer number, fLayer, for this hit.
185 // Returns the ladder number, fLadder, for this hit.
187 // Int_t GetDetector()
188 // Returns the detector number, fDet, for this hit.
190 // GetDetectorID(Int_t &layer, Int_t &ladder, Int_t &detector)
191 // Returns the layer, ladder, and detector numbers, fLayer fLadder fDet,
194 // Float_t GetIonization()
195 // Returns the energy lost, fDestep, by the particle creating this hit,
196 // in the units defined by the Monte Carlo.
198 // GetPositionG(Float_t &x, Float_t &y, Float_t &z)
199 // Returns the global position, fX fY fZ, of this hit, in the units
200 // define by the Monte Carlo.
202 // GetPositionG(Double_t &x, Double_t &y, Double_t &z)
203 // Returns the global position, fX fY fZ, of this hit, in the units
204 // define by the Monte Carlo.
206 // GetPositionG(Float_t &x, Float_t &y, Float_t &z, Float_t &tof)
207 // Returns the global position and time of flight, fX fY fZ fTof, of
208 // this hit, in the units define by the Monte Carlo.
210 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
211 // Returns the global position and time of flight, fX fY fZ fTof, of
212 // this hit, in the units define by the Monte Carlo.
214 // GetPositionL(Double_t &x,Double_t &y,Double_t &z)
215 // Returns the local position, fX fY fZ, of this hit in the coordiante
216 // of this module, in the units define by the Monte Carlo.
218 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
219 // Returns the local position and time of flight, fX fY fZ fTof, of
220 // this hit in the coordinates of this module, in the units define by the
224 // Returns the global x position in the units defined by the Monte Carlo.
227 // Returns the global y position in the units defined by the Monte Carlo.
230 // Returns the global z position in the units defined by the Monte Carlo.
233 // Returns the time of flight, fTof, of this hit, in the units defined
234 // by the Monte Carlo.
236 // GetMomentumG(Float_t &px, Float_t &py, Float_t &pz)
237 // Returns the global momentum, fPx fPy fPz, of the particle that made
238 // this hit, in the units define by the Monte Carlo.
240 // GetMomentumG(Double_t &px,Double_t &py,Double_t &pz)
241 // Returns the global momentum, fPx fPy fPz, of the particle that made
242 // this hit, in the units define by the Monte Carlo.
244 // GetMomentumL(Double_t &px,Double_t &py,Double_t &pz)
245 // Returns the momentum, fPx fPy fPz in coordinate appropreate for this
246 // specific module, in the units define by the Monte Carlo.
249 // Returns the global X momentum in the units defined by the Monte Carlo.
252 // Returns the global Y momentum in the units defined by the Monte Carlo.
255 // Returns the global Z momentum in the units defined by the Monte Carlo.
257 ////////////////////////////////////////////////////////////////////////
258 //_____________________________________________________________________________
259 AliITShit::AliITShit():AliHit(){
260 // Default Constructor
261 // Zero data member just to be safe.
267 // A default created AliITShit class.
269 fStatus = 0; // Track Status
270 fLayer = 0; // Layer number
271 fLadder = 0; // Ladder number
272 fDet = 0; // Detector number
273 fPx = 0.0; // PX of particle at the point of the hit
274 fPy = 0.0; // PY of particle at the point of the hit
275 fPz = 0.0; // PZ of particle at the point of the hit
276 fDestep = 0.0; // Energy deposited in the current step
277 fTof = 0.0; // Time of flight at the point of the hit
278 fStatus0 = 0; // zero status bit by default.
279 fx0 = 0.0; // Starting point of this step
280 fy0 = 0.0; // Starting point of this step
281 fz0 = 0.0; // Starting point of this step
282 ft0 = 0.0; // Starting point of this step
284 AliITShit::AliITShit(Int_t shunt,Int_t track,Int_t *vol,Float_t edep,
285 Float_t tof,TLorentzVector &x,TLorentzVector &x0,
286 TLorentzVector &p) : AliHit(shunt, track){
287 ////////////////////////////////////////////////////////////////////////
289 // The creator of the AliITShit class. The variables shunt and
290 // track are passed to the creator of the AliHit class. See the AliHit
291 // class for a full description. In the units of the Monte Carlo
292 ////////////////////////////////////////////////////////////////////////
294 // Int_t shunt See AliHit
295 // Int_t track Track number, see AliHit
296 // Int_t *vol Array of integer hit data,
297 // vol[0] Layer where the hit is, 1-6 typicaly
298 // vol[1] Ladder where the hit is.
299 // vol[2] Detector number where the hit is
300 // vol[3] Set of status bits
301 // vol[4] Set of status bits at start
305 // A default created AliITShit class.
307 fLayer = vol[0]; // Layer number
308 fLadder = vol[2]; // Ladder number
309 fDet = vol[1]; // Detector number
310 fStatus = vol[3]; // Track status flags
311 fStatus0 = vol[4]; // Track status flag for start position.
312 fX = x.X(); // Track X global position
313 fY = x.Y(); // Track Y global position
314 fZ = x.Z(); // Track Z global position
315 fPx = p.Px(); // Track X Momentum
316 fPy = p.Py(); // Track Y Momentum
317 fPz = p.Pz(); // Track Z Momentum
318 fDestep = edep; // Track dE/dx for this step
319 fTof = tof ; // Track Time of Flight for this step
320 fx0 = x0.X(); // Track X global position
321 fy0 = x0.Y(); // Track Y global position
322 fz0 = x0.Z(); // Track Z global position
323 ft0 = x0.T(); // Starting point of this step
325 //______________________________________________________________________
326 AliITShit::AliITShit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
327 AliHit(shunt, track){
328 ////////////////////////////////////////////////////////////////////////
330 // The creator of the AliITShit class. The variables shunt and
331 // track are passed to the creator of the AliHit class. See the AliHit
332 // class for a full description. the integer array *vol contains, in order,
333 // fLayer = vol[0], fDet = vol[1], fLadder = vol[2], fStatus = vol[3].
334 // The array *hits contains, in order, fX = hits[0], fY = hits[1],
335 // fZ = hits[2], fPx = hits[3], fPy = hits[4], fPz = hits[5],
336 // fDestep = hits[6], and fTof = hits[7]. In the units of the Monte Carlo
337 ////////////////////////////////////////////////////////////////////////
339 // Int_t shunt See AliHit
340 // Int_t track Track number, see AliHit
341 // Int_t *vol Array of integer hit data,
342 // vol[0] Layer where the hit is, 1-6 typicaly
343 // vol[1] Ladder where the hit is.
344 // vol[2] Detector number where the hit is
345 // vol[3] Set of status bits
346 // Float_t *hits Array of hit information
347 // hits[0] X global position of this hit
348 // hits[1] Y global position of this hit
349 // hits[2] Z global position of this hit
350 // hits[3] Px global position of this hit
351 // hits[4] Py global position of this hit
352 // hits[5] Pz global position of this hit
353 // hits[6] Energy deposited by this step
354 // hits[7] Time of flight of this particle at this step
358 // A standard created AliITShit class.
359 fLayer = vol[0]; // Layer number
360 fLadder = vol[2]; // Ladder number
361 fDet = vol[1]; // Detector number
362 fStatus = vol[3]; // Track status flags
363 fX = hits[0]; // Track X global position
364 fY = hits[1]; // Track Y global position
365 fZ = hits[2]; // Track Z global position
366 fPx = hits[3]; // Track X Momentum
367 fPy = hits[4]; // Track Y Momentum
368 fPz = hits[5]; // Track Z Momentum
369 fDestep = hits[6]; // Track dE/dx for this step
370 fTof = hits[7]; // Track Time of Flight for this step
371 fStatus0 = 0;// Track Status of Starting point
372 fx0 = 0.0; // Starting point of this step
373 fy0 = 0.0; // Starting point of this step
374 fz0 = 0.0; // Starting point of this step
375 ft0 = 0.0; // Starting point of this step
377 //______________________________________________________________________
378 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z){
379 ////////////////////////////////////////////////////////////////////////
380 // Returns the position of this hit in the local coordinates of this
381 // module, and in the units of the Monte Carlo.
382 ////////////////////////////////////////////////////////////////////////
383 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
390 gm->GtoL(fLayer,fLadder,fDet,g,l);
395 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
396 // AliITSv7 - SDD case
403 //______________________________________________________________________
404 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z,Float_t &tof){
405 ////////////////////////////////////////////////////////////////////////
406 // Returns the position and time of flight of this hit in the local
407 // coordinates of this module, and in the units of the Monte Carlo.
408 ////////////////////////////////////////////////////////////////////////
409 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
416 gm->GtoL(fLayer,fLadder,fDet,g,l);
421 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
422 // AliITSv7 - SDD case
430 //______________________________________________________________________
431 Float_t AliITShit::GetXL(){
432 ////////////////////////////////////////////////////////////////////////
433 // Returns the x position of this hit in the local coordinates of this
434 // module, and in the units of the Monte Carlo.
435 ////////////////////////////////////////////////////////////////////////
436 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
443 gm->GtoL(fLayer,fLadder,fDet,g,l);
446 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
450 //______________________________________________________________________
451 Float_t AliITShit::GetYL(){
452 ////////////////////////////////////////////////////////////////////////
453 // Returns the y position of this hit in the local coordinates of this
454 // module, and in the units of the Monte Carlo.
455 ////////////////////////////////////////////////////////////////////////
456 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
463 gm->GtoL(fLayer,fLadder,fDet,g,l);
466 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
470 //______________________________________________________________________
471 Float_t AliITShit::GetZL(){
472 ////////////////////////////////////////////////////////////////////////
473 // Returns the z position of this hit in the local coordinates of this
474 // module, and in the units of the Monte Carlo.
475 ////////////////////////////////////////////////////////////////////////
476 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
483 gm->GtoL(fLayer,fLadder,fDet,g,l);
486 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
490 //______________________________________________________________________
491 void AliITShit::GetMomentumL(Float_t &px,Float_t &py,Float_t &pz){
492 ////////////////////////////////////////////////////////////////////////
493 // Returns the momentum of this hit in the local coordinates of this
494 // module, and in the units of the Monte Carlo.
495 ////////////////////////////////////////////////////////////////////////
496 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
503 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
508 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
515 //______________________________________________________________________
516 Float_t AliITShit::GetPXL(){
517 ////////////////////////////////////////////////////////////////////////
518 // Returns the X momentum of this hit in the local coordinates of this
519 // module, and in the units of the Monte Carlo.
520 ////////////////////////////////////////////////////////////////////////
521 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
528 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
531 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
535 //______________________________________________________________________
536 Float_t AliITShit::GetPYL(){
537 ////////////////////////////////////////////////////////////////////////
538 // Returns the Y momentum of this hit in the local coordinates of this
539 // module, and in the units of the Monte Carlo.
540 ////////////////////////////////////////////////////////////////////////
541 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
548 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
551 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
556 //______________________________________________________________________
557 Float_t AliITShit::GetPZL(){
558 ////////////////////////////////////////////////////////////////////////
559 // Returns the Z momentum of this hit in the local coordinates of this
560 // module, and in the units of the Monte Carlo.
561 ////////////////////////////////////////////////////////////////////////
562 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
569 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
572 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
577 //___________________________________________________________________________;
578 Int_t AliITShit::GetModule(){
579 ////////////////////////////////////////////////////////////////////////
580 // Returns the module index number of the module where this hit was in.
581 ////////////////////////////////////////////////////////////////////////
582 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
584 if (gm) return gm->GetModuleIndex(fLayer,fLadder,fDet);
586 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
590 //______________________________________________________________________
591 TParticle * AliITShit::GetParticle(){
592 ////////////////////////////////////////////////////////////////////////
593 // Returns the pointer to the TParticle for the particle that created
594 // this hit. From the TParticle all kinds of information about this
595 // particle can be found. See the TParticle class.
596 ////////////////////////////////////////////////////////////////////////
597 return gAlice->Particle(GetTrack());
599 //----------------------------------------------------------------------
600 void AliITShit::Print(ostream *os){
601 ////////////////////////////////////////////////////////////////////////
602 // Standard output format for this class.
603 ////////////////////////////////////////////////////////////////////////
618 fmt = os->setf(ios::scientific); // set scientific floating point output
619 *os << fTrack << " " << fX << " " << fY << " " << fZ << " ";
620 fmt = os->setf(ios::hex); // set hex for fStatus only.
621 *os << fStatus << " ";
622 fmt = os->setf(ios::dec); // every thing else decimel.
623 *os << fLayer << " " << fLadder << " " << fDet << " ";;
624 *os << fPx << " " << fPy << " " << fPz << " ";
625 *os << fDestep << " " << fTof;
626 *os << " " << fx0 << " " << fy0 << " " << fz0;
627 // *os << " " << endl;
628 os->flags(fmt); // reset back to old formating.
631 //----------------------------------------------------------------------
632 void AliITShit::Read(istream *is){
633 ////////////////////////////////////////////////////////////////////////
634 // Standard input format for this class.
635 ////////////////////////////////////////////////////////////////////////
638 *is >> fTrack >> fX >> fY >> fZ;
639 *is >> fStatus >> fLayer >> fLadder >> fDet >> fPx >> fPy >> fPz >>
641 *is >> fx0 >> fy0 >> fz0;
644 //----------------------------------------------------------------------
645 ostream &operator<<(ostream &os,AliITShit &p){
646 ////////////////////////////////////////////////////////////////////////
647 // Standard output streaming function.
648 ////////////////////////////////////////////////////////////////////////
653 //----------------------------------------------------------------------
654 istream &operator>>(istream &is,AliITShit &r){
655 ////////////////////////////////////////////////////////////////////////
656 // Standard input streaming function.
657 ////////////////////////////////////////////////////////////////////////
662 //----------------------------------------------------------------------