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.SimInteractor;
13 import org.lcsim.recon.tracking.trfbase.TrackVector;
14 import org.lcsim.recon.tracking.trfbase.VTrack;
15 import org.lcsim.recon.tracking.trfutil.Assert;
16
17
18
19
20
21 public class ThinCylMsSim_Test extends TestCase
22 {
23 private boolean debug;
24
25 public void testThinCylMsSim()
26 {
27 String component = "ThinCylMsSim";
28 String ok_prefix = component + " (I): ";
29 String error_prefix = component + " test (E): ";
30
31 if(debug) System.out.println( ok_prefix
32 + "---------- Testing component " + component
33 + ". ----------" );
34 if(debug) System.out.println( ok_prefix + "Test constructor." );
35 ThinCylMsSim scatterIt = new ThinCylMsSim(0.001);
36 if(debug) System.out.println(scatterIt);
37
38 Assert.assertTrue(scatterIt.radLength() == 0.001);
39
40 SurfCylinder cyl = new SurfCylinder(20.);
41 double[] pars = {1., 2., 3., 4., 5. };
42 TrackVector tv = new TrackVector(pars);
43 VTrack vtrk = new VTrack(cyl, tv);
44
45 if(debug) System.out.println("\n Original VTrack: "+vtrk);
46 TrackVector trv = new TrackVector( vtrk.vector() );
47 trv.set(SurfCylinder.IQPT,1.0);
48 vtrk.setVector( trv );
49 if(debug) System.out.println("\n Modified VTrack: "+vtrk);
50 scatterIt.interact( vtrk );
51 if(debug) System.out.println("\n Interacted VTrack: "+vtrk);
52 if(debug) System.out.println("\n Original TrackVector trv: "+trv);
53 TrackVector scattered = new TrackVector( vtrk.vector() );
54 Assert.assertTrue( scattered.get(SurfCylinder.IPHI) == trv.get(SurfCylinder.IPHI) );
55 Assert.assertTrue( scattered.get(SurfCylinder.IZ) == trv.get(SurfCylinder.IZ) );
56 Assert.assertTrue( scattered.get(SurfCylinder.IALF) != trv.get(SurfCylinder.IALF) );
57 Assert.assertTrue( scattered.get(SurfCylinder.ITLM) != trv.get(SurfCylinder.ITLM) );
58 Assert.assertTrue( scattered.get(SurfCylinder.IQPT) != trv.get(SurfCylinder.IQPT) );
59 if(debug) System.out.println( "before interaction " + trv );
60 if(debug) System.out.println( "after interaction " + scattered );
61
62
63 TrackVector tvec = new TrackVector();
64 tvec.set(SurfCylinder.IPHI,1.0);
65 tvec.set(SurfCylinder.IZ, 2.0);
66 tvec.set(SurfCylinder.IALF,3.0);
67 tvec.set(SurfCylinder.ITLM,4.0);
68 tvec.set(SurfCylinder.IQPT,5.0);
69 SurfCylinder scyl = new SurfCylinder(6.0);
70 VTrack t = new VTrack(scyl.newPureSurface(),tvec);
71 if(debug) System.out.println( "Track before interacting... " + t );
72 scatterIt.interact( t );
73 if(debug) System.out.println( "Track after interacting... " + t );
74
75
76
77 tvec.set(SurfCylinder.IPHI,7.25001);
78 tvec.set(SurfCylinder.IZ,83.571);
79 tvec.set(SurfCylinder.IALF,0.0220818);
80 tvec.set(SurfCylinder.ITLM,0.586898);
81 tvec.set(SurfCylinder.IQPT,-0.0116488);
82
83
84 SurfCylinder scyl2 = new SurfCylinder(35.0);
85 VTrack t2 = new VTrack(scyl2.newPureSurface(),tvec);
86 if(debug) System.out.println( "Track before interacting... " + t2 );
87 scatterIt.interact( t2 );
88 if(debug) System.out.println( "Track after interacting... " + t2 );
89
90 /
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126