GeomConverter/test/org/lcsim/material
diff -N RadiationLengthTest.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ RadiationLengthTest.java 28 Feb 2011 21:48:59 -0000 1.1
@@ -0,0 +1,34 @@
+package org.lcsim.material;
+
+import junit.framework.TestCase;
+
+/**
+ * This is a test of radiation length values calculated by the {@link MaterialManager}.
+ * Answer key is taken from values at
+ * {@link http://pdg.lbl.gov/2010/AtomicNuclearProperties}.
+ *
+ * @author jeremym
+ * @version $Id: RadiationLengthTest.java,v 1.1 2011/02/28 21:48:59 jeremy Exp $
+ */
+// FIXME Hydrogen X0 with density is wrong.
+public class RadiationLengthTest extends TestCase
+{
+ String materialLookup[] = {"Tungsten", "Lead", "Silicon", "Boron"};
+ double radLenKey[] = {6.76, 6.37, 21.82, 52.69};
+ double radLenDensKey[] = {0.3504, 0.5612, 9.370, 22.23};
+ public void testRadLen()
+ {
+ MaterialManager mgr = MaterialManager.instance();
+ System.out.println("Material radLen, radLenDens");
+ for (int i=0, n=materialLookup.length; i<n; i++)
+ {
+ Material material = mgr.getMaterial(materialLookup[i]);
+ String materialName = material.getName();
+ System.out.println(materialName + " "
+ + material.getRadiationLength() + ", "
+ + material.getRadiationLengthWithDensity());
+ assertEquals(material.getRadiationLength(), radLenKey[i], 0.01);
+ assertEquals(material.getRadiationLengthWithDensity(), radLenDensKey[i], 0.01);
+ }
+ }
+}