All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
SimTrackerDigiHit.cc
Go to the documentation of this file.
1 #include "SimTrackerDigiHit.h"
2 
3 // Namespaces
4 using namespace CLHEP;
5 using namespace lcio;
6 
7 namespace sistrip {
8 
9 //
10 // Constructor
11 //
12 SimTrackerDigiHit::SimTrackerDigiHit()
13 {
14  _cellID0 = 0.;
15  _EDep = 0.;
16  _time = 0.;
17  _particle = 0;
18  _pathLength = 0.;
19 
20  _pos[0] = 0.;
21  _pos[1] = 0.;
22  _pos[2] = 0.;
23 
24  _p[0] = 0.;
25  _p[1] = 0.;
26  _p[2] = 0.;
27 
28  _prePosition.setX(0);
29  _prePosition.setY(0);
30  _prePosition.setZ(0);
31 
32  _posPosition.setX(0);
33  _posPosition.setY(0);
34  _posPosition.setZ(0);
35 }
36 
37 //
38 // Destructor
39 //
40 SimTrackerDigiHit::~SimTrackerDigiHit()
41 {
42 // std::cout << "Deleting SimTrackerDigiHit" << std::endl;
43 }
44 
45 
46 //
47 // Set preStep position of a hit - DEPRECATED method
48 //
49 void SimTrackerDigiHit::setPosition( double pos[3])
50 {
51  setPrePosition(pos[0], pos[1], pos[2]);
52 }
53 
54 //
55 // Set preStep position of a hit
56 //
57 void SimTrackerDigiHit::setPrePosition( double pos[3], float momentum[3], float pathLength)
58 {
59  Hep3Vector direction(momentum[0], momentum[1], momentum[2]);
60  direction = direction.unit();
61  direction *= pathLength/2.;
62 
63  _prePosition.setX( pos[0] - direction.getX() );
64  _prePosition.setY( pos[1] - direction.getY() );
65  _prePosition.setZ( pos[2] - direction.getZ() );
66 }
67 
68 //
69 // Set preStep position of a hit
70 //
71 void SimTrackerDigiHit::setPrePosition( double preX, double preY, double preZ)
72 {
73  _pos[0] = preX;
74  _pos[1] = preY;
75  _pos[2] = preZ;
76 
77  _prePosition.setX(preX);
78  _prePosition.setY(preY);
79  _prePosition.setZ(preZ);
80 
81 }
82 
83 //
84 // Set preStep Three vector
85 //
86 void SimTrackerDigiHit::set3PrePosition( const Hep3Vector & prePosition)
87 {
88  _pos[0] = prePosition.getX();
89  _pos[1] = prePosition.getY();
90  _pos[2] = prePosition.getZ();
91 
92  _prePosition = prePosition;
93 }
94 
95 //
96 // Set posStep position of a hit
97 //
98 void SimTrackerDigiHit::setPosPosition( double pos[3], float momentum[3], float pathLength)
99 {
100  Hep3Vector direction(momentum[0], momentum[1], momentum[2]);
101  direction = direction.unit();
102  direction *= pathLength/2.;
103 
104  _posPosition.setX( pos[0] + direction.getX() );
105  _posPosition.setY( pos[1] + direction.getY() );
106  _posPosition.setZ( pos[2] + direction.getZ() );
107 }
108 
109 //
110 // Set posStep position of a hit
111 //
112 void SimTrackerDigiHit::setPosPosition( double posX, double posY, double posZ)
113 {
114  _posPosition.setX(posX);
115  _posPosition.setY(posY);
116  _posPosition.setZ(posZ);
117 }
118 
119 //
120 // Set posStep position of a hit
121 //
122 void SimTrackerDigiHit::set3PosPosition( const Hep3Vector & posPosition)
123 {
124  _posPosition = posPosition;
125 }
126 
127 //
128 // Set particle momentum at preStep position
129 //
130 void SimTrackerDigiHit::setMomentum( float p[3])
131 {
132  _p[0] = p[0];
133  _p[1] = p[1];
134  _p[2] = p[2];
135 
136  _momentum.setX(p[0]);
137  _momentum.setY(p[1]);
138  _momentum.setZ(p[2]);
139 }
140 
141 //
142 // Set particle momentum at preStep position
143 //
144 void SimTrackerDigiHit::setMomentum( float pX, float pY, float pZ)
145 {
146  _p[0] = pX;
147  _p[1] = pY;
148  _p[2] = pZ;
149 
150  _momentum.setX(pX);
151  _momentum.setY(pY);
152  _momentum.setZ(pZ);
153 }
154 
155 //
156 // Set particle Three momentum
157 //
158 void SimTrackerDigiHit::set3Momentum( const Hep3Vector & momentum)
159 {
160  _p[0] = momentum.getX();
161  _p[1] = momentum.getY();
162  _p[2] = momentum.getZ();
163 
164  _momentum = momentum;
165 }
166 
167 //
168 // Get step size
169 //
170 double SimTrackerDigiHit::getStepSize() const
171 {
172  Hep3Vector step = _posPosition - _prePosition;
173 
174  return step.mag();
175 }
176 
177 } // Namespace
178 
179