Print

Print


Commit in GeomConverter/test/org/lcsim/detector on MAIN
ShapeRotateTest.java+58-671.2 -> 1.3
JM: Update test case.

GeomConverter/test/org/lcsim/detector
ShapeRotateTest.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- ShapeRotateTest.java	28 Mar 2007 00:52:48 -0000	1.2
+++ ShapeRotateTest.java	29 Mar 2007 22:27:52 -0000	1.3
@@ -46,25 +46,13 @@
     }
 
     public void testShapeRotate()
-    {
-        System.out.println("testShapeRotate");
-
-        Hep3Vector point = new BasicHep3Vector(0,0,-10);
-        IPhysicalVolumePath path = nav.getPath(point);
-
-        System.out.println(point + " " + path.toString());
-
-        point = new BasicHep3Vector(0,0,10);
-        path = nav.getPath(point);
-
-        System.out.println(point + " " + path.toString());
-        
-        for (IDetectorElement de : DetectorElementStore.getInstance())
+    {        
+        try {
+            writeHepRep("ShapeRotateTest.heprep");
+        }
+        catch ( Throwable x )
         {
-            if ( de.hasGeometryInfo() )
-            {
-                System.out.println(de.getName() + " " + de.getGeometry().getPosition());
-            }
+            throw new RuntimeException(x);
         }
     }
 
@@ -76,62 +64,66 @@
             super(name, parent, path);
         }        
     }
-
+    
     public void setUp()
     {
         IPhysicalVolume world = createWorld();
         nav = new PhysicalVolumeNavigator("default",world);
-
-        // testbox1
-        Box box1 = new Box("testbox1",50,50,50);
-        ILogicalVolume lv1 = new LogicalVolume("testbox1",box1,dummymat);
-        Rotation3D rot1 = new Rotation3D();
-        //rot1.setPassiveXYZ(0, 0, Math.PI/4);
-        Hep3Vector t1 = new BasicHep3Vector(100,0,0);
-        new PhysicalVolume(
-                new Transform3D(t1,rot1),
-                "testbox1",
-                lv1,
-                world.getLogicalVolume(),
-                0);        
-
-        Box box2 = new Box("testbox2",10,10,10);
-        LogicalVolume lv2 = new LogicalVolume("testbox2",box2,dummymat);
-        Rotation3D rot2 = new Rotation3D();        
-        //rot2.setPassiveEuler(Math.PI/4, 0,0);
-        new PhysicalVolume(
-                new Transform3D(new BasicHep3Vector(25,0,0), rot2),
-                "testbox2",
-                lv2,
-                lv1,
-                1);                
-        
-        Hep3Vector t3 = new BasicHep3Vector(-100,0,0);
-        Rotation3D rot3 = new Rotation3D();
-        rot3.setPassiveXYZ(0,Math.PI,0);
-        new PhysicalVolume(
-                new Transform3D(t3,rot3),
-                "testbox3",
-                lv1,
-                world.getLogicalVolume(),
-                1);             
-        
-        IDetectorElement de1 = new TestDE("de1",null,"/testbox1");
-        IDetectorElement de2 = new TestDE("de2",null,"/testbox3");
-        IDetectorElement de3 = new TestDE("de3",de1,"/testbox1/testbox2");
-        IDetectorElement de4 = new TestDE("de4",de2,"/testbox3/testbox2");
-
-        points.add(new BasicHep3Vector(25,0,0));
-
-        try {
-            writeHepRep("ShapeRotateTest.heprep");
+        
+        Box box1 = new Box("box1",50,25,50);
+        ILogicalVolume lv1 = new LogicalVolume("test1",box1,dummymat);
+        
+        Box box2 = new Box("box2", 10,10,10);
+        ILogicalVolume lv2 = new LogicalVolume("test2",box2,dummymat);
+        Hep3Vector t1 = new BasicHep3Vector(25,0,0);
+        
+        IPhysicalVolume pv1 = 
+            new PhysicalVolume(
+                    new Transform3D(t1),
+                    "box2",
+                    lv2,
+                    lv1,
+                    0
+                    );
+        
+        double transX = 0;
+        double transIncr = 100;
+        
+        double rotZ = 0;
+        double rotIncr = Math.PI/2;
+        
+        for (int i=0; i<5; i++)
+        {
+            Rotation3D thisRot = new Rotation3D();
+            thisRot.setPassiveXYZ(0, 0, rotZ);
+            
+            Hep3Vector thisTrans = new BasicHep3Vector(transX,0,0);
+            
+            IPhysicalVolume pv =
+                new PhysicalVolume(
+                        new Transform3D(thisTrans, thisRot),
+                        "pv" + i,
+                        lv1,
+                        world.getLogicalVolume(),
+                        i);
+            
+            rotZ += rotIncr;
+            transX += transIncr;
+            
+            new TestDE("dau"+i,null,"/pv"+i+"/box2");
+            new TestDE("par"+i,null,"/pv"+i);
         }
-        catch ( Throwable x )
+        
+        for (IDetectorElement de : DetectorElementStore.getInstance())
         {
-            throw new RuntimeException(x);
+            System.out.println(de.getName());
+            if ( de.hasGeometryInfo())
+            {
+                System.out.println("     " + de.getGeometry().getPhysicalVolumePath());
+            }
         }
     }
-
+  
     public final IPhysicalVolume createWorld()
     {       
         Box boxWorld = new Box(
@@ -157,7 +149,6 @@
         return pvTop;
     }      
 
-
     public final static String HITS_LAYER = "Hits";
     public final static String PARTICLES_LAYER = "Particles";
 
CVSspam 0.2.8