View Javadoc

1   /*
2    * PropNull_Test.java
3    *
4    * Created on July 24, 2007, 12:04 PM
5    *
6    * $Id: PropNull_Test.java,v 1.1.1.1 2010/04/08 20:38:00 jeremy Exp $
7    */
8   
9   package org.lcsim.recon.tracking.trfbase;
10  
11  import junit.framework.TestCase;
12  import org.lcsim.recon.tracking.trfutil.Assert;
13  
14  /**
15   *
16   * @author Norman Graf
17   */
18  public class PropNull_Test extends TestCase
19  {
20      private boolean debug;
21      /** Creates a new instance of PropNull_Test */
22      public void testPropNull()
23      {
24          String ok_prefix = "PropNull test (I): ";
25          String error_prefix = "PropNull test (E): ";
26          
27          if(debug) System.out.println( ok_prefix
28                  + "------- Testing component PropNull  -----------" );
29          
30          
31          //********************************************************************
32          
33          if(debug) System.out.println( ok_prefix + "Construct propagator."  );
34          PropNull prop = new PropNull();
35          if(debug) System.out.println( prop );
36          
37          //********************************************************************
38          
39          if(debug) System.out.println( ok_prefix + "Construct surfaces and tracks."  );
40          Surface srf1 = new SurfTest(1);
41          Surface srf2 = new SurfTest(2);
42          Surface bsrf1 = new BSurfTest(1,2);
43          VTrack trv1 = new VTrack( new SurfTest(1) );
44          VTrack trv2 = new VTrack(srf2);
45          ETrack tre1 = new ETrack(srf1);
46          ETrack tre2 = new ETrack(srf2);
47          
48          //********************************************************************
49          
50          if(debug) System.out.println( ok_prefix + "Propagate to same surface."  );
51          PropStat pstat = new PropStat();
52          pstat = prop.vecProp(trv1,srf1);
53          if(debug) System.out.println( pstat );
54          Assert.assertTrue( pstat.success() );
55          pstat = prop.vecDirProp(trv1, srf1,PropDir.FORWARD);
56          if(debug) System.out.println( pstat );
57          Assert.assertTrue( pstat.success() );
58          pstat = prop.errProp(tre1,srf1);
59          if(debug) System.out.println( pstat );
60          Assert.assertTrue( pstat.success() );
61          pstat = prop.errDirProp(tre1,srf1,PropDir.FORWARD);
62          if(debug) System.out.println( pstat );
63          Assert.assertTrue( pstat.success() );
64          
65          //********************************************************************
66          
67          if(debug) System.out.println( ok_prefix + "Propagate to same bounded surface."  );
68          pstat = prop.vecProp(trv1,bsrf1);
69          if(debug) System.out.println( pstat );
70          Assert.assertTrue( pstat.success() );
71          pstat = prop.vecDirProp(trv1,bsrf1,PropDir.FORWARD);
72          if(debug) System.out.println( pstat );
73          Assert.assertTrue( pstat.success() );
74          pstat = prop.errProp(tre1,bsrf1);
75          if(debug) System.out.println( pstat );
76          Assert.assertTrue( pstat.success() );
77          pstat = prop.errDirProp(tre1,bsrf1,PropDir.FORWARD);
78          if(debug) System.out.println( pstat );
79          Assert.assertTrue( pstat.success() );
80          
81          //********************************************************************
82          
83          if(debug) System.out.println( ok_prefix + "Propagate to different surface."  );
84          pstat = prop.vecProp(trv1,srf2);
85          if(debug) System.out.println( pstat );
86          Assert.assertTrue( ! pstat.success() );
87          pstat = prop.vecDirProp(trv1,srf2,PropDir.FORWARD);
88          if(debug) System.out.println( pstat );
89          Assert.assertTrue( ! pstat.success() );
90          pstat = prop.errProp(tre1,srf2);
91          if(debug) System.out.println( pstat );
92          Assert.assertTrue( ! pstat.success() );
93          pstat = prop.errDirProp(tre1,srf2,PropDir.FORWARD);
94          if(debug) System.out.println( pstat );
95          Assert.assertTrue( ! pstat.success() );
96          
97          
98          //********************************************************************
99          
100         if(debug) System.out.println( ok_prefix
101                 + "------------- All tests passed. -------------" );
102         
103         //********************************************************************        
104     }
105     
106 }