Print

Print


Commit in lcsim/src/org/lcsim/contrib/onoprien/tracking/geom on MAIN
SegmentationManager.java+2-11.3 -> 1.4
Segmenter.java+34-101.2 -> 1.3
segmentation/CylindricalBarrelSegmenter.java+25-121.4 -> 1.5
            /RingSegmenter.java+49-281.4 -> 1.5
+110-51
4 modified files


lcsim/src/org/lcsim/contrib/onoprien/tracking/geom
SegmentationManager.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- SegmentationManager.java	31 May 2007 09:38:54 -0000	1.3
+++ SegmentationManager.java	12 Jul 2007 05:00:22 -0000	1.4
@@ -28,7 +28,7 @@
  * {@link #getSegmenters()} methods.
  *
  * @author D.Onoprienko
- * @version $Id: SegmentationManager.java,v 1.3 2007/05/31 09:38:54 onoprien Exp $
+ * @version $Id: SegmentationManager.java,v 1.4 2007/07/12 05:00:22 onoprien Exp $
  */
 abstract public class SegmentationManager implements ConditionsListener {
   
@@ -125,6 +125,7 @@
    * sensor ID, and returns {@link Sensor} object corresponding to this ID.
    */
   public Sensor getSensor(SimTrackerHit hit) {
+    System.out.println("Hit: "+hit.getSubdetector().getName()+" layer "+hit.getLayer());
     return getSensor(getSensorID(hit));
   }
 

lcsim/src/org/lcsim/contrib/onoprien/tracking/geom
Segmenter.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- Segmenter.java	31 May 2007 09:38:54 -0000	1.2
+++ Segmenter.java	12 Jul 2007 05:00:22 -0000	1.3
@@ -5,34 +5,58 @@
 
 /**
  * Base class for defining segmentation of a particular part of the detector.
+ * <p>
+ * Within that part, each sensor is identified by a unique non-negative integer 
+ * <tt>postfix</tt>. Subclusses should override three methods to define a particular 
+ * segmentation: {@link #getSensorPostfix(SimTrackerHit hit)} that returns <tt>postfix</tt>
+ * given the simulated hit position, {@link #getMaxPostfix()} that returns maximum 
+ * possible postfix value, and {@link #makeSensor(int postfix)} that creates a new
+ * {@link Sensor} objects given <tt>postfix</tt>.
+ * <p>
+ * {@link SegmentationManager} will assign <tt>prefix</tt> value and overall ID length
+ * to this <tt>Segmenter</tt> through calls to {@link #setPrefix(int prefix)} and 
+ * {@link #setPostfixLength(int length)}.
+ * After that, {@link #getSensorID(SimTrackerHit hit)} and {@link #getSensor(int sensorID)}
+ * can be used (again, by {@link SegmentationManager}) to calculate <tt>SensorID</tt>
+ * (unique within the detector) and to create a new {@link Sensor}.
+ * <p>
+ * If a subclass requires any detector dependent initialization, it should override
+ * {@link #detectorChanged(Detector)} but include a call to <tt>super.detectorChanged(Detector)</tt>.
  *
  * @author D.Onoprienko
- * @version $Id: Segmenter.java,v 1.2 2007/05/31 09:38:54 onoprien Exp $
+ * @version $Id: Segmenter.java,v 1.3 2007/07/12 05:00:22 onoprien Exp $
  */
 abstract public class Segmenter {
   
 // -- To be implemented by subclusses :  ---------------------------------------
   
   /**
-   * Returns sensor ID postfix corresponding to the given position. This postfix must 
-   * be positive  integer, unique within the part of the detector handled by this 
-   * <tt>Segmenter</tt>  object. The final Sensor ID will be constructed taking into
-   * account the prefix set through a call to {@link #setPrefix()} method.
+   * Returns <tt>postfix</tt> corresponding to the position of the given simulated
+   * hit. The <tt>postfix</tt> must be non-negative integer,
+   * unique within the part of the detector handled by this <tt>Segmenter</tt> 
+   * object. The final <tt>SensorID</tt> will be constructed taking into account
+   * the prefix set through a call to {@link #setPrefix(int prefix)} method.
    */
   abstract protected int getSensorPostfix(SimTrackerHit hit);
   
   /**
    * Returns maximum postfix value that can be returned by
-   * {@link #getSensorPostfix(SimTrackerHit)} method of this <tt>Segmenter</tt>object.
+   * {@link #getSensorPostfix(SimTrackerHit)} method of this <tt>Segmenter</tt> object.
    */
   abstract protected int getMaxPostfix();
 
-  /** Creates a {@link Sensor} object given the ID. */
+  /** Creates a new {@link Sensor} object given the <tt>postfix</tt>. */
   abstract protected Sensor makeSensor(int postfix);
   
 // -- Public getters :  --------------------------------------------------------
   
+  /**
+   * Returns integer <tt>SensorID</tt> uniquely identifying a {@link Sensor} object
+   * within the whole detector, given the position of a simulated hit.
+   */
   public int getSensorID(SimTrackerHit hit) {
+    System.out.println("Hit layer: " + hit.getLayer() +" Sensor ID: " + ((_prefix << _postfixLength) | getSensorPostfix(hit)) +
+                       " Prefix: " + _prefix + " Postfix " + getSensorPostfix(hit));
     return (_prefix << _postfixLength) | getSensorPostfix(hit);
   }
   
@@ -47,7 +71,7 @@
 
   /** 
    * Returns minimum number of bits required to hold any postfix that can be returned by
-   * {@link #getSensorPostfix(SimTrackerHit)} method of this <tt>Segmenter</tt>object.
+   * {@link #getSensorPostfix(SimTrackerHit)} method of this <tt>Segmenter</tt> object.
    */
   public int getNativePostfixLength() {
     return getIdSize(getMaxPostfix());
@@ -56,7 +80,7 @@
 // -- Setters :  ---------------------------------------------------------------
   
   /**
-   * Set prefix for Sensor IDs returned by this <tt>Segmenter</tt>object.
+   * Set prefix for <tt>SensorID</tt> returned by this <tt>Segmenter</tt> object.
    * For any ID returned by {@link #getSensorID(SimTrackerHit)} method, 
    * the number of lower bits set throught a call to {@link #setPostfixLength(int)} 
    * will contain the postfix returned by {@link #getSensorPostfix(SimTrackerHit)},
@@ -70,7 +94,7 @@
   }
   
   /**
-   * Set postfix length for Sensor IDs returned by this <tt>Segmenter</tt>object.
+   * Set postfix length for <tt>SensorID</tt> returned by this <tt>Segmenter</tt> object.
    * For any ID returned by {@link #getSensorID(SimTrackerHit)} method, 
    * the number of lower bits set throught a call to this method  will contain the 
    * postfix returned by {@link #getSensorPostfix(SimTrackerHit)}, preceded by 

lcsim/src/org/lcsim/contrib/onoprien/tracking/geom/segmentation
CylindricalBarrelSegmenter.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- CylindricalBarrelSegmenter.java	31 May 2007 09:38:54 -0000	1.4
+++ CylindricalBarrelSegmenter.java	12 Jul 2007 05:00:22 -0000	1.5
@@ -1,6 +1,6 @@
 package org.lcsim.contrib.onoprien.tracking.geom.segmentation;
 
-import java.util.List;
+import java.util.*;
 
 import hep.physics.vec.BasicHep3Vector;
 import org.lcsim.event.SimTrackerHit;
@@ -21,15 +21,23 @@
 import org.lcsim.contrib.onoprien.tracking.transform.CartesianToCylindrical;
 
 /**
+ * Simplistic {@link Segmenter} that tiles barrel cylinders with Z-parallel strips or pixels.
+ * <p>
+ * Each barrel layer will correspond to a single {@link Sensor} object, with the
+ * <tt>postfix</tt> equal to layer number.
  *
  * @author D.Onoprienko
- * @version $Id: CylindricalBarrelSegmenter.java,v 1.4 2007/05/31 09:38:54 onoprien Exp $
+ * @version $Id: CylindricalBarrelSegmenter.java,v 1.5 2007/07/12 05:00:22 onoprien Exp $
  */
 public class CylindricalBarrelSegmenter extends Segmenter {
   
 // -- Constructors and initialization :  ---------------------------------------
-  
-  /** Creates a new instance of CylindricalBarrelSegmenter */
+
+  /**
+   * Creates a new instance of CylindricalBarrelSegmenter.
+   * Subdetector name supplied to the constructor is used to provide reasonable 
+   * defaults for strip width and length.
+   */
   public CylindricalBarrelSegmenter(String subdetectorName) {
     _sdName = subdetectorName;
     if (_sdName == "TrackerBarrel") {
@@ -47,20 +55,26 @@
   public void detectorChanged(Detector detector) {
     super.detectorChanged(detector);
     List<IDetectorElement> sensors = SegmentationManager.getLeaves(detector.getSubdetector(_sdName).getDetectorElement());
+    Collections.sort(sensors, new Comparator<IDetectorElement>() {
+      public int compare(IDetectorElement s1, IDetectorElement s2) {
+        return (int)Math.signum(((Tube)(s1.getGeometry().getLogicalVolume().getSolid())).getInnerRadius()
+                              - ((Tube)(s2.getGeometry().getLogicalVolume().getSolid())).getInnerRadius());
+      }
+    });
     _nLayers = sensors.size();
     _radius = new double[_nLayers];
     _length = new double[_nLayers];
     _thickness = new double[_nLayers];
-    int id = 0;
+    int postfix = 0;
     for (IDetectorElement del : sensors) {
       IGeometryInfo gInfo = del.getGeometry();
       Tube solid = (Tube) gInfo.getLogicalVolume().getSolid();
       double rInner = solid.getInnerRadius();
       double rOuter = solid.getOuterRadius();
-      _radius[id] = (rInner + rOuter)/2.;
-      _length[id] = solid.getZHalfLength()*2.;
-      _thickness[id] = (rOuter - rInner);
-      id++;
+      _radius[postfix] = (rInner + rOuter)/2.;
+      _length[postfix] = solid.getZHalfLength()*2.;
+      _thickness[postfix] = (rOuter - rInner);
+      postfix++;
     }
   }
   
@@ -84,7 +98,7 @@
    * account the prefix set through a call to {@link #setPrefix()} method.
    */
   public int getSensorPostfix(SimTrackerHit hit) {
-    return hit.getLayer() + 1;
+    return hit.getLayer();
   }
   
   /**
@@ -97,8 +111,7 @@
 
   /** Creates a {@link Sensor} object given the ID. */
   public Sensor makeSensor(int postfix) {
-    int id = postfix - 1;
-    SensorType type = new Cylinder(_length[id], _radius[id], _thickness[id], _stripLength, _stripWidth);
+    SensorType type = new Cylinder(_length[postfix], _radius[postfix], _thickness[postfix], _stripLength, _stripWidth);
     return new Sensor(type, _trans, _rot);
   }
   

lcsim/src/org/lcsim/contrib/onoprien/tracking/geom/segmentation
RingSegmenter.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- RingSegmenter.java	31 May 2007 09:38:54 -0000	1.4
+++ RingSegmenter.java	12 Jul 2007 05:00:22 -0000	1.5
@@ -1,6 +1,6 @@
 package org.lcsim.contrib.onoprien.tracking.geom.segmentation;
 
-import java.util.List;
+import java.util.*;
 
 import hep.physics.vec.BasicHep3Vector;
 import hep.physics.vec.Hep3Vector;
@@ -24,64 +24,90 @@
 
 /**
  *
- * Fix relation between layer returned by hits and copy number.
+ * Simplistic {@link Segmenter} that tiles endcap disks with strips or pixels.
+ * <p>
+ * Each disk will correspond to a {@link Sensor} object, with the <tt>postfix</tt>
+ * equal to layer number for disks in Z-positive endcap, and to layer number plus
+ * number of layers in Z-negative endcap. Disks corresponding to odd-numbered layers
+ * are rotated by an angle set through a call to {@link #setStereoAngle(double angle)}.
  *
  * @author D.Onoprienko
- * @version $Id: RingSegmenter.java,v 1.4 2007/05/31 09:38:54 onoprien Exp $
+ * @version $Id: RingSegmenter.java,v 1.5 2007/07/12 05:00:22 onoprien Exp $
  */
 public class RingSegmenter extends Segmenter {
   
 // -- Constructors and initialization :  ---------------------------------------
   
-  /** Creates a new instance of CylindricalBarrelSegmenter */
+  /** 
+   * Creates a new instance of RingSegmenter.
+   * Subdetector name supplied to the constructor is used to provide reasonable 
+   * defaults for strip width, length, and stereo angle.
+   */
   public RingSegmenter(String subdetectorName) {
     _sdName = subdetectorName;
     if (_sdName == "TrackerEndcap") {
       setStripWidth(25.*Const.micrometer);
       setStripLength(10.*Const.cm);
+      setStereoAngle(Math.PI / 2.);
     } else if (_sdName == "VertexEndcap" || _sdName == "TrackerForward") {
       setStripWidth(25.*Const.micrometer);
       setStripLength(25.*Const.micrometer);
+      setStereoAngle(0.);
     }
-    setStereoAngle(Math.PI / 2.);
   }
-  
+
   /** 
    * Detector-dependent initialization.
    */
   public void detectorChanged(Detector detector) {
     super.detectorChanged(detector);
     List<IDetectorElement> sensors = SegmentationManager.getLeaves(detector.getSubdetector(_sdName).getDetectorElement());
-    _nDisks = sensors.size();
+    Collections.sort(sensors, new Comparator<IDetectorElement>() {
+      public int compare(IDetectorElement s1, IDetectorElement s2) {
+        return (int)Math.signum(s1.getGeometry().getPosition().z()-s2.getGeometry().getPosition().z());
+      }
+    });
+    int _nDisks = sensors.size();
     _radiusInner = new double[_nDisks];
     _radiusOuter = new double[_nDisks];
     _thickness = new double[_nDisks];
     _z = new double[_nDisks];
-    int id = 0;
+    _nLayers = _nDisks/2;
+    int iDisk = 0;
     for (IDetectorElement del : sensors) {
+      int postfix = (iDisk < _nLayers) ? _nDisks - iDisk - 1 : iDisk - _nLayers;
       IGeometryInfo gInfo = del.getGeometry();
       Tube solid = (Tube) gInfo.getLogicalVolume().getSolid();
-      _radiusInner[id] = solid.getInnerRadius();
-      _radiusOuter[id] = solid.getOuterRadius();
-      _thickness[id] = solid.getZHalfLength()*2.;
-      _z[id] = gInfo.getPosition().z();
-      id++;
+      _radiusInner[postfix] = solid.getInnerRadius();
+      _radiusOuter[postfix] = solid.getOuterRadius();
+      _thickness[postfix] = solid.getZHalfLength()*2.;
+      _z[postfix] = gInfo.getPosition().z();
+      iDisk++;
     }
   }
   
 // -- Setters :  ---------------------------------------------------------------
 
-  /** Set strip width. Default is 5 micron. */
+  /**
+   * Set strip width.
+   * Default is 25 micron.
+   */
   public void setStripWidth(double pitch) {
     _stripWidth = pitch;
   }
 
-  /** Set strip length. Default is 10 cm. */
+  /**
+   * Set strip length. 
+   * Default is 10 cm for "TrackerEndcap", 25 micron for "VertexEndcap" and "TrackerForward".
+   */
   public void setStripLength(double length) {
     _stripLength = length;
   }
 
-  /** Set stereo angle. Default is 90 degrees */
+  /**
+   * Set stereo angle.
+   * Default is 90 degrees for "TrackerEndcap", 0 for "VertexEndcap" and "TrackerForward".
+   */
   public void setStereoAngle(double angle) {
     _rot1 = new Rotation3D(Axis.Z, angle);
   }
@@ -89,14 +115,10 @@
 // -----------------------------------------------------------------------------
 
   /**
-   * Returns sensor ID postfix corresponding to the given position. This postfix must 
-   * be positive  integer, unique within the part of the detector handled by this 
-   * <tt>Segmenter</tt>  object. The final Sensor ID will be constructed taking into
-   * account the prefix set through a call to {@link #setPrefix()} method.
+   * Returns sensor ID postfix corresponding to the given position.
    */
   public int getSensorPostfix(SimTrackerHit hit) {
-    int offSet = hit.getPoint()[2] > 0. ? 0 : _nDisks;
-    return hit.getLayer() + 1 + offSet;
+    return hit.getPoint()[2] > 0. ? hit.getLayer() : _nLayers + hit.getLayer();
   }
   
   /**
@@ -104,15 +126,14 @@
    * {@link #getSensorPostfix(SimTrackerHit)} method of this <tt>Segmenter</tt>object.
    */
   public int getMaxPostfix() {
-    return _nDisks * 2;
+    return _nLayers * 2;
   }
 
   /** Creates a {@link Sensor} object given the ID. */
   public Sensor makeSensor(int postfix) {
-    int id = postfix - 1;
-    SensorType type = new Ring(_radiusInner[id], _radiusOuter[id], _thickness[id], _stripLength, _stripWidth);
-    Hep3Vector trans = new BasicHep3Vector(0.,0.,_z[id]);
-    Rotation3D rot = ((postfix % _nDisks) % 2 == 1) ? _rot0 : _rot1 ;
+    SensorType type = new Ring(_radiusInner[postfix], _radiusOuter[postfix], _thickness[postfix], _stripLength, _stripWidth);
+    Hep3Vector trans = new BasicHep3Vector(0.,0.,_z[postfix]);
+    Rotation3D rot = ((postfix % _nLayers) % 2 == 0) ? _rot0 : _rot1 ;
     return new Sensor(type, trans, rot);
   }
   
@@ -120,7 +141,7 @@
   
   String _sdName;
   
-  private int _nDisks;
+  private int _nLayers;
   private double[] _radiusInner;
   private double[] _radiusOuter;
   private double[] _thickness;
CVSspam 0.2.8