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>
23 #include <TGeometry.h>
26 #include "TParticle.h"
30 #include "AliITSgeom.h"
31 #include "AliITShit.h"
36 ////////////////////////////////////////////////////////////////////////
38 // Written by Rene Brun, Federico Carminati, and Roberto Barbera
41 // Modified and documented by Bjorn S. Nilsen
44 // AliITShit is the hit class for the ITS. Hits are the information
45 // that comes from a Monte Carlo at each step as a particle mass through
46 // sensitive detector elements as particles are transported through a
51 <img src="picts/ITS/AliITShit_Class_Diagram.gif">
54 <font size=+2 color=red>
55 <p>This show the relasionships between the ITS hit class and the rest of Aliroot.
60 ////////////////////////////////////////////////////////////////////////
61 // Inline Member functions:
64 // The default creator of the AliITShit class.
67 // The default destructor of the AliITShit class.
70 // See AliHit for a full description. Returns the track number fTrack
73 // SetTrack(int track)
74 // See AliHit for a full description. Sets the track number fTrack
77 // Int_t GetTrackStatus()
78 // Returns the value of the track status flag fStatus. This flag
79 // indicates the track status at the time of creating this hit. It is
80 // made up of the following 8 status bits from highest order to lowest
82 // 0 : IsTrackAlive(): IsTrackStop():IsTrackDisappeared():
83 // IsTrackOut():IsTrackExiting():IsTrackEntering():IsTrackInside() .
84 // See AliMC for a description of these functions. If the function is
85 // true then the bit is set to one, otherwise it is zero.
87 // Bool_t StatusInside()
88 // Returns kTRUE if the particle producing this hit is still inside
89 // the present volume. Returns kFalse if this particle will be in another
90 // volume. {bit IsTrackInside is set or not}
92 // Bool_t StatusEntering()
93 // Returns kTRUE if the particle producing this hit is has just enterd
94 // the present volume. Returns kFalse otherwise. {bit IsTrackEntering is
97 // Bool_t StatusExiting()
98 // Returns kTRUE if the particle producing this hit is will exit
99 // the present volume. Returns kFalse otherwise. {bit IsTrackExiting is set
102 // Bool_t StatusOut()
103 // Returns kTRUE if the particle producing this hit is goint exit the
104 // simulation. Returns kFalse otherwise. {bit IsTrackOut is set or not}
106 // Bool_t StatusDisappeared()
107 // Returns kTRUE if the particle producing this hit is going to "disappear"
108 // for example it has interacted producing some other particles. Returns
109 // kFalse otherwise. {bit IsTrackOut is set or not}
111 // Bool_t StatusStop()
112 // Returns kTRUE if the particle producing this hit is has dropped below
113 // its energy cut off producing some other particles. Returns kFalse otherwise.
114 // {bit IsTrackOut is set or not}
116 // Bool_t StatuAlives()
117 // Returns kTRUE if the particle producing this hit is going to continue
118 // to be transported. Returns kFalse otherwise. {bit IsTrackOut is set or not}
121 // Returns the layer number, fLayer, for this hit.
124 // Returns the ladder number, fLadder, for this hit.
126 // Int_t GetDetector()
127 // Returns the detector number, fDet, for this hit.
129 // GetDetectorID(Int_t &layer, Int_t &ladder, Int_t &detector)
130 // Returns the layer, ladder, and detector numbers, fLayer fLadder fDet,
133 // Float_t GetIonization()
134 // Returns the energy lost, fDestep, by the particle creating this hit,
135 // in the units defined by the Monte Carlo.
137 // GetPositionG(Float_t &x, Float_t &y, Float_t &z)
138 // Returns the global position, fX fY fZ, of this hit, in the units
139 // define by the Monte Carlo.
141 // GetPositionG(Double_t &x, Double_t &y, Double_t &z)
142 // Returns the global position, fX fY fZ, of this hit, in the units
143 // define by the Monte Carlo.
145 // GetPositionG(Float_t &x, Float_t &y, Float_t &z, Float_t &tof)
146 // Returns the global position and time of flight, fX fY fZ fTof, of
147 // this hit, in the units define by the Monte Carlo.
149 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
150 // Returns the global position and time of flight, fX fY fZ fTof, of
151 // this hit, in the units define by the Monte Carlo.
153 // GetPositionL(Double_t &x,Double_t &y,Double_t &z)
154 // Returns the local position, fX fY fZ, of this hit in the coordiante
155 // of this module, in the units define by the Monte Carlo.
157 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
158 // Returns the local position and time of flight, fX fY fZ fTof, of
159 // this hit in the coordinates of this module, in the units define by the
163 // Returns the global x position in the units defined by the Monte Carlo.
166 // Returns the global y position in the units defined by the Monte Carlo.
169 // Returns the global z position in the units defined by the Monte Carlo.
172 // Returns the time of flight, fTof, of this hit, in the units defined
173 // by the Monte Carlo.
175 // GetMomentumG(Float_t &px, Float_t &py, Float_t &pz)
176 // Returns the global momentum, fPx fPy fPz, of the particle that made
177 // this hit, in the units define by the Monte Carlo.
179 // GetMomentumG(Double_t &px,Double_t &py,Double_t &pz)
180 // Returns the global momentum, fPx fPy fPz, of the particle that made
181 // this hit, in the units define by the Monte Carlo.
183 // GetMomentumL(Double_t &px,Double_t &py,Double_t &pz)
184 // Returns the momentum, fPx fPy fPz in coordinate appropreate for this
185 // specific module, in the units define by the Monte Carlo.
188 // Returns the global X momentum in the units defined by the Monte Carlo.
191 // Returns the global Y momentum in the units defined by the Monte Carlo.
194 // Returns the global Z momentum in the units defined by the Monte Carlo.
196 ////////////////////////////////////////////////////////////////////////
197 //_____________________________________________________________________________
198 AliITShit::AliITShit():AliHit(){
199 // Default Constructor
200 // Zero data member just to be safe.
206 // A default created AliITShit class.
208 fStatus = 0; // Track Status
209 fLayer = 0; // Layer number
210 fLadder = 0; // Ladder number
211 fDet = 0; // Detector number
212 fPx = 0.0; // PX of particle at the point of the hit
213 fPy = 0.0; // PY of particle at the point of the hit
214 fPz = 0.0; // PZ of particle at the point of the hit
215 fDestep = 0.0; // Energy deposited in the current step
216 fTof = 0.0; // Time of flight at the point of the hit
217 fStatus0 = 0; // zero status bit by default.
218 fx0 = 0.0; // Starting point of this step
219 fy0 = 0.0; // Starting point of this step
220 fz0 = 0.0; // Starting point of this step
221 ft0 = 0.0; // Starting point of this step
223 AliITShit::AliITShit(Int_t shunt,Int_t track,Int_t *vol,Float_t edep,
224 Float_t tof,TLorentzVector &x,TLorentzVector &x0,
225 TLorentzVector &p) : AliHit(shunt, track){
226 ////////////////////////////////////////////////////////////////////////
228 // The creator of the AliITShit class. The variables shunt and
229 // track are passed to the creator of the AliHit class. See the AliHit
230 // class for a full description. In the units of the Monte Carlo
231 ////////////////////////////////////////////////////////////////////////
233 // Int_t shunt See AliHit
234 // Int_t track Track number, see AliHit
235 // Int_t *vol Array of integer hit data,
236 // vol[0] Layer where the hit is, 1-6 typicaly
237 // vol[1] Ladder where the hit is.
238 // vol[2] Detector number where the hit is
239 // vol[3] Set of status bits
240 // vol[4] Set of status bits at start
244 // A default created AliITShit class.
246 fLayer = vol[0]; // Layer number
247 fLadder = vol[2]; // Ladder number
248 fDet = vol[1]; // Detector number
249 fStatus = vol[3]; // Track status flags
250 fStatus0 = vol[4]; // Track status flag for start position.
251 fX = x.X(); // Track X global position
252 fY = x.Y(); // Track Y global position
253 fZ = x.Z(); // Track Z global position
254 fPx = p.Px(); // Track X Momentum
255 fPy = p.Py(); // Track Y Momentum
256 fPz = p.Pz(); // Track Z Momentum
257 fDestep = edep; // Track dE/dx for this step
258 fTof = tof ; // Track Time of Flight for this step
259 fx0 = x0.X(); // Track X global position
260 fy0 = x0.Y(); // Track Y global position
261 fz0 = x0.Z(); // Track Z global position
262 ft0 = x0.T(); // Starting point of this step
264 //______________________________________________________________________
265 AliITShit::AliITShit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
266 AliHit(shunt, track){
267 ////////////////////////////////////////////////////////////////////////
269 // The creator of the AliITShit class. The variables shunt and
270 // track are passed to the creator of the AliHit class. See the AliHit
271 // class for a full description. the integer array *vol contains, in order,
272 // fLayer = vol[0], fDet = vol[1], fLadder = vol[2], fStatus = vol[3].
273 // The array *hits contains, in order, fX = hits[0], fY = hits[1],
274 // fZ = hits[2], fPx = hits[3], fPy = hits[4], fPz = hits[5],
275 // fDestep = hits[6], and fTof = hits[7]. 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 // Float_t *hits Array of hit information
286 // hits[0] X global position of this hit
287 // hits[1] Y global position of this hit
288 // hits[2] Z global position of this hit
289 // hits[3] Px global position of this hit
290 // hits[4] Py global position of this hit
291 // hits[5] Pz global position of this hit
292 // hits[6] Energy deposited by this step
293 // hits[7] Time of flight of this particle at this step
297 // A standard 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 fX = hits[0]; // Track X global position
303 fY = hits[1]; // Track Y global position
304 fZ = hits[2]; // Track Z global position
305 fPx = hits[3]; // Track X Momentum
306 fPy = hits[4]; // Track Y Momentum
307 fPz = hits[5]; // Track Z Momentum
308 fDestep = hits[6]; // Track dE/dx for this step
309 fTof = hits[7]; // Track Time of Flight for this step
310 fStatus0 = 0;// Track Status of Starting point
311 fx0 = 0.0; // Starting point of this step
312 fy0 = 0.0; // Starting point of this step
313 fz0 = 0.0; // Starting point of this step
314 ft0 = 0.0; // Starting point of this step
316 //______________________________________________________________________
317 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z){
318 ////////////////////////////////////////////////////////////////////////
319 // Returns the position of this hit in the local coordinates of this
320 // module, and in the units of the Monte Carlo.
321 ////////////////////////////////////////////////////////////////////////
322 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
329 gm->GtoL(fLayer,fLadder,fDet,g,l);
334 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
335 // AliITSv7 - SDD case
342 //______________________________________________________________________
343 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z,Float_t &tof){
344 ////////////////////////////////////////////////////////////////////////
345 // Returns the position and time of flight of this hit in the local
346 // coordinates of this module, and in the units of the Monte Carlo.
347 ////////////////////////////////////////////////////////////////////////
348 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
355 gm->GtoL(fLayer,fLadder,fDet,g,l);
360 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
361 // AliITSv7 - SDD case
369 //______________________________________________________________________
370 void AliITShit::GetPositionL0(Double_t &x,Double_t &y,Double_t &z,
372 ////////////////////////////////////////////////////////////////////////
373 // Returns the initial position and time of flight of this hit in the local
374 // coordinates of this module, and in the units of the Monte Carlo.
375 ////////////////////////////////////////////////////////////////////////
376 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
383 gm->GtoL(fLayer,fLadder,fDet,g,l);
388 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
389 // AliITSv7 - SDD case
397 //______________________________________________________________________
398 Float_t AliITShit::GetXL(){
399 ////////////////////////////////////////////////////////////////////////
400 // Returns the x position of this hit in the local coordinates of this
401 // module, and in the units of the Monte Carlo.
402 ////////////////////////////////////////////////////////////////////////
403 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
410 gm->GtoL(fLayer,fLadder,fDet,g,l);
413 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
417 //______________________________________________________________________
418 Float_t AliITShit::GetYL(){
419 ////////////////////////////////////////////////////////////////////////
420 // Returns the y position of this hit in the local coordinates of this
421 // module, and in the units of the Monte Carlo.
422 ////////////////////////////////////////////////////////////////////////
423 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
430 gm->GtoL(fLayer,fLadder,fDet,g,l);
433 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
437 //______________________________________________________________________
438 Float_t AliITShit::GetZL(){
439 ////////////////////////////////////////////////////////////////////////
440 // Returns the z position of this hit in the local coordinates of this
441 // module, and in the units of the Monte Carlo.
442 ////////////////////////////////////////////////////////////////////////
443 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
450 gm->GtoL(fLayer,fLadder,fDet,g,l);
453 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
457 //______________________________________________________________________
458 void AliITShit::GetMomentumL(Float_t &px,Float_t &py,Float_t &pz){
459 ////////////////////////////////////////////////////////////////////////
460 // Returns the momentum of this hit in the local coordinates of this
461 // module, and in the units of the Monte Carlo.
462 ////////////////////////////////////////////////////////////////////////
463 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
470 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
475 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
482 //______________________________________________________________________
483 Float_t AliITShit::GetPXL(){
484 ////////////////////////////////////////////////////////////////////////
485 // Returns the X momentum of this hit in the local coordinates of this
486 // module, and in the units of the Monte Carlo.
487 ////////////////////////////////////////////////////////////////////////
488 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
495 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
498 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
502 //______________________________________________________________________
503 Float_t AliITShit::GetPYL(){
504 ////////////////////////////////////////////////////////////////////////
505 // Returns the Y momentum of this hit in the local coordinates of this
506 // module, and in the units of the Monte Carlo.
507 ////////////////////////////////////////////////////////////////////////
508 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
515 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
518 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
523 //______________________________________________________________________
524 Float_t AliITShit::GetPZL(){
525 ////////////////////////////////////////////////////////////////////////
526 // Returns the Z momentum of this hit in the local coordinates of this
527 // module, and in the units of the Monte Carlo.
528 ////////////////////////////////////////////////////////////////////////
529 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
536 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
539 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
544 //___________________________________________________________________________;
545 Int_t AliITShit::GetModule(){
546 ////////////////////////////////////////////////////////////////////////
547 // Returns the module index number of the module where this hit was in.
548 ////////////////////////////////////////////////////////////////////////
549 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
551 if (gm) return gm->GetModuleIndex(fLayer,fLadder,fDet);
553 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
557 //______________________________________________________________________
558 TParticle * AliITShit::GetParticle(){
559 ////////////////////////////////////////////////////////////////////////
560 // Returns the pointer to the TParticle for the particle that created
561 // this hit. From the TParticle all kinds of information about this
562 // particle can be found. See the TParticle class.
563 ////////////////////////////////////////////////////////////////////////
564 return gAlice->GetMCApp()->Particle(GetTrack());
566 //----------------------------------------------------------------------
567 void AliITShit::Print(ostream *os){
568 ////////////////////////////////////////////////////////////////////////
569 // Standard output format for this class.
570 ////////////////////////////////////////////////////////////////////////
578 #if defined __ICC || defined __ECC
585 fmt = os->setf(ios::scientific); // set scientific floating point output
586 *os << fTrack << " " << fX << " " << fY << " " << fZ << " ";
587 fmt = os->setf(ios::hex); // set hex for fStatus only.
588 *os << fStatus << " ";
589 fmt = os->setf(ios::dec); // every thing else decimel.
590 *os << fLayer << " " << fLadder << " " << fDet << " ";;
591 *os << fPx << " " << fPy << " " << fPz << " ";
592 *os << fDestep << " " << fTof;
593 *os << " " << fx0 << " " << fy0 << " " << fz0;
594 // *os << " " << endl;
595 os->flags(fmt); // reset back to old formating.
598 //----------------------------------------------------------------------
599 void AliITShit::Read(istream *is){
600 ////////////////////////////////////////////////////////////////////////
601 // Standard input format for this class.
602 ////////////////////////////////////////////////////////////////////////
605 *is >> fTrack >> fX >> fY >> fZ;
606 *is >> fStatus >> fLayer >> fLadder >> fDet >> fPx >> fPy >> fPz >>
608 *is >> fx0 >> fy0 >> fz0;
611 //----------------------------------------------------------------------
612 ostream &operator<<(ostream &os,AliITShit &p){
613 ////////////////////////////////////////////////////////////////////////
614 // Standard output streaming function.
615 ////////////////////////////////////////////////////////////////////////
620 //----------------------------------------------------------------------
621 istream &operator>>(istream &is,AliITShit &r){
622 ////////////////////////////////////////////////////////////////////////
623 // Standard input streaming function.
624 ////////////////////////////////////////////////////////////////////////
629 //----------------------------------------------------------------------