1 package org.lcsim.recon.tracking.trfzp;
2
3
4 import org.lcsim.recon.tracking.trfutil.Assert;
5
6 import org.lcsim.recon.tracking.trfbase.Hit;
7 import org.lcsim.recon.tracking.trfbase.HitVector;
8 import org.lcsim.recon.tracking.trfbase.HitError;
9 import org.lcsim.recon.tracking.trfbase.HitDerivative;
10 import org.lcsim.recon.tracking.trfbase.ETrack;
11 import org.lcsim.recon.tracking.trfbase.TrackVector;
12 import org.lcsim.recon.tracking.trfbase.TrackError;
13
14
15
16
17
18
19
20
21
22
23
24
25
26 public class HitZPlane2 extends Hit
27 {
28
29
30
31
32
33 static double values[] =
34 { 1.0, 0.0, 0.0, 0.0, 0.0,
35 0.0, 1.0, 0.0, 0.0, 0.0 };
36 static HitDerivative _deriv = new HitDerivative(2,values);
37
38
39
40
41
42
43
44
45
46 public static String typeName()
47 { return "HitZPlane2"; }
48
49
50
51
52
53
54
55
56
57 public static String staticType()
58 { return typeName(); }
59
60
61
62 private double _x;
63 private double _y;
64
65
66 private double _dx2;
67 private double _dy2;
68 private double _dxdy;
69
70
71
72
73 protected boolean equal( Hit hit)
74 {
75 Assert.assertTrue( type().equals(hit.type()) );
76 return cluster().equals(hit.cluster());
77 }
78
79
80 HitZPlane2(double x, double y, double dx2, double dy2, double dxdy)
81 {
82 _x = x;
83 _y = y;
84 _dx2 = dx2;
85 _dy2 = dy2;
86 _dxdy = dxdy;
87 }
88
89
90
91
92
93
94
95
96 public HitZPlane2( HitZPlane2 hit)
97 {
98 super(hit);
99 _x = hit._x;
100 _y = hit._y;
101 _dx2 = hit._dx2;
102 _dy2 = hit._dy2;
103 _dxdy = hit._dxdy;
104 }
105
106
107
108
109
110
111
112
113
114 public String type()
115 { return staticType(); }
116
117
118
119
120
121
122
123
124
125 public int size()
126 { return 2; }
127
128
129
130
131
132
133
134
135 public HitVector measuredVector()
136 {
137 ClusZPlane2 clu = fullCluster();
138 return new HitVector( clu.x(), clu.y() );
139 }
140
141
142
143
144
145
146
147
148 public HitError measuredError()
149 {
150 ClusZPlane2 clu = fullCluster();
151 return new HitError(clu.dX2(),clu.dXdY(), clu.dY2() );
152 }
153
154
155
156
157
158
159
160
161 public HitVector predictedVector()
162 {
163 return new HitVector( _x , _y );
164 }
165
166
167
168
169
170
171
172
173 public HitError predictedError()
174 {
175 return new HitError( _dx2,_dxdy, _dy2 );
176 }
177
178
179
180
181
182
183
184
185 public HitDerivative dHitdTrack()
186 {
187 return _deriv;
188 }
189
190
191
192
193
194
195
196
197 public HitVector differenceVector()
198 {
199
200 ClusZPlane2 clu = fullCluster();
201
202 double diff_x = _x - clu.x();
203 double diff_y = _y - clu.y();
204 return new HitVector( diff_x, diff_y );
205 }
206
207
208
209
210
211
212
213
214 public void update( ETrack tre)
215 {
216
217 TrackVector vec = tre.vector();
218
219 _x = vec.get(SurfZPlane.IX);
220 _y = vec.get(SurfZPlane.IY);
221
222 TrackError err = tre.error() ;
223
224 _dx2 = err.get(SurfZPlane.IX,SurfZPlane.IX);
225 _dxdy = err.get(SurfZPlane.IX,SurfZPlane.IY);
226 _dy2 = err.get(SurfZPlane.IY,SurfZPlane.IY);
227 }
228
229
230
231
232
233
234
235 public double x()
236 { return _x; }
237
238
239
240
241
242
243 public double y()
244 { return _y; }
245
246
247
248
249
250
251 public double dX2()
252 { return _dx2; }
253
254
255
256
257
258
259 public double dY2()
260 { return _dy2; }
261
262
263
264
265
266
267 public double dXdY()
268 { return _dxdy; }
269
270
271
272
273
274
275
276
277 public ClusZPlane2 fullCluster()
278 { return ( ClusZPlane2) _pclus; }
279
280
281
282
283
284
285
286 public String toString()
287 {
288 if( _pclus != null )
289 {
290 return "HitZPlane2 from " + _pclus;
291 }
292 else
293 {
294 return "HitZPlane2 with no parent clusters";
295 }
296 }
297
298 }