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.20 2002/10/22 14:45:42 alibrary
19 Introducing Riostream.h
21 Revision 1.19 2002/10/14 14:57:00 hristov
22 Merging the VirtualMC branch to the main development branch (HEAD)
24 Revision 1.13.6.3 2002/08/28 15:06:50 alibrary
27 Revision 1.18 2002/08/07 18:37:53 nilsen
28 Removed endl from print function. should be supplied by user as wanted.
30 Revision 1.17 2002/06/20 09:10:14 hristov
31 Data member ft0 initialized
33 Revision 1.16 2002/06/19 21:12:37 nilsen
34 Fixed bug with non-zero-ed new data members in constructors. Thanks Jiri
35 for finding it and pointing it out.
37 Revision 1.15 2002/06/12 18:59:47 nilsen
38 Added Starting track location to hit class and related changes to modules.
39 This is at present still fully backwards compatible since starting hits
40 are still written to the file. When aliroot v4.0 will be released, this
41 backwards compatiblity will be broken by removing the enterence hit, and making
42 the nessesary changes to module at that time.
44 Revision 1.14 2002/05/19 18:17:03 hristov
45 Changes needed by ICC/IFC compiler (Intel)
47 Revision 1.13 2002/03/09 18:35:35 nilsen
48 Added functions to print out Hit data members.
50 Revision 1.12 2002/03/08 16:05:05 nilsen
51 Standeard io streamers added to make debugging et al. easier.
53 Revision 1.11 2001/01/30 09:23:13 hristov
54 Streamers removed (R.Brun)
56 Revision 1.10 2001/01/26 20:01:19 hristov
57 Major upgrade of AliRoot code
59 Revision 1.9 2000/10/02 16:32:51 barbera
60 Automatic streamer used and forward declarations added
62 Revision 1.3.4.7 2000/10/02 15:54:49 barbera
63 Automatic streamer used and forward declarations added
65 Revision 1.8 2000/09/22 12:35:21 nilsen
66 Traps placed incase it is used without a properly initilized AliITSgeom class.
68 Revision 1.7 2000/07/10 16:07:18 fca
69 Release version of ITS code
71 Revision 1.3.4.2 2000/03/04 23:43:57 nilsen
72 Fixed up the comments/documentation.
74 Revision 1.3.4.1 2000/01/12 19:03:32 nilsen
75 This is the version of the files after the merging done in December 1999.
76 See the ReadMe110100.txt file for details
78 Revision 1.3 1999/09/29 09:24:20 fca
79 Introduction of the Copyright and cvs Log
83 #include <Riostream.h>
88 #include <TGeometry.h>
91 #include "TParticle.h"
95 #include "AliITSgeom.h"
96 #include "AliITShit.h"
100 ////////////////////////////////////////////////////////////////////////
102 // Written by Rene Brun, Federico Carminati, and Roberto Barbera
105 // Modified and documented by Bjorn S. Nilsen
108 // AliITShit is the hit class for the ITS. Hits are the information
109 // that comes from a Monte Carlo at each step as a particle mass through
110 // sensitive detector elements as particles are transported through a
115 <img src="picts/ITS/AliITShit_Class_Diagram.gif">
118 <font size=+2 color=red>
119 <p>This show the relasionships between the ITS hit class and the rest of Aliroot.
124 ////////////////////////////////////////////////////////////////////////
125 // Inline Member functions:
128 // The default creator of the AliITShit class.
131 // The default destructor of the AliITShit class.
134 // See AliHit for a full description. Returns the track number fTrack
137 // SetTrack(int track)
138 // See AliHit for a full description. Sets the track number fTrack
141 // Int_t GetTrackStatus()
142 // Returns the value of the track status flag fStatus. This flag
143 // indicates the track status at the time of creating this hit. It is
144 // made up of the following 8 status bits from highest order to lowest
146 // 0 : IsTrackAlive(): IsTrackStop():IsTrackDisappeared():
147 // IsTrackOut():IsTrackExiting():IsTrackEntering():IsTrackInside() .
148 // See AliMC for a description of these functions. If the function is
149 // true then the bit is set to one, otherwise it is zero.
151 // Bool_t StatusInside()
152 // Returns kTRUE if the particle producing this hit is still inside
153 // the present volume. Returns kFalse if this particle will be in another
154 // volume. {bit IsTrackInside is set or not}
156 // Bool_t StatusEntering()
157 // Returns kTRUE if the particle producing this hit is has just enterd
158 // the present volume. Returns kFalse otherwise. {bit IsTrackEntering is
161 // Bool_t StatusExiting()
162 // Returns kTRUE if the particle producing this hit is will exit
163 // the present volume. Returns kFalse otherwise. {bit IsTrackExiting is set
166 // Bool_t StatusOut()
167 // Returns kTRUE if the particle producing this hit is goint exit the
168 // simulation. Returns kFalse otherwise. {bit IsTrackOut is set or not}
170 // Bool_t StatusDisappeared()
171 // Returns kTRUE if the particle producing this hit is going to "disappear"
172 // for example it has interacted producing some other particles. Returns
173 // kFalse otherwise. {bit IsTrackOut is set or not}
175 // Bool_t StatusStop()
176 // Returns kTRUE if the particle producing this hit is has dropped below
177 // its energy cut off producing some other particles. Returns kFalse otherwise.
178 // {bit IsTrackOut is set or not}
180 // Bool_t StatuAlives()
181 // Returns kTRUE if the particle producing this hit is going to continue
182 // to be transported. Returns kFalse otherwise. {bit IsTrackOut is set or not}
185 // Returns the layer number, fLayer, for this hit.
188 // Returns the ladder number, fLadder, for this hit.
190 // Int_t GetDetector()
191 // Returns the detector number, fDet, for this hit.
193 // GetDetectorID(Int_t &layer, Int_t &ladder, Int_t &detector)
194 // Returns the layer, ladder, and detector numbers, fLayer fLadder fDet,
197 // Float_t GetIonization()
198 // Returns the energy lost, fDestep, by the particle creating this hit,
199 // in the units defined by the Monte Carlo.
201 // GetPositionG(Float_t &x, Float_t &y, Float_t &z)
202 // Returns the global position, fX fY fZ, of this hit, in the units
203 // define by the Monte Carlo.
205 // GetPositionG(Double_t &x, Double_t &y, Double_t &z)
206 // Returns the global position, fX fY fZ, of this hit, in the units
207 // define by the Monte Carlo.
209 // GetPositionG(Float_t &x, Float_t &y, Float_t &z, Float_t &tof)
210 // Returns the global position and time of flight, fX fY fZ fTof, of
211 // this hit, in the units define by the Monte Carlo.
213 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
214 // Returns the global position and time of flight, fX fY fZ fTof, of
215 // this hit, in the units define by the Monte Carlo.
217 // GetPositionL(Double_t &x,Double_t &y,Double_t &z)
218 // Returns the local position, fX fY fZ, of this hit in the coordiante
219 // of this module, in the units define by the Monte Carlo.
221 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
222 // Returns the local position and time of flight, fX fY fZ fTof, of
223 // this hit in the coordinates of this module, in the units define by the
227 // Returns the global x position in the units defined by the Monte Carlo.
230 // Returns the global y position in the units defined by the Monte Carlo.
233 // Returns the global z position in the units defined by the Monte Carlo.
236 // Returns the time of flight, fTof, of this hit, in the units defined
237 // by the Monte Carlo.
239 // GetMomentumG(Float_t &px, Float_t &py, Float_t &pz)
240 // Returns the global momentum, fPx fPy fPz, of the particle that made
241 // this hit, in the units define by the Monte Carlo.
243 // GetMomentumG(Double_t &px,Double_t &py,Double_t &pz)
244 // Returns the global momentum, fPx fPy fPz, of the particle that made
245 // this hit, in the units define by the Monte Carlo.
247 // GetMomentumL(Double_t &px,Double_t &py,Double_t &pz)
248 // Returns the momentum, fPx fPy fPz in coordinate appropreate for this
249 // specific module, in the units define by the Monte Carlo.
252 // Returns the global X momentum in the units defined by the Monte Carlo.
255 // Returns the global Y momentum in the units defined by the Monte Carlo.
258 // Returns the global Z momentum in the units defined by the Monte Carlo.
260 ////////////////////////////////////////////////////////////////////////
261 //_____________________________________________________________________________
262 AliITShit::AliITShit():AliHit(){
263 // Default Constructor
264 // Zero data member just to be safe.
270 // A default created AliITShit class.
272 fStatus = 0; // Track Status
273 fLayer = 0; // Layer number
274 fLadder = 0; // Ladder number
275 fDet = 0; // Detector number
276 fPx = 0.0; // PX of particle at the point of the hit
277 fPy = 0.0; // PY of particle at the point of the hit
278 fPz = 0.0; // PZ of particle at the point of the hit
279 fDestep = 0.0; // Energy deposited in the current step
280 fTof = 0.0; // Time of flight at the point of the hit
281 fStatus0 = 0; // zero status bit by default.
282 fx0 = 0.0; // Starting point of this step
283 fy0 = 0.0; // Starting point of this step
284 fz0 = 0.0; // Starting point of this step
285 ft0 = 0.0; // Starting point of this step
287 AliITShit::AliITShit(Int_t shunt,Int_t track,Int_t *vol,Float_t edep,
288 Float_t tof,TLorentzVector &x,TLorentzVector &x0,
289 TLorentzVector &p) : AliHit(shunt, track){
290 ////////////////////////////////////////////////////////////////////////
292 // The creator of the AliITShit class. The variables shunt and
293 // track are passed to the creator of the AliHit class. See the AliHit
294 // class for a full description. In the units of the Monte Carlo
295 ////////////////////////////////////////////////////////////////////////
297 // Int_t shunt See AliHit
298 // Int_t track Track number, see AliHit
299 // Int_t *vol Array of integer hit data,
300 // vol[0] Layer where the hit is, 1-6 typicaly
301 // vol[1] Ladder where the hit is.
302 // vol[2] Detector number where the hit is
303 // vol[3] Set of status bits
304 // vol[4] Set of status bits at start
308 // A default created AliITShit class.
310 fLayer = vol[0]; // Layer number
311 fLadder = vol[2]; // Ladder number
312 fDet = vol[1]; // Detector number
313 fStatus = vol[3]; // Track status flags
314 fStatus0 = vol[4]; // Track status flag for start position.
315 fX = x.X(); // Track X global position
316 fY = x.Y(); // Track Y global position
317 fZ = x.Z(); // Track Z global position
318 fPx = p.Px(); // Track X Momentum
319 fPy = p.Py(); // Track Y Momentum
320 fPz = p.Pz(); // Track Z Momentum
321 fDestep = edep; // Track dE/dx for this step
322 fTof = tof ; // Track Time of Flight for this step
323 fx0 = x0.X(); // Track X global position
324 fy0 = x0.Y(); // Track Y global position
325 fz0 = x0.Z(); // Track Z global position
326 ft0 = x0.T(); // Starting point of this step
328 //______________________________________________________________________
329 AliITShit::AliITShit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
330 AliHit(shunt, track){
331 ////////////////////////////////////////////////////////////////////////
333 // The creator of the AliITShit class. The variables shunt and
334 // track are passed to the creator of the AliHit class. See the AliHit
335 // class for a full description. the integer array *vol contains, in order,
336 // fLayer = vol[0], fDet = vol[1], fLadder = vol[2], fStatus = vol[3].
337 // The array *hits contains, in order, fX = hits[0], fY = hits[1],
338 // fZ = hits[2], fPx = hits[3], fPy = hits[4], fPz = hits[5],
339 // fDestep = hits[6], and fTof = hits[7]. In the units of the Monte Carlo
340 ////////////////////////////////////////////////////////////////////////
342 // Int_t shunt See AliHit
343 // Int_t track Track number, see AliHit
344 // Int_t *vol Array of integer hit data,
345 // vol[0] Layer where the hit is, 1-6 typicaly
346 // vol[1] Ladder where the hit is.
347 // vol[2] Detector number where the hit is
348 // vol[3] Set of status bits
349 // Float_t *hits Array of hit information
350 // hits[0] X global position of this hit
351 // hits[1] Y global position of this hit
352 // hits[2] Z global position of this hit
353 // hits[3] Px global position of this hit
354 // hits[4] Py global position of this hit
355 // hits[5] Pz global position of this hit
356 // hits[6] Energy deposited by this step
357 // hits[7] Time of flight of this particle at this step
361 // A standard created AliITShit class.
362 fLayer = vol[0]; // Layer number
363 fLadder = vol[2]; // Ladder number
364 fDet = vol[1]; // Detector number
365 fStatus = vol[3]; // Track status flags
366 fX = hits[0]; // Track X global position
367 fY = hits[1]; // Track Y global position
368 fZ = hits[2]; // Track Z global position
369 fPx = hits[3]; // Track X Momentum
370 fPy = hits[4]; // Track Y Momentum
371 fPz = hits[5]; // Track Z Momentum
372 fDestep = hits[6]; // Track dE/dx for this step
373 fTof = hits[7]; // Track Time of Flight for this step
374 fStatus0 = 0;// Track Status of Starting point
375 fx0 = 0.0; // Starting point of this step
376 fy0 = 0.0; // Starting point of this step
377 fz0 = 0.0; // Starting point of this step
378 ft0 = 0.0; // Starting point of this step
380 //______________________________________________________________________
381 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z){
382 ////////////////////////////////////////////////////////////////////////
383 // Returns the position of this hit in the local coordinates of this
384 // module, and in the units of the Monte Carlo.
385 ////////////////////////////////////////////////////////////////////////
386 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
393 gm->GtoL(fLayer,fLadder,fDet,g,l);
398 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
399 // AliITSv7 - SDD case
406 //______________________________________________________________________
407 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z,Float_t &tof){
408 ////////////////////////////////////////////////////////////////////////
409 // Returns the position and time of flight of this hit in the local
410 // coordinates of this module, and in the units of the Monte Carlo.
411 ////////////////////////////////////////////////////////////////////////
412 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
419 gm->GtoL(fLayer,fLadder,fDet,g,l);
424 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
425 // AliITSv7 - SDD case
433 //______________________________________________________________________
434 Float_t AliITShit::GetXL(){
435 ////////////////////////////////////////////////////////////////////////
436 // Returns the x 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::GetYL(){
455 ////////////////////////////////////////////////////////////////////////
456 // Returns the y 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 Float_t AliITShit::GetZL(){
475 ////////////////////////////////////////////////////////////////////////
476 // Returns the z position 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->GtoL(fLayer,fLadder,fDet,g,l);
489 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
493 //______________________________________________________________________
494 void AliITShit::GetMomentumL(Float_t &px,Float_t &py,Float_t &pz){
495 ////////////////////////////////////////////////////////////////////////
496 // Returns the momentum of this hit in the local coordinates of this
497 // module, and in the units of the Monte Carlo.
498 ////////////////////////////////////////////////////////////////////////
499 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
506 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
511 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
518 //______________________________________________________________________
519 Float_t AliITShit::GetPXL(){
520 ////////////////////////////////////////////////////////////////////////
521 // Returns the X 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);
538 //______________________________________________________________________
539 Float_t AliITShit::GetPYL(){
540 ////////////////////////////////////////////////////////////////////////
541 // Returns the Y momentum of this hit in the local coordinates of this
542 // module, and in the units of the Monte Carlo.
543 ////////////////////////////////////////////////////////////////////////
544 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
551 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
554 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
559 //______________________________________________________________________
560 Float_t AliITShit::GetPZL(){
561 ////////////////////////////////////////////////////////////////////////
562 // Returns the Z momentum of this hit in the local coordinates of this
563 // module, and in the units of the Monte Carlo.
564 ////////////////////////////////////////////////////////////////////////
565 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
572 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
575 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
580 //___________________________________________________________________________;
581 Int_t AliITShit::GetModule(){
582 ////////////////////////////////////////////////////////////////////////
583 // Returns the module index number of the module where this hit was in.
584 ////////////////////////////////////////////////////////////////////////
585 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
587 if (gm) return gm->GetModuleIndex(fLayer,fLadder,fDet);
589 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
593 //______________________________________________________________________
594 TParticle * AliITShit::GetParticle(){
595 ////////////////////////////////////////////////////////////////////////
596 // Returns the pointer to the TParticle for the particle that created
597 // this hit. From the TParticle all kinds of information about this
598 // particle can be found. See the TParticle class.
599 ////////////////////////////////////////////////////////////////////////
600 return gAlice->Particle(GetTrack());
602 //----------------------------------------------------------------------
603 void AliITShit::Print(ostream *os){
604 ////////////////////////////////////////////////////////////////////////
605 // Standard output format for this class.
606 ////////////////////////////////////////////////////////////////////////
614 #if defined __ICC || defined __ECC
621 fmt = os->setf(ios::scientific); // set scientific floating point output
622 *os << fTrack << " " << fX << " " << fY << " " << fZ << " ";
623 fmt = os->setf(ios::hex); // set hex for fStatus only.
624 *os << fStatus << " ";
625 fmt = os->setf(ios::dec); // every thing else decimel.
626 *os << fLayer << " " << fLadder << " " << fDet << " ";;
627 *os << fPx << " " << fPy << " " << fPz << " ";
628 *os << fDestep << " " << fTof;
629 *os << " " << fx0 << " " << fy0 << " " << fz0;
630 // *os << " " << endl;
631 os->flags(fmt); // reset back to old formating.
634 //----------------------------------------------------------------------
635 void AliITShit::Read(istream *is){
636 ////////////////////////////////////////////////////////////////////////
637 // Standard input format for this class.
638 ////////////////////////////////////////////////////////////////////////
641 *is >> fTrack >> fX >> fY >> fZ;
642 *is >> fStatus >> fLayer >> fLadder >> fDet >> fPx >> fPy >> fPz >>
644 *is >> fx0 >> fy0 >> fz0;
647 //----------------------------------------------------------------------
648 ostream &operator<<(ostream &os,AliITShit &p){
649 ////////////////////////////////////////////////////////////////////////
650 // Standard output streaming function.
651 ////////////////////////////////////////////////////////////////////////
656 //----------------------------------------------------------------------
657 istream &operator>>(istream &is,AliITShit &r){
658 ////////////////////////////////////////////////////////////////////////
659 // Standard input streaming function.
660 ////////////////////////////////////////////////////////////////////////
665 //----------------------------------------------------------------------