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