10 modified files
GeomConverter/src/org/lcsim/detector
diff -u -r1.8 -r1.9
--- DetectorElement.java 20 Mar 2007 21:19:59 -0000 1.8
+++ DetectorElement.java 24 Mar 2007 01:02:49 -0000 1.9
@@ -1,5 +1,7 @@
package org.lcsim.detector;
+import hep.physics.vec.Hep3Vector;
+
import org.lcsim.detector.identifier.IIdentifier;
public class DetectorElement
@@ -242,4 +244,36 @@
{
this.id = id;
}
+
+ public boolean hasGeometryInfo()
+ {
+ return geometry != null;
+ }
+
+ public IDetectorElement findDetectorElement(
+ Hep3Vector globalPoint)
+ {
+ IDetectorElement srch = null;
+
+ if ( hasGeometryInfo() )
+ {
+ if ( getGeometry().isInside(globalPoint))
+ {
+ srch = this;
+ }
+ }
+
+ // Look recursively through the children.
+ for ( IDetectorElement child : getChildren() )
+ {
+ IDetectorElement childSrch = child.findDetectorElement(globalPoint);
+ if ( childSrch != null )
+ {
+ srch = childSrch;
+ }
+ }
+
+ return srch;
+ }
+
}
\ No newline at end of file
GeomConverter/src/org/lcsim/detector
diff -u -r1.9 -r1.10
--- GeometryInfo.java 20 Mar 2007 01:21:39 -0000 1.9
+++ GeometryInfo.java 24 Mar 2007 01:02:49 -0000 1.10
@@ -127,7 +127,9 @@
}
// Cache the global position.
- globalPosition = localToGlobal.transformed(new BasicHep3Vector());
+ globalPosition = localToGlobal.transformed(new BasicHep3Vector(0.,0.,0.));
+
+ //System.out.println(getDetectorElement().getName() + " = " + globalPosition);
}
/**
@@ -312,6 +314,5 @@
public boolean hasPhysicalVolumePath()
{
return support != null;
- }
-
+ }
}
\ No newline at end of file
GeomConverter/src/org/lcsim/detector
diff -u -r1.4 -r1.5
--- IDetectorElement.java 20 Mar 2007 21:19:59 -0000 1.4
+++ IDetectorElement.java 24 Mar 2007 01:02:49 -0000 1.5
@@ -1,5 +1,7 @@
package org.lcsim.detector;
+import hep.physics.vec.Hep3Vector;
+
import org.lcsim.detector.identifier.IIdentifiable;
import org.lcsim.detector.identifier.IIdentifier;
@@ -9,7 +11,7 @@
*
* @author Tim Nelson <[log in to unmask]>
* @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: IDetectorElement.java,v 1.4 2007/03/20 21:19:59 jeremy Exp $
+ * @version $Id: IDetectorElement.java,v 1.5 2007/03/24 01:02:49 jeremy Exp $
*/
public interface IDetectorElement
extends IIdentifiable, INamed
@@ -65,4 +67,35 @@
* @param parent
*/
public void setParent(IDetectorElement parent);
+
+ /**
+ * @return True if IGeometryInfo has been created,
+ * False if IGeometryInfo is null.
+ */
+ public boolean hasGeometryInfo();
+
+ /**
+ * Locate the deepest IDetectorElement containing the global point
+ * @param globalPoint, starting with this DetectorElement and traversing
+ * into its children. This DetectorElement may be returned if it
+ * has geometry that contains the point but none of its descendants
+ * contain the point.
+ *
+ * This method can be used from @see org.lcsim.geometry.Detector
+ * to find the deepest DetectorElement within the complete detector.
+ *
+ * This method is not on GeometryInfo, because a DetectorElement is
+ * allowed to have a <code>null</code> GeometryInfo if it is a simple
+ * container without a geometry path, i.e. a ghost volume.
+ *
+ * @return The deepest IDetectorElement containing globalPoint
+ * or <code>null</code> if point is not contained within
+ * this DetectorElement or its children.
+ *
+ * FIXME: Should this go into a DetectorElementNavigator? It is somehwat
+ * against previous philosophy of keeping all geometry-related functionality
+ * of a DetectorElement within GeometryInfo.
+ */
+ public IDetectorElement findDetectorElement(
+ Hep3Vector globalPoint);
}
\ No newline at end of file
GeomConverter/src/org/lcsim/detector
diff -u -r1.9 -r1.10
--- IGeometryInfo.java 20 Mar 2007 01:16:46 -0000 1.9
+++ IGeometryInfo.java 24 Mar 2007 01:02:49 -0000 1.10
@@ -168,7 +168,7 @@
public boolean isGhost();
/**
- * Return the associated DetectorElement.
+ * Return the associated DetectorElement.
* @return
*/
public IDetectorElement getDetectorElement();
GeomConverter/src/org/lcsim/detector
diff -u -r1.11 -r1.12
--- PhysicalVolumeNavigator.java 20 Mar 2007 00:47:17 -0000 1.11
+++ PhysicalVolumeNavigator.java 24 Mar 2007 01:02:49 -0000 1.12
@@ -4,12 +4,12 @@
import hep.physics.vec.Hep3Vector;
/**
- * Navigates from a top or "top" volume
+ * Navigates from a top or "world" volume
* into daughter volumes using String
* paths of Physical Volume names. The
* returned information is a unique
- * stack of PhysicalVolume objects, which
- * is a new PhysicalVolumePath.
+ * stack of PhysicalVolume objects, called
+ * an IPhysicalVolumePath.
*
* String paths are a series of PhysicalVolume names.
*
@@ -18,15 +18,17 @@
* Paths do not include an explicit name of the top
* volume. The top volume can be addressed with
* a single slash, "/", which the getPath method will
- * interpret to mean top volume of this navigator.
+ * interpret to mean the top volume of this navigator.
*
* The LogicalVolume class enforces unique naming of
* PhysicalVolume objects within its own daughter collection.
+ * This allows unique addressing of children from a
+ * given PhysicalVolume node.
*
* Locates the deepest daughter volume containing a given
* global point within the top volume.
*
- * Computes the combined transform of an IPhysicalVolumePath.
+ * Computes the combined transform of IPhysicalVolumePaths.
*
* In theory, the top PhysicalVolume need not be the world
* volume. It is referred to as the "top" volume to avoid
@@ -336,43 +338,7 @@
PhysicalVolumeNavigatorStore.getInstance().add(this);
}
-
- /**
- * Create a PhysicalVolumeNavigator with @param pvTop
- * as the top level.
- * @param pvTop
- */
- /*
- public PhysicalVolumeNavigator(IPhysicalVolume pvTop)
- {
- super("default");
-
- setTopPhysicalVolume(pvTop);
-
- PhysicalVolumeNavigatorStore.getInstance().add(this);
- }*/
-
- /**
- * Create a PhysicalVolumeNavigator with the top volume
- * of @param path as the navigator's top volume.
- *
- * @param path
- */
- /*
- public PhysicalVolumeNavigator(IPhysicalVolumePath path)
- {
- super("default");
-
- if ( path == null )
- {
- throw new IllegalArgumentException("The path is null!");
- }
-
- setTopPhysicalVolume(path);
-
- PhysicalVolumeNavigatorStore.getInstance().add(this);
- }*/
-
+
public void traversePreOrder(
IPhysicalVolumeVisitor visitor)
{
@@ -408,10 +374,9 @@
}
}
}
-
-
+
/**
- * Visit the PhysicalVolume recursively using postorder,
+ * Visit each PhysicalVolume recursively using postorder,
* calling the given IPhysicalVolumeVisitor's visit method
* for each node.
*
GeomConverter/src/org/lcsim/detector/converter/compact
diff -u -r1.3 -r1.4
--- CylindricalEndcapCalorimeterConverter.java 20 Mar 2007 21:19:59 -0000 1.3
+++ CylindricalEndcapCalorimeterConverter.java 24 Mar 2007 01:02:50 -0000 1.4
@@ -53,12 +53,15 @@
DetectorElement reflectedEndcap=null;
if ( cal.getReflect() )
{
- Rotation3D reflect =
- new Rotation3D(Rotation3D.passiveXRotation(Math.PI));
-
+ Rotation3D reflect = new Rotation3D();
+ reflect.setPassiveEuler(Math.PI,0,0);
+
new PhysicalVolume
(
- new Transform3D(new BasicHep3Vector(0,0,negz), reflect),
+ new Transform3D(
+ new BasicHep3Vector(0,0,negz),
+ reflect
+ ),
cal.getName() + "_negative",
envelope,
world.getLogicalVolume(),
GeomConverter/src/org/lcsim/detector/converter/compact
diff -u -r1.8 -r1.9
--- DetectorConverter.java 20 Mar 2007 23:57:51 -0000 1.8
+++ DetectorConverter.java 24 Mar 2007 01:02:50 -0000 1.9
@@ -34,6 +34,7 @@
addSubdetectorConverter( new CylindricalBarrelCalorimeterConverter() );
addSubdetectorConverter( new CylindricalEndcapCalorimeterConverter() );
addSubdetectorConverter( new MultiLayerTrackerConverter() );
+ addSubdetectorConverter( new DiskTrackerConverter() );
}
private void addSubdetectorConverter(ISubdetectorConverter s)
@@ -64,11 +65,12 @@
// Create the default navigator.
PhysicalVolumeNavigatorStore.getInstance().reset();
PhysicalVolumeNavigatorStore.getInstance().createDefault(pvWorld);
- detector.setSupport("/");
- detector.setWorldVolume(pvWorld);
+ detector.setSupport("/");
// Construct the tracking volume.
buildTrackingVolume(pvWorld.getLogicalVolume(), detector);
+
+ detector.setWorldVolume(pvWorld);
convertMaterials("/org/lcsim/material/elements.xml");
convertMaterials("/org/lcsim/material/materials.xml");
@@ -151,7 +153,7 @@
world,
0);
- new DetectorElement("tracking_region", detector, "/tracking_region");
+ //new DetectorElement("trackers", detector, "/tracking_region");
}
private IPhysicalVolume buildWorldVolume(Detector detector)
GeomConverter/src/org/lcsim/geometry/compact
diff -u -r1.19 -r1.20
--- Detector.java 20 Mar 2007 23:57:51 -0000 1.19
+++ Detector.java 24 Mar 2007 01:02:50 -0000 1.20
@@ -6,7 +6,11 @@
import org.jdom.Element;
import org.lcsim.detector.DetectorElement;
+import org.lcsim.detector.IDetectorElement;
+import org.lcsim.detector.ILogicalVolume;
import org.lcsim.detector.IPhysicalVolume;
+import org.lcsim.detector.IPhysicalVolumeNavigator;
+import org.lcsim.detector.PhysicalVolumeNavigator;
import org.lcsim.material.XMLMaterialManager;
/**
@@ -29,6 +33,8 @@
private SystemIDMap idmap = new SystemIDMap();
private IPhysicalVolume worldVolume;
+ private IPhysicalVolume trackingVolume;
+ private IPhysicalVolumeNavigator navigator;
/**
* Called by the reader to create a new Detector
@@ -49,6 +55,18 @@
public void setWorldVolume(IPhysicalVolume worldVolume)
{
this.worldVolume = worldVolume;
+ navigator = new PhysicalVolumeNavigator("world",worldVolume);
+ trackingVolume = navigator.getPath("/tracking_region").getLeafVolume();
+ }
+
+ public IPhysicalVolume getTrackingVolume()
+ {
+ return trackingVolume;
+ }
+
+ public IPhysicalVolumeNavigator getNavigator()
+ {
+ return navigator;
}
/**
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
diff -u -r1.17 -r1.18
--- DiskTracker.java 12 Sep 2006 01:20:53 -0000 1.17
+++ DiskTracker.java 24 Mar 2007 01:02:50 -0000 1.18
@@ -24,20 +24,20 @@
{
super(node);
}
-
+
public void addToLCDD(LCDD lcdd, SensitiveDetector sens) throws JDOMException
{
int id = node.getAttribute("id").getIntValue();
String detectorName = node.getAttributeValue("name");
boolean reflect = node.getAttribute("reflect").getBooleanValue();
-
+
Material air = lcdd.getMaterial("Air");
Rotation reflection = lcdd.getDefine().getRotation("reflect_rot");
Solids solids = lcdd.getSolids();
Structure structure = lcdd.getStructure();
-
+
Volume trackingVolume = lcdd.pickMotherVolume(this);
-
+
int n = 0;
for (Iterator i = node.getChildren("layer").iterator(); i.hasNext(); n++)
{
@@ -47,13 +47,13 @@
Volume volume1 = new Volume(name1+"_volume");
volume1.setMaterial(air);
volume1.setSolid(tube1);
-
+
int m = 0;
double zmin = layer.getAttribute("inner_z").getDoubleValue();
double rmin = layer.getAttribute("inner_r").getDoubleValue();
double rmax = layer.getAttribute("outer_r").getDoubleValue();
double z = zmin;
-
+
double layerWidth = 0;
for (Iterator j = layer.getChildren("slice").iterator(); j.hasNext();)
{
@@ -70,14 +70,14 @@
}
layerWidth += w;
}
-
+
for (Iterator j = layer.getChildren("slice").iterator(); j.hasNext(); m++)
{
Element slice = (Element) j.next();
double w = slice.getAttribute("thickness").getDoubleValue();
Attribute s = slice.getAttribute("sensitive");
boolean sensitive = s != null && s.getBooleanValue();
-
+
String name = detectorName+"_layer"+n+"_slice"+m;
Tube tube = new Tube(name);
tube.setZ(w);
@@ -85,37 +85,37 @@
tube.setRMax(rmax);
tube.setDeltaPhi(Math.PI*2);
solids.addSolid(tube);
-
+
Volume volume = new Volume(name+"_volume");
volume.setMaterial(lcdd.getMaterial(slice.getAttributeValue("material")));
volume.setSolid(tube);
if (sensitive) volume.setSensitiveDetector(sens);
-
+
/* FIXME: these need to be called automatically whenever a new volume is created --JM */
setRegion(lcdd, slice, volume);
setLimitSet(lcdd, slice, volume);
setVisAttributes(lcdd, node, volume);
-
+
PhysVol physvol = new PhysVol(volume);
physvol.setZ(z-zmin -layerWidth/2 + w/2);
physvol.addPhysVolID("layer",n);
volume1.addContent(physvol);
structure.addVolume(volume);
-
+
z += w;
}
-
+
tube1.setZ(layerWidth);
tube1.setRMin(rmin);
tube1.setRMax(rmax);
tube1.setDeltaPhi(Math.PI*2);
-
+
PhysVol physvol = new PhysVol(volume1);
physvol.setZ(zmin+layerWidth/2);
physvol.addPhysVolID("system",id);
physvol.addPhysVolID("barrel",1);
trackingVolume.addPhysVol(physvol);
-
+
if (reflect)
{
PhysVol physvol2 = new PhysVol(volume1);
@@ -127,13 +127,13 @@
}
solids.addContent(tube1);
structure.addContent(volume1);
-
+
setVisAttributes(lcdd, node, volume1);
}
-
+
setCombineHits(node, sens);
}
-
+
public boolean isTracker()
{
return true;
GeomConverter/test/org/lcsim/detector/converter/compact
diff -u -r1.5 -r1.6
--- DetectorConverterTest.java 20 Mar 2007 23:57:51 -0000 1.5
+++ DetectorConverterTest.java 24 Mar 2007 01:02:50 -0000 1.6
@@ -11,13 +11,11 @@
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.lcsim.detector.DetectorElementStore;
import org.lcsim.detector.IDetectorElement;
import org.lcsim.detector.IGeometryInfo;
import org.lcsim.detector.IPhysicalVolume;
import org.lcsim.detector.IPhysicalVolumeNavigator;
import org.lcsim.detector.PhysicalVolumeNavigatorStore;
-import org.lcsim.detector.PhysicalVolumeStore;
import org.lcsim.detector.solids.Tube;
import org.lcsim.geometry.Detector;
import org.lcsim.geometry.GeometryReader;
CVSspam 0.2.8