View Javadoc

1   package org.lcsim.geometry.layer;
2   
3   import org.jdom.Element;
4   import org.jdom.JDOMException;
5   
6   /**
7    * Provides access to layering information in a subdetector.
8    * 
9    * @author Jeremy McCormick <jeremym@slac.stanford.edu>
10   */
11  public class Layering 
12  {    
13      protected LayerStack layerStack;
14      protected double offset = 0;
15      
16      public static Layering makeLayering(Element e) throws JDOMException
17      {
18          return new Layering(e);
19      }
20      
21      /** 
22       * @param e The XML element representing the subdetector in the compact format.
23       */
24      public Layering(Element e) throws JDOMException
25      {        
26          // Create the LayerStack using static conversion function.
27          layerStack = LayerFromCompactCnv.makeLayerStackFromCompact(e);
28      }
29      
30      public Layering(LayerStack s)
31      {
32      	layerStack = s;
33      }
34      
35      public double getDistanceToLayer(int layer)
36      {
37          return getLayerStack().getThicknessToLayerFront(layer) + offset;
38      }
39      
40      public double getDistanceToLayerBack(int layer)
41      {
42      	return getLayerStack().getThicknessToLayerBack(layer) + offset;
43      }
44      
45      /** alias to getLayerStack() */
46      public LayerStack getLayers()
47      {
48          return getLayerStack();
49      }
50  
51      public Layer getLayer(int i)
52      {
53          return getLayerStack().getLayer(i);
54      }
55      
56      public double getThickness()
57      {
58          return getLayerStack().getTotalThickness();
59      }
60      
61      public LayerStack getLayerStack()
62      {
63          return layerStack;
64      }
65      
66      public int getLayerCount()
67      {
68          return getLayerStack().getNumberOfLayers();
69      }       
70      
71      public int getNumberOfLayers()
72      {
73          return getLayerCount();
74      }
75      
76      public int size()
77      {
78          return getLayerCount();
79      }
80      
81      public double getDistanceToLayerSensorMid(int layer)
82      {
83          return getDistanceToLayer(layer) + 
84                 getLayerStack().getLayer(layer).getThicknessToSensitiveMid();
85      }
86      
87      public double getDistanceToLayerSensorFront(int layer)
88      {
89      	return getDistanceToLayer(layer) + getLayerStack().getLayer(layer).getThicknessToSensitive();
90      }
91      
92      public double getDistanceToLayerSensorBack(int layer)
93      {    	
94      	return getDistanceToLayerSensorFront(layer) + getLayer(layer).getSensorThickness();
95      }
96              
97      public void setOffset(double o)
98      {
99          offset = o;
100     }
101     
102     public double getOffset()
103     {
104         return offset;
105     }
106 }