GeomConverter/test/org/lcsim/material
diff -u -r1.7 -r1.8
--- BetheBlockTest.java 27 Jan 2006 00:37:22 -0000 1.7
+++ BetheBlockTest.java 2 May 2006 20:31:31 -0000 1.8
@@ -1,26 +1,20 @@
-/*
- * MaterialManagerTest.java
- *
- * Created on July 1, 2005, 2:25 PM
- */
-
package org.lcsim.material;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.lcsim.material.Material;
-import org.lcsim.material.MaterialElement;
+import hep.physics.particle.properties.ParticlePropertyManager;
+import hep.physics.particle.properties.ParticlePropertyProvider;
+import hep.physics.particle.properties.ParticleType;
/**
*
* @author jeremym
*/
public class BetheBlockTest extends TestCase
-{
- private double m_muon = 105.658369;
- private double m_pion = 139.57018;
- private double p_default[] = {1.0, 0, 0};
+{
+ private static ParticlePropertyProvider pinfo =
+ ParticlePropertyManager.getParticlePropertyProvider();
/** Creates a new instance of MaterialManagerTest */
public BetheBlockTest()
@@ -28,8 +22,7 @@
public BetheBlockTest(String testName)
{
- super(testName);
- MaterialManager.instance();
+ super(testName);
}
public static TestSuite suite()
@@ -37,95 +30,37 @@
return new TestSuite(BetheBlockTest.class);
}
- public void test_MuonInCarbon()
- {
- // 1 GeV
- double p[] =
- { 1.0, 0, 0 };
-
- runTest("Carbon", "muon", m_muon, 1.0, p );
-
- // 10 GeV
- p[0] = 10.0;
- runTest("Carbon", "muon", m_muon, 1.0, p );
-
- // 200 MeV
- p[0] = 0.2;
-
- runTest("Carbon", "muon", m_muon, 1.0, p );
-
- // 100 MeV
- p[0] = 0.1;
- runTest("Carbon", "muon", m_muon, 1.0, p );
- }
-
- public void test_MuonInSilicon()
- {
- // 1 GeV
- double p[] =
- { 1.0, 0, 0 };
- runTest("Silicon", "muon", m_muon, 1.0, p );
-
- // 10 GeV
- p[0] = 10.0;
- runTest("Silicon", "muon", m_muon, 1.0, p );
-
- // 200 MeV
- p[0] = 0.2;
- runTest("Silicon", "muon", m_muon, 1.0, p );
- }
-
- public void test_MuonInIron()
- {
- runTest("Iron", "muon", m_muon, 1.0, p_default);
- }
-
- public void test_MuonInHydrogen()
- {
- runTest("Hydrogen", "muon", m_muon, 1.0, p_default);
- }
-
- public void test_PionInCarbon()
+ public void test_All()
{
- // 1 GeV
- double p[] =
- { 1.0, 0, 0 };
- runTest("Carbon", "pion", m_pion, 1.0, p);
-
- // 10 GeV
- p[0] = 10.0;
-
- runTest("Carbon", "pion", m_pion, 1.0, p);
-
- // 200 MeV
- p[0] = 0.2;
-
- runTest("Carbon", "pion", m_pion, 1.0, p);
-
- // 100 MeV
- p[0] = 0.1;
-
- runTest("Carbon", "pion", m_pion, 1.0, p);
+ MaterialManager.instance();
+ double[] p = {10,50,100,200,500,1000,2000,5000,10000};
+ String[] materials = {"Copper","Iron","Silicon","Lead","Hydrogen","Helium","Carbon"};
+ int[] pdgids = {11,13,211,321,2212};
+
+ for (double pp : p)
+ {
+ for (String m : materials)
+ {
+ for (int pdg : pdgids)
+ {
+ ParticleType ptype = pinfo.get(pdg);
+ double mass = ptype.getMass();
+ double charge = ptype.getCharge();
+ double[] parr = {pp, 0, 0};
+ String pname = ptype.getName();
+ this.run(m, pname, mass, charge, parr);
+ }
+ }
+ }
}
- private void runTest(String materialName, String particle, double mass,
+ private void run(String materialName, String particle, double mass,
double charge, double[] p)
{
- System.out.println("----------");
- System.out.println("Running BetheBlochTest for " + particle + " in " + materialName + "...");
-
- System.out.println("");
Material material = MaterialManager.getMaterials().get(materialName);
assert (material != null);
- System.out.println(material.toString());
- System.out.println("");
-
- System.out.println("particle=" + particle + "; momentum=(" + p[0]
- + ", " + p[1] + ", " + p[2] + "); mass=" + mass + "; charge=" + charge);
- System.out.println("");
-
double dEdx = MaterialCalculator.computeBetheBloch(material,
p, mass, charge, 1.0);
- System.out.println("dEdx(MeV/cm)="+dEdx);
+ System.out.println(particle + " " + p[0] + " " + materialName + " " + dEdx);
}
}
\ No newline at end of file