Print

Print


Commit in GeomConverter/sandbox/calorimeter on MAIN
ICellGrid2D.java+249added 1.1
JM: sandbox

GeomConverter/sandbox/calorimeter
ICellGrid2D.java added at 1.1
diff -N ICellGrid2D.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ICellGrid2D.java	28 Feb 2007 21:15:39 -0000	1.1
@@ -0,0 +1,249 @@
+// $Id: ICellGrid2D.java,v 1.1 2007/02/28 21:15:39 jeremy Exp $
+
+package org.lcsim.detector.calorimeter;
+
+/**
+ * A generic 2D grid that can be used to segment planar readout volumes.
+ * 
+ * @author Jeremy McCormick <[log in to unmask]>
+ * @version $Id: ICellGrid2D.java,v 1.1 2007/02/28 21:15:39 jeremy Exp $
+ */
+interface ICellGrid2D
+{	
+	/**
+	 * Description of coordinate system type.
+	 * x_y     : u=x,   v=y
+	 * r_phi   : u=r,   v=phi
+	 * eta_phi : u=eta, v=phi
+	 */
+    enum CoordinateSystemType
+    {
+        x_y,
+        r_phi,
+        eta_phi
+    }
+
+    /**
+     * Description of cell's 2D bounding shape.     
+     */
+    enum CellShape
+    {
+        Rectangle,
+        Hexagon,
+        Chevron,
+        Diamond
+    }
+
+    /**
+     * Get the coordinate system type.
+     * @return The type of coordinate system.
+     */
+    CoordinateSystemType coordinateSystem();
+
+    /**
+     * 
+     * @return
+     */
+    public CellShape cellShape();
+
+    /**
+     * The number of cells in the grid.
+     * @return The number of cells in the grid.    
+     */
+    public int ncells();
+
+    /**
+     * A list of all cell indices.
+     * @return An int array containing all the cell indices.
+     */
+    public int[] cells();
+
+    /**
+     * The index for the cell at the u,v coordinate.
+     * @param u
+     * @param v
+     * @return
+     */
+    public int cell(double u, double v);
+    
+	/** 
+	 * The index of the cell at row number rowNum and column number cellNum.
+	 */
+    public int cell(int rowNum, int cellNum);
+   
+    /**
+     * The 2D center point of a cell.
+     * @param cellIndex
+     * @return
+     */  
+    public double[] center(int cellIndex);
+
+    /**
+     * The distance along the v axis from the coordinate system origin to the center of a row.
+     * @param rowNumber
+     * @return
+     */ 
+    public double rowCenter(int rowNumber);
+
+    /**
+     * The distance along the u axis from the coordinate system origin to the center of a column.
+     * @param columnNumber
+     * @return
+     */
+    public double columnCenter(int columnNumber);
+
+    /**
+     * Height of row number rowNum.
+     * Determined by height of tallest cell in row.  
+     * @param rowNumber
+     * @return
+     */
+    public double rowHeight(int rowNumber);
+
+    /**
+     * Width of column number columnNumber. 
+     * Determined by widest cell in column.
+     * @param columnNumber
+     * @return
+     */
+    public double columnWidth(int columnNumber);
+   
+    /**
+     * The total number of rows. 
+     */
+    public int nrows();
+
+    /**
+     * The total number of columns.
+     * @return
+     */
+    public int ncolumns();
+    
+    /**
+     * width, height
+     * @return
+     */
+    double[] extent();
+
+    /**
+     * Width of cell.
+     * @param cellIndex
+     * @return
+     */
+    public double width(int cellIndex);
+
+    /**
+     * Heigh of cell.
+     * @param cellIndex
+     * @return
+     */
+    public double height(int cellIndex);
+
+    /** 
+     * The 2D points of a cell's corners.
+     * 
+     * @param cellIndex
+     * @return
+     */
+    public double[][] corners(int cellIndex);
+
+    /**
+     * Indices of all the cells in a row.
+     * @param rowNumber
+     * @return
+     */
+    public int[] cellsInRow(int rowNumber);
+
+    /**
+     * Indices of all cells in a column.
+     * @param columnNumber
+     * @return
+     */
+    public int[] cellsInColumn(int columnNumber);
+
+	/** 
+	 * Extent of the geometric readout plane:
+	 * [xmin,xmax,ymin,ymax] for cartesian	or
+	 * [rmin,rmax,phimin,phimax] for polar.
+	 */
+    public double[] gridExtent();
+	
+	/** 
+	 * The number of the row that contains the cell at cellIndex.
+	 */
+    public int row(int cellIndex);
+	
+	/** 
+	 * The cell number within the row. 
+	 */
+    public int column(int cellIndex);
+	
+	/**
+	 * The index of the cell nearest to the given point in 2d coordinates (x,y) or (r,phi). 
+	 */
+    public int nearestCell(double u, double v);
+	
+	/** 
+	 * True if coordinate (c1,c2) is within the given cell. 
+	 */
+    public boolean isInside(double c1, double c2, int cellIndex);
+	
+	/**
+	 * True if coordinate (c1,c2) is within any cell. 
+	 */
+    public boolean isInside(double u, double v);	
+
+    /**
+     * Get the lefthand neighbors of a cell along u.
+     * @param cellIndex The target cell.
+     * @return Array containing lefthand neighbors.
+     */
+    public int[] neighborsLeft(int cellIndex);
+
+    /**
+     * Get the right-hand neighbors of a cell along u.
+     * @param cellIndex The target cell.
+     * @return Array containing right-hand neighbors.
+     */
+    public int[] neighborsRight(int cellIndex);
+
+    /**
+     * Get the upper neighbors of a cell along v.
+     * @param cellIndex The target cell.
+     * @return Array containing upper neighbors.
+     */
+    public int[] neighborsTop(int cellIndex);
+
+    /**
+     * Get the bottom neighbors of a cell along v.
+     * @param cellIndex The target cell.
+     * @return Array containing bottom neighbors.
+     */
+    public int[] neighborsBottom(int cellIndex);
+
+    /**
+     * Return the VonNeumann neighborhood,
+     * or all non-diagonal neighbors.
+     * @param cellIndex
+     * @return
+     */
+    public int[] neighborsVonNeumann(int cellIndex);
+
+    /**
+     * Return the Moore neighborhood,
+     * or all adjacent cells.
+     * @param cellIndex
+     * @return
+     */
+    public int[] neighborsMoore(int cellIndex);
+
+    /**
+     * Calculate the distance from the point u,v
+     * to the center of the given cell.
+     * @param u
+     * @param v
+     * @param cellIndex
+     * @return
+     */
+    public double distanceToCellCenter(double u, double v, int cellIndex);   
+}
\ No newline at end of file
CVSspam 0.2.8