2 added + 6 modified, total 8 files
GeomConverter/src/org/lcsim/material
diff -N RadiationLengthCalculator.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ RadiationLengthCalculator.java 1 Jul 2005 21:59:54 -0000 1.1
@@ -0,0 +1,71 @@
+/*
+ * CoulombCorrectionCalculator.java
+ *
+ * Created on July 1, 2005, 11:18 AM
+ */
+
+package org.lcsim.material;
+
+import static java.lang.Math.log;
+
+/**
+ *
+ * @author jeremym
+ */
+abstract public class RadiationLengthCalculator
+{
+ /* Coulomb correction factors from G4Element via Phys Rev. D50 3-1 (1994) page 1254 */
+ public static final double[] COULOMB_CORRECTIONS = { 0.0083, 0.20206, 0.0020, 0.0369 };
+
+ /* Fine structure constant from PDG July 2004, Table 1.1 */
+ public static final double FINE_STRUCTURE_CONSTANT = 1 / 137.03599911;
+
+ /* Tsai constants from G4Element::ComputeLradTsaiFactor() via Phys Rev. D50 3-1 (1994) page 1254 */
+ public static final double[] TSAI_LRAD_LIGHT = { 5.31, 4.79, 4.74, 4.71 };
+ public static final double[] TSAI_LPRAD_LIGHT = { 6.144, 5.621, 5.805, 5.924 };
+
+ public static double computeCoulombCorrection(double Z)
+ {
+ if ( Z <= 0 )
+ {
+ throw new IllegalArgumentException("Z cannot be <= 0.");
+ }
+
+ double az2 = (FINE_STRUCTURE_CONSTANT * Z) * (FINE_STRUCTURE_CONSTANT * Z);
+ double az4 = az2 * az2;
+
+ double coulomb = (COULOMB_CORRECTIONS[0] * az4 + COULOMB_CORRECTIONS[1] +
+ 1.0/(1.0 + az2)) * az2 - (COULOMB_CORRECTIONS[2] * az4 + COULOMB_CORRECTIONS[3]) * az4;
+
+ return coulomb;
+ }
+
+ public static double computeTsaiFactor(double Z, double coulombCorrection)
+ {
+ double logZ3 = log(Z) / 3.0;
+ int iz = (int) (Z + 0.5) - 1;
+
+ double lrad, lprad;
+ if ( iz <= 3)
+ {
+ lrad = TSAI_LRAD_LIGHT[iz];
+ lprad = TSAI_LPRAD_LIGHT[iz];
+ }
+ else
+ {
+ lrad = log(184.15) - logZ3;
+ lprad = log(1194.0) - 2 * logZ3;
+ }
+
+ /**
+ * FINE_STRUCTURE_CONSTANT is actually 'alpha_rcl2' in G4Element but this is same as F.S.C. in CLHEP.
+ */
+ double tsai = 4 * FINE_STRUCTURE_CONSTANT * Z * ( Z * (lrad * coulombCorrection) + lprad);
+ return tsai;
+ }
+
+ public static double computeTsaiFactor(double Z)
+ {
+ return computeTsaiFactor(Z, computeCoulombCorrection(Z) );
+ }
+}
GeomConverter/src/org/lcsim/material
diff -u -r1.6 -r1.7
--- Material.java 1 Jul 2005 21:49:10 -0000 1.6
+++ Material.java 1 Jul 2005 21:59:54 -0000 1.7
@@ -405,6 +405,16 @@
_nuclearInteractionLength = (NILinv <= 0.0 ? MAX_NUCLEAR_INTERACTION_LENGTH : 1.0/NILinv);
}
+ double estimateNuclearInteractionLength()
+ {
+ return ( 35.0 * pow(_A, (1/3)) );
+ }
+
+ double estimateRadiationLength()
+ {
+ return (180.0 * _A / ( _Z * _Z));
+ }
+
public double getRadiationLength()
{
return _radiationLength;
@@ -423,12 +433,14 @@
public String toString()
{
- return "name=" + getName() + "; nComponents=" + _nComponents +
- "; nElements=" + _nElements + "; temp=" + _temp +
- "; pressure=" + _pressure + "; density=" + _density +
- "; state=" + _state.toString() + "; elecPerVol=" +
+ return "Material=" + getName() + "; nComponents=" + _nComponents +
+ "; nElements=" + _nElements + "; temp=" + _temp + "\t\n" +
+ "pressure=" + _pressure + "; density=" + _density +
+ "; state=" + _state.toString() + "\t\n" + "elecPerVol=" +
_totalElectronsPerVolume + "; NIL=" + _nuclearInteractionLength +
"; NILmat=" + getNuclearInteractionLengthForMaterial() +
- "; RL=" + _radiationLength;
+ "; RL=" + _radiationLength +
+ "; NILestimate: " + estimateNuclearInteractionLength() +
+ "; RLestimate: " + estimateRadiationLength();
}
}
\ No newline at end of file
GeomConverter/src/org/lcsim/material
diff -u -r1.3 -r1.4
--- MaterialElement.java 1 Jul 2005 00:08:39 -0000 1.3
+++ MaterialElement.java 1 Jul 2005 21:59:54 -0000 1.4
@@ -1,6 +1,4 @@
package org.lcsim.material;
-import java.util.Map;
-import java.util.TreeMap;
public class MaterialElement
{
@@ -8,10 +6,13 @@
private String _fullName; // Element full name
private double _Z; // Element Z
private double _A; // Atomic weight in mol/cc
+ private double _N; // effective number of nucleons
private double _density; // Density in g/cm^3 at 25 degrees C or at boiling point for liquids
private double _meltingPoint; // Melting point (K)
private double _boilingPoint; // Boiling point (K)
private double _ionizationPotential; // Ionization potential (eV)
+ private double _coulombCorrection;
+ private double _tsai;
/*
private static String[] ElementNotes = {
@@ -41,6 +42,10 @@
_fullName = fullName;
_Z = Z;
_A = A;
+
+ /* Geant4 writes the constant as 'g/mole'. */
+ _N = _A / 6.24151e+21;
+
_density = density;
_meltingPoint = mp;
_boilingPoint = bp;
@@ -74,6 +79,12 @@
{
return _A;
}
+
+ public double getN()
+ {
+ return _N;
+ }
+
public double getDensity()
{
return _density;
@@ -104,4 +115,27 @@
{
return _name;
}
+
+ public double getTsaiFactor()
+ {
+ return _tsai;
+ }
+
+ public void computeCoulombFactor()
+ {
+ /* calculate radiation length */
+ _coulombCorrection = RadiationLengthCalculator.computeCoulombCorrection(_Z);
+ }
+
+ public void computeTsaiFactor()
+ {
+ /* compute Tsai factor, using Z plus coulomb (so it doesn't need to be recomputed) */
+ _tsai = RadiationLengthCalculator.computeTsaiFactor(_Z, _coulombCorrection);
+ }
+
+ public void computeDerivedQuantities()
+ {
+ computeCoulombFactor();
+ computeTsaiFactor();
+ }
}
\ No newline at end of file
GeomConverter/src/org/lcsim/material
diff -u -r1.2 -r1.3
--- MaterialElementData.java 1 Jul 2005 00:09:22 -0000 1.2
+++ MaterialElementData.java 1 Jul 2005 21:59:54 -0000 1.3
@@ -9,7 +9,7 @@
{
protected static void defineElements()
{
- MaterialElement vacuum = new MaterialElement( "vacuum", "vacuum" , 0, 0.0 , 0.0 , 0.0 , 0.0 , 0.0 );
+// MaterialElement vacuum = new MaterialElement( "vacuum", "vacuum" , 0, 0.0 , 0.0 , 0.0 , 0.0 , 0.0 );
MaterialElement Hydrogen = new MaterialElement( "H" , "Hydrogen" , 1, 1.00794 , 0.0708 , 13.81 , 20.28 , 13.598 );
MaterialElement Deuterium = new MaterialElement( "D" , "Deuterium" , 1, 2.0140 , 0.16 , 15.0 , 23.4 , -1 );
MaterialElement Helium = new MaterialElement( "He", "Helium" , 2, 4.002602 , 0.124901 , 0.94999999, 4.22 , 24.587 );
GeomConverter/src/org/lcsim/material
diff -u -r1.3 -r1.4
--- MaterialManager.java 1 Jul 2005 00:07:38 -0000 1.3
+++ MaterialManager.java 1 Jul 2005 21:59:54 -0000 1.4
@@ -6,6 +6,7 @@
package org.lcsim.material;
+import java.io.PrintStream;
import java.util.HashMap;
import java.util.Map;
@@ -116,4 +117,18 @@
material.addElement( me, 1.0);
}
}
+
+ public static void printMaterials(PrintStream ps)
+ {
+ ps.println("MaterialManager - dumping materials database...");
+ for ( Material m : materials().values() )
+ {
+ ps.println(m.toString());
+ }
+ }
+
+ public static void printMaterials()
+ {
+ printMaterials(System.out);
+ }
}
\ No newline at end of file
GeomConverter/src/org/lcsim/material
diff -u -r1.3 -r1.4
--- MaterialState.java 1 Jul 2005 00:07:14 -0000 1.3
+++ MaterialState.java 1 Jul 2005 21:59:54 -0000 1.4
@@ -25,11 +25,11 @@
*/
public String toString()
{
- String className = getClass().getName();
- int lastDot = className.lastIndexOf('.');
- if(lastDot!=-1)className = className.substring(lastDot+1);
+ //String className = getClass().getName();
+ //int lastDot = className.lastIndexOf('.');
+ //if(lastDot!=-1)className = className.substring(lastDot+1);
- return className+" "+_state;
+ return _state;
}
static MaterialState getMaterialState(org.jdom.Element materialElement) throws JDOMException
GeomConverter/src/org/lcsim/material
diff -u -r1.3 -r1.4
--- materials.xml 1 Jul 2005 00:05:59 -0000 1.3
+++ materials.xml 1 Jul 2005 21:59:54 -0000 1.4
@@ -1,10 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<materials>
+
+ <!--
+ Air by weight from
+
+ http://www.engineeringtoolbox.com/air-composition-24_212.html
+ -->
<material name="Air">
<D type="density" unit="g/cm3" value="0.0012"/>
- <fraction n="0.7803" ref="N"/>
- <fraction n="0.2103" ref="O"/>
- <fraction n="0.0094" ref="Ar"/>
+ <fraction n="0.754" ref="N"/>
+ <fraction n="0.234" ref="O"/>
+ <fraction n="0.012" ref="Ar"/>
</material>
<material name="Epoxy">
GeomConverter/test/org/lcsim/material
diff -N MaterialManagerTest.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ MaterialManagerTest.java 1 Jul 2005 21:59:55 -0000 1.1
@@ -0,0 +1,43 @@
+/*
+ * MaterialManagerTest.java
+ *
+ * Created on July 1, 2005, 2:25 PM
+ */
+
+package org.lcsim.material;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ *
+ * @author jeremym
+ */
+public class MaterialManagerTest extends TestCase
+{
+ MaterialManager mgr;
+
+ /** Creates a new instance of MaterialManagerTest */
+ public MaterialManagerTest()
+ {}
+
+ public MaterialManagerTest(String testName)
+ {
+ super(testName);
+ }
+
+ public static TestSuite suite()
+ {
+ return new TestSuite(MaterialManagerTest.class);
+ }
+
+ protected void setUp()
+ {}
+
+ public void test_materialsBasic()
+ {
+ MaterialManager mgr = MaterialManager.instance();
+ mgr.printMaterials();
+ }
+}
\ No newline at end of file
CVSspam 0.2.8