Commit in lcsim/test on MAIN
NeighbourFindingTest.java-1261.3 removed
org/lcsim/NeighbourFindingTest.java+132added 1.1
+132-126
1 added + 1 removed, total 2 files
JM: Move test from base package.

lcsim/test
NeighbourFindingTest.java removed after 1.3
diff -N NeighbourFindingTest.java
--- NeighbourFindingTest.java	19 Sep 2006 18:45:17 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,126 +0,0 @@
-
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import org.lcsim.conditions.DetectorLocator;
-import org.lcsim.geometry.Detector;
-import org.lcsim.geometry.IDDecoder;
-import org.lcsim.geometry.compact.Subdetector;
-import org.lcsim.geometry.subdetector.CylindricalCalorimeter;
-
-public class NeighbourFindingTest extends TestCase
-{
-    public static Test suite()
-    {
-        return new TestSuite(NeighbourFindingTest.class);
-    }
-
-    public void testDetectorLocator() throws Exception
-    {
-        //List<String> detNames = DetectorLocator.getDetectorNameList();
-	List<String> detNames = new ArrayList<String>();
-	detNames.add("acme0605");
-	detNames.add("cdcaug05");
-	detNames.add("frankyaug05");
-	detNames.add("ldcaug05");
-	detNames.add("sdfeb05");
-	detNames.add("sdjan03");
-	detNames.add("sid00");
-
-        // Loop over detector list.
-        for(String detname : detNames ) {
-            Detector det = DetectorLocator.findDetector(detname);
-
-            // loop over all subdetectors
-            Map<String, Subdetector> subdetMap = det.getSubdetectors();
-            for(String subdetName : subdetMap.keySet()) {
-                Subdetector subdet = subdetMap.get(subdetName);
-
-                // test all cylindrical barrels and disk-like endcaps
-                if(subdet instanceof CylindricalCalorimeter) {
-                    CylindricalCalorimeter cal = (CylindricalCalorimeter)subdet;
-                    if(cal==null) continue;
-
-                    IDDecoder decoder = null;
-                    try {
-                        decoder = cal.getIDDecoder();
-                    }
-                    catch(Exception x) {
-                        System.out.println("Note: no decoder for <"+cal.getName()+">: cal type = "+cal);
-                        continue;
-                    }
-
-                    if(cal.isBarrel()) {
-                        // test neighbour finding at difficut situation: phi=0
-                        double rmin = cal.getInnerRadius();
-                        double rmax = cal.getOuterRadius();
-                        double[] pos = new double[3];
-                        pos[0] = (rmin+rmax)/2;
-                        pos[1] = 0;
-                        pos[2] = 0;
-
-                        // test cell finding without previously setting a longID into the decoder
-                        long refid = decoder.findCellContainingXYZ(pos);
-                        assert refid != 0 : "Error: No refID cell returned.  Valid input point?";
-
-                        if( decoder.supportsNeighbours() ) {
-                            // test neighbour finding
-                            decoder.setID(refid);
-                            long[] neighs = decoder.getNeighbourIDs(1,1,1);
-                            assert neighs.length == 26 : "Incorrect # neighbors returned: "+neighs.length;
-                        }
-                        else {
-                            System.out.println("Neighbor finding not supported for <"+cal.getName()+">");
-                            continue;
-                        }
-                    }
-                    else {
-                        // test neighbour finding at difficut situation: phi=0
-                        double rmin = cal.getInnerRadius();
-                        double rmax = cal.getOuterRadius();
-                        double zmin = cal.getZMin();
-                        double zmax = cal.getZMax();
-
-                        double[] pos = new double[3];
-                        pos[0] = (rmin+rmax)/2;
-                        pos[1] = 0;
-
-                        // test cell finding without previously setting a longID into the decoder
-
-                        // for south
-                        pos[2] = (zmin+zmax)/2;
-                        long refidSouth = decoder.findCellContainingXYZ(pos);
-                        assert refidSouth != 0 : "Error: No refID cell returned.  Valid input point?";
-
-                        // for north
-                        pos[2] = -(zmin+zmax)/2;
-                        long refidNorth = decoder.findCellContainingXYZ(pos);
-                        assert refidNorth != 0 : "Error: No refID cell returned.  Valid input point?";
-
-                        assert refidNorth!=refidSouth : "Same refid for north and south ("+refidNorth+")is wrong!";
-
-                        if( decoder.supportsNeighbours() ) {
-                            // test neighbour finding
-                            long[] neighs;
-                            decoder.setID(refidSouth);
-                            neighs = decoder.getNeighbourIDs(1,1,1);
-                            assert neighs.length == 26 : "Incorrect # neighbors returned: "+neighs.length;
-
-                            decoder.setID(refidNorth);
-                            neighs = decoder.getNeighbourIDs(1,1,1);
-                            assert neighs.length == 26 : "Incorrect # neighbors returned: "+neighs.length;
-                        }
-                        else {
-                            System.out.println("Neighbor finding not supported for <"+cal.getName()+">");
-                            continue;
-                        }
-                    }
-                }
-            }
-        }
-    }
-}

lcsim/test/org/lcsim
NeighbourFindingTest.java added at 1.1
diff -N NeighbourFindingTest.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ NeighbourFindingTest.java	8 Aug 2007 23:34:43 -0000	1.1
@@ -0,0 +1,132 @@
+package org.lcsim;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.lcsim.conditions.DetectorLocator;
+import org.lcsim.geometry.Detector;
+import org.lcsim.geometry.IDDecoder;
+import org.lcsim.geometry.compact.Subdetector;
+import org.lcsim.geometry.subdetector.CylindricalCalorimeter;
+
+public class NeighbourFindingTest extends TestCase
+{
+    public static Test suite()
+    {
+        return new TestSuite(NeighbourFindingTest.class);
+    }
+
+    public void testDetectorLocator() throws Exception
+    {
+        //List<String> detNames = DetectorLocator.getDetectorNameList();
+	List<String> detNames = new ArrayList<String>();
+	
+	detNames.add("acme0605");
+	detNames.add("cdcaug05");
+	detNames.add("frankyaug05");
+	detNames.add("ldcaug05");
+	detNames.add("sdfeb05");
+	// Breaks maven 2 build for some reason.  --JM
+	//detNames.add("sdjan03");
+	detNames.add("sid00");
+
+        // Loop over detector list.
+        for(String detname : detNames ) {
+        	
+        	//System.out.println(detname);
+        	
+            Detector det = DetectorLocator.findDetector(detname);
+
+            // loop over all subdetectors
+            Map<String, Subdetector> subdetMap = det.getSubdetectors();
+            for(String subdetName : subdetMap.keySet()) {
+                Subdetector subdet = subdetMap.get(subdetName);
+
+                // test all cylindrical barrels and disk-like endcaps
+                if(subdet instanceof CylindricalCalorimeter) {
+                    CylindricalCalorimeter cal = (CylindricalCalorimeter)subdet;
+                    if(cal==null) continue;
+
+                    IDDecoder decoder = null;
+                    try {
+                        decoder = cal.getIDDecoder();
+                    }
+                    catch(Exception x) {
+                        System.out.println("Note: no decoder for <"+cal.getName()+">: cal type = "+cal);
+                        continue;
+                    }
+
+                    if(cal.isBarrel()) {
+                        // test neighbour finding at difficut situation: phi=0
+                        double rmin = cal.getInnerRadius();
+                        double rmax = cal.getOuterRadius();
+                        double[] pos = new double[3];
+                        pos[0] = (rmin+rmax)/2;
+                        pos[1] = 0;
+                        pos[2] = 0;
+
+                        // test cell finding without previously setting a longID into the decoder
+                        long refid = decoder.findCellContainingXYZ(pos);
+                        assert refid != 0 : "Error: No refID cell returned.  Valid input point?";
+
+                        if( decoder.supportsNeighbours() ) {
+                            // test neighbour finding
+                            decoder.setID(refid);
+                            long[] neighs = decoder.getNeighbourIDs(1,1,1);
+                            assert neighs.length == 26 : "Incorrect # neighbors returned: "+neighs.length;
+                        }
+                        else {
+                            System.out.println("Neighbor finding not supported for <"+cal.getName()+">");
+                            continue;
+                        }
+                    }
+                    else {
+                        // test neighbour finding at difficut situation: phi=0
+                        double rmin = cal.getInnerRadius();
+                        double rmax = cal.getOuterRadius();
+                        double zmin = cal.getZMin();
+                        double zmax = cal.getZMax();
+
+                        double[] pos = new double[3];
+                        pos[0] = (rmin+rmax)/2;
+                        pos[1] = 0;
+
+                        // test cell finding without previously setting a longID into the decoder
+
+                        // for south
+                        pos[2] = (zmin+zmax)/2;
+                        long refidSouth = decoder.findCellContainingXYZ(pos);
+                        assert refidSouth != 0 : "Error: No refID cell returned.  Valid input point?";
+
+                        // for north
+                        pos[2] = -(zmin+zmax)/2;
+                        long refidNorth = decoder.findCellContainingXYZ(pos);
+                        assert refidNorth != 0 : "Error: No refID cell returned.  Valid input point?";
+
+                        assert refidNorth!=refidSouth : "Same refid for north and south ("+refidNorth+")is wrong!";
+
+                        if( decoder.supportsNeighbours() ) {
+                            // test neighbour finding
+                            long[] neighs;
+                            decoder.setID(refidSouth);
+                            neighs = decoder.getNeighbourIDs(1,1,1);
+                            assert neighs.length == 26 : "Incorrect # neighbors returned: "+neighs.length;
+
+                            decoder.setID(refidNorth);
+                            neighs = decoder.getNeighbourIDs(1,1,1);
+                            assert neighs.length == 26 : "Incorrect # neighbors returned: "+neighs.length;
+                        }
+                        else {
+                            System.out.println("Neighbor finding not supported for <"+cal.getName()+">");
+                            continue;
+                        }
+                    }
+                }
+            }
+        }
+    }
+}
CVSspam 0.2.8