GeomConverter/test/org/lcsim/geometry/segmentation
diff -N ProjectiveCylinderTest.java
--- ProjectiveCylinderTest.java 18 Jul 2005 18:00:08 -0000 1.5
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,165 +0,0 @@
-package org.lcsim.geometry.segmentation;
-
-import java.util.HashSet;
-import java.util.Set;
-import junit.framework.*;
-import org.jdom.Element;
-import org.jdom.JDOMException;
-import org.lcsim.geometry.CylindricalSubdetector;
-import org.lcsim.geometry.IDDecoder;
-import org.lcsim.geometry.layer.Layering;
-import org.lcsim.geometry.util.IDDescriptor;
-import org.lcsim.geometry.util.IDEncoder;
-
-/**
- *
- * @author tonyj
- */
-public class ProjectiveCylinderTest extends TestCase
-{
- private ProjectiveCylinder pc;
- private org.lcsim.geometry.util.IDEncoder encoder;
- private org.lcsim.geometry.util.IDDecoder decoder;
-
- public ProjectiveCylinderTest(String testName)
- {
- super(testName);
- }
-/*
- protected void setUp() throws java.lang.Exception
- {
- Element e = new Element("segmentation");
- e.setAttribute("phiBins","100");
- e.setAttribute("thetaBins","200");
- pc = new ProjectiveCylinder(e);
-
- String description = "layer:7,system:3,barrel:3,theta:32:11,phi:11";
- IDDescriptor desc = new IDDescriptor(description);
- pc.setIDDescription(desc);
- encoder = new org.lcsim.geometry.util.IDEncoder(desc);
- decoder = new org.lcsim.geometry.util.IDDecoder(desc);
-
- Element de = new Element("detector");
- Element l = new Element("layer");
- l.setAttribute("repeat","0");
-
- Layering ls = new TestSubdetector(de);
- pc.setCalorimeter(ls);
- }
-*/
- protected void tearDown() throws java.lang.Exception
- {
- }
-
- public static junit.framework.Test suite()
- {
- return new TestSuite(ProjectiveCylinderTest.class);
- }
-
- public void testProjectiveCylinderTest()
- {
- System.out.println("This test has been deprecated. --JM");
- }
-
- /**
- * Test of supportsNeighbours method, of class org.lcsim.geometry.segmentation.ProjectiveCylinder.
- */
-/*
- public void testSupportsNeighbours()
- {
- assertTrue(pc.supportsNeighbours());
- }
-*/
- /**
- * Test of getNeighbourIDs method, of class org.lcsim.geometry.segmentation.ProjectiveCylinder.
- */
- /*
- public void testGetNeighbourIDs1()
- {
- int[] values = { 20, 1, 1, 25, 75 };
- int[] v = new int[values.length];
- long id = encoder.setValues(values);
- pc.setID(id);
-
- long[] ids = pc.getNeighbourIDs();
- assertEquals(26,ids.length);
- assertFalse(checkForDuplicates(ids));
- }
- private boolean checkForDuplicates(long[] ids)
- {
- Set set = new HashSet();
- for (int i=0; i<ids.length; i++) set.add(ids[i]);
- return set.size() != ids.length;
- }
- public void testGetNeighbourIDs2()
- {
- int[] values = { 20, 1, 1, 25, 75 };
- long id = encoder.setValues(values);
- pc.setID(id);
-
- long[] ids = pc.getNeighbourIDs(2,2,2);
- assertEquals(124,ids.length);
- assertFalse(checkForDuplicates(ids));
- }
- public void testGetNeighbourIDs3()
- {
- int[] values = { 50, 1, 1, 25, 75 };
- long id = encoder.setValues(values);
- pc.setID(id);
-
- long[] ids = pc.getNeighbourIDs();
- assertEquals(9,ids.length);
- assertFalse(checkForDuplicates(ids));
- }
-
- private class TestSubdetector
- extends org.lcsim.geometry.subdetector.CylindricalCalorimeter
- {
- public TestSubdetector(Element e) throws JDOMException
- {
- super(e);
- }
-
- public double getRadiusForLayer(int layer)
- {
- if (layer<0 || layer>=getLayerCount()) throw new IndexOutOfBoundsException();
- return getInnerRadius()+(getOuterRadius()-getInnerRadius())*layer/getLayerCount();
- }
-
- public double getDistanceToLayer(int layer)
- {
- return getRadiusForLayer(layer);
- }
-
- public double getZMin()
- {
- return -100;
- }
-
- public double getZMax()
- {
- return 100;
- }
-
- public double getOuterRadius()
- {
- return 200;
- }
-
- public int getLayerCount()
- {
- return 50;
- }
-
- public double getInnerRadius()
- {
- return 100;
- }
-
- public double[] transformLocalToGlobal(double[] localPos)
- {
- return localPos;
- }
- }
-*/
-}