TrackPoint_t.cc
Go to the documentation of this file.
1 //----------------------------------------------------------------------
2 // Sets the relevant memebers of the data class for storing the
3 // MC data for the Hadron and Muon Monitors.
4 //
5 // $Id: TrackPoint_t.cc,v 1.1 2011/07/13 16:20:52 loiacono Exp $
6 //----------------------------------------------------------------------
7 
8 
9 #include "globals.hh"
10 #include "G4ios.hh"
11 
12 #include "TrackPoint_t.hh"
13 
15 
16 //-----------------------------------------------------------------------------------
18  :type(-999),
19  trkid(-999),
20  gen(-99),
21  impwt(1.0),
22  x(-99999.0),
23  y(-99999.0),
24  z(-99999.0),
25  px(-99999.0),
26  py(-99999.0),
27  pz(-99999.0)
28 
29 {
30 
31 }
32 
33 //-----------------------------------------------------------------------------------
35 {
36  // TrackPoint_t destructor
37 }
38 
39 
40 //------------------------------------------------------------------------------------------
41 Float_t TrackPoint_t::GetPosition(int i) const
42 {
43  if (i == 0) return x;
44  else if(i == 1) return y;
45  else if(i == 2) return z;
46  else
47  {
48  std::cout << "TrackPoint_t::GetPosition - invalid position index " << i
49  << ". Valid indices are 0, 1, and 2. " << std::endl;
50  return -999999.0;
51  }
52 }
53 
54 //------------------------------------------------------------------------------------------
56 {
57  if (pos == "x" || pos == "X") return x;
58  else if(pos == "y" || pos == "Y") return y;
59  else if(pos == "z" || pos == "Z") return z;
60  else
61  {
62  std::cout << "TrackPoint_t::GetPosition - invalid position \"" << pos
63  << "\". Valid positions are x, y, z, X, Y and Z. " << std::endl;
64  return -999999.0;
65  }
66 }
67 
68 //------------------------------------------------------------------------------------------
69 Float_t TrackPoint_t::GetMomentum(int i) const
70 {
71  if (i == 0) return px;
72  else if(i == 1) return py;
73  else if(i == 2) return pz;
74  else
75  {
76  std::cout << "TrackPoint_t::GetMomentum - invalid momentum index " << i
77  << ". Valid indices are 0, 1, and 2. " << std::endl;
78  return -999999.0;
79  }
80 }
81 
82 //------------------------------------------------------------------------------------------
84 {
85  if (pos == "x" || pos == "X") return px;
86  else if(pos == "y" || pos == "Y") return py;
87  else if(pos == "z" || pos == "Z") return pz;
88  else
89  {
90  std::cout << "TrackPoint_t::GetMomentum - invalid momentum direction \"" << pos
91  << "\". Valid directions are x, y, z, X, Y and Z. " << std::endl;
92  return -999999.0;
93  }
94 }
95 
96 //------------------------------------------------------------------------------------------
98 {
99 
100  std::cout << "TrackPoint_t::Print - " << std::endl;
101  std::cout << " type = " << type << std::endl;
102  std::cout << " track ID = " << trkid << std::endl;
103  std::cout << " generation = " << gen << std::endl;
104  std::cout << " impwt = " << impwt << std::endl;
105  std::cout << " x = " << x << std::endl;
106  std::cout << " y = " << y << std::endl;
107  std::cout << " z = " << z << std::endl;
108  std::cout << " px = " << px << std::endl;
109  std::cout << " py = " << py << std::endl;
110  std::cout << " pz = " << pz << std::endl;
111 }
std::string string
Definition: nybbler.cc:12
double y
ClassImp(TrackPoint_t) TrackPoint_t
Definition: TrackPoint_t.cc:14
Float_t GetMomentum(int i) const
Definition: TrackPoint_t.cc:69
Double_t impwt
Definition: TrackPoint_t.hh:51
double z
Float_t GetPosition(int i) const
Definition: TrackPoint_t.cc:41
virtual ~TrackPoint_t()
Definition: TrackPoint_t.cc:34
static QCString type
Definition: declinfo.cpp:672
list x
Definition: train.py:276
QTextStream & endl(QTextStream &s)