3 modified files
GeomConverter/src/org/lcsim/geometry/compact
diff -u -r1.22 -r1.23
--- Subdetector.java 18 Nov 2009 22:11:44 -0000 1.22
+++ Subdetector.java 18 Nov 2009 22:20:15 -0000 1.23
@@ -14,72 +14,67 @@
* @author Tony Johnson <[log in to unmask]>
* @author Jeremy McCormick <[log in to unmask]>
*/
-public class Subdetector
-implements org.lcsim.geometry.Subdetector
+public class Subdetector implements org.lcsim.geometry.Subdetector
{
- // FIXME: Why is reflect a general attribute of Subdetector? It only makes
- // sense for endcaps!
- // Make default setting true so that when it isn't set, we get two endcaps as expected.
+ // FIXME: Why is reflect a general attribute of Subdetector? It only makes
+ // sense for endcaps!
+ // Make default setting true so that when it isn't set, we get two endcaps as expected.
private boolean reflect = true;
-
+
private Readout readout;
- private String name;
- private int systemID;
+ private String name;
+ private int systemID;
//private ParameterSet _parameters;
private VisAttributes vis;
private Element node;
private IDetectorElement de;
- private boolean insideTrackingVolume=false;
-
+ private boolean insideTrackingVolume = false;
+
protected Subdetector(Element element) throws JDOMException
- {
- //super(element.getAttributeValue("name"));
-
+ {
+ //super(element.getAttributeValue("name"));
+
node = element;
-
- name = element.getAttributeValue("name");
-
+
+ name = element.getAttributeValue("name");
+
Attribute r = element.getAttribute("reflect");
- reflect = r != null && r.getBooleanValue();
-
+ reflect = r != null && r.getBooleanValue();
+
// Don't need a null check on id, as the compact schema include a default of 0.
systemID = element.getAttribute("id").getIntValue();
-
+
// Check if inside tracking volume.
- Attribute insideAttrib = node.getAttribute("insideTrackingVolume");
+ Attribute insideAttrib = node.getAttribute("insideTrackingVolume");
try
{
- if ( insideAttrib == null )
+ if (insideAttrib == null)
{
- if ( isTracker() )
+ if (isTracker())
{
- insideTrackingVolume = true;
- }
- else
+ insideTrackingVolume = true;
+ } else
{
- insideTrackingVolume = false;
+ insideTrackingVolume = false;
}
- }
- else
+ } else
{
- insideTrackingVolume = insideAttrib.getBooleanValue();
+ insideTrackingVolume = insideAttrib.getBooleanValue();
}
- }
- catch (org.jdom.DataConversionException dce)
+ } catch (org.jdom.DataConversionException dce)
{
throw new RuntimeException("Error converting insideTrackingVolume attribute.", dce);
- }
+ }
}
-
+
protected void setReadout(Readout r)
{
// Require a valid system id.
if (systemID == 0)
- throw new RuntimeException("The detector " + getName() + " cannot have a readout" +
- " because it does not have a valid system id.");
+ throw new RuntimeException("The detector " + getName() + " cannot have a readout" + " because it does not have a valid system id.");
this.readout = r;
}
-
+
/**
* Get the readout associated with this detector.
*
@@ -89,7 +84,7 @@
{
return readout;
}
-
+
/*
public void setParameters(ParameterSet parameters)
{
@@ -100,13 +95,13 @@
{
return _parameters;
}
- */
-
+ */
+
public IDDecoder getIDDecoder()
{
return getReadout().getIDDecoder();
}
-
+
public String getName()
{
return name;
@@ -114,10 +109,10 @@
public int getSystemID()
{
- return(systemID);
+ return (systemID);
}
-
- public boolean isBarrel()
+
+ public boolean isBarrel()
{
return false;
}
@@ -141,7 +136,7 @@
{
return false;
}
-
+
public double[] transformLocalToGlobal(double[] locPos)
{
return locPos;
@@ -154,36 +149,36 @@
public Layering getLayering()
{
- throw new RuntimeException("layers not implemented");
+ throw new RuntimeException("layers not implemented");
}
-
+
public void setVisAttributes(VisAttributes vis)
{
- this.vis = vis;
+ this.vis = vis;
}
-
+
public VisAttributes getVisAttributes()
{
- return this.vis;
+ return this.vis;
}
-
+
public Element getNode()
{
return node;
}
-
+
public IDetectorElement getDetectorElement()
{
- return de;
+ return de;
}
-
+
public void setDetectorElement(IDetectorElement de)
{
- this.de = de;
+ this.de = de;
}
-
+
public boolean isInsideTrackingVolume()
{
- return insideTrackingVolume;
+ return insideTrackingVolume;
}
}
\ No newline at end of file
GeomConverter/src/org/lcsim/geometry/subdetector
diff -u -r1.12 -r1.13
--- PolyhedraEndcapCalorimeter.java 18 Nov 2009 22:11:25 -0000 1.12
+++ PolyhedraEndcapCalorimeter.java 18 Nov 2009 22:20:15 -0000 1.13
@@ -20,119 +20,121 @@
import org.jdom.JDOMException;
/**
- *
+ *
* @author jeremym
*/
public class PolyhedraEndcapCalorimeter extends AbstractPolyhedraCalorimeter
{
- private double zmin;
- private double zmax;
+ private double zmin;
+ private double zmax;
- public PolyhedraEndcapCalorimeter(Element node) throws JDOMException
- {
- super(node);
- build(node);
- }
-
- private void build(Element node) throws JDOMException
- {
- double thickness = getLayering().getThickness();
- zlength = thickness;
-
- Element dimensions = node.getChild("dimensions");
-
- zmin = dimensions.getAttribute("zmin").getDoubleValue();
- zmax = zmin + thickness;
-
- irad = dimensions.getAttribute("rmin").getDoubleValue();
- orad = dimensions.getAttribute("rmax").getDoubleValue();
- }
-
- public double getZMin()
- {
- return zmin;
- }
-
- public double getZMax()
- {
- return zmax;
- }
-
- 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;
- }
+ public PolyhedraEndcapCalorimeter(Element node) throws JDOMException
+ {
+ super(node);
+ build(node);
+ }
+
+ private void build(Element node) throws JDOMException
+ {
+ double thickness = getLayering().getThickness();
+ zlength = thickness;
+
+ Element dimensions = node.getChild("dimensions");
+
+ zmin = dimensions.getAttribute("zmin").getDoubleValue();
+ zmax = zmin + thickness;
+
+ irad = dimensions.getAttribute("rmin").getDoubleValue();
+ orad = dimensions.getAttribute("rmax").getDoubleValue();
+ }
+
+ public double getZMin()
+ {
+ return zmin;
+ }
+
+ public double getZMax()
+ {
+ return zmax;
+ }
+
+ 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;
+ }
}
\ No newline at end of file
GeomConverter/src/org/lcsim/geometry/subdetector
diff -u -r1.4 -r1.5
--- PolyhedraEndcapCalorimeter2.java 18 Nov 2009 22:11:25 -0000 1.4
+++ PolyhedraEndcapCalorimeter2.java 18 Nov 2009 22:20:15 -0000 1.5
@@ -15,112 +15,115 @@
public class PolyhedraEndcapCalorimeter2 extends AbstractPolyhedraCalorimeter
{
- private double zmin;
- private double zmax;
-
+ private double zmin;
+ private double zmax;
+
public PolyhedraEndcapCalorimeter2(Element node) throws JDOMException
{
super(node);
- build(node);
+ build(node);
}
-
- private void build(Element node) throws JDOMException
- {
- double thickness = getLayering().getThickness();
- zlength = thickness;
-
- Element dimensions = node.getChild("dimensions");
-
- zmin = dimensions.getAttribute("zmin").getDoubleValue();
- zmax = zmin + thickness;
-
- irad = dimensions.getAttribute("rmin").getDoubleValue();
- orad = dimensions.getAttribute("rmax").getDoubleValue();
- }
-
- public double getZMin()
- {
- return zmin;
- }
-
- public double getZMax()
- {
- return zmax;
- }
-
- 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;
- }
- }
-
+
+ private void build(Element node) throws JDOMException
+ {
+ double thickness = getLayering().getThickness();
+ zlength = thickness;
+
+ Element dimensions = node.getChild("dimensions");
+
+ zmin = dimensions.getAttribute("zmin").getDoubleValue();
+ zmax = zmin + thickness;
+
+ irad = dimensions.getAttribute("rmin").getDoubleValue();
+ orad = dimensions.getAttribute("rmax").getDoubleValue();
+ }
+
+ public double getZMin()
+ {
+ return zmin;
+ }
+
+ public double getZMax()
+ {
+ return zmax;
+ }
+
+ 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;
CVSspam 0.2.8