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.17 2002/06/20 09:10:14 hristov
19 Data member ft0 initialized
21 Revision 1.16 2002/06/19 21:12:37 nilsen
22 Fixed bug with non-zero-ed new data members in constructors. Thanks Jiri
23 for finding it and pointing it out.
25 Revision 1.15 2002/06/12 18:59:47 nilsen
26 Added Starting track location to hit class and related changes to modules.
27 This is at present still fully backwards compatible since starting hits
28 are still written to the file. When aliroot v4.0 will be released, this
29 backwards compatiblity will be broken by removing the enterence hit, and making
30 the nessesary changes to module at that time.
32 Revision 1.14 2002/05/19 18:17:03 hristov
33 Changes needed by ICC/IFC compiler (Intel)
35 Revision 1.13 2002/03/09 18:35:35 nilsen
36 Added functions to print out Hit data members.
38 Revision 1.12 2002/03/08 16:05:05 nilsen
39 Standeard io streamers added to make debugging et al. easier.
41 Revision 1.11 2001/01/30 09:23:13 hristov
42 Streamers removed (R.Brun)
44 Revision 1.10 2001/01/26 20:01:19 hristov
45 Major upgrade of AliRoot code
47 Revision 1.9 2000/10/02 16:32:51 barbera
48 Automatic streamer used and forward declarations added
50 Revision 1.3.4.7 2000/10/02 15:54:49 barbera
51 Automatic streamer used and forward declarations added
53 Revision 1.8 2000/09/22 12:35:21 nilsen
54 Traps placed incase it is used without a properly initilized AliITSgeom class.
56 Revision 1.7 2000/07/10 16:07:18 fca
57 Release version of ITS code
59 Revision 1.3.4.2 2000/03/04 23:43:57 nilsen
60 Fixed up the comments/documentation.
62 Revision 1.3.4.1 2000/01/12 19:03:32 nilsen
63 This is the version of the files after the merging done in December 1999.
64 See the ReadMe110100.txt file for details
66 Revision 1.3 1999/09/29 09:24:20 fca
67 Introduction of the Copyright and cvs Log
76 #include <TGeometry.h>
79 #include "TParticle.h"
83 #include "AliITSgeom.h"
84 #include "AliITShit.h"
88 ////////////////////////////////////////////////////////////////////////
90 // Written by Rene Brun, Federico Carminati, and Roberto Barbera
93 // Modified and documented by Bjorn S. Nilsen
96 // AliITShit is the hit class for the ITS. Hits are the information
97 // that comes from a Monte Carlo at each step as a particle mass through
98 // sensitive detector elements as particles are transported through a
103 <img src="picts/ITS/AliITShit_Class_Diagram.gif">
106 <font size=+2 color=red>
107 <p>This show the relasionships between the ITS hit class and the rest of Aliroot.
112 ////////////////////////////////////////////////////////////////////////
113 // Inline Member functions:
116 // The default creator of the AliITShit class.
119 // The default destructor of the AliITShit class.
122 // See AliHit for a full description. Returns the track number fTrack
125 // SetTrack(int track)
126 // See AliHit for a full description. Sets the track number fTrack
129 // Int_t GetTrackStatus()
130 // Returns the value of the track status flag fStatus. This flag
131 // indicates the track status at the time of creating this hit. It is
132 // made up of the following 8 status bits from highest order to lowest
134 // 0 : IsTrackAlive(): IsTrackStop():IsTrackDisappeared():
135 // IsTrackOut():IsTrackExiting():IsTrackEntering():IsTrackInside() .
136 // See AliMC for a description of these functions. If the function is
137 // true then the bit is set to one, otherwise it is zero.
139 // Bool_t StatusInside()
140 // Returns kTRUE if the particle producing this hit is still inside
141 // the present volume. Returns kFalse if this particle will be in another
142 // volume. {bit IsTrackInside is set or not}
144 // Bool_t StatusEntering()
145 // Returns kTRUE if the particle producing this hit is has just enterd
146 // the present volume. Returns kFalse otherwise. {bit IsTrackEntering is
149 // Bool_t StatusExiting()
150 // Returns kTRUE if the particle producing this hit is will exit
151 // the present volume. Returns kFalse otherwise. {bit IsTrackExiting is set
154 // Bool_t StatusOut()
155 // Returns kTRUE if the particle producing this hit is goint exit the
156 // simulation. Returns kFalse otherwise. {bit IsTrackOut is set or not}
158 // Bool_t StatusDisappeared()
159 // Returns kTRUE if the particle producing this hit is going to "disappear"
160 // for example it has interacted producing some other particles. Returns
161 // kFalse otherwise. {bit IsTrackOut is set or not}
163 // Bool_t StatusStop()
164 // Returns kTRUE if the particle producing this hit is has dropped below
165 // its energy cut off producing some other particles. Returns kFalse otherwise.
166 // {bit IsTrackOut is set or not}
168 // Bool_t StatuAlives()
169 // Returns kTRUE if the particle producing this hit is going to continue
170 // to be transported. Returns kFalse otherwise. {bit IsTrackOut is set or not}
173 // Returns the layer number, fLayer, for this hit.
176 // Returns the ladder number, fLadder, for this hit.
178 // Int_t GetDetector()
179 // Returns the detector number, fDet, for this hit.
181 // GetDetectorID(Int_t &layer, Int_t &ladder, Int_t &detector)
182 // Returns the layer, ladder, and detector numbers, fLayer fLadder fDet,
185 // Float_t GetIonization()
186 // Returns the energy lost, fDestep, by the particle creating this hit,
187 // in the units defined by the Monte Carlo.
189 // GetPositionG(Float_t &x, Float_t &y, Float_t &z)
190 // Returns the global position, fX fY fZ, of this hit, in the units
191 // define by the Monte Carlo.
193 // GetPositionG(Double_t &x, Double_t &y, Double_t &z)
194 // Returns the global position, fX fY fZ, of this hit, in the units
195 // define by the Monte Carlo.
197 // GetPositionG(Float_t &x, Float_t &y, Float_t &z, Float_t &tof)
198 // Returns the global position and time of flight, fX fY fZ fTof, of
199 // this hit, in the units define by the Monte Carlo.
201 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
202 // Returns the global position and time of flight, fX fY fZ fTof, of
203 // this hit, in the units define by the Monte Carlo.
205 // GetPositionL(Double_t &x,Double_t &y,Double_t &z)
206 // Returns the local position, fX fY fZ, of this hit in the coordiante
207 // of this module, in the units define by the Monte Carlo.
209 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
210 // Returns the local position and time of flight, fX fY fZ fTof, of
211 // this hit in the coordinates of this module, in the units define by the
215 // Returns the global x position in the units defined by the Monte Carlo.
218 // Returns the global y position in the units defined by the Monte Carlo.
221 // Returns the global z position in the units defined by the Monte Carlo.
224 // Returns the time of flight, fTof, of this hit, in the units defined
225 // by the Monte Carlo.
227 // GetMomentumG(Float_t &px, Float_t &py, Float_t &pz)
228 // Returns the global momentum, fPx fPy fPz, of the particle that made
229 // this hit, in the units define by the Monte Carlo.
231 // GetMomentumG(Double_t &px,Double_t &py,Double_t &pz)
232 // Returns the global momentum, fPx fPy fPz, of the particle that made
233 // this hit, in the units define by the Monte Carlo.
235 // GetMomentumL(Double_t &px,Double_t &py,Double_t &pz)
236 // Returns the momentum, fPx fPy fPz in coordinate appropreate for this
237 // specific module, in the units define by the Monte Carlo.
240 // Returns the global X momentum in the units defined by the Monte Carlo.
243 // Returns the global Y momentum in the units defined by the Monte Carlo.
246 // Returns the global Z momentum in the units defined by the Monte Carlo.
248 ////////////////////////////////////////////////////////////////////////
249 //_____________________________________________________________________________
250 AliITShit::AliITShit():AliHit(){
251 // Default Constructor
252 // Zero data member just to be safe.
258 // A default created AliITShit class.
260 fStatus = 0; // Track Status
261 fLayer = 0; // Layer number
262 fLadder = 0; // Ladder number
263 fDet = 0; // Detector number
264 fPx = 0.0; // PX of particle at the point of the hit
265 fPy = 0.0; // PY of particle at the point of the hit
266 fPz = 0.0; // PZ of particle at the point of the hit
267 fDestep = 0.0; // Energy deposited in the current step
268 fTof = 0.0; // Time of flight at the point of the hit
269 fStatus0 = 0; // zero status bit by default.
270 fx0 = 0.0; // Starting point of this step
271 fy0 = 0.0; // Starting point of this step
272 fz0 = 0.0; // Starting point of this step
273 ft0 = 0.0; // Starting point of this step
275 AliITShit::AliITShit(Int_t shunt,Int_t track,Int_t *vol,Float_t edep,
276 Float_t tof,TLorentzVector &x,TLorentzVector &x0,
277 TLorentzVector &p) : AliHit(shunt, track){
278 ////////////////////////////////////////////////////////////////////////
280 // The creator of the AliITShit class. The variables shunt and
281 // track are passed to the creator of the AliHit class. See the AliHit
282 // class for a full description. In the units of the Monte Carlo
283 ////////////////////////////////////////////////////////////////////////
285 // Int_t shunt See AliHit
286 // Int_t track Track number, see AliHit
287 // Int_t *vol Array of integer hit data,
288 // vol[0] Layer where the hit is, 1-6 typicaly
289 // vol[1] Ladder where the hit is.
290 // vol[2] Detector number where the hit is
291 // vol[3] Set of status bits
292 // vol[4] Set of status bits at start
296 // A default created AliITShit class.
298 fLayer = vol[0]; // Layer number
299 fLadder = vol[2]; // Ladder number
300 fDet = vol[1]; // Detector number
301 fStatus = vol[3]; // Track status flags
302 fStatus0 = vol[4]; // Track status flag for start position.
303 fX = x.X(); // Track X global position
304 fY = x.Y(); // Track Y global position
305 fZ = x.Z(); // Track Z global position
306 fPx = p.Px(); // Track X Momentum
307 fPy = p.Py(); // Track Y Momentum
308 fPz = p.Pz(); // Track Z Momentum
309 fDestep = edep; // Track dE/dx for this step
310 fTof = tof ; // Track Time of Flight for this step
311 fx0 = x0.X(); // Track X global position
312 fy0 = x0.Y(); // Track Y global position
313 fz0 = x0.Z(); // Track Z global position
314 ft0 = x0.T(); // Starting point of this step
316 //______________________________________________________________________
317 AliITShit::AliITShit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
318 AliHit(shunt, track){
319 ////////////////////////////////////////////////////////////////////////
321 // The creator of the AliITShit class. The variables shunt and
322 // track are passed to the creator of the AliHit class. See the AliHit
323 // class for a full description. the integer array *vol contains, in order,
324 // fLayer = vol[0], fDet = vol[1], fLadder = vol[2], fStatus = vol[3].
325 // The array *hits contains, in order, fX = hits[0], fY = hits[1],
326 // fZ = hits[2], fPx = hits[3], fPy = hits[4], fPz = hits[5],
327 // fDestep = hits[6], and fTof = hits[7]. In the units of the Monte Carlo
328 ////////////////////////////////////////////////////////////////////////
330 // Int_t shunt See AliHit
331 // Int_t track Track number, see AliHit
332 // Int_t *vol Array of integer hit data,
333 // vol[0] Layer where the hit is, 1-6 typicaly
334 // vol[1] Ladder where the hit is.
335 // vol[2] Detector number where the hit is
336 // vol[3] Set of status bits
337 // Float_t *hits Array of hit information
338 // hits[0] X global position of this hit
339 // hits[1] Y global position of this hit
340 // hits[2] Z global position of this hit
341 // hits[3] Px global position of this hit
342 // hits[4] Py global position of this hit
343 // hits[5] Pz global position of this hit
344 // hits[6] Energy deposited by this step
345 // hits[7] Time of flight of this particle at this step
349 // A standard created AliITShit class.
350 fLayer = vol[0]; // Layer number
351 fLadder = vol[2]; // Ladder number
352 fDet = vol[1]; // Detector number
353 fStatus = vol[3]; // Track status flags
354 fX = hits[0]; // Track X global position
355 fY = hits[1]; // Track Y global position
356 fZ = hits[2]; // Track Z global position
357 fPx = hits[3]; // Track X Momentum
358 fPy = hits[4]; // Track Y Momentum
359 fPz = hits[5]; // Track Z Momentum
360 fDestep = hits[6]; // Track dE/dx for this step
361 fTof = hits[7]; // Track Time of Flight for this step
362 fStatus0 = 0;// Track Status of Starting point
363 fx0 = 0.0; // Starting point of this step
364 fy0 = 0.0; // Starting point of this step
365 fz0 = 0.0; // Starting point of this step
366 ft0 = 0.0; // Starting point of this step
368 //______________________________________________________________________
369 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z){
370 ////////////////////////////////////////////////////////////////////////
371 // Returns the position of this hit in the local coordinates of this
372 // module, and in the units of the Monte Carlo.
373 ////////////////////////////////////////////////////////////////////////
374 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
381 gm->GtoL(fLayer,fLadder,fDet,g,l);
386 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
387 // AliITSv7 - SDD case
394 //______________________________________________________________________
395 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z,Float_t &tof){
396 ////////////////////////////////////////////////////////////////////////
397 // Returns the position and time of flight of this hit in the local
398 // coordinates of this module, and in the units of the Monte Carlo.
399 ////////////////////////////////////////////////////////////////////////
400 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
407 gm->GtoL(fLayer,fLadder,fDet,g,l);
412 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
413 // AliITSv7 - SDD case
421 //______________________________________________________________________
422 Float_t AliITShit::GetXL(){
423 ////////////////////////////////////////////////////////////////////////
424 // Returns the x position of this hit in the local coordinates of this
425 // module, and in the units of the Monte Carlo.
426 ////////////////////////////////////////////////////////////////////////
427 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
434 gm->GtoL(fLayer,fLadder,fDet,g,l);
437 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
441 //______________________________________________________________________
442 Float_t AliITShit::GetYL(){
443 ////////////////////////////////////////////////////////////////////////
444 // Returns the y position of this hit in the local coordinates of this
445 // module, and in the units of the Monte Carlo.
446 ////////////////////////////////////////////////////////////////////////
447 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
454 gm->GtoL(fLayer,fLadder,fDet,g,l);
457 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
461 //______________________________________________________________________
462 Float_t AliITShit::GetZL(){
463 ////////////////////////////////////////////////////////////////////////
464 // Returns the z position of this hit in the local coordinates of this
465 // module, and in the units of the Monte Carlo.
466 ////////////////////////////////////////////////////////////////////////
467 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
474 gm->GtoL(fLayer,fLadder,fDet,g,l);
477 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
481 //______________________________________________________________________
482 void AliITShit::GetMomentumL(Float_t &px,Float_t &py,Float_t &pz){
483 ////////////////////////////////////////////////////////////////////////
484 // Returns the momentum of this hit in the local coordinates of this
485 // module, and in the units of the Monte Carlo.
486 ////////////////////////////////////////////////////////////////////////
487 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
494 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
499 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
506 //______________________________________________________________________
507 Float_t AliITShit::GetPXL(){
508 ////////////////////////////////////////////////////////////////////////
509 // Returns the X momentum of this hit in the local coordinates of this
510 // module, and in the units of the Monte Carlo.
511 ////////////////////////////////////////////////////////////////////////
512 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
519 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
522 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
526 //______________________________________________________________________
527 Float_t AliITShit::GetPYL(){
528 ////////////////////////////////////////////////////////////////////////
529 // Returns the Y 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 Float_t AliITShit::GetPZL(){
549 ////////////////////////////////////////////////////////////////////////
550 // Returns the Z momentum of this hit in the local coordinates of this
551 // module, and in the units of the Monte Carlo.
552 ////////////////////////////////////////////////////////////////////////
553 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
560 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
563 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
568 //___________________________________________________________________________;
569 Int_t AliITShit::GetModule(){
570 ////////////////////////////////////////////////////////////////////////
571 // Returns the module index number of the module where this hit was in.
572 ////////////////////////////////////////////////////////////////////////
573 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
575 if (gm) return gm->GetModuleIndex(fLayer,fLadder,fDet);
577 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
581 //______________________________________________________________________
582 TParticle * AliITShit::GetParticle(){
583 ////////////////////////////////////////////////////////////////////////
584 // Returns the pointer to the TParticle for the particle that created
585 // this hit. From the TParticle all kinds of information about this
586 // particle can be found. See the TParticle class.
587 ////////////////////////////////////////////////////////////////////////
588 return gAlice->Particle(GetTrack());
590 //----------------------------------------------------------------------
591 void AliITShit::Print(ostream *os){
592 ////////////////////////////////////////////////////////////////////////
593 // Standard output format for this class.
594 ////////////////////////////////////////////////////////////////////////
609 fmt = os->setf(ios::scientific); // set scientific floating point output
610 *os << fTrack << " " << fX << " " << fY << " " << fZ << " ";
611 fmt = os->setf(ios::hex); // set hex for fStatus only.
612 *os << fStatus << " ";
613 fmt = os->setf(ios::dec); // every thing else decimel.
614 *os << fLayer << " " << fLadder << " " << fDet << " ";;
615 *os << fPx << " " << fPy << " " << fPz << " ";
616 *os << fDestep << " " << fTof;
617 *os << " " << fx0 << " " << fy0 << " " << fz0;
618 // *os << " " << endl;
619 os->flags(fmt); // reset back to old formating.
622 //----------------------------------------------------------------------
623 void AliITShit::Read(istream *is){
624 ////////////////////////////////////////////////////////////////////////
625 // Standard input format for this class.
626 ////////////////////////////////////////////////////////////////////////
629 *is >> fTrack >> fX >> fY >> fZ;
630 *is >> fStatus >> fLayer >> fLadder >> fDet >> fPx >> fPy >> fPz >>
632 *is >> fx0 >> fy0 >> fz0;
635 //----------------------------------------------------------------------
636 ostream &operator<<(ostream &os,AliITShit &p){
637 ////////////////////////////////////////////////////////////////////////
638 // Standard output streaming function.
639 ////////////////////////////////////////////////////////////////////////
644 //----------------------------------------------------------------------
645 istream &operator>>(istream &is,AliITShit &r){
646 ////////////////////////////////////////////////////////////////////////
647 // Standard input streaming function.
648 ////////////////////////////////////////////////////////////////////////
653 //----------------------------------------------------------------------