13 added files
lcsim/src/org/lcsim/contrib/subdetector/tracker/silicon
diff -N GeometryInfo.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ GeometryInfo.java 10 Nov 2006 21:06:22 -0000 1.1
@@ -0,0 +1,103 @@
+/*
+ * 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.contrib.subdetector.tracker.silicon;
+
+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;
+ LVolume _logical_volume;
+ List<PVolume> _daughter_volumes;
+
+ /** Creates a new instance of GeometryInfo */
+ public GeometryInfo(CoordinateTransformation3D global_to_local, LVolume 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<PVolume> daughter_volumes = getLogicalVolume().getDaughters();
+
+ String volume_name = "";
+ for (PVolume 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 PVolume childVolume(Hep3Vector global_point)
+ {
+ Hep3Vector parent_point = globalToLocal(global_point);
+ List<PVolume> daughter_volumes = getLogicalVolume().getDaughters();
+
+ PVolume volume = null;
+ for (PVolume 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 global_point)
+ {
+ return getLogicalVolume().getSolid().isInside(globalToLocal(global_point));
+ }
+
+ public LVolume getLogicalVolume()
+ {
+ return _logical_volume;
+ }
+
+
+}
\ No newline at end of file
lcsim/src/org/lcsim/contrib/subdetector/tracker/silicon
diff -N ISolid.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ISolid.java 10 Nov 2006 21:06:22 -0000 1.1
@@ -0,0 +1,35 @@
+/*
+ * ISolid.java
+ *
+ * Created on October 9, 2006, 3:44 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 org.jdom.Element;
+import org.jdom.DataConversionException;
+
+/**
+ *
+ * @author tknelson
+ */
+public interface ISolid
+{
+
+ // Return dimensions
+ public double[] getDimensions();
+
+ // Calculate volume
+ public double getVolume();
+
+ // Is a particular point inside?
+ public boolean isInside(Hep3Vector point);
+
+ // Must be buildable from xml
+ public void buildFromXML(Element solid);
+
+}
lcsim/src/org/lcsim/contrib/subdetector/tracker/silicon
diff -N SiTrackerBarrelLayerVolume.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ SiTrackerBarrelLayerVolume.java 10 Nov 2006 21:06:22 -0000 1.1
@@ -0,0 +1,64 @@
+/*
+ * SiTrackerBarrelLayerVolume.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 SiTrackerBarrelLayerVolume extends LVolume
+{
+
+ public SiTrackerBarrelLayerVolume(Element layer) throws JDOMException
+ {
+ super(layer);
+ buildFromXML(layer);
+ }
+
+ 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();)
+ {
+ _pvolumes.add( new PVolume((Element)i.next()) ) ;
+ }
+
+ }
+
+}
\ No newline at end of file
lcsim/src/org/lcsim/contrib/subdetector/tracker/silicon
diff -N GeometryCatalog.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ GeometryCatalog.java 10 Nov 2006 21:06:22 -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();
+ }
+
+
+}
lcsim/src/org/lcsim/contrib/subdetector/tracker/silicon
diff -N IGeometryInfo.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ IGeometryInfo.java 10 Nov 2006 21:06:22 -0000 1.1
@@ -0,0 +1,50 @@
+/*
+ * IGeometryInfo.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.subdetector.tracker.silicon;
+
+import hep.physics.vec.Hep3Vector;
+
+/**
+ *
+ * @author tknelson
+ */
+public interface IGeometryInfo
+{
+
+ // global to local transformation
+ public CoordinateTransformation3D getGlobalToLocal();
+
+ // local to global transformation
+ public CoordinateTransformation3D getLocalToGlobal();
+
+ // 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 PVolume childVolume(Hep3Vector global_point);
+
+ // 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>
+
+ // determine whether a point is inside the logical volume
+ public boolean isInside(Hep3Vector global_point);
+
+ // get the associated logical volume
+ public LVolume getLogicalVolume();
+
+}
lcsim/src/org/lcsim/contrib/subdetector/tracker/silicon
diff -N IDetectorElement.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ IDetectorElement.java 10 Nov 2006 21:06:22 -0000 1.1
@@ -0,0 +1,29 @@
+/*
+ * 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.subdetector.tracker.silicon;
+
+import java.util.List;
+
+/**
+ *
+ * @author tknelson
+ */
+public interface IDetectorElement
+{
+
+ // Get geometry Information
+ public IGeometryInfo getGeometry();
+
+ // Get information about hierarchy
+// public IDetectorElement getParent();
+//
+// public List<IDetectorElement> getChildren();
+
+}
lcsim/src/org/lcsim/contrib/subdetector/tracker/silicon
diff -N PVolume.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ PVolume.java 10 Nov 2006 21:06: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);
+
+ }
+
+}
lcsim/src/org/lcsim/contrib/subdetector/tracker/silicon
diff -N Trapezoid.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Trapezoid.java 10 Nov 2006 21:06:22 -0000 1.1
@@ -0,0 +1,80 @@
+/*
+ * Trapezoid.java
+ *
+ * Created on October 6, 2006, 4:41 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 org.jdom.Element;
+import org.jdom.DataConversionException;
+
+/**
+ *
+ * @author tknelson
+ */
+public class Trapezoid implements ISolid
+{
+
+ // Fields
+ //=======
+ private double _dimensions[] = new double[4];
+
+ /** Creates a new instance of Box */
+ public Trapezoid(double[] dimensions)
+ {
+ _dimensions = dimensions;
+ }
+
+ public Trapezoid(double x1, double x2, double y, double z)
+ {
+ _dimensions[0] = x1;
+ _dimensions[1] = x2;
+ _dimensions[2] = y;
+ _dimensions[3] = z;
+ }
+
+ // Public methods
+ //===============
+ public double[] getDimensions()
+ {
+ return _dimensions;
+ }
+
+ public double getVolume()
+ {
+ return (_dimensions[0]+_dimensions[1])/2.0 * _dimensions[2] * _dimensions[3];
+ }
+
+ public boolean isInside(Hep3Vector point)
+ {
+ double inverse_slope = (_dimensions[1]-_dimensions[0])/(2.0*_dimensions[2]);
+ double x_intercept = (_dimensions[0]+_dimensions[1]/4.0);
+
+ double x_limit = inverse_slope*point.y()+x_intercept;
+
+ return ( Math.abs(point.x()) < x_limit &&
+ Math.abs(point.y()) < _dimensions[2]/2.0 &&
+ Math.abs(point.z()) < _dimensions[3]/2.0 );
+ }
+
+ public void buildFromXML(Element trapezoid)
+ {
+ try
+ {
+ _dimensions[0] = trapezoid.getAttribute("size_x1").getDoubleValue();
+ _dimensions[1] = trapezoid.getAttribute("size_x2").getDoubleValue();
+ _dimensions[2] = trapezoid.getAttribute("size_y").getDoubleValue();
+ _dimensions[3] = trapezoid.getAttribute("size_z").getDoubleValue();
+ }
+ catch (DataConversionException dce)
+ {
+ System.out.println("Cannot convert Trapezoid dimensions to double!");
+ }
+ }
+
+}
lcsim/src/org/lcsim/contrib/subdetector/tracker/silicon
diff -N CoordinateTransformation3D.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ CoordinateTransformation3D.java 10 Nov 2006 21:06:22 -0000 1.1
@@ -0,0 +1,95 @@
+/*
+ * CoordinateTransformation3D.java
+ *
+ * Created on September 19, 2006, 11:27 AM
+ *
+ * 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 hep.physics.vec.VecOp;
+
+/**
+ *
+ * @author tknelson
+ */
+public class CoordinateTransformation3D
+{
+
+ // Fields
+ Hep3Vector _translation = new BasicHep3Vector(0.0,0.0,0.0);
+ Hep3Rotation _rotation = new Hep3Rotation();
+
+ /**
+ * Creates a new instance of CoordinateTransformation3D
+ */
+ public CoordinateTransformation3D()
+ {
+ }
+
+ public CoordinateTransformation3D(Hep3Vector translation, Hep3Rotation rotation)
+ {
+ _translation = translation;
+ _rotation = rotation;
+ }
+
+ // Access to translation and rotation
+ public Hep3Vector getTranslation()
+ {
+ return _translation;
+ }
+
+ public Hep3Rotation 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);
+ }
+
+ // Invert the transformation
+ public void invert()
+ {
+ _translation = VecOp.mult(-1.0,VecOp.mult(_rotation,_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,_translation)),
+// _rotation.inverse()); // FIXME: Need to assure that transpose is used
+// return transform;
+// }
+
+ // Static functions
+ public static CoordinateTransformation3D mult(CoordinateTransformation3D transformation1, CoordinateTransformation3D transformation2)
+ {
+ Hep3Rotation rotation = (Hep3Rotation)VecOp.mult(transformation1.getRotation(),transformation2.getRotation());
+ Hep3Vector translation = VecOp.add(VecOp.mult(transformation1.getRotation(),transformation2.getTranslation()),
+ transformation1.getTranslation());
+ return new CoordinateTransformation3D(translation,rotation);
+ }
+
+}
lcsim/src/org/lcsim/contrib/subdetector/tracker/silicon
diff -N LVolume.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ LVolume.java 10 Nov 2006 21:06:23 -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
lcsim/src/org/lcsim/contrib/subdetector/tracker/silicon
diff -N Box.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Box.java 10 Nov 2006 21:06:23 -0000 1.1
@@ -0,0 +1,66 @@
+/*
+ * Box.java
+ *
+ * Created on October 6, 2006, 4:41 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 org.jdom.Element;
+import org.jdom.DataConversionException;
+
+/**
+ *
+ * @author tknelson
+ */
+public class Box implements ISolid
+{
+
+ // Fields
+ //=======
+ private double _dimensions[] = new double[3];
+
+ /** Creates a new instance of Box */
+ public Box(Element box)
+ {
+ buildFromXML(box);
+ }
+
+ // Public methods
+ //===============
+ public double[] getDimensions()
+ {
+ return _dimensions;
+ }
+
+ public double getVolume()
+ {
+ return _dimensions[0]*_dimensions[1]*_dimensions[2];
+ }
+
+ public boolean isInside(Hep3Vector point)
+ {
+ return ( Math.abs(point.x()) < _dimensions[0]/2.0 &&
+ Math.abs(point.y()) < _dimensions[1]/2.0 &&
+ Math.abs(point.z()) < _dimensions[2]/2.0 );
+ }
+
+ public void buildFromXML(Element box)
+ {
+ try
+ {
+ _dimensions[0] = box.getAttribute("x_size").getDoubleValue();
+ _dimensions[1] = box.getAttribute("y_size").getDoubleValue();
+ _dimensions[2] = box.getAttribute("z_size").getDoubleValue();
+ }
+ catch (DataConversionException dce)
+ {
+ System.out.println("Cannot convert Box dimensions to double!");
+ }
+ }
+
+}
lcsim/src/org/lcsim/contrib/subdetector/tracker/silicon
diff -N Hep3Rotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Hep3Rotation.java 10 Nov 2006 21:06:23 -0000 1.1
@@ -0,0 +1,73 @@
+/*
+ * Hep3Rotation.java
+ *
+ * Created on October 4, 2006, 10:51 AM
+ *
+ * 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.Hep3Matrix;
+import hep.physics.vec.BasicHep3Matrix;
+import hep.physics.vec.VecOp;
+
+/**
+ *
+ * @author tknelson
+ */
+public class Hep3Rotation extends BasicHep3Matrix
+{
+
+ // Fields
+ //=======
+ /** Creates a new instance of Hep3Rotation */
+ public Hep3Rotation()
+ {
+ }
+
+ // Static Methods
+ //===============
+ public static Hep3Rotation passiveTaitBryan(double alpha, double beta, double gamma)
+ {
+ return (Hep3Rotation)VecOp.mult(passiveZRotation(gamma),VecOp.mult(passiveYRotation(beta),passiveXRotation(alpha)));
+ }
+
+ public static Hep3Rotation passiveXRotation(double angle)
+ {
+ double sin = Math.sin(angle);
+ double cos = Math.cos(angle);
+ Hep3Rotation rotation = new Hep3Rotation();
+ rotation.setElement(1,1,cos);
+ rotation.setElement(1,2,sin);
+ rotation.setElement(2,1,-sin);
+ rotation.setElement(2,2,cos);
+ return rotation;
+ }
+
+ public static Hep3Rotation passiveYRotation(double angle)
+ {
+ double sin = Math.sin(angle);
+ double cos = Math.cos(angle);
+ Hep3Rotation rotation = new Hep3Rotation();
+ rotation.setElement(0,0,cos);
+ rotation.setElement(1,3,-sin);
+ rotation.setElement(3,1,sin);
+ rotation.setElement(3,3,cos);
+ return rotation;
+ }
+
+ public static Hep3Rotation passiveZRotation(double angle)
+ {
+ double sin = Math.sin(angle);
+ double cos = Math.cos(angle);
+ Hep3Rotation rotation = new Hep3Rotation();
+ rotation.setElement(0,0,cos);
+ rotation.setElement(0,1,sin);
+ rotation.setElement(1,0,-sin);
+ rotation.setElement(1,1,cos);
+ return rotation;
+ }
+
+}
lcsim/src/org/lcsim/contrib/subdetector/tracker/silicon
diff -N TubeSegment.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ TubeSegment.java 10 Nov 2006 21:06:23 -0000 1.1
@@ -0,0 +1,85 @@
+/*
+ * TubeSegment.java
+ *
+ * Created on November 3, 2006, 2:41 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 org.jdom.Element;
+import org.jdom.DataConversionException;
+
+/**
+ *
+ * @author tknelson
+ */
+public class TubeSegment implements ISolid
+{
+
+ // Fields
+ //=======
+ private double _dimensions[] = new double[3];
+
+ /** Creates a new instance of Box */
+ public TubeSegment(Element tubesegment)
+ {
+ buildFromXML(tubesegment);
+ }
+
+ // Accessors
+ //==========
+ public double getInnerRadius()
+ {
+ return _dimensions[0];
+ }
+
+ public double getOuterRadius()
+ {
+ return _dimensions[1];
+ }
+
+ public double getZLength()
+ {
+ return _dimensions[2];
+ }
+
+ // Implementation of ISolid
+ //=========================
+ public double[] getDimensions()
+ {
+ return _dimensions;
+ }
+
+ public double getVolume()
+ {
+ return Math.PI*(_dimensions[1]*_dimensions[1] - _dimensions[0]*_dimensions[0])*_dimensions[2];
+ }
+
+ public boolean isInside(Hep3Vector point)
+ {
+ double r_xy = Math.sqrt(point.x()*point.x() + point.y()*point.y());
+
+ return ( r_xy > _dimensions[0] &&
+ r_xy < _dimensions[1] &&
+ Math.abs(point.z()) < _dimensions[2]/2.0 );
+ }
+
+ public void buildFromXML(Element tubesegment)
+ {
+ try
+ {
+ _dimensions[0] = tubesegment.getAttribute("r_inner").getDoubleValue();
+ _dimensions[1] = tubesegment.getAttribute("r_outer").getDoubleValue();
+ _dimensions[2] = tubesegment.getAttribute("z_length").getDoubleValue();
+ }
+ catch (DataConversionException dce)
+ {
+ System.out.println("Cannot convert TubeSegment dimensions to double!");
+ }
+ }
+
+}
CVSspam 0.2.8