Print

Print


Commit in lcsim/test/org/lcsim/recon/tracking/trflayer on MAIN
ClusterFinder_t.java+52added 1.1
LayerSimulator_t.java+57added 1.1
Detector_t.java+79added 1.1
ClusterFindManager_t.java+40added 1.1
InteractingLayer_t.java+86added 1.1
DetectorSimulator_t.java+77added 1.1
Layer_t.java+95added 1.1
LayerSimGeneric_t.java+65added 1.1
LTrack_t.java+126added 1.1
ClusterFindAll_t.java+76added 1.1
LayerStatChain_t.java+44added 1.1
LayerStat_t.java+75added 1.1
+872
12 added files
Component tests for trflayer.

lcsim/test/org/lcsim/recon/tracking/trflayer
ClusterFinder_t.java added at 1.1
diff -N ClusterFinder_t.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ClusterFinder_t.java	24 Jul 2007 23:36:42 -0000	1.1
@@ -0,0 +1,52 @@
+/*
+ * ClusterFinder_t.java
+ *
+ * Created on July 24, 2007, 4:33 PM
+ *
+ * $Id: ClusterFinder_t.java,v 1.1 2007/07/24 23:36:42 ngraf Exp $
+ */
+
+package org.lcsim.recon.tracking.trflayer;
+
+import junit.framework.TestCase;
+import org.lcsim.recon.tracking.trfbase.ETrack;
+import org.lcsim.recon.tracking.trfbase.SurfTest;
+import org.lcsim.recon.tracking.trfutil.Assert;
+
+/**
+ *
+ * @author Norman Graf
+ */
+public class ClusterFinder_t extends TestCase
+{
+    private boolean debug;
+    /** Creates a new instance of ClusterFinder_t */
+    public void testClusterFinder()
+    {
+         String component = "ClusterFinder";
+        String ok_prefix = component + " (I): ";
+        String error_prefix = component + " test (E): ";
+        
+        if(debug) System.out.println(ok_prefix
+                + "-------- Testing component " + component
+                + ". --------" );
+        
+        //********************************************************************
+        
+        if(debug) System.out.println(ok_prefix + "Test constructor." );
+        ClusterFinderTest find = new ClusterFinderTest(3.0);
+        if(debug) System.out.println(find );
+        Assert.assertTrue( find.surface().parameter(0) == 3.0 );
+        Assert.assertTrue( find.clusters().size() == 0 );
+        ETrack tre = new ETrack( new SurfTest(3.0) );
+        Assert.assertTrue( find.clusters(tre).size() == 0 );
+        
+        //********************************************************************
+        
+        if(debug) System.out.println(ok_prefix
+                + "------------- All tests passed. -------------" );
+        
+        //********************************************************************       
+    }
+    
+}

lcsim/test/org/lcsim/recon/tracking/trflayer
LayerSimulator_t.java added at 1.1
diff -N LayerSimulator_t.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ LayerSimulator_t.java	24 Jul 2007 23:36:42 -0000	1.1
@@ -0,0 +1,57 @@
+/*
+ * LayerSimulator_t.java
+ *
+ * Created on July 24, 2007, 4:26 PM
+ *
+ * $Id: LayerSimulator_t.java,v 1.1 2007/07/24 23:36:42 ngraf Exp $
+ */
+
+package org.lcsim.recon.tracking.trflayer;
+
+import junit.framework.TestCase;
+import org.lcsim.recon.tracking.trfbase.SurfTest;
+import org.lcsim.recon.tracking.trfbase.VTrack;
+import org.lcsim.recon.tracking.trfutil.Assert;
+
+/**
+ *
+ * @author Norman Graf
+ */
+public class LayerSimulator_t extends TestCase
+{
+    private boolean debug;
+    /** Creates a new instance of LayerSimulator_t */
+    public void testLayerSimulator()
+    {
+         String component = "LayerSimulator";
+        String ok_prefix = component + " (I): ";
+        String error_prefix = component + " test (E): ";
+        
+        if(debug) System.out.println( ok_prefix
+                + "---------- Testing component " + component
+                + ". ----------" );
+        
+        //********************************************************************
+        
+        
+        if(debug) System.out.println( ok_prefix + "Check constructor." );
+        Layer  lyr = new LayerTest(5.0);
+        LayerSimulatorTest lsim = new LayerSimulatorTest(lyr);
+        if(debug) System.out.println( lsim );
+        Assert.assertTrue( lyr.equals(lsim.layer()) );
+        Assert.assertTrue( lsim.generators().size() == 1 );
+        VTrack trv = new VTrack( (new SurfTest(5.0)) );
+        int mcid = 137;
+        lsim.addClusters(trv, 137);
+        lsim.dropClusters();
+        
+        //********************************************************************
+        
+        if(debug) System.out.println( ok_prefix
+                + "------------- All tests passed. -------------" );
+        
+        
+        //********************************************************************       
+    }
+    
+}

lcsim/test/org/lcsim/recon/tracking/trflayer
Detector_t.java added at 1.1
diff -N Detector_t.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Detector_t.java	24 Jul 2007 23:36:42 -0000	1.1
@@ -0,0 +1,79 @@
+/*
+ * Detector_t.java
+ *
+ * Created on July 24, 2007, 4:31 PM
+ *
+ * $Id: Detector_t.java,v 1.1 2007/07/24 23:36:42 ngraf Exp $
+ */
+
+package org.lcsim.recon.tracking.trflayer;
+
+import junit.framework.TestCase;
+import org.lcsim.recon.tracking.trfutil.Assert;
+
+/**
+ *
+ * @author Norman Graf
+ */
+public class Detector_t extends TestCase
+{
+    private boolean debug;
+    /** Creates a new instance of Detector_t */
+    public void testDetector()
+    {
+         String component = "Detector";
+        String ok_prefix = component + " (I): ";
+        String error_prefix = component + " test (E): ";
+        
+        if(debug) System.out.println(ok_prefix
+                + "---------- Testing component " + component
+                + ". ----------" );
+        
+        //********************************************************************
+        
+        if(debug) System.out.println(ok_prefix + "Test subclass constructor." );
+        double x1 = 5.0;
+        Layer lyr1 = new LayerTest(x1);
+        Detector det1 = new OneLayerDetectorTest("Layer One", lyr1);
+        if(debug) System.out.println(det1 );
+        Assert.assertTrue( det1.isOk() );
+        Assert.assertTrue( det1.layerNames().size() == 1 );
+        Assert.assertTrue( det1.layerNames().get(0) == "Layer One" );
+        Assert.assertTrue( det1.isAssigned( "Layer One" ) );
+        Assert.assertTrue( ! det1.isAssigned( "Layer 1" ) );
+        Assert.assertTrue( det1.layer("Layer One").typeName().equals(lyr1.typeName()) );
+        
+        
+        //********************************************************************
+        
+        if(debug) System.out.println(ok_prefix + "Test composite detector." );
+        double x2 = 2.0;
+        double x3 = 3.0;
+        Layer lyr2  = new LayerTest(x2);
+        Layer lyr3  = new LayerTest(x3);
+        Detector  det2  = new TwoLayerDetectorTest("layer 2", lyr2, "layer 3", lyr3);
+        if(debug) System.out.println(det2 );
+        TwoSubDetectorTest det3 = new TwoSubDetectorTest(det1,det2);
+        if(debug) System.out.println(det3 );
+        Assert.assertTrue( det3.isOk() );
+        Assert.assertTrue( det3.layerNames().size() == 3 );
+        Assert.assertTrue( det3.layerNames().get(0) == "Layer One" );
+        Assert.assertTrue( det3.layerNames().get(det3.layerNames().size()-1) == "layer 3" );
+        Assert.assertTrue( det3.isAssigned( "Layer One" ) );
+        Assert.assertTrue( det3.isAssigned( "layer 2" ) );
+        Assert.assertTrue( det3.isAssigned( "layer 3" ) );
+        Assert.assertTrue( ! det1.isAssigned( "Layer 1" ) );
+        Assert.assertTrue( det3.layer("Layer One").typeName().equals(lyr1.typeName()) );
+        Assert.assertTrue( det3.layer("layer 2").typeName().equals(lyr2.typeName()) );
+        
+        //********************************************************************
+        
+        //********************************************************************
+        
+        if(debug) System.out.println(ok_prefix
+                + "------------- All tests passed. -------------" );
+        
+        //********************************************************************       
+    }
+    
+}

lcsim/test/org/lcsim/recon/tracking/trflayer
ClusterFindManager_t.java added at 1.1
diff -N ClusterFindManager_t.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ClusterFindManager_t.java	24 Jul 2007 23:36:43 -0000	1.1
@@ -0,0 +1,40 @@
+/*
+ * ClusterFindManager_t.java
+ *
+ * Created on July 24, 2007, 4:34 PM
+ *
+ * $Id: ClusterFindManager_t.java,v 1.1 2007/07/24 23:36:43 ngraf Exp $
+ */
+
+package org.lcsim.recon.tracking.trflayer;
+
+import junit.framework.TestCase;
+
+/**
+ *
+ * @author Norman Graf
+ */
+public class ClusterFindManager_t extends TestCase
+{
+    private boolean debug;
+    /** Creates a new instance of ClusterFindManager_t */
+    public void testClusterFindManager()
+    {
+         String component = "ClusterFindManager";
+        String ok_prefix = component + " (I): ";
+        String error_prefix = component + " test (E): ";
+        
+        if(debug) System.out.println( ok_prefix
+                + "---------- Testing component " + component
+                + ". ----------" );
+        
+        //********************************************************************
+        if(debug) System.out.println( ok_prefix
+                + "No tests. abstract class");
+        if(debug) System.out.println( ok_prefix
+                + "------------- All tests passed. -------------" );
+        
+        //********************************************************************       
+    }
+    
+}

lcsim/test/org/lcsim/recon/tracking/trflayer
InteractingLayer_t.java added at 1.1
diff -N InteractingLayer_t.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ InteractingLayer_t.java	24 Jul 2007 23:36:43 -0000	1.1
@@ -0,0 +1,86 @@
+/*
+ * InteractingLayer_t.java
+ *
+ * Created on July 24, 2007, 4:30 PM
+ *
+ * $Id: InteractingLayer_t.java,v 1.1 2007/07/24 23:36:43 ngraf Exp $
+ */
+
+package org.lcsim.recon.tracking.trflayer;
+
+import junit.framework.TestCase;
+import org.lcsim.recon.tracking.trfbase.ETrack;
+import org.lcsim.recon.tracking.trfbase.Interactor;
+import org.lcsim.recon.tracking.trfbase.InteractorTest;
+import org.lcsim.recon.tracking.trfbase.PropDirectedTest;
+import org.lcsim.recon.tracking.trfbase.SurfTest;
+import org.lcsim.recon.tracking.trfbase.TrackError;
+import org.lcsim.recon.tracking.trfbase.TrackVector;
+import org.lcsim.recon.tracking.trfutil.Assert;
+
+/**
+ *
+ * @author Norman Graf
+ */
+public class InteractingLayer_t extends TestCase
+{
+    private boolean debug;
+    /** Creates a new instance of InteractingLayer_t */
+    public void testInteractingLayer()
+    {
+         String component = "InteractingLayer";
+        String ok_prefix = component + " (I): ";
+        String error_prefix = component + " test (E): ";
+        
+        if(debug) System.out.println( ok_prefix
+                + "---------- Testing component " + component
+                + ". ----------" );
+        
+        //********************************************************************
+        
+        if(debug) System.out.println( ok_prefix + "Test constructor." );
+        Layer ltest1 = new LayerTest(10.,3);
+        Layer ltest2 = new LayerTest(20.);
+        Interactor inter = new InteractorTest(1.0);
+        InteractingLayer intltest1= new InteractingLayer( ltest1, inter );
+        InteractingLayer intltest2= new InteractingLayer( ltest2, inter );
+        if(debug) System.out.println( intltest1 );
+        if(debug) System.out.println( intltest1.type() );
+        if(debug) System.out.println( intltest2.type() );
+        Assert.assertTrue( intltest1.type().equals(intltest2.type()) );
+        Assert.assertTrue( intltest1.hasClusters() );
+        Assert.assertTrue( intltest1.clusters().size() == 0 );
+        Assert.assertTrue( intltest1.layer().equals(ltest1) );
+        Assert.assertTrue( intltest1.interactor().equals(inter) );
+        
+        //********************************************************************
+        
+        //********************************************************************
+        
+        if(debug) System.out.println( ok_prefix + "Construct propagator and track." );
+        PropDirectedTest prop = new PropDirectedTest();
+        if(debug) System.out.println( prop );
+        SurfTest stest = new SurfTest(2);
+        TrackVector vec = new TrackVector();
+        TrackError err = new TrackError();
+        err.set(0,0, 1.0);
+        ETrack tre = new ETrack(stest.newPureSurface(), vec, err );
+        ETrack tre0 = new ETrack(tre);
+        if(debug) System.out.println( tre );
+        
+        //  if(debug) System.out.println( ok_prefix + "Test interaction" );
+        //  intltest1.propagate(tre, prop);
+        //  if(debug) System.out.println( tre );
+        
+        
+        //********************************************************************
+        
+        
+        if(debug) System.out.println( ok_prefix
+                + "------------- All tests passed. -------------" );
+        
+    
+    //********************************************************************       
+    }
+    
+}

lcsim/test/org/lcsim/recon/tracking/trflayer
DetectorSimulator_t.java added at 1.1
diff -N DetectorSimulator_t.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ DetectorSimulator_t.java	24 Jul 2007 23:36:43 -0000	1.1
@@ -0,0 +1,77 @@
+/*
+ * DetectorSimulator_t.java
+ *
+ * Created on July 24, 2007, 4:32 PM
+ *
+ * $Id: DetectorSimulator_t.java,v 1.1 2007/07/24 23:36:43 ngraf Exp $
+ */
+
+package org.lcsim.recon.tracking.trflayer;
+
+import junit.framework.TestCase;
+import org.lcsim.recon.tracking.trfutil.Assert;
+
+/**
+ *
+ * @author Norman Graf
+ */
+public class DetectorSimulator_t extends TestCase
+{
+    private boolean debug;
+    /** Creates a new instance of DetectorSimulator_t */
+    public void testDetectorSimulator()
+    {
+         String component = "DetectorSimulator";
+        String ok_prefix = component + " (I): ";
+        String error_prefix = component + " test (E): ";
+        
+        if(debug) System.out.println( ok_prefix
+                +"---------- Testing component " + component
+                + ". ----------" );
+        
+        //********************************************************************
+        
+        if(debug) System.out.println( ok_prefix +"Check return status." );
+        Assert.assertTrue( DetSimReturnStatus.OK != null);
+        Assert.assertTrue( DetSimReturnStatus.UNKNOWN_NAME != DetSimReturnStatus.OK );
+        Assert.assertTrue( DetSimReturnStatus.LAYER_MISMATCH != DetSimReturnStatus.OK );
+        
+        //********************************************************************
+        
+        if(debug) System.out.println( ok_prefix +"Check constructor." );
+        Layer lyr1 = new LayerTest(1.0);
+        Layer lyr2 = new LayerTest(2.0);
+        Layer lyr3 = new LayerTest(3.0);
+        LayerSimulator lsim1 = new LayerSimulatorTest(lyr1) ;
+        LayerSimulator lsim2 = new LayerSimulatorTest(lyr2) ;
+        LayerSimulator lsim3 = new LayerSimulatorTest(lyr3) ;
+        
+        Detector det12 = new TwoLayerDetectorTest("LYR1",lyr1,"LYR2",lyr2);
+        Detector det3 = new OneLayerDetectorTest("LYR3",lyr3);
+        if(debug) System.out.println( det12 );
+        if(debug) System.out.println( det3 );
+        TwoLayerDetectorSimulatorTest dsim12 = new TwoLayerDetectorSimulatorTest(det12,"LYR1",lsim1,"LYR2",lsim2);
+        OneLayerDetectorSimulatorTest dsim3 = new OneLayerDetectorSimulatorTest(det3,"LYR3",lsim3);
+        if(debug) System.out.println( dsim12 );
+        if(debug) System.out.println( dsim3 );
+        Assert.assertTrue( dsim12.generators().size() == 2 );
+        Assert.assertTrue( dsim3.generators().size() == 1 );
+        
+        //********************************************************************
+        
+        if(debug) System.out.println( ok_prefix +"Combine detector simulators." );
+        Detector det123 = new TwoSubDetectorTest(det12,det3);
+        if(debug) System.out.println( det123 );
+        TwoSubDetectorSimulatorTest dsim123 = new TwoSubDetectorSimulatorTest(det123,dsim12,dsim3);
+        Assert.assertTrue( dsim123.generators().size() == 3 );
+        if(debug) System.out.println( dsim123 );
+        
+        //********************************************************************
+        
+        if(debug) System.out.println( ok_prefix
+                +"------------- All tests passed. -------------" );
+        
+        //********************************************************************       
+    }
+    
+}

lcsim/test/org/lcsim/recon/tracking/trflayer
Layer_t.java added at 1.1
diff -N Layer_t.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Layer_t.java	24 Jul 2007 23:36:43 -0000	1.1
@@ -0,0 +1,95 @@
+/*
+ * Layer_t.java
+ *
+ * Created on July 24, 2007, 3:10 PM
+ *
+ * $Id: Layer_t.java,v 1.1 2007/07/24 23:36:43 ngraf Exp $
+ */
+
+package org.lcsim.recon.tracking.trflayer;
+
+import java.util.List;
+import junit.framework.TestCase;
+import org.lcsim.recon.tracking.trfbase.ETrack;
+import org.lcsim.recon.tracking.trfbase.SurfTest;
+import org.lcsim.recon.tracking.trfbase.TrackError;
+import org.lcsim.recon.tracking.trfbase.TrackVector;
+import org.lcsim.recon.tracking.trfutil.Assert;
+
+/**
+ *
+ * @author Norman Graf
+ */
+public class Layer_t extends TestCase
+{
+    private boolean debug;
+    /** Creates a new instance of Layer_t */
+    public void testLayer()
+    {
+                String component = "Layer";
+        String ok_prefix = component + " (I): ";
+        String error_prefix = component + " test (E): ";
+        
+        if(debug) System.out.println(ok_prefix
+                + "---------- Testing component " + component
+                + ". ----------" );
+        //********************************************************************
+        
+        if(debug) System.out.println(ok_prefix + "Test constructor." );
+        LayerTest ltest1 = new LayerTest(10.,3);
+        LayerTest ltest2 = new LayerTest(20.);
+        if(debug) System.out.println(ltest1 );
+        if(debug) System.out.println(ltest1.get_type() );
+        if(debug) System.out.println(ltest2.get_type() );
+        Assert.assertTrue( ltest1.get_type().equals(ltest2.get_type()) );
+        Assert.assertTrue( ltest1.hasClusters() );
+        Assert.assertTrue( ltest1.clusters().size() == 0 );
+        
+        //********************************************************************
+        
+        if(debug) System.out.println(ok_prefix + "Construct propagator and track." );
+        PropTest prop = new PropTest();
+        if(debug) System.out.println(prop );
+        SurfTest stest = new SurfTest(2);
+        TrackVector vec = new TrackVector();
+        TrackError err = new TrackError();
+        ETrack tre = new ETrack( stest.newPureSurface(), vec, err );
+        ETrack tre0 = new ETrack(tre);
+        if(debug) System.out.println(tre );
+        
+        //********************************************************************
+        // This needs to be changed to LTrack...
+        if(debug) System.out.println(ok_prefix + "Propagate 1." );
+        List ltracks1 = ltest1.propagate(tre,prop);
+        Assert.assertTrue( ltracks1.size() == 1 );
+        if(debug) System.out.println("ltracks1.get(0)= "+ltracks1.get(0) );
+        //  const LayerStat& lstat1 = ltracks1.front().get_status();
+        //  Assert.assertTrue( ! lstat1.at_exit() );
+        
+        //********************************************************************
+        
+        if(debug) System.out.println(ok_prefix + "Propagate 2." );
+        List ltracks2 = ltest1.propagate( ((LTrack)ltracks1.get(0)).track(),prop);
+        Assert.assertTrue( ltracks2.size() == 1 );
+        if(debug) System.out.println(ltracks2.get(0) );
+        //  const LayerStat& lstat2 = ltracks2.front().get_status();
+        //  Assert.assertTrue( ! lstat2.at_exit() );
+        
+        //********************************************************************
+        
+        if(debug) System.out.println(ok_prefix + "Propagate 3." );
+        List ltracks3 = ltest1.propagate( ((LTrack) ltracks2.get(0)).track(),prop);
+        Assert.assertTrue( ltracks3.size() == 1 );
+        if(debug) System.out.println(ltracks3.get(0) );
+        //  const LayerStat& lstat3 = ltracks3.front().get_status();
+        //  Assert.assertTrue( lstat3.at_exit() );
+        
+        
+        if(debug) System.out.println(ok_prefix
+                + "------------- All tests passed. -------------" );
+        
+        //********************************************************************
+        
+    }
+    
+}

lcsim/test/org/lcsim/recon/tracking/trflayer
LayerSimGeneric_t.java added at 1.1
diff -N LayerSimGeneric_t.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ LayerSimGeneric_t.java	24 Jul 2007 23:36:43 -0000	1.1
@@ -0,0 +1,65 @@
+/*
+ * LayerSimGeneric_t.java
+ *
+ * Created on July 24, 2007, 4:27 PM
+ *
+ * $Id: LayerSimGeneric_t.java,v 1.1 2007/07/24 23:36:43 ngraf Exp $
+ */
+
+package org.lcsim.recon.tracking.trflayer;
+
+import junit.framework.TestCase;
+import org.lcsim.recon.tracking.trfbase.HitGenerator;
+import org.lcsim.recon.tracking.trfbase.HitGeneratorTest;
+import org.lcsim.recon.tracking.trfbase.PropDirectedTest;
+import org.lcsim.recon.tracking.trfbase.Propagator;
+import org.lcsim.recon.tracking.trfbase.SurfTest;
+import org.lcsim.recon.tracking.trfbase.VTrack;
+import org.lcsim.recon.tracking.trfutil.Assert;
+
+/**
+ *
+ * @author Norman Graf
+ */
+public class LayerSimGeneric_t extends TestCase
+{
+    private boolean debug;
+    /** Creates a new instance of LayerSimGeneric_t */
+    public void testLayerSimGeneric()
+    {
+       String component = "LayerSimGeneric";
+        String ok_prefix = component + " (I): ";
+        String error_prefix = component + " test (E): ";
+        
+        if(debug) System.out.println( ok_prefix
+                + "---------- Testing component " + component
+                + ". ----------" );
+        
+        //********************************************************************
+        
+        if(debug) System.out.println( ok_prefix + "Check constructor." );
+        double spar = 5.0;
+        SurfTest srf = new SurfTest(spar);
+        HitGenerator hgen = new HitGeneratorTest(srf);
+        Layer lyr = new LayerTest(spar);
+        Propagator prop = new PropDirectedTest();
+        LayerSimGeneric lsim = new LayerSimGeneric(lyr,hgen,prop);
+        if(debug) System.out.println( lsim );
+        Layer lyr1 = lsim.layer();
+        if(debug) System.out.println( lyr );
+        Assert.assertTrue(lyr1.equals(lyr));
+        Assert.assertTrue( lsim.generators().size() == 1 );
+        VTrack trv = new VTrack( srf.newPureSurface() );
+        int mcid = 137;
+        lsim.addClusters(trv,mcid);
+        lsim.dropClusters();
+        
+        //********************************************************************
+        
+        if(debug) System.out.println( ok_prefix
+                + "------------- All tests passed. -------------" );
+        
+        //********************************************************************        
+    }
+    
+}

lcsim/test/org/lcsim/recon/tracking/trflayer
LTrack_t.java added at 1.1
diff -N LTrack_t.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ LTrack_t.java	24 Jul 2007 23:36:43 -0000	1.1
@@ -0,0 +1,126 @@
+/*
+ * LTrack_t.java
+ *
+ * Created on July 24, 2007, 4:29 PM
+ *
+ * $Id: LTrack_t.java,v 1.1 2007/07/24 23:36:43 ngraf Exp $
+ */
+
+package org.lcsim.recon.tracking.trflayer;
+
+import junit.framework.TestCase;
+import org.lcsim.recon.tracking.trfbase.ETrack;
+import org.lcsim.recon.tracking.trfbase.SurfTest;
+import org.lcsim.recon.tracking.trfutil.Assert;
+
+/**
+ *
+ * @author Norman Graf
+ */
+public class LTrack_t extends TestCase
+{
+    private boolean debug;
+    /** Creates a new instance of LTrack_t */
+    public void testLTrack()
+    {
+          String component = "LTrack";
+        String ok_prefix = component + " (I): ";
+        String error_prefix = component + " test (E): ";
+        
+        if(debug) System.out.println( ok_prefix
+                + "---------- Testing component " + component
+                + ". ----------" );
+        
+        //********************************************************************
+        
+        if(debug) System.out.println( ok_prefix + "Test constructor." );
+        SurfTest stst = new SurfTest(1.0);
+        ETrack tre = new ETrack( stst.newPureSurface() );
+        if(debug) System.out.println("tre= "+tre);
+        Layer ltst = new TLayer();
+        LayerStat lstat = new LayerStat(ltst);
+        lstat.setState(2);
+        //  LTrack trl1 = new LTrack();
+        LTrack trl1 = new LTrack(tre, lstat);
+        if(debug) System.out.println("trl1= "+trl1);
+        //fetch reference to the Etrack...
+        ETrack tmp = trl1.track();
+        if(debug) System.out.println("tmp= "+tmp);
+        //Set this reference to a real Etrack...
+        tmp = tre;
+        if(debug) System.out.println("tmp= "+tmp);
+        trl1.pushStatus(lstat);
+        if(debug) System.out.println( "trl1= "+trl1 );
+        // trl1 should now point to a real track... but it doesn't!
+        LTrack trl2 = new LTrack(trl1);
+        if(debug) System.out.println( "trl2= "+trl2 );
+        
+        //********************************************************************
+        
+        if(debug) System.out.println( ok_prefix + "Test access." );
+        if(debug) System.out.println("\n ***trl1.get_track()= \n"+trl1.track());
+        if(debug) System.out.println("\n ***trl2.get_track()= \n"+trl2.track());
+        Assert.assertTrue( trl1.track().equals(trl2.track()) );
+        LayerStatChain lsc = trl1.statusChain();
+        if(debug) System.out.println("***lsc= \n"+lsc);
+        if(debug) System.out.println("\n "+trl1.status().state() );
+        Assert.assertTrue( trl1.status().state() == 2 );
+        
+        //********************************************************************
+        
+        if(debug) System.out.println( ok_prefix + "Test status manipulation." );
+        Assert.assertTrue( trl1.atValidStatus() );
+        Assert.assertTrue( trl1.status().state() == 2 );
+        if(debug) System.out.println( trl1 );
+        trl1.status().setState(1);
+        if(debug) System.out.println( trl1 );
+        Assert.assertTrue( trl1.status().state() == 1 );
+        // insert 2nd status
+        lstat.setState(2);
+        trl1.pushStatus(lstat);
+        if(debug) System.out.println( trl1 );
+        Assert.assertTrue( trl1.status().state() == 2 );
+        Assert.assertTrue( trl1.setPreviousStatus() );
+        // insert 3rd status
+        lstat.setState(3);
+        trl1.pushStatus(lstat);
+        Assert.assertTrue( ! trl1.atTopStatus() );
+        Assert.assertTrue( trl1.status().state() == 3 );
+        // step up to 2nd status
+        Assert.assertTrue( trl1.setPreviousStatus() );
+        if(debug) System.out.println(trl1.status().state());
+        if(debug) System.out.println("lsc= "+trl1.statusChain());
+        Assert.assertTrue( trl1.status().state() == 2 );
+        // step up to 1st status
+        Assert.assertTrue( trl1.setPreviousStatus() );
+        Assert.assertTrue( ! trl1.setPreviousStatus() );
+        Assert.assertTrue( trl1.atTopStatus() );
+        Assert.assertTrue( trl1.status().state() == 1 );
+        // step down
+        Assert.assertTrue( trl1.setNextStatus() );
+        if(debug) System.out.println("get_state()= "+trl1.status().state());
+        Assert.assertTrue( trl1.status().state() == 2 );
+        Assert.assertTrue( trl1.setNextStatus() );
+        Assert.assertTrue( trl1.status().state() == 3 );
+        Assert.assertTrue( ! trl1.setNextStatus() );
+        // pop last status -- should leave us positioned at 2nd
+        Assert.assertTrue( trl1.popStatus() );
+        Assert.assertTrue( trl1.status().state() == 2 );
+        
+        //********************************************************************
+        
+        if(debug) System.out.println( ok_prefix + "Test propagator status" );
+        Assert.assertTrue( ! trl2.propStat().success() );
+        trl2.propStat().setForward();
+        Assert.assertTrue( trl2.propStat().success() );
+        double s = 123.4;
+        trl2.propStat().setPathDistance(s);
+        Assert.assertTrue( trl2.propStat().pathDistance() == s );
+        
+        if(debug) System.out.println( ok_prefix
+                + "------------- All tests passed. -------------" );
+        
+        //********************************************************************      
+    }
+    
+}

lcsim/test/org/lcsim/recon/tracking/trflayer
ClusterFindAll_t.java added at 1.1
diff -N ClusterFindAll_t.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ClusterFindAll_t.java	24 Jul 2007 23:36:44 -0000	1.1
@@ -0,0 +1,76 @@
+/*
+ * ClusterFindAll_t.java
+ *
+ * Created on July 24, 2007, 4:35 PM
+ *
+ * $Id: ClusterFindAll_t.java,v 1.1 2007/07/24 23:36:44 ngraf Exp $
+ */
+
+package org.lcsim.recon.tracking.trflayer;
+
+import junit.framework.TestCase;
+import org.lcsim.recon.tracking.trfbase.ClusterTest;
+import org.lcsim.recon.tracking.trfbase.ETrack;
+import org.lcsim.recon.tracking.trfbase.SurfTest;
+import org.lcsim.recon.tracking.trfutil.Assert;
+
+/**
+ *
+ * @author Norman Graf
+ */
+public class ClusterFindAll_t extends TestCase
+{
+    private boolean debug;
+    /** Creates a new instance of ClusterFindAll_t */
+    public void testClusterFindAll()
+    {
+         String component = "ClusterFindAll";
+        String ok_prefix = component + " (I): ";
+        String error_prefix = component + " test (E): ";
+        
+        if(debug) System.out.println(ok_prefix
+                + "-------- Testing component " + component
+                + ". --------" );
+        
+        //********************************************************************
+        
+        if(debug) System.out.println(ok_prefix + "Test constructor." );
+        SurfTest psrf6 = new SurfTest(6.0);
+        ClusterFindAll find = new ClusterFindAll(psrf6);
+        if(debug) System.out.println(find );
+        
+        Assert.assertTrue( find.surface().parameter(0) == 6.0 );
+        Assert.assertTrue( find.clusters().size() == 0 );
+        ETrack tre = new ETrack(psrf6);
+        Assert.assertTrue( find.clusters(tre).size() == 0 );
+        
+        //********************************************************************
+        
+        if(debug) System.out.println(ok_prefix + "Add some clusters."  );
+        find.addCluster( new ClusterTest(psrf6,1) );
+        find.addCluster( new ClusterTest(psrf6,2) );
+        find.addCluster( new ClusterTest(psrf6,3) );
+        if(debug) System.out.println(find );
+        Assert.assertTrue( find.clusters().size() == 3 );
+        Assert.assertTrue( find.clusters(tre).size() == 3 );
+        
+        //********************************************************************
+        
+        if(debug) System.out.println(ok_prefix + "Drop the clusters."  );
+        find.dropClusters();
+        if(debug) System.out.println(find );
+        Assert.assertTrue( find.clusters().size() == 0 );
+        Assert.assertTrue( find.clusters(tre).size() == 0 );
+        
+        //********************************************************************
+        
+        //********************************************************************
+        
+        if(debug) System.out.println(ok_prefix
+                + "------------- All tests passed. -------------" );
+        
+        
+        //********************************************************************       
+    }
+    
+}

lcsim/test/org/lcsim/recon/tracking/trflayer
LayerStatChain_t.java added at 1.1
diff -N LayerStatChain_t.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ LayerStatChain_t.java	24 Jul 2007 23:36:44 -0000	1.1
@@ -0,0 +1,44 @@
+/*
+ * LayerStatChain_t.java
+ *
+ * Created on July 24, 2007, 4:25 PM
+ *
+ * $Id: LayerStatChain_t.java,v 1.1 2007/07/24 23:36:44 ngraf Exp $
+ */
+
+package org.lcsim.recon.tracking.trflayer;
+
+import junit.framework.TestCase;
+
+/**
+ *
+ * @author Norman Graf
+ */
+public class LayerStatChain_t extends TestCase
+{
+    private boolean debug;
+    /** Creates a new instance of LayerStatChain_t */
+    public void testLayerStatChain()
+    {
+        String component = "LayerStat";
+        String ok_prefix = component + " (I): ";
+        String error_prefix = component + " test (E): ";
+        
+        if(debug) System.out.println( ok_prefix
+                + "---------- Testing component " + component
+                + ". ----------");
+        
+        //********************************************************************
+        
+        LayerStatChain lsc = new LayerStatChain();
+        if(debug) System.out.println(lsc);
+        
+        
+        if(debug) System.out.println( ok_prefix
+                + "------------- All tests passed. -------------");
+        if(debug) System.out.println("This is too difficult to test here. \n We test with LTrack");
+        
+        //********************************************************************        
+    }
+    
+}

lcsim/test/org/lcsim/recon/tracking/trflayer
LayerStat_t.java added at 1.1
diff -N LayerStat_t.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ LayerStat_t.java	24 Jul 2007 23:36:44 -0000	1.1
@@ -0,0 +1,75 @@
+/*
+ * LayerStat_t.java
+ *
+ * Created on July 24, 2007, 4:22 PM
+ *
+ * $Id: LayerStat_t.java,v 1.1 2007/07/24 23:36:44 ngraf Exp $
+ */
+
+package org.lcsim.recon.tracking.trflayer;
+
+import junit.framework.TestCase;
+import org.lcsim.recon.tracking.trfbase.ETrack;
+import org.lcsim.recon.tracking.trfbase.MissTest;
+import org.lcsim.recon.tracking.trfbase.Surface;
+import org.lcsim.recon.tracking.trfutil.Assert;
+
+/**
+ *
+ * @author Norman Graf
+ */
+public class LayerStat_t extends TestCase
+{
+ private boolean debug;   
+    /** Creates a new instance of LayerStat_t */
+    public void testLayerStat()
+    {
+        String component = "LayerStat";
+        String ok_prefix = component + " (I): ";
+        String error_prefix = component + " test (E): ";
+        
+        if(debug) System.out.println( ok_prefix
+                + "---------- Testing component " + component
+                + ". ----------" );
+        
+        
+        //********************************************************************
+        
+        if(debug) System.out.println( ok_prefix + "Construct and fill status." );
+        MissTest miss = new MissTest(2.0,0.4);
+        ClusterFinderTest find = new ClusterFinderTest(2.0);
+        Surface srf = find.surface();
+        ETrack tre = new ETrack(srf.newPureSurface() );
+        TLayer lyr = new TLayer(true,true,miss,find,5);
+        LayerStat lstat = lyr.propagate();
+        if(debug) System.out.println( lstat );
+        lyr.check(lstat);
+        Assert.assertTrue( lstat.atExit() );
+        Assert.assertTrue( lstat.hasClusters() );
+        Assert.assertTrue( lstat.clusters().size() == 0 );
+        Assert.assertTrue( lstat.clusters(tre).size() == 0 );
+        Assert.assertTrue( lstat.miss().likelihood() == 0.4 );
+        Assert.assertTrue( lstat.layer() == lyr );
+        
+        //********************************************************************
+        
+        if(debug) System.out.println( ok_prefix + "Test copy." );
+        LayerStat lstat2 = new LayerStat(lstat);
+        if(debug) System.out.println( lstat2 );
+        Assert.assertTrue( lstat2.atExit() );
+        Assert.assertTrue( lstat2.hasClusters() );
+        Assert.assertTrue( lstat2.clusters().size() == 0 );
+        Assert.assertTrue( lstat2.clusters(tre).size() == 0 );
+        Assert.assertTrue( lstat2.miss().likelihood() == 0.4 );
+        Assert.assertTrue( lstat2.layer() == lyr );
+        lyr.check(lstat2);
+        
+        //********************************************************************
+        
+        if(debug) System.out.println( ok_prefix
+                + "------------- All tests passed. -------------" );
+        
+        //********************************************************************        
+    }
+    
+}
CVSspam 0.2.8