1 package org.lcsim.geometry.subdetector;
2
3 import org.jdom.Element;
4 import org.jdom.JDOMException;
5 import org.lcsim.geometry.CylindricalSubdetector;
6
7
8
9
10
11 abstract class AbstractCylindricalTracker extends AbstractTracker implements CylindricalSubdetector
12 {
13 private double zmax;
14 private double zmin;
15 private double rmin;
16 private double rmax;
17
18 public AbstractCylindricalTracker( Element node ) throws JDOMException
19 {
20 super( node );
21 build( node );
22 }
23
24 private void build( Element node ) throws JDOMException
25 {
26 Element dimensions = node.getChild( "dimensions" );
27
28 if ( dimensions == null )
29 {
30 throw new JDOMException( "Missing dimensions element." );
31 }
32
33 rmin = dimensions.getAttribute( "inner_r" ).getDoubleValue();
34 zmax = dimensions.getAttribute( "outer_z" ).getDoubleValue();
35 if ( dimensions.getAttribute( "inner_z" ) != null )
36 {
37 zmin = dimensions.getAttribute( "inner_z" ).getDoubleValue();
38 }
39 else
40 {
41 zmin = -zmax;
42 }
43 rmax = rmin + getLayering().getLayers().getTotalThickness();
44 getLayering().setOffset( rmin );
45 }
46
47 public double getZMax()
48 {
49 return zmax;
50 }
51
52 public double getZMin()
53 {
54 return zmin;
55 }
56
57 public double getOuterRadius()
58 {
59 return rmax;
60 }
61
62 public double getInnerRadius()
63 {
64 return rmin;
65 }
66 }