View Javadoc

1   package org.lcsim.geometry.compact.converter.lcdd.util;
2   
3   import org.jdom.DataConversionException;
4   import org.jdom.Element;
5   
6   /**
7    *
8    * @author tonyj
9    */
10  public class Tube extends Solid
11  {
12      public Tube(String name, double innerR, double outerR, double zHalf)
13      {
14          super("tube",name);
15          setRMin(innerR);
16          setRMax(outerR);
17          // FIXME: GDML will divide this by 2 so need to double it!
18          setZ(zHalf*2);
19          setAttribute("deltaphi", String.valueOf(Math.PI * 2) );
20      }
21      
22      public Tube(String name, Element element)
23      {
24          super("tube",name);
25          try {
26              setRMin(element.getAttribute("rmin").getDoubleValue());
27              setRMax(element.getAttribute("rmax").getDoubleValue());
28              // FIXME: GDML will divide this by 2 so need to double it!
29              setZ(element.getAttribute("zhalf").getDoubleValue() * 2);
30          }
31          catch (DataConversionException x)
32          {
33              throw new RuntimeException(x);
34          }
35          setAttribute("deltaphi", String.valueOf(Math.PI * 2) );
36      }
37  
38      /** Creates a new instance of Tube */
39      public Tube(String name)
40      {
41          super("tube",name);
42  
43          /** 
44           * Set default deltaphi to 360 deg, i.e. full tube segment.        
45           */
46          setAttribute("deltaphi", String.valueOf(Math.PI * 2) );
47  
48          /** 
49           * Set default rmin to 0.0.      
50           */
51          setAttribute("rmin", "0.0");
52      }
53      public void setZ(double z)
54      {
55          setAttribute("z",String.valueOf(z));
56      }
57      public void setRMin(double r)
58      {
59          setAttribute("rmin",String.valueOf(r));
60      }
61      public void setRMax(double r)
62      {
63          setAttribute("rmax",String.valueOf(r));
64      }
65      public void setDeltaPhi(double phi)
66      {
67          setAttribute("deltaphi",String.valueOf(phi));
68      }
69  }