Commit in GeomConverter on MAIN
src/org/lcsim/material/Material.java+10-101.10 -> 1.11
                      /MaterialCalculator.java+55-531.3 -> 1.4
                      /MaterialElement.java+3-31.7 -> 1.8
                      /MaterialElementData.java+1-11.3 -> 1.4
                      /MaterialManager.java+2-21.5 -> 1.6
                      /XMLMaterialManager.java+17-171.10 -> 1.11
test/org/lcsim/material/MaterialFromGDMLCnvTest.java+2-11.2 -> 1.3
+90-87
7 modified files
Cleaned-up public interfaces to material classes.

GeomConverter/src/org/lcsim/material
Material.java 1.10 -> 1.11
diff -u -r1.10 -r1.11
--- Material.java	2 Jul 2005 00:28:34 -0000	1.10
+++ Material.java	2 Jul 2005 00:49:47 -0000	1.11
@@ -25,7 +25,7 @@
     public static final double DEFAULT_PRESSURE = 1.0;
     
     /* 1 mole */
-    public static final double AVOGADRO = 6.022136736e23;
+    //public static final double AVOGADRO = 6.022136736e23;
     
     public static final double MAX_RADIATION_LENGTH = java.lang.Double.MAX_VALUE;
     public static final double MAX_NUCLEAR_INTERACTION_LENGTH = java.lang.Double.MAX_VALUE;
@@ -34,13 +34,13 @@
     public static final double LAMBDA0 = 35.0;
     
     /* atomic mass unit (rest mass) in MeV */
-    public static final double AMU_C2 = 931.49432;
+    //public static final double AMU_C2 = 931.49432;
     
     /* speed of light in mm/s */
-    public static final double C_LIGHT = 299.792458;
+    //public static final double C_LIGHT = 299.792458;
     
     /* atomic mass unit */
-    public static final double AMU = AMU_C2 / (C_LIGHT * C_LIGHT);
+    //public static final double AMU = AMU_C2 / (C_LIGHT * C_LIGHT);
     
     double _temp;
     double _pressure;
@@ -148,17 +148,17 @@
         MaterialManager.addMaterial(this);
     }
     
-    int getNumberOfElements()
+    public int getNumberOfElements()
     {
         return _nElements;
     }
     
-    List<MaterialElement> getElements()
+    public List<MaterialElement> getElements()
     {
         return _elements;
     }
     
-    List<Double> getMassFractions()
+    public List<Double> getMassFractions()
     {
         return _massFractions;
     }
@@ -168,7 +168,7 @@
      *
      * Based on G4Material::AddElement() .
      */
-    void addElement(MaterialElement element,
+    public void addElement(MaterialElement element,
             int nAtoms)
     {
         //System.out.println("Material.addElement() - composite add " + element.getName() + " to " + getName() );
@@ -212,7 +212,7 @@
     }
     
     /** Add element by fraction of mass. */
-    void addElement(MaterialElement element,
+    public void addElement(MaterialElement element,
             double fraction)
     {
         //System.out.println("Material.addElement() - fraction add " + element.getName() + " to " + getName() );
@@ -251,7 +251,7 @@
     }
     
     /** Add material by fraction of mass. */
-    void addMaterial(Material material,
+    public void addMaterial(Material material,
             double fraction)
     {
         //System.out.println("Material.addElement() - fraction add " + material.getName() + " to " + getName() );

GeomConverter/src/org/lcsim/material
MaterialCalculator.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- MaterialCalculator.java	2 Jul 2005 00:28:34 -0000	1.3
+++ MaterialCalculator.java	2 Jul 2005 00:49:47 -0000	1.4
@@ -25,59 +25,7 @@
     //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) );
-//    }    
-    
-//    public static double computeNuclearInteractionLengthEstimate(double A)
-//    {        
-//        return ( Material.LAMBDA0 * pow(A, 0.33333));
-//    }
+
     
     public static double computeRadiationLengthEstimate(double A, double Z)
     {
@@ -161,3 +109,57 @@
         return NIL;
     }
 }
+
+    /*
+    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) );
+//    }    
+    
+//    public static double computeNuclearInteractionLengthEstimate(double A)
+//    {        
+//        return ( Material.LAMBDA0 * pow(A, 0.33333));
+//    }
\ No newline at end of file

GeomConverter/src/org/lcsim/material
MaterialElement.java 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- MaterialElement.java	2 Jul 2005 00:28:34 -0000	1.7
+++ MaterialElement.java	2 Jul 2005 00:49:47 -0000	1.8
@@ -126,7 +126,7 @@
 //        _tsai = MaterialCalculator.computeTsaiFactor(_Z, _coulombCorrection);
 //    }
     
-    public void computeDerivedQuantities()
+    private void computeDerivedQuantities()
     {
 //        computeCoulombFactor();
 //        computeTsaiFactor();        
@@ -134,12 +134,12 @@
         computeRadiationLength();
     }
     
-    void computeNuclearInteractionLength()
+    private void computeNuclearInteractionLength()
     {
         _nuclearInteractionLength = MaterialCalculator.computeNuclearInteractionLength( getA(), getZ() );
     }
     
-    void computeRadiationLength()
+    private void computeRadiationLength()
     {
         //_radiationLength = MaterialCalculator.computeRadiationLengthEstimate( getA(), getZ() );
         _radiationLength = MaterialCalculator.computeRadiationLengthTsai( getA(), getZ() );

GeomConverter/src/org/lcsim/material
MaterialElementData.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- MaterialElementData.java	1 Jul 2005 21:59:54 -0000	1.3
+++ MaterialElementData.java	2 Jul 2005 00:49:47 -0000	1.4
@@ -5,7 +5,7 @@
  * Ported from lelaps.
  *
  */
-public class MaterialElementData
+public abstract class MaterialElementData
 {
     protected static void defineElements()
     {        

GeomConverter/src/org/lcsim/material
MaterialManager.java 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- MaterialManager.java	1 Jul 2005 22:36:00 -0000	1.5
+++ MaterialManager.java	2 Jul 2005 00:49:48 -0000	1.6
@@ -98,12 +98,12 @@
         }
     }
     
-    public static void defineElements()
+    private static void defineElements()
     {
         MaterialElementData.defineElements();        
     }
     
-    public static void defineMaterialsForElements()
+    private static void defineMaterialsForElements()
     {
         for ( MaterialElement me : elements().values() )
         {

GeomConverter/src/org/lcsim/material
XMLMaterialManager.java 1.10 -> 1.11
diff -u -r1.10 -r1.11
--- XMLMaterialManager.java	1 Jul 2005 00:06:58 -0000	1.10
+++ XMLMaterialManager.java	2 Jul 2005 00:49:48 -0000	1.11
@@ -77,7 +77,7 @@
     }
     
     /** Setup materials in the static material instance manager. */
-    public static void setupMaterials()
+    private static void setupMaterials()
     {
         if ( !loadedMaterials )
         {
@@ -98,7 +98,7 @@
     }
     
     /** Create a material manager that has elements as parent with additional materials from InputStream. */
-    public static XMLMaterialManager create(InputStream in) throws IOException
+    private static XMLMaterialManager create(InputStream in) throws IOException
     {
         if ( in == null )
         {
@@ -136,7 +136,7 @@
     }
     
     /** Ctor for parentless XMLMaterialFactory with (optional) element data. */
-    private XMLMaterialManager(boolean loadElements)
+    public XMLMaterialManager(boolean loadElements)
     {
         parent = null;
         createMaps();
@@ -193,19 +193,19 @@
     }
     
     /** Set current document source. */
-    public void setCurrentDocument(Document d)
+    private void setCurrentDocument(Document d)
     {
         currentDoc = d;
     }
     
     /** Is the argument an element of type material? */
-    public boolean isMaterial(org.jdom.Element e)
+    public static boolean isMaterial(org.jdom.Element e)
     {
         return "material".equals(e.getName());
     }
     
     /** Is the argument an element of type element? [sic] */
-    public boolean isElement(org.jdom.Element e)
+    public static boolean isElement(org.jdom.Element e)
     {
         return "element".equals(e.getName());
     }        
@@ -243,7 +243,7 @@
      * @param d Document to search for materials element.
      *
      */
-    public org.jdom.Element getMaterialsRoot(Document d) throws JDOMException
+    private org.jdom.Element getMaterialsRoot(Document d) throws JDOMException
     {
         org.jdom.Element m = null;
         if (d.hasRootElement() )
@@ -271,13 +271,13 @@
     }
     
     /** Finds the materials element in the current document. */
-    public org.jdom.Element getMaterialsRoot() throws JDOMException
+    private org.jdom.Element getMaterialsRoot() throws JDOMException
     {
         return getMaterialsRoot(currentDoc);
     }
     
     /** Add a material to the map. */
-    public void addMaterial(org.jdom.Element e) throws JDOMException
+    private void addMaterial(org.jdom.Element e) throws JDOMException
     {
         if ( e.getName() != "material")
         {
@@ -296,7 +296,7 @@
     }
     
     /** Add an element to the map. */
-    public void addElement(org.jdom.Element e) throws JDOMException
+    private void addElement(org.jdom.Element e) throws JDOMException
     {
         //System.out.println("add element: " + e.getAttributeValue("name"));
         
@@ -425,13 +425,13 @@
     }
     
     /** Load all materials and elements from the current document. */
-    public void loadFromDocument() throws JDOMException
+    private void loadFromDocument() throws JDOMException
     {
         loadFromDocument(currentDoc);
     }
     
     /** Core method for loading material and element XML data from an external entity. */
-    public void loadFromDocument(Document d) throws JDOMException
+    private void loadFromDocument(Document d) throws JDOMException
     {
         org.jdom.Element root = getMaterialsRoot(d);
         
@@ -478,7 +478,7 @@
      * Recursively add the referenced materials or elements from a single material node.
      * It will also automatically look in the parent.
      */
-    public void addReferences(org.jdom.Element e, Document d) throws JDOMException
+    private void addReferences(org.jdom.Element e, Document d) throws JDOMException
     {
         //System.out.println("XMLMaterialManager.addReferences() - adding refs for " + e.getAttributeValue("name"));
         if ( e != null )
@@ -544,7 +544,7 @@
      * @param matName Name of material to start recursive reference lookup.
      * @param refs    List that will contain all references as XML elements.
      */
-    public void makeReferenceList(String matName, List refs) throws JDOMException
+    private void makeReferenceList(String matName, List refs) throws JDOMException
     {
         if ( refs == null )
         {
@@ -604,12 +604,12 @@
         }
     }
     
-    public void addReferences(org.jdom.Element e) throws JDOMException
+    private void addReferences(org.jdom.Element e) throws JDOMException
     {
         addReferences(e, currentDoc);
     }
     
-    public Document cloneMaterialsRoot(org.jdom.Element e) throws JDOMException
+    private Document cloneMaterialsRoot(org.jdom.Element e) throws JDOMException
     {
         if ( e.getName() != "materials" )
         {
@@ -741,7 +741,7 @@
     /**
      * Cache contents of the default chemical elements file, including their materials definitions.
      */
-    public void loadElements()
+    private void loadElements()
     {
         if ( !loadedElements )
         {

GeomConverter/test/org/lcsim/material
MaterialFromGDMLCnvTest.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- MaterialFromGDMLCnvTest.java	1 Jul 2005 00:12:25 -0000	1.2
+++ MaterialFromGDMLCnvTest.java	2 Jul 2005 00:49:49 -0000	1.3
@@ -37,7 +37,8 @@
     
     public void test_cnvNoLCDD() throws IOException, JDOMException
     {
-        MaterialElementData med = new MaterialElementData();
+        //MaterialElementData med = new MaterialElementData();
+        MaterialManager.instance();
         XMLMaterialManager f = XMLMaterialManager.create(defURL);                          
         
         //for ( MaterialElement me : MaterialManager.elements().values() )
CVSspam 0.2.8