View Javadoc

1   package org.lcsim.geometry.compact.converter.lcdd;
2   
3   import org.jdom.Attribute;
4   import org.jdom.DataConversionException;
5   import org.jdom.Element;
6   import org.jdom.JDOMException;
7   import org.lcsim.geometry.compact.converter.lcdd.util.Calorimeter;
8   
9   /**
10   *
11   * @author jeremym
12   */
13  public class GlobalGridXY extends LCDDSegmentation 
14  {
15      private double gridSizeX;
16      private double gridSizeY;
17  
18      /** Creates a new instance of GridXYZ */
19      public GlobalGridXY(Element node) throws DataConversionException, JDOMException 
20      {
21          super(node);
22  
23          Attribute attrib = node.getAttribute("gridSizeX");
24  
25          if ( attrib != null )
26          {
27              gridSizeX = attrib.getDoubleValue();
28          }
29          else
30          {
31              throw new RuntimeException("Missing gridSizeX parameter.");
32          }
33  
34          attrib = node.getAttribute("gridSizeY");
35  
36          if ( attrib != null )
37          {            
38              gridSizeY = attrib.getDoubleValue();
39          }
40          else
41          {
42              throw new RuntimeException("Missing gridSizeY parameter.");
43          }
44      }
45  
46      void setSegmentation(Calorimeter cal)
47      {
48          org.lcsim.geometry.compact.converter.lcdd.util.GlobalGridXY g =
49              new org.lcsim.geometry.compact.converter.lcdd.util.GlobalGridXY();
50  
51          g.setGridSizeX(gridSizeX);
52          g.setGridSizeY(gridSizeY);
53  
54          cal.setSegmentation(g);
55      }
56  }