2 added + 1 removed + 8 modified, total 11 files
GeomConverter/src/org/lcsim/detector
diff -N GeometryInfo.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ GeometryInfo.java 4 Mar 2007 05:03:00 -0000 1.1
@@ -0,0 +1,247 @@
+package org.lcsim.detector;
+
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Vector;
+
+/**
+ * IGeometryInfo provides a cache of geometry
+ * information for a single DetectorElement.
+ * This includes transforms from local to
+ * global, global to local, and parent to local,
+ * as well as center position.
+ *
+ * @author Jeremy McCormick <[log in to unmask]>
+ * @author Tim Nelson <[log in to unmask]>
+ *
+ */
+public class GeometryInfo
+implements IGeometryInfo
+{
+ IDetectorElement detectorElement;
+ IGeometryInfoContainer childIGeometryInfos;
+ IGeometryInfo parentIGeometryInfo;
+ IPhysicalVolumePath support;
+ IPhysicalVolumeNavigator navigator;
+ ILogicalVolume logicalVolume;
+ ICoordinateTransformation3D globalToLocal;
+ ICoordinateTransformation3D localToGlobal;
+ ICoordinateTransformation3D parentToLocal;
+ Hep3Vector globalPosition;
+
+ /**
+ * This constructor associates this GeometryInfo
+ * with a node in the geometry tree.
+ *
+ * @param detectorElement
+ * @param support
+ */
+ public GeometryInfo(
+ IDetectorElement detectorElement,
+ IPhysicalVolumePath support)
+ {
+ // This constructor does not allow a null DetectorElement.
+ if ( detectorElement == null )
+ {
+ throw new IllegalArgumentException("DE cannot be null!");
+ }
+
+ // This constructor does not allow a null support.
+ if ( support == null )
+ {
+ throw new IllegalArgumentException("Support cannot be null!");
+ }
+
+ // This constructor does not allow a path with no components in it.
+ if ( support.size() == 0)
+ {
+ throw new IllegalArgumentException("Support contains no PhysicalVolumes!");
+ }
+
+ // Set the ref to the DetectorElement.
+ this.detectorElement = detectorElement;
+
+ // If this DetectorElement has children, add the
+ // child IGeometryInfo to the cached list.
+ if (detectorElement.getChildren() != null)
+ {
+ if (detectorElement.getChildren().size()>0)
+ {
+ this.childIGeometryInfos = new GeometryInfoContainer();
+ for (IDetectorElement de : detectorElement.getChildren())
+ {
+ this.childIGeometryInfos.add(de.getGeometry());
+ }
+ }
+ }
+
+ // Set the parent IGeometryInfo ref.
+ if (detectorElement.getParent()!=null)
+ {
+ this.parentIGeometryInfo = detectorElement.getParent().getGeometry();
+ }
+
+ // Set the support reference.
+ this.support = support;
+
+ // Cache a PhysicalVolumeNavigator.
+ navigator = new PhysicalVolumeNavigator(support.getTopVolume());
+
+ // Set ref to LogicalVolume.
+ logicalVolume = support.get(support.size()-1).getLogicalVolume();
+
+ // Cache global to local.
+ globalToLocal = navigator.getTransform(support);
+
+ // Cache global position.
+ globalPosition = globalToLocal.transformed(new BasicHep3Vector());
+
+ // Cache local to global.
+ localToGlobal = globalToLocal.inverse();
+ }
+
+ /* (non-Javadoc)
+ * @see org.lcsim.detector.IGeometryInfoTest#childIGeometryInfos()
+ */
+ public IGeometryInfoContainer childIGeometryInfos()
+ {
+ return childIGeometryInfos;
+ }
+
+ /* (non-Javadoc)
+ * @see org.lcsim.detector.IGeometryInfoTest#getPhysicalVolumePath(hep.physics.vec.Hep3Vector)
+ */
+ public IPhysicalVolumePath getPhysicalVolumePath(Hep3Vector global_point)
+ {
+ return navigator.getPath(global_point);
+ }
+
+ /* (non-Javadoc)
+ * @see org.lcsim.detector.IGeometryInfoTest#getLogicalVolume()
+ */
+ public ILogicalVolume getLogicalVolume()
+ {
+ return logicalVolume;
+ }
+
+ /* (non-Javadoc)
+ * @see org.lcsim.detector.IGeometryInfoTest#getLogicalVolumeName()
+ */
+ public String getLogicalVolumeName()
+ {
+ return getLogicalVolume().getName();
+ }
+
+ /* (non-Javadoc)
+ * @see org.lcsim.detector.IGeometryInfoTest#getPhysicalVolume(hep.physics.vec.Hep3Vector)
+ */
+ public IPhysicalVolume getPhysicalVolume(Hep3Vector globalPoint)
+ {
+ return getPhysicalVolumePath(globalPoint).getLeafVolume();
+ }
+
+ /* (non-Javadoc)
+ * @see org.lcsim.detector.IGeometryInfoTest#getPosition()
+ */
+ public Hep3Vector getPosition()
+ {
+ return globalPosition;
+ }
+
+ /* (non-Javadoc)
+ * @see org.lcsim.detector.IGeometryInfoTest#getPhysicalVolumePath()
+ */
+ public IPhysicalVolumePath getPhysicalVolumePath()
+ {
+ return support;
+ }
+
+ /* (non-Javadoc)
+ * @see org.lcsim.detector.IGeometryInfoTest#globalToLocal()
+ */
+ public ICoordinateTransformation3D getGlobalToLocal()
+ {
+ return globalToLocal;
+ }
+
+ /* (non-Javadoc)
+ * @see org.lcsim.detector.IGeometryInfoTest#globalToLocal(hep.physics.vec.Hep3Vector)
+ */
+ public Hep3Vector transformGlobalToLocal(Hep3Vector global_point)
+ {
+ return globalToLocal.transformed(global_point);
+ }
+
+ /* (non-Javadoc)
+ * @see org.lcsim.detector.IGeometryInfoTest#hasLogicalVolume()
+ */
+ public boolean hasLogicalVolume()
+ {
+ return logicalVolume != null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.lcsim.detector.IGeometryInfoTest#hasSupport()
+ */
+ public boolean hasSupport()
+ {
+ return support != null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.lcsim.detector.IGeometryInfoTest#isInside(hep.physics.vec.Hep3Vector)
+ */
+ public boolean isInside(Hep3Vector point)
+ {
+ // Get the path from the navigator.
+ // If the returned path is not equal
+ // to this GeometryInfo's path, then
+ // we are not inside this GI's exact
+ // corresponding PhysicalVolume.
+ return support.equals(navigator.getPath(point));
+ }
+
+ /* (non-Javadoc)
+ * @see org.lcsim.detector.IGeometryInfoTest#localToGlobal()
+ */
+ public ICoordinateTransformation3D getLocalToGlobal()
+ {
+ return localToGlobal;
+ }
+
+ /* (non-Javadoc)
+ * @see org.lcsim.detector.IGeometryInfoTest#localToGlobal(hep.physics.vec.Hep3Vector)
+ */
+ public Hep3Vector transformLocalToGlobal(Hep3Vector local_point)
+ {
+ return localToGlobal.transformed(local_point);
+ }
+
+ /* (non-Javadoc)
+ * @see org.lcsim.detector.IGeometryInfoTest#parentIGeometryInfo()
+ */
+ public IGeometryInfo parentIGeometryInfo()
+ {
+ return parentIGeometryInfo();
+ }
+
+ /* (non-Javadoc)
+ * @see org.lcsim.detector.IGeometryInfoTest#parentToLocal()
+ */
+ public ICoordinateTransformation3D getParentToLocal()
+ {
+ return parentToLocal;
+ }
+
+ public Hep3Vector transformParentToLocal(Hep3Vector parentPoint)
+ {
+ return parentToLocal.transformed(parentPoint);
+ }
+
+ /* (non-Javadoc)
+ * @see org.lcsim.detector.IGeometryInfoTest#setSupport(org.lcsim.detector.IPhysicalVolumePath)
+ */
+ public void setSupport(IPhysicalVolumePath support)
+ {
+ this.support = support;
+ }
+}
\ No newline at end of file
GeomConverter/src/org/lcsim/detector
diff -N GeometryInfoContainer.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ GeometryInfoContainer.java 4 Mar 2007 05:03:00 -0000 1.1
@@ -0,0 +1,8 @@
+package org.lcsim.detector;
+
+import java.util.ArrayList;
+
+public class GeometryInfoContainer
+extends ArrayList<IGeometryInfo>
+implements IGeometryInfoContainer
+{}
GeomConverter/src/org/lcsim/detector
diff -u -r1.2 -r1.3
--- DetectorElement.java 3 Mar 2007 13:33:56 -0000 1.2
+++ DetectorElement.java 4 Mar 2007 05:03:00 -0000 1.3
@@ -3,14 +3,35 @@
import org.lcsim.detector.identifier.IIdentifier;
public class DetectorElement
+extends Named
implements IDetectorElement
{
private IDetectorElementContainer children;
private IGeometryInfo geometry;
- String name;
IDetectorElement parent;
IIdentifier id;
+
+ /**
+ * Create a DE with support in the geometry tree.
+ *
+ * @param name
+ * @param parent
+ * @param support
+ * @param id
+ */
+ public DetectorElement(
+ String name,
+ IDetectorElement parent,
+ IPhysicalVolumePath support,
+ IIdentifier id)
+ {
+ super(name);
+ this.parent = parent;
+ this.geometry=new GeometryInfo(this,support);
+ this.id = id;
+ }
+ /**
public DetectorElement(
String name,
IGeometryInfo geometry,
@@ -18,7 +39,7 @@
IDetectorElementContainer children,
IIdentifier id)
{
- this.name = name;
+ super(name);
this.geometry=geometry;
this.parent=parent;
// Copy the DE from container. Don't use
@@ -29,6 +50,12 @@
}
this.id = id;
}
+ */
+
+ public void addChild(IDetectorElement child)
+ {
+ children.add(child);
+ }
public IDetectorElementContainer getChildren()
{
@@ -40,11 +67,6 @@
return geometry;
}
- public String getName()
- {
- return name;
- }
-
public IDetectorElement getParent()
{
return parent;
GeomConverter/src/org/lcsim/detector
diff -u -r1.1 -r1.2
--- IDetectorElement.java 28 Feb 2007 21:52:00 -0000 1.1
+++ IDetectorElement.java 4 Mar 2007 05:03:00 -0000 1.2
@@ -8,9 +8,10 @@
*
* @author Tim Nelson <[log in to unmask]>
* @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: IDetectorElement.java,v 1.1 2007/02/28 21:52:00 jeremy Exp $
+ * @version $Id: IDetectorElement.java,v 1.2 2007/03/04 05:03:00 jeremy Exp $
*/
-public interface IDetectorElement extends IIdentifiable
+public interface IDetectorElement
+extends IIdentifiable, INamed
{
/**
* Get the geometric information for this node.
GeomConverter/src/org/lcsim/detector
diff -u -r1.2 -r1.3
--- IDetectorFactory.java 3 Mar 2007 14:06:41 -0000 1.2
+++ IDetectorFactory.java 4 Mar 2007 05:03:00 -0000 1.3
@@ -7,9 +7,12 @@
public interface IDetectorFactory
{
- ILogicalVolume createLogicalVolume(String name, ISolid solid, IMaterial material);
- IPhysicalVolume createPhysicalVolume();
- IPhysicalVolumeNavigator createPhysicalVolumeNavigator();
+ IDetectorElement createDetectorElement(String name);
+ IGeometryInfo createGeometryInfo(IDetectorElement de);
+ ILogicalVolume createLogicalVolume(String name, ISolid solid, IMaterial material);
+
+ IPhysicalVolumeNavigator createPhysicalVolumeNavigator(IPhysicalVolume world);
+ IPhysicalVolume createPhysicalVolume();
IRotation3D createRotation3D();
ICoordinateTransformation3D createTransform3D();
@@ -17,5 +20,5 @@
IMaterial createMaterialMixture();
Box createBox();
- Tube createTube();
-}
+ Tube createTube();
+}
\ No newline at end of file
GeomConverter/src/org/lcsim/detector
diff -u -r1.3 -r1.4
--- IGeometryInfo.java 3 Mar 2007 13:33:56 -0000 1.3
+++ IGeometryInfo.java 4 Mar 2007 05:03:00 -0000 1.4
@@ -3,194 +3,64 @@
import hep.physics.vec.Hep3Vector;
/**
+ * This interface auto-extracted from first draft of GeometryInfo class.
*
- * IGeometryInfo.java
+ * It provides access to the following information:
*
- * A port of Gaudi's IGeometryInfo, an abstract interface
- * to a node in the geometry tree.
+ * -logical volume
+ * -logical volume name
+ * -global to local transform
+ * -local to global transform
+ * -parent to local transform
+ * -the PhysicalVolumePath associated with this DE
+ *
+ * There are services for transforming global or local points
+ * using the above transforms.
+ *
+ * Additionally, the isInside method will check whether
+ * a global point is inside the leaf PhysicalVolume in the
+ * path.
*
- * @author Tim Nelson <[log in to unmask]>
* @author Jeremy McCormick <[log in to unmask]>
+ *
*/
-public interface IGeometryInfo
-{
- public ILogicalVolume getLogicalVolume();
-
- public String getLogicalVolumeName();
-
- public IPhysicalVolumePath getSupport();
-
- public boolean hasSupport();
-
- public void setSupport(IPhysicalVolumePath support);
-
- public boolean hasLogicalVolume();
-
- // global to local transformation
- public CoordinateTransformation3D globalToLocal();
-
- // local to global transformation
- public CoordinateTransformation3D localToGlobal();
-
- // parent to local
- public CoordinateTransformation3D parentToLocal();
-
- // transform a point in local coordinates to global coordinates
- public Hep3Vector localToGlobal(Hep3Vector local_point);
-
- // transform a point in global coordinates to local coordinates
- public Hep3Vector globalToLocal(Hep3Vector global_point);
-
- // get name of daughter volume containing a point in global coordinates
- public String childVolumeName(Hep3Vector global_point);
-
- // get daughter volume containing a point in global coordinates
- public IPhysicalVolume getPhysicalVolume(Hep3Vector globalPoint);
-
- public boolean isInside(Hep3Vector point);
-
- public Hep3Vector getPosition();
-
- //String belongsToPath(Hep3Vector globalPoint);
-
- //String belongsToPath(Hep3Vector globalPoint, int level);
-
- //IGeometryInfo belongsTo(Hep3Vector globalPoint);
-
- //IGeometryInfo belongsTo(Hep3Vector globalPoint, int level);
-
- /** find full geometry information for given point
- * @param point input 3D point
- * @param level number of levels to nagigate down the hierarchy
- * @param start is the location (or path) of "nearest regular
- * DetectorElement", which simultaneously contains the
- * Point and has the connection with Actual Geometry Tree.
- * @param volumePath retuned information
- */
- //IPhysicalVolumePath getFullGeoInfoForPoint(
- // Hep3Vector point,
- // int level,
- // IGeometryInfo start);
-
- /** find full geometry information for given point
- * @param point input 3D point
- * @param level number of levels to nagigate down the hierarchy
- * @param start is the location (or path) of "nearest regular
- * DetectorElement", which simultaneously contains the
- * Point and has the connection with Actual Geometry Tree.
- * @param replicaPath retuned information
- */
-// virtual StatusCode fullGeoInfoForPoint
-// ( const Gaudi::XYZPoint& point ,
-// const int level ,
-// IGeometryInfo*& start ,
-// ILVolume::ReplicaPath& replicaPath ) = 0;
-
- /** find full geometry information for given point
- * @param point input 3D point
- * @param level number of levels to nagigate down the hierarchy
- * @param start is the location (or path) of "nearest regular
- * DetectorElement", which simultaneously contains the
- * Point and has the connection with Actual Geometry Tree.
- * @param volumePath retuned information
- */
-// IPhysicalVolumePath fullGeoInfoForPoint
-// ( Hep3Vector point, int level, String start);
-
- /** find full geometry information for given point
- * @param point input 3D point
- * @param level number of levels to nagigate down the hierarchy
- * @param start is the location (or path) of "nearest regular
- * DetectorElement", which simultaneously contains the
- * Point and has the connection with Actual Geometry Tree.
- * @param replicaPath retuned information
- */
-// virtual StatusCode fullGeoInfoForPoint
-// ( const Gaudi::XYZPoint& point ,
-// const int level ,
-// std::string& start ,
-// ILVolume::ReplicaPath& replicaPath ) = 0;;
-
- /** the information about the support
- * @param start "start" geometry info
- * @param replicaPath replica path
- * @return status code
- */
- //virtual StatusCode location
- //( IGeometryInfo*& start ,
- // ILVolume::ReplicaPath& replicaPath ) const = 0;
-
- /** the information about the support
- * @param start "start" geometry info
- * @param replicaPath replica path
- * @return status code
- */
- //virtual StatusCode location
- //( std::string& start ,
- // ILVolume::ReplicaPath& replicaPath ) const = 0;
-
- /** the name of Logical Volume, addressed by start and Replica Path
- * @param start start
- * @param replicaPath replicaPath
- * @return the name of Logical Volume
- */
- //virtual std::string lvolumePath
- //( const std::string& start ,
- // const ILVolume::ReplicaPath& replicaPath ) = 0;
-
- /** the Logical Volume, addressed by start and Replica Path
- * @param start start
- * @param replicaPath replicaPath
- * @return pointer to Logical Volume
- */
- //virtual const ILVolume* lvolume
- //( const std::string& start ,
- // const ILVolume::ReplicaPath& replicaPath ) = 0;
-
- /** the name of Logical Volume, addressed by start and Replica Path
- * @param start start
- * @param replicaPath replicaPath
- * @return the name of Logical Volume
- */
- //virtual std::string lvolumePath
- //( IGeometryInfo* start ,
- // const ILVolume::ReplicaPath& replicaPath ) = 0;
-
- /** the Logical Volume, addressed by start and Replica Path
- * @param start start
- * @param replicaPath replicaPath
- * @return pointer to Logical Volume
- */
- //virtual const ILVolume* lvolume
- //( IGeometryInfo* start ,
- // const ILVolume::ReplicaPath& replicaPath ) = 0;
-
- /// retrive reference to replica path (mistrerious "rpath" or "npath")
- //virtual const ILVolume::ReplicaPath& supportPath() const = 0;
-
- /** @} */ // end of group LogVol
-
- /** pointer to the parent IGeometryInfo (const version)
- * @return pointer to the parent IGeometryInfo
- */
- IGeometryInfo parentIGeometryInfo();
-
- //IGeometryInfo supportIGeometryInfo();
-
- /** (reference to) container of children IGeometryInfo
- * return reference to container of children IGeometryInfo
- */
- IGeometryInfoContainer childIGeometryInfos();
-
- //interface IGeometryInfoIterator
- //{
- // IGeometryInfo next();
- // IGeometryInfo prev();
- // IGeometryInfo end();
- // IGeometryInfo begin();
- //}
-
- //IGeometryInfoIterator childBegin();
-
- //IGeometryInfoIterator childEnd();
+public interface IGeometryInfo
+{
+ public abstract IGeometryInfoContainer childIGeometryInfos();
+
+ public abstract IPhysicalVolumePath getPhysicalVolumePath(
+ Hep3Vector global_point);
+
+ public abstract ILogicalVolume getLogicalVolume();
+
+ public abstract String getLogicalVolumeName();
+
+ public abstract IPhysicalVolume getPhysicalVolume(Hep3Vector globalPoint);
+
+ public abstract Hep3Vector getPosition();
+
+ public abstract IPhysicalVolumePath getPhysicalVolumePath();
+
+ public abstract ICoordinateTransformation3D getGlobalToLocal();
+
+ public abstract Hep3Vector transformGlobalToLocal(Hep3Vector global_point);
+
+ public abstract boolean hasLogicalVolume();
+
+ public abstract boolean hasSupport();
+
+ public abstract boolean isInside(Hep3Vector point);
+
+ public abstract ICoordinateTransformation3D getLocalToGlobal();
+
+ public abstract Hep3Vector transformLocalToGlobal(Hep3Vector local_point);
+
+ public abstract IGeometryInfo parentIGeometryInfo();
+
+ public abstract ICoordinateTransformation3D getParentToLocal();
+
+ public abstract Hep3Vector transformParentToLocal(Hep3Vector parentPoint);
+
+ public abstract void setSupport(IPhysicalVolumePath support);
+
}
\ No newline at end of file
GeomConverter/src/org/lcsim/detector
diff -u -r1.3 -r1.4
--- IPhysicalVolumePath.java 3 Mar 2007 13:33:56 -0000 1.3
+++ IPhysicalVolumePath.java 4 Mar 2007 05:03:00 -0000 1.4
@@ -4,4 +4,8 @@
public interface IPhysicalVolumePath
extends List<IPhysicalVolume>
-{}
\ No newline at end of file
+{
+ public IPhysicalVolume getTopVolume();
+ public IPhysicalVolume getLeafVolume();
+ public boolean isEmpty();
+}
\ No newline at end of file
GeomConverter/src/org/lcsim/detector
diff -u -r1.3 -r1.4
--- PhysicalVolumeNavigator.java 3 Mar 2007 13:59:17 -0000 1.3
+++ PhysicalVolumeNavigator.java 4 Mar 2007 05:03:00 -0000 1.4
@@ -154,23 +154,43 @@
}
public IPhysicalVolume getTopPhysicalVolume()
- {
+ {
return pvTop;
}
public void setTopPhysicalVolume(IPhysicalVolume physvol)
{
+ if (physvol == null)
+ {
+ throw new IllegalArgumentException("Top PhysicalVolume cannot be null ref!");
+ }
pvTop = physvol;
}
+ public void setTopPhysicalVolume(IPhysicalVolumePath path)
+ {
+ if (path == null)
+ {
+ throw new IllegalArgumentException("The path cannot be null!");
+ }
+
+ if (path.isEmpty())
+ {
+ throw new IllegalArgumentException("The path is empty!");
+ }
+
+ setTopPhysicalVolume(path.getTopVolume());
+ }
+
private IPhysicalVolume pvTop;
public PhysicalVolumeNavigator(IPhysicalVolume pvTop)
{
- if ( pvTop == null )
- {
- throw new IllegalArgumentException("!!! PhysicalVolumeNavigator cannot be setup with a null PhysicalVolume !!!");
- }
- setTopPhysicalVolume(pvTop);
+ setTopPhysicalVolume(pvTop);
+ }
+
+ public PhysicalVolumeNavigator(IPhysicalVolumePath path)
+ {
+ setTopPhysicalVolume(path);
}
}
\ No newline at end of file
GeomConverter/src/org/lcsim/detector
diff -u -r1.1 -r1.2
--- PhysicalVolumePath.java 3 Mar 2007 02:24:51 -0000 1.1
+++ PhysicalVolumePath.java 4 Mar 2007 05:03:00 -0000 1.2
@@ -6,6 +6,56 @@
extends ArrayList<IPhysicalVolume>
implements IPhysicalVolumePath
{
+ public IPhysicalVolume getTopVolume()
+ {
+ if (size()>0)
+ {
+ return this.get(0);
+ }
+ else {
+ return null;
+ }
+ }
+
+ public IPhysicalVolume getLeafVolume()
+ {
+ if (size()>0)
+ {
+ return this.get(size()-1);
+ }
+ else {
+ return null;
+ }
+ }
+
+ public boolean isEmpty()
+ {
+ return size()==0;
+ }
+
+ public boolean equals(IPhysicalVolumePath path)
+ {
+ if (path == null)
+ {
+ return false;
+ }
+
+ if (path.size() != this.size())
+ {
+ return false;
+ }
+
+ for (int i=0; i<this.size(); i++)
+ {
+ if (this.get(i) != path.get(i))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
public String toString()
{
StringBuffer sb = new StringBuffer();
GeomConverter/src/org/lcsim/detector
diff -N SimpleTestGeometry.java
--- SimpleTestGeometry.java 3 Mar 2007 13:33:56 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,87 +0,0 @@
-package org.lcsim.detector;
-
-import static org.lcsim.units.clhep.SystemOfUnits.cm;
-import static org.lcsim.units.clhep.SystemOfUnits.m;
-import hep.physics.vec.BasicHep3Vector;
-
-import org.lcsim.detector.material.IMaterial;
-import org.lcsim.detector.material.MaterialElement;
-import org.lcsim.detector.solids.Box;
-
-/**
- * Makes simplistic detector geometry for testing the detector package.
- *
- * @author jeremym
- *
- */
-public class SimpleTestGeometry
-{
- private static IMaterial dummymat = new MaterialElement("dummymat",1,1,1.0);
-
- public static IPhysicalVolume createTestGeometry()
- {
- IPhysicalVolume world = createWorld();
- createTestGeometryBoxes(world);
- return world;
- }
-
- public static final void createTestGeometryBoxes(IPhysicalVolume mom)
- {
- // A 1 x 1 m box in the world.
- Box box = new Box("test_box",1.0*m,1.0*m,1.0*m);
- LogicalVolume lvTest = new LogicalVolume("lvTest",box,dummymat);
- new PhysicalVolume(
- new CoordinateTransformation3D(),
- "test",
- lvTest,
- mom.getLogicalVolume(),
- 1);
-
- // Box daughter volume inside mother at x = +20 cm.
- Box box2 = new Box("test_box2",10.0*cm,10.0*cm,10.0*cm);
- LogicalVolume lvTest2 = new LogicalVolume("lvTest2",box2,dummymat);
- // Box is displayed 5.0 mm in X.
- new PhysicalVolume(
- new CoordinateTransformation3D(new BasicHep3Vector(5.0,0,0)),
- "test2",
- lvTest2,
- lvTest,
- 1);
-
- // Another box in the big one at x = -20 cm.
- //Box box3 = new Box("test_box3",10.0*cm,10.0*cm,10.0*cm);
- //LogicalVolume lvTest3 = new LogicalVolume("lvTest3",box3,dummymat);
- //new PhysicalVolume(
- // new CoordinateTransformation3D(
- // new BasicHep3Vector(-20.0*cm,0.0,0.0)),
- // "test3",
- // lvTest3,
- // lvTest,
- // 2);
- }
-
- public static final IPhysicalVolume createWorld()
- {
- Box boxWorld = new Box(
- "world_box",
- 10.0*m,
- 10.0*m,
- 10.0*m);
-
- LogicalVolume lvWorld =
- new LogicalVolume(
- "world",
- boxWorld,
- dummymat);
-
- IPhysicalVolume pvTop =
- new PhysicalVolume(
- null,
- "world",
- lvWorld,
- null,
- 0);
-
- return pvTop;
- }
-}
\ No newline at end of file
GeomConverter/src/org/lcsim/detector/identifier
diff -u -r1.1 -r1.2
--- IIdentifier.java 28 Feb 2007 21:52:00 -0000 1.1
+++ IIdentifier.java 4 Mar 2007 05:03:00 -0000 1.2
@@ -1,5 +1,7 @@
package org.lcsim.detector.identifier;
+import java.util.BitSet;
+
/**
* An interface for comparable identifiers.
*
@@ -36,29 +38,58 @@
*/
public boolean less(IIdentifier id);
- // what should this return code represent?
- // seems like lattitude here could be helpful
- // for implementations/subclasses but maybe
- // this isn't needed
+ /**
+ * 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 sizeBits();
+ public int getSizeInBits();
- // size in 32-bit words
- public int sizeWords();
-
- // size in bytes
- public int sizeBytes();
-
- // hex rep
+ /**
+ * Get a raw hex string representation.
+ * @return
+ */
public String hexString();
- // set from hex string
+ // Setup from hex string.
public void setHexString(String hexRep);
// set value from another IIdentifier
- public void setIdentifier(IIdentifier id);
+ //public void setIdentifier(IIdentifier id);
// clear state
public void clear();
CVSspam 0.2.8