1 added + 12 modified, total 13 files
GeomConverter
diff -u -r1.6 -r1.7
--- maven.xml 13 Jun 2005 21:27:44 -0000 1.6
+++ maven.xml 9 Aug 2007 22:44:48 -0000 1.7
@@ -5,7 +5,21 @@
<goal name="dist" prereqs="run:dist" />
<postGoal name="xdoc:register-reports">
- <attainGoal name="maven-checkstyle-plugin:deregister"/>
+ <attainGoal name="maven-checkstyle-plugin:deregister"/>
<attainGoal name="maven-license-plugin:deregister"/>
</postGoal>
+
+ <!-- Make the output directory for test files before testing starts. -->
+ <preGoal name="test:test">
+ <attainGoal name="make-test-output-dir" />
+ </preGoal>
+
+ <preGoal name="test:single">
+ <attainGoal name="make-test-output-dir" />
+ </preGoal>
+
+ <goal name="make-test-output-dir">
+ <ant:mkdir dir="${maven.build.dir}/test-output" />
+ </goal>
+
</project>
GeomConverter
diff -u -r1.2 -r1.3
--- pom2.xml 8 Aug 2007 18:45:05 -0000 1.2
+++ pom2.xml 9 Aug 2007 22:44:48 -0000 1.3
@@ -47,7 +47,27 @@
<argLine>-Xmx1024m</argLine>
</configuration>
</plugin>
+
+ <!-- Create the directory for test output. -->
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>generate-test-resources</phase>
+ <configuration>
+ <tasks>
+ <mkdir dir="${project.build.directory}/test-output" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
</plugins>
+
</build>
<repositories>
<repository>
GeomConverter/src/org/lcsim/detector/converter/heprep
diff -u -r1.8 -r1.9
--- DetectorElementToHepRepConverter.java 7 Aug 2007 22:47:53 -0000 1.8
+++ DetectorElementToHepRepConverter.java 9 Aug 2007 22:44:49 -0000 1.9
@@ -118,43 +118,21 @@
Trd trd = (Trd)geo.getLogicalVolume().getSolid();
HepRepType ec = typeTree.getType("Barrel");
- HepRepType type = factory.createHepRepType(ec, detelem.getName());
+ HepRepType type = factory.createHepRepType(ec, detelem.getName());
type.addAttValue("drawAs","Prism");
HepRepInstance instance = factory.createHepRepInstance(instanceTree, type);
- Hep3Vector points[] = new BasicHep3Vector[8];
-
- double x1 = trd.getXHalfLength1();
- double x2 = trd.getXHalfLength2();
- double y1 = trd.getYHalfLength1();
- double y2 = trd.getYHalfLength2();
- double z = trd.getZHalfLength();
-
- points[0] = new BasicHep3Vector(-x1,-y1,z);
- points[1] = new BasicHep3Vector(-x1,y1,z);
- points[2] = new BasicHep3Vector(x1,y1,z);
- points[3] = new BasicHep3Vector(x1,-y1,z);
-
- points[4] = new BasicHep3Vector(-x2,-y2,-z);
- points[5] = new BasicHep3Vector(-x2,y2,-z);
- points[6] = new BasicHep3Vector(x2,y2,-z);
- points[7] = new BasicHep3Vector(x2,-y2,-z);
-
- for (int i=0; i<points.length; i++)
- {
- Hep3Vector vec = geo.transformLocalToGlobal(points[i]);
- points[i] = vec;
- }
-
+ Hep3Vector points[] = trd.getPoints();
+
for (int i=0; i<points.length; i++)
{
- Hep3Vector vec = points[i];
+ Hep3Vector p = geo.transformLocalToGlobal(points[i]);
factory.createHepRepPoint(
instance,
- vec.x(),
- vec.y(),
- vec.z()
+ p.x(),
+ p.y(),
+ p.z()
);
}
@@ -173,7 +151,7 @@
for (int i=0; i<TRAP_POINT_ORDER.length; i++)
{
- Hep3Vector p = points[TRAP_POINT_ORDER[i]];
+ Hep3Vector p = geo.transformLocalToGlobal(points[TRAP_POINT_ORDER[i]]);
factory.createHepRepPoint(instance,p.x(),p.y(),p.z());
}
}
GeomConverter/src/org/lcsim/util/test
diff -N TestUtil.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ TestUtil.java 9 Aug 2007 22:44:49 -0000 1.1
@@ -0,0 +1,44 @@
+package org.lcsim.util.test;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+
+import org.lcsim.util.cache.FileCache;
+
+public abstract class TestUtil
+{
+ public static String getTestOutputDir()
+ {
+ return "target/test-output/";
+ }
+
+ public static class TestOutputFile extends File
+ {
+ public TestOutputFile(String filename)
+ {
+ super(getTestOutputDir() + filename);
+ }
+ }
+
+ public static class CachedInputFile
+ {
+ File file;
+
+ public CachedInputFile(String url)
+ {
+ try {
+ file = (new FileCache()).getCachedFile(new URL(url));
+ }
+ catch (IOException x)
+ {
+ throw new RuntimeException(x);
+ }
+ }
+
+ public File getFile()
+ {
+ return file;
+ }
+ }
+}
\ No newline at end of file
GeomConverter/test/org/lcsim/detector
diff -u -r1.7 -r1.8
--- ShapeRotateTest.java 7 Aug 2007 18:11:39 -0000 1.7
+++ ShapeRotateTest.java 9 Aug 2007 22:44:50 -0000 1.8
@@ -10,7 +10,6 @@
import hep.graphics.heprep.HepRepType;
import hep.graphics.heprep.HepRepTypeTree;
import hep.graphics.heprep.HepRepWriter;
-import hep.physics.vec.BasicHep3Vector;
import hep.physics.vec.Hep3Vector;
import java.awt.Color;
@@ -25,6 +24,7 @@
import org.lcsim.detector.material.IMaterial;
import org.lcsim.detector.material.MaterialElement;
import org.lcsim.detector.solids.Box;
+import org.lcsim.util.test.TestUtil.TestOutputFile;
/**
* Test case that writes out a heprep file called
@@ -58,7 +58,7 @@
public void testShapeRotate()
{
try {
- writeHepRep("ShapeRotateTest.heprep");
+ writeHepRep(new TestOutputFile("ShapeRotateTest.heprep").getAbsolutePath());
}
catch ( Throwable x )
{
GeomConverter/test/org/lcsim/detector/converter/compact
diff -u -r1.5 -r1.6
--- SiTrackerBarrelTest.java 11 Apr 2007 20:51:48 -0000 1.5
+++ SiTrackerBarrelTest.java 9 Aug 2007 22:44:50 -0000 1.6
@@ -2,16 +2,12 @@
import hep.graphics.heprep.HepRep;
import hep.graphics.heprep.HepRepFactory;
-import hep.graphics.heprep.HepRepInstance;
import hep.graphics.heprep.HepRepInstanceTree;
-import hep.graphics.heprep.HepRepPoint;
import hep.graphics.heprep.HepRepTreeID;
import hep.graphics.heprep.HepRepType;
import hep.graphics.heprep.HepRepTypeTree;
import hep.graphics.heprep.HepRepWriter;
-import hep.physics.vec.Hep3Vector;
-import java.awt.Color;
import java.io.FileOutputStream;
import java.io.InputStream;
@@ -23,6 +19,7 @@
import org.lcsim.detector.converter.heprep.DetectorElementToHepRepConverter;
import org.lcsim.geometry.Detector;
import org.lcsim.geometry.GeometryReader;
+import org.lcsim.util.test.TestUtil.TestOutputFile;
/**
*
@@ -71,7 +68,7 @@
public void testHepRep()
{
try {
- writeHepRep("SiTrackerBarrelTest.heprep");
+ writeHepRep(new TestOutputFile("SiTrackerBarrelTest.heprep").getAbsolutePath());
}
catch ( Exception x )
{
GeomConverter/test/org/lcsim/detector/solids
diff -u -r1.1 -r1.2
--- TrapTest.java 7 Aug 2007 22:47:54 -0000 1.1
+++ TrapTest.java 9 Aug 2007 22:44:50 -0000 1.2
@@ -13,12 +13,13 @@
import org.lcsim.detector.converter.heprep.DetectorElementToHepRepConverter;
import org.lcsim.detector.material.IMaterial;
import org.lcsim.detector.material.MaterialElement;
+import org.lcsim.util.test.TestUtil.TestOutputFile;
/**
* Test that writes out the HepRep for a {@link org.lcsim.detector.solids.Trap} solid.
*
* @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: TrapTest.java,v 1.1 2007/08/07 22:47:54 jeremy Exp $
+ * @version $Id: TrapTest.java,v 1.2 2007/08/09 22:44:50 jeremy Exp $
*/
public class TrapTest
@@ -31,7 +32,7 @@
public void testTrd() throws Exception
{
createGeometry();
- DetectorElementToHepRepConverter.writeHepRep("trap.heprep");
+ DetectorElementToHepRepConverter.writeHepRep(new TestOutputFile("TrapTest.heprep").getAbsolutePath());
}
public IPhysicalVolume createGeometry()
GeomConverter/test/org/lcsim/detector/solids
diff -u -r1.5 -r1.6
--- TrdTest.java 8 Aug 2007 20:20:20 -0000 1.5
+++ TrdTest.java 9 Aug 2007 22:44:50 -0000 1.6
@@ -18,12 +18,13 @@
import org.lcsim.detector.converter.heprep.DetectorElementToHepRepConverter;
import org.lcsim.detector.material.IMaterial;
import org.lcsim.detector.material.MaterialElement;
+import org.lcsim.util.test.TestUtil.TestOutputFile;
/**
* Test that writes out the HepRep for a {@link org.lcsim.detector.solids.Trd}.
*
* @author Jeremy McCormick
- * @version $Id: TrdTest.java,v 1.5 2007/08/08 20:20:20 jeremy Exp $
+ * @version $Id: TrdTest.java,v 1.6 2007/08/09 22:44:50 jeremy Exp $
*/
public class TrdTest
@@ -36,7 +37,7 @@
public void testTrd() throws Exception
{
createGeometry();
- DetectorElementToHepRepConverter.writeHepRep("trd.heprep");
+ DetectorElementToHepRepConverter.writeHepRep(new TestOutputFile("TrdTest.heprep").getAbsolutePath());
}
public IPhysicalVolume createGeometry()
GeomConverter/test/org/lcsim/geometry/compact/converter
diff -u -r1.2 -r1.3
--- MainTest.java 23 Jul 2005 01:12:56 -0000 1.2
+++ MainTest.java 9 Aug 2007 22:44:51 -0000 1.3
@@ -4,7 +4,12 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;
-import junit.framework.*;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.lcsim.util.test.TestUtil.TestOutputFile;
/**
@@ -51,7 +56,7 @@
*/
public void testMain() throws Throwable
{
- String[] args = (tempFile.getAbsolutePath()+" temp.heprep").split(" ");
+ String[] args = (tempFile.getAbsolutePath()+" " + new TestOutputFile("temp.heprep").getAbsolutePath()).split(" ");
Main.main(args);
}
GeomConverter/test/org/lcsim/geometry/compact/converter/lcdd
diff -u -r1.1 -r1.2
--- EcalBarrel_ConverterTest.java 21 Jan 2006 02:41:36 -0000 1.1
+++ EcalBarrel_ConverterTest.java 9 Aug 2007 22:44:51 -0000 1.2
@@ -8,6 +8,8 @@
import junit.framework.TestCase;
import junit.framework.TestSuite;
+import org.lcsim.util.test.TestUtil.TestOutputFile;
+
/**
*
* @author jeremym
@@ -22,7 +24,7 @@
public void testEcalBarrel_Converter() throws Exception
{
InputStream in = EcalBarrel_ConverterTest.class.getResourceAsStream("/org/lcsim/geometry/subdetector/EcalBarrelTest.xml");
- File file = new File("EcalBarrel_ConverterTest.lcdd");
+ File file = new TestOutputFile("EcalBarrel_ConverterTest.lcdd");
OutputStream out = new FileOutputStream(file);
new Main(true).convert("EcalBarrel_ConverterTest",in,out);
}
GeomConverter/test/org/lcsim/geometry/compact/converter/lcdd
diff -u -r1.4 -r1.5
--- PolyhedraBarrelCalorimeterConverterTest.java 17 Oct 2006 22:14:54 -0000 1.4
+++ PolyhedraBarrelCalorimeterConverterTest.java 9 Aug 2007 22:44:51 -0000 1.5
@@ -8,6 +8,8 @@
import junit.framework.TestCase;
import junit.framework.TestSuite;
+import org.lcsim.util.test.TestUtil.TestOutputFile;
+
/**
*
* @author jeremym
@@ -28,7 +30,7 @@
PolyhedraBarrelCalorimeterConverterTest.class.
getResourceAsStream(
"/org/lcsim/geometry/subdetector/PolyhedraBarrelCalorimeterTest.xml");
- OutputStream out = new BufferedOutputStream(new FileOutputStream("PolyhedraBarrelCalorimeterTest.lcdd"));
+ OutputStream out = new BufferedOutputStream(new FileOutputStream(new TestOutputFile("PolyhedraBarrelCalorimeterTest.lcdd")));
new Main(true).convert("PolyhedraBarrelCalorimeterTest",in,out);
}
}
\ No newline at end of file
GeomConverter/test/org/lcsim/geometry/compact/converter/lcdd
diff -u -r1.2 -r1.3
--- PolyhedraEndcapCalorimeterConverterTest.java 17 Oct 2006 23:20:04 -0000 1.2
+++ PolyhedraEndcapCalorimeterConverterTest.java 9 Aug 2007 22:44:51 -0000 1.3
@@ -6,6 +6,8 @@
import junit.framework.TestCase;
import junit.framework.TestSuite;
+import org.lcsim.util.test.TestUtil.TestOutputFile;
+
/**
*
* @author jeremym
@@ -26,6 +28,6 @@
PolyhedraEndcapCalorimeterConverterTest.class.
getResourceAsStream(
"/org/lcsim/geometry/subdetector/PolyhedraEndcapCalorimeterTest.xml");
- new Main(true).convert("PolyhedraEndcapCalorimeterTest",in,new FileOutputStream("PolyhedraEndcapCalorimeterTest.lcdd"));
+ new Main(true).convert("PolyhedraEndcapCalorimeterTest",in,new FileOutputStream(new TestOutputFile("PolyhedraEndcapCalorimeterTest.lcdd")));
}
}
\ No newline at end of file
GeomConverter/test/org/lcsim/geometry/compact/converter/lcdd
diff -u -r1.1 -r1.2
--- SiTrackerBarrelTest.java 6 Oct 2006 19:11:29 -0000 1.1
+++ SiTrackerBarrelTest.java 9 Aug 2007 22:44:51 -0000 1.2
@@ -8,6 +8,8 @@
import junit.framework.TestCase;
import junit.framework.TestSuite;
+import org.lcsim.util.test.TestUtil.TestOutputFile;
+
/**
*
* @author jeremym
@@ -27,7 +29,7 @@
public void test_converter() throws Exception
{
InputStream in = SiTrackerBarrel.class.getResourceAsStream("/org/lcsim/geometry/subdetector/SiTrackerBarrelTest.xml");
- OutputStream out = new BufferedOutputStream(new FileOutputStream("SiTrackerBarrelTest.lcdd"));
+ OutputStream out = new BufferedOutputStream(new FileOutputStream(new TestOutputFile("SiTrackerBarrelTest.lcdd")));
new Main(true).convert("SiTrackerBarrelTest",in,out);
}
}
CVSspam 0.2.8