Print

Print


Commit in GeomConverter on MAIN
sandbox/identifier/IIdentifier64.java-101.2 removed
src/org/lcsim/detector/DetectorElement.java+31-41.16 -> 1.17
                      /DetectorElementContainer.java+31.2 -> 1.3
                      /DetectorFactory.java+51.4 -> 1.5
                      /IDetectorElement.java+104-411.12 -> 1.13
                      /IDetectorElementContainer.java+321.3 -> 1.4
                      /IDetectorElementStore.java+11-31.1 -> 1.2
                      /IDetectorFactory.java+21.7 -> 1.8
                      /IRotation3D.java+2-1661.5 -> 1.6
                      /Rotation3D.java+1-951.9 -> 1.10
src/org/lcsim/detector/converter/compact/DeDetector.java+33added 1.1
                                        /DetectorConverter.java+76-201.12 -> 1.13
src/org/lcsim/detector/identifier/ExpandedIdentifier.java+99added 1.1
                                 /IExpandedIdentifier.java+21added 1.1
                                 /IIdentifierDictionary.java+19added 1.1
                                 /IIdentifierDictionaryManager.java+13added 1.1
                                 /IIdentifierField.java+15added 1.1
                                 /IIdentifierHelper.java+17added 1.1
                                 /Identifier.java+91added 1.1
                                 /IdentifierDictionary.java+62added 1.1
                                 /IdentifierDictionaryManager.java+36added 1.1
                                 /IdentifierField.java+54added 1.1
                                 /IdentifierHelper.java+76added 1.1
                                 /IIdentifier.java+39-521.2 -> 1.3
src/org/lcsim/geometry/Subdetector.java+71.18 -> 1.19
src/org/lcsim/geometry/layer/Layer.java+31.11 -> 1.12
test/org/lcsim/detector/converter/compact/DiskTrackerTest.java+11-41.4 -> 1.5
test/org/lcsim/detector/identifier/IdentifierHelperTest.java+62added 1.1
+925-395
13 added + 1 removed + 14 modified, total 28 files
JM: Dev snapshot.  First version of identifier package.

GeomConverter/sandbox/identifier
IIdentifier64.java removed after 1.2
diff -N IIdentifier64.java
--- IIdentifier64.java	28 Feb 2007 19:50:47 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,10 +0,0 @@
-interface IIdentifier64 extends IIdentifier
-{
-    public boolean equals(IIdentifier64 id);
-    public boolean nequals(IIdentifier64 id);
-    public boolean less(IIdentifier64 id);
-    public boolean greater(IIdentifier64 id);
-	
-    long value();
-    void set(long newValue);
-}

GeomConverter/src/org/lcsim/detector
DetectorElement.java 1.16 -> 1.17
diff -u -r1.16 -r1.17
--- DetectorElement.java	27 Apr 2007 23:32:50 -0000	1.16
+++ DetectorElement.java	2 May 2007 01:58:18 -0000	1.17
@@ -3,16 +3,17 @@
 import hep.physics.vec.Hep3Vector;
 
 import org.lcsim.detector.identifier.IIdentifier;
+import org.lcsim.detector.identifier.IIdentifierHelper;
 
 public class DetectorElement 
 extends Named
 implements IDetectorElement
 {
     private IDetectorElementContainer children = new DetectorElementContainer(); 
-
     private IGeometryInfo geometry = null;
     private IDetectorElement parent = null;
-    private IIdentifier id = null; 
+    private IIdentifier id = null;
+    private IIdentifierHelper helper = null;
     private IParameters parameters = new Parameters();
     private IReadout readout;
 
@@ -84,8 +85,8 @@
             String name,
             IDetectorElement parent)
     {
-        super(name);        
-        setParent(parent);        
+        super(name);
+        setup(parent,(IPhysicalVolumePath)null,null);
         register();
     }
 
@@ -334,4 +335,30 @@
             }
         }
     }   
+    
+    public boolean isDescendant(IDetectorElement de)
+    {
+        boolean isDesc = false;
+        if ( hasChildren() )
+        {
+            if ( children.contains( de) )
+            {
+                return isDesc = true;
+            }
+            else {
+                for ( IDetectorElement child : children )
+                {
+                    isDesc = child.isDescendant( de );
+                    if ( isDesc )
+                        break;
+                }
+            }
+        }
+        return isDesc;
+    }
+    
+    public void setIdentifierHelper( IIdentifierHelper helper )
+    {
+        this.helper = helper;
+    }
 }
\ No newline at end of file

GeomConverter/src/org/lcsim/detector
DetectorElementContainer.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- DetectorElementContainer.java	20 Mar 2007 21:19:59 -0000	1.2
+++ DetectorElementContainer.java	2 May 2007 01:58:18 -0000	1.3
@@ -2,6 +2,9 @@
 
 import java.util.ArrayList;
 
+/**
+ * 
+ */
 public class DetectorElementContainer
 extends ArrayList<IDetectorElement>
 implements IDetectorElementContainer

GeomConverter/src/org/lcsim/detector
DetectorFactory.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- DetectorFactory.java	17 Mar 2007 00:10:40 -0000	1.4
+++ DetectorFactory.java	2 May 2007 01:58:18 -0000	1.5
@@ -138,4 +138,9 @@
 				outerRadius,
 				zHalfLength);
 	}
+    
+    public <T> IReadout<T> createReadout()
+    {
+        return new Readout<T>();
+    }    
 }
\ No newline at end of file

GeomConverter/src/org/lcsim/detector
IDetectorElement.java 1.12 -> 1.13
diff -u -r1.12 -r1.13
--- IDetectorElement.java	27 Apr 2007 23:32:50 -0000	1.12
+++ IDetectorElement.java	2 May 2007 01:58:18 -0000	1.13
@@ -4,46 +4,70 @@
 
 import org.lcsim.detector.identifier.IIdentifiable;
 import org.lcsim.detector.identifier.IIdentifier;
+import org.lcsim.detector.identifier.IIdentifierHelper;
 
 /**
- * A class to represent a node in the detector tree,
- * based on Gaudi's IDetectorElement interface.
+ * A class to represent a node in the detector hierarchy,
+ * based on Gaudi's IDetectorElement interface.  The
+ * concept of DetectorElement is more abstract than
+ * physical geometry, as it may simply be a container
+ * for other DetectorElements and need not have a physical
+ * representation in the geometry tree.
  * 
- * @author Tim Nelson <[log in to unmask]>
- * @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: IDetectorElement.java,v 1.12 2007/04/27 23:32:50 jeremy Exp $
+ * @see DetectorElement
+ * @see IDetectorElementStore
+ * @see IDetectorElementContainer
+ * @see GeometryInfo
+ * @see IIdentifiable
+ * @see IIdentifier
+ * @see INamed
+ * @see IReadout
+ * @see Readout
+ * 
+ * @author Tim Nelson
+ * @author Jeremy McCormick
+ * @version $Id: IDetectorElement.java,v 1.13 2007/05/02 01:58:18 jeremy Exp $
  */
 public interface IDetectorElement 
 extends IIdentifiable, INamed
 {
 	/**
-	 * Get the geometric information for this node.
+	 * Get the geometric information for this node,
+     * including the volume center position and 
+     * global and local transformations.     
+     * 
 	 * @return An IGeometryInfo object with geometry information.
 	 */
     public IGeometryInfo getGeometry();
             
     /**
-     * Get the parent element of this node.
-     * @return This node's parent.
+     * Get the parent element of this node.  The top-level
+     * <code>DetectorElement</code> has no parent.         
+     * 
+     * @return This node's parent or <code>null</code> if 
+     *         the DetectorElement has no parent.
      */
     public IDetectorElement getParent();
 
     /**
-     * Get a container with the DE's child DE's.
-     * @return An IDetectorElementContainer with this DE's children.
+     * Get a container with the DetectorElement's children.
+     * 
+     * @return An IDetectorElementContainer containing this DE's children.
+     *         This container will be empty if there are no children.
      */
     public IDetectorElementContainer getChildren();
 
     /**
-     * True if the IDetectorElement has children.  
+     * True if the DetectorElement has children.  
      * 
-     * @return True if has children else False.
+     * @return True if has children, else False.
      */
     public boolean hasChildren();
     
     /**
-     * Get the name of this DE.
-     * @return The name this DE.
+     * Get the name of this DetectorElement.
+     * 
+     * @return The name this DetectorElement.
      */
     public String getName();
     
@@ -57,78 +81,117 @@
     
     /**
      * Get the identifier of this DE.
+     * 
+     * @return The unique identifier of this DetectorElement.
      */
     public IIdentifier getIdentifier();
     
     /**
-     * Set the parent IDetectorElement.  This method
+     * Set the parent DetectorElement.  This method
      * also calls addChild on the parent.
      * 
-     * @param parent
+     * @param parent The parent DetectorElement.
      */
     public void setParent(IDetectorElement parent);
     
     /**
-     * @return True if IGeometryInfo has been created,
-     *         False if IGeometryInfo is null. 
+     * @return True if {@link IGeometryInfo} has been created;
+     *         False if {@link IGeometryInfo} is <code>null</code>. 
      */
     public boolean hasGeometryInfo();
        
     /**
-     * Locate the deepest IDetectorElement containing the global point
-     * @param globalPoint, starting with this DetectorElement and traversing 
-     * into its children.  This DetectorElement may be returned if it
-     * has geometry that contains the point but none of its descendants 
-     * contain the point.
+     * Locate the deepest DetectorElement containing a global point
+     * starting with this DetectorElement and traversing into its children.  
+     * This DetectorElement may be returned if it has geometry that 
+     * contains the point but none of its descendants contain the point.
      * 
-     * This method can be used from @see org.lcsim.geometry.Detector
+     * This method can be used from {@link org.lcsim.geometry.Detector}
      * to find the deepest DetectorElement within the complete detector.
      *   
-     * This method is not on GeometryInfo, because a DetectorElement is
+     * This method is not on {@link GeometryInfo}, because a DetectorElement is
      * allowed to have a <code>null</code> GeometryInfo if it is a simple 
      * container without a geometry path, i.e. a ghost volume.
      *   
      * @return The deepest IDetectorElement containing globalPoint
      *         or <code>null</code> if point is not contained within
      *         this DetectorElement or its children.
-     *         
-     * FIXME: Should this go into a DetectorElementNavigator?  It is somehwat
-     *        against previous philosophy of keeping all geometry-related functionality
-     *        of a DetectorElement within GeometryInfo. 
      */    
-    public IDetectorElement findDetectorElement( 
-            Hep3Vector globalPoint);   
+    public IDetectorElement findDetectorElement(Hep3Vector globalPoint);   
     
     /**
      * Get the readout associated with this DetectorElement,
      * or <code>null</code> if the DetectorElement has no
      * associated readout.
+     * 
+     * @see org.lcsim.detector.IReadout
+     * @see org.lcsim.detector.Readout
+     * 
      * @return Associated IReadout object or <code>null</code> if
-     *         no IReadout has been assigned to this DetectorElement.
+     *         Readout has been assigned to this DetectorElement.
      */
     public <T> IReadout<T> getReadout();
 
+    /**
+     * True if this DetectorElement has an {@link IReadout}; 
+     * False if the {@link IReadout} is <code>null</code>
+     * 
+     * @return True if this DetectorElement has a Readout;
+     *         False if there is no Readout.
+     */
     public boolean hasReadout();
     
     /**
-     * The named parameters associated with this DetectorElement.
-     * @return An IParameters object with the parameters.
+     * The named parameters associated with this {@link DetectorElement}.
+     * 
+     * @see org.lcsim.detector.IParameters
+     * 
+     * @return An {@link IParameters} object containing the {@link DetectorElement}'s named parameters.
      */
     public IParameters getParameters();
     
     /**
-     * A list of parents from top DE to this DE.
-     * First member of list is the top DE.
-     * Last member of list is this DE. 
+     * A list of parents from the top to this one.
+     * The first member of the list will be the top {@link IDetectorElement}
+     * in the hierarchy.  The last memory of the list will be
+     * this {@link IDetectorElement}.
+     * 
+     * @see IDetectorElementContainer
      * 
-     * @param detelem
-     * @return
+     * @return A list of ancestors from the top {@link DetectorElement}.
      */
     public IDetectorElementContainer getAncestry();
     
     /**
-     * Recursively clear the <code>IReadout</code> of this DetectorElement
-     * and its children.
+     * Clear the {@link IReadout} of this {@link DetectorElement}
+     * and recursively visit and clear the children..
+     * 
+     * @see IReadout
+     * @see Readout
      */
     public void clearReadouts();
+    
+    /**
+     * True if this DetectorElement is a descendant 
+     * of this one.  False if the {@param de} is not 
+     * contained by this {@link DetectorElement} or if
+     * {@param de} is equal to this DetectorElement.
+     * 
+     * @param de A DetectorElement to search for.
+     * @see IDetectorElement
+     * @see DetectorElement
+     * @see IDetectorElementContainer
+     * @return True if {@param de} is a descendant
+     *         of this DetectorElement.
+     */
+    public boolean isDescendant(IDetectorElement de);
+    
+    /**
+     * Set the {@see IIdentifierHelper} for encoding and decoding
+     * identifiers of this DetectorElement.
+     * 
+     * @param helper The {@see IIdentifierHelper} that has a reference 
+     *               to this DetectorElement's {@see IIdentifierDictionary}.
+     */
+    public void setIdentifierHelper( IIdentifierHelper helper ); 
 }
\ No newline at end of file

GeomConverter/src/org/lcsim/detector
IDetectorElementContainer.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- IDetectorElementContainer.java	20 Mar 2007 21:19:59 -0000	1.3
+++ IDetectorElementContainer.java	2 May 2007 01:58:18 -0000	1.4
@@ -2,9 +2,41 @@
 
 import java.util.List;
 
+/**
+ * DetectorElementContainer extends 
+ * {@link java.util.List} and contains 0 
+ * or more DetectorElements.  It can be used 
+ * to provide special behavior for collections 
+ * of DetectorElements.
+ * 
+ * @see DetectorElement
+ * @see IDetectorElement
+ * @see java.util.List
+ * @see java.util.ArrayList
+ * 
+ * @author Jeremy McCormick
+ * @version $Id: IDetectorElementContainer.java,v 1.4 2007/05/02 01:58:18 jeremy Exp $
+ */
 public interface IDetectorElementContainer 
 extends List<IDetectorElement>
 {
+    /**
+     * Get a DetectorElement by name.
+     * 
+     * @param  name The name of the DetectorElement.
+     * @return      The matching DetectorElement or
+     *              <code>null</code> if none exists
+     *              with matching {@param name}.
+     */
     public IDetectorElement get(String name);
+    
+    /**
+     * True if contains a DetectorElement with name {@param name};
+     * False if does not contain.
+     * 
+     * @param   name The name of the DetectorElement.
+     * @return       True if contains a DetectorElement with
+     *               matching name; False if it does not.
+     */
     public boolean contains(String name);
 }
\ No newline at end of file

GeomConverter/src/org/lcsim/detector
IDetectorElementStore.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- IDetectorElementStore.java	6 Mar 2007 20:22:17 -0000	1.1
+++ IDetectorElementStore.java	2 May 2007 01:58:19 -0000	1.2
@@ -1,7 +1,15 @@
 package org.lcsim.detector;
 
-import java.util.List;
-
+/**
+ * The {@link IDetectorElementStore} is a registry of 
+ * all DetectorElements in the current geometry.
+ * 
+ * @see IDetectorElement
+ * @see IObjectStore
+ * 
+ * @author jeremym
+ * @version $Id: IDetectorElementStore.java,v 1.2 2007/05/02 01:58:19 jeremy Exp $
+ */
 public interface IDetectorElementStore 
-extends List<IDetectorElement> 
+extends IObjectStore 
 {}
\ No newline at end of file

GeomConverter/src/org/lcsim/detector
IDetectorFactory.java 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- IDetectorFactory.java	17 Mar 2007 00:10:40 -0000	1.7
+++ IDetectorFactory.java	2 May 2007 01:58:19 -0000	1.8
@@ -72,4 +72,6 @@
 			double innerRadius, 
 			double outerRadius, 
 			double zHalfLength);	
+    
+    public <T> IReadout<T> createReadout();    
 }
\ No newline at end of file

GeomConverter/src/org/lcsim/detector
IRotation3D.java 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- IRotation3D.java	3 Apr 2007 01:43:12 -0000	1.5
+++ IRotation3D.java	2 May 2007 01:58:19 -0000	1.6
@@ -16,7 +16,7 @@
  * 
  * @author Tim Nelson <[log in to unmask]>
  * @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: IRotation3D.java,v 1.5 2007/04/03 01:43:12 jeremy Exp $
+ * @version $Id: IRotation3D.java,v 1.6 2007/05/02 01:58:19 jeremy Exp $
  */
 public interface IRotation3D
 {   
@@ -139,171 +139,7 @@
      * The trace of the matrix.
      * @return
      */
-    public double trace();
-   
-    /**
-     * Get the XX component.
-     * @return
-     */
-    public double xx();
-    
-    /**
-     * Get the XY component.
-     * @return
-     */
-    public double xy();
-    
-    /**
-     * Get the XZ component.
-     * @return
-     */
-    public double xz();
-    
-    /**
-     * Get the YX component.
-     * @return
-     */
-    public double yx();
-    
-    /**
-     * Get the YY component.
-     * @return
-     */    
-    public double yy();
-    
-    /**
-     * Get the YZ component.
-     * @return
-     */    
-    public double yz();
-    
-    /**
-     * Get the ZX component.
-     * @return
-     */            
-    public double zx();
-    
-    /**
-     * Get the ZY component.
-     * @return
-     */        
-    public double zy();
-    
-    /**
-     * Get the ZZ component.
-     * @return
-     */        
-    public double zz();
-    
-    /**
-     * Get the X column.
-     * @return 
-     */        
-    public Hep3Vector getColumnX();
-    
-    /**
-     * Get the Y column.
-     * @return 
-     */        
-    public Hep3Vector getColumnY();    
-    
-    /**
-     * Get the Z column.
-     * @return 
-     */        
-    public Hep3Vector getColumnZ();
-    
-    /**
-     * Get the X row.
-     * @return 
-     */        
-    public Hep3Vector getRowX();
-    
-    /**
-     * Get the Y row.
-     * @return 
-     */        
-    public Hep3Vector getRowY();
-    
-    /**
-     * Get the Z row.
-     * @return 
-     */        
-    public Hep3Vector getRowZ();    
-    
-    /**
-     * Set the ith row using a Hep3Vector.
-     * @param row
-     * @param vec
-     */
-    public void setRow(int row, Hep3Vector vec);
-    
-    /**
-     * Set the ith row using a double array.
-     * @param row
-     * @param vec
-     */
-    public void setRow(int row, double[] vec);
-    
-    /**
-     * Set the ith row using arguments.
-     * @param row
-     * @param vec
-     */
-    public void setRow(int row, double a, double b, double c);
-    
-    /**
-     * Set the ith column using a Hep3Vector.
-     * @param row
-     * @param vec
-     */
-    public void setColumn(int col, Hep3Vector vec);
-    
-    /**
-     * Set the ith column using an array of doubles.
-     * @param row
-     * @param vec
-     */
-    public void setColumn(int col, double[] vec);
-    
-    /**
-     * Set the ith column using arguments.
-     * @param row
-     * @param vec
-     */
-    public void setColumn(int col, double x, double y, double z);
-    
-    public void setColumnX(Hep3Vector vec);
-    public void setColumnX(double[] arr);
-    public void setColumnX(double x, double y, double z);
-    
-    public void setColumnY(Hep3Vector vec);
-    public void setColumnY(double [] arr);
-    public void setColumnY(double x, double y, double z);
-    
-    public void setColumnZ(Hep3Vector vec);
-    public void setColumnZ(double [] arr);
-    public void setColumnZ(double x, double y, double z);
-    
-    public void setRowX(Hep3Vector vec);
-    public void setRowX(double [] arr);
-    public void setRowX(double x, double y, double z);
-    
-    public void setRowY(Hep3Vector vec);
-    public void setRowY(double [] arr);
-    public void setRowY(double x, double y, double z);
-    
-    public void setRowZ(Hep3Vector vec);
-    public void setRowZ(double [] arr);
-    public void setRowZ(double x, double y, double z);
-
-    /**
-     * Set matrix component by row and column.
-     * @param row
-     * @param col
-     * @param v
-     */
-    public void setComponent(int row, int col, double v);
+    public double trace();  
     
     /**
      * Get matrix component by row and column.

GeomConverter/src/org/lcsim/detector
Rotation3D.java 1.9 -> 1.10
diff -u -r1.9 -r1.10
--- Rotation3D.java	4 Mar 2007 12:08:15 -0000	1.9
+++ Rotation3D.java	2 May 2007 01:58:19 -0000	1.10
@@ -12,7 +12,7 @@
  * 
  * @author Tim Nelson <[log in to unmask]>
  * @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: Rotation3D.java,v 1.9 2007/03/04 12:08:15 jeremy Exp $
+ * @version $Id: Rotation3D.java,v 1.10 2007/05/02 01:58:19 jeremy Exp $
  */
 public class Rotation3D implements IRotation3D
 {
@@ -155,36 +155,6 @@
 		return matrix.e(ZRow,ZCol);
 	}
 
-	public Hep3Vector getColumnX()
-	{
-		return new BasicHep3Vector(xx(),yx(),zx());
-	}
-
-	public Hep3Vector getColumnY()
-	{
-		return new BasicHep3Vector(xy(),yy(),zy());
-	}
-
-	public Hep3Vector getColumnZ()
-	{
-		return new BasicHep3Vector(xz(),yz(),zz());
-	}
-
-	public Hep3Vector getRowX()
-	{
-		return new BasicHep3Vector(xx(),xy(),xz());
-	}
-
-	public Hep3Vector getRowY()
-	{
-		return new BasicHep3Vector(yx(),yy(),yz());
-	}
-
-	public Hep3Vector getRowZ()
-	{
-		return new BasicHep3Vector(zx(),zy(),zz());
-	}
-
 	public void printOut(PrintStream ps)
 	{
 		ps.print("[");
@@ -258,58 +228,6 @@
 		setRow(row,vec.v());
 	}
 
-	public void setColumnX(double[] arr) {
-		setColumn(XCol,arr);
-	}
-
-	public void setColumnX(Hep3Vector vec) {
-		setColumnX(vec.v());
-	}
-
-	public void setColumnY(double[] arr) 
-	{
-		setColumn(YCol,arr);
-	}
-
-	public void setColumnY(Hep3Vector vec) {
-		setColumnY(vec.v());		
-	}
-
-	public void setColumnZ(double[] arr) 
-	{
-		setColumn(ZCol,arr);		
-	}
-
-	public void setColumnZ(Hep3Vector vec) {
-		setColumnZ(vec.v());		
-	}
-
-	public void setRowX(double[] arr) {
-		setRow(XRow,arr);		
-	}
-
-	public void setRowX(Hep3Vector vec) 
-	{		
-		setRowX(vec.v());
-	}
-
-	public void setRowY(double[] arr) 
-	{
-		setRow(YRow,arr);
-	}
-
-	public void setRowY(Hep3Vector vec) {
-		setRowY(vec.v());		
-	}
-
-	public void setRowZ(double[] arr) {
-		setRow(ZRow,arr);		
-	}
-
-	public void setRowZ(Hep3Vector vec) {
-		setRowZ(vec.v());		
-	}
-
 	public void setComponent(int row, int col, double v)
 	{
 		matrix.setElement(row,col,v);
@@ -320,18 +238,6 @@
 		setColumn(col, new double[]{x,y,z});
 	}
 
-	public void setColumnX(double x, double y, double z) {
-		setColumnX(new double[]{x,y,z});		
-	}
-
-	public void setColumnY(double x, double y, double z) {
-		setColumnY(new double[]{x,y,z});		
-	}
-
-	public void setColumnZ(double x, double y, double z) {
-		setColumnZ(new double[]{x,y,z});		
-	}
-
 	public void setRow(int row, double a, double b, double c) 
 	{
 		setRow(row,new double[]{a,b,c});

GeomConverter/src/org/lcsim/detector/converter/compact
DeDetector.java added at 1.1
diff -N DeDetector.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ DeDetector.java	2 May 2007 01:58:19 -0000	1.1
@@ -0,0 +1,33 @@
+package org.lcsim.detector.converter.compact;
+
+import hep.physics.vec.Hep3Vector;
+
+import org.lcsim.detector.DetectorElement;
+import org.lcsim.geometry.Detector;
+
+/**
+ * Wraps a compact detector in a DetectorElement.
+ * 
+ * @see org.lcsim.geometry.Detector
+ * @see org.lcsim.geometry.DetectorElement
+ * @see org.lcsim.geometry.FieldMap
+ *
+ * @author Jeremy McCormick
+ * @version $Id: DeDetector.java,v 1.1 2007/05/02 01:58:19 jeremy Exp $
+ */
+
+public class DeDetector
+extends DetectorElement
+{
+    Detector detector;
+    public DeDetector(Detector detector)
+    {
+        super( detector.getName(), null, "/");
+        this.detector = detector;
+    }   
+    
+    public Hep3Vector getBField(Hep3Vector position)
+    {
+        return detector.getFieldMap().getField(position);
+    }
+}
\ No newline at end of file

GeomConverter/src/org/lcsim/detector/converter/compact
DetectorConverter.java 1.12 -> 1.13
diff -u -r1.12 -r1.13
--- DetectorConverter.java	20 Apr 2007 00:16:54 -0000	1.12
+++ DetectorConverter.java	2 May 2007 01:58:19 -0000	1.13
@@ -7,7 +7,6 @@
 import org.jdom.Document;
 import org.jdom.Element;
 import org.jdom.JDOMException;
-import org.lcsim.detector.DetectorElement;
 import org.lcsim.detector.IDetectorElement;
 import org.lcsim.detector.ILogicalVolume;
 import org.lcsim.detector.IPhysicalVolume;
@@ -17,13 +16,21 @@
 import org.lcsim.detector.converter.lcdd.MaterialElementConverter;
 import org.lcsim.detector.converter.lcdd.MaterialMixtureConverter;
 import org.lcsim.detector.converter.lcdd.MaterialsConverter;
+import org.lcsim.detector.identifier.IIdentifierDictionary;
+import org.lcsim.detector.identifier.IIdentifierField;
+import org.lcsim.detector.identifier.IdentifierDictionary;
+import org.lcsim.detector.identifier.IdentifierDictionaryManager;
+import org.lcsim.detector.identifier.IdentifierField;
+import org.lcsim.detector.identifier.IdentifierHelper;
 import org.lcsim.detector.material.IMaterial;
 import org.lcsim.detector.material.MaterialStore;
 import org.lcsim.detector.solids.Box;
 import org.lcsim.detector.solids.Tube;
 import org.lcsim.geometry.Detector;
+import org.lcsim.geometry.Readout;
 import org.lcsim.geometry.compact.Constant;
 import org.lcsim.geometry.compact.Subdetector;
+import org.lcsim.geometry.util.IDDescriptor;
 
 public class DetectorConverter implements IDetectorConverter 
 {
@@ -68,34 +75,37 @@
         PhysicalVolumeNavigatorStore.getInstance().reset();
         PhysicalVolumeNavigatorStore.getInstance().createDefault(pvWorld);               
         
-        IDetectorElement deDet = new DetectorElement(detector.getName(), null, "/");
-        
+        // Set the Detector's DetectorElement.
+        IDetectorElement deDet = new DeDetector(detector);
         detector.setDetectorElement( deDet );
-        
-        //detector.setSupport("/");        
-        
+                       
         // Construct the tracking volume.
         buildTrackingVolume( pvWorld.getLogicalVolume(), detector );
         
-        detector.setWorldVolume(pvWorld);
-                                     
-        convertMaterials("/org/lcsim/material/elements.xml");
-        convertMaterials("/org/lcsim/material/materials.xml");
-        convertMaterials(doc);
-        
-        convertSubdetectors(detector);
-                                        
+        // Set the world volume.
+        detector.setWorldVolume( pvWorld );
+                                
+        // Convert materials.
+        convertMaterials( "/org/lcsim/material/elements.xml" );
+        convertMaterials( "/org/lcsim/material/materials.xml" );
+        convertMaterials( doc );
+        
+        // Convert Subdetectors.
+        convertSubdetectors( detector );
+                                
+        // Return the world volume.
         return pvWorld;
     }
       
 	private void convertMaterials(Document doc) throws JDOMException
 	{
-		(new MaterialsConverter()).convert(doc);
+		( new MaterialsConverter() ).convert( doc );
 	}
 	
 	private void convertMaterials(String resource) throws JDOMException, IOException
 	{
 		Document doc = CompactDocumentBuilder.build(resource);
+        //convertMaterials( doc );
 		
 		MaterialElementConverter elemCnv = new MaterialElementConverter();
 		MaterialMixtureConverter matCnv = new MaterialMixtureConverter();
@@ -121,16 +131,62 @@
 		{
 			Subdetector subdet = entry.getValue();
 			
-			ISubdetectorConverter cnv = getSubdetectorConverter(subdet.getClass());
+            // Lookup a registered converter for this Subdetector class.
+			ISubdetectorConverter cnv = getSubdetectorConverter( subdet.getClass() );
+            
 			if ( cnv != null )
 			{                
-                // Convert from a compact type to the
-                // generic detector description.
-				cnv.convert(subdet, detector);                          
-			}
+                // Build the IdentifierDictionary for this Subdetector.
+                // Subdetector converters need this to be done first.
+                IIdentifierDictionary iddict = createIdentifierDictionary( subdet );
+                
+                // Convert from a compact type to the generic detector description
+                // using a registered converter.
+				cnv.convert(subdet, detector);
+                
+                // Now assign the IdentifierHelper to the DetectorElement after it has been built.
+                if ( subdet.getDetectorElement() != null )
+                {
+                    subdet.getDetectorElement().setIdentifierHelper( new IdentifierHelper( iddict ) );
+                }
+			}            
 		}		
 	}
     
+    /**
+     * Creates an {@see IIdentifierDictionary} from an existing {@see org.lcsim.geometry.Subdetector}.
+     * 
+     * @see org.lcsim.geometry.Readout
+     * @see org.lcsim.detector.identifier
+     * @see org.lcsim.detector.identifier.IIdentifierDictionary
+     * @see org.lcsim.detector.identifier.IIdentifierDictionaryManager
+     * @see org.lcsim.detector.identifier.IIdentifierField
+     * 
+     * @param subdet The Subdetector.
+     */
+    private IIdentifierDictionary createIdentifierDictionary(Subdetector subdet)
+    {
+        Readout ro = subdet.getReadout();
+        IIdentifierDictionary iddict=null;
+        if ( ro != null )
+        {
+            iddict = new IdentifierDictionary(ro.getName());
+            IdentifierDictionaryManager.getInstance().addIdentifierDictionary( iddict );
+            
+            IDDescriptor desc = ro.getIDDescriptor();
+            for ( int i=0; i<desc.fieldCount(); i++ )
+            {
+                int nbits = desc.fieldLength(i);                
+                int start = desc.fieldStart(i);
+                boolean signed = desc.isSigned(i);
+                String name = desc.fieldName(i);
+                IIdentifierField field = new IdentifierField(name,nbits,start,signed);
+                iddict.addField(field);
+            }                                    
+        }   
+        return iddict;
+    }
+    
     private void buildTrackingVolume(ILogicalVolume world, Detector detector)
     {
         Map<String,Constant> constants = detector.getConstants();

GeomConverter/src/org/lcsim/detector/identifier
ExpandedIdentifier.java added at 1.1
diff -N ExpandedIdentifier.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ExpandedIdentifier.java	2 May 2007 01:58:19 -0000	1.1
@@ -0,0 +1,99 @@
+package org.lcsim.detector.identifier;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * COMMENT
+ *
+ * @author Jeremy McCormick
+ * @version $Id: ExpandedIdentifier.java,v 1.1 2007/05/02 01:58:19 jeremy Exp $
+ */
+
+public class ExpandedIdentifier
+implements IExpandedIdentifier
+{
+    List<Integer> values = new ArrayList<Integer>();
+    
+    public ExpandedIdentifier()
+    {}
+    
+    public ExpandedIdentifier( int[] values )
+    {
+        for ( int value : values )
+        {
+            this.values.add( value );
+        }
+    }
+    
+    public ExpandedIdentifier( List<Integer> values )
+    {
+        this.values.addAll( values );
+    }
+    
+    public ExpandedIdentifier( String values )
+    {
+        String[] buffer = values.split("/");
+        for ( String value : buffer )
+        {
+            addValue( Integer.parseInt( value ) );
+        }
+    }
+
+    public void addValue( int value)
+    {
+        values.add(value);        
+    }
+
+    public void clear()
+    {
+        values.clear();
+    }
+
+    public int getNumberOfFields()
+    {
+        return values.size();
+    }
+
+    public int getValue( int index )
+    {
+        return values.get( index );
+    }
+
+    public List<Integer> getValues()
+    {
+        return values;
+    }
+
+    public boolean isValid()
+    {
+        return values.size() != 0;        
+    }
+    
+    public String toString()
+    {
+        StringBuffer buff = new StringBuffer();
+        for ( Integer value : values )
+        {
+            buff.append("/" + value);
+        }
+        return buff.toString();
+    }       
+    
+    public boolean equals(IExpandedIdentifier id)
+    {
+        if ( id.getNumberOfFields() != this.getNumberOfFields() )
+        {
+            return false;
+        }
+        
+        for ( int i=0; i<this.getNumberOfFields(); i++)
+        {
+            if ( id.getValue(i) != this.getValue(i))
+            {
+                return false;
+            }            
+        }
+        return true;
+    }
+}
\ No newline at end of file

GeomConverter/src/org/lcsim/detector/identifier
IExpandedIdentifier.java added at 1.1
diff -N IExpandedIdentifier.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ IExpandedIdentifier.java	2 May 2007 01:58:19 -0000	1.1
@@ -0,0 +1,21 @@
+package org.lcsim.detector.identifier;
+
+import java.util.List;
+
+/**
+ * COMMENT
+ *
+ * @author Jeremy McCormick
+ * @version $Id: IExpandedIdentifier.java,v 1.1 2007/05/02 01:58:19 jeremy Exp $
+ */
+
+public interface IExpandedIdentifier
+{
+    public void addValue(int value);
+    public int getValue(int index);
+    public List<Integer> getValues();
+    public int getNumberOfFields();
+    public void clear();
+    public boolean isValid();
+    public boolean equals(IExpandedIdentifier id);
+}

GeomConverter/src/org/lcsim/detector/identifier
IIdentifierDictionary.java added at 1.1
diff -N IIdentifierDictionary.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ IIdentifierDictionary.java	2 May 2007 01:58:19 -0000	1.1
@@ -0,0 +1,19 @@
+package org.lcsim.detector.identifier;
+
+import java.util.Map;
+
+/**
+ * COMMENT
+ *
+ * @author Jeremy McCormick
+ * @version $Id: IIdentifierDictionary.java,v 1.1 2007/05/02 01:58:19 jeremy Exp $
+ */
+
+public interface IIdentifierDictionary
+{
+    public String getName();
+    public void addField(IIdentifierField field);
+    public IIdentifierField getField(String fieldName);  
+    public IIdentifierField getField(int index);
+    public Map<String,IIdentifierField> getFields();    
+}
\ No newline at end of file

GeomConverter/src/org/lcsim/detector/identifier
IIdentifierDictionaryManager.java added at 1.1
diff -N IIdentifierDictionaryManager.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ IIdentifierDictionaryManager.java	2 May 2007 01:58:19 -0000	1.1
@@ -0,0 +1,13 @@
+package org.lcsim.detector.identifier;
+/**
+ * COMMENT
+ *
+ * @author Jeremy McCormick
+ * @version $Id: IIdentifierDictionaryManager.java,v 1.1 2007/05/02 01:58:19 jeremy Exp $
+ */
+
+public interface IIdentifierDictionaryManager
+{    
+    public IIdentifierDictionary getIdentifierDictionary(String name);
+    public void addIdentifierDictionary(IIdentifierDictionary dict);
+}
\ No newline at end of file

GeomConverter/src/org/lcsim/detector/identifier
IIdentifierField.java added at 1.1
diff -N IIdentifierField.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ IIdentifierField.java	2 May 2007 01:58:19 -0000	1.1
@@ -0,0 +1,15 @@
+package org.lcsim.detector.identifier;
+/**
+ * COMMENT
+ *
+ * @author Jeremy McCormick
+ * @version $Id: IIdentifierField.java,v 1.1 2007/05/02 01:58:19 jeremy Exp $
+ */
+public interface IIdentifierField
+{
+    public String getLabel();
+    public int getNumberOfBits();
+    public int getOffset();
+    public long getMaskOn();
+    public boolean isSigned();
+}
\ No newline at end of file

GeomConverter/src/org/lcsim/detector/identifier
IIdentifierHelper.java added at 1.1
diff -N IIdentifierHelper.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ IIdentifierHelper.java	2 May 2007 01:58:19 -0000	1.1
@@ -0,0 +1,17 @@
+package org.lcsim.detector.identifier;
+
+/**
+ * COMMENT
+ *
+ * @author Jeremy McCormick
+ * @version $Id: IIdentifierHelper.java,v 1.1 2007/05/02 01:58:19 jeremy Exp $
+ */
+
+public interface IIdentifierHelper
+{
+    public IIdentifierDictionary getIdentifierDictionary();
+    public IIdentifier pack(IExpandedIdentifier id);
+    //public IIdentifier pack(IExpandedIdentifier id, int start);
+    //public IIdentifier pack(IExpandedIdentifier id, int start, int nfields);
+    public IExpandedIdentifier unpack(IIdentifier id);
+}
\ No newline at end of file

GeomConverter/src/org/lcsim/detector/identifier
Identifier.java added at 1.1
diff -N Identifier.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Identifier.java	2 May 2007 01:58:19 -0000	1.1
@@ -0,0 +1,91 @@
+/**
+ * File:    Identifier.java
+ * Created: Apr 30, 2007 4:16:59 PM
+ * 
+ * Implementation of {@link IIdentifier}.
+ *
+ * @author Jeremy McCormick
+ * @version $Id: Identifier.java,v 1.1 2007/05/02 01:58:19 jeremy Exp $
+ */
+package org.lcsim.detector.identifier;
+
+/**
+ * Implementation of a 64-bit packed identifier.
+ * 
+ * @see DetectorElement
+ * @see IIdentifier
+ */
+public class Identifier
+implements IIdentifier
+{    
+    long value = unsetValue;
+    private static final long unsetValue = 0;
+    
+    Identifier()
+    {}
+    
+    Identifier(long value)
+    {
+        this.value = value;
+    }
+    
+    Identifier(int value)
+    {
+        this.value = (int)value;
+    }
+    
+    public long getValue()
+    {
+        return value;
+    }
+    
+    public void setValue( long value )
+    {
+        this.value = value;        
+    }
+    
+    public void clear()
+    {
+         value = unsetValue;
+    }
+
+    public boolean equals( IIdentifier id)
+    {
+        return id.getValue() == value;
+    }
+ 
+    public String getHexString()
+    {
+        return Long.toHexString(value);
+    }
+    
+    public String toString()
+    {
+        return getHexString();
+    }
+    
+    public void setHexString( String hexRep )
+    {
+        value = Long.parseLong(hexRep, 16);
+    }
+
+    public boolean isValid()
+    {
+        return value != unsetValue;
+    }
+
+    public boolean less( IIdentifier id)
+    {
+        return value < id.getValue();
+    }
+
+    public boolean greater( IIdentifier id)
+    {
+        return value > id.getValue();
+    }
+    
+    public boolean nequals( IIdentifier id)
+    {
+        return value != id.getValue();
+    }
+}

GeomConverter/src/org/lcsim/detector/identifier
IdentifierDictionary.java added at 1.1
diff -N IdentifierDictionary.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ IdentifierDictionary.java	2 May 2007 01:58:19 -0000	1.1
@@ -0,0 +1,62 @@
+package org.lcsim.detector.identifier;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * COMMENT
+ *
+ * @author Jeremy McCormick
+ * @version $Id: IdentifierDictionary.java,v 1.1 2007/05/02 01:58:19 jeremy Exp $
+ */
+
+public class IdentifierDictionary implements IIdentifierDictionary
+{
+    Map<String,IIdentifierField> fields = new LinkedHashMap<String,IIdentifierField>();
+    private String name;
+    
+    public IdentifierDictionary(String name)
+    {
+        this.name = name;
+    }
+    
+    public String getName()
+    {
+        return name;
+    }
+    
+    public void addField(IIdentifierField field)
+    {
+        if ( fields.containsKey( field.getLabel() ) )
+        {
+            throw new IllegalArgumentException("Dictionary already has a field called <" + name + ">.");
+        }
+        fields.put(field.getLabel(),field);
+    }
+
+    public IIdentifierField getField(String fieldName)
+    {
+        return fields.get(fieldName);
+    }
+    
+    public IIdentifierField getField(int index)
+    {
+        return (IIdentifierField)fields.values().toArray()[index];
+    }
+
+    public Map<String,IIdentifierField> getFields()
+    {
+        return fields;
+    }      
+    
+    public String toString()
+    {
+        StringBuffer str = new StringBuffer();
+        str.append(getName() + '\n');
+        for ( IIdentifierField field : getFields().values() )
+        {
+            str.append("    " + field.toString());
+        }
+        return str.toString();
+    }
+}
\ No newline at end of file

GeomConverter/src/org/lcsim/detector/identifier
IdentifierDictionaryManager.java added at 1.1
diff -N IdentifierDictionaryManager.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ IdentifierDictionaryManager.java	2 May 2007 01:58:19 -0000	1.1
@@ -0,0 +1,36 @@
+package org.lcsim.detector.identifier;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * COMMENT
+ *
+ * @author Jeremy McCormick
+ * @version $Id: IdentifierDictionaryManager.java,v 1.1 2007/05/02 01:58:19 jeremy Exp $
+ */
+
+public class IdentifierDictionaryManager
+implements IIdentifierDictionaryManager
+{
+    Map<String,IIdentifierDictionary> dicts = new HashMap<String,IIdentifierDictionary>();
+    private static final IIdentifierDictionaryManager instance = new IdentifierDictionaryManager();
+    
+    private IdentifierDictionaryManager()
+    {}
+    
+    public void addIdentifierDictionary(IIdentifierDictionary dict)
+    {
+        dicts.put(dict.getName(), dict);
+    }
+
+    public IIdentifierDictionary getIdentifierDictionary(String name)
+    {
+        return dicts.get(name);        
+    }       
+    
+    public static IIdentifierDictionaryManager getInstance()
+    {
+        return instance;
+    }       
+}
\ No newline at end of file

GeomConverter/src/org/lcsim/detector/identifier
IdentifierField.java added at 1.1
diff -N IdentifierField.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ IdentifierField.java	2 May 2007 01:58:19 -0000	1.1
@@ -0,0 +1,54 @@
+package org.lcsim.detector.identifier;
+
+/**
+ * COMMENT
+ *
+ * @author Jeremy McCormick
+ * @version $Id: IdentifierField.java,v 1.1 2007/05/02 01:58:19 jeremy Exp $
+ */
+
+public class IdentifierField implements IIdentifierField
+{
+    private int numberOfBits;
+    private int offset;
+    private boolean isSigned;
+    private String label;
+    
+    public IdentifierField(String label, int numberOfBits, int offset, boolean isSigned)
+    {
+        this.label = label;
+        this.numberOfBits = numberOfBits;
+        this.offset = offset;
+        this.isSigned = isSigned;        
+    }
+    
+    public String getLabel()
+    {
+        return label;
+    }
+
+    public long getMaskOn()
+    {
+        return (1L << getNumberOfBits()) - 1;
+    }
+
+    public int getNumberOfBits()
+    {
+        return numberOfBits;
+    }
+
+    public int getOffset()
+    {
+        return offset;
+    }
+
+    public boolean isSigned()
+    {
+        return isSigned;
+    }
+    
+    public String toString()
+    {
+        return getLabel() + ":" + getOffset() + ":" + getNumberOfBits() + ":" + isSigned() + "\n";
+    }
+}
\ No newline at end of file

GeomConverter/src/org/lcsim/detector/identifier
IdentifierHelper.java added at 1.1
diff -N IdentifierHelper.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ IdentifierHelper.java	2 May 2007 01:58:19 -0000	1.1
@@ -0,0 +1,76 @@
+package org.lcsim.detector.identifier;
+
+/**
+ * A helper class for encoding and decoding identifiers
+ * using information from an identifier dictionary.
+ * 
+ * @see IIdentifierDictionary
+ * @see IIdentifier
+ * @see IExpandedIdentifier
+ *
+ * @author Jeremy McCormick
+ * @version $Id: IdentifierHelper.java,v 1.1 2007/05/02 01:58:19 jeremy Exp $
+ */
+
+public class IdentifierHelper
+implements IIdentifierHelper
+{
+    private IIdentifierDictionary iddict=null;
+
+    public IdentifierHelper( IIdentifierDictionary iddict )
+    {
+        this.iddict = iddict;
+    }
+    
+    public IIdentifierDictionary getIdentifierDictionary()
+    {
+        return iddict;
+    }
+    
+    public IIdentifier pack( IExpandedIdentifier id )
+    {
+        long result = 0;
+        int idx = 0;
+        for ( int value : id.getValues() )
+        {
+            IIdentifierField field = iddict.getField(idx);
+            int start = field.getOffset();
+            long mask = field.getMaskOn();
+            result |= (mask & value) << start;
+            ++idx;
+        }       
+        return new Identifier( result );
+    }
+
+    public IExpandedIdentifier unpack( IIdentifier compact )
+    {
+        ExpandedIdentifier buffer = new ExpandedIdentifier();
+
+        long id = compact.getValue();
+        
+        for ( IIdentifierField field : iddict.getFields().values() )
+        {
+            int start = field.getOffset();
+            int length = field.getNumberOfBits();
+            long mask = field.getMaskOn();
+                        
+            int result = (int) ((id >> start) & mask);
+            if ( field.isSigned() )
+            {
+                int signBit = 1 << (length-1);
+                if ((result & signBit) != 0) 
+                {
+                    result -= (1 << length);
+                    
+                    // FIXME: Negatives have an unknown off-by-one error
+                    //        which is corrected for here!  (Why????)
+                    result += 1;
+                }
+            }
+            
+            buffer.addValue(result);
+        }
+        
+        return buffer;
+    }           
+}

GeomConverter/src/org/lcsim/detector/identifier
IIdentifier.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- IIdentifier.java	4 Mar 2007 05:03:00 -0000	1.2
+++ IIdentifier.java	2 May 2007 01:58:19 -0000	1.3
@@ -1,17 +1,32 @@
 package org.lcsim.detector.identifier;
 
-import java.util.BitSet;
-
 /**
- * An interface for comparable identifiers.
+ * An interface defining comparable 64-bit identifiers
+ * using for uniquely defining components of the
+ * detector.
+ * 
+ * @see DetectorElement
  * 
  * @author jeremym
- *
+ * @version $Id: IIdentifier.java,v 1.3 2007/05/02 01:58:19 jeremy Exp $
  */
 public interface IIdentifier
 {
     /**
+     * Get the value of this identifier as a long.
+     */
+    long getValue();
+    
+    /**
+     * Set the value of this identifier from a long.
+     * 
+     * @param id
+     */
+    void setValue(long id);
+    
+    /**
      * True if the identifiers are equivalent. 
+     * 
      * @param id
      * @return
      */
@@ -19,6 +34,7 @@
     
     /**
      * True if the identifiers are not equivalent.
+     * 
      * @param id
      * @return
      */
@@ -26,6 +42,7 @@
     
     /**
      * True if this identifier is greater.
+     * 
      * @param id
      * @return
      */
@@ -33,67 +50,37 @@
     
     /**
      * True if this identifier is less.
+     * 
      * @param id
      * @return
      */
 	public boolean less(IIdentifier id);   
     
-	/**
-	 * The return value can express the magnitude
-	 * of difference, such as number of bits
-	 * that are different or number of different fields,
-	 * for an id with fields.
-	 * 
-	 * @param id
-	 * @return
-	 */
-	public int compare(IIdentifier id);
-
-	/**
-	 * Get a raw BitSet encoding of this id.
-	 * @return
-	 */
-	public BitSet getBitSet();
-	
-	/**
-	 * Get an integer list of fields representing
-	 * the field values.
-	 *  
-	 * @return
-	 */
-	public int[] fields();
-	
-	/**
-	 * Get field value.
-	 * @param i
-	 * @return
-	 */
-	public int field(int i);
-	
-	/** 
-	 * @param name
-	 * @return
-	 */
-	public int fieldName(String name);		
-	
-    // size in bits
-	public int getSizeInBits();
-    
     /**
      * Get a raw hex string representation.
+     * 
      * @return
      */
-	public String hexString();
+	public String getHexString();
 
-    // Setup from hex string.
+    /**
+     * Set the value from a raw hex string.
+     * 
+     * @param hexRep
+     */
 	public void setHexString(String hexRep);
     
-    // set value from another IIdentifier
-	//public void setIdentifier(IIdentifier id);
-
-    // clear state
+	/**
+     * Clear the state of this identifier. 
+	 */
 	public void clear();
 
-    // is id in valid state
+	/**
+     * True if this ID has been set; 
+     * False if it has not been set
+     * or was set and then cleared. 
+     *  
+     * @return
+	 */
 	public boolean isValid();
 }
\ No newline at end of file

GeomConverter/src/org/lcsim/geometry
Subdetector.java 1.18 -> 1.19
diff -u -r1.18 -r1.19
--- Subdetector.java	20 Apr 2007 00:50:23 -0000	1.18
+++ Subdetector.java	2 May 2007 01:58:20 -0000	1.19
@@ -24,6 +24,13 @@
     public boolean isBarrel();
     public boolean isEndcap();
         
+    /**
+     * 
+     * @param localPos
+     * @return
+     * @deprecated Use {@link org.lcsim.detector.IGeometryInfo#getLocalToGlobal()}
+     */
+    @Deprecated
     public double[] transformLocalToGlobal(double[] localPos);
     
     public IDetectorElement getDetectorElement();

GeomConverter/src/org/lcsim/geometry/layer
Layer.java 1.11 -> 1.12
diff -u -r1.11 -r1.12
--- Layer.java	20 Mar 2007 00:47:19 -0000	1.11
+++ Layer.java	2 May 2007 01:58:20 -0000	1.12
@@ -16,7 +16,10 @@
  * a subdetector.
  *
  * @author jeremym
+ * 
+ * @deprecated Use {@link org.lcsim.detector.IDetectorElement} functionality instead.
  */
+@Deprecated 
 public class Layer
 {
     List<LayerSlice> slices;

GeomConverter/test/org/lcsim/detector/converter/compact
DiskTrackerTest.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- DiskTrackerTest.java	20 Apr 2007 00:16:54 -0000	1.4
+++ DiskTrackerTest.java	2 May 2007 01:58:20 -0000	1.5
@@ -97,15 +97,22 @@
                 "DiskTracker_negative_sensor1",
                 "DiskTrackerTest"
         };
-        
+             
         /*
         for (IDetectorElement de : DetectorElementStore.getInstance())
         {
+            System.out.println("isDescendant of detector <" + de.getName() + "> - " + detector.getDetectorElement().isDescendant(de));
+            
             if ( de.hasGeometryInfo() )
             {
-                System.out.println(de.getName() + " " + de.getGeometry().getPosition());
+                System.out.println(de.getName());
+                if ( de.getParent() != null )
+                {
+                    System.out.println("    " + de.getParent().getName());
+                }
             }
-        }*/
+        }
+        */
                 
         for ( int i=0; i<zpoints.length; i++ )
         {           
@@ -121,7 +128,7 @@
                     );
             
             IDetectorElement srch = detector.getDetectorElement().findDetectorElement(zpoint);
-           
+                                   
             assertTrue("Wrong path <" + path.toString() + "> at z = " + zpoints[i] + ".  Expected <" + pathAnswerKey[i] + ">.",
                     srch.getName().equals(deAnswerKey[i]));
         }

GeomConverter/test/org/lcsim/detector/identifier
IdentifierHelperTest.java added at 1.1
diff -N IdentifierHelperTest.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ IdentifierHelperTest.java	2 May 2007 01:58:20 -0000	1.1
@@ -0,0 +1,62 @@
+package org.lcsim.detector.identifier;
+
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * COMMENT
+ *
+ * @author Jeremy McCormick
+ * @version $Id: IdentifierHelperTest.java,v 1.1 2007/05/02 01:58:20 jeremy Exp $
+ */
+
+public class IdentifierHelperTest
+extends TestCase
+{
+    public IdentifierHelperTest(String name)
+    {
+        super(name);
+    }
+    
+    public static junit.framework.Test suite()
+    {
+        return new TestSuite(IdentifierHelperTest.class);
+    }
+    
+    public void testIdHelper()
+    {
+        IIdentifierDictionary iddict = new IdentifierDictionary("test");
+        iddict.addField(new IdentifierField("field1",32,0,false));
+        iddict.addField(new IdentifierField("field2",32,32,true));
+        
+        IIdentifierHelper helper = new IdentifierHelper( iddict );
+        
+        IExpandedIdentifier expId = new ExpandedIdentifier();
+        expId.addValue(1);
+        expId.addValue(-1);
+        
+        IIdentifier compactId = helper.pack( expId );
+        
+        IExpandedIdentifier expIdCheck = helper.unpack(compactId);
+        
+        assertTrue( expId.equals( expIdCheck ));
+        
+        System.out.println("compactId - " + compactId.toString());
+        System.out.println("expId - " + expId.toString());
+        System.out.println("expIdCheck - " + expIdCheck.toString());
+        System.out.println();
+        
+        expId.clear();
+        expId.addValue(1);
+        expId.addValue(1);
+        
+        compactId = helper.pack(expId);
+        expIdCheck = helper.unpack( compactId );
+        
+        assertTrue( expId.equals( expIdCheck ));
+        
+        System.out.println("compactId - " + compactId.toString());
+        System.out.println("expId - " + expId.toString());        
+        System.out.println("expIdCheck - " + expIdCheck.toString());
+    }
+}
\ No newline at end of file
CVSspam 0.2.8