Commit in lcsim/src/org/lcsim/contrib/onoprien/vsegment/geom on MAIN
sensortype/Cylinder.java+158added 1.1
          /Hexagon.java+136added 1.1
          /Rectangle.java+294added 1.1
          /Ring.java+88added 1.1
          /WedgeSideParallel.java+184added 1.1
sensortypes/Cylinder.java-1581.1 removed
           /Hexagon.java-1361.1 removed
           /Rectangle.java-2941.1 removed
           /Ring.java-881.1 removed
           /WedgeSideParallel.java-1841.1 removed
+860-860
5 added + 5 removed, total 10 files
Updated SensorTypes

lcsim/src/org/lcsim/contrib/onoprien/vsegment/geom/sensortype
Cylinder.java added at 1.1
diff -N Cylinder.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Cylinder.java	3 Sep 2008 04:28:29 -0000	1.1
@@ -0,0 +1,158 @@
+package org.lcsim.contrib.onoprien.vsegment.geom.sensortype;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Vector;
+
+import org.lcsim.contrib.onoprien.vsegment.geom.SensorType;
+import org.lcsim.contrib.onoprien.vsegment.hit.ITrackerHit;
+import org.lcsim.contrib.onoprien.vsegment.transform.IRefFrame;
+
+/**
+ * This class represents a cylindrical sensor with strips parallel to its axis.
+ * The reference frame is cylindrical (U,V,W = Phi,Z,R), with the position of origin 
+ * controled by <tt>Hep3Vector center</tt> parameter given to a constructor.
+ * If <tt>center = (Phi0,Z0,R0)</tt>, then the sensor volume of the cylinder will be defined by 
+ * <tt><nobr>Phi0-PI < u < Phi0+PI ,</nobr> 
+ * <nobr>Z0-length < v < Z0+length ,</nobr> 
+ * <nobr>R0-thickness/2 < w < R0+thickness/2</nobr></tt>. 
+ * Constructors that do not require <tt>center</tt> parameter assume
+ * <nobr><tt>center = (0.,0.,radius)</tt></nobr>,
+ * placing the local reference frame origin in the center of the detector with 
+ * <tt>phi</tt> ranging from <tt>-PI</tt> to <tt>PI</tt>.
+ *
+ * @author D.Onoprienko
+ * @version $Id: Cylinder.java,v 1.1 2008/09/03 04:28:29 onoprien Exp $
+ */
+public class Cylinder extends Rectangle {
+  
+// -- Constructors :  ----------------------------------------------------------
+  
+  /**
+   * Create <tt>Cylinder</tt> instance.
+   * The <tt>center</tt> parameter controls offsets in the local reference frame.
+   *
+   * @param length      Length of the cylinder (along strip direction).
+   * @param radius      Radius of the cylinder.
+   * @param thickness   Thickness of the sensor.
+   * @param nLength     Number of divisions along the cylinder length.
+   * @param nPhi        Number of divisions in phi.
+   * @param center      Controls definition of the local reference frame
+   */
+  public Cylinder(double radius, double length, double thickness, int nPhi, int nLength, Hep3Vector center) {
+    super(TWOPI, length, thickness, nPhi, nLength, center);
+    _hitType = ((length/nLength)/(TWOPI*radius/nPhi) < 4.) ? ITrackerHit.Type.PIXEL : ITrackerHit.Type.STRIP;
+  }
+  
+  /**
+   * Create <tt>Cylinder</tt> instance.
+   *
+   * @param length      Length of the cylinder (along strip direction).
+   * @param radius      Radius of the cylinder.
+   * @param thickness   Thickness of the sensor.
+   * @param nLength     Number of divisions along the cylinder length.
+   * @param nPhi        Number of divisions in phi.
+   */
+  public Cylinder(double radius, double length, double thickness, int nPhi, int nLength) {
+    this(radius, length, thickness, nPhi, nLength, new BasicHep3Vector(0.,0.,radius));
+  }
+  
+  /**
+   * Create <tt>Cylinder</tt> instance.
+   * Strip width will be adjusted to make sure integral number of strips fits the 
+   * circumference of the cylinder.
+   *
+   * @param length       Length of the cylinder (along strip direction).
+   * @param radius       Radius of the cylinder.
+   * @param thickness    Thickness of the sensor.
+   * @param stripPitch   Strip width.
+   * @param stripLength  Strip length.
+   * @param center       Controls definition of the local reference frame
+   */
+  public Cylinder(double radius, double length, double thickness, double stripPitch, double stripLength, Hep3Vector center) {
+    this(radius, length, thickness, (int) Math.round((TWOPI*radius)/stripPitch), (int) Math.round(length/stripLength), center);
+  }
+  
+  /**
+   * Create <tt>Cylinder</tt> instance.
+   * Strip width will be adjusted to make sure integral number of strips fits the 
+   * circumference of the cylinder.
+   *
+   * @param length       Length of the cylinder (along strip direction).
+   * @param radius       Radius of the cylinder.
+   * @param thickness    Thickness of the sensor.
+   * @param stripPitch   Strip width.
+   * @param stripLength  Strip length.
+   */
+  public Cylinder(double radius, double length, double thickness, double stripPitch, double stripLength) {
+    this(radius, length, thickness, stripPitch, stripLength, new BasicHep3Vector(0.,0.,radius));
+  }
+
+// -----------------------------------------------------------------------------
+
+  /**
+   * Converts a point in local sensor coordinates to channel ID.
+   * Returns -1 if the point is outside of sensor sensitive area.
+   */
+  public int getChannelID(Hep3Vector point) {
+    
+//    if (Math.abs(point.z()-_wCenter) > _thick/2.) return -1;
+
+    double u = point.x();
+    double v = point.y();
+
+    int nV = (int) Math.floor((v-_vLow)/_length);
+    if ((nV < 0) || (nV >= _nDivV)) return -1;
+
+    int nU = (int) Math.floor((u-_uLow)/_pitch); 
+    while (nU < 0) nU += _nDivU;
+    while (nU >= _nDivU) nU -= _nDivU;
+
+    return nV*_nDivU + nU;
+  }
+  
+  /**
+   * Returns channel ID of a neighbor channel.
+   * Returns -1 if the channel defined by shifts does not exist on this sensor.
+   *
+   * @param channelID  ID of the original channel
+   * @param shiftV     move in <tt>V</tt> direction by <tt>shiftV</tt> channels
+   * @param shiftU     move in <tt>U</tt> direction by <tt>shiftU</tt> channels
+   */
+  public int getNeighbor(int channelID, int shiftU, int shiftV) {
+    int nV = (channelID / _nDivU) + shiftV;
+    if (nV < 0 || nV >= _nDivV) return -1;
+    int nU = (channelID % _nDivU) + shiftU;
+    while (nU < 0) nU += _nDivU;
+    while (nU >= _nDivU) nU -= _nDivU;
+    return nV*_nDivU + nU;
+  }
+  
+  /** 
+   * Returns array of IDs of all immediate neighbor channels. 
+   * For strips ({@link #getHitDimension()} returns 1), this method looks for neighbors
+   * in U direction only. Therefore, each strip has 1 or 2 neighbors. For pixels
+   * ({@link #getHitDimension()} returns 2), up to 8 neighbors can be found.
+   */
+  public List<Integer> getNeighbors(int channelID) {
+    int nU = channelID % _nDivU;
+    int nV = channelID / _nDivU;
+    ArrayList<Integer> out = new ArrayList<Integer>(8);
+    int vDown = ((_hitType.nMeasDir() == 2) && (nV > 0)) ? nV-1 : nV;
+    int vUp = ((_hitType.nMeasDir() == 2) && (nV < _nDivV-1)) ? nV+1 : nV;
+    for (int iV = vDown; iV < vUp; iV++) {
+      for (int iU = nU-1; iU < nU+1; iU++) {
+        while (nU < 0) nU += _nDivU;
+        while (nU >= _nDivU) nU -= _nDivU;
+        out.add(nV*_nDivU + nU);
+      }
+    }
+    return out;
+  }
+
+// -- Private parts :  ---------------------------------------------------------
+  
+  static final double TWOPI = 2.*Math.PI;
+}

lcsim/src/org/lcsim/contrib/onoprien/vsegment/geom/sensortype
Hexagon.java added at 1.1
diff -N Hexagon.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Hexagon.java	3 Sep 2008 04:28:29 -0000	1.1
@@ -0,0 +1,136 @@
+package org.lcsim.contrib.onoprien.vsegment.geom.sensortype;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Vector;
+
+import org.lcsim.contrib.onoprien.vsegment.geom.SensorType;
+import org.lcsim.contrib.onoprien.vsegment.hit.ITrackerHit;
+import org.lcsim.contrib.onoprien.vsegment.transform.IRefFrame;
+
+/**
+ * This class represents a hexagonal sensor with strips parallel to its side.
+ * The reference frame origin is at the center of the sensor.
+ * <p>
+ * Note: sensor thickness is ignored in the current implementation - <tt>getCnannel(position)</tt> 
+ * method does not check whether the specified position belongs to the sensitive volume. The reference
+ * surface is defined by the <tt>W = 0</tt> plane in the sensor local reference frame.
+ *
+ * @author D.Onoprienko
+ * @version $Id: Hexagon.java,v 1.1 2008/09/03 04:28:29 onoprien Exp $
+ */
+public class Hexagon implements SensorType {
+  
+// -- Constructors :  ----------------------------------------------------------
+  
+  /**
+   * Create <tt>Hexagon</tt> instance.
+   *
+   * @param sideLength      Length of the hexagon side.
+   * @param thickness       Thickness of the sensor.
+   * @param nU              Number of divisions along U (measurement direction, perpendicular to strips).
+   */
+  public Hexagon(double sideLength, double thickness, int nU) {
+    _side = sideLength;
+    _halfWidth = sideLength*COSPI6;
+    _halfThick = thickness/2.;
+    _nDivU = nU;
+    _pitch = (2.*_halfWidth)/nU;
+  }
+
+// -----------------------------------------------------------------------------
+
+  /**
+   * Converts a point in local sensor coordinates to channel ID.
+   * Returns -1 if the point is outside of sensor sensitive area.
+   */
+  public int getChannelID(Hep3Vector point) {
+    
+//    if (Math.abs(point.z()) > _halfThick) return -1;
+
+    double u = point.x();
+    double v = point.y();
+    if (Math.abs(u) > _halfWidth || Math.abs(v) > _side - Math.abs(u)*TANPI6) return -1;
+    
+    int nU = (int) Math.floor((u+_halfWidth)/_pitch); if (nU == _nDivU) nU--;
+    return nU;
+  }
+  
+  /**
+   * Returns position of the center of the given channel, in local sensor coordinates.
+   */
+  public Hep3Vector getChannelPosition(int channelID) {
+    double u = (channelID + .5) * _pitch - _halfWidth;
+    return new BasicHep3Vector(u,0.,0.);
+  }
+
+  /** Returns maximum possible channel ID on this sensor. */
+  public int getMaxChannelID() {
+    return  _nDivU - 1;
+  }
+  
+  /** Returns <tt>true</tt> if channel with this ID exists on this sensor. */
+  public boolean isValidChannelID(int channelID) {
+    return channelID > -1 && channelID < _nDivU;
+  }
+  
+  /**
+   * Returns dimensions of the given channel along U, V, W.
+   */
+  public Hep3Vector getChannelDimensions(int channelID) {
+    double u = (channelID + .5) * _pitch - _halfWidth;
+    double stripLength = 2.* (_side - Math.abs(u)*TANPI6);
+    return new BasicHep3Vector(_pitch, stripLength, 0.);
+  }
+  
+  
+  /**
+   * Returns the dimension of a measurement by this type of sensor (<tt>STRIP</tt> since 
+   * <tt>WedgeSideParallel</tt> is always tiled with strips).
+   */
+  public ITrackerHit.Type getHitType() {return ITrackerHit.Type.STRIP;}
+  
+  /**
+   * Returns local cartesian reference frame at the specified position in local sensor coordinates.
+   * For this type of sensor, the specified sensor reference frame is returned, independent of position.
+   */
+  public IRefFrame getLocalFrame(IRefFrame sensorFrame, Hep3Vector position) {
+    return sensorFrame;
+  }
+  
+  /**
+   * Returns channel ID of a neighbor channel.
+   * Returns -1 if the channel defined by shifts does not exist on this sensor.
+   *
+   * @param channelID  ID of the original channel
+   * @param shiftV     move in <tt>V</tt> direction by <tt>shiftV</tt> channels
+   * @param shiftU     move in <tt>U</tt> direction by <tt>shiftU</tt> channels
+   */
+  public int getNeighbor(int channelID, int shiftU, int shiftV) {
+    int nU = channelID + shiftU;
+    return (nU < 0 || nU >= _nDivU || shiftV != 0) ? -1 : nU ;
+  }
+  
+  /** Returns array of IDs of all immediate neighbor channels. */
+  public List<Integer> getNeighbors(int channelID) {
+    ArrayList<Integer> out = new ArrayList<Integer>(2);
+    if (channelID > 0) out.add(channelID - 1);
+    if (channelID < (_nDivU - 1)) out.add(channelID + 1);
+    return out;
+  }
+  
+// -- Private parts :  ---------------------------------------------------------
+  
+  protected double _side;
+  protected double _halfWidth;
+  protected double _halfThick;
+  
+  protected double _pitch;
+  
+  protected int _nDivU;
+  
+  protected final double COSPI6 = Math.sqrt(3.)/2.;
+  protected final double TANPI6 = 1./Math.sqrt(3.);
+}

lcsim/src/org/lcsim/contrib/onoprien/vsegment/geom/sensortype
Rectangle.java added at 1.1
diff -N Rectangle.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Rectangle.java	3 Sep 2008 04:28:29 -0000	1.1
@@ -0,0 +1,294 @@
+package org.lcsim.contrib.onoprien.vsegment.geom.sensortype;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Vector;
+
+import org.lcsim.contrib.onoprien.vsegment.geom.SensorType;
+import org.lcsim.contrib.onoprien.vsegment.hit.ITrackerHit;
+import org.lcsim.contrib.onoprien.vsegment.transform.IRefFrame;
+
+/**
+ * This class represents a rectangular sensor with rectangular strips or pixel sparallel to its side.
+ * <p>
+ * Note: sensor thickness is ignored in the current implementation - <tt>getCnannel(position)</tt> 
+ * method does not check whether the specified position belongs to the sensitive volume. The reference
+ * surface is defined by the <tt>W = 0</tt> plane in the sensor local reference frame.
+ *
+ * @author D.Onoprienko
+ * @version $Id: Rectangle.java,v 1.1 2008/09/03 04:28:29 onoprien Exp $
+ */
+public class Rectangle implements SensorType {
+  
+// -- Constructors :  ----------------------------------------------------------
+  
+  /** Default constructor for use by subclusses. No initialization. */
+  public Rectangle() {}
+  
+  /**
+   * Create an instance of <tt>Rectangle</tt>.
+   * The <tt>center</tt> parameter controls how the local reference frame origin
+   * is positioned with respect to the cuboid defining the sensor volume.
+   *
+   * @param width       Width of the sensor.
+   * @param length      Length of the sensor (along strip direction).
+   * @param thickness   Thickness of the sensor.
+   * @param nWidth      Number of divisions across the sensor width.
+   * @param nLength     Number of divisions along the sensor length.
+   * @param center      Position of the sensor volume cuboid center in the local reference frame.
+   */
+  public Rectangle(double width, double length, double thickness, 
+                   int nWidth, int nLength, Hep3Vector center) {
+    if (nLength == 0) nLength = 1;
+    _uLow = center.x() - width/2.;
+    _vLow = center.y() - length/2.;
+    _wCenter = center.z();
+    _pitch = width/nWidth;
+    _length = length/nLength;
+    _thick = thickness;
+    _hitType = (_length/_pitch < 4.) ? ITrackerHit.Type.PIXEL : ITrackerHit.Type.STRIP;
+    _nDivV = nLength;
+    _nDivU = nWidth;
+//    System.out.println("Rect w "+width+" len "+length+" thick "+thickness+" nW "+nWidth+" nL "+nLength+" center "+center);
+//    System.out.println(" pitch "+_pitch+" length "+_length+" thick "+_thick+" hitDim "+_hitDim);
+  }
+  
+  /**
+   * Create <tt>Rectangle</tt> instance.
+   * Reference frame origin will be in the center of the cuboid defining the sensor volume.
+   *
+   * @param width       Width of the sensor.
+   * @param length      Length of the sensor (along strip direction).
+   * @param thickness   Thickness of the sensor.
+   * @param nWidth      Number of divisions across the sensor width.
+   * @param nLength     Number of divisions along the sensor length.
+   */
+  public Rectangle(double width, double length, double thickness, int nWidth, int nLength) {
+    this(width, length, thickness, nWidth, nLength, new BasicHep3Vector());
+  }
+  
+  /**
+   * Create <tt>Rectangle</tt> instance.
+   * The <tt>center</tt> parameter controls how the local reference frame origin
+   * is positioned with respect to the cuboid defining the sensor volume.
+   * Strip width will be rounded to place integral number of strips on the rectangle.
+   *
+   * @param width       Width of the sensor.
+   * @param length      Length of the sensor (along strip direction).
+   * @param thickness   Thickness of the sensor.
+   * @param stripPitch  Strip width.
+   * @param nLength     Number of divisions along the sensor length.
+   * @param center      Position of the cuboid center in the local reference frame
+   */
+  public Rectangle(double width, double length, double thickness, 
+                   double stripPitch, int nLength, Hep3Vector center) {
+    this(width, length, thickness, (int)Math.round(width/stripPitch), nLength, center);
+  }
+  
+  /**
+   * Create <tt>Rectangle</tt> instance.
+   * Reference frame origin will be in the center of the cuboid defining the sensor volume.
+   * Strip width will be rounded to place integral number of strips on the rectangle.
+   *
+   * @param width       Width of the sensor.
+   * @param length      Length of the sensor (along strip direction).
+   * @param thickness   Thickness of the sensor.
+   * @param stripPitch  Strip width.
+   * @param nLength     Number of divisions along the sensor length.
+   */
+  public Rectangle(double width, double length, double thickness, 
+                   double stripPitch, int nLength) {
+    this(width, length, thickness, (int)Math.round(width/stripPitch), nLength, new BasicHep3Vector());
+  }
+  
+  /**
+   * Create <tt>Rectangle</tt> instance.
+   * The <tt>center</tt> parameter controls how the local reference frame origin
+   * is positioned with respect to the cuboid defining the sensor volume.
+   * Strip length will be rounded to place integral number of strips on the rectangle.
+   *
+   * @param width         Width of the sensor.
+   * @param length        Length of the sensor (along strip direction).
+   * @param thickness     Thickness of the sensor.
+   * @param nWidth        Number of divisions across the sensor width.
+   * @param stripLength   Strip length.
+   * @param center        Position of the cuboid center in the local reference frame
+   */
+  public Rectangle(double width, double length, double thickness, 
+                   int nWidth, double stripLength, Hep3Vector center) {
+    this(width, length, thickness, nWidth, (int)Math.round(length/stripLength), center);
+  }
+  
+  /**
+   * Create <tt>Rectangle</tt> instance.
+   * Reference frame origin will be in the center of the cuboid defining the sensor volume.
+   * Strip length will be rounded to place integral number of strips on the rectangle.
+   *
+   * @param width         Width of the sensor.
+   * @param length        Length of the sensor (along strip direction).
+   * @param thickness     Thickness of the sensor.
+   * @param nWidth        Number of divisions across the sensor width.
+   * @param stripLength   Strip length.
+   */
+  public Rectangle(double width, double length, double thickness, 
+                   int nWidth, double stripLength) {
+    this(width, length, thickness, nWidth, (int)Math.round(length/stripLength), new BasicHep3Vector());
+  }
+  
+  /**
+   * Create <tt>Rectangle</tt> instance.
+   * The <tt>center</tt> parameter controls how the local reference frame origin
+   * is positioned with respect to the cuboid defining the sensor volume.
+   * Strip width and length will be rounded to place integral number of strips on the rectangle.
+   *
+   * @param width         Width of the sensor.
+   * @param length        Length of the sensor (along strip direction).
+   * @param thickness     Thickness of the sensor.
+   * @param stripPitch    Strip width.
+   * @param stripLength   Strip length.
+   * @param center        Position of the cuboid center in the local reference frame
+   */
+  public Rectangle(double width, double length, double thickness, 
+                   double stripPitch, double stripLength, Hep3Vector center) {
+    this(width, length, thickness, (int)Math.round(width/stripPitch), (int)Math.round(length/stripLength), center);
+  }
+  
+  /**
+   * Create <tt>Rectangle</tt> instance.
+   * Reference frame origin will be in the center of the cuboid defining the sensor volume.
+   * Strip width and length will be rounded to place integral number of strips on the rectangle.
+   *
+   * @param width         Width of the sensor.
+   * @param length        Length of the sensor (along strip direction).
+   * @param thickness     Thickness of the sensor.
+   * @param stripPitch    Strip width.
+   * @param stripLength   Strip length.
+   */
+  public Rectangle(double width, double length, double thickness, 
+                   double stripPitch, double stripLength) {
+    this(width, length, thickness, (int)Math.round(width/stripPitch), (int)Math.round(length/stripLength), new BasicHep3Vector());
+  }
+
+// -- Setters :  ---------------------------------------------------------------
+  
+  /**
+   * Set the dimension of a measurement by this type of sensor (1 for strips, 2 for pixels, etc).
+   */
+  public void setHitType(ITrackerHit.Type hitType) {
+    _hitType = hitType;
+  }
+    
+// -----------------------------------------------------------------------------
+
+  /**
+   * Converts a point in local sensor coordinates to channel ID.
+   * Returns -1 if the point is outside of sensor sensitive area.
+   */
+  public int getChannelID(Hep3Vector point) {
+    
+//    if (Math.abs(point.z()-_wCenter) > _thick/2.) return -1;
+
+    double u = point.x();
+    double v = point.y();
+    
+    int nU = (int) Math.floor((u-_uLow)/_pitch); 
+    if ((nU < 0) || (nU >= _nDivU)) return -1;
+    int nV = (int) Math.floor((v-_vLow)/_length);
+    if ((nV < 0) || (nV >= _nDivV)) return -1;
+    return nV*_nDivU + nU;
+  }
+  
+  /**
+   * Returns position of the center of the given channel, in local sensor coordinates.
+   */
+  public Hep3Vector getChannelPosition(int channelID) {
+    int nU = channelID % _nDivU;
+    int nV = channelID / _nDivU;
+    double u = (nU + .5) * _pitch + _uLow;
+    double v = (nV + .5) * _length + _vLow;
+    return new BasicHep3Vector(u,v,0.);
+  }
+
+  /** Returns maximum possible channel ID on this sensor. */
+  public int getMaxChannelID() {
+    return  _nDivU * _nDivV - 1;
+  }
+  
+  /** Returns <tt>true</tt> if channel with this ID exists on this sensor. */
+  public boolean isValidChannelID(int channelID) {
+    return channelID > -1 && channelID < (_nDivU * _nDivV);
+  }
+  
+  /**
+   * Returns dimensions of the given channel along U, V, W.
+   */
+  public Hep3Vector getChannelDimensions(int channelID) {
+    return new BasicHep3Vector(_pitch, _length, _thick);
+  }
+  
+  
+  /**
+   * Returns the type of hits produced by this type of sensor.
+   */
+  public ITrackerHit.Type getHitType() {
+    return _hitType;
+  }
+  
+  /**
+   * Returns local cartesian reference frame at the specified position in local sensor coordinates.
+   * For this type of sensor, the specified sensor reference frame is returned, independent of position.
+   */
+  public IRefFrame getLocalFrame(IRefFrame sensorFrame, Hep3Vector position) {
+    return sensorFrame;
+  }
+  
+  /**
+   * Returns channel ID of a neighbor channel.
+   * Returns -1 if the channel defined by shifts does not exist on this sensor.
+   *
+   * @param channelID  ID of the original channel
+   * @param shiftV     move in <tt>V</tt> direction by <tt>shiftV</tt> channels
+   * @param shiftU     move in <tt>U</tt> direction by <tt>shiftU</tt> channels
+   */
+  public int getNeighbor(int channelID, int shiftU, int shiftV) {
+    int nU = (channelID % _nDivU) + shiftU;
+    if ((nU < 0) || (nU >= _nDivU)) return -1;
+    int nV = (channelID / _nDivU) + shiftV;
+    if ((nV < 0) || (nV >= _nDivV)) return -1;
+    return nV*_nDivU + nU;
+  }
+  
+  /** Returns array of IDs of all immediate neighbor channels. */
+  public List<Integer> getNeighbors(int channelID) {
+    int nU = channelID % _nDivU;
+    int nV = channelID / _nDivU;
+    ArrayList<Integer> out = new ArrayList<Integer>(8);
+    int vDown = ((_hitType.nMeasDir() == 2) && (nV > 0)) ? nV-1 : nV;
+    int vUp = ((_hitType.nMeasDir() == 2) && (nV < _nDivV-1)) ? nV+1 : nV;
+    int uDown = (nU > 0) ? nU-1 : nU;
+    int uUp = (nU < _nDivU-1) ? nU+1 : nU;
+    for (int iV = vDown; iV < vUp; iV++) {
+      for (int iU = uDown; iU < uUp; iU++) {
+        out.add(nV*_nDivU + nU);
+      }
+    }
+    return out;
+  }
+  
+// -- Private parts :  ---------------------------------------------------------
+  
+  protected double _uLow;
+  protected double _vLow;
+  protected double _wCenter;
+  
+  protected double _pitch;
+  protected double _length;
+  protected double _thick;
+  
+  protected ITrackerHit.Type _hitType;
+  
+  protected int _nDivU;
+  protected int _nDivV;
+}

lcsim/src/org/lcsim/contrib/onoprien/vsegment/geom/sensortype
Ring.java added at 1.1
diff -N Ring.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Ring.java	3 Sep 2008 04:28:29 -0000	1.1
@@ -0,0 +1,88 @@
+package org.lcsim.contrib.onoprien.vsegment.geom.sensortype;
+
+import java.util.*;
+
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Vector;
+
+/**
+ * Class to represent a disk sensor divided into rectangular strips or pixels.
+ * Reference frame origin is at the center of the disk in X and Y, Z position can be controlled. 
+ *
+ * {@link #getChannelID(Hep3Vector)} method returns <tt>-1</tt> if and only if the 
+ * center of the rectangle (strip) to which the point belongs is ouside the ring.
+ *
+ * @author D.Onoprienko
+ * @version $Id: Ring.java,v 1.1 2008/09/03 04:28:29 onoprien Exp $
+ */
+public class Ring extends Rectangle {
+  
+// -- Constructors :  ----------------------------------------------------------
+  
+  /**
+   * Create <tt>Ring</tt> instance.
+   *
+   * @param radiusMin   Inside radius of the ring.
+   * @param radiusMax   Outside radius of the ring.
+   * @param pitch       Width of a strip.
+   * @param length      Length of a strip.
+   * @param thickness   Thickness of the sensor.
+   * @param wCenter     W coordinate of the disk volume center in the local reference frame.
+   */
+  public Ring(double radiusMin, double radiusMax, double pitch, double length, double thickness, double wCenter) {
+    super(pitch*Math.ceil(2.*radiusMax/pitch), length*Math.ceil(2.*radiusMax/length), thickness, pitch, length, 
+            new BasicHep3Vector(0.,0.,wCenter));
+    _rMin = radiusMin;
+    _rMax = radiusMax;
+  }
+  
+// -----------------------------------------------------------------------------
+
+  /**
+   * Converts a point in local sensor coordinates to channel ID.
+   * Returns -1 if the point is outside of sensor sensitive area.
+   */
+  public int getChannelID(Hep3Vector point) {
+    int channel = super.getChannelID(point);
+    return isValidChannelID(channel) ? channel : -1;
+  }
+  
+  /**
+   * Returns channel ID of a neighbor channel.
+   * Returns -1 if the channel defined by shifts does not exist on this sensor.
+   *
+   * @param channelID  ID of the original channel
+   * @param shiftV     move in <tt>V</tt> direction by <tt>shiftV</tt> channels
+   * @param shiftU     move in <tt>U</tt> direction by <tt>shiftU</tt> channels
+   */
+  public int getNeighbor(int channelID, int shiftU, int shiftV) {
+    int neighbor = super.getNeighbor(channelID, shiftU, shiftV);
+    return isValidChannelID(neighbor) ? neighbor : -1;
+  }
+  
+  /** Returns array of IDs of all immediate neighbor channels. */
+  public List<Integer> getNeighbors(int channelID) {
+    List<Integer> raw = super.getNeighbors(channelID);
+    List<Integer> out = new ArrayList<Integer>(raw.size());
+    for (int neighbor : raw) {
+      if (isValidChannelID(neighbor)) out.add(neighbor);
+    }
+    return out;
+  }
+  
+// -- Helper methods :  --------------------------------------------------------
+
+  /**
+   * Returns <tt>true</tt> if the center of the channel is inside the ring.
+   */
+  public boolean isValidChannelID(int channelID) {
+    if (!super.isValidChannelID(channelID)) return false;
+    double r = getChannelPosition(channelID).magnitude();
+    return r > _rMin && r < _rMax;
+  }
+
+// -- Private parts :  ---------------------------------------------------------
+  
+  protected double _rMin;
+  protected double _rMax;
+}

lcsim/src/org/lcsim/contrib/onoprien/vsegment/geom/sensortype
WedgeSideParallel.java added at 1.1
diff -N WedgeSideParallel.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ WedgeSideParallel.java	3 Sep 2008 04:28:29 -0000	1.1
@@ -0,0 +1,184 @@
+package org.lcsim.contrib.onoprien.vsegment.geom.sensortype;
+
+import java.util.*;
+
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Vector;
+
+import org.lcsim.contrib.onoprien.vsegment.geom.SensorType;
+import org.lcsim.contrib.onoprien.vsegment.hit.ITrackerHit;
+import org.lcsim.contrib.onoprien.vsegment.transform.IRefFrame;
+
+/**
+ *
+ * @author D.Onoprienko
+ * @version $Id: WedgeSideParallel.java,v 1.1 2008/09/03 04:28:29 onoprien Exp $
+ */
+public class WedgeSideParallel implements SensorType {
+  
+// -- Constructors :  ----------------------------------------------------------
+  
+  public WedgeSideParallel(boolean left, double shortBase, double longBase, double angle, double pitch) {
+    _left = left;
+    _pitch = pitch;
+    _tan = Math.tan(angle/2.);
+    _cotan2 = 1./Math.tan(angle);
+    _side = ((longBase - shortBase)/2.)/Math.sin(angle/2.);
+    _maxID = (int) Math.floor((longBase * Math.cos(angle/2.))/pitch);
+    _uCorner = shortBase * Math.cos(angle/2.);
+    _offset = (left) ? 0. : (_maxID * pitch) - _uCorner;
+    _vConst = - (shortBase/2.) / Math.sin(angle/2.);
+    
+  }
+
+  public WedgeSideParallel(double rMin, double side, double angle, double pitch, boolean left) {
+    _left = left;
+    _side = side;
+    _tan = Math.tan(angle/2.);
+    _cotan2 = 1./Math.tan(angle);
+    _pitch = pitch;
+    _maxID = (int) Math.floor(((rMin+side)*Math.sin(angle))/pitch);
+    _uCorner = rMin * Math.sin(angle);
+    _offset = (left) ? 0. : (_maxID * pitch) - _uCorner;
+    _vConst = - rMin;
+  }
+// -----------------------------------------------------------------------------
+
+  /**
+   * Converts a point in local sensor coordinates to channel ID.
+   * Returns -1 if the point is outside of sensor sensitive area.
+   */
+  public int getChannelID(Hep3Vector point) {
+    double u = point.x();
+    int channel = (int) Math.floor((u + _offset) / _pitch);
+    return ((channel < 0) || (channel > _maxID)) ? -1 : channel;
+  }
+  
+  /**
+   * Returns position of the center of a given channel, in local sensor coordinates.
+   */
+  public Hep3Vector getChannelPosition(int channelID) {
+    double u = ((channelID + .5) * _pitch) - _offset;
+    double v;
+    if (_left) {
+      if (u < _uCorner) {
+        v = _side/2. - u * _tan;
+      } else {
+        v = ((_side - u * _tan) + (u * _cotan2 + _vConst) )/2.;
+      }
+    } else {
+      if (u < 0.) {
+        v = (_side + u * _tan - u * _cotan2 )/2.;
+      } else {
+        v = _side/2. + u * _tan;
+      }
+    }
+    return new BasicHep3Vector(u,v,0.);
+  }
+  
+  /** Returns maximum channel ID on this sensor. */
+  public int getMaxChannelID() {
+    return _maxID;
+  }
+  
+  /** Returns <tt>true</tt> if channel with this ID exists on this sensor. */
+  public boolean isValidChannelID(int channelID) {
+    return channelID > -1 && channelID <= _maxID;
+  }
+  
+  /** Returns dimensions of a given channel along U, V, W. */
+  public Hep3Vector getChannelDimensions(int channelID) {
+    double u = ((channelID + .5) * _pitch) - _offset;
+    double length;
+    if (_left) {
+      if (u < _uCorner) {
+        length = _side;
+      } else {
+        length = (_side - u * _tan) - (u * _cotan2 + _vConst);
+      }
+    } else {
+      if (u < 0.) {
+        length = (_side + u * _tan) + u * _cotan2 ;
+      } else {
+        length = _side;
+      }
+    }
+    return new BasicHep3Vector(_pitch, length, 0.);
+  }
+  
+  /**
+   * Returns the dimension of a measurement by this type of sensor (<tt>STRIP</tt> since 
+   * <tt>WedgeSideParallel</tt> is always tiled with strips).
+   */
+  public ITrackerHit.Type getHitType() {return ITrackerHit.Type.STRIP;}
+  
+  /**
+   * Returns local cartesian reference frame at the specified position in local sensor coordinates.
+   * For this type of sensor, the specified sensor reference frame is returned, independent of position.
+   */
+  public IRefFrame getLocalFrame(IRefFrame sensorFrame, Hep3Vector position) {
+    return sensorFrame;
+  }
+  
+  /**
+   * Returns ID of a channel obtained by shifting the given channel by the given
+   * number of channels in the given direction along the local reference frame axis. 
+   * Returns <tt>-1</tt> if shifting puts the point outside of the sensor boundaries.
+   * Throws <tt>IllegalArgumentException</tt> if this type of sensor does not have a
+   * concept of a neighbor in the given direction. 
+   *
+   * @param channelID  ID of the original channel
+   * @param shiftV     move in <tt>V</tt> direction by <tt>shiftV</tt> channels
+   * @param shiftU     move in <tt>U</tt> direction by <tt>shiftU</tt> channels
+   */
+  public int getNeighbor(int channelID, int shiftU, int shiftV) {
+    if (shiftV != 0) return -1;
+    int channel = channelID + shiftU;
+    return ((channel < 0) || (channel > _maxID)) ? -1 : channel;
+  }
+  
+  /**
+   * Returns array of IDs of all immediate neighbor channels.
+   */
+  public List<Integer> getNeighbors(int channelID) {
+    ArrayList<Integer> out = new ArrayList<Integer>(2);
+    if (channelID > 0) out.add(channelID - 1);
+    if (channelID < _maxID) out.add(channelID + 1);
+    return out;
+  }
+  
+  /**
+   * Returns an array of (U,V) coordinates of corners of the sensor.
+   * Useful for event display. The dimensions of the returned array are [4][2].
+   */
+  public double[][] getCorners() {
+    double[][] out = new double[4][2];
+    out[0] = new double[]{0.,0.};
+    if (_left) {
+      out[1] = new double[]{0.,_side};
+      double u = (_side - _vConst) * Math.sin(2.*Math.atan(_tan));
+      out[2] = new double[]{u, _side - u * _tan};
+      out[3] = new double[]{_uCorner, - _uCorner * _tan};
+    } else {
+      double u = - _side * Math.sin(2.*Math.atan(_tan));
+      out[1] = new double[]{u, - u * _cotan2};
+      out[2] = new double[]{_uCorner, _side + _uCorner * _tan};
+      out[3] = new double[]{_uCorner, _uCorner * _tan};
+    }
+    return out;
+  }
+  
+// -- Private parts :  ---------------------------------------------------------
+  
+  private boolean _left;
+  
+  private int _maxID;
+  private double _offset;
+  private double _pitch;
+  private double _side;
+  private double _tan;
+  private double _cotan2;
+  private double _uCorner;
+  private double _vConst;
+  
+}

lcsim/src/org/lcsim/contrib/onoprien/vsegment/geom/sensortypes
Cylinder.java removed after 1.1
diff -N Cylinder.java
--- Cylinder.java	2 Sep 2008 19:29:48 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,158 +0,0 @@
-package org.lcsim.contrib.onoprien.vsegment.geom.sensortypes;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import hep.physics.vec.BasicHep3Vector;
-import hep.physics.vec.Hep3Vector;
-
-import org.lcsim.contrib.onoprien.vsegment.geom.SensorType;
-import org.lcsim.contrib.onoprien.vsegment.hit.ITrackerHit;
-import org.lcsim.contrib.onoprien.vsegment.transform.IRefFrame;
-
-/**
- * This class represents a cylindrical sensor with strips parallel to its axis.
- * The reference frame is cylindrical (U,V,W = Phi,Z,R), with the position of origin 
- * controled by <tt>Hep3Vector center</tt> parameter given to a constructor.
- * If <tt>center = (Phi0,Z0,R0)</tt>, then the sensor volume of the cylinder will be defined by 
- * <tt><nobr>Phi0-PI < u < Phi0+PI ,</nobr> 
- * <nobr>Z0-length < v < Z0+length ,</nobr> 
- * <nobr>R0-thickness/2 < w < R0+thickness/2</nobr></tt>. 
- * Constructors that do not require <tt>center</tt> parameter assume
- * <nobr><tt>center = (0.,0.,radius)</tt></nobr>,
- * placing the local reference frame origin in the center of the detector with 
- * <tt>phi</tt> ranging from <tt>-PI</tt> to <tt>PI</tt>.
- *
- * @author D.Onoprienko
- * @version $Id: Cylinder.java,v 1.1 2008/09/02 19:29:48 onoprien Exp $
- */
-public class Cylinder extends Rectangle {
-  
-// -- Constructors :  ----------------------------------------------------------
-  
-  /**
-   * Create <tt>Cylinder</tt> instance.
-   * The <tt>center</tt> parameter controls offsets in the local reference frame.
-   *
-   * @param length      Length of the cylinder (along strip direction).
-   * @param radius      Radius of the cylinder.
-   * @param thickness   Thickness of the sensor.
-   * @param nLength     Number of divisions along the cylinder length.
-   * @param nPhi        Number of divisions in phi.
-   * @param center      Controls definition of the local reference frame
-   */
-  public Cylinder(double radius, double length, double thickness, int nPhi, int nLength, Hep3Vector center) {
-    super(TWOPI, length, thickness, nPhi, nLength, center);
-    _hitType = ((length/nLength)/(TWOPI*radius/nPhi) < 4.) ? ITrackerHit.Type.PIXEL : ITrackerHit.Type.STRIP;
-  }
-  
-  /**
-   * Create <tt>Cylinder</tt> instance.
-   *
-   * @param length      Length of the cylinder (along strip direction).
-   * @param radius      Radius of the cylinder.
-   * @param thickness   Thickness of the sensor.
-   * @param nLength     Number of divisions along the cylinder length.
-   * @param nPhi        Number of divisions in phi.
-   */
-  public Cylinder(double radius, double length, double thickness, int nPhi, int nLength) {
-    this(radius, length, thickness, nPhi, nLength, new BasicHep3Vector(0.,0.,radius));
-  }
-  
-  /**
-   * Create <tt>Cylinder</tt> instance.
-   * Strip width will be adjusted to make sure integral number of strips fits the 
-   * circumference of the cylinder.
-   *
-   * @param length       Length of the cylinder (along strip direction).
-   * @param radius       Radius of the cylinder.
-   * @param thickness    Thickness of the sensor.
-   * @param stripPitch   Strip width.
-   * @param stripLength  Strip length.
-   * @param center       Controls definition of the local reference frame
-   */
-  public Cylinder(double radius, double length, double thickness, double stripPitch, double stripLength, Hep3Vector center) {
-    this(radius, length, thickness, (int) Math.round((TWOPI*radius)/stripPitch), (int) Math.round(length/stripLength), center);
-  }
-  
-  /**
-   * Create <tt>Cylinder</tt> instance.
-   * Strip width will be adjusted to make sure integral number of strips fits the 
-   * circumference of the cylinder.
-   *
-   * @param length       Length of the cylinder (along strip direction).
-   * @param radius       Radius of the cylinder.
-   * @param thickness    Thickness of the sensor.
-   * @param stripPitch   Strip width.
-   * @param stripLength  Strip length.
-   */
-  public Cylinder(double radius, double length, double thickness, double stripPitch, double stripLength) {
-    this(radius, length, thickness, stripPitch, stripLength, new BasicHep3Vector(0.,0.,radius));
-  }
-
-// -----------------------------------------------------------------------------
-
-  /**
-   * Converts a point in local sensor coordinates to channel ID.
-   * Returns -1 if the point is outside of sensor sensitive area.
-   */
-  public int getChannelID(Hep3Vector point) {
-    
-//    if (Math.abs(point.z()-_wCenter) > _thick/2.) return -1;
-
-    double u = point.x();
-    double v = point.y();
-
-    int nV = (int) Math.floor((v-_vLow)/_length);
-    if ((nV < 0) || (nV >= _nDivV)) return -1;
-
-    int nU = (int) Math.floor((u-_uLow)/_pitch); 
-    while (nU < 0) nU += _nDivU;
-    while (nU >= _nDivU) nU -= _nDivU;
-
-    return nV*_nDivU + nU;
-  }
-  
-  /**
-   * Returns channel ID of a neighbor channel.
-   * Returns -1 if the channel defined by shifts does not exist on this sensor.
-   *
-   * @param channelID  ID of the original channel
-   * @param shiftV     move in <tt>V</tt> direction by <tt>shiftV</tt> channels
-   * @param shiftU     move in <tt>U</tt> direction by <tt>shiftU</tt> channels
-   */
-  public int getNeighbor(int channelID, int shiftU, int shiftV) {
-    int nV = (channelID / _nDivU) + shiftV;
-    if (nV < 0 || nV >= _nDivV) return -1;
-    int nU = (channelID % _nDivU) + shiftU;
-    while (nU < 0) nU += _nDivU;
-    while (nU >= _nDivU) nU -= _nDivU;
-    return nV*_nDivU + nU;
-  }
-  
-  /** 
-   * Returns array of IDs of all immediate neighbor channels. 
-   * For strips ({@link #getHitDimension()} returns 1), this method looks for neighbors
-   * in U direction only. Therefore, each strip has 1 or 2 neighbors. For pixels
-   * ({@link #getHitDimension()} returns 2), up to 8 neighbors can be found.
-   */
-  public List<Integer> getNeighbors(int channelID) {
-    int nU = channelID % _nDivU;
-    int nV = channelID / _nDivU;
-    ArrayList<Integer> out = new ArrayList<Integer>(8);
-    int vDown = ((_hitType.nMeasDir() == 2) && (nV > 0)) ? nV-1 : nV;
-    int vUp = ((_hitType.nMeasDir() == 2) && (nV < _nDivV-1)) ? nV+1 : nV;
-    for (int iV = vDown; iV < vUp; iV++) {
-      for (int iU = nU-1; iU < nU+1; iU++) {
-        while (nU < 0) nU += _nDivU;
-        while (nU >= _nDivU) nU -= _nDivU;
-        out.add(nV*_nDivU + nU);
-      }
-    }
-    return out;
-  }
-
-// -- Private parts :  ---------------------------------------------------------
-  
-  static final double TWOPI = 2.*Math.PI;
-}

lcsim/src/org/lcsim/contrib/onoprien/vsegment/geom/sensortypes
Hexagon.java removed after 1.1
diff -N Hexagon.java
--- Hexagon.java	2 Sep 2008 19:29:48 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,136 +0,0 @@
-package org.lcsim.contrib.onoprien.vsegment.geom.sensortypes;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import hep.physics.vec.BasicHep3Vector;
-import hep.physics.vec.Hep3Vector;
-
-import org.lcsim.contrib.onoprien.vsegment.geom.SensorType;
-import org.lcsim.contrib.onoprien.vsegment.hit.ITrackerHit;
-import org.lcsim.contrib.onoprien.vsegment.transform.IRefFrame;
-
-/**
- * This class represents a hexagonal sensor with strips parallel to its side.
- * The reference frame origin is at the center of the sensor.
- * <p>
- * Note: sensor thickness is ignored in the current implementation - <tt>getCnannel(position)</tt> 
- * method does not check whether the specified position belongs to the sensitive volume. The reference
- * surface is defined by the <tt>W = 0</tt> plane in the sensor local reference frame.
- *
- * @author D.Onoprienko
- * @version $Id: Hexagon.java,v 1.1 2008/09/02 19:29:48 onoprien Exp $
- */
-public class Hexagon implements SensorType {
-  
-// -- Constructors :  ----------------------------------------------------------
-  
-  /**
-   * Create <tt>Hexagon</tt> instance.
-   *
-   * @param sideLength      Length of the hexagon side.
-   * @param thickness       Thickness of the sensor.
-   * @param nU              Number of divisions along U (measurement direction, perpendicular to strips).
-   */
-  public Hexagon(double sideLength, double thickness, int nU) {
-    _side = sideLength;
-    _halfWidth = sideLength*COSPI6;
-    _halfThick = thickness/2.;
-    _nDivU = nU;
-    _pitch = (2.*_halfWidth)/nU;
-  }
-
-// -----------------------------------------------------------------------------
-
-  /**
-   * Converts a point in local sensor coordinates to channel ID.
-   * Returns -1 if the point is outside of sensor sensitive area.
-   */
-  public int getChannelID(Hep3Vector point) {
-    
-//    if (Math.abs(point.z()) > _halfThick) return -1;
-
-    double u = point.x();
-    double v = point.y();
-    if (Math.abs(u) > _halfWidth || Math.abs(v) > _side - Math.abs(u)*TANPI6) return -1;
-    
-    int nU = (int) Math.floor((u+_halfWidth)/_pitch); if (nU == _nDivU) nU--;
-    return nU;
-  }
-  
-  /**
-   * Returns position of the center of the given channel, in local sensor coordinates.
-   */
-  public Hep3Vector getChannelPosition(int channelID) {
-    double u = (channelID + .5) * _pitch - _halfWidth;
-    return new BasicHep3Vector(u,0.,0.);
-  }
-
-  /** Returns maximum possible channel ID on this sensor. */
-  public int getMaxChannelID() {
-    return  _nDivU - 1;
-  }
-  
-  /** Returns <tt>true</tt> if channel with this ID exists on this sensor. */
-  public boolean isValidChannelID(int channelID) {
-    return channelID > -1 && channelID < _nDivU;
-  }
-  
-  /**
-   * Returns dimensions of the given channel along U, V, W.
-   */
-  public Hep3Vector getChannelDimensions(int channelID) {
-    double u = (channelID + .5) * _pitch - _halfWidth;
-    double stripLength = 2.* (_side - Math.abs(u)*TANPI6);
-    return new BasicHep3Vector(_pitch, stripLength, 0.);
-  }
-  
-  
-  /**
-   * Returns the dimension of a measurement by this type of sensor (<tt>STRIP</tt> since 
-   * <tt>WedgeSideParallel</tt> is always tiled with strips).
-   */
-  public ITrackerHit.Type getHitType() {return ITrackerHit.Type.STRIP;}
-  
-  /**
-   * Returns local cartesian reference frame at the specified position in local sensor coordinates.
-   * For this type of sensor, the specified sensor reference frame is returned, independent of position.
-   */
-  public IRefFrame getLocalFrame(IRefFrame sensorFrame, Hep3Vector position) {
-    return sensorFrame;
-  }
-  
-  /**
-   * Returns channel ID of a neighbor channel.
-   * Returns -1 if the channel defined by shifts does not exist on this sensor.
-   *
-   * @param channelID  ID of the original channel
-   * @param shiftV     move in <tt>V</tt> direction by <tt>shiftV</tt> channels
-   * @param shiftU     move in <tt>U</tt> direction by <tt>shiftU</tt> channels
-   */
-  public int getNeighbor(int channelID, int shiftU, int shiftV) {
-    int nU = channelID + shiftU;
-    return (nU < 0 || nU >= _nDivU || shiftV != 0) ? -1 : nU ;
-  }
-  
-  /** Returns array of IDs of all immediate neighbor channels. */
-  public List<Integer> getNeighbors(int channelID) {
-    ArrayList<Integer> out = new ArrayList<Integer>(2);
-    if (channelID > 0) out.add(channelID - 1);
-    if (channelID < (_nDivU - 1)) out.add(channelID + 1);
-    return out;
-  }
-  
-// -- Private parts :  ---------------------------------------------------------
-  
-  protected double _side;
-  protected double _halfWidth;
-  protected double _halfThick;
-  
-  protected double _pitch;
-  
-  protected int _nDivU;
-  
-  protected final double COSPI6 = Math.sqrt(3.)/2.;
-  protected final double TANPI6 = 1./Math.sqrt(3.);
-}

lcsim/src/org/lcsim/contrib/onoprien/vsegment/geom/sensortypes
Rectangle.java removed after 1.1
diff -N Rectangle.java
--- Rectangle.java	2 Sep 2008 19:29:48 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,294 +0,0 @@
-package org.lcsim.contrib.onoprien.vsegment.geom.sensortypes;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import hep.physics.vec.BasicHep3Vector;
-import hep.physics.vec.Hep3Vector;
-
-import org.lcsim.contrib.onoprien.vsegment.geom.SensorType;
-import org.lcsim.contrib.onoprien.vsegment.hit.ITrackerHit;
-import org.lcsim.contrib.onoprien.vsegment.transform.IRefFrame;
-
-/**
- * This class represents a rectangular sensor with rectangular strips or pixel sparallel to its side.
- * <p>
- * Note: sensor thickness is ignored in the current implementation - <tt>getCnannel(position)</tt> 
- * method does not check whether the specified position belongs to the sensitive volume. The reference
- * surface is defined by the <tt>W = 0</tt> plane in the sensor local reference frame.
- *
- * @author D.Onoprienko
- * @version $Id: Rectangle.java,v 1.1 2008/09/02 19:29:48 onoprien Exp $
- */
-public class Rectangle implements SensorType {
-  
-// -- Constructors :  ----------------------------------------------------------
-  
-  /** Default constructor for use by subclusses. No initialization. */
-  public Rectangle() {}
-  
-  /**
-   * Create an instance of <tt>Rectangle</tt>.
-   * The <tt>center</tt> parameter controls how the local reference frame origin
-   * is positioned with respect to the cuboid defining the sensor volume.
-   *
-   * @param width       Width of the sensor.
-   * @param length      Length of the sensor (along strip direction).
-   * @param thickness   Thickness of the sensor.
-   * @param nWidth      Number of divisions across the sensor width.
-   * @param nLength     Number of divisions along the sensor length.
-   * @param center      Position of the sensor volume cuboid center in the local reference frame.
-   */
-  public Rectangle(double width, double length, double thickness, 
-                   int nWidth, int nLength, Hep3Vector center) {
-    if (nLength == 0) nLength = 1;
-    _uLow = center.x() - width/2.;
-    _vLow = center.y() - length/2.;
-    _wCenter = center.z();
-    _pitch = width/nWidth;
-    _length = length/nLength;
-    _thick = thickness;
-    _hitType = (_length/_pitch < 4.) ? ITrackerHit.Type.PIXEL : ITrackerHit.Type.STRIP;
-    _nDivV = nLength;
-    _nDivU = nWidth;
-//    System.out.println("Rect w "+width+" len "+length+" thick "+thickness+" nW "+nWidth+" nL "+nLength+" center "+center);
-//    System.out.println(" pitch "+_pitch+" length "+_length+" thick "+_thick+" hitDim "+_hitDim);
-  }
-  
-  /**
-   * Create <tt>Rectangle</tt> instance.
-   * Reference frame origin will be in the center of the cuboid defining the sensor volume.
-   *
-   * @param width       Width of the sensor.
-   * @param length      Length of the sensor (along strip direction).
-   * @param thickness   Thickness of the sensor.
-   * @param nWidth      Number of divisions across the sensor width.
-   * @param nLength     Number of divisions along the sensor length.
-   */
-  public Rectangle(double width, double length, double thickness, int nWidth, int nLength) {
-    this(width, length, thickness, nWidth, nLength, new BasicHep3Vector());
-  }
-  
-  /**
-   * Create <tt>Rectangle</tt> instance.
-   * The <tt>center</tt> parameter controls how the local reference frame origin
-   * is positioned with respect to the cuboid defining the sensor volume.
-   * Strip width will be rounded to place integral number of strips on the rectangle.
-   *
-   * @param width       Width of the sensor.
-   * @param length      Length of the sensor (along strip direction).
-   * @param thickness   Thickness of the sensor.
-   * @param stripPitch  Strip width.
-   * @param nLength     Number of divisions along the sensor length.
-   * @param center      Position of the cuboid center in the local reference frame
-   */
-  public Rectangle(double width, double length, double thickness, 
-                   double stripPitch, int nLength, Hep3Vector center) {
-    this(width, length, thickness, (int)Math.round(width/stripPitch), nLength, center);
-  }
-  
-  /**
-   * Create <tt>Rectangle</tt> instance.
-   * Reference frame origin will be in the center of the cuboid defining the sensor volume.
-   * Strip width will be rounded to place integral number of strips on the rectangle.
-   *
-   * @param width       Width of the sensor.
-   * @param length      Length of the sensor (along strip direction).
-   * @param thickness   Thickness of the sensor.
-   * @param stripPitch  Strip width.
-   * @param nLength     Number of divisions along the sensor length.
-   */
-  public Rectangle(double width, double length, double thickness, 
-                   double stripPitch, int nLength) {
-    this(width, length, thickness, (int)Math.round(width/stripPitch), nLength, new BasicHep3Vector());
-  }
-  
-  /**
-   * Create <tt>Rectangle</tt> instance.
-   * The <tt>center</tt> parameter controls how the local reference frame origin
-   * is positioned with respect to the cuboid defining the sensor volume.
-   * Strip length will be rounded to place integral number of strips on the rectangle.
-   *
-   * @param width         Width of the sensor.
-   * @param length        Length of the sensor (along strip direction).
-   * @param thickness     Thickness of the sensor.
-   * @param nWidth        Number of divisions across the sensor width.
-   * @param stripLength   Strip length.
-   * @param center        Position of the cuboid center in the local reference frame
-   */
-  public Rectangle(double width, double length, double thickness, 
-                   int nWidth, double stripLength, Hep3Vector center) {
-    this(width, length, thickness, nWidth, (int)Math.round(length/stripLength), center);
-  }
-  
-  /**
-   * Create <tt>Rectangle</tt> instance.
-   * Reference frame origin will be in the center of the cuboid defining the sensor volume.
-   * Strip length will be rounded to place integral number of strips on the rectangle.
-   *
-   * @param width         Width of the sensor.
-   * @param length        Length of the sensor (along strip direction).
-   * @param thickness     Thickness of the sensor.
-   * @param nWidth        Number of divisions across the sensor width.
-   * @param stripLength   Strip length.
-   */
-  public Rectangle(double width, double length, double thickness, 
-                   int nWidth, double stripLength) {
-    this(width, length, thickness, nWidth, (int)Math.round(length/stripLength), new BasicHep3Vector());
-  }
-  
-  /**
-   * Create <tt>Rectangle</tt> instance.
-   * The <tt>center</tt> parameter controls how the local reference frame origin
-   * is positioned with respect to the cuboid defining the sensor volume.
-   * Strip width and length will be rounded to place integral number of strips on the rectangle.
-   *
-   * @param width         Width of the sensor.
-   * @param length        Length of the sensor (along strip direction).
-   * @param thickness     Thickness of the sensor.
-   * @param stripPitch    Strip width.
-   * @param stripLength   Strip length.
-   * @param center        Position of the cuboid center in the local reference frame
-   */
-  public Rectangle(double width, double length, double thickness, 
-                   double stripPitch, double stripLength, Hep3Vector center) {
-    this(width, length, thickness, (int)Math.round(width/stripPitch), (int)Math.round(length/stripLength), center);
-  }
-  
-  /**
-   * Create <tt>Rectangle</tt> instance.
-   * Reference frame origin will be in the center of the cuboid defining the sensor volume.
-   * Strip width and length will be rounded to place integral number of strips on the rectangle.
-   *
-   * @param width         Width of the sensor.
-   * @param length        Length of the sensor (along strip direction).
-   * @param thickness     Thickness of the sensor.
-   * @param stripPitch    Strip width.
-   * @param stripLength   Strip length.
-   */
-  public Rectangle(double width, double length, double thickness, 
-                   double stripPitch, double stripLength) {
-    this(width, length, thickness, (int)Math.round(width/stripPitch), (int)Math.round(length/stripLength), new BasicHep3Vector());
-  }
-
-// -- Setters :  ---------------------------------------------------------------
-  
-  /**
-   * Set the dimension of a measurement by this type of sensor (1 for strips, 2 for pixels, etc).
-   */
-  public void setHitType(ITrackerHit.Type hitType) {
-    _hitType = hitType;
-  }
-    
-// -----------------------------------------------------------------------------
-
-  /**
-   * Converts a point in local sensor coordinates to channel ID.
-   * Returns -1 if the point is outside of sensor sensitive area.
-   */
-  public int getChannelID(Hep3Vector point) {
-    
-//    if (Math.abs(point.z()-_wCenter) > _thick/2.) return -1;
-
-    double u = point.x();
-    double v = point.y();
-    
-    int nU = (int) Math.floor((u-_uLow)/_pitch); 
-    if ((nU < 0) || (nU >= _nDivU)) return -1;
-    int nV = (int) Math.floor((v-_vLow)/_length);
-    if ((nV < 0) || (nV >= _nDivV)) return -1;
-    return nV*_nDivU + nU;
-  }
-  
-  /**
-   * Returns position of the center of the given channel, in local sensor coordinates.
-   */
-  public Hep3Vector getChannelPosition(int channelID) {
-    int nU = channelID % _nDivU;
-    int nV = channelID / _nDivU;
-    double u = (nU + .5) * _pitch + _uLow;
-    double v = (nV + .5) * _length + _vLow;
-    return new BasicHep3Vector(u,v,0.);
-  }
-
-  /** Returns maximum possible channel ID on this sensor. */
-  public int getMaxChannelID() {
-    return  _nDivU * _nDivV - 1;
-  }
-  
-  /** Returns <tt>true</tt> if channel with this ID exists on this sensor. */
-  public boolean isValidChannelID(int channelID) {
-    return channelID > -1 && channelID < (_nDivU * _nDivV);
-  }
-  
-  /**
-   * Returns dimensions of the given channel along U, V, W.
-   */
-  public Hep3Vector getChannelDimensions(int channelID) {
-    return new BasicHep3Vector(_pitch, _length, _thick);
-  }
-  
-  
-  /**
-   * Returns the type of hits produced by this type of sensor.
-   */
-  public ITrackerHit.Type getHitType() {
-    return _hitType;
-  }
-  
-  /**
-   * Returns local cartesian reference frame at the specified position in local sensor coordinates.
-   * For this type of sensor, the specified sensor reference frame is returned, independent of position.
-   */
-  public IRefFrame getLocalFrame(IRefFrame sensorFrame, Hep3Vector position) {
-    return sensorFrame;
-  }
-  
-  /**
-   * Returns channel ID of a neighbor channel.
-   * Returns -1 if the channel defined by shifts does not exist on this sensor.
-   *
-   * @param channelID  ID of the original channel
-   * @param shiftV     move in <tt>V</tt> direction by <tt>shiftV</tt> channels
-   * @param shiftU     move in <tt>U</tt> direction by <tt>shiftU</tt> channels
-   */
-  public int getNeighbor(int channelID, int shiftU, int shiftV) {
-    int nU = (channelID % _nDivU) + shiftU;
-    if ((nU < 0) || (nU >= _nDivU)) return -1;
-    int nV = (channelID / _nDivU) + shiftV;
-    if ((nV < 0) || (nV >= _nDivV)) return -1;
-    return nV*_nDivU + nU;
-  }
-  
-  /** Returns array of IDs of all immediate neighbor channels. */
-  public List<Integer> getNeighbors(int channelID) {
-    int nU = channelID % _nDivU;
-    int nV = channelID / _nDivU;
-    ArrayList<Integer> out = new ArrayList<Integer>(8);
-    int vDown = ((_hitType.nMeasDir() == 2) && (nV > 0)) ? nV-1 : nV;
-    int vUp = ((_hitType.nMeasDir() == 2) && (nV < _nDivV-1)) ? nV+1 : nV;
-    int uDown = (nU > 0) ? nU-1 : nU;
-    int uUp = (nU < _nDivU-1) ? nU+1 : nU;
-    for (int iV = vDown; iV < vUp; iV++) {
-      for (int iU = uDown; iU < uUp; iU++) {
-        out.add(nV*_nDivU + nU);
-      }
-    }
-    return out;
-  }
-  
-// -- Private parts :  ---------------------------------------------------------
-  
-  protected double _uLow;
-  protected double _vLow;
-  protected double _wCenter;
-  
-  protected double _pitch;
-  protected double _length;
-  protected double _thick;
-  
-  protected ITrackerHit.Type _hitType;
-  
-  protected int _nDivU;
-  protected int _nDivV;
-}

lcsim/src/org/lcsim/contrib/onoprien/vsegment/geom/sensortypes
Ring.java removed after 1.1
diff -N Ring.java
--- Ring.java	2 Sep 2008 19:29:48 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,88 +0,0 @@
-package org.lcsim.contrib.onoprien.vsegment.geom.sensortypes;
-
-import java.util.*;
-
-import hep.physics.vec.BasicHep3Vector;
-import hep.physics.vec.Hep3Vector;
-
-/**
- * Class to represent a disk sensor divided into rectangular strips or pixels.
- * Reference frame origin is at the center of the disk in X and Y, Z position can be controlled. 
- *
- * {@link #getChannelID(Hep3Vector)} method returns <tt>-1</tt> if and only if the 
- * center of the rectangle (strip) to which the point belongs is ouside the ring.
- *
- * @author D.Onoprienko
- * @version $Id: Ring.java,v 1.1 2008/09/02 19:29:48 onoprien Exp $
- */
-public class Ring extends Rectangle {
-  
-// -- Constructors :  ----------------------------------------------------------
-  
-  /**
-   * Create <tt>Ring</tt> instance.
-   *
-   * @param radiusMin   Inside radius of the ring.
-   * @param radiusMax   Outside radius of the ring.
-   * @param pitch       Width of a strip.
-   * @param length      Length of a strip.
-   * @param thickness   Thickness of the sensor.
-   * @param wCenter     W coordinate of the disk volume center in the local reference frame.
-   */
-  public Ring(double radiusMin, double radiusMax, double pitch, double length, double thickness, double wCenter) {
-    super(pitch*Math.ceil(2.*radiusMax/pitch), length*Math.ceil(2.*radiusMax/length), thickness, pitch, length, 
-            new BasicHep3Vector(0.,0.,wCenter));
-    _rMin = radiusMin;
-    _rMax = radiusMax;
-  }
-  
-// -----------------------------------------------------------------------------
-
-  /**
-   * Converts a point in local sensor coordinates to channel ID.
-   * Returns -1 if the point is outside of sensor sensitive area.
-   */
-  public int getChannelID(Hep3Vector point) {
-    int channel = super.getChannelID(point);
-    return isValidChannelID(channel) ? channel : -1;
-  }
-  
-  /**
-   * Returns channel ID of a neighbor channel.
-   * Returns -1 if the channel defined by shifts does not exist on this sensor.
-   *
-   * @param channelID  ID of the original channel
-   * @param shiftV     move in <tt>V</tt> direction by <tt>shiftV</tt> channels
-   * @param shiftU     move in <tt>U</tt> direction by <tt>shiftU</tt> channels
-   */
-  public int getNeighbor(int channelID, int shiftU, int shiftV) {
-    int neighbor = super.getNeighbor(channelID, shiftU, shiftV);
-    return isValidChannelID(neighbor) ? neighbor : -1;
-  }
-  
-  /** Returns array of IDs of all immediate neighbor channels. */
-  public List<Integer> getNeighbors(int channelID) {
-    List<Integer> raw = super.getNeighbors(channelID);
-    List<Integer> out = new ArrayList<Integer>(raw.size());
-    for (int neighbor : raw) {
-      if (isValidChannelID(neighbor)) out.add(neighbor);
-    }
-    return out;
-  }
-  
-// -- Helper methods :  --------------------------------------------------------
-
-  /**
-   * Returns <tt>true</tt> if the center of the channel is inside the ring.
-   */
-  public boolean isValidChannelID(int channelID) {
-    if (!super.isValidChannelID(channelID)) return false;
-    double r = getChannelPosition(channelID).magnitude();
-    return r > _rMin && r < _rMax;
-  }
-
-// -- Private parts :  ---------------------------------------------------------
-  
-  protected double _rMin;
-  protected double _rMax;
-}

lcsim/src/org/lcsim/contrib/onoprien/vsegment/geom/sensortypes
WedgeSideParallel.java removed after 1.1
diff -N WedgeSideParallel.java
--- WedgeSideParallel.java	2 Sep 2008 19:29:48 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,184 +0,0 @@
-package org.lcsim.contrib.onoprien.vsegment.geom.sensortypes;
-
-import java.util.*;
-
-import hep.physics.vec.BasicHep3Vector;
-import hep.physics.vec.Hep3Vector;
-
-import org.lcsim.contrib.onoprien.vsegment.geom.SensorType;
-import org.lcsim.contrib.onoprien.vsegment.hit.ITrackerHit;
-import org.lcsim.contrib.onoprien.vsegment.transform.IRefFrame;
-
-/**
- *
- * @author D.Onoprienko
- * @version $Id: WedgeSideParallel.java,v 1.1 2008/09/02 19:29:48 onoprien Exp $
- */
-public class WedgeSideParallel implements SensorType {
-  
-// -- Constructors :  ----------------------------------------------------------
-  
-  public WedgeSideParallel(boolean left, double shortBase, double longBase, double angle, double pitch) {
-    _left = left;
-    _pitch = pitch;
-    _tan = Math.tan(angle/2.);
-    _cotan2 = 1./Math.tan(angle);
-    _side = ((longBase - shortBase)/2.)/Math.sin(angle/2.);
-    _maxID = (int) Math.floor((longBase * Math.cos(angle/2.))/pitch);
-    _uCorner = shortBase * Math.cos(angle/2.);
-    _offset = (left) ? 0. : (_maxID * pitch) - _uCorner;
-    _vConst = - (shortBase/2.) / Math.sin(angle/2.);
-    
-  }
-
-  public WedgeSideParallel(double rMin, double side, double angle, double pitch, boolean left) {
-    _left = left;
-    _side = side;
-    _tan = Math.tan(angle/2.);
-    _cotan2 = 1./Math.tan(angle);
-    _pitch = pitch;
-    _maxID = (int) Math.floor(((rMin+side)*Math.sin(angle))/pitch);
-    _uCorner = rMin * Math.sin(angle);
-    _offset = (left) ? 0. : (_maxID * pitch) - _uCorner;
-    _vConst = - rMin;
-  }
-// -----------------------------------------------------------------------------
-
-  /**
-   * Converts a point in local sensor coordinates to channel ID.
-   * Returns -1 if the point is outside of sensor sensitive area.
-   */
-  public int getChannelID(Hep3Vector point) {
-    double u = point.x();
-    int channel = (int) Math.floor((u + _offset) / _pitch);
-    return ((channel < 0) || (channel > _maxID)) ? -1 : channel;
-  }
-  
-  /**
-   * Returns position of the center of a given channel, in local sensor coordinates.
-   */
-  public Hep3Vector getChannelPosition(int channelID) {
-    double u = ((channelID + .5) * _pitch) - _offset;
-    double v;
-    if (_left) {
-      if (u < _uCorner) {
-        v = _side/2. - u * _tan;
-      } else {
-        v = ((_side - u * _tan) + (u * _cotan2 + _vConst) )/2.;
-      }
-    } else {
-      if (u < 0.) {
-        v = (_side + u * _tan - u * _cotan2 )/2.;
-      } else {
-        v = _side/2. + u * _tan;
-      }
-    }
-    return new BasicHep3Vector(u,v,0.);
-  }
-  
-  /** Returns maximum channel ID on this sensor. */
-  public int getMaxChannelID() {
-    return _maxID;
-  }
-  
-  /** Returns <tt>true</tt> if channel with this ID exists on this sensor. */
-  public boolean isValidChannelID(int channelID) {
-    return channelID > -1 && channelID <= _maxID;
-  }
-  
-  /** Returns dimensions of a given channel along U, V, W. */
-  public Hep3Vector getChannelDimensions(int channelID) {
-    double u = ((channelID + .5) * _pitch) - _offset;
-    double length;
-    if (_left) {
-      if (u < _uCorner) {
-        length = _side;
-      } else {
-        length = (_side - u * _tan) - (u * _cotan2 + _vConst);
-      }
-    } else {
-      if (u < 0.) {
-        length = (_side + u * _tan) + u * _cotan2 ;
-      } else {
-        length = _side;
-      }
-    }
-    return new BasicHep3Vector(_pitch, length, 0.);
-  }
-  
-  /**
-   * Returns the dimension of a measurement by this type of sensor (<tt>STRIP</tt> since 
-   * <tt>WedgeSideParallel</tt> is always tiled with strips).
-   */
-  public ITrackerHit.Type getHitType() {return ITrackerHit.Type.STRIP;}
-  
-  /**
-   * Returns local cartesian reference frame at the specified position in local sensor coordinates.
-   * For this type of sensor, the specified sensor reference frame is returned, independent of position.
-   */
-  public IRefFrame getLocalFrame(IRefFrame sensorFrame, Hep3Vector position) {
-    return sensorFrame;
-  }
-  
-  /**
-   * Returns ID of a channel obtained by shifting the given channel by the given
-   * number of channels in the given direction along the local reference frame axis. 
-   * Returns <tt>-1</tt> if shifting puts the point outside of the sensor boundaries.
-   * Throws <tt>IllegalArgumentException</tt> if this type of sensor does not have a
-   * concept of a neighbor in the given direction. 
-   *
-   * @param channelID  ID of the original channel
-   * @param shiftV     move in <tt>V</tt> direction by <tt>shiftV</tt> channels
-   * @param shiftU     move in <tt>U</tt> direction by <tt>shiftU</tt> channels
-   */
-  public int getNeighbor(int channelID, int shiftU, int shiftV) {
-    if (shiftV != 0) return -1;
-    int channel = channelID + shiftU;
-    return ((channel < 0) || (channel > _maxID)) ? -1 : channel;
-  }
-  
-  /**
-   * Returns array of IDs of all immediate neighbor channels.
-   */
-  public List<Integer> getNeighbors(int channelID) {
-    ArrayList<Integer> out = new ArrayList<Integer>(2);
-    if (channelID > 0) out.add(channelID - 1);
-    if (channelID < _maxID) out.add(channelID + 1);
-    return out;
-  }
-  
-  /**
-   * Returns an array of (U,V) coordinates of corners of the sensor.
-   * Useful for event display. The dimensions of the returned array are [4][2].
-   */
-  public double[][] getCorners() {
-    double[][] out = new double[4][2];
-    out[0] = new double[]{0.,0.};
-    if (_left) {
-      out[1] = new double[]{0.,_side};
-      double u = (_side - _vConst) * Math.sin(2.*Math.atan(_tan));
-      out[2] = new double[]{u, _side - u * _tan};
-      out[3] = new double[]{_uCorner, - _uCorner * _tan};
-    } else {
-      double u = - _side * Math.sin(2.*Math.atan(_tan));
-      out[1] = new double[]{u, - u * _cotan2};
-      out[2] = new double[]{_uCorner, _side + _uCorner * _tan};
-      out[3] = new double[]{_uCorner, _uCorner * _tan};
-    }
-    return out;
-  }
-  
-// -- Private parts :  ---------------------------------------------------------
-  
-  private boolean _left;
-  
-  private int _maxID;
-  private double _offset;
-  private double _pitch;
-  private double _side;
-  private double _tan;
-  private double _cotan2;
-  private double _uCorner;
-  private double _vConst;
-  
-}
CVSspam 0.2.8