View Javadoc

1   package org.lcsim.material;
2   
3   /**
4    * A class to represent chemical elements.
5    * @author jeremym
6    * @version $Id: MaterialElement.java,v 1.12 2011/03/11 19:22:20 jeremy Exp $
7    */
8   public class MaterialElement
9   {
10      private String _name;                     // formula
11      private double _Z;                        // atomic number
12      private double _A;                        // atomic weight 
13      private double _nuclearInteractionLength; // lambda
14      private double _radiationLength;          // X0 
15       
16      //public static final double AVOGADRO = 6.24151e+21;   
17      
18      /**
19       * The ctor for the element class.
20       * @param name The name of the element; same as formula.
21       * @param Z The atomic number.
22       * @param A The atomic mass.
23       * @param X0 The radiation length.
24       * @param lambda The nuclear interaction length.
25       */
26      MaterialElement(String name,                    
27              double Z,
28              double A,
29              double X0,
30              double lambda)
31      {
32          // Set parameters.
33          _name = name;
34          _Z = Z;
35          _A = A;
36          _radiationLength = X0;
37          _nuclearInteractionLength = lambda;
38          
39          // Add the element to the static MaterialManager instance.
40          MaterialManager.instance().addElement(this);
41      }            
42     
43      /**
44       * Get the atomic number of the element.
45       * @return The atomic number.
46       */
47      public double getZ()
48      {
49          return _Z;
50      }
51      
52      /**
53       * Get the atomic weight of the element.
54       * @return The atomic weight.
55       */
56      public double getA()
57      {
58          return _A;
59      }
60              
61      /**
62       * Get the name of the element.
63       * @return The name of the element.
64       */
65      public String getName()
66      {
67          return _name;
68      }
69          
70      /**
71       * Get the nuclear interaction length of the element (cm).
72       * @return The nuclear interaction length in cm.
73       */
74      public double getNuclearInteractionLength()
75      {
76          return _nuclearInteractionLength;
77      }   
78      
79      /**
80       * Get the radiation length of the element (cm).
81       * @return The nuclear interaction length in cm.
82       */
83      public double getRadiationLength()
84      {
85          return _radiationLength;
86      }
87      
88      /**
89       * Convert to String.
90       * @return String representation.
91       */
92      public String toString()
93      {
94          return getName()  + "; Z=" + _Z + "; A=" + _A +  "; X0=" + _radiationLength + "; lambda=" + _nuclearInteractionLength;
95      }    
96  }