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.15 2002/06/12 18:59:47 nilsen
19 Added Starting track location to hit class and related changes to modules.
20 This is at present still fully backwards compatible since starting hits
21 are still written to the file. When aliroot v4.0 will be released, this
22 backwards compatiblity will be broken by removing the enterence hit, and making
23 the nessesary changes to module at that time.
25 Revision 1.14 2002/05/19 18:17:03 hristov
26 Changes needed by ICC/IFC compiler (Intel)
28 Revision 1.13 2002/03/09 18:35:35 nilsen
29 Added functions to print out Hit data members.
31 Revision 1.12 2002/03/08 16:05:05 nilsen
32 Standeard io streamers added to make debugging et al. easier.
34 Revision 1.11 2001/01/30 09:23:13 hristov
35 Streamers removed (R.Brun)
37 Revision 1.10 2001/01/26 20:01:19 hristov
38 Major upgrade of AliRoot code
40 Revision 1.9 2000/10/02 16:32:51 barbera
41 Automatic streamer used and forward declarations added
43 Revision 1.3.4.7 2000/10/02 15:54:49 barbera
44 Automatic streamer used and forward declarations added
46 Revision 1.8 2000/09/22 12:35:21 nilsen
47 Traps placed incase it is used without a properly initilized AliITSgeom class.
49 Revision 1.7 2000/07/10 16:07:18 fca
50 Release version of ITS code
52 Revision 1.3.4.2 2000/03/04 23:43:57 nilsen
53 Fixed up the comments/documentation.
55 Revision 1.3.4.1 2000/01/12 19:03:32 nilsen
56 This is the version of the files after the merging done in December 1999.
57 See the ReadMe110100.txt file for details
59 Revision 1.3 1999/09/29 09:24:20 fca
60 Introduction of the Copyright and cvs Log
69 #include <TGeometry.h>
72 #include "TParticle.h"
76 #include "AliITSgeom.h"
77 #include "AliITShit.h"
81 ////////////////////////////////////////////////////////////////////////
83 // Written by Rene Brun, Federico Carminati, and Roberto Barbera
86 // Modified and documented by Bjorn S. Nilsen
89 // AliITShit is the hit class for the ITS. Hits are the information
90 // that comes from a Monte Carlo at each step as a particle mass through
91 // sensitive detector elements as particles are transported through a
96 <img src="picts/ITS/AliITShit_Class_Diagram.gif">
99 <font size=+2 color=red>
100 <p>This show the relasionships between the ITS hit class and the rest of Aliroot.
105 ////////////////////////////////////////////////////////////////////////
106 // Inline Member functions:
109 // The default creator of the AliITShit class.
112 // The default destructor of the AliITShit class.
115 // See AliHit for a full description. Returns the track number fTrack
118 // SetTrack(int track)
119 // See AliHit for a full description. Sets the track number fTrack
122 // Int_t GetTrackStatus()
123 // Returns the value of the track status flag fStatus. This flag
124 // indicates the track status at the time of creating this hit. It is
125 // made up of the following 8 status bits from highest order to lowest
127 // 0 : IsTrackAlive(): IsTrackStop():IsTrackDisappeared():
128 // IsTrackOut():IsTrackExiting():IsTrackEntering():IsTrackInside() .
129 // See AliMC for a description of these functions. If the function is
130 // true then the bit is set to one, otherwise it is zero.
132 // Bool_t StatusInside()
133 // Returns kTRUE if the particle producing this hit is still inside
134 // the present volume. Returns kFalse if this particle will be in another
135 // volume. {bit IsTrackInside is set or not}
137 // Bool_t StatusEntering()
138 // Returns kTRUE if the particle producing this hit is has just enterd
139 // the present volume. Returns kFalse otherwise. {bit IsTrackEntering is
142 // Bool_t StatusExiting()
143 // Returns kTRUE if the particle producing this hit is will exit
144 // the present volume. Returns kFalse otherwise. {bit IsTrackExiting is set
147 // Bool_t StatusOut()
148 // Returns kTRUE if the particle producing this hit is goint exit the
149 // simulation. Returns kFalse otherwise. {bit IsTrackOut is set or not}
151 // Bool_t StatusDisappeared()
152 // Returns kTRUE if the particle producing this hit is going to "disappear"
153 // for example it has interacted producing some other particles. Returns
154 // kFalse otherwise. {bit IsTrackOut is set or not}
156 // Bool_t StatusStop()
157 // Returns kTRUE if the particle producing this hit is has dropped below
158 // its energy cut off producing some other particles. Returns kFalse otherwise.
159 // {bit IsTrackOut is set or not}
161 // Bool_t StatuAlives()
162 // Returns kTRUE if the particle producing this hit is going to continue
163 // to be transported. Returns kFalse otherwise. {bit IsTrackOut is set or not}
166 // Returns the layer number, fLayer, for this hit.
169 // Returns the ladder number, fLadder, for this hit.
171 // Int_t GetDetector()
172 // Returns the detector number, fDet, for this hit.
174 // GetDetectorID(Int_t &layer, Int_t &ladder, Int_t &detector)
175 // Returns the layer, ladder, and detector numbers, fLayer fLadder fDet,
178 // Float_t GetIonization()
179 // Returns the energy lost, fDestep, by the particle creating this hit,
180 // in the units defined by the Monte Carlo.
182 // GetPositionG(Float_t &x, Float_t &y, Float_t &z)
183 // Returns the global position, fX fY fZ, of this hit, in the units
184 // define by the Monte Carlo.
186 // GetPositionG(Double_t &x, Double_t &y, Double_t &z)
187 // Returns the global position, fX fY fZ, of this hit, in the units
188 // define by the Monte Carlo.
190 // GetPositionG(Float_t &x, Float_t &y, Float_t &z, Float_t &tof)
191 // Returns the global position and time of flight, fX fY fZ fTof, of
192 // this hit, in the units define by the Monte Carlo.
194 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_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 // GetPositionL(Double_t &x,Double_t &y,Double_t &z)
199 // Returns the local position, fX fY fZ, of this hit in the coordiante
200 // of this module, in the units define by the Monte Carlo.
202 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
203 // Returns the local position and time of flight, fX fY fZ fTof, of
204 // this hit in the coordinates of this module, in the units define by the
208 // Returns the global x position in the units defined by the Monte Carlo.
211 // Returns the global y position in the units defined by the Monte Carlo.
214 // Returns the global z position in the units defined by the Monte Carlo.
217 // Returns the time of flight, fTof, of this hit, in the units defined
218 // by the Monte Carlo.
220 // GetMomentumG(Float_t &px, Float_t &py, Float_t &pz)
221 // Returns the global momentum, fPx fPy fPz, of the particle that made
222 // this hit, in the units define by the Monte Carlo.
224 // GetMomentumG(Double_t &px,Double_t &py,Double_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 // GetMomentumL(Double_t &px,Double_t &py,Double_t &pz)
229 // Returns the momentum, fPx fPy fPz in coordinate appropreate for this
230 // specific module, in the units define by the Monte Carlo.
233 // Returns the global X momentum in the units defined by the Monte Carlo.
236 // Returns the global Y momentum in the units defined by the Monte Carlo.
239 // Returns the global Z momentum in the units defined by the Monte Carlo.
241 ////////////////////////////////////////////////////////////////////////
242 //_____________________________________________________________________________
243 AliITShit::AliITShit():AliHit(){
244 // Default Constructor
245 // Zero data member just to be safe.
251 // A default created AliITShit class.
253 fStatus = 0; // Track Status
254 fLayer = 0; // Layer number
255 fLadder = 0; // Ladder number
256 fDet = 0; // Detector number
257 fPx = 0.0; // PX of particle at the point of the hit
258 fPy = 0.0; // PY of particle at the point of the hit
259 fPz = 0.0; // PZ of particle at the point of the hit
260 fDestep = 0.0; // Energy deposited in the current step
261 fTof = 0.0; // Time of flight at the point of the hit
262 fStatus0 = 0; // zero status bit by default.
263 fx0 = 0.0; // Starting point of this step
264 fy0 = 0.0; // Starting point of this step
265 fz0 = 0.0; // Starting point of this step
266 ft0 = 0.0; // Starting point of this step
268 AliITShit::AliITShit(Int_t shunt,Int_t track,Int_t *vol,Float_t edep,
269 Float_t tof,TLorentzVector &x,TLorentzVector &x0,
270 TLorentzVector &p) : AliHit(shunt, track){
271 ////////////////////////////////////////////////////////////////////////
273 // The creator of the AliITShit class. The variables shunt and
274 // track are passed to the creator of the AliHit class. See the AliHit
275 // class for a full description. In the units of the Monte Carlo
276 ////////////////////////////////////////////////////////////////////////
278 // Int_t shunt See AliHit
279 // Int_t track Track number, see AliHit
280 // Int_t *vol Array of integer hit data,
281 // vol[0] Layer where the hit is, 1-6 typicaly
282 // vol[1] Ladder where the hit is.
283 // vol[2] Detector number where the hit is
284 // vol[3] Set of status bits
285 // vol[4] Set of status bits at start
289 // A default created AliITShit class.
291 fLayer = vol[0]; // Layer number
292 fLadder = vol[2]; // Ladder number
293 fDet = vol[1]; // Detector number
294 fStatus = vol[3]; // Track status flags
295 fStatus0 = vol[4]; // Track status flag for start position.
296 fX = x.X(); // Track X global position
297 fY = x.Y(); // Track Y global position
298 fZ = x.Z(); // Track Z global position
299 fPx = p.Px(); // Track X Momentum
300 fPy = p.Py(); // Track Y Momentum
301 fPz = p.Pz(); // Track Z Momentum
302 fDestep = edep; // Track dE/dx for this step
303 fTof = tof ; // Track Time of Flight for this step
304 fx0 = x0.X(); // Track X global position
305 fy0 = x0.Y(); // Track Y global position
306 fz0 = x0.Z(); // Track Z global position
308 //______________________________________________________________________
309 AliITShit::AliITShit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
310 AliHit(shunt, track){
311 ////////////////////////////////////////////////////////////////////////
313 // The creator of the AliITShit class. The variables shunt and
314 // track are passed to the creator of the AliHit class. See the AliHit
315 // class for a full description. the integer array *vol contains, in order,
316 // fLayer = vol[0], fDet = vol[1], fLadder = vol[2], fStatus = vol[3].
317 // The array *hits contains, in order, fX = hits[0], fY = hits[1],
318 // fZ = hits[2], fPx = hits[3], fPy = hits[4], fPz = hits[5],
319 // fDestep = hits[6], and fTof = hits[7]. In the units of the Monte Carlo
320 ////////////////////////////////////////////////////////////////////////
322 // Int_t shunt See AliHit
323 // Int_t track Track number, see AliHit
324 // Int_t *vol Array of integer hit data,
325 // vol[0] Layer where the hit is, 1-6 typicaly
326 // vol[1] Ladder where the hit is.
327 // vol[2] Detector number where the hit is
328 // vol[3] Set of status bits
329 // Float_t *hits Array of hit information
330 // hits[0] X global position of this hit
331 // hits[1] Y global position of this hit
332 // hits[2] Z global position of this hit
333 // hits[3] Px global position of this hit
334 // hits[4] Py global position of this hit
335 // hits[5] Pz global position of this hit
336 // hits[6] Energy deposited by this step
337 // hits[7] Time of flight of this particle at this step
341 // A standard created AliITShit class.
342 fLayer = vol[0]; // Layer number
343 fLadder = vol[2]; // Ladder number
344 fDet = vol[1]; // Detector number
345 fStatus = vol[3]; // Track status flags
346 fX = hits[0]; // Track X global position
347 fY = hits[1]; // Track Y global position
348 fZ = hits[2]; // Track Z global position
349 fPx = hits[3]; // Track X Momentum
350 fPy = hits[4]; // Track Y Momentum
351 fPz = hits[5]; // Track Z Momentum
352 fDestep = hits[6]; // Track dE/dx for this step
353 fTof = hits[7]; // Track Time of Flight for this step
354 fStatus0 = 0;// Track Status of Starting point
355 fx0 = 0.0; // Starting point of this step
356 fy0 = 0.0; // Starting point of this step
357 fz0 = 0.0; // Starting point of this step
358 ft0 = 0.0; // Starting point of this step
360 //______________________________________________________________________
361 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z){
362 ////////////////////////////////////////////////////////////////////////
363 // Returns the position of this hit in the local coordinates of this
364 // module, and in the units of the Monte Carlo.
365 ////////////////////////////////////////////////////////////////////////
366 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
373 gm->GtoL(fLayer,fLadder,fDet,g,l);
378 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
379 // AliITSv7 - SDD case
386 //______________________________________________________________________
387 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z,Float_t &tof){
388 ////////////////////////////////////////////////////////////////////////
389 // Returns the position and time of flight of this hit in the local
390 // coordinates of this module, and in the units of the Monte Carlo.
391 ////////////////////////////////////////////////////////////////////////
392 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
399 gm->GtoL(fLayer,fLadder,fDet,g,l);
404 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
405 // AliITSv7 - SDD case
413 //______________________________________________________________________
414 Float_t AliITShit::GetXL(){
415 ////////////////////////////////////////////////////////////////////////
416 // Returns the x position of this hit in the local coordinates of this
417 // module, and in the units of the Monte Carlo.
418 ////////////////////////////////////////////////////////////////////////
419 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
426 gm->GtoL(fLayer,fLadder,fDet,g,l);
429 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
433 //______________________________________________________________________
434 Float_t AliITShit::GetYL(){
435 ////////////////////////////////////////////////////////////////////////
436 // Returns the y position of this hit in the local coordinates of this
437 // module, and in the units of the Monte Carlo.
438 ////////////////////////////////////////////////////////////////////////
439 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
446 gm->GtoL(fLayer,fLadder,fDet,g,l);
449 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
453 //______________________________________________________________________
454 Float_t AliITShit::GetZL(){
455 ////////////////////////////////////////////////////////////////////////
456 // Returns the z position of this hit in the local coordinates of this
457 // module, and in the units of the Monte Carlo.
458 ////////////////////////////////////////////////////////////////////////
459 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
466 gm->GtoL(fLayer,fLadder,fDet,g,l);
469 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
473 //______________________________________________________________________
474 void AliITShit::GetMomentumL(Float_t &px,Float_t &py,Float_t &pz){
475 ////////////////////////////////////////////////////////////////////////
476 // Returns the momentum of this hit in the local coordinates of this
477 // module, and in the units of the Monte Carlo.
478 ////////////////////////////////////////////////////////////////////////
479 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
486 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
491 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
498 //______________________________________________________________________
499 Float_t AliITShit::GetPXL(){
500 ////////////////////////////////////////////////////////////////////////
501 // Returns the X momentum of this hit in the local coordinates of this
502 // module, and in the units of the Monte Carlo.
503 ////////////////////////////////////////////////////////////////////////
504 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
511 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
514 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
518 //______________________________________________________________________
519 Float_t AliITShit::GetPYL(){
520 ////////////////////////////////////////////////////////////////////////
521 // Returns the Y momentum of this hit in the local coordinates of this
522 // module, and in the units of the Monte Carlo.
523 ////////////////////////////////////////////////////////////////////////
524 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
531 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
534 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
539 //______________________________________________________________________
540 Float_t AliITShit::GetPZL(){
541 ////////////////////////////////////////////////////////////////////////
542 // Returns the Z momentum of this hit in the local coordinates of this
543 // module, and in the units of the Monte Carlo.
544 ////////////////////////////////////////////////////////////////////////
545 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
552 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
555 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
560 //___________________________________________________________________________;
561 Int_t AliITShit::GetModule(){
562 ////////////////////////////////////////////////////////////////////////
563 // Returns the module index number of the module where this hit was in.
564 ////////////////////////////////////////////////////////////////////////
565 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
567 if (gm) return gm->GetModuleIndex(fLayer,fLadder,fDet);
569 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
573 //______________________________________________________________________
574 TParticle * AliITShit::GetParticle(){
575 ////////////////////////////////////////////////////////////////////////
576 // Returns the pointer to the TParticle for the particle that created
577 // this hit. From the TParticle all kinds of information about this
578 // particle can be found. See the TParticle class.
579 ////////////////////////////////////////////////////////////////////////
580 return gAlice->Particle(GetTrack());
582 //----------------------------------------------------------------------
583 void AliITShit::Print(ostream *os){
584 ////////////////////////////////////////////////////////////////////////
585 // Standard output format for this class.
586 ////////////////////////////////////////////////////////////////////////
601 fmt = os->setf(ios::scientific); // set scientific floating point output
602 *os << fTrack << " " << fX << " " << fY << " " << fZ << " ";
603 fmt = os->setf(ios::hex); // set hex for fStatus only.
604 *os << fStatus << " ";
605 fmt = os->setf(ios::dec); // every thing else decimel.
606 *os << fLayer << " " << fLadder << " " << fDet << " ";;
607 *os << fPx << " " << fPy << " " << fPz << " ";
608 *os << fDestep << " " << fTof;
609 *os << " " << fx0 << " " << fy0 << " " << fz0 << " ";
611 os->flags(fmt); // reset back to old formating.
614 //----------------------------------------------------------------------
615 void AliITShit::Read(istream *is){
616 ////////////////////////////////////////////////////////////////////////
617 // Standard input format for this class.
618 ////////////////////////////////////////////////////////////////////////
621 *is >> fTrack >> fX >> fY >> fZ;
622 *is >> fStatus >> fLayer >> fLadder >> fDet >> fPx >> fPy >> fPz >>
624 *is >> fx0 >> fy0 >> fz0;
627 //----------------------------------------------------------------------
628 ostream &operator<<(ostream &os,AliITShit &p){
629 ////////////////////////////////////////////////////////////////////////
630 // Standard output streaming function.
631 ////////////////////////////////////////////////////////////////////////
636 //----------------------------------------------------------------------
637 istream &operator>>(istream &is,AliITShit &r){
638 ////////////////////////////////////////////////////////////////////////
639 // Standard input streaming function.
640 ////////////////////////////////////////////////////////////////////////
645 //----------------------------------------------------------------------