30 modified files
GeomConverter/src/org/lcsim/detector
diff -u -r1.6 -r1.7
--- DetectorIdentifierHelper.java 2 Jul 2008 22:52:18 -0000 1.6
+++ DetectorIdentifierHelper.java 17 Nov 2010 00:13:43 -0000 1.7
@@ -306,7 +306,8 @@
SystemMap systemMap)
{
super(dict);
- try {
+ try
+ {
setup(dict,systemMap);
}
catch (Exception x)
@@ -325,6 +326,9 @@
private IIdentifier makeSubsysId(int system)
{
+ // Check for invalid system id and replace with 0 to get a valid identifier.
+ if (system == this.invalidSystemValue)
+ system = 0;
IExpandedIdentifier expid =
new ExpandedIdentifier(getIdentifierDictionary().getNumberOfFields());
expid.setValue(systemIndex, system);
@@ -334,6 +338,9 @@
private IIdentifier makeSubsysId(int system, int barrel)
{
+ // Check for invalid system id and replace with 0 to get a valid identifier.
+ if (system == this.invalidSystemValue)
+ system = 0;
IExpandedIdentifier expid =
new ExpandedIdentifier(getIdentifierDictionary().getNumberOfFields());
expid.setValue(systemIndex, system);
GeomConverter/src/org/lcsim/detector/identifier
diff -u -r1.7 -r1.8
--- IdentifierField.java 17 Nov 2010 00:07:02 -0000 1.7
+++ IdentifierField.java 17 Nov 2010 00:13:43 -0000 1.8
@@ -4,7 +4,7 @@
* Implementation of {@link IIdentifierField}.
*
* @author Jeremy McCormick
- * @version $Id: IdentifierField.java,v 1.7 2010/11/17 00:07:02 jeremy Exp $
+ * @version $Id: IdentifierField.java,v 1.8 2010/11/17 00:13:43 jeremy Exp $
*/
public class IdentifierField implements IIdentifierField
@@ -70,9 +70,14 @@
this.intMask = (1 << numberOfBits) - 1;
this.longMask = ((1L << numberOfBits) - 1);
- maxValue = ((int) Math.pow( 2, getNumberOfBits() )) - 1;
- minValue = 0;
- if ( isSigned() )
+ // Range for unsigned field.
+ if (!isSigned())
+ {
+ maxValue = ((int) Math.pow( 2, getNumberOfBits() )) - 1;
+ minValue = 0;
+ }
+ // Range for signed field.
+ else
{
// In a signed field, one bit is reserved for the sign bit.
maxValue = ((int) Math.pow( 2, getNumberOfBits() - 1 )) - 1;
GeomConverter/src/org/lcsim/geometry
diff -u -r1.15 -r1.16
--- Calorimeter.java 18 Dec 2009 19:32:28 -0000 1.15
+++ Calorimeter.java 17 Nov 2010 00:13:43 -0000 1.16
@@ -2,10 +2,27 @@
/**
*
+ * The interface for a generic Calorimeter detector, providing access
+ * to basic envelope parameters, calculations of layer parameters such
+ * as interaction and radiation lengths, as well as some information
+ * that is only accessible with method chaining and is pushed up to here.
+ *
* @author tonyj
+ * @author jeremym
+ *
+ * @version $Id: Calorimeter.java,v 1.16 2010/11/17 00:13:43 jeremy Exp $
*/
public interface Calorimeter extends Subdetector
{
+ /**
+ * The CalorimeterType is an enum describing the type of Calorimeter.
+ * Values are based on common subsystems in an ILC detector. This
+ * enum is designed such that only one subdetector should have a
+ * given type in the compact description except for UNKNOWN, which
+ * not be explicitly used in a calorimeterType field.
+ *
+ * @author jeremym
+ */
enum CalorimeterType
{
UNKNOWN,
@@ -44,18 +61,113 @@
}
}
+ /**
+ * Get the CalorimeterType of this Calorimeter.
+ * @return The CalorimeterType.
+ */
public CalorimeterType getCalorimeterType();
- // TODO: Implement these for all calorimeter types.
- /*
+ /**
+ * Get the innerRadius of this Calorimeter or 0 if NA.
+ * @return The innerRadius.
+ */
public double getInnerRadius();
+
+ /**
+ * Get the outerRadius of this Calorimeter or 0 if NA.
+ * @return The outerRadius.
+ */
public double getOuterRadius();
+
+ /**
+ * Get the innerZ of this Calorimeter or 0 if NA.
+ * @return The innerZ.
+ */
public double getInnerZ();
+
+ /**
+ * Get the outerZ of this Calorimeter or 0 if NA.
+ * @return The outerZ.
+ */
public double getOuterZ();
+
+ /**
+ * Get the Calorimeter's Z length.
+ * @return The Calorimeter's Z length.
+ */
+ public double getZLength();
+
+ /**
+ * Get the inner phi angle subtended by one calorimeter section or 0 if NA.
+ * @return The phi angle of one section.
+ */
public double getInnerPhi();
+
+ /**
+ * Get the outer phi angle subtended by one calorimeter section or 0 if NA.
+ * Typically this is the same as {@link #getInnerPhi()}.
+ * @return The outer phi angle of one section.
+ */
public double getOuterPhi();
- public double getInnerNumberOfSides();
- public double getOuterNumberOfSides();
- */
+ /**
+ * Get the inner number of sides of this calorimeter or 0 if NA.
+ * @return The inner number of sides.
+ */
+ public int getInnerNumberOfSides();
+
+ /**
+ * Get the outer number of sides of this calorimeter or 0 if NA.
+ * Typically this is the same as {@link #getInnerNumberOfSides()}.
+ * @return The outer number of sides.
+ */
+ public int getOuterNumberOfSides();
+
+ /**
+ * Get the number of layers in the Calorimeter.
+ * @ return The number of layers.
+ */
+ public int getNumberOfLayers();
+
+ /**
+ * Get the distance to the layer from the IP in mm.
+ * @param layerNumber The layer index.
+ * @return The distance to the layer.
+ */
+ public double getDistanceToLayer(int layerNumber);
+
+ /**
+ * Get the distance to the sensor from the IP in mm.
+ * @param The layer number.
+ * @return The distance to the sensor in mm.
+ */
+ public double getDistanceToSensor(int layerNumber);
+
+ /**
+ * Get the total layer thickness in mm.
+ * @return The total layer thickness.
+ */
+ public double getLayerThickness(int layern);
+
+ /**
+ * Get the sensor thickness in mm.
+ * @ return The sensor thicknes.
+ */
+ public double getSensorThickness(int layern);
+
+ /**
+ * Get the cell U dimension.
+ * @return The cell U dimension.
+ */
+ public double getCellSizeU();
+
+ /**
+ * Get the cell V dimension.
+ * @return The cell V dimension.
+ */
+ public double getCellSizeV();
+
+ // This would be useful but requires access to the conditions system.
+ // May require using a set method to decouple from conditions package.
+ // public boolean isDigital();
}
\ No newline at end of file
GeomConverter/src/org/lcsim/geometry
diff -u -r1.11 -r1.12
--- CylindricalSubdetector.java 11 May 2007 00:21:09 -0000 1.11
+++ CylindricalSubdetector.java 17 Nov 2010 00:13:43 -0000 1.12
@@ -8,7 +8,6 @@
* FIXME: Need Cylinder shape extending Solid.
*
*/
-@Deprecated
public interface CylindricalSubdetector
{
public double getInnerRadius();
GeomConverter/src/org/lcsim/geometry
diff -u -r1.34 -r1.35
--- Detector.java 20 Apr 2007 00:16:54 -0000 1.34
+++ Detector.java 17 Nov 2010 00:13:43 -0000 1.35
@@ -7,7 +7,13 @@
import hep.graphics.heprep.HepRepType;
import hep.graphics.heprep.HepRepTypeTree;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
import org.jdom.Element;
+import org.lcsim.geometry.Calorimeter.CalorimeterType;
import org.lcsim.geometry.compact.Field;
import org.lcsim.geometry.compact.Readout;
import org.lcsim.geometry.field.FieldOverlay;
@@ -15,12 +21,17 @@
/**
* @author tonyj
+ * @author jeremym
+ *
+ * @version $Id: Detector.java,v 1.35 2010/11/17 00:13:43 jeremy Exp $
*/
+// FIXME Determine which methods should go here or on compact Detector.
public class Detector
extends org.lcsim.geometry.compact.Detector
implements HepRepProvider
{
private FieldOverlay fieldOverlay = new FieldOverlay();
+ private Map<CalorimeterType, Calorimeter> calTypeMap = new HashMap<CalorimeterType, Calorimeter>();
protected Detector(Element node)
{
@@ -43,13 +54,28 @@
{
super.addSubdetector(sub);
setupIDDecoder(sub);
- //System.out.println("Added subdet: " + sub.getName() );
+
+ // Add Calorimeter to CalorimeterType map.
+ if (sub.isCalorimeter())
+ {
+ Calorimeter cal = (Calorimeter)sub;
+ if (!cal.getCalorimeterType().equals( CalorimeterType.UNKNOWN ))
+ {
+ if (calTypeMap.get( cal.getCalorimeterType() ) != null)
+ {
+ throw new RuntimeException("Cannot add duplicate CalorimeterType <" +
+ CalorimeterType.toString( cal.getCalorimeterType() ) +
+ "> from subdetector <" + cal.getName() + ">.");
+ }
+ calTypeMap.put( cal.getCalorimeterType(), cal );
+ }
+ }
}
/*
- * FIXME: There is not a 1-to-1 between subdetectors and readouts.
+ * FIXME: There is not necessary a 1-to-1 between subdetectors and readouts as implied here.
* FIXME: This function is just a hack to setup the IDDecoder. There is probably a
- * better way to do it.
+ * better way to do it.
*/
private void setupIDDecoder(org.lcsim.geometry.compact.Subdetector subdet)
{
@@ -79,6 +105,11 @@
super.addField((Field)field);
fieldOverlay.addField((FieldMap)field);
}
+
+ public Calorimeter getCalorimeterByType( CalorimeterType calType )
+ {
+ return calTypeMap.get( calType );
+ }
public void appendHepRep(HepRepFactory factory, HepRep heprep)
{
GeomConverter/src/org/lcsim/geometry
diff -u -r1.22 -r1.23
--- Subdetector.java 11 Sep 2007 19:21:03 -0000 1.22
+++ Subdetector.java 17 Nov 2010 00:13:43 -0000 1.23
@@ -15,6 +15,10 @@
public IDDecoder getIDDecoder();
+ public String getHitsCollectionName();
+
+ public String getDigiHitsCollectionName();
+
/**
* @deprecated Use functionality provided by {@link org.lcsim.detector.IDetectorElement}.
* @return The layering.
GeomConverter/src/org/lcsim/geometry/compact
diff -u -r1.9 -r1.10
--- Segmentation.java 14 Oct 2009 22:36:42 -0000 1.9
+++ Segmentation.java 17 Nov 2010 00:13:44 -0000 1.10
@@ -1,5 +1,8 @@
package org.lcsim.geometry.compact;
+import java.util.ArrayList;
+import java.util.List;
+
import org.jdom.Element;
import org.lcsim.geometry.util.BaseIDDecoder;
@@ -9,9 +12,21 @@
*/
public class Segmentation
extends BaseIDDecoder
-{
- protected Segmentation(Element segmentation)
- {
+{
+ protected List<Double> cellSizes = new ArrayList<Double>(2);
+
+ protected Segmentation(Element segmentation)
+ {
super();
- }
-}
+ }
+
+ public double getCellSizeU()
+ {
+ return this.cellSizes.get(0);
+ }
+
+ public double getCellSizeV()
+ {
+ return this.cellSizes.get(1);
+ }
+}
\ No newline at end of file
GeomConverter/src/org/lcsim/geometry/compact
diff -u -r1.23 -r1.24
--- Subdetector.java 18 Nov 2009 22:20:15 -0000 1.23
+++ Subdetector.java 17 Nov 2010 00:13:44 -0000 1.24
@@ -13,6 +13,8 @@
*
* @author Tony Johnson <[log in to unmask]>
* @author Jeremy McCormick <[log in to unmask]>
+ *
+ * @version $Id: Subdetector.java,v 1.24 2010/11/17 00:13:44 jeremy Exp $
*/
public class Subdetector implements org.lcsim.geometry.Subdetector
{
@@ -29,15 +31,17 @@
private Element node;
private IDetectorElement de;
private boolean insideTrackingVolume = false;
+ String digiCollectionName = null;
protected Subdetector(Element element) throws JDOMException
{
- //super(element.getAttributeValue("name"));
-
+ // XML node.
node = element;
-
+
+ // Subdetector name.
name = element.getAttributeValue("name");
+ // Reflect attribute.
Attribute r = element.getAttribute("reflect");
reflect = r != null && r.getBooleanValue();
@@ -53,7 +57,8 @@
if (isTracker())
{
insideTrackingVolume = true;
- } else
+ }
+ else
{
insideTrackingVolume = false;
}
@@ -61,10 +66,14 @@
{
insideTrackingVolume = insideAttrib.getBooleanValue();
}
- } catch (org.jdom.DataConversionException dce)
+ }
+ catch (org.jdom.DataConversionException dce)
{
throw new RuntimeException("Error converting insideTrackingVolume attribute.", dce);
}
+
+ // Set default digitized hits collection name.
+ digiCollectionName = this.getName().replace("Hits","DigiHits");
}
protected void setReadout(Readout r)
@@ -181,4 +190,28 @@
{
return insideTrackingVolume;
}
+
+ public String getHitsCollectionName()
+ {
+ return getReadout().getName();
+ }
+
+ /**
+ * Allow setting of digi collection name by external digitization Driver.
+ * This will override the default setting based on digisim's default.
+ * @param digiCollecionName The new name for digitized hits collection.
+ */
+ public void setDigiHitsCollectionName(String digiCollectionName)
+ {
+ this.digiCollectionName = digiCollectionName;
+ }
+
+ /**
+ * Get the name of the digitized hits collection.
+ * @return The digitized hits collection name.
+ */
+ public String getDigiHitsCollectionName()
+ {
+ return digiCollectionName;
+ }
}
\ No newline at end of file
GeomConverter/src/org/lcsim/geometry/segmentation
diff -u -r1.11 -r1.12
--- CartesianGridXY.java 14 Apr 2010 18:24:54 -0000 1.11
+++ CartesianGridXY.java 17 Nov 2010 00:13:44 -0000 1.12
@@ -22,7 +22,7 @@
* to segment staves in a calorimeter that have box shaped layers.
*
* @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: CartesianGridXY.java,v 1.11 2010/04/14 18:24:54 jeremy Exp $
+ * @version $Id: CartesianGridXY.java,v 1.12 2010/11/17 00:13:44 jeremy Exp $
*/
public class CartesianGridXY extends AbstractCartesianGrid
{
@@ -36,6 +36,7 @@
if (node.getAttribute("gridSizeX") != null)
{
gridSizeX = node.getAttribute("gridSizeX").getDoubleValue();
+ cellSizes.add(0, gridSizeX);
}
else
{
@@ -45,6 +46,7 @@
if (node.getAttribute("gridSizeY") != null)
{
gridSizeY = node.getAttribute("gridSizeY").getDoubleValue();
+ cellSizes.add(1, gridSizeY);
}
else
{
GeomConverter/src/org/lcsim/geometry/segmentation
diff -u -r1.8 -r1.9
--- CartesianGridXZ.java 14 Apr 2010 00:07:19 -0000 1.8
+++ CartesianGridXZ.java 17 Nov 2010 00:13:44 -0000 1.9
@@ -34,6 +34,7 @@
if (node.getAttribute("gridSizeX") != null)
{
gridSizeX = node.getAttribute("gridSizeX").getDoubleValue();
+ cellSizes.add(0, gridSizeX);
}
else
{
@@ -43,6 +44,7 @@
if (node.getAttribute("gridSizeZ") != null)
{
gridSizeZ = node.getAttribute("gridSizeZ").getDoubleValue();
+ cellSizes.add(1, gridSizeZ);
}
else
{
GeomConverter/src/org/lcsim/geometry/segmentation
diff -u -r1.6 -r1.7
--- EcalBarrelCartesianGridXY.java 14 Apr 2010 18:24:54 -0000 1.6
+++ EcalBarrelCartesianGridXY.java 17 Nov 2010 00:13:44 -0000 1.7
@@ -59,6 +59,7 @@
if (node.getAttribute("gridSizeX") != null)
{
gridSizeX = node.getAttribute("gridSizeX").getDoubleValue();
+ cellSizes.add(0, gridSizeX);
}
else
{
@@ -68,6 +69,7 @@
if (node.getAttribute("gridSizeY") != null)
{
gridSizeY = node.getAttribute("gridSizeY").getDoubleValue();
+ cellSizes.add(1, gridSizeY);
}
else
{
GeomConverter/src/org/lcsim/geometry/segmentation
diff -u -r1.9 -r1.10
--- GlobalGridXY.java 14 Apr 2010 18:24:54 -0000 1.9
+++ GlobalGridXY.java 17 Nov 2010 00:13:44 -0000 1.10
@@ -30,6 +30,7 @@
if (node.getAttribute("gridSizeX") != null)
{
gridSizeX = node.getAttribute("gridSizeX").getDoubleValue();
+ cellSizes.add(0, gridSizeX);
}
else
{
@@ -39,6 +40,7 @@
if (node.getAttribute("gridSizeY") != null)
{
gridSizeY = node.getAttribute("gridSizeY").getDoubleValue();
+ cellSizes.add(1, gridSizeY);
}
else
{
GeomConverter/src/org/lcsim/geometry/segmentation
diff -u -r1.30 -r1.31
--- GridXYZ.java 14 Apr 2010 18:24:54 -0000 1.30
+++ GridXYZ.java 17 Nov 2010 00:13:44 -0000 1.31
@@ -25,7 +25,7 @@
*
* @author Jeremy McCormick <[log in to unmask]>
* @author Guilherme Lima
- * @version $Id: GridXYZ.java,v 1.30 2010/04/14 18:24:54 jeremy Exp $
+ * @version $Id: GridXYZ.java,v 1.31 2010/11/17 00:13:44 jeremy Exp $
*/
// FIXME This class needs to be refactored.
public class GridXYZ extends SegmentationBase
@@ -49,19 +49,24 @@
{
super(node);
+ this.cellSizes.clear();
+
if (node.getAttribute("gridSizeX") != null)
{
gridSizeX = node.getAttribute("gridSizeX").getDoubleValue();
+ this.cellSizes.add(gridSizeX);
}
if (node.getAttribute("gridSizeY") != null)
{
gridSizeY = node.getAttribute("gridSizeY").getDoubleValue();
+ this.cellSizes.add(gridSizeY);
}
if (node.getAttribute("gridSizeZ") != null)
{
gridSizeZ = node.getAttribute("gridSizeZ").getDoubleValue();
+ this.cellSizes.add(gridSizeZ);
}
}
GeomConverter/src/org/lcsim/geometry/segmentation
diff -u -r1.26 -r1.27
--- NonprojectiveCylinder.java 23 May 2008 00:27:33 -0000 1.26
+++ NonprojectiveCylinder.java 17 Nov 2010 00:13:44 -0000 1.27
@@ -42,6 +42,19 @@
gridSizePhi = node.getAttribute("gridSizePhi").getDoubleValue();
gridSizeZ = node.getAttribute("gridSizeZ").getDoubleValue();
+
+ this.cellSizes.add(0, gridSizePhi);
+ this.cellSizes.add(1, gridSizeZ);
+ }
+
+ public double getCellSizeU()
+ {
+ return gridSizeZ;
+ }
+
+ public double getCellSizeV()
+ {
+ return gridSizeZ;
}
void setGridSizePhi(double gsp)
GeomConverter/src/org/lcsim/geometry/segmentation
diff -u -r1.27 -r1.28
--- ProjectiveCylinder.java 14 Apr 2010 18:51:53 -0000 1.27
+++ ProjectiveCylinder.java 17 Nov 2010 00:13:44 -0000 1.28
@@ -27,12 +27,28 @@
thetaBins = node.getAttribute("thetaBins").getIntValue();
phiBins = node.getAttribute("phiBins").getIntValue();
}
+
+ public double getCellSizeU()
+ {
+ return getTheta();
+ }
+
+ public double getCellSizeV()
+ {
+ return getPhi();
+ }
+ /**
+ * FIXME Cache this value in ctor.
+ */
public double getPhi()
{
return Math.PI * 2 * (getValue(phiIndex) + 0.5) / phiBins;
}
+ /**
+ * FIXME Cache this value in ctor.
+ */
public double getTheta()
{
return Math.PI * (getValue(thetaIndex) + 0.5) / thetaBins;
GeomConverter/src/org/lcsim/geometry/segmentation
diff -u -r1.23 -r1.24
--- ProjectiveZPlane.java 14 Apr 2010 18:24:54 -0000 1.23
+++ ProjectiveZPlane.java 17 Nov 2010 00:13:44 -0000 1.24
@@ -35,6 +35,16 @@
thetaBins = node.getAttribute("thetaBins").getIntValue();
phiBins = node.getAttribute("phiBins").getIntValue();
}
+
+ public double getCellSizeU()
+ {
+ return thetaDim;
+ }
+
+ public double getCellSizeV()
+ {
+ return phiDim;
+ }
public int getThetaBins()
{
@@ -83,8 +93,8 @@
phiIndex = id.indexOf("phi");
thetaIndex = id.indexOf("theta");
- barrelIndex = id.indexOf("barrel");
- systemIndex = id.indexOf("system");
+ barrelIndex = id.indexOf("barrel");
+ systemIndex = id.indexOf("system");
}
public long[] getNeighbourIDs(int deltaLayer, int deltaTheta, int deltaPhi)
GeomConverter/src/org/lcsim/geometry/segmentation
diff -u -r1.5 -r1.6
--- RegularNgonCartesianGridXY.java 14 Apr 2010 18:24:54 -0000 1.5
+++ RegularNgonCartesianGridXY.java 17 Nov 2010 00:13:44 -0000 1.6
@@ -41,6 +41,7 @@
if (node.getAttribute("gridSizeX") != null)
{
gridSizeX = node.getAttribute("gridSizeX").getDoubleValue();
+ cellSizes.add(0, gridSizeX);
}
else
{
@@ -50,6 +51,7 @@
if (node.getAttribute("gridSizeY") != null)
{
gridSizeY = node.getAttribute("gridSizeY").getDoubleValue();
+ cellSizes.add(1, gridSizeY);
}
else
{
GeomConverter/src/org/lcsim/geometry/segmentation
diff -u -r1.5 -r1.6
--- RegularNgonCartesianGridXZ.java 14 Apr 2010 18:52:25 -0000 1.5
+++ RegularNgonCartesianGridXZ.java 17 Nov 2010 00:13:44 -0000 1.6
@@ -52,6 +52,7 @@
if (node.getAttribute("gridSizeX") != null)
{
gridSizeX = node.getAttribute("gridSizeX").getDoubleValue();
+ cellSizes.add(0, gridSizeX);
}
else
{
@@ -61,6 +62,7 @@
if (node.getAttribute("gridSizeZ") != null)
{
gridSizeZ = node.getAttribute("gridSizeZ").getDoubleValue();
+ cellSizes.add(1, gridSizeZ);
}
else
{
GeomConverter/src/org/lcsim/geometry/segmentation
diff -u -r1.12 -r1.13
--- SegmentationBase.java 15 Sep 2009 19:55:31 -0000 1.12
+++ SegmentationBase.java 17 Nov 2010 00:13:44 -0000 1.13
@@ -4,6 +4,9 @@
package org.lcsim.geometry.segmentation;
+import java.util.ArrayList;
+import java.util.List;
+
import org.lcsim.geometry.Layered;
import org.jdom.Element;
import org.lcsim.geometry.layer.Layering;
@@ -15,23 +18,13 @@
*/
public abstract class SegmentationBase
extends org.lcsim.geometry.compact.Segmentation
-{
+{
public SegmentationBase(Element e)
{
super(e);
}
/**
- * FIXME: Should be renamed as it is actually returning the distance to the
- * midpoint of the sensitive layer.
- * FIXME: Does this belong here? It is only used by CylindricalEndcapCalorimeter.
- */
- public double getDistanceToSensitive(int layer)
- {
- return ((Layered) detector).getLayering().getDistanceToLayerSensorMid(layer);
- }
-
- /**
* Returns the cell which contains a given point (x,y,z).
*
* @param x Cartesian X coordinate.
@@ -72,8 +65,8 @@
return findCellContainingXYZ(pos.x(), pos.y(), pos.z());
}
- /*
- * FIXME: Does this belong here?
+ /**
+ * @deprecated
*/
protected int getNumberOfLayers()
{
@@ -85,36 +78,54 @@
return detector.transformLocalToGlobal(localPos);
}
+ /**
+ * @deprecated
+ */
protected Layering getLayering()
{
return ((Layered) detector).getLayering();
}
- // Not for public use, this is needed to calculate positions
- // and number of cells, etc.
- /*
- * FIXME: Are these next four functions really needed? --JM
+ /**
+ * @deprecated
*/
protected double getZMin()
{
return ((CylindricalSubdetector) detector).getZMin();
}
+ /**
+ * @deprecated
+ */
protected double getZMax()
{
return ((CylindricalSubdetector) detector).getZMax();
}
+ /**
+ * @deprecated
+ */
protected double getRMin()
{
return ((CylindricalSubdetector) detector).getInnerRadius();
}
+ /**
+ * @deprecated
+ */
protected double getRMax()
{
return ((CylindricalSubdetector) detector).getOuterRadius();
}
+ /**
+ * @deprecated
+ */
+ public double getDistanceToSensitive(int layer)
+ {
+ return ((Layered) detector).getLayering().getDistanceToLayerSensorMid(layer);
+ }
+
public boolean supportsNeighbours()
{
return true;
@@ -124,4 +135,4 @@
{
return this.getDecoder().getID();
}
-}
+}
\ No newline at end of file
GeomConverter/src/org/lcsim/geometry/subdetector
diff -u -r1.8 -r1.9
--- AbstractCalorimeter.java 9 Dec 2009 01:23:44 -0000 1.8
+++ AbstractCalorimeter.java 17 Nov 2010 00:13:44 -0000 1.9
@@ -6,28 +6,63 @@
*/
package org.lcsim.geometry.subdetector;
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Vector;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
import org.jdom.Element;
import org.jdom.JDOMException;
+import org.lcsim.detector.material.BetheBlochCalculator;
+import org.lcsim.detector.material.IMaterial;
+import org.lcsim.detector.material.IMaterialStore;
+import org.lcsim.detector.material.MaterialStore;
import org.lcsim.geometry.Calorimeter;
+import org.lcsim.geometry.compact.Segmentation;
+import org.lcsim.geometry.layer.Layer;
+import org.lcsim.geometry.layer.LayerSlice;
+import org.lcsim.material.Material;
+import org.lcsim.material.MaterialState;
/**
*
* @author Jeremy McCormick
+ * @version $Id: AbstractCalorimeter.java,v 1.9 2010/11/17 00:13:44 jeremy Exp $
*/
abstract class AbstractCalorimeter
extends AbstractLayeredSubdetector implements Calorimeter
{
Calorimeter.CalorimeterType calorimeterType = CalorimeterType.UNKNOWN;
+ private List<Double> nrad;
+ private List<Double> nlam;
+ private List<Double> de;
+ private Map<String, Double> dedxmap = new HashMap<String, Double>();
+
public AbstractCalorimeter(Element node) throws JDOMException
{
super(node);
+
+ //System.out.println(this.getName());
+
+ // Set the calorimeter type.
if (node.getAttribute("calorimeterType") != null)
{
- calorimeterType =
- CalorimeterType.fromString(
- node.getAttributeValue("calorimeterType"));
+ calorimeterType = CalorimeterType.fromString( node.getAttributeValue( "calorimeterType" ) );
}
+
+ // Initialize parameter arrays using layer count.
+ //System.out.println("nlayers = " + this.getLayering().getNumberOfLayers());
+ nrad = new ArrayList<Double>( this.getLayering().getNumberOfLayers() );
+ //System.out.println("nrad_size = " + nrad.size());
+ de = new ArrayList<Double>( this.getLayering().getNumberOfLayers() );
+ nlam = new ArrayList<Double>( this.getLayering().getNumberOfLayers() );
+
+ // Compute layer derived quantities.
+ computeLayerParameters();
}
public CalorimeterType getCalorimeterType()
@@ -39,4 +74,99 @@
{
return true;
}
+
+ public double getCellSizeU()
+ {
+ return ((Segmentation)this.getIDDecoder()).getCellSizeU();
+ }
+
+ public double getCellSizeV()
+ {
+ return ((Segmentation)this.getIDDecoder()).getCellSizeV();
+ }
+
+ /**
+ * Compute the radiation and interaction lengths for each layer of this subdetector.
+ * FIXME Access to the dedx information by material name should be moved into IMaterial
+ * interface because map is duplicated across subdetectors. The map could also be
+ * made static.
+ */
+ private void computeLayerParameters()
+ {
+ //System.out.println("nlayers = " + this.getLayering().getNumberOfLayers());
+
+ //IMaterialStore ms = MaterialStore.getInstance();
+ int nlayers = this.getNumberOfLayers();
+ Hep3Vector p = new BasicHep3Vector( 0., 0., 100. );
+ for (int j = 0; j < nlayers; j++)
+ {
+ //System.out.println("computing layer = " + j);
+ Layer layer = getLayering().getLayer( j );
+ double xrad = 0.;
+ double xlam = 0.;
+ double xde = 0.;
+ for (LayerSlice slice : layer.getSlices())
+ {
+ Material m = slice.getMaterial();
+ String materialName = m.getName();
+ //String materialName = slice.getMaterial().getName();
+ //Material m = ms.get( materialName );
+ //if (m == null)
+ // throw new RuntimeException( "Material <" + materialName + "> not found.");
+ double dedx;
+ if (dedxmap.containsKey( materialName ))
+ dedx = dedxmap.get( materialName ).doubleValue();
+ else
+ {
+ //dedx = BetheBlochCalculator.computeBetheBloch( m, p, 105., 1., .01 ) / 10000.;
+ //BetheBlochCalculator.computeBetheBloch( material, p, mass, charge, distance )
+
+ // Kludge to get material state to avoid using IMaterial objects that are not
+ // instantiated yet.
+ MaterialState state = m.getState();
+ IMaterial.State istate = null;
+ if (state == MaterialState.GAS)
+ {
+ istate = IMaterial.Gas;
+ }
+ else if (state == MaterialState.LIQUID)
+ {
+ istate = IMaterial.Liquid;
+ }
+ else if (state == MaterialState.SOLID)
+ {
+ istate = IMaterial.Solid;
+ }
+ else if (state == MaterialState.UNKNOWN)
+ {
+ istate = IMaterial.Unknown;
+ }
+ dedx = BetheBlochCalculator.computeBetheBloch(m.getZeff(), m.getAeff(), m.getDensity(), istate, m.getPressure(), m.getTemperature(), p, 105., 1., .01 ) / 10000;
+ dedxmap.put( materialName, new Double( dedx ) );
+ }
+ double dx = slice.getThickness();
+ xrad += dx / m.getRadiationLengthWithDensity();
+ xlam += dx / m.getNuclearInteractionLengthWithDensity();
+ xde += dx * dedx;
+ }
+ nrad.add( j, new Double( xrad / 10. ) );
+ nlam.add( j, new Double( xlam / 10. ) );
+ de.add( j, new Double( xde ) );
+ }
+ }
+
+ public double getNumberOfInteractionLengths( int layern )
+ {
+ return nlam.get( layern );
+ }
+
+ public double getNumberOfRadiationLengths( int layern )
+ {
+ return nrad.get( layern );
+ }
+
+ public double getDe( int layern )
+ {
+ return de.get( layern );
+ }
}
\ No newline at end of file
GeomConverter/src/org/lcsim/geometry/subdetector
diff -u -r1.5 -r1.6
--- AbstractLayeredSubdetector.java 8 Mar 2007 20:04:38 -0000 1.5
+++ AbstractLayeredSubdetector.java 17 Nov 2010 00:13:44 -0000 1.6
@@ -7,51 +7,98 @@
package org.lcsim.geometry.subdetector;
-import org.lcsim.geometry.Layered;
-import org.lcsim.geometry.layer.Layering;
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Vector;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
import org.jdom.Element;
import org.jdom.JDOMException;
+import org.lcsim.detector.material.BetheBlochCalculator;
+import org.lcsim.detector.material.IMaterial;
+import org.lcsim.detector.material.IMaterialStore;
+import org.lcsim.detector.material.MaterialStore;
+import org.lcsim.geometry.Calorimeter;
+import org.lcsim.geometry.Layered;
+import org.lcsim.geometry.layer.Layer;
+import org.lcsim.geometry.layer.LayerSlice;
+import org.lcsim.geometry.layer.Layering;
/**
- *
+ *
* @author jeremym
*/
-abstract class AbstractLayeredSubdetector extends AbstractSubdetector
- implements Layered
+abstract class AbstractLayeredSubdetector extends AbstractSubdetector implements Layered
{
protected Layering layering;
-
- /** Creates a new instance of a LayeredSubdetector */
- public AbstractLayeredSubdetector(Element node) throws JDOMException
- {
- super(node);
- build(node);
- }
-
- private void build(Element node) throws JDOMException
- {
- try {
- //System.out.println("build layering for <"+getName()+">");
- layering = org.lcsim.geometry.layer.Layering.makeLayering(node);
- }
- catch (JDOMException x)
- {
- System.err.println("WARNING: " + x.getMessage());
- }
+
+ /**
+ * Creates a new instance of a LayeredSubdetector
+ */
+ public AbstractLayeredSubdetector( Element node) throws JDOMException
+ {
+ super( node );
+ build( node );
}
-
+
+ private void build( Element node ) throws JDOMException
+ {
+ try
+ {
+ // Setup layering object.
+ layering = org.lcsim.geometry.layer.Layering.makeLayering( node );
+ }
+ catch (JDOMException x)
+ {
+ throw new RuntimeException( x );
+ }
+ }
+
public boolean isLayered()
{
return true;
}
-
+
public Layering getLayering()
{
return layering;
}
-
- public void setLayering(Layering layering)
+
+ protected void setLayering( Layering layering )
+ {
+ this.layering = layering;
+ }
+
+ public Layer getLayer( int layern )
+ {
+ return this.layering.getLayer( layern );
+ }
+
+ public int getNumberOfLayers()
+ {
+ return this.layering.getLayerCount();
+ }
+
+ public double getDistanceToLayer( int layern )
+ {
+ return this.layering.getDistanceToLayer( layern );
+ }
+
+ public double getDistanceToSensor( int layern )
+ {
+ return this.layering.getDistanceToLayerSensorFront( layern );
+ }
+
+ public double getLayerThickness( int layern )
+ {
+ return this.layering.getLayer( layern ).getThickness();
+ }
+
+ public double getSensorThickness( int layern )
{
- this.layering = layering;
+ return this.layering.getLayer( layern ).getSensorThickness();
}
}
\ No newline at end of file
GeomConverter/src/org/lcsim/geometry/subdetector
diff -u -r1.11 -r1.12
--- AbstractPolyhedraCalorimeter.java 14 Apr 2010 02:06:30 -0000 1.11
+++ AbstractPolyhedraCalorimeter.java 17 Nov 2010 00:13:44 -0000 1.12
@@ -83,14 +83,14 @@
// Parameters for Pandora.
- public double getInnerNumberOfSides()
+ public int getInnerNumberOfSides()
{
return this.getNumberOfSides();
}
public double getInnerPhi()
{
- return 0.;
+ return getSectionPhi();
}
public double getInnerRadius()
@@ -103,14 +103,14 @@
return this.getZMin();
}
- public double getOuterNumberOfSides()
+ public int getOuterNumberOfSides()
{
return this.getNumberOfSides();
}
public double getOuterPhi()
{
- return 0.;
+ return getSectionPhi();
}
public double getOuterRadius()
GeomConverter/src/org/lcsim/geometry/subdetector
diff -u -r1.6 -r1.7
--- AbstractTestBeam.java 11 Mar 2010 19:26:49 -0000 1.6
+++ AbstractTestBeam.java 17 Nov 2010 00:13:44 -0000 1.7
@@ -28,6 +28,7 @@
double x;
double y;
double z;
+ double r;
Hep3Vector position;
@@ -138,4 +139,71 @@
factory.createHepRepPoint(instance, x2, y2, z2);
factory.createHepRepPoint(instance, x2, y1, z2);
}
+
+ /**
+ * All TestBeams currently existing in GeomConverter have box envelopes, so numberOfSides is always 4.
+ * If this changes, then this method will need to take that into account.
+ * @return
+ */
+ public int getNumberOfSides()
+ {
+ return 4;
+ }
+
+ public int getInnerNumberOfSides()
+ {
+ return 4;
+ }
+
+ public int getOuterNumberOfSides()
+ {
+ return 4;
+ }
+
+ public double getInnerPhi()
+ {
+ return (Math.PI) / 2;
+ }
+
+ public double getOuterPhi()
+ {
+ return (Math.PI) / 2;
+ }
+
+ /**
+ * FIXME Not adjusted for position.
+ * @return
+ */
+ public double getInnerZ()
+ {
+ return -(z / 2);
+ }
+
+ /**
+ * FIXME Not adjusted for position.
+ * @return
+ */
+ public double getOuterZ()
+ {
+ return z / 2;
+ }
+
+ public double getOuterRadius()
+ {
+ if (r == 0)
+ {
+ r = Math.sqrt(Math.pow(x/2, 2) + Math.pow(y/2, 2));
+ }
+ return r;
+ }
+
+ public double getInnerRadius()
+ {
+ return 0;
+ }
+
+ public double getZLength()
+ {
+ return z;
+ }
}
\ No newline at end of file
GeomConverter/src/org/lcsim/geometry/subdetector
diff -u -r1.9 -r1.10
--- CylindricalBarrelCalorimeter.java 12 Sep 2006 02:42:49 -0000 1.9
+++ CylindricalBarrelCalorimeter.java 17 Nov 2010 00:13:44 -0000 1.10
@@ -65,4 +65,9 @@
factory.createHepRepPoint(instance2,0,0,getZMin());
factory.createHepRepPoint(instance2,0,0,getZMax());
}
+
+ public double getZLength()
+ {
+ return this.maxZ * 2;
+ }
}
GeomConverter/src/org/lcsim/geometry/subdetector
diff -u -r1.15 -r1.16
--- CylindricalCalorimeter.java 8 Mar 2007 20:04:38 -0000 1.15
+++ CylindricalCalorimeter.java 17 Nov 2010 00:13:44 -0000 1.16
@@ -43,6 +43,16 @@
return maxZ;
}
+ public double getOuterZ()
+ {
+ return getZMax();
+ }
+
+ public double getInnerZ()
+ {
+ return getZMin();
+ }
+
public double getOuterRadius()
{
return outerR;
@@ -52,4 +62,24 @@
{
return innerR;
}
+
+ public int getInnerNumberOfSides()
+ {
+ return 0;
+ }
+
+ public int getOuterNumberOfSides()
+ {
+ return 0;
+ }
+
+ public double getInnerPhi()
+ {
+ return Math.PI/2;
+ }
+
+ public double getOuterPhi()
+ {
+ return Math.PI/2;
+ }
}
\ No newline at end of file
GeomConverter/src/org/lcsim/geometry/subdetector
diff -u -r1.19 -r1.20
--- CylindricalEndcapCalorimeter.java 12 Sep 2006 02:42:49 -0000 1.19
+++ CylindricalEndcapCalorimeter.java 17 Nov 2010 00:13:44 -0000 1.20
@@ -92,4 +92,9 @@
return globPos;
}
+
+ public double getZLength()
+ {
+ return this.maxZ - this.minZ;
+ }
}
GeomConverter/src/org/lcsim/geometry/subdetector
diff -u -r1.1 -r1.2
--- CylindricalEndcapCalorimeter2.java 23 Sep 2010 22:58:03 -0000 1.1
+++ CylindricalEndcapCalorimeter2.java 17 Nov 2010 00:13:44 -0000 1.2
@@ -22,4 +22,9 @@
private void build(Element node) throws JDOMException
{}
+
+ public double getZLength()
+ {
+ return this.maxZ - this.minZ;
+ }
}
\ No newline at end of file
GeomConverter/src/org/lcsim/geometry/subdetector
diff -u -r1.9 -r1.10
--- TestBeamCalorimeter.java 9 Dec 2009 01:38:29 -0000 1.9
+++ TestBeamCalorimeter.java 17 Nov 2010 00:13:44 -0000 1.10
@@ -3,7 +3,7 @@
import org.jdom.Element;
import org.jdom.JDOMException;
import org.lcsim.geometry.Calorimeter;
-import org.lcsim.geometry.Calorimeter.CalorimeterType;
+import org.lcsim.geometry.compact.Segmentation;
/**
* @author Jeremy McCormick
@@ -22,13 +22,27 @@
}
}
+ // FIXME Duplicate implementation w.r.t. AbstractCalorimeter.
public boolean isCalorimeter()
{
return true;
}
-
+
+ // FIXME Duplicate implementation w.r.t. AbstractCalorimeter.
public CalorimeterType getCalorimeterType()
{
return calType;
}
+
+ // FIXME Duplicate implementation w.r.t. AbstractCalorimeter.
+ public double getCellSizeU()
+ {
+ return ((Segmentation)this.getIDDecoder()).getCellSizeU();
+ }
+
+ // FIXME Duplicate implementation w.r.t. AbstractCalorimeter.
+ public double getCellSizeV()
+ {
+ return ((Segmentation)this.getIDDecoder()).getCellSizeV();
+ }
}
\ No newline at end of file
GeomConverter/src/org/lcsim/geometry/subdetector
diff -u -r1.2 -r1.3
--- TestBeamTracker.java 7 Feb 2006 17:14:32 -0000 1.2
+++ TestBeamTracker.java 17 Nov 2010 00:13:44 -0000 1.3
@@ -1,10 +1,3 @@
-/*
- * TestBeamCalorimeter.java
- *
- * Created on September 2, 2005, 3:43 PM
- *
- */
-
package org.lcsim.geometry.subdetector;
import org.lcsim.geometry.Tracker;
@@ -23,11 +16,6 @@
super(node);
}
-// public org.lcsim.geometry.TrackerIDDecoder getTrackerIDDecoder()
-// {
-// return (org.lcsim.geometry.TrackerIDDecoder)(getReadout().getIDDecoder() );
-// }
-
public boolean isTracker()
{
return true;
GeomConverter/src/org/lcsim/geometry/util
diff -u -r1.17 -r1.18
--- BaseIDDecoder.java 5 Feb 2010 20:27:12 -0000 1.17
+++ BaseIDDecoder.java 17 Nov 2010 00:13:44 -0000 1.18
@@ -1,10 +1,3 @@
-/*
- * BaseIDDecoder.java
- *
- * Created on September 27, 2005, 10:18 PM
- *
- */
-
package org.lcsim.geometry.util;
import hep.physics.vec.Hep3Vector;
@@ -19,6 +12,7 @@
* classes for functionality.
*
* @author jeremym
+ * @version $Id: BaseIDDecoder.java,v 1.18 2010/11/17 00:13:44 jeremy Exp $
*/
public class BaseIDDecoder
implements org.lcsim.geometry.IDDecoder
CVSspam 0.2.8