1 package org.lcsim.recon.tracking.trfcyl;
2
3
4 import org.lcsim.recon.tracking.trfutil.TRFMath;
5 import org.lcsim.recon.tracking.trfutil.Assert;
6
7 import org.lcsim.recon.tracking.trfbase.TrackDerivative;
8 import org.lcsim.recon.tracking.trfbase.TrackVector;
9 import org.lcsim.recon.tracking.trfbase.Propagator;
10 import org.lcsim.recon.tracking.trfbase.PropDirected;
11 import org.lcsim.recon.tracking.trfbase.PropDir;
12 import org.lcsim.recon.tracking.trfbase.PropStat;
13 import org.lcsim.recon.tracking.trfbase.Surface;
14 import org.lcsim.recon.tracking.trfbase.VTrack;
15 import org.lcsim.recon.tracking.trfbase.ETrack;
16
17
18
19
20
21
22
23
24
25
26
27
28
29 public class PropJoinCyl extends PropDirected
30 {
31
32
33
34
35
36
37
38
39
40
41
42 public static String typeName()
43 { return "PropJoinCyl";
44 }
45
46
47
48
49
50
51
52
53
54 public static String staticType()
55 { return typeName();
56 }
57
58
59
60
61 private double _rmin;
62 private double _rfac;
63
64
65 private Propagator _prop1;
66 private Propagator _prop2;
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81 public PropJoinCyl(double rmin, double rfac, Propagator prop1,
82 Propagator prop2)
83 {
84 _rmin = rmin;
85 _rfac = rfac;
86 _prop1 = prop1.newPropagator();
87 _prop2 = prop2.newPropagator();
88 }
89
90
91
92
93
94
95
96
97 public Propagator newPropagator( )
98 {
99 return new PropJoinCyl(_rmin, _rfac, _prop1.newPropagator(), _prop2.newPropagator());
100 }
101
102
103
104
105
106
107
108
109
110 public String type()
111 { return staticType();
112 }
113
114
115
116
117
118
119
120
121 public double minRadius()
122 { return _rmin;
123 }
124
125
126
127
128
129
130 public double maxRadius()
131 { return _rfac;
132 }
133
134
135
136
137
138
139 public Propagator prop1()
140 { return _prop1.newPropagator();
141 }
142
143
144
145
146
147
148 public Propagator prop2()
149 { return _prop2.newPropagator();
150 }
151
152
153
154
155
156
157
158
159
160
161
162 public PropStat vecDirProp(VTrack trv, Surface srf, PropDir dir)
163 {
164 TrackDerivative der = null;
165 return vecDirProp(trv,srf,dir,der);
166 }
167
168
169
170
171
172
173
174
175
176
177
178
179
180 public PropStat vecDirProp(VTrack trv, Surface srf,
181 PropDir dir, TrackDerivative der )
182 {
183
184 TrackDerivative tmpder1 = null;
185 TrackDerivative tmpder2 = null;
186 if (der != null)
187 {
188 tmpder1 = new TrackDerivative();
189 tmpder2 = new TrackDerivative();
190 }
191
192
193
194 double r = _rfac*trv.spacePoint().rxy();
195 if ( r < _rmin ) r = _rmin;
196 PropStat pstat = _prop1.vecDirProp(trv, new SurfCylinder(r),
197 PropDir.NEAREST, tmpder1);
198 if ( ! pstat.success() )
199 {
200 return pstat;
201 }
202
203
204 pstat = _prop2.vecDirProp(trv, srf, dir, tmpder2);
205 if ( ! pstat.success() )
206 {
207 return pstat;
208 }
209
210
211 if ( der != null )
212 {
213 der = new TrackDerivative( tmpder2.times(tmpder1) );
214 }
215
216
217 return pstat;
218
219 }
220
221
222
223
224
225
226
227
228
229
230 public PropStat errDirProp(ETrack trv, Surface srf,
231 PropDir dir)
232 {
233 TrackDerivative der = null;
234 return errDirProp(trv,srf,dir,der);
235 }
236
237
238
239
240
241
242
243
244
245
246
247
248 public PropStat errDirProp(ETrack trv, Surface srf,
249 PropDir dir, TrackDerivative der)
250 {
251 TrackDerivative tmpder1 = null;
252 TrackDerivative tmpder2 = null;
253 if (der != null)
254 {
255
256 tmpder1 = new TrackDerivative();
257 tmpder2 = new TrackDerivative();
258 }
259
260
261 double r = _rfac*trv.spacePoint().rxy();
262
263 if ( r < _rmin ) r = _rmin;
264 PropStat pstat = _prop1.errDirProp(trv, new SurfCylinder(r),
265 PropDir.NEAREST, tmpder1 );
266 if ( ! pstat.success() )
267 {
268 return pstat;
269 }
270
271
272 pstat = _prop2.errDirProp(trv, srf, dir, tmpder2);
273 if ( ! pstat.success() )
274 {
275 return pstat;
276 }
277
278 if ( der != null )
279 {
280 der = new TrackDerivative( tmpder2.times(tmpder1) );
281 }
282
283 return pstat;
284
285 }
286
287
288
289
290
291
292
293
294 public String toString()
295 {
296 StringBuffer sb = new StringBuffer("Propagator using intermediate cylinder.\n");
297 sb.append("rmin = " + _rmin + "; rfac = " + _rfac + "\n");
298 sb.append("First propagator: " + _prop1 + "\n");
299 sb.append("Second propagator: " + _prop2 + "\n");
300 return sb.toString();
301 }
302 }