GeomConverter/src/org/lcsim/geometry/subdetector
diff -u -r1.4 -r1.5
--- AbstractPolyhedraCalorimeter.java 2 Sep 2005 19:34:46 -0000 1.4
+++ AbstractPolyhedraCalorimeter.java 7 Mar 2006 01:06:38 -0000 1.5
@@ -9,6 +9,16 @@
import org.jdom.Element;
import org.jdom.JDOMException;
import static java.lang.Math.PI;
+import static java.lang.Math.cos;
+import static java.lang.Math.sin;
+import static java.lang.Math.tan;
+
+import hep.graphics.heprep.HepRep;
+import hep.graphics.heprep.HepRepFactory;
+import hep.graphics.heprep.HepRepInstance;
+import hep.graphics.heprep.HepRepInstanceTree;
+import hep.graphics.heprep.HepRepType;
+import hep.graphics.heprep.HepRepTypeTree;
/**
*
@@ -74,4 +84,70 @@
{
return getSectionPhi() / 2;
}
+
+ 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");
+
+ 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 z = this.getZLength() / 2;
+
+ 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<getNumberOfSides(); i++)
+ {
+ 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);
+
+ /* +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);
+ factory.createHepRepPoint(instance, ix1, iy1, -z);
+
+ phi += getSectionPhi();
+ }
+ }
}
\ No newline at end of file
GeomConverter/src/org/lcsim/geometry/subdetector
diff -u -r1.2 -r1.3
--- EcalBarrel.java 15 Feb 2006 00:03:13 -0000 1.2
+++ EcalBarrel.java 7 Mar 2006 01:06:38 -0000 1.3
@@ -4,11 +4,10 @@
import org.jdom.JDOMException;
// FIXME: needs implementation!
-public class EcalBarrel extends AbstractCalorimeter
+public class EcalBarrel extends PolyhedraBarrelCalorimeter
{
public EcalBarrel(Element element) throws JDOMException
{
super(element);
-// System.out.println("EcalBarrel ctor");
}
}
GeomConverter/src/org/lcsim/geometry/subdetector
diff -u -r1.2 -r1.3
--- PolyhedraEndcapCalorimeter.java 2 Sep 2005 19:35:53 -0000 1.2
+++ PolyhedraEndcapCalorimeter.java 7 Mar 2006 01:06:38 -0000 1.3
@@ -57,7 +57,7 @@
return zmax;
}
- public void appendHepRep(HepRepFactory factory, HepRep heprep)
+ /* public void appendHepRep(HepRepFactory factory, HepRep heprep)
{
HepRepInstanceTree instanceTree = heprep.getInstanceTreeTop("Detector","1.0");
HepRepTypeTree typeTree = heprep.getTypeTree("DetectorType","1.0");
@@ -68,7 +68,7 @@
HepRepInstance instance = factory.createHepRepInstance(instanceTree, type);
- /* compute section (x,y) coordinates */
+ compute section (x,y) coordinates
double rmin = getInnerR();
double x1 = rmin * tan(getHalfSectionPhi());
@@ -88,9 +88,9 @@
double x3 = -x4;
double y3 = y4;
- /*
+
* Place nsides sections by applying matrix transform to starting coordinates.
- */
+
double phi = 0;
double flip = 1;
for (;;)
@@ -111,13 +111,13 @@
double ix4 = x4 * cos(phi) - y4 * sin(phi);
double iy4 = x4 * sin(phi) + y4 * cos(phi);
- /* +z face */
+ +z face
factory.createHepRepPoint(instance, ix1, iy1, flip*z1);
factory.createHepRepPoint(instance, ix2, iy2, flip*z1);
factory.createHepRepPoint(instance, ix3, iy3, flip*z1);
factory.createHepRepPoint(instance, ix4, iy4, flip*z1);
- /* -z face */
+ -z face
factory.createHepRepPoint(instance, ix4, iy4, flip*z2);
factory.createHepRepPoint(instance, ix3, iy3, flip*z2);
factory.createHepRepPoint(instance, ix2, iy2, flip*z2);
@@ -128,5 +128,5 @@
if (!getReflect() || flip<0) break;
flip = -1;
}
- }
+ }*/
}
\ No newline at end of file