View Javadoc

1   /*
2    * Segmentation.java Created on June 1, 2005, 2:05 PM
3    */
4   
5   package org.lcsim.geometry.segmentation;
6   
7   import java.util.ArrayList;
8   import java.util.List;
9   
10  import org.lcsim.geometry.Layered;
11  import org.jdom.Element;
12  import org.lcsim.geometry.layer.Layering;
13  import org.lcsim.geometry.CylindricalSubdetector;
14  import hep.physics.vec.Hep3Vector;
15  
16  /**
17   * @author jeremym Base implementation of Segmentation.
18   */
19  public abstract class SegmentationBase extends org.lcsim.geometry.compact.Segmentation
20  {
21      
22      public SegmentationBase(Element e)
23      {
24          super(e);
25      }
26      
27      public abstract String[] getSegmentationFieldNames();
28  
29      /**
30       * Returns the cell which contains a given point (x,y,z).
31       * 
32       * @param x Cartesian X coordinate.
33       * @param y Cartesian Y coordinate.
34       * @param z Cartesian Z coordinate.     
35       *
36       * @return ID of cell containing the point (maybe either in absorber or live
37       *         material), or <em>zero</em> if the point is not inside this
38       *         component.
39       */
40      abstract public long findCellContainingXYZ(double x, double y, double z);
41  
42      /**
43       * Returns the cell which contains a given point (x,y,z).
44       * 
45       * @param pos
46       *            3-dim array with cartesian coordinates of the point
47       * @return ID of cell containing the point (maybe either in absorber or live
48       *         material), or <em>zero</em> if the point is not inside this
49       *         component.
50       */
51      public long findCellContainingXYZ(double[] pos)
52      {
53          return findCellContainingXYZ(pos[0], pos[1], pos[2]);
54      }
55  
56      /**
57       * Returns the cell which contains a given point (x,y,z).
58       * 
59       * @param pos
60       *            Hep3Vector with cartesian coordinates of the point
61       * @return ID of cell containing the point (maybe either in absorber or live
62       *         material), or <em>zero</em> if the point is not inside this
63       *         component.
64       */
65      public long findCellContainingXYZ(Hep3Vector pos)
66      {
67          return findCellContainingXYZ(pos.x(), pos.y(), pos.z());
68      }
69  
70      /**
71       * @deprecated
72       */
73      protected int getNumberOfLayers()
74      {
75          return ((Layered) detector).getLayering().getLayerCount();
76      }
77  
78      protected double[] transformLocalToGlobal(double[] localPos)
79      {
80          return detector.transformLocalToGlobal(localPos);
81      }
82  
83      /**
84       * @deprecated
85       */
86      protected Layering getLayering()
87      {
88          return ((Layered) detector).getLayering();
89      }
90  
91      /**
92       * @deprecated
93       */
94      protected double getZMin()
95      {
96          return ((CylindricalSubdetector) detector).getZMin();
97      }
98  
99      /**
100      * @deprecated
101      */
102     protected double getZMax()
103     {
104         return ((CylindricalSubdetector) detector).getZMax();
105     }
106 
107     /**
108      * @deprecated
109      */
110     protected double getRMin()
111     {
112         return ((CylindricalSubdetector) detector).getInnerRadius();
113     }
114 
115     /**
116      * @deprecated
117      */
118     protected double getRMax()
119     {
120         return ((CylindricalSubdetector) detector).getOuterRadius();
121     }
122     
123     /**
124      * @deprecated
125      */
126     public double getDistanceToSensitive(int layer)
127     {
128         return ((Layered) detector).getLayering().getDistanceToLayerSensorMid(layer);
129     }
130     
131 	public boolean supportsNeighbours()
132 	{
133 		return true;
134 	}
135 	
136 	public long getID()
137 	{
138 		return this.getDecoder().getID();
139 	}	
140 }