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.13.6.3 2002/08/28 15:06:50 alibrary
21 Revision 1.18 2002/08/07 18:37:53 nilsen
22 Removed endl from print function. should be supplied by user as wanted.
24 Revision 1.17 2002/06/20 09:10:14 hristov
25 Data member ft0 initialized
27 Revision 1.16 2002/06/19 21:12:37 nilsen
28 Fixed bug with non-zero-ed new data members in constructors. Thanks Jiri
29 for finding it and pointing it out.
31 Revision 1.15 2002/06/12 18:59:47 nilsen
32 Added Starting track location to hit class and related changes to modules.
33 This is at present still fully backwards compatible since starting hits
34 are still written to the file. When aliroot v4.0 will be released, this
35 backwards compatiblity will be broken by removing the enterence hit, and making
36 the nessesary changes to module at that time.
38 Revision 1.14 2002/05/19 18:17:03 hristov
39 Changes needed by ICC/IFC compiler (Intel)
41 Revision 1.13 2002/03/09 18:35:35 nilsen
42 Added functions to print out Hit data members.
44 Revision 1.12 2002/03/08 16:05:05 nilsen
45 Standeard io streamers added to make debugging et al. easier.
47 Revision 1.11 2001/01/30 09:23:13 hristov
48 Streamers removed (R.Brun)
50 Revision 1.10 2001/01/26 20:01:19 hristov
51 Major upgrade of AliRoot code
53 Revision 1.9 2000/10/02 16:32:51 barbera
54 Automatic streamer used and forward declarations added
56 Revision 1.3.4.7 2000/10/02 15:54:49 barbera
57 Automatic streamer used and forward declarations added
59 Revision 1.8 2000/09/22 12:35:21 nilsen
60 Traps placed incase it is used without a properly initilized AliITSgeom class.
62 Revision 1.7 2000/07/10 16:07:18 fca
63 Release version of ITS code
65 Revision 1.3.4.2 2000/03/04 23:43:57 nilsen
66 Fixed up the comments/documentation.
68 Revision 1.3.4.1 2000/01/12 19:03:32 nilsen
69 This is the version of the files after the merging done in December 1999.
70 See the ReadMe110100.txt file for details
72 Revision 1.3 1999/09/29 09:24:20 fca
73 Introduction of the Copyright and cvs Log
82 #include <TGeometry.h>
85 #include "TParticle.h"
89 #include "AliITSgeom.h"
90 #include "AliITShit.h"
94 ////////////////////////////////////////////////////////////////////////
96 // Written by Rene Brun, Federico Carminati, and Roberto Barbera
99 // Modified and documented by Bjorn S. Nilsen
102 // AliITShit is the hit class for the ITS. Hits are the information
103 // that comes from a Monte Carlo at each step as a particle mass through
104 // sensitive detector elements as particles are transported through a
109 <img src="picts/ITS/AliITShit_Class_Diagram.gif">
112 <font size=+2 color=red>
113 <p>This show the relasionships between the ITS hit class and the rest of Aliroot.
118 ////////////////////////////////////////////////////////////////////////
119 // Inline Member functions:
122 // The default creator of the AliITShit class.
125 // The default destructor of the AliITShit class.
128 // See AliHit for a full description. Returns the track number fTrack
131 // SetTrack(int track)
132 // See AliHit for a full description. Sets the track number fTrack
135 // Int_t GetTrackStatus()
136 // Returns the value of the track status flag fStatus. This flag
137 // indicates the track status at the time of creating this hit. It is
138 // made up of the following 8 status bits from highest order to lowest
140 // 0 : IsTrackAlive(): IsTrackStop():IsTrackDisappeared():
141 // IsTrackOut():IsTrackExiting():IsTrackEntering():IsTrackInside() .
142 // See AliMC for a description of these functions. If the function is
143 // true then the bit is set to one, otherwise it is zero.
145 // Bool_t StatusInside()
146 // Returns kTRUE if the particle producing this hit is still inside
147 // the present volume. Returns kFalse if this particle will be in another
148 // volume. {bit IsTrackInside is set or not}
150 // Bool_t StatusEntering()
151 // Returns kTRUE if the particle producing this hit is has just enterd
152 // the present volume. Returns kFalse otherwise. {bit IsTrackEntering is
155 // Bool_t StatusExiting()
156 // Returns kTRUE if the particle producing this hit is will exit
157 // the present volume. Returns kFalse otherwise. {bit IsTrackExiting is set
160 // Bool_t StatusOut()
161 // Returns kTRUE if the particle producing this hit is goint exit the
162 // simulation. Returns kFalse otherwise. {bit IsTrackOut is set or not}
164 // Bool_t StatusDisappeared()
165 // Returns kTRUE if the particle producing this hit is going to "disappear"
166 // for example it has interacted producing some other particles. Returns
167 // kFalse otherwise. {bit IsTrackOut is set or not}
169 // Bool_t StatusStop()
170 // Returns kTRUE if the particle producing this hit is has dropped below
171 // its energy cut off producing some other particles. Returns kFalse otherwise.
172 // {bit IsTrackOut is set or not}
174 // Bool_t StatuAlives()
175 // Returns kTRUE if the particle producing this hit is going to continue
176 // to be transported. Returns kFalse otherwise. {bit IsTrackOut is set or not}
179 // Returns the layer number, fLayer, for this hit.
182 // Returns the ladder number, fLadder, for this hit.
184 // Int_t GetDetector()
185 // Returns the detector number, fDet, for this hit.
187 // GetDetectorID(Int_t &layer, Int_t &ladder, Int_t &detector)
188 // Returns the layer, ladder, and detector numbers, fLayer fLadder fDet,
191 // Float_t GetIonization()
192 // Returns the energy lost, fDestep, by the particle creating this hit,
193 // in the units defined by the Monte Carlo.
195 // GetPositionG(Float_t &x, Float_t &y, Float_t &z)
196 // Returns the global position, fX fY fZ, of this hit, in the units
197 // define by the Monte Carlo.
199 // GetPositionG(Double_t &x, Double_t &y, Double_t &z)
200 // Returns the global position, fX fY fZ, of this hit, in the units
201 // define by the Monte Carlo.
203 // GetPositionG(Float_t &x, Float_t &y, Float_t &z, Float_t &tof)
204 // Returns the global position and time of flight, fX fY fZ fTof, of
205 // this hit, in the units define by the Monte Carlo.
207 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
208 // Returns the global position and time of flight, fX fY fZ fTof, of
209 // this hit, in the units define by the Monte Carlo.
211 // GetPositionL(Double_t &x,Double_t &y,Double_t &z)
212 // Returns the local position, fX fY fZ, of this hit in the coordiante
213 // of this module, in the units define by the Monte Carlo.
215 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
216 // Returns the local position and time of flight, fX fY fZ fTof, of
217 // this hit in the coordinates of this module, in the units define by the
221 // Returns the global x position in the units defined by the Monte Carlo.
224 // Returns the global y position in the units defined by the Monte Carlo.
227 // Returns the global z position in the units defined by the Monte Carlo.
230 // Returns the time of flight, fTof, of this hit, in the units defined
231 // by the Monte Carlo.
233 // GetMomentumG(Float_t &px, Float_t &py, Float_t &pz)
234 // Returns the global momentum, fPx fPy fPz, of the particle that made
235 // this hit, in the units define by the Monte Carlo.
237 // GetMomentumG(Double_t &px,Double_t &py,Double_t &pz)
238 // Returns the global momentum, fPx fPy fPz, of the particle that made
239 // this hit, in the units define by the Monte Carlo.
241 // GetMomentumL(Double_t &px,Double_t &py,Double_t &pz)
242 // Returns the momentum, fPx fPy fPz in coordinate appropreate for this
243 // specific module, in the units define by the Monte Carlo.
246 // Returns the global X momentum in the units defined by the Monte Carlo.
249 // Returns the global Y momentum in the units defined by the Monte Carlo.
252 // Returns the global Z momentum in the units defined by the Monte Carlo.
254 ////////////////////////////////////////////////////////////////////////
255 //_____________________________________________________________________________
256 AliITShit::AliITShit():AliHit(){
257 // Default Constructor
258 // Zero data member just to be safe.
264 // A default created AliITShit class.
266 fStatus = 0; // Track Status
267 fLayer = 0; // Layer number
268 fLadder = 0; // Ladder number
269 fDet = 0; // Detector number
270 fPx = 0.0; // PX of particle at the point of the hit
271 fPy = 0.0; // PY of particle at the point of the hit
272 fPz = 0.0; // PZ of particle at the point of the hit
273 fDestep = 0.0; // Energy deposited in the current step
274 fTof = 0.0; // Time of flight at the point of the hit
275 fStatus0 = 0; // zero status bit by default.
276 fx0 = 0.0; // Starting point of this step
277 fy0 = 0.0; // Starting point of this step
278 fz0 = 0.0; // Starting point of this step
279 ft0 = 0.0; // Starting point of this step
281 AliITShit::AliITShit(Int_t shunt,Int_t track,Int_t *vol,Float_t edep,
282 Float_t tof,TLorentzVector &x,TLorentzVector &x0,
283 TLorentzVector &p) : AliHit(shunt, track){
284 ////////////////////////////////////////////////////////////////////////
286 // The creator of the AliITShit class. The variables shunt and
287 // track are passed to the creator of the AliHit class. See the AliHit
288 // class for a full description. In the units of the Monte Carlo
289 ////////////////////////////////////////////////////////////////////////
291 // Int_t shunt See AliHit
292 // Int_t track Track number, see AliHit
293 // Int_t *vol Array of integer hit data,
294 // vol[0] Layer where the hit is, 1-6 typicaly
295 // vol[1] Ladder where the hit is.
296 // vol[2] Detector number where the hit is
297 // vol[3] Set of status bits
298 // vol[4] Set of status bits at start
302 // A default created AliITShit class.
304 fLayer = vol[0]; // Layer number
305 fLadder = vol[2]; // Ladder number
306 fDet = vol[1]; // Detector number
307 fStatus = vol[3]; // Track status flags
308 fStatus0 = vol[4]; // Track status flag for start position.
309 fX = x.X(); // Track X global position
310 fY = x.Y(); // Track Y global position
311 fZ = x.Z(); // Track Z global position
312 fPx = p.Px(); // Track X Momentum
313 fPy = p.Py(); // Track Y Momentum
314 fPz = p.Pz(); // Track Z Momentum
315 fDestep = edep; // Track dE/dx for this step
316 fTof = tof ; // Track Time of Flight for this step
317 fx0 = x0.X(); // Track X global position
318 fy0 = x0.Y(); // Track Y global position
319 fz0 = x0.Z(); // Track Z global position
320 ft0 = x0.T(); // Starting point of this step
322 //______________________________________________________________________
323 AliITShit::AliITShit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
324 AliHit(shunt, track){
325 ////////////////////////////////////////////////////////////////////////
327 // The creator of the AliITShit class. The variables shunt and
328 // track are passed to the creator of the AliHit class. See the AliHit
329 // class for a full description. the integer array *vol contains, in order,
330 // fLayer = vol[0], fDet = vol[1], fLadder = vol[2], fStatus = vol[3].
331 // The array *hits contains, in order, fX = hits[0], fY = hits[1],
332 // fZ = hits[2], fPx = hits[3], fPy = hits[4], fPz = hits[5],
333 // fDestep = hits[6], and fTof = hits[7]. In the units of the Monte Carlo
334 ////////////////////////////////////////////////////////////////////////
336 // Int_t shunt See AliHit
337 // Int_t track Track number, see AliHit
338 // Int_t *vol Array of integer hit data,
339 // vol[0] Layer where the hit is, 1-6 typicaly
340 // vol[1] Ladder where the hit is.
341 // vol[2] Detector number where the hit is
342 // vol[3] Set of status bits
343 // Float_t *hits Array of hit information
344 // hits[0] X global position of this hit
345 // hits[1] Y global position of this hit
346 // hits[2] Z global position of this hit
347 // hits[3] Px global position of this hit
348 // hits[4] Py global position of this hit
349 // hits[5] Pz global position of this hit
350 // hits[6] Energy deposited by this step
351 // hits[7] Time of flight of this particle at this step
355 // A standard created AliITShit class.
356 fLayer = vol[0]; // Layer number
357 fLadder = vol[2]; // Ladder number
358 fDet = vol[1]; // Detector number
359 fStatus = vol[3]; // Track status flags
360 fX = hits[0]; // Track X global position
361 fY = hits[1]; // Track Y global position
362 fZ = hits[2]; // Track Z global position
363 fPx = hits[3]; // Track X Momentum
364 fPy = hits[4]; // Track Y Momentum
365 fPz = hits[5]; // Track Z Momentum
366 fDestep = hits[6]; // Track dE/dx for this step
367 fTof = hits[7]; // Track Time of Flight for this step
368 fStatus0 = 0;// Track Status of Starting point
369 fx0 = 0.0; // Starting point of this step
370 fy0 = 0.0; // Starting point of this step
371 fz0 = 0.0; // Starting point of this step
372 ft0 = 0.0; // Starting point of this step
374 //______________________________________________________________________
375 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z){
376 ////////////////////////////////////////////////////////////////////////
377 // Returns the position of this hit in the local coordinates of this
378 // module, and in the units of the Monte Carlo.
379 ////////////////////////////////////////////////////////////////////////
380 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
387 gm->GtoL(fLayer,fLadder,fDet,g,l);
392 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
393 // AliITSv7 - SDD case
400 //______________________________________________________________________
401 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z,Float_t &tof){
402 ////////////////////////////////////////////////////////////////////////
403 // Returns the position and time of flight of this hit in the local
404 // coordinates of this 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);
418 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
419 // AliITSv7 - SDD case
427 //______________________________________________________________________
428 Float_t AliITShit::GetXL(){
429 ////////////////////////////////////////////////////////////////////////
430 // Returns the x position of this hit in the local coordinates of this
431 // module, and in the units of the Monte Carlo.
432 ////////////////////////////////////////////////////////////////////////
433 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
440 gm->GtoL(fLayer,fLadder,fDet,g,l);
443 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
447 //______________________________________________________________________
448 Float_t AliITShit::GetYL(){
449 ////////////////////////////////////////////////////////////////////////
450 // Returns the y position of this hit in the local coordinates of this
451 // module, and in the units of the Monte Carlo.
452 ////////////////////////////////////////////////////////////////////////
453 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
460 gm->GtoL(fLayer,fLadder,fDet,g,l);
463 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
467 //______________________________________________________________________
468 Float_t AliITShit::GetZL(){
469 ////////////////////////////////////////////////////////////////////////
470 // Returns the z position of this hit in the local coordinates of this
471 // module, and in the units of the Monte Carlo.
472 ////////////////////////////////////////////////////////////////////////
473 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
480 gm->GtoL(fLayer,fLadder,fDet,g,l);
483 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
487 //______________________________________________________________________
488 void AliITShit::GetMomentumL(Float_t &px,Float_t &py,Float_t &pz){
489 ////////////////////////////////////////////////////////////////////////
490 // Returns the momentum of this hit in the local coordinates of this
491 // module, and in the units of the Monte Carlo.
492 ////////////////////////////////////////////////////////////////////////
493 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
500 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
505 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
512 //______________________________________________________________________
513 Float_t AliITShit::GetPXL(){
514 ////////////////////////////////////////////////////////////////////////
515 // Returns the X momentum of this hit in the local coordinates of this
516 // module, and in the units of the Monte Carlo.
517 ////////////////////////////////////////////////////////////////////////
518 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
525 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
528 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
532 //______________________________________________________________________
533 Float_t AliITShit::GetPYL(){
534 ////////////////////////////////////////////////////////////////////////
535 // Returns the Y momentum of this hit in the local coordinates of this
536 // module, and in the units of the Monte Carlo.
537 ////////////////////////////////////////////////////////////////////////
538 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
545 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
548 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
553 //______________________________________________________________________
554 Float_t AliITShit::GetPZL(){
555 ////////////////////////////////////////////////////////////////////////
556 // Returns the Z momentum of this hit in the local coordinates of this
557 // module, and in the units of the Monte Carlo.
558 ////////////////////////////////////////////////////////////////////////
559 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
566 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
569 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
574 //___________________________________________________________________________;
575 Int_t AliITShit::GetModule(){
576 ////////////////////////////////////////////////////////////////////////
577 // Returns the module index number of the module where this hit was in.
578 ////////////////////////////////////////////////////////////////////////
579 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
581 if (gm) return gm->GetModuleIndex(fLayer,fLadder,fDet);
583 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
587 //______________________________________________________________________
588 TParticle * AliITShit::GetParticle(){
589 ////////////////////////////////////////////////////////////////////////
590 // Returns the pointer to the TParticle for the particle that created
591 // this hit. From the TParticle all kinds of information about this
592 // particle can be found. See the TParticle class.
593 ////////////////////////////////////////////////////////////////////////
594 return gAlice->Particle(GetTrack());
596 //----------------------------------------------------------------------
597 void AliITShit::Print(ostream *os){
598 ////////////////////////////////////////////////////////////////////////
599 // Standard output format for this class.
600 ////////////////////////////////////////////////////////////////////////
615 fmt = os->setf(ios::scientific); // set scientific floating point output
616 *os << fTrack << " " << fX << " " << fY << " " << fZ << " ";
617 fmt = os->setf(ios::hex); // set hex for fStatus only.
618 *os << fStatus << " ";
619 fmt = os->setf(ios::dec); // every thing else decimel.
620 *os << fLayer << " " << fLadder << " " << fDet << " ";;
621 *os << fPx << " " << fPy << " " << fPz << " ";
622 *os << fDestep << " " << fTof;
623 *os << " " << fx0 << " " << fy0 << " " << fz0;
624 // *os << " " << endl;
625 os->flags(fmt); // reset back to old formating.
628 //----------------------------------------------------------------------
629 void AliITShit::Read(istream *is){
630 ////////////////////////////////////////////////////////////////////////
631 // Standard input format for this class.
632 ////////////////////////////////////////////////////////////////////////
635 *is >> fTrack >> fX >> fY >> fZ;
636 *is >> fStatus >> fLayer >> fLadder >> fDet >> fPx >> fPy >> fPz >>
638 *is >> fx0 >> fy0 >> fz0;
641 //----------------------------------------------------------------------
642 ostream &operator<<(ostream &os,AliITShit &p){
643 ////////////////////////////////////////////////////////////////////////
644 // Standard output streaming function.
645 ////////////////////////////////////////////////////////////////////////
650 //----------------------------------------------------------------------
651 istream &operator>>(istream &is,AliITShit &r){
652 ////////////////////////////////////////////////////////////////////////
653 // Standard input streaming function.
654 ////////////////////////////////////////////////////////////////////////
659 //----------------------------------------------------------------------