View Javadoc

1   /*
2    * PolyconeSupport.java
3    * 
4    * Created on October 31, 2005, 10:18 AM
5    */
6   
7   package org.lcsim.geometry.subdetector;
8   
9   import org.jdom.Element;
10  import org.jdom.DataConversionException;
11  import org.jdom.JDOMException;
12  import java.util.List;
13  import java.util.ArrayList;
14  import java.util.Iterator;
15  import org.lcsim.material.Material;
16  import org.lcsim.material.MaterialManager;
17  
18  /**
19   * @author Jeremy McCormick <jeremym@slac.stanford.edu>
20   * @version $Id: PolyconeSupport.java,v 1.8 2013/05/01 20:48:35 jeremy Exp $
21   */
22  public class PolyconeSupport extends AbstractSubdetector {
23  
24      List<ZPlane> zplanes = new ArrayList<ZPlane>();
25      Material material;
26  
27      public PolyconeSupport(Element node) throws JDOMException {
28          super(node);
29          material = MaterialManager.instance().getMaterial(node.getChild("material").getAttributeValue("name"));
30          for (Iterator i = node.getChildren("zplane").iterator(); i.hasNext();) {
31              try {
32                  Element zplane = (Element) i.next();
33                  zplanes.add(new ZPlane(zplane.getAttribute("rmin").getDoubleValue(), zplane.getAttribute("rmax").getDoubleValue(), zplane.getAttribute("z").getDoubleValue()));
34              } catch (DataConversionException dce) {
35                  throw new RuntimeException("bad values to zplane", dce);
36              }
37          }
38      }
39  
40      public Material getMaterial() {
41          return material;
42      }
43  
44      public List<ZPlane> getZPlanes() {
45          return zplanes;
46      }
47  
48      public int getNumberOfZPlanes() {
49          return zplanes.size();
50      }
51  
52      public ZPlane getZPlane(int idx) {
53          return zplanes.get(idx);
54      }
55  
56      public static class ZPlane {
57  
58          double rmin, rmax, z;
59  
60          public ZPlane(double rmin, double rmax, double z) {
61              this.rmin = rmin;
62              this.rmax = rmax;
63              this.z = z;
64          }
65  
66          public double getRMin() {
67              return rmin;
68          }
69  
70          public double getRMax() {
71              return rmax;
72          }
73  
74          public double getZ() {
75              return z;
76          }
77      }
78  }