39 added files
GeomConverter/sandbox/detector
diff -N CoordinateTransformation3D.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ CoordinateTransformation3D.java 28 Feb 2007 19:48:21 -0000 1.1
@@ -0,0 +1,112 @@
+/*
+ * CoordinateTransformation3D.java
+ */
+
+package org.lcsim.detector;
+
+import hep.physics.vec.Hep3Vector;
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.VecOp;
+
+/**
+ *
+ * @author tknelson
+ */
+public class CoordinateTransformation3D implements ICoordinateTransformation3D
+{
+
+ // Fields
+ Hep3Vector _translation = new BasicHep3Vector(0.0,0.0,0.0);
+ Rotation3D _rotation = new Rotation3D();
+
+ /**
+ * Creates a new instance of CoordinateTransformation3D
+ */
+ public CoordinateTransformation3D()
+ {
+ }
+
+ public CoordinateTransformation3D(Rotation3D rotation)
+ {
+ this._rotation = rotation;
+ }
+
+ public CoordinateTransformation3D(Hep3Vector translation)
+ {
+ this._translation = translation;
+ }
+
+ public CoordinateTransformation3D(Hep3Vector translation, Rotation3D rotation)
+ {
+ _translation = translation;
+ _rotation = rotation;
+ }
+
+ public CoordinateTransformation3D(Hep3Vector translation, IRotation3D rotation)
+ {
+ _translation = translation;
+ _rotation = (Rotation3D)rotation;
+ }
+
+ // Access to translation and rotation
+ public Hep3Vector getTranslation()
+ {
+ return _translation;
+ }
+
+ public Rotation3D getRotation()
+ {
+ return _rotation;
+ }
+
+ // Transformations
+ public Hep3Vector transform(Hep3Vector coordinates)
+ {
+ translate(coordinates);
+ rotate(coordinates);
+ return coordinates;
+ }
+
+ public Hep3Vector translate(Hep3Vector coordinates)
+ {
+ return VecOp.add(coordinates,_translation);
+ }
+
+ public Hep3Vector rotate(Hep3Vector coordinates)
+ {
+ //return VecOp.mult(_rotation,coordinates);
+ return VecOp.mult(_rotation.getRotationMatrix(),coordinates);
+ }
+
+ // Invert the transformation
+ public void invert()
+ {
+ _translation = VecOp.mult(-1.0,VecOp.mult(_rotation.getRotationMatrix(),_translation));
+ _rotation.invert(); // Need to assure that transpose is used
+ }
+
+ // FIXME: Talk to Tony about supporting this pattern
+
+ public CoordinateTransformation3D inverse()
+ {
+ CoordinateTransformation3D transform = new CoordinateTransformation3D(
+ VecOp.mult(-1.0,VecOp.mult(_rotation.getRotationMatrix(),_translation)),
+ _rotation.inverse()); // FIXME: Need to assure that transpose is used
+ return transform;
+ }
+
+ // Static functions
+ public static CoordinateTransformation3D mult(CoordinateTransformation3D transformation1, CoordinateTransformation3D transformation2)
+ {
+ Rotation3D rotation = new Rotation3D(VecOp.mult(transformation1.getRotation().getRotationMatrix(),transformation2.getRotation().getRotationMatrix()));
+ Hep3Vector translation = VecOp.add(VecOp.mult(transformation1.getRotation().getRotationMatrix(),transformation2.getTranslation()),transformation1.getTranslation());
+ return new CoordinateTransformation3D(translation,rotation);
+ }
+
+ // multiply in place
+ public void mult(ICoordinateTransformation3D transformation)
+ {
+ _rotation.setRotationMatrix(VecOp.mult(_rotation.getRotationMatrix(), transformation.getRotation().getRotationMatrix()));
+ _translation = VecOp.add(_translation, transformation.getTranslation());
+ }
+}
GeomConverter/sandbox/detector
diff -N DetectorElement.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ DetectorElement.java 28 Feb 2007 19:48:21 -0000 1.1
@@ -0,0 +1,23 @@
+/*
+ * IDetectorElement.java
+ *
+ * Created on November 2, 2006, 4:51 PM
+ *
+ * To change this template, choose Tools | Template Manager
+ * and open the template in the editor.
+ */
+
+package org.lcsim.contrib.JeremyMcCormick;
+
+import java.util.List;
+
+/**
+ *
+ * @author tknelson
+ */
+// SlowControl
+// FastControl
+// Calibration
+// ReadOut
+public abstract class DetectorElement implements IDetectorElement
+{}
GeomConverter/sandbox/detector
diff -N DetectorElementMixin.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ DetectorElementMixin.java 28 Feb 2007 19:48:21 -0000 1.1
@@ -0,0 +1,8 @@
+package org.lcsim.contrib.JeremyMcCormick;
+
+public interface DetectorElementMixin
+{
+ DetectorElement getDetectorElement();
+ void setDetectorElement(DetectorElement detelem);
+ boolean hasValidDetectorElement();
+}
GeomConverter/sandbox/detector
diff -N DetectorID.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ DetectorID.java 28 Feb 2007 19:48:21 -0000 1.1
@@ -0,0 +1,80 @@
+package org.lcsim.contrib.JeremyMcCormick;
+
+import org.lcsim.contrib.JeremyMcCormick.identifier.Identifier;
+
+/**
+ * Idea for global detector identifier based on AtlasDetectorID.
+ * @author jeremym
+ *
+ */
+public interface DetectorID
+{
+ public boolean isVertexBarrel(Identifier i);
+ public boolean isVertexEndcap(Identifier i);
+ public boolean isForwardCalorimter(Identifier i);
+ public boolean isLuminosityMonitor(Identifier i);
+ public boolean isGammaCal(Identifier i);
+ public boolean isTrackerBarrel(Identifier i);
+ public boolean isTrackerEndcap(Identifier i);
+ public boolean isTPC(Identifier i);
+ public boolean isEcalBarrel(Identifier i);
+ public boolean isEcalEndcap(Identifier i);
+ public boolean isHadBarrel(Identifier i);
+ public boolean isHadEndcap(Identifier i);
+ public boolean isMuonBarrel(Identifier i);
+ public boolean isMuonEndcap(Identifier i);
+
+ public Identifier getVertexBarrelID();
+ public Identifier getVertexEndcapID();
+ public Identifier getForwardCalorimeterID();
+ public Identifier getLuminosityMonitorID();
+ public Identifier getGammaCalID();
+ public Identifier getTrackerBarrelID();
+ public Identifier getTrackerEndcapID();
+ public Identifier getTPCID();
+ public Identifier getEcalBarrelID();
+ public Identifier getEcalEndcapID();
+ public Identifier getHadBarrelID();
+ public Identifier getHadEndcapID();
+ public Identifier getMuonBarrelID();
+ public Identifier getMuonEndcapID();
+
+ public int getVertexBarrelValue();
+ public int getVertexEndcapValue();
+ public int getForwardCalorimeterValue();
+ public int getLuminosityMonitorValue();
+ public int getGammaCalValue();
+ public int getTrackerBarrelValue();
+ public int getTrackerEndcapValue();
+ public int getTPCValue();
+ public int getEcalBarrelValue();
+ public int getEcalEndcapValue();
+ public int getHadBarrelValue();
+ public int getHadEndcapValue();
+ public int getMuonBarrelValue();
+ public int getMuonEndcapValue();
+
+
+
+
+ /*
+
+ VertexBarrel
+ VertexEndcap
+ ForwardCalorimeter
+ LuminosityMonitor
+ GammaCal
+ TrackerBarrel
+ TrackerEndcap
+ TPC
+ EcalBarrel
+ EcalEndcap
+ HadBarrel
+ HadEndcap
+ MuonBarrel
+ MuonEndcap
+
+ */
+
+
+}
GeomConverter/sandbox/detector
diff -N GeometryCatalog.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ GeometryCatalog.java 28 Feb 2007 19:48:21 -0000 1.1
@@ -0,0 +1,62 @@
+/*
+ * GeometryCatalog.java
+ *
+ * Created on November 9, 2006, 2:42 PM
+ *
+ * To change this template, choose Tools | Template Manager
+ * and open the template in the editor.
+ */
+
+package org.lcsim.contrib.subdetector.tracker.silicon;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ *
+ * @author tknelson
+ */
+public class GeometryCatalog
+{
+
+ // Singleton implementation
+ static private GeometryCatalog _instance;
+
+ /**
+ * Creates a new instance of GeometryCatalog
+ */
+ private GeometryCatalog()
+ {
+ }
+
+ static public GeometryCatalog getInstance()
+ {
+ if (_instance == null)
+ {
+ _instance = new GeometryCatalog();
+ }
+ return _instance;
+ }
+
+
+ // Storage of LVolumes
+ //====================
+ private Map<String,LVolume> _lvolumes = new HashMap<String,LVolume>();
+
+ public LVolume getLVolume(String name)
+ {
+ return _lvolumes.get(name);
+ }
+
+ public void addLVolume(String name, LVolume lvolume)
+ {
+ _lvolumes.put(name,lvolume);
+ }
+
+ public void clearLVolumes()
+ {
+ _lvolumes.clear();
+ }
+
+
+}
GeomConverter/sandbox/detector
diff -N GeometryInfo.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ GeometryInfo.java 28 Feb 2007 19:48:21 -0000 1.1
@@ -0,0 +1,107 @@
+/*
+ * GeometryInfo.java
+ *
+ * Created on November 6, 2006, 11:12 AM
+ *
+ * To change this template, choose Tools | Template Manager
+ * and open the template in the editor.
+ */
+
+package org.lcsim.detector;
+
+import hep.physics.vec.Hep3Vector;
+
+import java.util.List;
+
+/**
+ *
+ * @author tknelson
+ */
+public class GeometryInfo implements IGeometryInfo
+{
+
+ // Fields
+ //=======
+ CoordinateTransformation3D _global_to_local;
+ CoordinateTransformation3D _local_to_global;
+ ILogicalVolume _logical_volume;
+ List<IPhysicalVolume> _daughter_volumes;
+
+ /** Creates a new instance of GeometryInfo */
+ public GeometryInfo(CoordinateTransformation3D global_to_local, ILogicalVolume logical_volume)
+ {
+ _global_to_local = global_to_local;
+ _local_to_global = global_to_local.inverse();
+ _logical_volume = logical_volume;
+ }
+
+ // Accessors
+ public CoordinateTransformation3D getGlobalToLocal()
+ {
+ return _global_to_local;
+ }
+
+ public CoordinateTransformation3D getLocalToGlobal()
+ {
+ return _local_to_global;
+ }
+
+ public Hep3Vector globalToLocal(Hep3Vector global_point)
+ {
+ return _global_to_local.transform(global_point);
+ }
+
+ public Hep3Vector localToGlobal(Hep3Vector local_point)
+ {
+ return _local_to_global.transform(local_point);
+ }
+
+ public String childVolumeName(Hep3Vector global_point)
+ {
+ Hep3Vector parent_point = globalToLocal(global_point);
+ List<IPhysicalVolume> daughter_volumes = getLogicalVolume().getDaughterVolumes();
+
+ String volume_name = "";
+ for (IPhysicalVolume daughter_volume : _daughter_volumes)
+ {
+ if (daughter_volume.getLogicalVolume().getSolid().isInside(daughter_volume.parentToLocal(parent_point)));
+ {
+ volume_name = daughter_volume.getLogicalVolume().getName();
+ break;
+ }
+ }
+ return volume_name;
+ }
+
+ public IPhysicalVolume childVolume(Hep3Vector global_point)
+ {
+ Hep3Vector parent_point = globalToLocal(global_point);
+ List<IPhysicalVolume> daughter_volumes = getLogicalVolume().getDaughterVolumes();
+
+ IPhysicalVolume volume = null;
+ for (IPhysicalVolume daughter_volume : _daughter_volumes)
+ {
+ if (daughter_volume.getLogicalVolume().getSolid().isInside(daughter_volume.parentToLocal(parent_point)));
+ {
+ volume = daughter_volume;
+ break;
+ }
+ }
+ return volume;
+ }
+
+ public boolean isInside(Hep3Vector globalPoint)
+ {
+ return getLogicalVolume().getSolid().isInside(globalToLocal(globalPoint));
+ }
+
+ public ILogicalVolume getLogicalVolume()
+ {
+ return _logical_volume;
+ }
+
+ public Hep3Vector getPosition()
+ {
+ return null;
+ }
+}
\ No newline at end of file
GeomConverter/sandbox/detector
diff -N ICalibration.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ICalibration.java 28 Feb 2007 19:48:21 -0000 1.1
@@ -0,0 +1,5 @@
+package org.lcsim.detector;
+
+public interface ICalibration {
+
+}
GeomConverter/sandbox/detector
diff -N IColorInfo.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ IColorInfo.java 28 Feb 2007 19:48:21 -0000 1.1
@@ -0,0 +1,9 @@
+package org.lcsim.detector;
+
+public interface IColorInfo
+{
+ public double getAlpha();
+ public double getBlue();
+ public double getGreen();
+ public double getRed();
+}
GeomConverter/sandbox/detector
diff -N IConditions.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ IConditions.java 28 Feb 2007 19:48:21 -0000 1.1
@@ -0,0 +1,5 @@
+package org.lcsim.detector;
+
+public interface IConditions {
+
+}
GeomConverter/sandbox/detector
diff -N ICoordinateTransformation3D.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ICoordinateTransformation3D.java 28 Feb 2007 19:48:21 -0000 1.1
@@ -0,0 +1,27 @@
+/*
+ * ICoordinateTransformation3D.java
+ */
+
+package org.lcsim.detector;
+
+import hep.physics.vec.Hep3Vector;
+
+/**
+ *
+ * @author tknelson
+ */
+public interface ICoordinateTransformation3D
+{
+ // Access to translation and rotation
+ public Hep3Vector getTranslation();
+ public Rotation3D getRotation();
+
+ // Transformations
+ public Hep3Vector transform(Hep3Vector coordinates);
+ public Hep3Vector translate(Hep3Vector coordinates);
+ public Hep3Vector rotate(Hep3Vector coordinates);
+
+ public void mult(ICoordinateTransformation3D trans);
+
+ public void invert();
+}
\ No newline at end of file
GeomConverter/sandbox/detector
diff -N IDetectorElement.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ IDetectorElement.java 28 Feb 2007 19:48:21 -0000 1.1
@@ -0,0 +1,45 @@
+/*
+ * IDetectorElement.java
+ */
+
+package org.lcsim.detector;
+
+//import org.lcsim.detector.identifier.IIdentifiable;
+
+/**
+ * A class to represent a node in the detector tree,
+ * based on Gaudi's IDetectorElement interface.
+ *
+ * @author Tim Nelson <[log in to unmask]>
+ * @author Jeremy McCormick <[log in to unmask]>
+ */
+public interface IDetectorElement
+extends IIdentifiable
+{
+ public IGeometryInfo getIGeometryInfo();
+
+ public IReadout getIReadout();
+
+ public void setIGeometryInfo(IGeometryInfo geom);
+
+ public void setIReadout(IReadout ro);
+
+ // build the GeometryInfo
+ public void createIGeometryInfo();
+
+ // build the Readout
+ public void createIReadout();
+
+ // parent DE
+ public IDetectorElement parentIDetectorElement();
+
+ // subparts
+ public IDetectorElementCollection childIDetectorElements();
+
+ // name of this DE
+ public String getName();
+
+ // same as name? need to look at what Gaudi does here;
+ // also could have better return type (dir or tree type class)
+ public String fullPath();
+}
\ No newline at end of file
GeomConverter/sandbox/detector
diff -N IDetectorElementCollection.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ IDetectorElementCollection.java 28 Feb 2007 19:48:21 -0000 1.1
@@ -0,0 +1,6 @@
+package org.lcsim.detector;
+
+import java.util.Collection;
+
+interface IDetectorElementCollection extends Collection<IDetectorElement>
+{}
\ No newline at end of file
GeomConverter/sandbox/detector
diff -N IDetectorService.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ IDetectorService.java 28 Feb 2007 19:48:21 -0000 1.1
@@ -0,0 +1,12 @@
+package org.lcsim.detector;
+
+public interface IDetectorService
+{
+ void load();
+ void unload();
+
+ // add a detector and register the top-level detector element
+ void add(String name, IDetectorElement detElem);
+
+ IDetectorElement get(String name);
+}
\ No newline at end of file
GeomConverter/sandbox/detector
diff -N IDetectorXMLConverter.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ IDetectorXMLConverter.java 28 Feb 2007 19:48:21 -0000 1.1
@@ -0,0 +1,6 @@
+package org.lcsim.detector;
+
+public interface IDetectorXMLConverter<T>
+{
+
+}
GeomConverter/sandbox/detector
diff -N IDigit.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ IDigit.java 28 Feb 2007 19:48:21 -0000 1.1
@@ -0,0 +1,20 @@
+package org.lcsim.detector;
+
+import org.lcsim.detector.identifier.IIdentifiable;
+
+// ideas about a generic interface for hits access through IReadOut
+//
+// IDigit<SimTrackerHit> digit = DETracker.readout().digits().get(0);
+// SimTrackerHit trackerHit = digit.object();
+// [...do SimTrackerHit stuff...]
+//
+public interface IDigit<T> extends IIdentifiable
+{
+ double value();
+ IPosition position();
+
+ // less clunky name for this
+ T getSpecificType();
+
+ IDetectorElement detectorElement();
+}
\ No newline at end of file
GeomConverter/sandbox/detector
diff -N IDigitCollection.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ IDigitCollection.java 28 Feb 2007 19:48:21 -0000 1.1
@@ -0,0 +1,6 @@
+package org.lcsim.detector;
+
+import java.util.List;
+
+public interface IDigitCollection<T> extends List<IDigit<T>>
+{}
\ No newline at end of file
GeomConverter/sandbox/detector
diff -N IFastControl.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ IFastControl.java 28 Feb 2007 19:48:21 -0000 1.1
@@ -0,0 +1,5 @@
+package org.lcsim.detector;
+
+public interface IFastControl {
+
+}
GeomConverter/sandbox/detector
diff -N IGeometryInfo.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ IGeometryInfo.java 28 Feb 2007 19:48:21 -0000 1.1
@@ -0,0 +1,192 @@
+package org.lcsim.detector;
+
+import hep.physics.vec.Hep3Vector;
+
+/**
+ *
+ * IGeometryInfo.java
+ *
+ * A port of Gaudi's IGeometryInfo, an abstract interface
+ * to a node in the geometry tree.
+ *
+ * @author Tim Nelson <[log in to unmask]>
+ * @author Jeremy McCormick <[log in to unmask]>
+ */
+public interface IGeometryInfo
+{
+ public ILogicalVolume getLogicalVolume();
+
+ public String getLogicalVolumeName();
+
+ public boolean hasLogicalVolume();
+
+ // global to local transformation
+ public CoordinateTransformation3D toLocal();
+
+ // local to global transformation
+ public CoordinateTransformation3D toGlobal();
+
+ // transform a point in local coordinates to global coordinates
+ public Hep3Vector toGlobal(Hep3Vector local_point);
+
+ // transform a point in global coordinates to local coordinates
+ public Hep3Vector toLocal(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();
+
+ // virtual IGeometryInfo* supportIGeometryInfo() = 0 ;
+
+ /** (reference to) container of children IGeometryInfo
+ * return reference to container of children IGeometryInfo
+ */
+ //virtual IGeometryInfo::IGIChildrens& childIGeometryInfos() = 0;
+
+ 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>
+}
\ No newline at end of file
GeomConverter/sandbox/detector
diff -N ILogicalVolume.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ILogicalVolume.java 28 Feb 2007 19:48:21 -0000 1.1
@@ -0,0 +1,11 @@
+package org.lcsim.detector;
+
+import java.util.List;
+
+public interface ILogicalVolume
+{
+ String getName();
+ ISolid getSolid();
+ IMaterial getMaterial();
+ List<IPhysicalVolume> getDaughterVolumes();
+}
GeomConverter/sandbox/detector
diff -N IMaterial.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ IMaterial.java 28 Feb 2007 19:48:21 -0000 1.1
@@ -0,0 +1,27 @@
+package org.lcsim.detector;
+
+public interface IMaterial
+{
+ public String name();
+ public String description();
+ public double density();
+ public double pressure();
+ public double Z();
+ public double A();
+ public double atomicWeight();
+ public double meltingPoint();
+ public double boilingPoint();
+ public double nuclearInteractionLength();
+ public double moliereRadius();
+ public double radiationLength();
+ public double ionizationPotential();
+ public boolean isAtomicElement();
+ enum State
+ {
+ Gas,
+ Liquid,
+ Solid,
+ Unknown
+ }
+ State state();
+}
\ No newline at end of file
GeomConverter/sandbox/detector
diff -N IMaterialComposite.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ IMaterialComposite.java 28 Feb 2007 19:48:21 -0000 1.1
@@ -0,0 +1,14 @@
+package org.lcsim.detector;
+
+public interface IMaterialComposite extends IMaterial
+{
+ public int numberOfSubMaterials();
+ public void setNumberOfSubMaterials(int i);
+ public boolean hasMaxNumberOfSubMaterials();
+ public IMaterial get(int i);
+ public void addByMassFraction(IMaterial submaterial, double massFrac);
+ public void addByDensityFraction(IMaterial submaterial, double massFrac);
+ public void addByNumberOfAtoms(IMaterial submaterial, int n);
+ public void massFraction(int i);
+ public void densityFraction(int i);
+}
GeomConverter/sandbox/detector
diff -N IParameters.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ IParameters.java 28 Feb 2007 19:48:21 -0000 1.1
@@ -0,0 +1,7 @@
+package org.lcsim.detector;
+
+public interface IParameters
+{
+ //IParameter getParameter(String name);
+ //void addParameter(IParameter param);
+}
\ No newline at end of file
GeomConverter/sandbox/detector
diff -N IPhysicalVolume.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ IPhysicalVolume.java 28 Feb 2007 19:48:21 -0000 1.1
@@ -0,0 +1,12 @@
+package org.lcsim.detector;
+
+import hep.physics.vec.Hep3Vector;
+
+public interface IPhysicalVolume
+{
+ //ILogicalVolume volume();
+ String getName();
+ ILogicalVolume getLogicalVolume();
+ ITransform3D getTransform();
+ Hep3Vector parentToLocal(Hep3Vector point);
+}
\ No newline at end of file
GeomConverter/sandbox/detector
diff -N IPhysicalVolumeCollection.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ IPhysicalVolumeCollection.java 28 Feb 2007 19:48:21 -0000 1.1
@@ -0,0 +1,7 @@
+package org.lcsim.detector;
+
+import java.util.Collection;
+
+public interface IPhysicalVolumeCollection
+extends Collection<IPhysicalVolume>
+{}
GeomConverter/sandbox/detector
diff -N IPhysicalVolumePath.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ IPhysicalVolumePath.java 28 Feb 2007 19:48:21 -0000 1.1
@@ -0,0 +1,6 @@
+package org.lcsim.detector;
+
+import java.util.List;
+
+public interface IPhysicalVolumePath extends List<IPhysicalVolume>
+{}
GeomConverter/sandbox/detector
diff -N IPosition.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ IPosition.java 28 Feb 2007 19:48:21 -0000 1.1
@@ -0,0 +1,28 @@
+package org.lcsim.detector;
+
+import hep.physics.vec.Hep3Vector;
+
+// point in 3D space
+public interface IPosition extends Hep3Vector
+{
+ // cylindrical r
+ public double r();
+
+ // x,y,z
+ public double x();
+ public double y();
+ public double z();
+ double[] xyz();
+
+ // angles
+ public double phi();
+ public double eta();
+
+ // spherical r
+ public double mag();
+
+ public double mag2();
+ public double distance(IPosition point);
+ public double equals(IPosition point, double tolerance);
+ // public static double distance(IPositionXYZ a, IPositionXYZ b);
+}
\ No newline at end of file
GeomConverter/sandbox/detector
diff -N IReadout.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ IReadout.java 28 Feb 2007 19:48:21 -0000 1.1
@@ -0,0 +1,12 @@
+package org.lcsim.detector;
+
+import java.util.List;
+
+public interface IReadout
+{
+ String name();
+ IDigitCollection getDigitCollection();
+ List<IDigitCollection> digitCollections();
+ String[] digitCollectionNames();
+ int numberOfDigitCollections();
+}
\ No newline at end of file
GeomConverter/sandbox/detector
diff -N IRotation3D.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ IRotation3D.java 28 Feb 2007 19:48:21 -0000 1.1
@@ -0,0 +1,97 @@
+package org.lcsim.detector;
+
+import hep.physics.vec.BasicHep3Matrix;
+import hep.physics.vec.Hep3Matrix;
+import hep.physics.vec.Hep3Vector;
+
+// interface to rotations in 3D space
+interface IRotation3D
+{
+ public static final int XCol=0, YCol=1, ZCol=2,XRow=0,YRow=1,ZRow=2;
+ public static final int XX=0, XY=1, XZ=2, YX=3, YY=4, YZ=5, ZX=6, ZY=7, ZZ=8;
+
+ // returns a copy of the rotation matrix
+ public BasicHep3Matrix getRotationMatrix();
+
+ public void setRotationMatrix(Hep3Matrix matrix);
+ public void setRotationMatrix(BasicHep3Matrix matrix);
+ public void setRotationMatrix(double [][] arr);
+
+ public void setTaitBryan(double alpha, double beta, double gamma);
+ public void setPassiveEuler(double phi, double theta, double psi);
+ public void setActiveEuler(double phi, double theta, double psi);
+
+ public void setComponents(double xx, double xy, double xz, double yx, double yy, double yz, double zx, double zy, double zz);
+ public double[] getComponents();
+
+ public void invert();
+ public IRotation3D inverse();
+ public double trace();
+
+ public double xx();
+ public double xy();
+ public double xz();
+
+ public double yx();
+ public double yy();
+ public double yz();
+
+ public double zx();
+ public double zy();
+ public double zz();
+
+ // these return new objects
+ // and don't effect the rotation
+ // in place; use set methods
+ public Hep3Vector getColumnX();
+ public Hep3Vector getColumnY();
+ public Hep3Vector getColumnZ();
+
+ public Hep3Vector getRowX();
+ public Hep3Vector getRowY();
+ public Hep3Vector getRowZ();
+
+ public void setRow(int row, Hep3Vector vec);
+ public void setRow(int row, double[] vec);
+ public void setRow(int row, double a, double b, double c);
+
+ public void setColumn(int col, Hep3Vector vec);
+ public void setColumn(int col, double[] 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 element
+ public void set(int row, int col, double v);
+
+ // get element
+ public double get(int row, int col);
+
+ // get ith element
+ public double get(int i);
+
+ // resets the rotation to the identity matrix
+ public void resetToIdentity();
+}
\ No newline at end of file
GeomConverter/sandbox/detector
diff -N ISlowControl.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ISlowControl.java 28 Feb 2007 19:48:21 -0000 1.1
@@ -0,0 +1,5 @@
+package org.lcsim.detector;
+
+public interface ISlowControl {
+
+}
GeomConverter/sandbox/detector
diff -N ISolid.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ISolid.java 28 Feb 2007 19:48:21 -0000 1.1
@@ -0,0 +1,19 @@
+package org.lcsim.detector;
+
+import hep.physics.vec.Hep3Vector;
+
+public interface ISolid
+{
+ String getName();
+ //void setName(String name);
+ //double[] parameters();
+
+ //Inside isInside(IPosition position);
+ boolean isInside(Hep3Vector position);
+ //enum Inside
+ //{
+ // Inside,
+ // Surface,
+ // Outside
+ //}
+}
\ No newline at end of file
GeomConverter/sandbox/detector
diff -N ITransform3D.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ITransform3D.java 28 Feb 2007 19:48:21 -0000 1.1
@@ -0,0 +1,7 @@
+package org.lcsim.detector;
+
+public interface ITransform3D
+{
+ IRotation3D rotation();
+ ITranslation3D translation();
+}
GeomConverter/sandbox/detector
diff -N ITranslation3D.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ITranslation3D.java 28 Feb 2007 19:48:22 -0000 1.1
@@ -0,0 +1,5 @@
+package org.lcsim.detector;
+
+public interface ITranslation3D {
+
+}
GeomConverter/sandbox/detector
diff -N IVisualizationInfo.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ IVisualizationInfo.java 28 Feb 2007 19:48:22 -0000 1.1
@@ -0,0 +1,30 @@
+package org.lcsim.detector;
+
+public interface IVisualizationInfo
+{
+ IColorInfo getColor();
+ void setColor();
+
+ void isVisible();
+ void setIsVisible(boolean visible);
+
+ boolean getDaughtersVisible();
+ void setDaughtersVisible(boolean visible);
+
+ enum Representation
+ {
+ Wireframe,
+ Solid,
+ Outline
+ }
+ void setRepresentation(Representation rep);
+
+ enum LineStyle
+ {
+ Unbroken,
+ Dash,
+ Dot
+ }
+ void setLineStyle(LineStyle ls);
+ LineStyle getLineStyle();
+}
\ No newline at end of file
GeomConverter/sandbox/detector
diff -N LVolume.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ LVolume.java 28 Feb 2007 19:48:22 -0000 1.1
@@ -0,0 +1,102 @@
+/*
+ * LVolume.java
+ *
+ * Created on October 9, 2006, 3:15 PM
+ *
+ * To change this template, choose Tools | Template Manager
+ * and open the template in the editor.
+ */
+
+package org.lcsim.contrib.subdetector.tracker.silicon;
+
+import org.lcsim.material.Material;
+import org.lcsim.material.MaterialManager;
+import org.lcsim.material.MaterialNotFoundException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.jdom.Element;
+import org.jdom.JDOMException;
+
+/**
+ *
+ * @author tknelson
+ */
+public class LVolume
+{
+ // Fields
+ protected String _name;
+ protected Material _material;
+ protected ISolid _solid;
+ protected List<PVolume> _pvolumes = new ArrayList<PVolume>();
+
+ public LVolume(String name, ISolid solid, Material material)
+ {
+ _name = name;
+ _solid = solid;
+ _material = material;
+ }
+
+ public LVolume(Element lvolume) throws JDOMException
+ {
+ buildFromXML(lvolume);
+ }
+
+ // Accessors
+ //==========
+ public String getName()
+ {
+ return _name;
+ }
+
+ public Material getMaterial()
+ {
+ return _material;
+ }
+
+ public ISolid getSolid()
+ {
+ return _solid;
+ }
+
+ public List<PVolume> getPVolumes()
+ {
+ return _pvolumes;
+ }
+
+ public void addPVolume(PVolume pvolume)
+ {
+ _pvolumes.add(pvolume);
+ }
+
+ public void buildFromXML(Element lvolume)
+ {
+ // Create name
+ _name = lvolume.getAttributeValue("name");
+
+ // Create material
+ try
+ {
+ _material = MaterialManager.findMaterial(lvolume.getAttributeValue("material"));
+ }
+ catch (MaterialNotFoundException mnfe)
+ {
+ throw new RuntimeException(mnfe);
+ }
+
+ // Create solid
+ Element solid = lvolume.getChild("solid");
+ String shape = solid.getAttributeValue("shape");
+ if (shape=="box") _solid = new Box(solid);
+ if (shape=="tubesegment") _solid = new TubeSegment(solid);
+
+ // Add physical volumes
+ for (Iterator i = lvolume.getChildren("pvolume").iterator(); i.hasNext();)
+ {
+ addPVolume( new PVolume((Element)i.next()) ) ;
+ }
+
+ }
+
+}
\ No newline at end of file
GeomConverter/sandbox/detector
diff -N PVolume.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ PVolume.java 28 Feb 2007 19:48:22 -0000 1.1
@@ -0,0 +1,107 @@
+/*
+ * PVolume.java
+ *
+ * Created on November 2, 2006, 5:17 PM
+ *
+ * To change this template, choose Tools | Template Manager
+ * and open the template in the editor.
+ */
+
+package org.lcsim.contrib.subdetector.tracker.silicon;
+
+import hep.physics.vec.Hep3Vector;
+import hep.physics.vec.BasicHep3Vector;
+import org.jdom.Element;
+import org.jdom.DataConversionException;
+
+/**
+ *
+ * @author tknelson
+ */
+public class PVolume
+{
+
+ private String _name;
+ private String _lvolume_name;
+ private CoordinateTransformation3D _parent_to_local = new CoordinateTransformation3D();
+
+ /** Creates a new instance of PVolume */
+ public PVolume(String name, String lvolume_name, CoordinateTransformation3D parent_to_local)
+ {
+ _name = name;
+ _lvolume_name = lvolume_name;
+ _parent_to_local = parent_to_local;
+ }
+
+ public PVolume(Element pvolume)
+ {
+ buildFromXML(pvolume);
+ }
+
+ // Accessors
+ //==========
+ public String getName()
+ {
+ return _name;
+ }
+
+ public String getLVolumeName()
+ {
+ return _lvolume_name;
+ }
+
+ public LVolume getLVolume(String name)
+ {
+ return GeometryCatalog.getInstance().getLVolume(_lvolume_name);
+ }
+
+ public CoordinateTransformation3D getParentToLocal()
+ {
+ return _parent_to_local;
+ }
+
+ public Hep3Vector parentToLocal(Hep3Vector parent_point)
+ {
+ return _parent_to_local.transform(parent_point);
+ }
+
+ public void buildFromXML(Element pvolume)
+ {
+ // Create name
+ _name = pvolume.getAttributeValue("name");
+
+ // Create lvolume name
+ _lvolume_name = pvolume.getAttributeValue("lvolume");
+
+ // Create CoordinateTransformation3D
+ Element trans = pvolume.getChild("posXYZ");
+ Hep3Vector translation = null;
+ try
+ {
+ translation = new BasicHep3Vector(trans.getAttribute("x").getDoubleValue(),
+ trans.getAttribute("y").getDoubleValue(),
+ trans.getAttribute("z").getDoubleValue());
+ }
+ catch (DataConversionException dce)
+ {
+ System.out.println("Cannot convert translation to double!");
+ }
+
+ Element rot = pvolume.getChild("rotXYZ");
+ Hep3Rotation rotation = null;
+ try
+ {
+ rotation = Hep3Rotation.passiveTaitBryan(rot.getAttribute("rot_x").getDoubleValue(),
+ rot.getAttribute("rot_y").getDoubleValue(),
+ rot.getAttribute("rot_z").getDoubleValue());
+ }
+ catch (DataConversionException dce)
+ {
+ System.out.println("Cannot convert rotation to double!");
+ }
+
+ _parent_to_local = new CoordinateTransformation3D(translation,rotation);
+
+ }
+
+}
GeomConverter/sandbox/detector
diff -N Position.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Position.java 28 Feb 2007 19:48:22 -0000 1.1
@@ -0,0 +1,66 @@
+package org.lcsim.detector;
+
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Vector;
+import static java.lang.Math.abs;
+import static java.lang.Math.acos;
+import static java.lang.Math.sqrt;
+import static java.lang.Math.PI;
+
+public class Position extends BasicHep3Vector implements IPosition
+{
+ public Position(Hep3Vector point)
+ {
+ this.setV(point.x(),point.y(),point.z());
+ }
+
+ public Position(double point[])
+ {
+ super(point);
+ }
+
+ public Position(double x, double y, double z)
+ {
+ super(x,y,z);
+ }
+
+ public double distance(IPosition point)
+ {
+ // from SpacePoint
+ double dx = point.x() - this.x();
+ double dy = point.y() - this.y();
+ double dz = point.z() - this.z();
+ return Math.sqrt( dx*dx + dy*dy + dz*dz );
+ }
+
+ public boolean equals(IPosition point, double tolerance)
+ {
+ double d = this.distance(point);
+ return abs(d) < tolerance ? true : false;
+ }
+
+ // x >= 0 : eta = acos(y/s)
+ // x < 0 : eta = PI - acos(y/s)
+ public double eta()
+ {
+ double s = cylindricalRadius();
+ double a = acos(y()/s);
+ return 0 <= x() ? a : PI - a;
+ }
+
+ // phi = acos(z/magnitude)
+ public double phi()
+ {
+ return acos(z()/magnitude());
+ }
+
+ public double cylindricalRadius()
+ {
+ return sqrt(x()*x()+y()*y());
+ }
+
+ public double[] xyz()
+ {
+ return this.v();
+ }
+}
\ No newline at end of file
GeomConverter/sandbox/detector
diff -N Rotation3D.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Rotation3D.java 28 Feb 2007 19:48:22 -0000 1.1
@@ -0,0 +1,435 @@
+/*
+ * Hep3Rotation.java
+ */
+
+package org.lcsim.detector;
+
+import hep.physics.vec.BasicHep3Matrix;
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Vector;
+import hep.physics.vec.Hep3Matrix;
+import hep.physics.vec.VecOp;
+
+import java.io.PrintStream;
+
+/**
+ *
+ * @author Tim Nelson <[log in to unmask]>
+ * @author Jeremy McCormick <[log in to unmask]>
+ */
+public class Rotation3D implements IRotation3D
+{
+ public static final int XCol=0, YCol=1, ZCol=2,XRow=0,YRow=1,ZRow=2;
+
+ private BasicHep3Matrix matrix = BasicHep3Matrix.identity();
+
+ public Rotation3D()
+ {}
+
+ public void setRotationMatrix(Hep3Matrix matrix)
+ {
+ this.matrix = (BasicHep3Matrix)matrix;
+ }
+
+ /**
+ * Transform rotation using Tait-Bryan convention.
+ * @param alpha
+ * @param beta
+ * @param gamma
+ */
+ public void setTaitBryan(double alpha, double beta, double gamma)
+ {
+ matrix = passiveTaitBryan(alpha,beta,gamma);
+ }
+
+ public void setPassiveEuler(double phi, double theta, double psi)
+ {
+ matrix.setPassiveEuler(phi,theta,psi);
+ }
+
+ public void setActiveEuler(double phi, double theta, double psi)
+ {
+ matrix.setActiveEuler(phi,theta,psi);
+ }
+
+ // Static Methods
+ //===============
+ public static BasicHep3Matrix passiveEuler(double phi, double theta, double psi)
+ {
+ BasicHep3Matrix matrix = new BasicHep3Matrix();
+ matrix.setPassiveEuler(phi,theta,psi);
+ return matrix;
+ }
+
+ public static BasicHep3Matrix passiveTaitBryan(double alpha, double beta, double gamma)
+ {
+ return (BasicHep3Matrix)VecOp.mult(passiveZRotation(gamma),VecOp.mult(passiveYRotation(beta),passiveXRotation(alpha)));
+ }
+
+ public static BasicHep3Matrix passiveXRotation(double angle)
+ {
+ double sin = Math.sin(angle);
+ double cos = Math.cos(angle);
+ BasicHep3Matrix rotation = BasicHep3Matrix.identity();
+ rotation.setElement(1,1,cos);
+ rotation.setElement(1,2,sin);
+ rotation.setElement(2,1,-sin);
+ rotation.setElement(2,2,cos);
+ return rotation;
+ }
+
+ public static BasicHep3Matrix passiveYRotation(double angle)
+ {
+ double sin = Math.sin(angle);
+ double cos = Math.cos(angle);
+ BasicHep3Matrix rotation = BasicHep3Matrix.identity();
+ rotation.setElement(0,0,cos);
+ rotation.setElement(0,2,sin);
+ rotation.setElement(2,0,-sin);
+ rotation.setElement(2,2,cos);
+ return rotation;
+ }
+
+ public static BasicHep3Matrix passiveZRotation(double angle)
+ {
+ double sin = Math.sin(angle);
+ double cos = Math.cos(angle);
+ BasicHep3Matrix rotation = BasicHep3Matrix.identity();
+ rotation.setElement(0,0,cos);
+ rotation.setElement(0,1,sin);
+ rotation.setElement(1,0,-sin);
+ rotation.setElement(1,1,cos);
+ return rotation;
+ }
+
+ public void invert()
+ {
+ matrix.transpose();
+ }
+
+ public IRotation3D inverse()
+ {
+ BasicHep3Matrix inversematrix = new BasicHep3Matrix(matrix);
+ inversematrix.invert();
+ return new Rotation3D(inversematrix);
+ }
+
+ public double xx()
+ {
+ return matrix.e(0,0);
+ }
+
+ public double xy()
+ {
+ return matrix.e(0,1);
+ }
+
+ public double xz()
+ {
+ return matrix.e(0,2);
+ }
+
+ public double yx()
+ {
+ return matrix.e(1,0);
+ }
+
+ public double yy()
+ {
+ return matrix.e(1,1);
+ }
+
+ public double yz()
+ {
+ return matrix.e(1,2);
+ }
+
+ public double zx()
+ {
+ return matrix.e(2,0);
+ }
+
+ public double zy()
+ {
+ return matrix.e(2,1);
+ }
+
+ public double zz()
+ {
+ return matrix.e(2,2);
+ }
+
+ 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("[");
+ ps.println();
+
+ BasicHep3Matrix m = getRotationMatrix();
+
+ for (int i=0; i<3; i++)
+ {
+ ps.printf("%.4f %.4f %.4f", m.e(i,0), m.e(i,1), m.e(i,2));
+ ps.println();
+ }
+
+ ps.print("]");
+ ps.println('\n');
+ }
+
+ public void setColumn(int col, double[] arr)
+ {
+ assert(col >=0 && col <=3);
+ assert(arr.length>2);
+ for (int i=0; i<3; i++)
+ {
+ set(i,col,arr[i]);
+ }
+ }
+
+ public void setColumn(int col, Hep3Vector vec)
+ {
+ setColumn(col,vec.v());
+ }
+
+ public void setRow(int row, double[] arr)
+ {
+ assert(row >=0 && row <=3);
+ assert(row >=0 && row <=3);
+ for (int i=0; i<3; i++)
+ {
+ set(row, i, arr[i]);
+ }
+ }
+
+ public void setRow(int row, Hep3Vector vec)
+ {
+ setRow(row,vec.v());
+ }
+
+ public void setColumnX(double[] arr) {
+ setColumn(0,arr);
+ }
+
+ public void setColumnX(Hep3Vector vec) {
+ setColumnX(vec.v());
+ }
+
+ public void setColumnY(double[] arr)
+ {
+ setColumn(1,arr);
+ }
+
+ public void setColumnY(Hep3Vector vec) {
+ setColumnY(vec.v());
+ }
+
+ public void setColumnZ(double[] arr)
+ {
+ setColumn(2,arr);
+ }
+
+ public void setColumnZ(Hep3Vector vec) {
+ setColumnZ(vec.v());
+ }
+
+ public void setRowX(double[] arr) {
+ setRow(0,arr);
+ }
+
+ public void setRowX(Hep3Vector vec)
+ {
+ setRowX(vec.v());
+ }
+
+ public void setRowY(double[] arr)
+ {
+ setRow(1,arr);
+ }
+
+ public void setRowY(Hep3Vector vec) {
+ setRowY(vec.v());
+ }
+
+ public void setRowZ(double[] arr) {
+ setRow(2,arr);
+ }
+
+ public void setRowZ(Hep3Vector vec) {
+ setRowZ(vec.v());
+ }
+
+ public Rotation3D(BasicHep3Matrix matrix)
+ {
+ setRotationMatrix(matrix);
+ }
+
+ public Rotation3D(Hep3Matrix matrix)
+ {
+ setRotationMatrix((BasicHep3Matrix)matrix);
+ }
+
+ public void set(int i, int j, double v)
+ {
+ matrix.setElement(i,j,v);
+ }
+
+ public void setColumn(int col, double x, double y, double z)
+ {
+ 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});
+ }
+
+ public void setComponents(double xx, double xy, double xz, double yx, double yy, double yz, double zx, double zy, double zz)
+ {
+ setRowX(xx,xy,xz);
+ setRowY(yx,yy,yz);
+ setRowZ(zx,zy,zz);
+ }
+
+ public double[] getComponents()
+ {
+ double[] arr = new double[9];
+ int c=0;
+ for (int i=0; i<3; i++)
+ {
+ for (int j=0; j<3; j++)
+ {
+ arr[c]=matrix.e(i,j);
+ c++;
+ }
+ }
+ return arr;
+ }
+
+ public void setRowX(double xx, double xy, double xz)
+ {
+ set(0,0,xx);
+ set(0,1,xy);
+ set(0,2,xz);
+ }
+
+ public void setRowY(double yx, double yy, double yz)
+ {
+ set(1,0,yx);
+ set(1,1,yy);
+ set(1,2,yz);
+ }
+
+ public void setRowZ(double zx, double zy, double zz)
+ {
+ set(2,0,zx);
+ set(2,1,zy);
+ set(2,2,zz);
+ }
+
+ // set from row,col array of at least size 3x3
+ public void setRotationMatrix(double [][] a)
+ {
+ matrix = new BasicHep3Matrix();
+ for (int i=0; i<3; i++)
+ {
+ for (int j=0; j<3; j++)
+ {
+ set(i, j, a[i][j]);
+ }
+ }
+ }
+
+ public void resetToIdentity()
+ {
+ matrix = BasicHep3Matrix.identity();
+ }
+
+ public double trace()
+ {
+ return matrix.trace();
+ }
+
+ public BasicHep3Matrix getRotationMatrix()
+ {
+ return this.matrix;
+ }
+
+ public void setRotationMatrix(BasicHep3Matrix matrix)
+ {
+ this.matrix = matrix;
+ }
+
+ public double get(int r, int c)
+ {
+ return matrix.e(r,c);
+ }
+
+ public double get(int i)
+ {
+ switch (i)
+ {
+ case XX:
+ return xx();
+ case XY:
+ return xy();
+ case XZ:
+ return xz();
+ case YX:
+ return yx();
+ case YY:
+ return yy();
+ case YZ:
+ return yz();
+ case ZX:
+ return zx();
+ case ZY:
+ return zy();
+ case ZZ:
+ return zz();
+ default:
+ throw new IllegalArgumentException("Invalid matrix element : " + i );
+ }
+ }
+}
\ No newline at end of file
GeomConverter/sandbox/detector
diff -N RotationMatrix3D.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ RotationMatrix3D.java 28 Feb 2007 19:48:22 -0000 1.1
@@ -0,0 +1,230 @@
+/*
+ * Hep3Rotation.java
+ */
+
+//package org.lcsim.contrib.subdetector.tracker.silicon;
+
+package org.lcsim.detector.kernel;
+
+import hep.physics.vec.BasicHep3Matrix;
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Vector;
+import hep.physics.vec.BasicHep3Matrix;
+import hep.physics.vec.Hep3Matrix;
+import hep.physics.vec.VecOp;
+
+import java.io.PrintStream;
+
+/**
+ *
+ * @author tknelson
+ */
+public class RotationMatrix3D
+{
+ private BasicHep3Matrix matrix = BasicHep3Matrix.identity();
+
+ // Fields
+ //=======
+ /**
+ * Create a new Hep3Rotation containing the identify matrix.
+ */
+ public RotationMatrix3D()
+ {}
+
+ /**
+ * Create a new Hep3Rotation from a 3x3 matrix.
+ * @param matrix
+ */
+ public RotationMatrix3D(BasicHep3Matrix matrix)
+ {
+ setMatrix(matrix);
+ }
+
+ public RotationMatrix3D(Hep3Matrix matrix)
+ {
+ setMatrix((BasicHep3Matrix)matrix);
+ }
+
+ public BasicHep3Matrix getMatrix()
+ {
+ return this.matrix;
+ }
+
+ public void setMatrix(BasicHep3Matrix matrix)
+ {
+ this.matrix = matrix;
+ }
+
+ /**
+ * Transform rotation using Tait-Bryan convention.
+ * @param alpha
+ * @param beta
+ * @param gamma
+ */
+ public void setTaitBryan(double alpha, double beta, double gamma)
+ {
+ matrix = passiveTaitBryan(alpha,beta,gamma);
+ }
+
+ public void setPassiveEuler(double phi, double theta, double psi)
+ {
+ matrix.setPassiveEuler(phi,theta,psi);
+ }
+
+ public static BasicHep3Matrix passiveEuler(double phi, double theta, double psi)
+ {
+ BasicHep3Matrix matrix = new BasicHep3Matrix();
+ matrix.setPassiveEuler(phi,theta,psi);
+ return matrix;
+ }
+
+ // Static Methods
+ //===============
+ public static BasicHep3Matrix passiveTaitBryan(double alpha, double beta, double gamma)
+ {
+ return (BasicHep3Matrix)VecOp.mult(passiveZRotation(gamma),VecOp.mult(passiveYRotation(beta),passiveXRotation(alpha)));
+ }
+
+ public static BasicHep3Matrix passiveXRotation(double angle)
+ {
+ double sin = Math.sin(angle);
+ double cos = Math.cos(angle);
+ //Hep3Rotation rotation = new Hep3Rotation();
+ BasicHep3Matrix rotation = new BasicHep3Matrix();
+ rotation.setElement(0,0,cos);
+ rotation.setElement(0,1,sin);
+ rotation.setElement(1,0,-sin);
+ rotation.setElement(1,1,cos);
+ return rotation;
+ }
+
+ public static BasicHep3Matrix passiveYRotation(double angle)
+ {
+ double sin = Math.sin(angle);
+ double cos = Math.cos(angle);
+ //Hep3Rotation rotation = new Hep3Rotation();
+ BasicHep3Matrix rotation = new BasicHep3Matrix();
+
+ // FIXME: Off by 1 error! Indexed from 0.
+ //rotation.setElement(1,3,-sin);
+ //rotation.setElement(3,1,sin);
+ //rotation.setElement(3,3,cos);
+
+ // FIXME: Is this correct?
+ rotation.setElement(1,1,cos);
+ rotation.setElement(1,2,sin);
+ rotation.setElement(2,1,-sin);
+ rotation.setElement(2,2,cos);
+ return rotation;
+ }
+
+ public static BasicHep3Matrix passiveZRotation(double angle)
+ {
+ double sin = Math.sin(angle);
+ double cos = Math.cos(angle);
+ //Hep3Rotation rotation = new Hep3Rotation();
+ BasicHep3Matrix rotation = new BasicHep3Matrix();
+ rotation.setElement(0,0,cos);
+ rotation.setElement(0,1,sin);
+ rotation.setElement(1,0,-sin);
+ rotation.setElement(1,1,cos);
+ return rotation;
+ }
+
+ public void invert()
+ {
+ matrix.invert();
+ }
+
+ public double xx()
+ {
+ return matrix.e(0,0);
+ }
+
+ public double xy()
+ {
+ return matrix.e(0,1);
+ }
+
+ public double xz()
+ {
+ return matrix.e(0,2);
+ }
+
+ public double yx()
+ {
+ return matrix.e(1,0);
+ }
+
+ public double yy()
+ {
+ return matrix.e(1,1);
+ }
+
+ public double yz()
+ {
+ return matrix.e(1,2);
+ }
+
+ public double zx()
+ {
+ return matrix.e(2,0);
+ }
+
+ public double zy()
+ {
+ return matrix.e(2,1);
+ }
+
+ public double zz()
+ {
+ return matrix.e(2,2);
+ }
+
+ Hep3Vector colX()
+ {
+ return new BasicHep3Vector(matrix.e(0,0),matrix.e(1,0),matrix.e(2,0));
+ }
+
+ Hep3Vector colY()
+ {
+ return new BasicHep3Vector(matrix.e(0,1),matrix.e(1,1),matrix.e(2,1));
+ }
+
+ Hep3Vector colZ()
+ {
+ return new BasicHep3Vector(matrix.e(0,2),matrix.e(1,2),matrix.e(2,2));
+ }
+
+ Hep3Vector rowX()
+ {
+ return new BasicHep3Vector(matrix.e(0,0),matrix.e(0,1),matrix.e(0,2));
+ }
+
+ Hep3Vector rowY()
+ {
+ return new BasicHep3Vector(matrix.e(1,0),matrix.e(1,1),matrix.e(1,2));
+ }
+
+ Hep3Vector rowZ()
+ {
+ return new BasicHep3Vector(matrix.e(2,0),matrix.e(2,1),matrix.e(2,2));
+ }
+
+ public void printOut(PrintStream ps)
+ {
+ ps.print("[");
+ ps.println();
+
+ BasicHep3Matrix m = getMatrix();
+
+ for (int i=0; i<3; i++)
+ {
+ ps.printf("%.4f %.4f %.4f", m.e(i,0), m.e(i,1), m.e(i,2));
+ ps.println();
+ }
+
+ ps.print("]");
+ ps.println('\n');
+ }
+}
\ No newline at end of file
GeomConverter/sandbox/detector
diff -N ThreeVector.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ThreeVector.java 28 Feb 2007 19:48:22 -0000 1.1
@@ -0,0 +1,6 @@
+package org.lcsim.detector;
+
+import hep.physics.vec.BasicHep3Vector;
+
+public class ThreeVector extends BasicHep3Vector
+{}
CVSspam 0.2.8