Commit in GeomConverter/test/org/lcsim/detector on MAIN
CoordinateTransformation3DTest.java-141.5 -> 1.6
SimpleDetectorTest.java+96-21.1 -> 1.2
+96-16
2 modified files
JM: Snapshot.  PhysicalVolumeNavigator is working now.

GeomConverter/test/org/lcsim/detector
CoordinateTransformation3DTest.java 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- CoordinateTransformation3DTest.java	28 Feb 2007 21:41:19 -0000	1.5
+++ CoordinateTransformation3DTest.java	3 Mar 2007 13:34:01 -0000	1.6
@@ -221,18 +221,4 @@
     	assertTrue(Math.abs(transformed_point.z()/point.z()-1) < 1E-12);
         
     } 
-    
-    
-    private static final void assertStrictEquals(Rotation3D rotate1, Rotation3D rotate2)
-    {
-       	assert(rotate1.xx() == rotate2.xx());	
-    	assert(rotate1.xy() == rotate2.xy());
-    	assert(rotate1.xz() == rotate2.xz());
-    	assert(rotate1.yx() == rotate2.yx());
-    	assert(rotate1.yy() == rotate2.yy());
-    	assert(rotate1.yz() == rotate2.yz());
-    	assert(rotate1.zx() == rotate2.zx());
-    	assert(rotate1.zy() == rotate2.zy());
-    	assert(rotate1.zz() == rotate2.zz());    	
-    }
 }
\ No newline at end of file

GeomConverter/test/org/lcsim/detector
SimpleDetectorTest.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- SimpleDetectorTest.java	3 Mar 2007 01:19:43 -0000	1.1
+++ SimpleDetectorTest.java	3 Mar 2007 13:34:01 -0000	1.2
@@ -1,14 +1,19 @@
 package org.lcsim.detector;
 
+import static org.lcsim.units.clhep.SystemOfUnits.cm;
+import static org.lcsim.units.clhep.SystemOfUnits.m;
+import hep.physics.vec.BasicHep3Vector;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
 import org.lcsim.detector.material.IMaterial;
+import org.lcsim.detector.material.MaterialElement;
 import org.lcsim.detector.solids.Box;
 
 public class SimpleDetectorTest extends TestCase
 {		
-	private IPhysicalVolume world=null;
+	private IPhysicalVolume world = null;
+	private static IMaterial dummymat = new MaterialElement("dummymat",1,1,1.0);
 	
     public SimpleDetectorTest(String name)
     {
@@ -22,7 +27,7 @@
     
     protected void setUp() throws Exception
     {
-    	world = DetectorTestUtil.createTestSetup();
+    	world = createTestGeometry();
     }
     
     public void testBasicAccess()
@@ -39,4 +44,93 @@
     	IMaterial material = lvDau.getMaterial();
     	System.out.println("mat dau = " + material.getName());
     }
+    
+	static double[] xpoints = {5.1,4.9,2.6,2.4,1.1,0.9,0.5,0};
+    public void testNavigator()
+    {
+    	IPhysicalVolumeNavigator nav = new PhysicalVolumeNavigator(world);
+    	
+    	IPhysicalVolumePath path = nav.getPath("/test/test2");
+    	System.out.println("got path = " + path.toString());
+    	
+    	ICoordinateTransformation3D t = nav.getTransform(path);
+    	System.out.println("trans to box /test/test2="+t.toString());
+    	
+    	IPhysicalVolumePath path2 = nav.getPath(new BasicHep3Vector(0,0,0));
+    	System.out.println("nav thinks 0,0,0 = " + path2.toString());    	    
+    
+    	for (double x : xpoints)
+    	{
+    		IPhysicalVolumePath path3 = nav.getPath(new BasicHep3Vector(x,0,0));
+    		System.out.println("nav thinks x=" + x + " has path <" + path3.toString()+">");
+    	}
+    	
+    	for (double x : xpoints)
+    	{
+    		IPhysicalVolumePath path3 = nav.getPath(new BasicHep3Vector(-x,0,0));
+    		System.out.println("nav thinks x=" + -x + " has path <" + path3.toString()+">");
+    	}
+    }
+    
+	public static IPhysicalVolume createTestGeometry()
+	{
+		IPhysicalVolume world = createWorld();
+		createTestGeometryBoxes(world);
+		return world;
+	}
+	
+	public static final void createTestGeometryBoxes(IPhysicalVolume mom)
+	{
+		Box box = new Box("test_box",10.0,10.0,10.0);
+		LogicalVolume lvTest = new LogicalVolume("lvTest",box,dummymat);
+		new PhysicalVolume(
+				new CoordinateTransformation3D(),
+				"test",
+				lvTest,
+				mom.getLogicalVolume(),
+				1);
+	
+		Box box2 = new Box("test_box2",5.0,5.0,5.0);
+		LogicalVolume lvTest2 = new LogicalVolume("lvTest2",box2,dummymat);
+		new PhysicalVolume(
+				new CoordinateTransformation3D(new BasicHep3Vector(0,0,0)),
+				"test2",
+				lvTest2,
+				lvTest,
+				1);
+
+		Box box3 = new Box("test_box3",10.0*cm,10.0*cm,10.0*cm);
+		LogicalVolume lvTest3 = new LogicalVolume("lvTest3",box3,dummymat);
+		new PhysicalVolume(
+				new CoordinateTransformation3D(),
+				"test3",
+				lvTest3,
+				lvTest,
+				2);		
+	}
+	
+	public static final IPhysicalVolume createWorld()
+	{		
+		Box boxWorld = new Box(
+				"world_box",
+				10.0*m,
+				10.0*m,
+				10.0*m);
+		
+		LogicalVolume lvWorld = 
+			new LogicalVolume(
+					"world",
+					boxWorld,
+					dummymat);
+		
+		IPhysicalVolume pvTop = 
+			new PhysicalVolume(
+					null,
+					"world",
+					lvWorld,
+					null,
+					0);
+		
+		return pvTop;
+	}   
 }
\ No newline at end of file
CVSspam 0.2.8