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 #include <Riostream.h>
20 #include<TLorentzVector.h>
24 #include "AliITSgeom.h"
25 #include "AliITShit.h"
30 ////////////////////////////////////////////////////////////////////////
32 // Written by Rene Brun, Federico Carminati, and Roberto Barbera
35 // Modified and documented by Bjorn S. Nilsen
38 // AliITShit is the hit class for the ITS. Hits are the information
39 // that comes from a Monte Carlo at each step as a particle mass through
40 // sensitive detector elements as particles are transported through a
45 <img src="picts/ITS/AliITShit_Class_Diagram.gif">
48 <font size=+2 color=red>
49 <p>This show the relasionships between the ITS hit class and the rest of Aliroot.
54 ////////////////////////////////////////////////////////////////////////
55 // Inline Member functions:
58 // The default creator of the AliITShit class.
61 // The default destructor of the AliITShit class.
64 // See AliHit for a full description. Returns the track number fTrack
67 // SetTrack(int track)
68 // See AliHit for a full description. Sets the track number fTrack
71 // Int_t GetTrackStatus()
72 // Returns the value of the track status flag fStatus. This flag
73 // indicates the track status at the time of creating this hit. It is
74 // made up of the following 8 status bits from highest order to lowest
76 // 0 : IsTrackAlive(): IsTrackStop():IsTrackDisappeared():
77 // IsTrackOut():IsTrackExiting():IsTrackEntering():IsTrackInside() .
78 // See AliMC for a description of these functions. If the function is
79 // true then the bit is set to one, otherwise it is zero.
81 // Bool_t StatusInside()
82 // Returns kTRUE if the particle producing this hit is still inside
83 // the present volume. Returns kFalse if this particle will be in another
84 // volume. {bit IsTrackInside is set or not}
86 // Bool_t StatusEntering()
87 // Returns kTRUE if the particle producing this hit is has just enterd
88 // the present volume. Returns kFalse otherwise. {bit IsTrackEntering is
91 // Bool_t StatusExiting()
92 // Returns kTRUE if the particle producing this hit is will exit
93 // the present volume. Returns kFalse otherwise. {bit IsTrackExiting is set
97 // Returns kTRUE if the particle producing this hit is goint exit the
98 // simulation. Returns kFalse otherwise. {bit IsTrackOut is set or not}
100 // Bool_t StatusDisappeared()
101 // Returns kTRUE if the particle producing this hit is going to "disappear"
102 // for example it has interacted producing some other particles. Returns
103 // kFalse otherwise. {bit IsTrackOut is set or not}
105 // Bool_t StatusStop()
106 // Returns kTRUE if the particle producing this hit is has dropped below
107 // its energy cut off producing some other particles. Returns kFalse otherwise.
108 // {bit IsTrackOut is set or not}
110 // Bool_t StatuAlives()
111 // Returns kTRUE if the particle producing this hit is going to continue
112 // to be transported. Returns kFalse otherwise. {bit IsTrackOut is set or not}
115 // Returns the layer number, fLayer, for this hit.
118 // Returns the ladder number, fLadder, for this hit.
120 // Int_t GetDetector()
121 // Returns the detector number, fDet, for this hit.
123 // GetDetectorID(Int_t &layer, Int_t &ladder, Int_t &detector)
124 // Returns the layer, ladder, and detector numbers, fLayer fLadder fDet,
127 // Float_t GetIonization()
128 // Returns the energy lost, fDestep, by the particle creating this hit,
129 // in the units defined by the Monte Carlo.
131 // GetPositionG(Float_t &x, Float_t &y, Float_t &z)
132 // Returns the global position, fX fY fZ, of this hit, in the units
133 // define by the Monte Carlo.
135 // GetPositionG(Double_t &x, Double_t &y, Double_t &z)
136 // Returns the global position, fX fY fZ, of this hit, in the units
137 // define by the Monte Carlo.
139 // GetPositionG(Float_t &x, Float_t &y, Float_t &z, Float_t &tof)
140 // Returns the global position and time of flight, fX fY fZ fTof, of
141 // this hit, in the units define by the Monte Carlo.
143 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
144 // Returns the global position and time of flight, fX fY fZ fTof, of
145 // this hit, in the units define by the Monte Carlo.
147 // GetPositionL(Double_t &x,Double_t &y,Double_t &z)
148 // Returns the local position, fX fY fZ, of this hit in the coordiante
149 // of this module, in the units define by the Monte Carlo.
151 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
152 // Returns the local position and time of flight, fX fY fZ fTof, of
153 // this hit in the coordinates of this module, in the units define by the
157 // Returns the global x position in the units defined by the Monte Carlo.
160 // Returns the global y position in the units defined by the Monte Carlo.
163 // Returns the global z position in the units defined by the Monte Carlo.
166 // Returns the time of flight, fTof, of this hit, in the units defined
167 // by the Monte Carlo.
169 // GetMomentumG(Float_t &px, Float_t &py, Float_t &pz)
170 // Returns the global momentum, fPx fPy fPz, of the particle that made
171 // this hit, in the units define by the Monte Carlo.
173 // GetMomentumG(Double_t &px,Double_t &py,Double_t &pz)
174 // Returns the global momentum, fPx fPy fPz, of the particle that made
175 // this hit, in the units define by the Monte Carlo.
177 // GetMomentumL(Double_t &px,Double_t &py,Double_t &pz)
178 // Returns the momentum, fPx fPy fPz in coordinate appropreate for this
179 // specific module, in the units define by the Monte Carlo.
182 // Returns the global X momentum in the units defined by the Monte Carlo.
185 // Returns the global Y momentum in the units defined by the Monte Carlo.
188 // Returns the global Z momentum in the units defined by the Monte Carlo.
190 ////////////////////////////////////////////////////////////////////////
191 //_____________________________________________________________________________
192 AliITShit::AliITShit():AliHit(),
207 // Default Constructor
208 // Zero data member just to be safe.
214 // A default created AliITShit class.
217 AliITShit::AliITShit(Int_t shunt,Int_t track,Int_t *vol,Float_t edep,
218 Float_t tof,TLorentzVector &x,TLorentzVector &x0,
219 TLorentzVector &p) : AliHit(shunt, track),
234 ////////////////////////////////////////////////////////////////////////
236 // The creator of the AliITShit class. The variables shunt and
237 // track are passed to the creator of the AliHit class. See the AliHit
238 // class for a full description. In the units of the Monte Carlo
239 ////////////////////////////////////////////////////////////////////////
241 // Int_t shunt See AliHit
242 // Int_t track Track number, see AliHit
243 // Int_t *vol Array of integer hit data,
244 // vol[0] Layer where the hit is, 1-6 typicaly
245 // vol[1] Ladder where the hit is.
246 // vol[2] Detector number where the hit is
247 // vol[3] Set of status bits
248 // vol[4] Set of status bits at start
252 // A default created AliITShit class.
256 fX = x.X(); // Track X global position
257 fY = x.Y(); // Track Y global position
258 fZ = x.Z(); // Track Z global position
260 //______________________________________________________________________
261 AliITShit::AliITShit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
262 AliHit(shunt, track),
277 ////////////////////////////////////////////////////////////////////////
279 // The creator of the AliITShit class. The variables shunt and
280 // track are passed to the creator of the AliHit class. See the AliHit
281 // class for a full description. the integer array *vol contains, in order,
282 // fLayer = vol[0], fDet = vol[1], fLadder = vol[2], fStatus = vol[3].
283 // The array *hits contains, in order, fX = hits[0], fY = hits[1],
284 // fZ = hits[2], fPx = hits[3], fPy = hits[4], fPz = hits[5],
285 // fDestep = hits[6], and fTof = hits[7]. In the units of the Monte Carlo
286 ////////////////////////////////////////////////////////////////////////
288 // Int_t shunt See AliHit
289 // Int_t track Track number, see AliHit
290 // Int_t *vol Array of integer hit data,
291 // vol[0] Layer where the hit is, 1-6 typicaly
292 // vol[1] Ladder where the hit is.
293 // vol[2] Detector number where the hit is
294 // vol[3] Set of status bits
295 // Float_t *hits Array of hit information
296 // hits[0] X global position of this hit
297 // hits[1] Y global position of this hit
298 // hits[2] Z global position of this hit
299 // hits[3] Px global position of this hit
300 // hits[4] Py global position of this hit
301 // hits[5] Pz global position of this hit
302 // hits[6] Energy deposited by this step
303 // hits[7] Time of flight of this particle at this step
307 // A standard created AliITShit class.
308 fX = hits[0]; // Track X global position
309 fY = hits[1]; // Track Y global position
310 fZ = hits[2]; // Track Z global position
312 //______________________________________________________________________
313 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z){
314 ////////////////////////////////////////////////////////////////////////
315 // Returns the position of this hit in the local coordinates of this
316 // module, and in the units of the Monte Carlo.
317 ////////////////////////////////////////////////////////////////////////
318 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
325 gm->GtoL(fLayer,fLadder,fDet,g,l);
330 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
331 // AliITSv7 - SDD case
338 //______________________________________________________________________
339 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z,Float_t &tof){
340 ////////////////////////////////////////////////////////////////////////
341 // Returns the position and time of flight of this hit in the local
342 // coordinates of this module, and in the units of the Monte Carlo.
343 ////////////////////////////////////////////////////////////////////////
344 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
351 gm->GtoL(fLayer,fLadder,fDet,g,l);
356 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
357 // AliITSv7 - SDD case
365 //______________________________________________________________________
366 void AliITShit::GetPositionL0(Double_t &x,Double_t &y,Double_t &z,
368 ////////////////////////////////////////////////////////////////////////
369 // Returns the initial position and time of flight of this hit in the local
370 // coordinates of this module, and in the units of the Monte Carlo.
371 ////////////////////////////////////////////////////////////////////////
372 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
379 gm->GtoL(fLayer,fLadder,fDet,g,l);
384 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
385 // AliITSv7 - SDD case
393 //______________________________________________________________________
394 Float_t AliITShit::GetXL(){
395 ////////////////////////////////////////////////////////////////////////
396 // Returns the x position of this hit in the local coordinates of this
397 // module, and in the units of the Monte Carlo.
398 ////////////////////////////////////////////////////////////////////////
399 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
406 gm->GtoL(fLayer,fLadder,fDet,g,l);
409 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
413 //______________________________________________________________________
414 Float_t AliITShit::GetYL(){
415 ////////////////////////////////////////////////////////////////////////
416 // Returns the y 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::GetZL(){
435 ////////////////////////////////////////////////////////////////////////
436 // Returns the z 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 void AliITShit::GetMomentumL(Float_t &px,Float_t &py,Float_t &pz){
455 ////////////////////////////////////////////////////////////////////////
456 // Returns the momentum 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->GtoLMomentum(fLayer,fLadder,fDet,g,l);
471 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
478 //______________________________________________________________________
479 Float_t AliITShit::GetPXL(){
480 ////////////////////////////////////////////////////////////////////////
481 // Returns the X 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);
494 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
498 //______________________________________________________________________
499 Float_t AliITShit::GetPYL(){
500 ////////////////////////////////////////////////////////////////////////
501 // Returns the Y 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);
519 //______________________________________________________________________
520 Float_t AliITShit::GetPZL(){
521 ////////////////////////////////////////////////////////////////////////
522 // Returns the Z momentum of this hit in the local coordinates of this
523 // module, and in the units of the Monte Carlo.
524 ////////////////////////////////////////////////////////////////////////
525 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
532 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
535 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
540 //___________________________________________________________________________;
541 Int_t AliITShit::GetModule(){
542 ////////////////////////////////////////////////////////////////////////
543 // Returns the module index number of the module where this hit was in.
544 ////////////////////////////////////////////////////////////////////////
545 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
547 if (gm) return gm->GetModuleIndex(fLayer,fLadder,fDet);
549 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
553 //______________________________________________________________________
554 TParticle * AliITShit::GetParticle() const {
555 ////////////////////////////////////////////////////////////////////////
556 // Returns the pointer to the TParticle for the particle that created
557 // this hit. From the TParticle all kinds of information about this
558 // particle can be found. See the TParticle class.
559 ////////////////////////////////////////////////////////////////////////
560 return gAlice->GetMCApp()->Particle(GetTrack());
562 //----------------------------------------------------------------------
563 void AliITShit::Print(ostream *os) const {
564 ////////////////////////////////////////////////////////////////////////
565 // Standard output format for this class.
566 ////////////////////////////////////////////////////////////////////////
574 #if defined __ICC || defined __ECC || defined __xlC__
581 fmt = os->setf(ios::scientific); // set scientific floating point output
582 *os << fTrack << " " << fX << " " << fY << " " << fZ << " ";
583 fmt = os->setf(ios::hex); // set hex for fStatus only.
584 *os << fStatus << " ";
585 fmt = os->setf(ios::dec); // every thing else decimel.
586 *os << fLayer << " " << fLadder << " " << fDet << " ";;
587 *os << fPx << " " << fPy << " " << fPz << " ";
588 *os << fDestep << " " << fTof;
589 *os << " " << fx0 << " " << fy0 << " " << fz0;
590 // *os << " " << endl;
591 os->flags(fmt); // reset back to old formating.
594 //----------------------------------------------------------------------
595 void AliITShit::Read(istream *is) {
596 ////////////////////////////////////////////////////////////////////////
597 // Standard input format for this class.
598 ////////////////////////////////////////////////////////////////////////
601 *is >> fTrack >> fX >> fY >> fZ;
602 *is >> fStatus >> fLayer >> fLadder >> fDet >> fPx >> fPy >> fPz >>
604 *is >> fx0 >> fy0 >> fz0;
607 //----------------------------------------------------------------------
608 ostream &operator<<(ostream &os,AliITShit &p){
609 ////////////////////////////////////////////////////////////////////////
610 // Standard output streaming function.
611 ////////////////////////////////////////////////////////////////////////
616 //----------------------------------------------------------------------
617 istream &operator>>(istream &is,AliITShit &r){
618 ////////////////////////////////////////////////////////////////////////
619 // Standard input streaming function.
620 ////////////////////////////////////////////////////////////////////////
625 //----------------------------------------------------------------------