Print

Print


Commit in lcsim/src/org/lcsim/contrib/onoprien/tracking/geom on MAIN
SegmentationManager.java+3-11.5 -> 1.6
segmentation/SubdetectorBasedSegmentation.java+4-21.2 -> 1.3
sensortype/Hexagon.java+121added 1.1
+128-3
1 added + 2 modified, total 3 files


lcsim/src/org/lcsim/contrib/onoprien/tracking/geom
SegmentationManager.java 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- SegmentationManager.java	12 Jul 2007 05:12:00 -0000	1.5
+++ SegmentationManager.java	20 Jul 2007 20:00:53 -0000	1.6
@@ -28,7 +28,7 @@
  * {@link #getSegmenters()} methods.
  *
  * @author D.Onoprienko
- * @version $Id: SegmentationManager.java,v 1.5 2007/07/12 05:12:00 onoprien Exp $
+ * @version $Id: SegmentationManager.java,v 1.6 2007/07/20 20:00:53 onoprien Exp $
  */
 abstract public class SegmentationManager implements ConditionsListener {
   
@@ -47,6 +47,7 @@
    * of all segmenters, then assign prefixes to segmenters.
    */
   public void conditionsChanged(ConditionsEvent event) {
+    //System.out.println("SegMan: Conditions event "+event);
     ConditionsManager conMan = (event == null) ? ConditionsManager.defaultInstance() : event.getConditionsManager();
     try {
       Detector detector = conMan.getCachedConditions(Detector.class,"compact.xml").getCachedData();
@@ -72,6 +73,7 @@
     } catch (ConditionsSetNotFoundException x) {}
   }
   
+  /** Discard all {@Sensor} objects. */
   public void purge() {_sensorMap.clear();}
   
 // -- Sensor and channel lookup, ID conversions :  -----------------------------

lcsim/src/org/lcsim/contrib/onoprien/tracking/geom/segmentation
SubdetectorBasedSegmentation.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- SubdetectorBasedSegmentation.java	10 May 2007 07:11:12 -0000	1.2
+++ SubdetectorBasedSegmentation.java	20 Jul 2007 20:00:53 -0000	1.3
@@ -14,7 +14,7 @@
  * Segmentation that chooses {@link Segmenter} based on subdetector where the hit occured.
  *
  * @author D.Onoprienko
- * @version $Id: SubdetectorBasedSegmentation.java,v 1.2 2007/05/10 07:11:12 onoprien Exp $
+ * @version $Id: SubdetectorBasedSegmentation.java,v 1.3 2007/07/20 20:00:53 onoprien Exp $
  */
 public class SubdetectorBasedSegmentation extends SegmentationManager {
   
@@ -29,9 +29,11 @@
    * Detector dependent initialization.
    */
   public void detectorChanged(Detector detector) {
+    //System.out.println("SubdetectorBasedSegmentation: Detector "+detector.getDetectorName());
     _sdToSegmenter = new HashMap<Subdetector, Segmenter>();
     for (String sdName : _nameToSegmenter.keySet()) {
-      _sdToSegmenter.put(detector.getSubdetector(sdName), _nameToSegmenter.get(sdName));
+      Subdetector subDet = detector.getSubdetector(sdName);
+      if (subDet != null) _sdToSegmenter.put(subDet, _nameToSegmenter.get(sdName));
     }
   }
   

lcsim/src/org/lcsim/contrib/onoprien/tracking/geom/sensortype
Hexagon.java added at 1.1
diff -N Hexagon.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Hexagon.java	20 Jul 2007 20:00:53 -0000	1.1
@@ -0,0 +1,121 @@
+package org.lcsim.contrib.onoprien.tracking.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.tracking.geom.SensorType;
+
+/**
+ * This class represents a hexagonal sensor with strips parallel to its side.
+ * The reference frame origin is at the center of the sensor.
+ *
+ * @author D.Onoprienko
+ * @version $Id: Hexagon.java,v 1.1 2007/07/20 20:00:53 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;
+  }
+  
+  /**
+   * 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, 2.*_halfThick);
+  }
+  
+  /**
+   * Returns the dimension of a measurement by this type of sensor
+   * (1 for strips, 2 for pixels, etc). 
+   * <tt>Hexagon</tt> always contain strips so this method always returns 1.
+   */
+  public int getHitDimension() {
+    return 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 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);
+    int n = channelID - 1;
+    if (n > 0) out.add(n);
+    n = channelID + 1;
+    if (n < _nDivU) out.add(n);
+    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.);
+}
CVSspam 0.2.8