Print

Print


Commit in GeomConverter/src/org/lcsim/detector on MAIN
tracker/silicon/SiSensor.java+101.21 -> 1.22
               /SiTrackerModule.java+7-11.1 -> 1.2
               /SiStrips.java+25-51.13 -> 1.14
IRotation3D.java+16-51.9 -> 1.10
Rotation3D.java+30-71.12 -> 1.13
ITransform3D.java+30-31.2 -> 1.3
Transform3D.java+21-21.5 -> 1.6
converter/compact/SiTrackerBarrelConverter.java+19-151.30 -> 1.31
+158-38
8 modified files
Rotation and Transform now support transformation of SymmetricMatrix type, useful for transforming covariance matrices.
Change to SiStrips to correct automatic strip numbering in endcaps.
Change to SiSensor and SiTrackerModule to support making 2d strip hits

GeomConverter/src/org/lcsim/detector/tracker/silicon
SiSensor.java 1.21 -> 1.22
diff -u -r1.21 -r1.22
--- SiSensor.java	11 Dec 2007 07:27:52 -0000	1.21
+++ SiSensor.java	24 Dec 2007 14:27:07 -0000	1.22
@@ -237,6 +237,16 @@
         return (this._readout_electrodes.get(carrier) != null);
     }
     
+    public boolean isDoubleSided()
+    {
+        boolean double_sided = true;
+        for (ChargeCarrier carrier : ChargeCarrier.values())
+        {
+            double_sided = double_sided && hasElectrodesOnSide(carrier);
+        }
+        return double_sided;
+    }
+    
     public double distanceFromSide(Hep3Vector point, ChargeCarrier carrier)
     {
 //        System.out.println("distanceFromSide: "+-GeomOp3D.distanceBetween(new Point3D(point),_bias_surfaces.get(carrier).getPlane()));

GeomConverter/src/org/lcsim/detector/tracker/silicon
SiTrackerModule.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- SiTrackerModule.java	5 Dec 2007 01:36:06 -0000	1.1
+++ SiTrackerModule.java	24 Dec 2007 14:27:07 -0000	1.2
@@ -24,5 +24,11 @@
     public int getModuleId()
     {
         return moduleId;
-    }    
+    }
+    
+    public boolean isDoubleSided()
+    {
+        return this.findDescendants(SiSensor.class).size() == 2;
+    }
+    
 }
\ No newline at end of file

GeomConverter/src/org/lcsim/detector/tracker/silicon
SiStrips.java 1.13 -> 1.14
diff -u -r1.13 -r1.14
--- SiStrips.java	7 Dec 2007 22:19:51 -0000	1.13
+++ SiStrips.java	24 Dec 2007 14:27:07 -0000	1.14
@@ -300,6 +300,10 @@
     {
         Line3D strip_line = new Line3D(new Point3D(getCellPosition(cell_id)),getUnmeasuredCoordinate(0));
         
+//        System.out.println("Number of strips: "+this._nstrips);
+//        System.out.println("Strip offset: "+this._strip_offset);
+//        System.out.println("Pitch: "+this._pitch);
+//        System.out.println("cell_id: "+cell_id);
 //        System.out.println("strip_line start point: "+strip_line.getStartPoint());
 //        System.out.println("strip_line direction: "+strip_line.getDirection());
         
@@ -378,18 +382,34 @@
         
 //        System.out.println("xmin: " + xmin);
 //        System.out.println("xmax: " + xmax);
-//        System.out.println("xmax: " + xmax);
 //
-//        System.out.println("# strips: " +   (int)Math.floor((xmax-xmin-2*getPitch(0))/getPitch(0)) ) ;
-        
+//
+//        System.out.println("# strips: " +   (int)Math.ceil((xmax-xmin)/getPitch(0)) ) ;
         
-        setNStrips(  (int)Math.floor((xmax-xmin)/getPitch(0)) ) ;
+        setNStrips(  (int)Math.ceil((xmax-xmin)/getPitch(0)) ) ;
     }
     
     private void setNStrips(int nstrips)
     {
         _nstrips = nstrips;
-        _strip_offset = (_nstrips-1)*_pitch/2.;
+        setStripOffset();
+//        _strip_offset = (_nstrips-1)*_pitch/2.;
+    }
+    
+    private void setStripOffset()
+    {
+        double xmin = Double.MAX_VALUE;
+        double xmax = Double.MIN_VALUE;
+        for (Point3D vertex : _geometry.getVertices())
+        {
+            xmin = Math.min(xmin,vertex.x());
+            xmax = Math.max(xmax,vertex.x());
+        }
+        
+        double strips_center = (xmin+xmax)/2;
+        
+        _strip_offset = ((_nstrips-1)*_pitch)/2 - strips_center;
+        
     }
     
     private void setPitch(double pitch)

GeomConverter/src/org/lcsim/detector
IRotation3D.java 1.9 -> 1.10
diff -u -r1.9 -r1.10
--- IRotation3D.java	7 Aug 2007 18:11:40 -0000	1.9
+++ IRotation3D.java	24 Dec 2007 14:27:08 -0000	1.10
@@ -1,5 +1,6 @@
 package org.lcsim.detector;
 
+import hep.physics.matrix.SymmetricMatrix;
 import hep.physics.vec.Hep3Matrix;
 import hep.physics.vec.Hep3Vector;
 
@@ -13,7 +14,7 @@
  * @author Tim Nelson
  * @author Jeremy McCormick
  *
- * @version $Id: IRotation3D.java,v 1.9 2007/08/07 18:11:40 tknelson Exp $
+ * @version $Id: IRotation3D.java,v 1.10 2007/12/24 14:27:08 tknelson Exp $
  */
 public interface IRotation3D
 {
@@ -50,7 +51,6 @@
      * Rotate a Hep3Vector in place
      * @param coordinates
      */
-    
     public void rotate(Hep3Vector coordinates);
     
     /**
@@ -58,15 +58,26 @@
      * @param coordinates
      * @return rotated Hep3Vector
      */
-    
     public Hep3Vector rotated(Hep3Vector coordinates);
     
     /**
+     * Rotate a SymmetricMatrix in place (e.g. covariance matrix)
+     * @param matrix
+     */
+    public void rotate(SymmetricMatrix matrix);
+    
+    /**
+     * Rotate a SymmetricMatrix (e.g. covariance matrix)
+     * @param matrix
+     * @return rotated SymmetricMatrix
+     */
+    public SymmetricMatrix rotated(SymmetricMatrix matrix);
+    
+    /**
      * Compare this IRotation3D with another.
      * @param rotation
      * @return True if all components of the matrices are equal.
      */
-    
     public boolean equals(IRotation3D rotation);
     
     /**
@@ -99,7 +110,7 @@
      * @return True if this rotation is equal to identity.
      */
     public boolean isIdentity();
-
+    
     /**
      * Print out rotation
      * @param PrintStream for output

GeomConverter/src/org/lcsim/detector
Rotation3D.java 1.12 -> 1.13
diff -u -r1.12 -r1.13
--- Rotation3D.java	25 Sep 2007 22:37:15 -0000	1.12
+++ Rotation3D.java	24 Dec 2007 14:27:08 -0000	1.13
@@ -1,5 +1,8 @@
 package org.lcsim.detector;
 
+import hep.physics.matrix.Matrix;
+import hep.physics.matrix.MatrixOp;
+import hep.physics.matrix.SymmetricMatrix;
 import hep.physics.vec.BasicHep3Matrix;
 import hep.physics.vec.BasicHep3Vector;
 import hep.physics.vec.Hep3Matrix;
@@ -13,7 +16,7 @@
  *
  * @author Tim Nelson <[log in to unmask]>
  * @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: Rotation3D.java,v 1.12 2007/09/25 22:37:15 tknelson Exp $
+ * @version $Id: Rotation3D.java,v 1.13 2007/12/24 14:27:08 tknelson Exp $
  */
 public class Rotation3D implements IRotation3D
 {
@@ -21,7 +24,7 @@
      * The 3x3 rotation _matrix representing the state of this Rotation3D.
      */
     protected Hep3Matrix _matrix = BasicHep3Matrix.identity();
-   
+    
     /**
      * Construct a Rotation3D with the identity _matrix.
      */
@@ -129,6 +132,26 @@
         return VecOp.mult(_matrix,coordinates);
     }
     
+    public void rotate(SymmetricMatrix matrix)
+    {
+        SymmetricMatrix rotated_matrix = rotated(matrix);
+        for (int irow = 0; irow < matrix.getNRows(); irow++)
+        {
+            for (int icol = 0; icol < matrix.getNColumns(); icol++)
+            {
+                matrix.setElement(irow,icol,rotated_matrix.e(irow,icol));
+            }
+        }
+        
+    }
+    
+    public SymmetricMatrix rotated(SymmetricMatrix matrix)
+    {
+        Matrix rotation_matrix = getRotationMatrix();
+        Matrix rotation_matrix_transposed = inverse().getRotationMatrix();
+        return new SymmetricMatrix(MatrixOp.mult(rotation_matrix,MatrixOp.mult(matrix,rotation_matrix_transposed)));
+    }
+    
     public static Rotation3D multiply(IRotation3D rot1, IRotation3D rot2)
     {
         return new Rotation3D(VecOp.mult(rot1.getRotationMatrix(), rot2.getRotationMatrix()));
@@ -155,7 +178,7 @@
     {
         return equals(BasicHep3Matrix.identity());
     }
-
+    
     // Static Methods
     //===============
     public static IRotation3D passiveXRotation(double angle)
@@ -205,17 +228,17 @@
         double dx = unit_axis.x();
         double dy = unit_axis.y();
         double dz = unit_axis.z();
-
+        
         double sa = Math.sin(angle);
         double ca = Math.cos(angle);
-
+        
         BasicHep3Matrix rotation_matrix = new BasicHep3Matrix
                 (
                 ca+(1-ca)*dx*dx,        (1-ca)*dx*dy-sa*dz,     (1-ca)*dx*dz+sa*dy,
                 (1-ca)*dy*dx+sa*dz,     ca+(1-ca)*dy*dy,        (1-ca)*dy*dz-sa*dx,
-                (1-ca)*dz*dx-sa*dy,     (1-ca)*dz*dy+sa*dx,     ca+(1-ca)*dz*dz 
+                (1-ca)*dz*dx-sa*dy,     (1-ca)*dz*dy+sa*dx,     ca+(1-ca)*dz*dz
                 );
-
+        
         return new Rotation3D(rotation_matrix);
         
     }

GeomConverter/src/org/lcsim/detector
ITransform3D.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- ITransform3D.java	7 Aug 2007 18:11:40 -0000	1.2
+++ ITransform3D.java	24 Dec 2007 14:27:08 -0000	1.3
@@ -4,6 +4,7 @@
 
 package org.lcsim.detector;
 
+import hep.physics.matrix.SymmetricMatrix;
 import hep.physics.vec.Hep3Vector;
 
 /**
@@ -11,7 +12,7 @@
  * @author tknelson
  */
 public interface ITransform3D
-{       
+{
     
     /**
      * Get Hep3Vector corresponding to translation
@@ -35,6 +36,12 @@
     public void transform(Hep3Vector coordinates);
     
     /**
+     * Transform SymmetricMatrix in place (e.g. covariance)
+     * @param matrix to transform
+     */
+    public void transform(SymmetricMatrix matrix);
+    
+    /**
      * Translate coordinates in place
      * @param coordinates to translate
      */
@@ -46,6 +53,12 @@
      */
     public void rotate(Hep3Vector coordinates);
     
+    /**
+     * Rotate SymmetricMatrix in place (e.g. covariance)
+     * @param matrix to rotate
+     */
+    public void rotate(SymmetricMatrix matrix);
+    
     // Transformations creating new position vectors
     //==============================================
     
@@ -55,14 +68,21 @@
      * @return transformed coordinates
      */
     public Hep3Vector transformed(Hep3Vector coordinates);
-        
+    
+    /**
+     * Transform SymmetricMatrix (e.g. covariance)
+     * @param matrix to transform
+     * @return transformed matrix
+     */
+    public SymmetricMatrix transformed(SymmetricMatrix matrix);
+    
     /**
      * Translated coordinates
      * @param coordinates to translate
      * @return translated coordinates
      */
     public Hep3Vector translated(Hep3Vector coordinates);
-        
+    
     /**
      * Rotate coordinates
      * @param coordinates to rotate
@@ -71,6 +91,13 @@
     public Hep3Vector rotated(Hep3Vector coordinates);
     
     /**
+     * Rotate SymmetricMatrix (e.g. covariance)
+     * @param matrix to rotate
+     * @return rotated matrix
+     */
+    public SymmetricMatrix rotated(SymmetricMatrix matrix);
+    
+    /**
      * Multply this by another transformation in place
      * @param transformation to multiply by
      */

GeomConverter/src/org/lcsim/detector
Transform3D.java 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- Transform3D.java	7 Aug 2007 18:11:40 -0000	1.5
+++ Transform3D.java	24 Dec 2007 14:27:08 -0000	1.6
@@ -4,9 +4,8 @@
 
 package org.lcsim.detector;
 
-import hep.physics.vec.BasicHep3Vector;
+import hep.physics.matrix.SymmetricMatrix;
 import hep.physics.vec.Hep3Vector;
-import hep.physics.vec.VecOp;
 
 /**
  * A class for representing a 3D coordinate transformation
@@ -75,6 +74,11 @@
         translate(coordinates);
     }
     
+    public void transform(SymmetricMatrix matrix)
+    {
+        rotate(matrix);
+    }
+    
     public void translate(Hep3Vector coordinates)
     {
         _translation.translate(coordinates);
@@ -84,6 +88,11 @@
     {
         _rotation.rotate(coordinates);
     }
+    
+    public void rotate(SymmetricMatrix matrix)
+    {
+        _rotation.rotate(matrix);
+    }
      
     // Return transformed vectors
     public Hep3Vector transformed(Hep3Vector coordinates)
@@ -91,6 +100,11 @@
         return translated(rotated(coordinates));
     }
     
+    public SymmetricMatrix transformed(SymmetricMatrix matrix)
+    {
+        return rotated(matrix);
+    }
+    
     public Hep3Vector translated(Hep3Vector coordinates)
     {
         return _translation.translated(coordinates);
@@ -101,6 +115,11 @@
         return _rotation.rotated(coordinates);
     }
     
+    public SymmetricMatrix rotated(SymmetricMatrix matrix)
+    {
+        return _rotation.rotated(matrix);
+    }
+    
     // Invert the transformation
     public void invert()
     {

GeomConverter/src/org/lcsim/detector/converter/compact
SiTrackerBarrelConverter.java 1.30 -> 1.31
diff -u -r1.30 -r1.31
--- SiTrackerBarrelConverter.java	11 Dec 2007 07:27:51 -0000	1.30
+++ SiTrackerBarrelConverter.java	24 Dec 2007 14:27:08 -0000	1.31
@@ -50,8 +50,8 @@
 import org.lcsim.geometry.subdetector.SiTrackerBarrel;
 
 public class SiTrackerBarrelConverter
-extends AbstractSubdetectorConverter
-implements ISubdetectorConverter
+        extends AbstractSubdetectorConverter
+        implements ISubdetectorConverter
 {
     /*
     public IDetectorElement makeSubdetectorDetectorElement(Detector detector, Subdetector subdetector)
@@ -59,15 +59,15 @@
         subdetector.setDetectorElement( new DeSiTrackerBarrel(subdetector.getName(), detector.getDetectorElement()));
         return subdetector.getDetectorElement();
     }
-    */
-
+     */
+    
     public IIdentifierHelper makeIdentifierHelper(Subdetector subdetector, SystemMap systemMap)
     {
         return new SiTrackerIdentifierHelper(makeIdentifierDictionary(subdetector), systemMap);
-    }    
-
+    }
+    
     public void convert( Subdetector subdet, Detector detector)
-    {        
+    {
         Map<String, ILogicalVolume> modules = buildModules(subdet);
         
         try
@@ -515,22 +515,22 @@
                                 getIdentifierDictionary( subdet.getReadout().getName() );
                         
                         ExpandedIdentifier expId = new ExpandedIdentifier(iddict.getNumberOfFields());
-
+                        
                         // Set the System ID.
                         expId.setValue(iddict.getFieldIndex("system"), subdet.getSystemID());
-
+                        
                         // Set the barrel-endcap flag.
                         expId.setValue(iddict.getFieldIndex("barrel"), 0);
-
+                        
                         // Set the layer number.
                         expId.setValue(iddict.getFieldIndex("layer"), layer.getGeometry().getPath().getLeafVolume().getCopyNumber());
-
+                        
                         // Set the module id from the DetectorElement.
                         expId.setValue(iddict.getFieldIndex("module"),((SiTrackerModule)module).getModuleId());
-
+                        
                         // Set the sensor id for double-sided.
                         expId.setValue(iddict.getFieldIndex("sensor"),sensorId);
-
+                        
                         // Create the packed id using util method.
                         // No IdentifierHelper is available yet.
                         IIdentifier id = IdentifierUtil.pack( iddict, expId );
@@ -571,9 +571,13 @@
                         IRotation3D electrodes_rotation = new RotationPassiveXYZ(0.0,0.0,0.0);                                      // no rotation (global x-y = local x-y for axial strips)
                         Transform3D electrodes_transform = new Transform3D(electrodes_position, electrodes_rotation);
                         
+                        // Free calculation of readout electrodes, sense electrodes determined thereon
+                        SiSensorElectrodes readout_electrodes = new SiStrips(ChargeCarrier.HOLE,0.050,sensor,electrodes_transform);
+                        SiSensorElectrodes sense_electrodes = new SiStrips(ChargeCarrier.HOLE,0.025,(readout_electrodes.getNCells()*2-1),sensor,electrodes_transform);
+
                         // Free calculation of sense electrodes, readout electrodes determined thereon
-                        SiSensorElectrodes sense_electrodes = new SiStrips(ChargeCarrier.HOLE,0.025,sensor,electrodes_transform);
-                        SiSensorElectrodes readout_electrodes = new SiStrips(ChargeCarrier.HOLE,0.050,(sense_electrodes.getNCells()+1)/2,sensor,electrodes_transform);
+//                        SiSensorElectrodes sense_electrodes = new SiStrips(ChargeCarrier.HOLE,0.025,sensor,electrodes_transform);
+//                        SiSensorElectrodes readout_electrodes = new SiStrips(ChargeCarrier.HOLE,0.050,(sense_electrodes.getNCells()+1)/2,sensor,electrodes_transform);
                         
                         sensor.setSenseElectrodes(sense_electrodes);
                         sensor.setReadoutElectrodes(readout_electrodes);
CVSspam 0.2.8