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(){
193 // Default Constructor
194 // Zero data member just to be safe.
200 // A default created AliITShit class.
202 fStatus = 0; // Track Status
203 fLayer = 0; // Layer number
204 fLadder = 0; // Ladder number
205 fDet = 0; // Detector number
206 fPx = 0.0; // PX of particle at the point of the hit
207 fPy = 0.0; // PY of particle at the point of the hit
208 fPz = 0.0; // PZ of particle at the point of the hit
209 fDestep = 0.0; // Energy deposited in the current step
210 fTof = 0.0; // Time of flight at the point of the hit
211 fStatus0 = 0; // zero status bit by default.
212 fx0 = 0.0; // Starting point of this step
213 fy0 = 0.0; // Starting point of this step
214 fz0 = 0.0; // Starting point of this step
215 ft0 = 0.0; // Starting point of this step
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){
220 ////////////////////////////////////////////////////////////////////////
222 // The creator of the AliITShit class. The variables shunt and
223 // track are passed to the creator of the AliHit class. See the AliHit
224 // class for a full description. In the units of the Monte Carlo
225 ////////////////////////////////////////////////////////////////////////
227 // Int_t shunt See AliHit
228 // Int_t track Track number, see AliHit
229 // Int_t *vol Array of integer hit data,
230 // vol[0] Layer where the hit is, 1-6 typicaly
231 // vol[1] Ladder where the hit is.
232 // vol[2] Detector number where the hit is
233 // vol[3] Set of status bits
234 // vol[4] Set of status bits at start
238 // A default created AliITShit class.
240 fLayer = vol[0]; // Layer number
241 fLadder = vol[2]; // Ladder number
242 fDet = vol[1]; // Detector number
243 fStatus = vol[3]; // Track status flags
244 fStatus0 = vol[4]; // Track status flag for start position.
245 fX = x.X(); // Track X global position
246 fY = x.Y(); // Track Y global position
247 fZ = x.Z(); // Track Z global position
248 fPx = p.Px(); // Track X Momentum
249 fPy = p.Py(); // Track Y Momentum
250 fPz = p.Pz(); // Track Z Momentum
251 fDestep = edep; // Track dE/dx for this step
252 fTof = tof ; // Track Time of Flight for this step
253 fx0 = x0.X(); // Track X global position
254 fy0 = x0.Y(); // Track Y global position
255 fz0 = x0.Z(); // Track Z global position
256 ft0 = x0.T(); // Starting point of this step
258 //______________________________________________________________________
259 AliITShit::AliITShit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
260 AliHit(shunt, track){
261 ////////////////////////////////////////////////////////////////////////
263 // The creator of the AliITShit class. The variables shunt and
264 // track are passed to the creator of the AliHit class. See the AliHit
265 // class for a full description. the integer array *vol contains, in order,
266 // fLayer = vol[0], fDet = vol[1], fLadder = vol[2], fStatus = vol[3].
267 // The array *hits contains, in order, fX = hits[0], fY = hits[1],
268 // fZ = hits[2], fPx = hits[3], fPy = hits[4], fPz = hits[5],
269 // fDestep = hits[6], and fTof = hits[7]. In the units of the Monte Carlo
270 ////////////////////////////////////////////////////////////////////////
272 // Int_t shunt See AliHit
273 // Int_t track Track number, see AliHit
274 // Int_t *vol Array of integer hit data,
275 // vol[0] Layer where the hit is, 1-6 typicaly
276 // vol[1] Ladder where the hit is.
277 // vol[2] Detector number where the hit is
278 // vol[3] Set of status bits
279 // Float_t *hits Array of hit information
280 // hits[0] X global position of this hit
281 // hits[1] Y global position of this hit
282 // hits[2] Z global position of this hit
283 // hits[3] Px global position of this hit
284 // hits[4] Py global position of this hit
285 // hits[5] Pz global position of this hit
286 // hits[6] Energy deposited by this step
287 // hits[7] Time of flight of this particle at this step
291 // A standard created AliITShit class.
292 fLayer = vol[0]; // Layer number
293 fLadder = vol[2]; // Ladder number
294 fDet = vol[1]; // Detector number
295 fStatus = vol[3]; // Track status flags
296 fX = hits[0]; // Track X global position
297 fY = hits[1]; // Track Y global position
298 fZ = hits[2]; // Track Z global position
299 fPx = hits[3]; // Track X Momentum
300 fPy = hits[4]; // Track Y Momentum
301 fPz = hits[5]; // Track Z Momentum
302 fDestep = hits[6]; // Track dE/dx for this step
303 fTof = hits[7]; // Track Time of Flight for this step
304 fStatus0 = 0;// Track Status of Starting point
305 fx0 = 0.0; // Starting point of this step
306 fy0 = 0.0; // Starting point of this step
307 fz0 = 0.0; // Starting point of this step
308 ft0 = 0.0; // Starting point of this step
310 //______________________________________________________________________
311 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z){
312 ////////////////////////////////////////////////////////////////////////
313 // Returns the position of this hit in the local coordinates of this
314 // module, and in the units of the Monte Carlo.
315 ////////////////////////////////////////////////////////////////////////
316 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
323 gm->GtoL(fLayer,fLadder,fDet,g,l);
328 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
329 // AliITSv7 - SDD case
336 //______________________________________________________________________
337 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z,Float_t &tof){
338 ////////////////////////////////////////////////////////////////////////
339 // Returns the position and time of flight of this hit in the local
340 // coordinates of this module, and in the units of the Monte Carlo.
341 ////////////////////////////////////////////////////////////////////////
342 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
349 gm->GtoL(fLayer,fLadder,fDet,g,l);
354 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
355 // AliITSv7 - SDD case
363 //______________________________________________________________________
364 void AliITShit::GetPositionL0(Double_t &x,Double_t &y,Double_t &z,
366 ////////////////////////////////////////////////////////////////////////
367 // Returns the initial position and time of flight of this hit in the local
368 // coordinates of this module, and in the units of the Monte Carlo.
369 ////////////////////////////////////////////////////////////////////////
370 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
377 gm->GtoL(fLayer,fLadder,fDet,g,l);
382 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
383 // AliITSv7 - SDD case
391 //______________________________________________________________________
392 Float_t AliITShit::GetXL(){
393 ////////////////////////////////////////////////////////////////////////
394 // Returns the x position of this hit in the local coordinates of this
395 // module, and in the units of the Monte Carlo.
396 ////////////////////////////////////////////////////////////////////////
397 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
404 gm->GtoL(fLayer,fLadder,fDet,g,l);
407 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
411 //______________________________________________________________________
412 Float_t AliITShit::GetYL(){
413 ////////////////////////////////////////////////////////////////////////
414 // Returns the y position of this hit in the local coordinates of this
415 // module, and in the units of the Monte Carlo.
416 ////////////////////////////////////////////////////////////////////////
417 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
424 gm->GtoL(fLayer,fLadder,fDet,g,l);
427 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
431 //______________________________________________________________________
432 Float_t AliITShit::GetZL(){
433 ////////////////////////////////////////////////////////////////////////
434 // Returns the z position of this hit in the local coordinates of this
435 // module, and in the units of the Monte Carlo.
436 ////////////////////////////////////////////////////////////////////////
437 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
444 gm->GtoL(fLayer,fLadder,fDet,g,l);
447 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
451 //______________________________________________________________________
452 void AliITShit::GetMomentumL(Float_t &px,Float_t &py,Float_t &pz){
453 ////////////////////////////////////////////////////////////////////////
454 // Returns the momentum of this hit in the local coordinates of this
455 // module, and in the units of the Monte Carlo.
456 ////////////////////////////////////////////////////////////////////////
457 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
464 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
469 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
476 //______________________________________________________________________
477 Float_t AliITShit::GetPXL(){
478 ////////////////////////////////////////////////////////////////////////
479 // Returns the X momentum of this hit in the local coordinates of this
480 // module, and in the units of the Monte Carlo.
481 ////////////////////////////////////////////////////////////////////////
482 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
489 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
492 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
496 //______________________________________________________________________
497 Float_t AliITShit::GetPYL(){
498 ////////////////////////////////////////////////////////////////////////
499 // Returns the Y momentum of this hit in the local coordinates of this
500 // module, and in the units of the Monte Carlo.
501 ////////////////////////////////////////////////////////////////////////
502 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
509 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
512 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
517 //______________________________________________________________________
518 Float_t AliITShit::GetPZL(){
519 ////////////////////////////////////////////////////////////////////////
520 // Returns the Z momentum of this hit in the local coordinates of this
521 // module, and in the units of the Monte Carlo.
522 ////////////////////////////////////////////////////////////////////////
523 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
530 gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
533 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
538 //___________________________________________________________________________;
539 Int_t AliITShit::GetModule(){
540 ////////////////////////////////////////////////////////////////////////
541 // Returns the module index number of the module where this hit was in.
542 ////////////////////////////////////////////////////////////////////////
543 AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
545 if (gm) return gm->GetModuleIndex(fLayer,fLadder,fDet);
547 Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
551 //______________________________________________________________________
552 TParticle * AliITShit::GetParticle() const {
553 ////////////////////////////////////////////////////////////////////////
554 // Returns the pointer to the TParticle for the particle that created
555 // this hit. From the TParticle all kinds of information about this
556 // particle can be found. See the TParticle class.
557 ////////////////////////////////////////////////////////////////////////
558 return gAlice->GetMCApp()->Particle(GetTrack());
560 //----------------------------------------------------------------------
561 void AliITShit::Print(ostream *os) const {
562 ////////////////////////////////////////////////////////////////////////
563 // Standard output format for this class.
564 ////////////////////////////////////////////////////////////////////////
572 #if defined __ICC || defined __ECC || defined __xlC__
579 fmt = os->setf(ios::scientific); // set scientific floating point output
580 *os << fTrack << " " << fX << " " << fY << " " << fZ << " ";
581 fmt = os->setf(ios::hex); // set hex for fStatus only.
582 *os << fStatus << " ";
583 fmt = os->setf(ios::dec); // every thing else decimel.
584 *os << fLayer << " " << fLadder << " " << fDet << " ";;
585 *os << fPx << " " << fPy << " " << fPz << " ";
586 *os << fDestep << " " << fTof;
587 *os << " " << fx0 << " " << fy0 << " " << fz0;
588 // *os << " " << endl;
589 os->flags(fmt); // reset back to old formating.
592 //----------------------------------------------------------------------
593 void AliITShit::Read(istream *is) {
594 ////////////////////////////////////////////////////////////////////////
595 // Standard input format for this class.
596 ////////////////////////////////////////////////////////////////////////
599 *is >> fTrack >> fX >> fY >> fZ;
600 *is >> fStatus >> fLayer >> fLadder >> fDet >> fPx >> fPy >> fPz >>
602 *is >> fx0 >> fy0 >> fz0;
605 //----------------------------------------------------------------------
606 ostream &operator<<(ostream &os,AliITShit &p){
607 ////////////////////////////////////////////////////////////////////////
608 // Standard output streaming function.
609 ////////////////////////////////////////////////////////////////////////
614 //----------------------------------------------------------------------
615 istream &operator>>(istream &is,AliITShit &r){
616 ////////////////////////////////////////////////////////////////////////
617 // Standard input streaming function.
618 ////////////////////////////////////////////////////////////////////////
623 //----------------------------------------------------------------------