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"
35 ////////////////////////////////////////////////////////////////////////
37 // Written by Rene Brun, Federico Carminati, and Roberto Barbera
40 // Modified and documented by Bjorn S. Nilsen
43 // AliITShit is the hit class for the ITS. Hits are the information
44 // that comes from a Monte Carlo at each step as a particle mass through
45 // sensitive detector elements as particles are transported through a
50 <img src="picts/ITS/AliITShit_Class_Diagram.gif">
53 <font size=+2 color=red>
54 <p>This show the relasionships between the ITS hit class and the rest of Aliroot.
59 ////////////////////////////////////////////////////////////////////////
60 // Inline Member functions:
63 // The default creator of the AliITShit class.
66 // The default destructor of the AliITShit class.
69 // See AliHit for a full description. Returns the track number fTrack
72 // SetTrack(int track)
73 // See AliHit for a full description. Sets the track number fTrack
76 // Int_t GetTrackStatus()
77 // Returns the value of the track status flag fStatus. This flag
78 // indicates the track status at the time of creating this hit. It is
79 // made up of the following 8 status bits from highest order to lowest
81 // 0 : IsTrackAlive(): IsTrackStop():IsTrackDisappeared():
82 // IsTrackOut():IsTrackExiting():IsTrackEntering():IsTrackInside() .
83 // See AliMC for a description of these functions. If the function is
84 // true then the bit is set to one, otherwise it is zero.
86 // Bool_t StatusInside()
87 // Returns kTRUE if the particle producing this hit is still inside
88 // the present volume. Returns kFalse if this particle will be in another
89 // volume. {bit IsTrackInside is set or not}
91 // Bool_t StatusEntering()
92 // Returns kTRUE if the particle producing this hit is has just enterd
93 // the present volume. Returns kFalse otherwise. {bit IsTrackEntering is
96 // Bool_t StatusExiting()
97 // Returns kTRUE if the particle producing this hit is will exit
98 // the present volume. Returns kFalse otherwise. {bit IsTrackExiting is set
101 // Bool_t StatusOut()
102 // Returns kTRUE if the particle producing this hit is goint exit the
103 // simulation. Returns kFalse otherwise. {bit IsTrackOut is set or not}
105 // Bool_t StatusDisappeared()
106 // Returns kTRUE if the particle producing this hit is going to "disappear"
107 // for example it has interacted producing some other particles. Returns
108 // kFalse otherwise. {bit IsTrackOut is set or not}
110 // Bool_t StatusStop()
111 // Returns kTRUE if the particle producing this hit is has dropped below
112 // its energy cut off producing some other particles. Returns kFalse otherwise.
113 // {bit IsTrackOut is set or not}
115 // Bool_t StatuAlives()
116 // Returns kTRUE if the particle producing this hit is going to continue
117 // to be transported. Returns kFalse otherwise. {bit IsTrackOut is set or not}
120 // Returns the layer number, fLayer, for this hit.
123 // Returns the ladder number, fLadder, for this hit.
125 // Int_t GetDetector()
126 // Returns the detector number, fDet, for this hit.
128 // GetDetectorID(Int_t &layer, Int_t &ladder, Int_t &detector)
129 // Returns the layer, ladder, and detector numbers, fLayer fLadder fDet,
132 // Float_t GetIonization()
133 // Returns the energy lost, fDestep, by the particle creating this hit,
134 // in the units defined by the Monte Carlo.
136 // GetPositionG(Float_t &x, Float_t &y, Float_t &z)
137 // Returns the global position, fX fY fZ, of this hit, in the units
138 // define by the Monte Carlo.
140 // GetPositionG(Double_t &x, Double_t &y, Double_t &z)
141 // Returns the global position, fX fY fZ, of this hit, in the units
142 // define by the Monte Carlo.
144 // GetPositionG(Float_t &x, Float_t &y, Float_t &z, Float_t &tof)
145 // Returns the global position and time of flight, fX fY fZ fTof, of
146 // this hit, in the units define by the Monte Carlo.
148 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
149 // Returns the global position and time of flight, fX fY fZ fTof, of
150 // this hit, in the units define by the Monte Carlo.
152 // GetPositionL(Double_t &x,Double_t &y,Double_t &z)
153 // Returns the local position, fX fY fZ, of this hit in the coordiante
154 // of this module, in the units define by the Monte Carlo.
156 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
157 // Returns the local position and time of flight, fX fY fZ fTof, of
158 // this hit in the coordinates of this module, in the units define by the
162 // Returns the global x position in the units defined by the Monte Carlo.
165 // Returns the global y position in the units defined by the Monte Carlo.
168 // Returns the global z position in the units defined by the Monte Carlo.
171 // Returns the time of flight, fTof, of this hit, in the units defined
172 // by the Monte Carlo.
174 // GetMomentumG(Float_t &px, Float_t &py, Float_t &pz)
175 // Returns the global momentum, fPx fPy fPz, of the particle that made
176 // this hit, in the units define by the Monte Carlo.
178 // GetMomentumG(Double_t &px,Double_t &py,Double_t &pz)
179 // Returns the global momentum, fPx fPy fPz, of the particle that made
180 // this hit, in the units define by the Monte Carlo.
182 // GetMomentumL(Double_t &px,Double_t &py,Double_t &pz)
183 // Returns the momentum, fPx fPy fPz in coordinate appropreate for this
184 // specific module, in the units define by the Monte Carlo.
187 // Returns the global X momentum in the units defined by the Monte Carlo.
190 // Returns the global Y momentum in the units defined by the Monte Carlo.
193 // Returns the global Z momentum in the units defined by the Monte Carlo.
195 ////////////////////////////////////////////////////////////////////////
196 //_____________________________________________________________________________
197 AliITShit::AliITShit():AliHit(){
198 // Default Constructor
199 // Zero data member just to be safe.
205 // A default created AliITShit class.
207 fStatus = 0; // Track Status
208 fLayer = 0; // Layer number
209 fLadder = 0; // Ladder number
210 fDet = 0; // Detector number
211 fPx = 0.0; // PX of particle at the point of the hit
212 fPy = 0.0; // PY of particle at the point of the hit
213 fPz = 0.0; // PZ of particle at the point of the hit
214 fDestep = 0.0; // Energy deposited in the current step
215 fTof = 0.0; // Time of flight at the point of the hit
216 fStatus0 = 0; // zero status bit by default.
217 fx0 = 0.0; // Starting point of this step
218 fy0 = 0.0; // Starting point of this step
219 fz0 = 0.0; // Starting point of this step
220 ft0 = 0.0; // Starting point of this step
222 AliITShit::AliITShit(Int_t shunt,Int_t track,Int_t *vol,Float_t edep,
223 Float_t tof,TLorentzVector &x,TLorentzVector &x0,
224 TLorentzVector &p) : AliHit(shunt, track){
225 ////////////////////////////////////////////////////////////////////////
227 // The creator of the AliITShit class. The variables shunt and
228 // track are passed to the creator of the AliHit class. See the AliHit
229 // class for a full description. In the units of the Monte Carlo
230 ////////////////////////////////////////////////////////////////////////
232 // Int_t shunt See AliHit
233 // Int_t track Track number, see AliHit
234 // Int_t *vol Array of integer hit data,
235 // vol[0] Layer where the hit is, 1-6 typicaly
236 // vol[1] Ladder where the hit is.
237 // vol[2] Detector number where the hit is
238 // vol[3] Set of status bits
239 // vol[4] Set of status bits at start
243 // A default created AliITShit class.
245 fLayer = vol[0]; // Layer number
246 fLadder = vol[2]; // Ladder number
247 fDet = vol[1]; // Detector number
248 fStatus = vol[3]; // Track status flags
249 fStatus0 = vol[4]; // Track status flag for start position.
250 fX = x.X(); // Track X global position
251 fY = x.Y(); // Track Y global position
252 fZ = x.Z(); // Track Z global position
253 fPx = p.Px(); // Track X Momentum
254 fPy = p.Py(); // Track Y Momentum
255 fPz = p.Pz(); // Track Z Momentum
256 fDestep = edep; // Track dE/dx for this step
257 fTof = tof ; // Track Time of Flight for this step
258 fx0 = x0.X(); // Track X global position
259 fy0 = x0.Y(); // Track Y global position
260 fz0 = x0.Z(); // Track Z global position
261 ft0 = x0.T(); // Starting point of this step
263 //______________________________________________________________________
264 AliITShit::AliITShit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
265 AliHit(shunt, track){
266 ////////////////////////////////////////////////////////////////////////
268 // The creator of the AliITShit class. The variables shunt and
269 // track are passed to the creator of the AliHit class. See the AliHit
270 // class for a full description. the integer array *vol contains, in order,
271 // fLayer = vol[0], fDet = vol[1], fLadder = vol[2], fStatus = vol[3].
272 // The array *hits contains, in order, fX = hits[0], fY = hits[1],
273 // fZ = hits[2], fPx = hits[3], fPy = hits[4], fPz = hits[5],
274 // fDestep = hits[6], and fTof = hits[7]. In the units of the Monte Carlo
275 ////////////////////////////////////////////////////////////////////////
277 // Int_t shunt See AliHit
278 // Int_t track Track number, see AliHit
279 // Int_t *vol Array of integer hit data,
280 // vol[0] Layer where the hit is, 1-6 typicaly
281 // vol[1] Ladder where the hit is.
282 // vol[2] Detector number where the hit is
283 // vol[3] Set of status bits
284 // Float_t *hits Array of hit information
285 // hits[0] X global position of this hit
286 // hits[1] Y global position of this hit
287 // hits[2] Z global position of this hit
288 // hits[3] Px global position of this hit
289 // hits[4] Py global position of this hit
290 // hits[5] Pz global position of this hit
291 // hits[6] Energy deposited by this step
292 // hits[7] Time of flight of this particle at this step
296 // A standard created AliITShit class.
297 fLayer = vol[0]; // Layer number
298 fLadder = vol[2]; // Ladder number
299 fDet = vol[1]; // Detector number
300 fStatus = vol[3]; // Track status flags
301 fX = hits[0]; // Track X global position
302 fY = hits[1]; // Track Y global position
303 fZ = hits[2]; // Track Z global position
304 fPx = hits[3]; // Track X Momentum
305 fPy = hits[4]; // Track Y Momentum
306 fPz = hits[5]; // Track Z Momentum
307 fDestep = hits[6]; // Track dE/dx for this step
308 fTof = hits[7]; // Track Time of Flight for this step
309 fStatus0 = 0;// Track Status of Starting point
310 fx0 = 0.0; // Starting point of this step
311 fy0 = 0.0; // Starting point of this step
312 fz0 = 0.0; // Starting point of this step
313 ft0 = 0.0; // Starting point of this step
315 //______________________________________________________________________
316 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z){
317 ////////////////////////////////////////////////////////////////////////
318 // Returns the position of this hit in the local coordinates of this
319 // module, and in the units of the Monte Carlo.
320 ////////////////////////////////////////////////////////////////////////
321 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
328 gm->GtoL(fLayer,fLadder,fDet,g,l);
333 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
334 // AliITSv7 - SDD case
341 //______________________________________________________________________
342 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z,Float_t &tof){
343 ////////////////////////////////////////////////////////////////////////
344 // Returns the position and time of flight of this hit in the local
345 // coordinates of this module, and in the units of the Monte Carlo.
346 ////////////////////////////////////////////////////////////////////////
347 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
354 gm->GtoL(fLayer,fLadder,fDet,g,l);
359 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
360 // AliITSv7 - SDD case
368 //______________________________________________________________________
369 void AliITShit::GetPositionL0(Double_t &x,Double_t &y,Double_t &z,
371 ////////////////////////////////////////////////////////////////////////
372 // Returns the initial position and time of flight of this hit in the local
373 // coordinates of this module, and in the units of the Monte Carlo.
374 ////////////////////////////////////////////////////////////////////////
375 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
382 gm->GtoL(fLayer,fLadder,fDet,g,l);
387 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
388 // AliITSv7 - SDD case
396 //______________________________________________________________________
397 Float_t AliITShit::GetXL(){
398 ////////////////////////////////////////////////////////////////////////
399 // Returns the x position of this hit in the local coordinates of this
400 // module, and in the units of the Monte Carlo.
401 ////////////////////////////////////////////////////////////////////////
402 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
409 gm->GtoL(fLayer,fLadder,fDet,g,l);
412 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
416 //______________________________________________________________________
417 Float_t AliITShit::GetYL(){
418 ////////////////////////////////////////////////////////////////////////
419 // Returns the y position of this hit in the local coordinates of this
420 // module, and in the units of the Monte Carlo.
421 ////////////////////////////////////////////////////////////////////////
422 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
429 gm->GtoL(fLayer,fLadder,fDet,g,l);
432 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
436 //______________________________________________________________________
437 Float_t AliITShit::GetZL(){
438 ////////////////////////////////////////////////////////////////////////
439 // Returns the z position of this hit in the local coordinates of this
440 // module, and in the units of the Monte Carlo.
441 ////////////////////////////////////////////////////////////////////////
442 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
449 gm->GtoL(fLayer,fLadder,fDet,g,l);
452 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
456 //______________________________________________________________________
457 void AliITShit::GetMomentumL(Float_t &px,Float_t &py,Float_t &pz){
458 ////////////////////////////////////////////////////////////////////////
459 // Returns the momentum of this hit in the local coordinates of this
460 // module, and in the units of the Monte Carlo.
461 ////////////////////////////////////////////////////////////////////////
462 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
469 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
474 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
481 //______________________________________________________________________
482 Float_t AliITShit::GetPXL(){
483 ////////////////////////////////////////////////////////////////////////
484 // Returns the X momentum of this hit in the local coordinates of this
485 // module, and in the units of the Monte Carlo.
486 ////////////////////////////////////////////////////////////////////////
487 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
494 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
497 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
501 //______________________________________________________________________
502 Float_t AliITShit::GetPYL(){
503 ////////////////////////////////////////////////////////////////////////
504 // Returns the Y momentum of this hit in the local coordinates of this
505 // module, and in the units of the Monte Carlo.
506 ////////////////////////////////////////////////////////////////////////
507 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
514 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
517 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
522 //______________________________________________________________________
523 Float_t AliITShit::GetPZL(){
524 ////////////////////////////////////////////////////////////////////////
525 // Returns the Z momentum of this hit in the local coordinates of this
526 // module, and in the units of the Monte Carlo.
527 ////////////////////////////////////////////////////////////////////////
528 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
535 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
538 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
543 //___________________________________________________________________________;
544 Int_t AliITShit::GetModule(){
545 ////////////////////////////////////////////////////////////////////////
546 // Returns the module index number of the module where this hit was in.
547 ////////////////////////////////////////////////////////////////////////
548 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
550 if (gm) return gm->GetModuleIndex(fLayer,fLadder,fDet);
552 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
556 //______________________________________________________________________
557 TParticle * AliITShit::GetParticle(){
558 ////////////////////////////////////////////////////////////////////////
559 // Returns the pointer to the TParticle for the particle that created
560 // this hit. From the TParticle all kinds of information about this
561 // particle can be found. See the TParticle class.
562 ////////////////////////////////////////////////////////////////////////
563 return gAlice->Particle(GetTrack());
565 //----------------------------------------------------------------------
566 void AliITShit::Print(ostream *os){
567 ////////////////////////////////////////////////////////////////////////
568 // Standard output format for this class.
569 ////////////////////////////////////////////////////////////////////////
577 #if defined __ICC || defined __ECC
584 fmt = os->setf(ios::scientific); // set scientific floating point output
585 *os << fTrack << " " << fX << " " << fY << " " << fZ << " ";
586 fmt = os->setf(ios::hex); // set hex for fStatus only.
587 *os << fStatus << " ";
588 fmt = os->setf(ios::dec); // every thing else decimel.
589 *os << fLayer << " " << fLadder << " " << fDet << " ";;
590 *os << fPx << " " << fPy << " " << fPz << " ";
591 *os << fDestep << " " << fTof;
592 *os << " " << fx0 << " " << fy0 << " " << fz0;
593 // *os << " " << endl;
594 os->flags(fmt); // reset back to old formating.
597 //----------------------------------------------------------------------
598 void AliITShit::Read(istream *is){
599 ////////////////////////////////////////////////////////////////////////
600 // Standard input format for this class.
601 ////////////////////////////////////////////////////////////////////////
604 *is >> fTrack >> fX >> fY >> fZ;
605 *is >> fStatus >> fLayer >> fLadder >> fDet >> fPx >> fPy >> fPz >>
607 *is >> fx0 >> fy0 >> fz0;
610 //----------------------------------------------------------------------
611 ostream &operator<<(ostream &os,AliITShit &p){
612 ////////////////////////////////////////////////////////////////////////
613 // Standard output streaming function.
614 ////////////////////////////////////////////////////////////////////////
619 //----------------------------------------------------------------------
620 istream &operator>>(istream &is,AliITShit &r){
621 ////////////////////////////////////////////////////////////////////////
622 // Standard input streaming function.
623 ////////////////////////////////////////////////////////////////////////
628 //----------------------------------------------------------------------