1
2
3
4
5
6
7
8
9 package org.lcsim.recon.tracking.trfcyl;
10
11 import junit.framework.TestCase;
12 import org.lcsim.recon.tracking.trfbase.ETrack;
13 import org.lcsim.recon.tracking.trfbase.Interactor;
14 import org.lcsim.recon.tracking.trfbase.Surface;
15 import org.lcsim.recon.tracking.trfbase.TrackError;
16 import org.lcsim.recon.tracking.trfbase.TrackVector;
17 import org.lcsim.recon.tracking.trfutil.Assert;
18
19
20
21
22
23 public class ThinCylMs_Test extends TestCase
24 {
25 private boolean debug;
26
27 public void testThinCylMs()
28 {
29 String component = "ThinCylMs";
30 String ok_prefix = component + " (I): ";
31 String error_prefix = component + " test (E): ";
32
33 if(debug) System.out.println( ok_prefix
34 + "---------- Testing component " + component
35 + ". ----------" );
36 if(debug) System.out.println( ok_prefix + "Test constructor." );
37 ThinCylMs scatterIt = new ThinCylMs(1.0);
38
39 TrackError initialError = new TrackError();
40 initialError.set(2,2 , 0.0);
41 initialError.set(3,3 , 0.0);
42 initialError.set(4,4 , 0.0);
43 initialError.set(4,3 , 0.0);
44 initialError.set(3,4 , 0.0);
45
46 TrackVector trv = new TrackVector();
47 trv.set(0 , 1.0);
48 trv.set(1 , 1.0);
49 trv.set(2 , 1.0);
50 trv.set(3 , 1.0);
51 trv.set(4 , 1.0);
52
53 Surface srf = new SurfCylinder( 20.0 );
54
55 ETrack tmpTrack = new ETrack( srf, trv, initialError );
56
57 tmpTrack.setError( initialError );
58 scatterIt.interact( tmpTrack );
59
60 TrackError finalError = tmpTrack.error();
61 double trueLength = 1.0/Math.cos(1.0)*Math.sqrt(1.0 + 1.0);
62 double thetaSqr = (0.0136)*(1.0/Math.cos(Math.atan(1.0)))*Math.sqrt(trueLength)*
63 (1 + 0.038*Math.log(trueLength));
64 thetaSqr *= thetaSqr;
65
66 double alfalf = (1.0 + 1.0);
67 double tlamtlam = (alfalf*alfalf);
68 double cc = (1.0);
69 double ctlam = ((1.0)*(1.0 + 1.0));
70 double tlamc = (ctlam);
71
72 alfalf *= thetaSqr;
73 tlamtlam *= thetaSqr;
74 cc *= thetaSqr;
75 ctlam *= thetaSqr;
76 tlamc *= thetaSqr;
77
78 Assert.assertTrue(scatterIt.radLength() == 1.0);
79 Assert.assertTrue((finalError.get(2,2)-alfalf)<0.000001);
80 Assert.assertTrue((finalError.get(3,3)-tlamtlam)<0.000001);
81 Assert.assertTrue((finalError.get(4,4)-cc)<0.000001);
82 Assert.assertTrue((finalError.get(3,4)-ctlam)<0.000001);
83 Assert.assertTrue((finalError.get(4,3)-tlamc)<0.000001);
84
85 /
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109