1 package org.lcsim.recon.tracking.trfzp;
2
3 import org.lcsim.recon.tracking.trfutil.Assert;
4
5 import org.lcsim.recon.tracking.trfbase.Hit;
6 import org.lcsim.recon.tracking.trfbase.HitVector;
7 import org.lcsim.recon.tracking.trfbase.HitError;
8 import org.lcsim.recon.tracking.trfbase.HitDerivative;
9 import org.lcsim.recon.tracking.trfbase.ETrack;
10
11
12
13
14
15
16
17
18
19
20
21
22
23 public class HitZPlane1 extends Hit
24 {
25
26
27
28
29
30
31
32
33
34
35
36
37 public static String typeName()
38 { return "HitZPlane1";
39 }
40
41
42
43
44
45
46
47
48
49 public static String staticType()
50 { return typeName();
51 }
52
53
54
55 private double _axy_pre;
56
57
58 private double _eaxy_pre;
59
60
61
62
63
64
65
66
67
68 protected boolean equal( Hit hit)
69 {
70 Assert.assertTrue( type().equals(hit.type()) );
71 return cluster().equals(hit.cluster());
72 }
73
74
75 HitZPlane1(double axy, double eaxy)
76 {
77 _axy_pre = axy;
78 _eaxy_pre = eaxy;
79 }
80
81
82
83
84
85
86
87
88 public HitZPlane1( HitZPlane1 hit)
89 {
90 super(hit);
91 _axy_pre = hit._axy_pre;
92 _eaxy_pre = hit._eaxy_pre;
93 }
94
95
96
97
98
99
100
101
102
103 public String type()
104 { return staticType();
105 }
106
107
108
109
110
111
112
113
114
115
116 public int size()
117 { return 1;
118 }
119
120
121
122
123
124
125
126
127 public HitVector measuredVector()
128 {
129 return new HitVector( fullCluster().aXY() );
130 }
131
132
133
134
135
136
137
138
139 public HitError measuredError()
140 {
141 double daxy = fullCluster().daXY();
142 return new HitError( daxy*daxy );
143 }
144
145
146
147
148
149
150
151
152 public HitVector predictedVector()
153 {
154 return new HitVector( _axy_pre );
155 }
156
157
158
159
160
161
162
163
164 public HitError predictedError()
165 {
166 return new HitError( _eaxy_pre );
167 }
168
169
170
171
172
173
174
175
176 public HitDerivative dHitdTrack()
177 {
178 double values[] =
179 { 0.0, 0.0, 0.0, 0.0, 0.0 };
180 values[0] = fullCluster().wX();
181 values[1] = fullCluster().wY();
182 HitDerivative deriv = new HitDerivative(1,values);
183 return deriv;
184 }
185
186
187
188
189
190
191
192
193 public HitVector differenceVector()
194 {
195 return new HitVector( _axy_pre-fullCluster().aXY() );
196 }
197
198
199
200
201
202
203
204
205 public void update( ETrack tre)
206 {
207
208 double x_track = tre.vector().get(SurfZPlane.IX);
209 double y_track = tre.vector().get(SurfZPlane.IY);
210 double exx_track = tre.error().get(SurfZPlane.IX,SurfZPlane.IX);
211 double exy_track = tre.error().get(SurfZPlane.IX,SurfZPlane.IY);
212 double eyy_track = tre.error().get(SurfZPlane.IY,SurfZPlane.IY);
213
214 double cl_wx = fullCluster().wX();
215 double cl_wy = fullCluster().wY();
216
217 _axy_pre = cl_wx*x_track + cl_wy*y_track;
218 _eaxy_pre = exx_track*cl_wx*cl_wx +
219 2.*exy_track*cl_wx*cl_wy +
220 eyy_track*cl_wy*cl_wy;
221 }
222
223
224
225
226
227
228
229
230 public ClusZPlane1 fullCluster()
231 {
232 return (ClusZPlane1) _pclus;
233 }
234
235
236
237
238
239
240
241 public String toString()
242 {
243 if( _pclus != null )
244 {
245 return "HitZPlane1 from " + _pclus;
246 }
247 else
248 {
249 return "HitZPlane1 with no parent clusters";
250 }
251 }
252 }