GeomConverter/src/org/lcsim/geometry/subdetector
diff -u -r1.15 -r1.16
--- AbstractPolyhedraCalorimeter.java 3 Dec 2010 01:21:38 -0000 1.15
+++ AbstractPolyhedraCalorimeter.java 30 Jan 2012 13:43:47 -0000 1.16
@@ -9,19 +9,18 @@
import org.lcsim.detector.converter.heprep.DetectorElementToHepRepConverter;
/**
- * This class provides common implementation of methods for calorimeters with a polyhedra
- * topology.
+ * This class provides common implementation of methods for calorimeters with a polyhedra topology.
*
* @see org.lcsim.geometry.Calorimeter
* @see org.lcsim.geometry.subdetector.AbstractCalorimeter
*
* @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: AbstractPolyhedraCalorimeter.java,v 1.15 2010/12/03 01:21:38 jeremy Exp $
+ * @version $Id: AbstractPolyhedraCalorimeter.java,v 1.16 2012/01/30 13:43:47 jeremy Exp $
*/
// TODO Remove duplicate methods (e.g. methods added for Pandora output).
public class AbstractPolyhedraCalorimeter extends AbstractCalorimeter
{
- public AbstractPolyhedraCalorimeter( Element node ) throws JDOMException
+ public AbstractPolyhedraCalorimeter( Element node) throws JDOMException
{
super( node );
build( node );
@@ -32,10 +31,15 @@
Element dimensions = node.getChild( "dimensions" );
nsides = dimensions.getAttribute( "numsides" ).getIntValue();
- sectionPhi = ( 2. * PI ) / ( ( double ) nsides );
-
+ sectionPhi = (2. * PI) / ((double) nsides);
+
// Additional parameters are read by subclasses.
}
+
+ protected final double computeBarrelOuterRadius()
+ {
+ return (getInnerRadius() + getLayering().getThickness())/(Math.cos(Math.PI/getNumberOfSides()));
+ }
public int getNumberOfSides()
{
@@ -79,13 +83,10 @@
// Old HepRep method. Keep here for reference. --JM
/*
- * public void appendHepRep(HepRepFactory factory, HepRep heprep) { HepRepInstanceTree
- * instanceTree = heprep.getInstanceTreeTop("Detector","1.0"); HepRepTypeTree typeTree
- * = heprep.getTypeTree("DetectorType","1.0"); HepRepType barrel =
- * typeTree.getType("Barrel");
+ * public void appendHepRep(HepRepFactory factory, HepRep heprep) { HepRepInstanceTree instanceTree = heprep.getInstanceTreeTop("Detector","1.0"); HepRepTypeTree typeTree =
+ * heprep.getTypeTree("DetectorType","1.0"); HepRepType barrel = typeTree.getType("Barrel");
*
- * HepRepType type = factory.createHepRepType(barrel, getName());
- * type.addAttValue("drawAs","Polygon");
+ * HepRepType type = factory.createHepRepType(barrel, getName()); type.addAttValue("drawAs","Polygon");
*
* setHepRepColor(type);
*
@@ -105,43 +106,29 @@
*
* double x3 = -x4; double y3 = y4;
*
- * // Place nsides sections by applying matrix transform to starting coordinates.
- * double phi = 0; for ( int i=0; i<getNumberOfSides(); i++) { instance =
- * factory.createHepRepInstance(instanceTree, type);
+ * // Place nsides sections by applying matrix transform to starting coordinates. double phi = 0; for ( int i=0; i<getNumberOfSides(); i++) { instance = factory.createHepRepInstance(instanceTree,
+ * type);
*
- * double ix1 = x1 * cos(phi) - y1 * sin(phi); double iy1 = x1 * sin(phi) + y1 *
- * cos(phi);
+ * double ix1 = x1 * cos(phi) - y1 * sin(phi); double iy1 = x1 * sin(phi) + y1 * cos(phi);
*
- * double ix2 = x2 * cos(phi) - y2 * sin(phi); double iy2 = x2 * sin(phi) + y2 *
- * cos(phi);
+ * double ix2 = x2 * cos(phi) - y2 * sin(phi); double iy2 = x2 * sin(phi) + y2 * cos(phi);
*
- * double ix3 = x3 * cos(phi) - y3 * sin(phi); double iy3 = x3 * sin(phi) + y3 *
- * cos(phi);
+ * double ix3 = x3 * cos(phi) - y3 * sin(phi); double iy3 = x3 * sin(phi) + y3 * cos(phi);
*
- * double ix4 = x4 * cos(phi) - y4 * sin(phi); double iy4 = x4 * sin(phi) + y4 *
- * cos(phi);
+ * double ix4 = x4 * cos(phi) - y4 * sin(phi); double iy4 = x4 * sin(phi) + y4 * cos(phi);
*
- * // +z face factory.createHepRepPoint(instance, ix1, iy1, z);
- * factory.createHepRepPoint(instance, ix2, iy2, z);
- * factory.createHepRepPoint(instance, ix3, iy3, z);
+ * // +z face factory.createHepRepPoint(instance, ix1, iy1, z); factory.createHepRepPoint(instance, ix2, iy2, z); factory.createHepRepPoint(instance, ix3, iy3, z);
* factory.createHepRepPoint(instance, ix4, iy4, z);
*
- * // -z face factory.createHepRepPoint(instance, ix4, iy4, -z);
- * factory.createHepRepPoint(instance, ix3, iy3, -z);
- * factory.createHepRepPoint(instance, ix2, iy2, -z);
+ * // -z face factory.createHepRepPoint(instance, ix4, iy4, -z); factory.createHepRepPoint(instance, ix3, iy3, -z); factory.createHepRepPoint(instance, ix2, iy2, -z);
* factory.createHepRepPoint(instance, ix1, iy1, -z);
*
* phi += getSectionPhi(); } }
*
- * // Static version for subclasses. public static final void
- * appendHepRep(AbstractPolyhedraCalorimeter cal, HepRepFactory factory, HepRep
- * heprep) { HepRepInstanceTree instanceTree =
- * heprep.getInstanceTreeTop("Detector","1.0"); HepRepTypeTree typeTree =
- * heprep.getTypeTree("DetectorType","1.0"); HepRepType barrel =
- * typeTree.getType("Barrel");
+ * // Static version for subclasses. public static final void appendHepRep(AbstractPolyhedraCalorimeter cal, HepRepFactory factory, HepRep heprep) { HepRepInstanceTree instanceTree =
+ * heprep.getInstanceTreeTop("Detector","1.0"); HepRepTypeTree typeTree = heprep.getTypeTree("DetectorType","1.0"); HepRepType barrel = typeTree.getType("Barrel");
*
- * HepRepType type = factory.createHepRepType(barrel, cal.getName());
- * type.addAttValue("drawAs","Polygon");
+ * HepRepType type = factory.createHepRepType(barrel, cal.getName()); type.addAttValue("drawAs","Polygon");
*
* cal.setHepRepColor(type);
*
@@ -161,30 +148,21 @@
*
* double x3 = -x4; double y3 = y4;
*
- * // Place nsides sections by applying matrix transform to starting coordinates.
- * double phi = 0; for ( int i=0; i<cal.getNumberOfSides(); i++) { instance =
+ * // Place nsides sections by applying matrix transform to starting coordinates. double phi = 0; for ( int i=0; i<cal.getNumberOfSides(); i++) { instance =
* factory.createHepRepInstance(instanceTree, type);
*
- * double ix1 = x1 * cos(phi) - y1 * sin(phi); double iy1 = x1 * sin(phi) + y1 *
- * cos(phi);
+ * double ix1 = x1 * cos(phi) - y1 * sin(phi); double iy1 = x1 * sin(phi) + y1 * cos(phi);
*
- * double ix2 = x2 * cos(phi) - y2 * sin(phi); double iy2 = x2 * sin(phi) + y2 *
- * cos(phi);
+ * double ix2 = x2 * cos(phi) - y2 * sin(phi); double iy2 = x2 * sin(phi) + y2 * cos(phi);
*
- * double ix3 = x3 * cos(phi) - y3 * sin(phi); double iy3 = x3 * sin(phi) + y3 *
- * cos(phi);
+ * double ix3 = x3 * cos(phi) - y3 * sin(phi); double iy3 = x3 * sin(phi) + y3 * cos(phi);
*
- * double ix4 = x4 * cos(phi) - y4 * sin(phi); double iy4 = x4 * sin(phi) + y4 *
- * cos(phi);
+ * double ix4 = x4 * cos(phi) - y4 * sin(phi); double iy4 = x4 * sin(phi) + y4 * cos(phi);
*
- * // +z face factory.createHepRepPoint(instance, ix1, iy1, z);
- * factory.createHepRepPoint(instance, ix2, iy2, z);
- * factory.createHepRepPoint(instance, ix3, iy3, z);
+ * // +z face factory.createHepRepPoint(instance, ix1, iy1, z); factory.createHepRepPoint(instance, ix2, iy2, z); factory.createHepRepPoint(instance, ix3, iy3, z);
* factory.createHepRepPoint(instance, ix4, iy4, z);
*
- * // -z face factory.createHepRepPoint(instance, ix4, iy4, -z);
- * factory.createHepRepPoint(instance, ix3, iy3, -z);
- * factory.createHepRepPoint(instance, ix2, iy2, -z);
+ * // -z face factory.createHepRepPoint(instance, ix4, iy4, -z); factory.createHepRepPoint(instance, ix3, iy3, -z); factory.createHepRepPoint(instance, ix2, iy2, -z);
* factory.createHepRepPoint(instance, ix1, iy1, -z);
*
* phi += cal.getSectionPhi(); } }
GeomConverter/src/org/lcsim/geometry/subdetector
diff -u -r1.19 -r1.20
--- PolyhedraEndcapCalorimeter.java 26 Jan 2011 01:11:57 -0000 1.19
+++ PolyhedraEndcapCalorimeter.java 30 Jan 2012 13:43:47 -0000 1.20
@@ -14,7 +14,7 @@
/**
* @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: PolyhedraEndcapCalorimeter.java,v 1.19 2011/01/26 01:11:57 jeremy Exp $
+ * @version $Id: PolyhedraEndcapCalorimeter.java,v 1.20 2012/01/30 13:43:47 jeremy Exp $
*/
public class PolyhedraEndcapCalorimeter extends AbstractPolyhedraCalorimeter
{
@@ -37,7 +37,6 @@
innerRadius = dimensions.getAttribute( "rmin" ).getDoubleValue();
outerRadius = dimensions.getAttribute( "rmax" ).getDoubleValue();
- outerRadius = outerRadius * Math.cos( Math.PI / nsides );
// Set layering pre-offset.
getLayering().setOffset( innerZ );
@@ -46,62 +45,6 @@
public void appendHepRep( HepRepFactory factory, HepRep heprep )
{
DetectorElementToHepRepConverter.convert( getDetectorElement(), factory, heprep, 2, true, getVisAttributes().getColor() );
- /*
- * HepRepInstanceTree instanceTree = heprep.getInstanceTreeTop("Detector", "1.0");
- * HepRepTypeTree typeTree = heprep.getTypeTree("DetectorType", "1.0"); HepRepType
- * barrel = typeTree.getType("Barrel");
- *
- * HepRepType type = factory.createHepRepType(barrel, getName());
- * type.addAttValue("drawAs", "Polygon");
- *
- * setHepRepColor(type);
- *
- * HepRepInstance instance = factory.createHepRepInstance(instanceTree, type);
- *
- * // Compute section (x,y) coordinates. double rmin = getInnerR();
- *
- * double x1 = rmin * tan(this.getHalfSectionPhi()); double y1 = rmin;
- *
- * double x2 = -x1; double y2 = y1;
- *
- * double t = this.getLayering().getLayerStack().getTotalThickness(); double zin =
- * this.getZMin(); double zout = zin + t;
- *
- * double rmax = this.getOuterR();
- *
- * double x4 = rmax * tan(this.getHalfSectionPhi()); double y4 = rmax;
- *
- * double x3 = -x4; double y3 = y4;
- *
- * // Place nsides sections by applying matrix transform to starting //
- * coordinates. double phi = 0; for (int i = 0; i < 2; i++) { for (int j = 0; j <
- * getNumberOfSides(); j++) { instance =
- * factory.createHepRepInstance(instanceTree, type);
- *
- * double ix1 = x1 * cos(phi) - y1 * sin(phi); double iy1 = x1 * sin(phi) + y1 *
- * cos(phi);
- *
- * double ix2 = x2 * cos(phi) - y2 * sin(phi); double iy2 = x2 * sin(phi) + y2 *
- * cos(phi);
- *
- * double ix3 = x3 * cos(phi) - y3 * sin(phi); double iy3 = x3 * sin(phi) + y3 *
- * cos(phi);
- *
- * double ix4 = x4 * cos(phi) - y4 * sin(phi); double iy4 = x4 * sin(phi) + y4 *
- * cos(phi);
- *
- * factory.createHepRepPoint(instance, ix1, iy1, zin);
- * factory.createHepRepPoint(instance, ix2, iy2, zin);
- * factory.createHepRepPoint(instance, ix3, iy3, zin);
- * factory.createHepRepPoint(instance, ix4, iy4, zin);
- *
- * factory.createHepRepPoint(instance, ix4, iy4, zout);
- * factory.createHepRepPoint(instance, ix3, iy3, zout);
- * factory.createHepRepPoint(instance, ix2, iy2, zout);
- * factory.createHepRepPoint(instance, ix1, iy1, zout);
- *
- * phi += getSectionPhi(); } if (!getReflect()) break; zin = -zin; zout = -zout; }
- */
}
public boolean isEndcap()
GeomConverter/src/org/lcsim/geometry/subdetector
diff -u -r1.12 -r1.13
--- PolyhedraEndcapCalorimeter2.java 26 Jan 2011 01:11:58 -0000 1.12
+++ PolyhedraEndcapCalorimeter2.java 30 Jan 2012 13:43:47 -0000 1.13
@@ -9,7 +9,7 @@
/**
* @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: PolyhedraEndcapCalorimeter2.java,v 1.12 2011/01/26 01:11:58 jeremy Exp $
+ * @version $Id: PolyhedraEndcapCalorimeter2.java,v 1.13 2012/01/30 13:43:47 jeremy Exp $
*/
public class PolyhedraEndcapCalorimeter2 extends AbstractPolyhedraCalorimeter
{
@@ -29,8 +29,7 @@
innerRadius = dimensions.getAttribute( "rmin" ).getDoubleValue();
outerRadius = dimensions.getAttribute( "rmax" ).getDoubleValue();
- outerRadius = outerRadius * Math.cos( Math.PI / nsides );
-
+
// Set layering pre-offset.
getLayering().setOffset( innerZ );
}
@@ -40,64 +39,6 @@
DetectorElementToHepRepConverter.convert( this.getDetectorElement(), factory, heprep, 2, true, getVisAttributes().getColor() );
}
- /*
- * public void appendHepRep(HepRepFactory factory, HepRep heprep) { HepRepInstanceTree
- * instanceTree = heprep.getInstanceTreeTop("Detector", "1.0"); HepRepTypeTree
- * typeTree = heprep.getTypeTree("DetectorType", "1.0"); HepRepType barrel =
- * typeTree.getType("Barrel");
- *
- * HepRepType type = factory.createHepRepType(barrel, getName());
- * type.addAttValue("drawAs", "Polygon");
- *
- * setHepRepColor(type);
- *
- * HepRepInstance instance = factory.createHepRepInstance(instanceTree, type);
- *
- * // Compute section (x,y) coordinates. double rmin = getInnerR();
- *
- * double x1 = rmin * tan(this.getHalfSectionPhi()); double y1 = rmin;
- *
- * double x2 = -x1; double y2 = y1;
- *
- * double t = this.getLayering().getLayerStack().getTotalThickness(); double zin =
- * this.getZMin(); double zout = zin + t;
- *
- * double rmax = this.getOuterR();
- *
- * double x4 = rmax * tan(this.getHalfSectionPhi()); double y4 = rmax;
- *
- * double x3 = -x4; double y3 = y4;
- *
- * // Place nsides sections by applying matrix transform to starting // coordinates.
- * double phi = 0; for (int i = 0; i < 2; i++) { for (int j = 0; j <
- * getNumberOfSides(); j++) { instance = factory.createHepRepInstance(instanceTree,
- * type);
- *
- * double ix1 = x1 * cos(phi) - y1 * sin(phi); double iy1 = x1 * sin(phi) + y1 *
- * cos(phi);
- *
- * double ix2 = x2 * cos(phi) - y2 * sin(phi); double iy2 = x2 * sin(phi) + y2 *
- * cos(phi);
- *
- * double ix3 = x3 * cos(phi) - y3 * sin(phi); double iy3 = x3 * sin(phi) + y3 *
- * cos(phi);
- *
- * double ix4 = x4 * cos(phi) - y4 * sin(phi); double iy4 = x4 * sin(phi) + y4 *
- * cos(phi);
- *
- * factory.createHepRepPoint(instance, ix1, iy1, zin);
- * factory.createHepRepPoint(instance, ix2, iy2, zin);
- * factory.createHepRepPoint(instance, ix3, iy3, zin);
- * factory.createHepRepPoint(instance, ix4, iy4, zin);
- *
- * factory.createHepRepPoint(instance, ix4, iy4, zout);
- * factory.createHepRepPoint(instance, ix3, iy3, zout);
- * factory.createHepRepPoint(instance, ix2, iy2, zout);
- * factory.createHepRepPoint(instance, ix1, iy1, zout);
- *
- * phi += getSectionPhi(); } if (!getReflect()) break; zin = -zin; zout = -zout; } }
- */
-
public boolean isEndcap()
{
return true;