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.16 2002/06/19 21:12:37 nilsen
19 Fixed bug with non-zero-ed new data members in constructors. Thanks Jiri
20 for finding it and pointing it out.
22 Revision 1.15 2002/06/12 18:59:47 nilsen
23 Added Starting track location to hit class and related changes to modules.
24 This is at present still fully backwards compatible since starting hits
25 are still written to the file. When aliroot v4.0 will be released, this
26 backwards compatiblity will be broken by removing the enterence hit, and making
27 the nessesary changes to module at that time.
29 Revision 1.14 2002/05/19 18:17:03 hristov
30 Changes needed by ICC/IFC compiler (Intel)
32 Revision 1.13 2002/03/09 18:35:35 nilsen
33 Added functions to print out Hit data members.
35 Revision 1.12 2002/03/08 16:05:05 nilsen
36 Standeard io streamers added to make debugging et al. easier.
38 Revision 1.11 2001/01/30 09:23:13 hristov
39 Streamers removed (R.Brun)
41 Revision 1.10 2001/01/26 20:01:19 hristov
42 Major upgrade of AliRoot code
44 Revision 1.9 2000/10/02 16:32:51 barbera
45 Automatic streamer used and forward declarations added
47 Revision 1.3.4.7 2000/10/02 15:54:49 barbera
48 Automatic streamer used and forward declarations added
50 Revision 1.8 2000/09/22 12:35:21 nilsen
51 Traps placed incase it is used without a properly initilized AliITSgeom class.
53 Revision 1.7 2000/07/10 16:07:18 fca
54 Release version of ITS code
56 Revision 1.3.4.2 2000/03/04 23:43:57 nilsen
57 Fixed up the comments/documentation.
59 Revision 1.3.4.1 2000/01/12 19:03:32 nilsen
60 This is the version of the files after the merging done in December 1999.
61 See the ReadMe110100.txt file for details
63 Revision 1.3 1999/09/29 09:24:20 fca
64 Introduction of the Copyright and cvs Log
73 #include <TGeometry.h>
76 #include "TParticle.h"
80 #include "AliITSgeom.h"
81 #include "AliITShit.h"
85 ////////////////////////////////////////////////////////////////////////
87 // Written by Rene Brun, Federico Carminati, and Roberto Barbera
90 // Modified and documented by Bjorn S. Nilsen
93 // AliITShit is the hit class for the ITS. Hits are the information
94 // that comes from a Monte Carlo at each step as a particle mass through
95 // sensitive detector elements as particles are transported through a
100 <img src="picts/ITS/AliITShit_Class_Diagram.gif">
103 <font size=+2 color=red>
104 <p>This show the relasionships between the ITS hit class and the rest of Aliroot.
109 ////////////////////////////////////////////////////////////////////////
110 // Inline Member functions:
113 // The default creator of the AliITShit class.
116 // The default destructor of the AliITShit class.
119 // See AliHit for a full description. Returns the track number fTrack
122 // SetTrack(int track)
123 // See AliHit for a full description. Sets the track number fTrack
126 // Int_t GetTrackStatus()
127 // Returns the value of the track status flag fStatus. This flag
128 // indicates the track status at the time of creating this hit. It is
129 // made up of the following 8 status bits from highest order to lowest
131 // 0 : IsTrackAlive(): IsTrackStop():IsTrackDisappeared():
132 // IsTrackOut():IsTrackExiting():IsTrackEntering():IsTrackInside() .
133 // See AliMC for a description of these functions. If the function is
134 // true then the bit is set to one, otherwise it is zero.
136 // Bool_t StatusInside()
137 // Returns kTRUE if the particle producing this hit is still inside
138 // the present volume. Returns kFalse if this particle will be in another
139 // volume. {bit IsTrackInside is set or not}
141 // Bool_t StatusEntering()
142 // Returns kTRUE if the particle producing this hit is has just enterd
143 // the present volume. Returns kFalse otherwise. {bit IsTrackEntering is
146 // Bool_t StatusExiting()
147 // Returns kTRUE if the particle producing this hit is will exit
148 // the present volume. Returns kFalse otherwise. {bit IsTrackExiting is set
151 // Bool_t StatusOut()
152 // Returns kTRUE if the particle producing this hit is goint exit the
153 // simulation. Returns kFalse otherwise. {bit IsTrackOut is set or not}
155 // Bool_t StatusDisappeared()
156 // Returns kTRUE if the particle producing this hit is going to "disappear"
157 // for example it has interacted producing some other particles. Returns
158 // kFalse otherwise. {bit IsTrackOut is set or not}
160 // Bool_t StatusStop()
161 // Returns kTRUE if the particle producing this hit is has dropped below
162 // its energy cut off producing some other particles. Returns kFalse otherwise.
163 // {bit IsTrackOut is set or not}
165 // Bool_t StatuAlives()
166 // Returns kTRUE if the particle producing this hit is going to continue
167 // to be transported. Returns kFalse otherwise. {bit IsTrackOut is set or not}
170 // Returns the layer number, fLayer, for this hit.
173 // Returns the ladder number, fLadder, for this hit.
175 // Int_t GetDetector()
176 // Returns the detector number, fDet, for this hit.
178 // GetDetectorID(Int_t &layer, Int_t &ladder, Int_t &detector)
179 // Returns the layer, ladder, and detector numbers, fLayer fLadder fDet,
182 // Float_t GetIonization()
183 // Returns the energy lost, fDestep, by the particle creating this hit,
184 // in the units defined by the Monte Carlo.
186 // GetPositionG(Float_t &x, Float_t &y, Float_t &z)
187 // Returns the global position, fX fY fZ, of this hit, in the units
188 // define by the Monte Carlo.
190 // GetPositionG(Double_t &x, Double_t &y, Double_t &z)
191 // Returns the global position, fX fY fZ, of this hit, in the units
192 // define by the Monte Carlo.
194 // GetPositionG(Float_t &x, Float_t &y, Float_t &z, Float_t &tof)
195 // Returns the global position and time of flight, fX fY fZ fTof, of
196 // this hit, in the units define by the Monte Carlo.
198 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
199 // Returns the global position and time of flight, fX fY fZ fTof, of
200 // this hit, in the units define by the Monte Carlo.
202 // GetPositionL(Double_t &x,Double_t &y,Double_t &z)
203 // Returns the local position, fX fY fZ, of this hit in the coordiante
204 // of this module, in the units define by the Monte Carlo.
206 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
207 // Returns the local position and time of flight, fX fY fZ fTof, of
208 // this hit in the coordinates of this module, in the units define by the
212 // Returns the global x position in the units defined by the Monte Carlo.
215 // Returns the global y position in the units defined by the Monte Carlo.
218 // Returns the global z position in the units defined by the Monte Carlo.
221 // Returns the time of flight, fTof, of this hit, in the units defined
222 // by the Monte Carlo.
224 // GetMomentumG(Float_t &px, Float_t &py, Float_t &pz)
225 // Returns the global momentum, fPx fPy fPz, of the particle that made
226 // this hit, in the units define by the Monte Carlo.
228 // GetMomentumG(Double_t &px,Double_t &py,Double_t &pz)
229 // Returns the global momentum, fPx fPy fPz, of the particle that made
230 // this hit, in the units define by the Monte Carlo.
232 // GetMomentumL(Double_t &px,Double_t &py,Double_t &pz)
233 // Returns the momentum, fPx fPy fPz in coordinate appropreate for this
234 // specific module, in the units define by the Monte Carlo.
237 // Returns the global X momentum in the units defined by the Monte Carlo.
240 // Returns the global Y momentum in the units defined by the Monte Carlo.
243 // Returns the global Z momentum in the units defined by the Monte Carlo.
245 ////////////////////////////////////////////////////////////////////////
246 //_____________________________________________________________________________
247 AliITShit::AliITShit():AliHit(){
248 // Default Constructor
249 // Zero data member just to be safe.
255 // A default created AliITShit class.
257 fStatus = 0; // Track Status
258 fLayer = 0; // Layer number
259 fLadder = 0; // Ladder number
260 fDet = 0; // Detector number
261 fPx = 0.0; // PX of particle at the point of the hit
262 fPy = 0.0; // PY of particle at the point of the hit
263 fPz = 0.0; // PZ of particle at the point of the hit
264 fDestep = 0.0; // Energy deposited in the current step
265 fTof = 0.0; // Time of flight at the point of the hit
266 fStatus0 = 0; // zero status bit by default.
267 fx0 = 0.0; // Starting point of this step
268 fy0 = 0.0; // Starting point of this step
269 fz0 = 0.0; // Starting point of this step
270 ft0 = 0.0; // Starting point of this step
272 AliITShit::AliITShit(Int_t shunt,Int_t track,Int_t *vol,Float_t edep,
273 Float_t tof,TLorentzVector &x,TLorentzVector &x0,
274 TLorentzVector &p) : AliHit(shunt, track){
275 ////////////////////////////////////////////////////////////////////////
277 // The creator of the AliITShit class. The variables shunt and
278 // track are passed to the creator of the AliHit class. See the AliHit
279 // class for a full description. In the units of the Monte Carlo
280 ////////////////////////////////////////////////////////////////////////
282 // Int_t shunt See AliHit
283 // Int_t track Track number, see AliHit
284 // Int_t *vol Array of integer hit data,
285 // vol[0] Layer where the hit is, 1-6 typicaly
286 // vol[1] Ladder where the hit is.
287 // vol[2] Detector number where the hit is
288 // vol[3] Set of status bits
289 // vol[4] Set of status bits at start
293 // A default created AliITShit class.
295 fLayer = vol[0]; // Layer number
296 fLadder = vol[2]; // Ladder number
297 fDet = vol[1]; // Detector number
298 fStatus = vol[3]; // Track status flags
299 fStatus0 = vol[4]; // Track status flag for start position.
300 fX = x.X(); // Track X global position
301 fY = x.Y(); // Track Y global position
302 fZ = x.Z(); // Track Z global position
303 fPx = p.Px(); // Track X Momentum
304 fPy = p.Py(); // Track Y Momentum
305 fPz = p.Pz(); // Track Z Momentum
306 fDestep = edep; // Track dE/dx for this step
307 fTof = tof ; // Track Time of Flight for this step
308 fx0 = x0.X(); // Track X global position
309 fy0 = x0.Y(); // Track Y global position
310 fz0 = x0.Z(); // Track Z global position
311 ft0 = x0.T(); // Starting point of this step
313 //______________________________________________________________________
314 AliITShit::AliITShit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
315 AliHit(shunt, track){
316 ////////////////////////////////////////////////////////////////////////
318 // The creator of the AliITShit class. The variables shunt and
319 // track are passed to the creator of the AliHit class. See the AliHit
320 // class for a full description. the integer array *vol contains, in order,
321 // fLayer = vol[0], fDet = vol[1], fLadder = vol[2], fStatus = vol[3].
322 // The array *hits contains, in order, fX = hits[0], fY = hits[1],
323 // fZ = hits[2], fPx = hits[3], fPy = hits[4], fPz = hits[5],
324 // fDestep = hits[6], and fTof = hits[7]. In the units of the Monte Carlo
325 ////////////////////////////////////////////////////////////////////////
327 // Int_t shunt See AliHit
328 // Int_t track Track number, see AliHit
329 // Int_t *vol Array of integer hit data,
330 // vol[0] Layer where the hit is, 1-6 typicaly
331 // vol[1] Ladder where the hit is.
332 // vol[2] Detector number where the hit is
333 // vol[3] Set of status bits
334 // Float_t *hits Array of hit information
335 // hits[0] X global position of this hit
336 // hits[1] Y global position of this hit
337 // hits[2] Z global position of this hit
338 // hits[3] Px global position of this hit
339 // hits[4] Py global position of this hit
340 // hits[5] Pz global position of this hit
341 // hits[6] Energy deposited by this step
342 // hits[7] Time of flight of this particle at this step
346 // A standard created AliITShit class.
347 fLayer = vol[0]; // Layer number
348 fLadder = vol[2]; // Ladder number
349 fDet = vol[1]; // Detector number
350 fStatus = vol[3]; // Track status flags
351 fX = hits[0]; // Track X global position
352 fY = hits[1]; // Track Y global position
353 fZ = hits[2]; // Track Z global position
354 fPx = hits[3]; // Track X Momentum
355 fPy = hits[4]; // Track Y Momentum
356 fPz = hits[5]; // Track Z Momentum
357 fDestep = hits[6]; // Track dE/dx for this step
358 fTof = hits[7]; // Track Time of Flight for this step
359 fStatus0 = 0;// Track Status of Starting point
360 fx0 = 0.0; // Starting point of this step
361 fy0 = 0.0; // Starting point of this step
362 fz0 = 0.0; // Starting point of this step
363 ft0 = 0.0; // Starting point of this step
365 //______________________________________________________________________
366 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z){
367 ////////////////////////////////////////////////////////////////////////
368 // Returns the position of this hit in the local coordinates of this
369 // module, and in the units of the Monte Carlo.
370 ////////////////////////////////////////////////////////////////////////
371 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
378 gm->GtoL(fLayer,fLadder,fDet,g,l);
383 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
384 // AliITSv7 - SDD case
391 //______________________________________________________________________
392 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z,Float_t &tof){
393 ////////////////////////////////////////////////////////////////////////
394 // Returns the position and time of flight of this hit in the local
395 // coordinates of this module, and in the units of the Monte Carlo.
396 ////////////////////////////////////////////////////////////////////////
397 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
404 gm->GtoL(fLayer,fLadder,fDet,g,l);
409 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
410 // AliITSv7 - SDD case
418 //______________________________________________________________________
419 Float_t AliITShit::GetXL(){
420 ////////////////////////////////////////////////////////////////////////
421 // Returns the x position of this hit in the local coordinates of this
422 // module, and in the units of the Monte Carlo.
423 ////////////////////////////////////////////////////////////////////////
424 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
431 gm->GtoL(fLayer,fLadder,fDet,g,l);
434 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
438 //______________________________________________________________________
439 Float_t AliITShit::GetYL(){
440 ////////////////////////////////////////////////////////////////////////
441 // Returns the y position of this hit in the local coordinates of this
442 // module, and in the units of the Monte Carlo.
443 ////////////////////////////////////////////////////////////////////////
444 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
451 gm->GtoL(fLayer,fLadder,fDet,g,l);
454 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
458 //______________________________________________________________________
459 Float_t AliITShit::GetZL(){
460 ////////////////////////////////////////////////////////////////////////
461 // Returns the z position of this hit in the local coordinates of this
462 // module, and in the units of the Monte Carlo.
463 ////////////////////////////////////////////////////////////////////////
464 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
471 gm->GtoL(fLayer,fLadder,fDet,g,l);
474 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
478 //______________________________________________________________________
479 void AliITShit::GetMomentumL(Float_t &px,Float_t &py,Float_t &pz){
480 ////////////////////////////////////////////////////////////////////////
481 // Returns the momentum of this hit in the local coordinates of this
482 // module, and in the units of the Monte Carlo.
483 ////////////////////////////////////////////////////////////////////////
484 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
491 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
496 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
503 //______________________________________________________________________
504 Float_t AliITShit::GetPXL(){
505 ////////////////////////////////////////////////////////////////////////
506 // Returns the X momentum of this hit in the local coordinates of this
507 // module, and in the units of the Monte Carlo.
508 ////////////////////////////////////////////////////////////////////////
509 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
516 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
519 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
523 //______________________________________________________________________
524 Float_t AliITShit::GetPYL(){
525 ////////////////////////////////////////////////////////////////////////
526 // Returns the Y momentum of this hit in the local coordinates of this
527 // module, and in the units of the Monte Carlo.
528 ////////////////////////////////////////////////////////////////////////
529 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
536 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
539 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
544 //______________________________________________________________________
545 Float_t AliITShit::GetPZL(){
546 ////////////////////////////////////////////////////////////////////////
547 // Returns the Z momentum of this hit in the local coordinates of this
548 // module, and in the units of the Monte Carlo.
549 ////////////////////////////////////////////////////////////////////////
550 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
557 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
560 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
565 //___________________________________________________________________________;
566 Int_t AliITShit::GetModule(){
567 ////////////////////////////////////////////////////////////////////////
568 // Returns the module index number of the module where this hit was in.
569 ////////////////////////////////////////////////////////////////////////
570 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
572 if (gm) return gm->GetModuleIndex(fLayer,fLadder,fDet);
574 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
578 //______________________________________________________________________
579 TParticle * AliITShit::GetParticle(){
580 ////////////////////////////////////////////////////////////////////////
581 // Returns the pointer to the TParticle for the particle that created
582 // this hit. From the TParticle all kinds of information about this
583 // particle can be found. See the TParticle class.
584 ////////////////////////////////////////////////////////////////////////
585 return gAlice->Particle(GetTrack());
587 //----------------------------------------------------------------------
588 void AliITShit::Print(ostream *os){
589 ////////////////////////////////////////////////////////////////////////
590 // Standard output format for this class.
591 ////////////////////////////////////////////////////////////////////////
606 fmt = os->setf(ios::scientific); // set scientific floating point output
607 *os << fTrack << " " << fX << " " << fY << " " << fZ << " ";
608 fmt = os->setf(ios::hex); // set hex for fStatus only.
609 *os << fStatus << " ";
610 fmt = os->setf(ios::dec); // every thing else decimel.
611 *os << fLayer << " " << fLadder << " " << fDet << " ";;
612 *os << fPx << " " << fPy << " " << fPz << " ";
613 *os << fDestep << " " << fTof;
614 *os << " " << fx0 << " " << fy0 << " " << fz0 << " ";
616 os->flags(fmt); // reset back to old formating.
619 //----------------------------------------------------------------------
620 void AliITShit::Read(istream *is){
621 ////////////////////////////////////////////////////////////////////////
622 // Standard input format for this class.
623 ////////////////////////////////////////////////////////////////////////
626 *is >> fTrack >> fX >> fY >> fZ;
627 *is >> fStatus >> fLayer >> fLadder >> fDet >> fPx >> fPy >> fPz >>
629 *is >> fx0 >> fy0 >> fz0;
632 //----------------------------------------------------------------------
633 ostream &operator<<(ostream &os,AliITShit &p){
634 ////////////////////////////////////////////////////////////////////////
635 // Standard output streaming function.
636 ////////////////////////////////////////////////////////////////////////
641 //----------------------------------------------------------------------
642 istream &operator>>(istream &is,AliITShit &r){
643 ////////////////////////////////////////////////////////////////////////
644 // Standard input streaming function.
645 ////////////////////////////////////////////////////////////////////////
650 //----------------------------------------------------------------------