17 added + 6 modified, total 23 files
GeomConverter/src/org/lcsim/detector
diff -N IGeometryInfoContainer.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ IGeometryInfoContainer.java 2 Mar 2007 02:28:23 -0000 1.1
@@ -0,0 +1,7 @@
+package org.lcsim.detector;
+
+import java.util.Collection;
+
+public interface IGeometryInfoContainer
+extends Collection<IGeometryInfo>
+{}
\ No newline at end of file
GeomConverter/src/org/lcsim/detector
diff -N ILogicalVolumeStore.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ILogicalVolumeStore.java 2 Mar 2007 02:28:23 -0000 1.1
@@ -0,0 +1,5 @@
+package org.lcsim.detector;
+
+public interface ILogicalVolumeStore
+extends IObjectStore<ILogicalVolume>
+{}
GeomConverter/src/org/lcsim/detector
diff -N INamed.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ INamed.java 2 Mar 2007 02:28:23 -0000 1.1
@@ -0,0 +1,22 @@
+package org.lcsim.detector;
+
+/**
+ *
+ * A mixin interface for assigning String names to objects.
+ *
+ * @author Jeremy McCormick <[log in to unmask]>
+ *
+ */
+public interface INamed
+{
+ public String getName();
+ public void setName(String name) throws ImmutableNameException;
+ public boolean isNameChangeable();
+ public final class ImmutableNameException extends Exception
+ {
+ public ImmutableNameException(String name)
+ {
+ super("The name of <" + name + "> is not immutable once set.");
+ }
+ }
+}
\ No newline at end of file
GeomConverter/src/org/lcsim/detector
diff -N IObjectStore.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ IObjectStore.java 2 Mar 2007 02:28:23 -0000 1.1
@@ -0,0 +1,7 @@
+package org.lcsim.detector;
+
+import java.util.List;
+
+public interface IObjectStore<T>
+extends List<T>
+{}
GeomConverter/src/org/lcsim/detector
diff -N IPhysicalVolumeStore.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ IPhysicalVolumeStore.java 2 Mar 2007 02:28:23 -0000 1.1
@@ -0,0 +1,5 @@
+package org.lcsim.detector;
+
+public interface IPhysicalVolumeStore
+extends IObjectStore<IPhysicalVolume>
+{}
GeomConverter/src/org/lcsim/detector
diff -N ISolidStore.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ISolidStore.java 2 Mar 2007 02:28:23 -0000 1.1
@@ -0,0 +1,5 @@
+package org.lcsim.detector;
+
+public interface ISolidStore
+extends IObjectStore<ISolid>
+{}
GeomConverter/src/org/lcsim/detector
diff -N LogicalVolume.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ LogicalVolume.java 2 Mar 2007 02:28:23 -0000 1.1
@@ -0,0 +1,80 @@
+package org.lcsim.detector;
+
+/**
+ * Implementation of @see ILogicalVolume.
+ *
+ * @author Jeremy McCormick <[log in to unmask]>
+ *
+ */
+public class LogicalVolume
+extends Named
+implements ILogicalVolume
+{
+ IMaterial material;
+ ISolid solid;
+ IPhysicalVolumeContainer physicalVolumes;
+
+ public LogicalVolume(String name, ISolid solid, IMaterial material)
+ {
+ super(name);
+ this.solid = solid;
+ this.material = material;
+
+ // Register with the store.
+ LogicalVolumeStore.getInstance().add(this);
+ }
+
+ public IMaterial getMaterial()
+ {
+ return material;
+ }
+
+ public ISolid getSolid()
+ {
+ return solid;
+ }
+
+ public IPhysicalVolumeContainer getDaughters()
+ {
+ return physicalVolumes;
+ }
+
+ public void addDaughter(IPhysicalVolume physvol)
+ {
+ physicalVolumes.add(physvol);
+ }
+
+ public IPhysicalVolume getDaughter(int i)
+ {
+ return physicalVolumes.get(i);
+ }
+
+ public boolean isDaughter(IPhysicalVolume physvol)
+ {
+ return physicalVolumes.contains(physvol);
+ }
+
+ public int getNumberOfDaughters()
+ {
+ return physicalVolumes.size();
+ }
+
+ public boolean isAncestor(IPhysicalVolume physvol)
+ {
+ boolean isDaughter = isDaughter(physvol);
+ if (!isDaughter)
+ {
+ for (IPhysicalVolume iphysvol : physicalVolumes)
+ {
+ isDaughter = iphysvol.getLogicalVolume().isAncestor(physvol);
+ if (isDaughter) break;
+ }
+ }
+ return isDaughter;
+ }
+
+ protected void finalize()
+ {
+ LogicalVolumeStore.getInstance().remove(this);
+ }
+}
\ No newline at end of file
GeomConverter/src/org/lcsim/detector
diff -N LogicalVolumeStore.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ LogicalVolumeStore.java 2 Mar 2007 02:28:23 -0000 1.1
@@ -0,0 +1,16 @@
+package org.lcsim.detector;
+
+public class LogicalVolumeStore
+extends ObjectStore<ILogicalVolume>
+implements ILogicalVolumeStore
+{
+ private static ILogicalVolumeStore store;
+ public static ILogicalVolumeStore getInstance()
+ {
+ if (store == null)
+ {
+ store = new LogicalVolumeStore();
+ }
+ return store;
+ }
+}
\ No newline at end of file
GeomConverter/src/org/lcsim/detector
diff -N Named.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Named.java 2 Mar 2007 02:28:23 -0000 1.1
@@ -0,0 +1,47 @@
+package org.lcsim.detector;
+
+/**
+ *
+ * Implementation of the @see INamed interface.
+ *
+ * @author Jeremy McCormick <[log in to unmask]>
+ *
+ */
+public abstract class Named
+implements INamed
+{
+ private String name;
+ private boolean isNameChangeable=true;
+
+ public Named(String name)
+ {
+ this.name = name;
+ }
+
+ public Named(String name, boolean isNameChangeable)
+ {
+ this.name = name;
+ this.isNameChangeable = isNameChangeable;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name) throws ImmutableNameException
+ {
+ if ( isNameChangeable )
+ {
+ this.name = name;
+ }
+ else {
+ throw new ImmutableNameException(name);
+ }
+ }
+
+ public boolean isNameChangeable()
+ {
+ return isNameChangeable;
+ }
+}
\ No newline at end of file
GeomConverter/src/org/lcsim/detector
diff -N ObjectStore.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ObjectStore.java 2 Mar 2007 02:28:23 -0000 1.1
@@ -0,0 +1,8 @@
+package org.lcsim.detector;
+
+import java.util.ArrayList;
+
+public class ObjectStore<T>
+extends ArrayList<T>
+implements IObjectStore<T>
+{}
\ No newline at end of file
GeomConverter/src/org/lcsim/detector
diff -N PhysicalVolume.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ PhysicalVolume.java 2 Mar 2007 02:28:23 -0000 1.1
@@ -0,0 +1,69 @@
+package org.lcsim.detector;
+
+import hep.physics.vec.Hep3Vector;
+
+public class PhysicalVolume
+extends Named
+implements IPhysicalVolume
+{
+ CoordinateTransformation3D transform;
+ ILogicalVolume logicalVolume;
+ ILogicalVolume motherLogicalVolume;
+ int copyNum;
+
+ public PhysicalVolume(
+ CoordinateTransformation3D transform,
+ String name,
+ ILogicalVolume logicalVolume,
+ ILogicalVolume motherLogicalVolume,
+ int copyNum)
+ {
+ super(name);
+ this.transform = transform;
+ this.logicalVolume = logicalVolume;
+ this.motherLogicalVolume = motherLogicalVolume;
+ this.copyNum = copyNum;
+
+ // Add to mother.
+ motherLogicalVolume.addDaughter(this);
+
+ // Add to store.
+ PhysicalVolumeStore.getInstance().add(this);
+ }
+
+ public Rotation3D getRotation()
+ {
+ return transform.getRotation();
+ }
+
+ public int getCopyNumber()
+ {
+ return copyNum;
+ }
+
+ public ILogicalVolume getMotherLogicalVolume()
+ {
+ return motherLogicalVolume;
+ }
+
+
+ public ILogicalVolume getLogicalVolume()
+ {
+ return logicalVolume;
+ }
+
+ public CoordinateTransformation3D getTransform()
+ {
+ return transform;
+ }
+
+ public Hep3Vector getTranslation()
+ {
+ return transform.getTranslation();
+ }
+
+ protected void finalize()
+ {
+ PhysicalVolumeStore.getInstance().remove(this);
+ }
+}
\ No newline at end of file
GeomConverter/src/org/lcsim/detector
diff -N PhysicalVolumeContainer.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ PhysicalVolumeContainer.java 2 Mar 2007 02:28:23 -0000 1.1
@@ -0,0 +1,7 @@
+package org.lcsim.detector;
+
+import java.util.ArrayList;
+
+public class PhysicalVolumeContainer
+extends ArrayList<IPhysicalVolume>
+{}
GeomConverter/src/org/lcsim/detector
diff -N PhysicalVolumeStore.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ PhysicalVolumeStore.java 2 Mar 2007 02:28:23 -0000 1.1
@@ -0,0 +1,16 @@
+package org.lcsim.detector;
+
+public class PhysicalVolumeStore
+extends ObjectStore<IPhysicalVolume>
+implements IPhysicalVolumeStore
+{
+ private static IPhysicalVolumeStore store;
+ public static IPhysicalVolumeStore getInstance()
+ {
+ if ( store == null )
+ {
+ store = new PhysicalVolumeStore();
+ }
+ return store;
+ }
+}
\ No newline at end of file
GeomConverter/src/org/lcsim/detector
diff -N SolidStore.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ SolidStore.java 2 Mar 2007 02:28:23 -0000 1.1
@@ -0,0 +1,16 @@
+package org.lcsim.detector;
+
+public class SolidStore
+extends ObjectStore<ISolid>
+implements ISolidStore
+{
+ private static ISolidStore store;
+ public static ISolidStore getInstance()
+ {
+ if ( store == null )
+ {
+ store = new SolidStore();
+ }
+ return store;
+ }
+}
\ No newline at end of file
GeomConverter/src/org/lcsim/detector
diff -u -r1.1 -r1.2
--- IGeometryInfo.java 28 Feb 2007 21:52:00 -0000 1.1
+++ IGeometryInfo.java 2 Mar 2007 02:28:23 -0000 1.2
@@ -21,16 +21,19 @@
public boolean hasLogicalVolume();
// global to local transformation
- public CoordinateTransformation3D toLocal();
+ public CoordinateTransformation3D globalToLocal();
// local to global transformation
- public CoordinateTransformation3D toGlobal();
+ public CoordinateTransformation3D localToGlobal();
+
+ // parent to local
+ public CoordinateTransformation3D parentToLocal();
// transform a point in local coordinates to global coordinates
- public Hep3Vector toGlobal(Hep3Vector local_point);
+ public Hep3Vector localToGlobal(Hep3Vector local_point);
// transform a point in global coordinates to local coordinates
- public Hep3Vector toLocal(Hep3Vector global_point);
+ public Hep3Vector globalToLocal(Hep3Vector global_point);
// get name of daughter volume containing a point in global coordinates
public String childVolumeName(Hep3Vector global_point);
@@ -42,13 +45,13 @@
public Hep3Vector getPosition();
- String belongsToPath(Hep3Vector globalPoint);
+ //String belongsToPath(Hep3Vector globalPoint);
- String belongsToPath(Hep3Vector globalPoint, int level);
+ //String belongsToPath(Hep3Vector globalPoint, int level);
- IGeometryInfo belongsTo(Hep3Vector globalPoint);
+ //IGeometryInfo belongsTo(Hep3Vector globalPoint);
- IGeometryInfo belongsTo(Hep3Vector globalPoint, int level);
+ //IGeometryInfo belongsTo(Hep3Vector globalPoint, int level);
/** find full geometry information for given point
* @param point input 3D point
@@ -58,10 +61,10 @@
* Point and has the connection with Actual Geometry Tree.
* @param volumePath retuned information
*/
- IPhysicalVolumePath getFullGeoInfoForPoint(
- Hep3Vector point,
- int level,
- IGeometryInfo start);
+ //IPhysicalVolumePath getFullGeoInfoForPoint(
+ // Hep3Vector point,
+ // int level,
+ // IGeometryInfo start);
/** find full geometry information for given point
* @param point input 3D point
@@ -85,8 +88,8 @@
* Point and has the connection with Actual Geometry Tree.
* @param volumePath retuned information
*/
- IPhysicalVolumePath fullGeoInfoForPoint
- ( Hep3Vector point, int level, String start);
+// IPhysicalVolumePath fullGeoInfoForPoint
+// ( Hep3Vector point, int level, String start);
/** find full geometry information for given point
* @param point input 3D point
@@ -166,27 +169,22 @@
*/
IGeometryInfo parentIGeometryInfo();
- // virtual IGeometryInfo* supportIGeometryInfo() = 0 ;
+ //IGeometryInfo supportIGeometryInfo();
/** (reference to) container of children IGeometryInfo
* return reference to container of children IGeometryInfo
*/
- //virtual IGeometryInfo::IGIChildrens& childIGeometryInfos() = 0;
+ IGeometryInfoContainer childIGeometryInfos();
+
+ //interface IGeometryInfoIterator
+ //{
+ // IGeometryInfo next();
+ // IGeometryInfo prev();
+ // IGeometryInfo end();
+ // IGeometryInfo begin();
+ //}
- interface IGeometryInfoIterator
- {
- IGeometryInfo next();
- IGeometryInfo prev();
- IGeometryInfo end();
- IGeometryInfo begin();
- }
-
- IGeometryInfoIterator childBegin();
-
- IGeometryInfoIterator childEnd();
-
- // Gaudi has "get the exact full geometry location" What does this mean???
- // One interpretation, entire heirarchy as map of LVolumes to
- // positions in coordinates of each volume
- // public Map<ILVolume,Hep3Vector>
+ //IGeometryInfoIterator childBegin();
+
+ //IGeometryInfoIterator childEnd();
}
\ No newline at end of file
GeomConverter/src/org/lcsim/detector
diff -u -r1.2 -r1.3
--- ILogicalVolume.java 28 Feb 2007 21:59:39 -0000 1.2
+++ ILogicalVolume.java 2 Mar 2007 02:28:23 -0000 1.3
@@ -1,11 +1,25 @@
package org.lcsim.detector;
-import java.util.List;
-
+/**
+ * An interface to logical volume information.
+ *
+ * This interface borrows from the Geant4 class G4LogicalVolume,
+ * but does not include regions, sensitive detectors, or the magnetic
+ * field.
+ *
+ * {@link }
+ *
+ * @author Jeremy McCormick <[log in to unmask]>
+ *
+ */
public interface ILogicalVolume
+extends INamed
{
- String getName();
- ISolid getSolid();
- IMaterial getMaterial();
- IPhysicalVolumeContainer getDaughterVolumes();
-}
+ public ISolid getSolid();
+ public IMaterial getMaterial();
+ public IPhysicalVolumeContainer getDaughters();
+ public void addDaughter(IPhysicalVolume physvol);
+ public IPhysicalVolume getDaughter(int i);
+ public boolean isDaughter(IPhysicalVolume physvol);
+ public boolean isAncestor(IPhysicalVolume physvol);
+}
\ No newline at end of file
GeomConverter/src/org/lcsim/detector
diff -u -r1.1 -r1.2
--- IPhysicalVolume.java 28 Feb 2007 21:52:00 -0000 1.1
+++ IPhysicalVolume.java 2 Mar 2007 02:28:23 -0000 1.2
@@ -3,11 +3,13 @@
import hep.physics.vec.Hep3Vector;
public interface IPhysicalVolume
+extends INamed
{
- String getName();
- ILogicalVolume getLogicalVolume();
- ICoordinateTransformation3D getTransform();
- Hep3Vector getPosition();
- IRotation3D getRotation();
- Hep3Vector parentToLocal(Hep3Vector point);
+ public ILogicalVolume getLogicalVolume();
+ public ILogicalVolume getMotherLogicalVolume();
+ public ICoordinateTransformation3D getTransform();
+ public Hep3Vector getTranslation();
+ public IRotation3D getRotation();
+ public int getCopyNumber();
+ //Hep3Vector parentToLocal(Hep3Vector point);
}
\ No newline at end of file
GeomConverter/src/org/lcsim/detector
diff -u -r1.1 -r1.2
--- IPhysicalVolumeContainer.java 28 Feb 2007 21:52:00 -0000 1.1
+++ IPhysicalVolumeContainer.java 2 Mar 2007 02:28:23 -0000 1.2
@@ -1,7 +1,7 @@
package org.lcsim.detector;
-import java.util.Collection;
+import java.util.List;
public interface IPhysicalVolumeContainer
-extends Collection<IPhysicalVolume>
+extends List<IPhysicalVolume>
{}
GeomConverter/src/org/lcsim/detector
diff -u -r1.1 -r1.2
--- IPhysicalVolumePath.java 28 Feb 2007 21:52:00 -0000 1.1
+++ IPhysicalVolumePath.java 2 Mar 2007 02:28:23 -0000 1.2
@@ -2,5 +2,6 @@
import java.util.List;
-public interface IPhysicalVolumePath extends List<IPhysicalVolume>
+public interface IPhysicalVolumePath
+extends List<IPhysicalVolume>
{}
GeomConverter/src/org/lcsim/detector
diff -u -r1.1 -r1.2
--- ISolid.java 28 Feb 2007 21:52:00 -0000 1.1
+++ ISolid.java 2 Mar 2007 02:28:23 -0000 1.2
@@ -3,8 +3,8 @@
import hep.physics.vec.Hep3Vector;
public interface ISolid
+extends INamed
{
- public String getName();
- public void setName(String name);
- boolean isInside(Hep3Vector position);
+ public boolean isInside(Hep3Vector position);
+ public double getCubicVolume();
}
\ No newline at end of file
GeomConverter/src/org/lcsim/detector/solids
diff -N AbstractSolid.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ AbstractSolid.java 2 Mar 2007 02:28:24 -0000 1.1
@@ -0,0 +1,23 @@
+package org.lcsim.detector.solids;
+
+import org.lcsim.detector.ISolid;
+import org.lcsim.detector.Named;
+import org.lcsim.detector.SolidStore;
+
+public abstract class AbstractSolid
+extends Named
+implements ISolid
+{
+ String name;
+
+ public AbstractSolid(String name)
+ {
+ super(name);
+ SolidStore.getInstance().add(this);
+ }
+
+ protected void finalize()
+ {
+ SolidStore.getInstance().remove(this);
+ }
+}
\ No newline at end of file
GeomConverter/src/org/lcsim/detector/solids
diff -N Box.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Box.java 2 Mar 2007 02:28:24 -0000 1.1
@@ -0,0 +1,53 @@
+package org.lcsim.detector.solids;
+
+import hep.physics.vec.Hep3Vector;
+
+/**
+ *
+ * An @see ISolid representing a box. Lengths are
+ * half lengths in x, y, and z.
+ *
+ * @author Tim Nelson <[log in to unmask]>
+ * @author Jeremy McCormick <[log in to unmask]>
+ * @version $Id: Box.java,v 1.1 2007/03/02 02:28:24 jeremy Exp $
+ */
+public class Box
+extends AbstractSolid
+{
+ double xHalf, yHalf, zHalf;
+
+ public Box(String name, double halfX, double halfY, double halfZ)
+ {
+ super(name);
+ this.xHalf = halfX;
+ this.yHalf = halfY;
+ this.zHalf = halfZ;
+ }
+
+ public double getXHalfLength()
+ {
+ return xHalf;
+ }
+
+ public double getYHalfLength()
+ {
+ return yHalf;
+ }
+
+ public double getZHalfLength()
+ {
+ return zHalf;
+ }
+
+ public boolean isInside(Hep3Vector point)
+ {
+ return ( Math.abs(point.x()) < xHalf &&
+ Math.abs(point.y()) < yHalf &&
+ Math.abs(point.z()) < zHalf );
+ }
+
+ public double getCubicVolume()
+ {
+ return 8 * (getXHalfLength() * getYHalfLength() * getZHalfLength());
+ }
+}
\ No newline at end of file
GeomConverter/src/org/lcsim/detector/solids
diff -N Tube.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Tube.java 2 Mar 2007 02:28:24 -0000 1.1
@@ -0,0 +1,57 @@
+package org.lcsim.detector.solids;
+
+import hep.physics.vec.Hep3Vector;
+
+import org.lcsim.detector.ISolid;
+import org.lcsim.detector.Named;
+
+/**
+ *
+ * @author Tim Nelson <[log in to unmask]>
+ * @author Jeremy McCormick <[log in to unmask]>
+ * @version $Id: Tube.java,v 1.1 2007/03/02 02:28:24 jeremy Exp $
+ */
+public class Tube
+extends Named
+implements ISolid
+{
+ private double innerRadius, outerRadius, zHalfLength;
+
+ public Tube(String name, double innerRadius, double outerRadius, double zHalfLength)
+ {
+ super(name);
+ this.innerRadius = innerRadius;
+ this.outerRadius = outerRadius;
+ this.zHalfLength = zHalfLength;
+ }
+
+ public double getInnerRadius()
+ {
+ return innerRadius;
+ }
+
+ public double getOuterRadius()
+ {
+ return outerRadius;
+ }
+
+ public double getZHalfLength()
+ {
+ return zHalfLength;
+ }
+
+ public double getCubicVolume()
+ {
+ return Math.PI * (outerRadius * outerRadius -
+ innerRadius * innerRadius) * (zHalfLength * 2);
+ }
+
+ public boolean isInside(Hep3Vector point)
+ {
+ double r_xy = Math.sqrt(point.x()*point.x() + point.y()*point.y());
+
+ return ( r_xy > innerRadius &&
+ r_xy < outerRadius &&
+ Math.abs(point.z()) < zHalfLength );
+ }
+}
\ No newline at end of file
CVSspam 0.2.8