1 /* 2 * InteractingLayer_Test.java 3 * 4 * Created on July 24, 2007, 4:30 PM 5 * 6 * $Id: InteractingLayer_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.Interactor; 14 import org.lcsim.recon.tracking.trfbase.InteractorTest; 15 import org.lcsim.recon.tracking.trfbase.PropDirectedTest; 16 import org.lcsim.recon.tracking.trfbase.SurfTest; 17 import org.lcsim.recon.tracking.trfbase.TrackError; 18 import org.lcsim.recon.tracking.trfbase.TrackVector; 19 import org.lcsim.recon.tracking.trfutil.Assert; 20 21 /** 22 * 23 * @author Norman Graf 24 */ 25 public class InteractingLayer_Test extends TestCase 26 { 27 private boolean debug; 28 /** Creates a new instance of InteractingLayer_Test */ 29 public void testInteractingLayer() 30 { 31 String component = "InteractingLayer"; 32 String ok_prefix = component + " (I): "; 33 String error_prefix = component + " test (E): "; 34 35 if(debug) System.out.println( ok_prefix 36 + "---------- Testing component " + component 37 + ". ----------" ); 38 39 //******************************************************************** 40 41 if(debug) System.out.println( ok_prefix + "Test constructor." ); 42 Layer ltest1 = new LayerTest(10.,3); 43 Layer ltest2 = new LayerTest(20.); 44 Interactor inter = new InteractorTest(1.0); 45 InteractingLayer intltest1= new InteractingLayer( ltest1, inter ); 46 InteractingLayer intltest2= new InteractingLayer( ltest2, inter ); 47 if(debug) System.out.println( intltest1 ); 48 if(debug) System.out.println( intltest1.type() ); 49 if(debug) System.out.println( intltest2.type() ); 50 Assert.assertTrue( intltest1.type().equals(intltest2.type()) ); 51 Assert.assertTrue( intltest1.hasClusters() ); 52 Assert.assertTrue( intltest1.clusters().size() == 0 ); 53 Assert.assertTrue( intltest1.layer().equals(ltest1) ); 54 Assert.assertTrue( intltest1.interactor().equals(inter) ); 55 56 //******************************************************************** 57 58 //******************************************************************** 59 60 if(debug) System.out.println( ok_prefix + "Construct propagator and track." ); 61 PropDirectedTest prop = new PropDirectedTest(); 62 if(debug) System.out.println( prop ); 63 SurfTest stest = new SurfTest(2); 64 TrackVector vec = new TrackVector(); 65 TrackError err = new TrackError(); 66 err.set(0,0, 1.0); 67 ETrack tre = new ETrack(stest.newPureSurface(), vec, err ); 68 ETrack tre0 = new ETrack(tre); 69 if(debug) System.out.println( tre ); 70 71 // if(debug) System.out.println( ok_prefix + "Test interaction" ); 72 // intltest1.propagate(tre, prop); 73 // if(debug) System.out.println( tre ); 74 75 76 //******************************************************************** 77 78 79 if(debug) System.out.println( ok_prefix 80 + "------------- All tests passed. -------------" ); 81 82 83 //******************************************************************** 84 } 85 86 }