View Javadoc

1   package org.lcsim.geometry.compact;
2   
3   import org.jdom.Element;
4   import org.jdom.DataConversionException;
5   
6   /**
7    * 
8    * @author jeremym
9    */
10  public class Region {
11  
12      private String name;
13      private boolean storeSecondaries = false;
14      private boolean killTracks = false;
15      private double rangeCut;
16      private String lunit;
17      private double energyThreshold;
18      private String eunit;
19  
20      protected Region(Element node) {
21          name = node.getAttributeValue("name");
22  
23          try {
24              if (node.getAttribute("storeSecondaries") != null) {
25                  storeSecondaries = node.getAttribute("storeSecondaries").getBooleanValue();
26              }
27          } catch (DataConversionException dce) {
28              throw new RuntimeException("Problem converting " + node.getAttributeValue("storeSecondaries") + " to boolean", dce);
29          }
30          
31          try {
32              if (node.getAttribute("killTracks") != null) {
33                  killTracks = node.getAttribute("killTracks").getBooleanValue();
34              }
35          } catch (DataConversionException dce) {
36              throw new RuntimeException("Problem converting to boolean: " + node.getAttributeValue("killTracks"));
37          }
38  
39          try {
40              if (node.getAttribute("cut") != null) {
41                  rangeCut = node.getAttribute("cut").getDoubleValue();
42              } else {
43                  rangeCut = 1.0;
44              }
45          } catch (DataConversionException dce) {
46              throw new RuntimeException("Problem converting " + node.getAttributeValue("cut") + " to double", dce);
47          }
48  
49          if (node.getAttribute("lunit") != null) {
50              lunit = node.getAttributeValue("lunit");
51          } else {
52              lunit = "mm";
53          }
54  
55          try {
56              if (node.getAttribute("threshold") != null) {
57                  energyThreshold = node.getAttribute("threshold").getDoubleValue();
58              } else {
59                  energyThreshold = 0.0;
60              }
61          } catch (DataConversionException dce) {
62              throw new RuntimeException("Problem converting " + node.getAttributeValue("threshold") + " to double", dce);
63          }
64  
65          if (node.getAttribute("eunit") != null) {
66              eunit = node.getAttributeValue("eunit");
67          } else {
68              eunit = "MeV";
69          }
70      }
71  
72      public String getName() {
73          return name;
74      }
75  
76      public boolean getStoreSecondaries() {
77          return storeSecondaries;
78      }
79      
80      public boolean getKillTracks() {
81          return killTracks;
82      }
83  
84      public double getRangeCut() {
85          return rangeCut;
86      }
87  
88      public String getLengthUnit() {
89          return lunit;
90      }
91  
92      public double getEnergyThreshold() {
93          return energyThreshold;
94      }
95  
96      public String getEnergyUnit() {
97          return eunit;
98      }
99  }