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