Commit in lcsim/src/org/lcsim/contrib/onoprien/vsegment on MAIN
transform/RefFrameCylinder.java+116added 1.1
         /RefFrameCylinderLZR.java+126added 1.1
         /RefFrameLocalOnCylinder.java+112added 1.1
         /package-info.java+4added 1.1
         /IRefFrame.java+5-51.1 -> 1.2
         /Axis.java-201.1 removed
hit/package-info.java+4added 1.1
mctruth/package-info.java+4added 1.1
+371-25
6 added + 1 removed + 1 modified, total 8 files
Non-Cartesian reference frame implementations and SensorTypes using them.
A few kludges will have to be removed after finalizing hitmaking.

lcsim/src/org/lcsim/contrib/onoprien/vsegment/transform
RefFrameCylinder.java added at 1.1
diff -N RefFrameCylinder.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ RefFrameCylinder.java	5 Sep 2008 21:40:04 -0000	1.1
@@ -0,0 +1,116 @@
+package org.lcsim.contrib.onoprien.vsegment.transform;
+
+import hep.physics.matrix.SymmetricMatrix;
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Vector;
+import org.lcsim.math.coordinatetransform.CovarianceMatrixTransformer;
+
+
+/**
+ * 
+ *
+ * @author D. Onoprienko
+ * @version $Id: RefFrameCylinder.java,v 1.1 2008/09/05 21:40:04 onoprien Exp $
+ */
+public class RefFrameCylinder implements IRefFrame {
+  
+// -- Constructors :  ----------------------------------------------------------
+  
+  public RefFrameCylinder(ConstHep3Vector origin) {
+    _origin = origin;
+  }
+  
+  public RefFrameCylinder(Hep3Vector origin) {
+    _origin = new ConstHep3Vector(origin);
+  }
+
+// -- Getters :  ---------------------------------------------------------------
+  
+  public Owner getOwner() {return Owner.SENSOR;}
+  
+  public Type getType() {return Type.CYL;}
+  
+  public Hep3Vector u() {throw new UnsupportedOperationException();}
+  
+  public Hep3Vector v() {throw new UnsupportedOperationException();}
+  
+  public Hep3Vector w() {throw new UnsupportedOperationException();}
+  
+  public Hep3Vector getOrigin() {
+    return _origin;
+  }
+  
+// -- Transformation :  --------------------------------------------------------
+  
+  /**
+   * Returns coordinates of a point in the transformed reference frame given its 
+   * coordinates in the original reference frame. 
+   */
+  public BasicHep3Vector transformTo(Hep3Vector vector) {
+    double x = vector.x() - _origin.x();
+    double y = vector.y() - _origin.y();
+    double u = Math.atan2(y,x);
+    double v = vector.z() - _origin.z();
+    double w = Math.hypot(x,y);
+    return new BasicHep3Vector(u,v,w);
+  }
+  
+  /**
+   * Returns coordinates of a point in the original reference frame given its 
+   * coordinates in the transformed reference frame. 
+   */
+  public BasicHep3Vector transformFrom(Hep3Vector vector) {
+    double r = vector.z();
+    double phi = vector.x();
+    double x = _origin.x() + r * Math.cos(phi);
+    double y = _origin.y() + r * Math.sin(phi);
+    double z = _origin.z() + vector.y();
+    return new BasicHep3Vector(x,y,z);
+  }
+  
+  /**
+   * Throws <tt>UnsupportedOperationException</tt> since for this type of reference frame,
+   * covariance matrix cannot be transformed without knowing the position.
+   */
+  public SymmetricMatrix transformTo(SymmetricMatrix covMatrix) {
+    throw new UnsupportedOperationException();
+  }
+  
+  /**
+   * Throws <tt>UnsupportedOperationException</tt> since for this type of reference frame,
+   * covariance matrix cannot be transformed without knowing the position.
+   */
+  public SymmetricMatrix transformFrom(SymmetricMatrix covMatrix) {
+    throw new UnsupportedOperationException();
+  }
+  
+  /**
+   * Returns covariance matrix in the transformed reference frame given the 
+   * covariance matrix and position in the original reference frame. 
+   */
+  public SymmetricMatrix transformTo(SymmetricMatrix covMatrix, Hep3Vector vector) {
+    double x = vector.x() - _origin.x();
+    double y = vector.y() - _origin.y();
+    double[] cov = CovarianceMatrixTransformer.xy2rphi(x, y, covMatrix.e(0,0), covMatrix.e(1,1), covMatrix.e(0,1));
+    return new SymmetricMatrix(3, new double[] {cov[0], 
+                                                    0.,  covMatrix.e(2,2),
+                                                cov[2],                0.,  cov[1] }, true);
+  }
+  
+  /**
+   * Returns covariance matrix in the original reference frame given the 
+   * covariance matrix and position in the transformed reference frame. 
+   */
+  public SymmetricMatrix transformFrom(SymmetricMatrix covMatrix, Hep3Vector vector) {
+    double phi = vector.x();
+    double r = vector.z();
+    double[] cov = CovarianceMatrixTransformer.rphi2xy(r, phi, covMatrix.e(2,2), covMatrix.e(0,0), covMatrix.e(0,2));
+    return new SymmetricMatrix(3, new double[] {cov[0],
+                                                cov[2],  cov[1],
+                                                    0.,      0.,  covMatrix.e(1,1)}, true);
+  }
+  
+// -- Private parts :  ---------------------------------------------------------
+
+  ConstHep3Vector _origin;
+}

lcsim/src/org/lcsim/contrib/onoprien/vsegment/transform
RefFrameCylinderLZR.java added at 1.1
diff -N RefFrameCylinderLZR.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ RefFrameCylinderLZR.java	5 Sep 2008 21:40:04 -0000	1.1
@@ -0,0 +1,126 @@
+package org.lcsim.contrib.onoprien.vsegment.transform;
+
+import hep.physics.matrix.SymmetricMatrix;
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Vector;
+import org.lcsim.math.coordinatetransform.CovarianceMatrixTransformer;
+
+
+/**
+ * 
+ *
+ * @author D. Onoprienko
+ * @version $Id: RefFrameCylinderLZR.java,v 1.1 2008/09/05 21:40:04 onoprien Exp $
+ */
+public class RefFrameCylinderLZR implements IRefFrame {
+  
+// -- Constructors :  ----------------------------------------------------------
+  
+  public RefFrameCylinderLZR(ConstHep3Vector origin, double radius) {
+    _origin = origin;
+    _r = radius;
+  }
+  
+  public RefFrameCylinderLZR(Hep3Vector origin, double radius) {
+    _origin = new ConstHep3Vector(origin);
+    _r = radius;
+  }
+
+// -- IRefFrame getters :  -----------------------------------------------------
+  
+  public Owner getOwner() {return Owner.SENSOR;}
+  
+  public Type getType() {return Type.CYL_LZR;}
+  
+  public Hep3Vector u() {throw new UnsupportedOperationException();}
+  
+  public Hep3Vector v() {throw new UnsupportedOperationException();}
+  
+  public Hep3Vector w() {throw new UnsupportedOperationException();}
+  
+  public Hep3Vector getOrigin() {
+    return _origin;
+  }
+  
+// -- Transformation :  --------------------------------------------------------
+  
+  /**
+   * Returns coordinates of a point in the transformed reference frame given its 
+   * coordinates in the original reference frame. 
+   */
+  public Hep3Vector transformTo(Hep3Vector vector) {
+    double x = vector.x() - _origin.x();
+    double y = vector.y() - _origin.y();
+    double u = Math.atan2(y,x) * _r ;
+    double v = vector.z() - _origin.z();
+    double w = Math.hypot(x,y) - _r ;
+    return new BasicHep3Vector(u,v,w);
+  }
+  
+  /**
+   * Returns coordinates of a point in the original reference frame given its 
+   * coordinates in the transformed reference frame. 
+   */
+  public Hep3Vector transformFrom(Hep3Vector vector) {
+    double r = vector.z() + _r ;
+    double phi = vector.x() / _r ;
+    double x = _origin.x() + r * Math.cos(phi);
+    double y = _origin.y() + r * Math.sin(phi);
+    double z = _origin.z() + vector.y();
+    return new BasicHep3Vector(x,y,z);
+  }
+  
+  /**
+   * Throws <tt>UnsupportedOperationException</tt> since for this type of reference frame,
+   * covariance matrix cannot be transformed without knowing the position.
+   */
+  public SymmetricMatrix transformTo(SymmetricMatrix covMatrix) {
+    throw new UnsupportedOperationException();
+  }
+  
+  /**
+   * Throws <tt>UnsupportedOperationException</tt> since for this type of reference frame,
+   * covariance matrix cannot be transformed without knowing the position.
+   */
+  public SymmetricMatrix transformFrom(SymmetricMatrix covMatrix) {
+    throw new UnsupportedOperationException();
+  }
+  
+  /**
+   * Returns covariance matrix in the transformed reference frame given the 
+   * covariance matrix and position in the original reference frame. 
+   */
+  public SymmetricMatrix transformTo(SymmetricMatrix covMatrix, Hep3Vector vector) {
+    double x = vector.x() - _origin.x();
+    double y = vector.y() - _origin.y();
+    double[] cov = CovarianceMatrixTransformer.xy2rphi(x, y, covMatrix.e(0,0), covMatrix.e(1,1), covMatrix.e(0,1));
+    return new SymmetricMatrix(3, new double[] {cov[0]*_r*_r, 
+                                                          0.,  covMatrix.e(2,2),
+                                                   cov[2]*_r,                0.,  cov[1] }, true);
+  }
+  
+  /**
+   * Returns covariance matrix in the original reference frame given the 
+   * covariance matrix and position in the transformed reference frame. 
+   */
+  public SymmetricMatrix transformFrom(SymmetricMatrix covMatrix, Hep3Vector vector) {
+    double phi = vector.x() / _r ;
+    double r = vector.z() + _r;
+    double[] cov = CovarianceMatrixTransformer.rphi2xy(r, phi, 
+            covMatrix.e(2,2), covMatrix.e(0,0)/(_r*_r), covMatrix.e(0,2)/_r);
+    return new SymmetricMatrix(3, new double[] {cov[0],
+                                                cov[2],  cov[1],
+                                                    0.,      0.,  covMatrix.e(1,1)}, true);
+  }
+  
+// -- Extra getters :  ---------------------------------------------------------
+  
+  double getRadius() {
+    return _r;
+  }
+
+// -- Private parts :  ---------------------------------------------------------
+
+  ConstHep3Vector _origin;
+  double _r;
+}

lcsim/src/org/lcsim/contrib/onoprien/vsegment/transform
RefFrameLocalOnCylinder.java added at 1.1
diff -N RefFrameLocalOnCylinder.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ RefFrameLocalOnCylinder.java	5 Sep 2008 21:40:04 -0000	1.1
@@ -0,0 +1,112 @@
+package org.lcsim.contrib.onoprien.vsegment.transform;
+
+import hep.physics.matrix.SymmetricMatrix;
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Vector;
+
+/**
+ *
+ *
+ * @author D. Onoprienko
+ * @version $Id: RefFrameLocalOnCylinder.java,v 1.1 2008/09/05 21:40:04 onoprien Exp $
+ */
+public class RefFrameLocalOnCylinder implements IRefFrame {
+  
+// -- Constructors :  ----------------------------------------------------------
+  
+  public RefFrameLocalOnCylinder(RefFrameCylinder sensorFrame, double phi, double z, double radius) {
+    _rf = sensorFrame;
+    _phi = phi;
+    _z = z;
+    _r = radius;
+  }
+  
+  public RefFrameLocalOnCylinder(RefFrameCylinder sensorFrame, Hep3Vector position) {
+    _rf = sensorFrame;
+    _phi = position.x();
+    _z = position.y();
+    _r = position.z();
+  }
+
+// -- Getters :  ---------------------------------------------------------------
+  
+  public Owner getOwner() {return Owner.LOCAL;}
+  
+  public Type getType() {return Type.XYZ;}
+  
+  public Hep3Vector u() {
+    return new ConstHep3Vector(-Math.sin(_phi), Math.cos(_phi), 0.);
+  }
+  
+  public Hep3Vector v() {
+    return ConstHep3Vector.V001;
+  }
+  
+  public Hep3Vector w() {
+    return new ConstHep3Vector(Math.cos(_phi), Math.sin(_phi), 0.);
+  }
+  
+  public Hep3Vector getOrigin() {
+    return _rf.transformFrom(new ConstHep3Vector(_phi, _z, _r));
+  }
+  
+// -- Transformation :  --------------------------------------------------------
+  
+  /**
+   * Returns coordinates of a point in the transformed reference frame given its 
+   * coordinates in the original reference frame. 
+   */
+  public Hep3Vector transformTo(Hep3Vector vector) {
+    BasicHep3Vector c = _rf.transformTo(vector);
+    throw new UnsupportedOperationException("FIXME");
+  }
+  
+  /**
+   * Returns coordinates of a point in the original reference frame given its 
+   * coordinates in the transformed reference frame. 
+   */
+  public Hep3Vector transformFrom(Hep3Vector vector) {
+    throw new UnsupportedOperationException("FIXME");
+  }
+  
+  /**
+   * Returns covariance matrix in the transformed reference frame given the 
+   * covariance matrix in the original reference frame. 
+   * Throws <tt>RuntimeException</tt> if transformed covariance matrix cannot be
+   * computed based on the original covariance matrix alone.
+   */
+  public SymmetricMatrix transformTo(SymmetricMatrix covMatrix) {
+    throw new UnsupportedOperationException("FIXME");
+  }
+  
+  /**
+   * Returns covariance matrix in the original reference frame given the 
+   * covariance matrix in the transformed reference frame. 
+   * Throws <tt>RuntimeException</tt> if original covariance matrix cannot be
+   * computed based on the transformed covariance matrix alone.
+   */
+  public SymmetricMatrix transformFrom(SymmetricMatrix covMatrix) {
+    throw new UnsupportedOperationException("FIXME");
+  }
+  
+  /**
+   * Returns covariance matrix in the transformed reference frame given the 
+   * covariance matrix and position in the original reference frame. 
+   */
+  public SymmetricMatrix transformTo(SymmetricMatrix covMatrix, Hep3Vector vector) {
+    return transformTo(covMatrix);
+  }
+  
+  /**
+   * Returns covariance matrix in the original reference frame given the 
+   * covariance matrix and position in the transformed reference frame. 
+   */
+  public SymmetricMatrix transformFrom(SymmetricMatrix covMatrix, Hep3Vector vector) {
+    return transformFrom(covMatrix);
+  }
+  
+// -- Private parts :  ---------------------------------------------------------
+  
+  private double _phi, _z, _r;
+  private RefFrameCylinder _rf;
+}

lcsim/src/org/lcsim/contrib/onoprien/vsegment/transform
package-info.java added at 1.1
diff -N package-info.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ package-info.java	5 Sep 2008 21:40:04 -0000	1.1
@@ -0,0 +1,4 @@
+/**
+ * Utility classes used in reference frames transformations.
+ */
+package org.lcsim.contrib.onoprien.vsegment.transform;

lcsim/src/org/lcsim/contrib/onoprien/vsegment/transform
IRefFrame.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- IRefFrame.java	2 Sep 2008 19:29:44 -0000	1.1
+++ IRefFrame.java	5 Sep 2008 21:40:04 -0000	1.2
@@ -8,7 +8,7 @@
  * Interface to represent a reference frame.
  *
  * @author D. Onoprienko
- * @version $Id: IRefFrame.java,v 1.1 2008/09/02 19:29:44 onoprien Exp $
+ * @version $Id: IRefFrame.java,v 1.2 2008/09/05 21:40:04 onoprien Exp $
  */
 public interface IRefFrame {
   
@@ -31,11 +31,11 @@
     /** Cartesian reference frame. */
     XYZ,
     
-    /** Reference frame associated with a particular sensor. */
-    CYL_Phi_Z_R,
+    /** Cylindrical reference frame. */
+    CYL,
     
-    /** Local reference frame associated with a particular hit. */
-    CYL_PhiR_Z_R
+    /** Cylindrical reference frame with coordinates (Phi*R0, Z, R-R0). */
+    CYL_LZR
   }
   
 // -- Getters :  ---------------------------------------------------------------

lcsim/src/org/lcsim/contrib/onoprien/vsegment/transform
Axis.java removed after 1.1
diff -N Axis.java
--- Axis.java	2 Sep 2008 19:29:44 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,20 +0,0 @@
-package org.lcsim.contrib.onoprien.vsegment.transform;
-
-/**
- *
- * @author D.Onoprienko
- * @version $Id: Axis.java,v 1.1 2008/09/02 19:29:44 onoprien Exp $
- */
-public enum Axis {
-  
-  X(0),
-  Y(1),
-  Z(2);
-  
-  private int _index;
-  
-  private Axis(int index) {_index = index;}
-  
-  public int index() {return _index;}
- 
-}

lcsim/src/org/lcsim/contrib/onoprien/vsegment/hit
package-info.java added at 1.1
diff -N package-info.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ package-info.java	5 Sep 2008 21:40:05 -0000	1.1
@@ -0,0 +1,4 @@
+/**
+ * Tracking object model - generic interfaces and virtual segmentation specific implementations.
+ */
+package org.lcsim.contrib.onoprien.vsegment.hit;

lcsim/src/org/lcsim/contrib/onoprien/vsegment/mctruth
package-info.java added at 1.1
diff -N package-info.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ package-info.java	5 Sep 2008 21:40:05 -0000	1.1
@@ -0,0 +1,4 @@
+/**
+ * Classes handling access to Monte Carlo truth information.
+ */
+package org.lcsim.contrib.onoprien.vsegment.mctruth;
CVSspam 0.2.8