1 /* 2 * LayerStat_Test.java 3 * 4 * Created on July 24, 2007, 4:22 PM 5 * 6 * $Id: LayerStat_Test.java,v 1.1.1.1 2010/04/08 20:38:00 jeremy Exp $ 7 */ 8 9 package org.lcsim.recon.tracking.trflayer; 10 11 import junit.framework.TestCase; 12 import org.lcsim.recon.tracking.trfbase.ETrack; 13 import org.lcsim.recon.tracking.trfbase.MissTest; 14 import org.lcsim.recon.tracking.trfbase.Surface; 15 import org.lcsim.recon.tracking.trfutil.Assert; 16 17 /** 18 * 19 * @author Norman Graf 20 */ 21 public class LayerStat_Test extends TestCase 22 { 23 private boolean debug; 24 /** Creates a new instance of LayerStat_Test */ 25 public void testLayerStat() 26 { 27 String component = "LayerStat"; 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 35 36 //******************************************************************** 37 38 if(debug) System.out.println( ok_prefix + "Construct and fill status." ); 39 MissTest miss = new MissTest(2.0,0.4); 40 ClusterFinderTest find = new ClusterFinderTest(2.0); 41 Surface srf = find.surface(); 42 ETrack tre = new ETrack(srf.newPureSurface() ); 43 TLayer lyr = new TLayer(true,true,miss,find,5); 44 LayerStat lstat = lyr.propagate(); 45 if(debug) System.out.println( lstat ); 46 lyr.check(lstat); 47 Assert.assertTrue( lstat.atExit() ); 48 Assert.assertTrue( lstat.hasClusters() ); 49 Assert.assertTrue( lstat.clusters().size() == 0 ); 50 Assert.assertTrue( lstat.clusters(tre).size() == 0 ); 51 Assert.assertTrue( lstat.miss().likelihood() == 0.4 ); 52 Assert.assertTrue( lstat.layer() == lyr ); 53 54 //******************************************************************** 55 56 if(debug) System.out.println( ok_prefix + "Test copy." ); 57 LayerStat lstat2 = new LayerStat(lstat); 58 if(debug) System.out.println( lstat2 ); 59 Assert.assertTrue( lstat2.atExit() ); 60 Assert.assertTrue( lstat2.hasClusters() ); 61 Assert.assertTrue( lstat2.clusters().size() == 0 ); 62 Assert.assertTrue( lstat2.clusters(tre).size() == 0 ); 63 Assert.assertTrue( lstat2.miss().likelihood() == 0.4 ); 64 Assert.assertTrue( lstat2.layer() == lyr ); 65 lyr.check(lstat2); 66 67 //******************************************************************** 68 69 if(debug) System.out.println( ok_prefix 70 + "------------- All tests passed. -------------" ); 71 72 //******************************************************************** 73 } 74 75 }