View Javadoc

1   package org.lcsim.geometry.layer;
2   
3   import org.lcsim.material.Material;
4   import org.lcsim.material.MaterialManager;
5   import org.lcsim.material.MaterialNotFoundException;
6   
7   /**
8    * @author Jeremy McCormick <jeremym@slac.stanford.edu>
9    * @version $Id: LayerSlice.java,v 1.12 2011/03/11 19:22:20 jeremy Exp $
10   */
11  public class LayerSlice
12  {
13      private boolean sensitive;
14      private Material material = null;
15      private double thickness;
16  
17      public LayerSlice()
18      {
19          material = null;
20          thickness = 0.0;
21          sensitive = false;
22      }
23  
24      public LayerSlice(String matName, double w, boolean sens)
25      {
26  
27          material = MaterialManager.instance().getMaterial(matName);
28          if (material == null)
29          {
30              throw new RuntimeException("The material " + matName + " was not found.");
31          }
32  
33          thickness = w;
34          sensitive = sens;
35      }
36  
37      private LayerSlice(Material m, double w, boolean sens)
38      {
39          if (m == null)
40          {
41              throw new IllegalArgumentException("Material argument cannot be null.");
42          }
43  
44          material = m;
45          thickness = w;
46          sensitive = sens;
47      }
48  
49      public Material getMaterial()
50      {
51          return material;
52      }
53  
54      public double getThickness()
55      {
56          return thickness;
57      }
58  
59      public boolean isSensitive()
60      {
61          return sensitive;
62      }
63  
64      public void setMaterial(Material m)
65      {
66          if (m == null)
67          {
68              throw new IllegalArgumentException("Material argument to LayerSlice is null!");
69          }
70          material = m;
71      }
72  
73      public void setThickness(double t)
74      {
75          if (t < 0.0)
76          {
77              throw new IllegalArgumentException("Thickness cannot be < 0.0");
78          }
79          thickness = t;
80      }
81  
82      public void setIsSensitive(boolean s)
83      {
84          sensitive = s;
85      }
86  }