GeomConverter/test/org/lcsim/geometry/field
diff -N Cartesian3DMagneticFieldMapTest.java
--- Cartesian3DMagneticFieldMapTest.java 4 Sep 2013 00:16:36 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,73 +0,0 @@
-package org.lcsim.geometry.field;
-
-import hep.physics.vec.BasicHep3Vector;
-import hep.physics.vec.Hep3Vector;
-import java.io.InputStream;
-import java.util.Map;
-import static junit.framework.Assert.assertEquals;
-import org.lcsim.geometry.Detector;
-import org.lcsim.geometry.FieldMap;
-import org.lcsim.geometry.GeometryReader;
-import org.lcsim.geometry.compact.Field;
-
-/**
- *
- * @author Norman A Graf
- *
- * @version $Id:
- */
-public class Cartesian3DMagneticFieldMapTest extends FieldTest
-{
-
- public Cartesian3DMagneticFieldMapTest(String name)
- {
- super(name);
- }
-
- public void testRead() throws Exception
- {
- InputStream in = this.getClass().getResourceAsStream("/org/lcsim/geometry/field/Cartesian3DMagneticFieldMapTest.xml");
- GeometryReader reader = new GeometryReader();
- Detector det = reader.read(in);
- FieldMap map = det.getFieldMap();
-
- double[] off = {1., 2., 3.};
- double[] fp = {-25.0, -8.9, -150.};
- double[] B = new double[3];
-
- // field at first map position should be zero since we offset the field
- testFieldAt(map, fp[0], fp[1], fp[2], 0, 0, 0);
- // field at first map position with offset included should equal first field values
- testFieldAt(map, fp[0] + off[0], fp[1] + off[1], fp[2] + off[2], 0, -0.0019, 0);
- // field at the origin
- testFieldAt(map, 0.0 + off[0], -8.9 + off[1], 0.0 + off[2], 0., -0.5006, 0.);
- // this field map is invariant in y, test this...
- testFieldAt(map, 0.0 + off[0], 0. + off[1], 0.0 + off[2], 0., -0.5006, 0.);
- testFieldAt(map, 0.0 + off[0], 8.9 + off[1], 0.0 + off[2], 0., -0.5006, 0.);
-
- //TODO check interpolation more rigorously
- //check all variations of accessor methods (why do we have SO many?!
- double[] p = {fp[0] + off[0], fp[1] + off[1], fp[2] + off[2]};
- Hep3Vector h3vP = new BasicHep3Vector(fp[0] + off[0], fp[1] + off[1], fp[2] + off[2]);
-
- map.getField(p, B);
- Hep3Vector h3vB = map.getField(h3vP);
- assertEquals(B[0], h3vB.x());
- assertEquals(B[1], h3vB.y());
- assertEquals(B[2], h3vB.z());
-
- double[] B2 = map.getField(p);
- for (int i = 0; i < 3; ++i) {
- assertEquals(B[i], B2[i]);
- }
-
- // test specifics of Cartesian3DMagneticFieldMap
- Map<String, Field> fields = det.getFields();
- assertEquals(fields.size(), 1);
- FieldMap3D cmap = (FieldMap3D) fields.get("Cartesian3DMagneticFieldMapTest");
- double[] offsets = cmap.globalOffset();
- assertEquals(offsets[0], 1.);
- assertEquals(offsets[1], 2.);
- assertEquals(offsets[2], 3.);
- }
-}