View Javadoc

1   /*
2    * Miss_Test.java
3    *
4    * Created on July 24, 2007, 12:12 PM
5    *
6    * $Id: Miss_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 Miss_Test extends TestCase
19  {
20      private boolean debug;
21      /** Creates a new instance of Miss_Test */
22      public void testMiss()
23      {
24           String component = "Miss";
25          String ok_prefix = component + " (I): ";
26          String error_prefix = component + " test (E): ";
27          
28          if(debug) System.out.println(ok_prefix
29                  + "---------- Testing component " + component
30                  + ". ----------" );
31          
32          //********************************************************************
33          
34          if(debug) System.out.println(ok_prefix + "Test constructor." );
35          MissTest miss = new MissTest(1,0.5);
36          if(debug) System.out.println(miss );
37          
38          //********************************************************************
39          
40          if(debug) System.out.println(ok_prefix + "Test cloning." );
41          Miss miss2 = miss.newCopy();
42          if(debug) System.out.println(miss2 );
43          
44          //********************************************************************
45          
46          if(debug) System.out.println(ok_prefix + "Test access." );
47          SurfTest srf = new SurfTest(1);
48          Assert.assertTrue( miss2.surface().pureEqual(srf) );
49          Assert.assertTrue( miss2.likelihood() == 0.5 );
50          
51          //********************************************************************
52          
53          if(debug) System.out.println(ok_prefix + "Test update." );
54          ETrack tre = new ETrack( srf.newPureSurface() );
55          miss2.update(tre);
56          Assert.assertTrue( miss.likelihood() == 0.5 );
57          Assert.assertTrue( miss2.likelihood() == 0.5*0.9 );
58          
59          //********************************************************************
60          
61          if(debug) System.out.println(ok_prefix
62                  + "------------- All tests passed. -------------" );
63          
64          //********************************************************************       
65      }
66      
67  }