GeomConverter/src/org/lcsim/material
diff -u -r1.14 -r1.15
--- Material.java 18 Jul 2005 17:58:31 -0000 1.14
+++ Material.java 20 Jul 2005 01:01:28 -0000 1.15
@@ -22,42 +22,65 @@
public static final double DEFAULT_TEMPERATURE = 273.15;
/* Default pressure in atmospheres = 1.0 */
- public static final double DEFAULT_PRESSURE = 1.0;
-
+ public static final double DEFAULT_PRESSURE = 1.0;
+
+ /* Maximum RL and NIL */
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;
-
+ public static final double MAX_NUCLEAR_INTERACTION_LENGTH = java.lang.Double.MAX_VALUE;
+
+ /* temperature in Kelvin */
double _temp;
+
+ /* pressure in atmospheres */
double _pressure;
+
+ /* density in g/cm3 */
double _density;
+
+ /* corresponds to single MaterialElement? */
boolean _isElement;
+
+ /* Z value */
public double _Z;
+
+ /* A value */
public double _A;
- public double _Neff;
+
+ /* state */
MaterialState _state;
+
+ /* short name for lookup */
String _name;
- String _formula;
+ /* chemical formula */
+ String _formula;
+
int _nComponents;
int _nComponentsMax;
- int _nElements;
+
+ /* number of elements in mass fraction list */
+ int _nElements;
+ /* list of elements making up this material */
private List<MaterialElement> _elements = new ArrayList<MaterialElement>();
+
+ /* list of mass fractions corresponding to each element in elements list */
private List<Double> _massFractions = new ArrayList<Double>();
+
+ /* number of atoms corresponding to each element in elements list */
private List<Integer> _atoms = new ArrayList<Integer>();
- private List<Double> _nAtomsPerVolume = new ArrayList<Double>();
/* radiation length in g/cm2 */
double _radiationLength;
/* radiation length in cm, taking into account the density */
- double _radiationLengthWithDensity;
+ double _radiationLengthWithDensity;
/* nuclear interaction length in g/cm2 */
double _nuclearInteractionLength;
/* NIL in cm, taking into account the density */
- double _nuclearInteractionLengthWithDensity;
+ double _nuclearInteractionLengthWithDensity;
/* Construct base material with all info, creating a MaterialElement, also. */
public Material(String name,
@@ -126,6 +149,128 @@
MaterialManager.addMaterial(this);
}
+ public String getName()
+ {
+ return _name;
+ }
+
+ public double getDensity()
+ {
+ return _density;
+ }
+
+ public double getPressure()
+ {
+ return _pressure;
+ }
+
+ public boolean isElement()
+ {
+ return _isElement;
+ }
+
+ public double getZ()
+ {
+ return _Z;
+ }
+
+ public double getA()
+ {
+ return _A;
+ }
+
+ public double getTemperature()
+ {
+ return _temp;
+ }
+
+ public void setFormula(String formula)
+ {
+ _formula = formula;
+ }
+
+ public int getNComponents()
+ {
+ return _nComponents;
+ }
+
+ public int getNComponentsMax()
+ {
+ return _nComponentsMax;
+ }
+
+ public int getNElements()
+ {
+ return _nElements;
+ }
+
+ public MaterialState getState()
+ {
+ return _state;
+ }
+
+ /* compute NIL based on mass fractions */
+ private double computeNuclearInteractionLength()
+ {
+ double NILinv = 0.0;
+
+ for (int i = 0; i < _nElements; i++)
+ {
+ MaterialElement me = _elements.get(i);
+ NILinv += _massFractions.get(i) / me.getNuclearInteractionLength();
+ }
+
+ _nuclearInteractionLength = (NILinv <= 0.0 ? MAX_NUCLEAR_INTERACTION_LENGTH : 1.0/NILinv);
+ _nuclearInteractionLengthWithDensity = _nuclearInteractionLength / _density;
+
+ return NILinv;
+ }
+
+ /** compute RL based on mass fractions */
+ private double computeRadiationLength()
+ {
+ double rlinv = 0.0;
+
+ for (int i = 0; i < _nElements; i++)
+ {
+ MaterialElement me = _elements.get(i);
+ rlinv += _massFractions.get(i) / me.getRadiationLength();
+ }
+
+ _radiationLength = (rlinv <= 0.0 ? MAX_RADIATION_LENGTH : 1.0/rlinv);
+ _radiationLengthWithDensity = _radiationLength / _density;
+
+ return _radiationLength;
+ }
+
+ private void computeDerivedQuantities()
+ {
+ computeRadiationLength();
+ computeNuclearInteractionLength();
+ }
+
+ public double getRadiationLength()
+ {
+ return _radiationLength;
+ }
+
+ public double getNuclearInteractionLength()
+ {
+ return _nuclearInteractionLength;
+ }
+
+ /* get NIL/density in cm */
+ public double getNuclearInteractionLengthWithDensity()
+ {
+ return _nuclearInteractionLengthWithDensity;
+ }
+
+ /* get RL/density in cm */
+ public double getRadiationLengthWithDensity()
+ {
+ return _radiationLengthWithDensity;
+ }
+
public int getNumberOfElements()
{
return _nElements;
@@ -274,7 +419,7 @@
++_nElements;
}
}
- ++_nComponents;
+ ++_nComponents;
}
else
{
@@ -302,106 +447,19 @@
}
if ( abs(1 - weightSum) > 0.001 )
- {
- throw new RuntimeException("Mass fractions do not sum to 1 within 0.001 tolerance for this material: " + getName() );
- }
- }
-
- public String getName()
- {
- return _name;
- }
-
- public void setFormula(String formula)
- {
- _formula = formula;
- }
-
- public int getNComponents()
- {
- return _nComponents;
- }
-
- public int getNComponentsMax()
- {
- return _nComponentsMax;
- }
-
- public int getNElements()
- {
- return _nElements;
- }
-
- public void computeDerivedQuantities()
- {
- computeRadiationLength();
- computeNuclearInteractionLength();
- }
-
- /* compute NIL based on mass fractions */
- private double computeNuclearInteractionLength()
- {
- double NILinv = 0.0;
-
- for (int i = 0; i < _nElements; i++)
{
- MaterialElement me = _elements.get(i);
- NILinv += _massFractions.get(i) / me.getNuclearInteractionLength();
- }
-
- _nuclearInteractionLength = (NILinv <= 0.0 ? MAX_NUCLEAR_INTERACTION_LENGTH : 1.0/NILinv);
- _nuclearInteractionLengthWithDensity = _nuclearInteractionLength / _density;
-
- return NILinv;
- }
-
- /** compute RL based on mass fractions */
- private double computeRadiationLength()
- {
- double rlinv = 0.0;
-
- for (int i = 0; i < _nElements; i++)
- {
- MaterialElement me = _elements.get(i);
- rlinv += _massFractions.get(i) / me.getRadiationLength();
+ throw new RuntimeException("Mass fractions do not sum to 1 within 0.001 tolerance for this material: " + getName() );
}
-
- _radiationLength = (rlinv <= 0.0 ? MAX_RADIATION_LENGTH : 1.0/rlinv);
- _radiationLengthWithDensity = _radiationLength / _density;
-
- return _radiationLength;
}
-
- public double getRadiationLength()
- {
- return _radiationLength;
- }
-
- public double getNuclearInteractionLength()
- {
- return _nuclearInteractionLength;
- }
-
- /* get NIL/density in cm */
- public double getNuclearInteractionLengthWithDensity()
- {
- return _nuclearInteractionLengthWithDensity;
- }
-
- /* get RL/density in cm */
- public double getRadiationLengthWithDensity()
- {
- return _radiationLengthWithDensity;
- }
public String toString()
{
return "Material=" + getName() + "; nComponents=" + _nComponents +
"; nElements=" + _nElements + "; temp(K)=" + _temp + "\t\n" +
"pressure(atmos)=" + _pressure + "; density(g/cm3)=" + _density +
- "; state=" + _state.toString() + "\t\n" + "NIL(gcm2)=" +
+ "; state=" + _state.toString() + "\t\n" + "NIL(gcm2)=" +
_nuclearInteractionLength + "; RL(gcm2)=" + _radiationLength +
"; NIL(cm)" + getNuclearInteractionLengthWithDensity() +
- "; RL(cm)" + getRadiationLengthWithDensity();
+ "; RL(cm)" + getRadiationLengthWithDensity();
}
}
\ No newline at end of file