Commit in GeomConverter on MAIN
src/org/lcsim/geometry/compact/converter/lcdd/CylindricalEndcapCalorimeter2.java+127added 1.1
src/org/lcsim/geometry/compact/converter/lcdd/util/Cone.java+42added 1.1
src/org/lcsim/geometry/subdetector/CylindricalEndcapCalorimeter2.java+25added 1.1
testResources/org/lcsim/geometry/subdetector/CylindricalEndcapCalorimeter2Test.xml+39added 1.1
+233
4 added files
work in progress on new CylindricalEndcapCalorimeter for muon collider studies

GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
CylindricalEndcapCalorimeter2.java added at 1.1
diff -N CylindricalEndcapCalorimeter2.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ CylindricalEndcapCalorimeter2.java	23 Sep 2010 22:58:03 -0000	1.1
@@ -0,0 +1,127 @@
+package org.lcsim.geometry.compact.converter.lcdd;
+
+import org.jdom.Element;
+import org.jdom.JDOMException;
+import org.lcsim.geometry.compact.converter.lcdd.util.Cone;
+import org.lcsim.geometry.compact.converter.lcdd.util.LCDD;
+import org.lcsim.geometry.compact.converter.lcdd.util.Material;
+import org.lcsim.geometry.compact.converter.lcdd.util.PhysVol;
+import org.lcsim.geometry.compact.converter.lcdd.util.Rotation;
+import org.lcsim.geometry.compact.converter.lcdd.util.SensitiveDetector;
+import org.lcsim.geometry.compact.converter.lcdd.util.Solids;
+import org.lcsim.geometry.compact.converter.lcdd.util.Structure;
+import org.lcsim.geometry.compact.converter.lcdd.util.Tube;
+import org.lcsim.geometry.compact.converter.lcdd.util.Volume;
+import org.lcsim.geometry.layer.LayerStack;
+import org.lcsim.geometry.layer.Layering;
+
+public class CylindricalEndcapCalorimeter2 extends LCDDSubdetector
+{
+    CylindricalEndcapCalorimeter2(Element c) throws JDOMException
+    {
+        super(c);
+    }
+
+    void addToLCDD(LCDD lcdd, SensitiveDetector sens) throws JDOMException
+    {
+        // Get subdetector id and name.
+        int id = node.getAttribute("id").getIntValue();
+        String subdetectorName = node.getAttributeValue("name");
+
+        // Get important references from LCDD.
+        Material air = lcdd.getMaterial("Air");
+        Solids solids = lcdd.getSolids();
+        Structure structure = lcdd.getStructure();
+        Volume motherVolume = lcdd.pickMotherVolume(this);
+
+        // Get the subdetector dimensions.
+        Element dimensions = node.getChild("dimensions");
+        double zmin = dimensions.getAttribute("zmin").getDoubleValue();
+        double rmin = dimensions.getAttribute("rmin").getDoubleValue();
+        double rmax = dimensions.getAttribute("rmax").getDoubleValue();
+        double innerAngle = dimensions.getAttribute("angle").getDoubleValue();
+
+        // Make layering object.
+        LayerStack layers = Layering.makeLayering(this.node).getLayerStack();
+
+        // Get thickness of calorimeter in z dimension determined by layering.
+        double thickness = layers.getTotalThickness();
+
+        // Compute radius at last zplane of envelope.
+        double rmin2 = rmin + (thickness * Math.tan(innerAngle));
+
+        // Make the subdetector's envelope cone.
+        // Note: Z measurement is full length, which will be divided by two for half-length by GDML.
+        Cone envelopeCone = new Cone(subdetectorName + "_envelope_cone", rmin, rmin2, rmax, rmax, thickness);
+        solids.addSolid(envelopeCone);
+
+        // Make the calorimeter envelope volume.
+        Volume envelopeVolume = new Volume(subdetectorName + "_volume", envelopeCone, air);
+
+        // Set the absolute z coordinate of the layer front face for layer loop.
+        double layerZ = -thickness / 2;
+
+        // The rmin of the layer which will decrease along z.
+        double layerRmin = rmin;
+                
+        // Loop over and build the layers into the detector envelope.
+        for (int i = 0, l = layers.getNumberOfLayers(); i < l; i++)
+        {
+            System.out.println(" layer " + i);
+            System.out.println("  z = " + layerZ);
+            
+            // Get this layer's thickness.
+            double layerThickness = layers.getLayer(i).getThickness();
+
+            // Compute change in layer inner radius.
+            double layerdx = Math.tan(innerAngle) * layerThickness;
+
+            // Add dx to inner radius.
+            layerRmin += layerdx;
+
+            // Make layer tube.
+            // Note: This shape wants the z half-length instead of full z length. 
+            Tube layerTube = new Tube(subdetectorName + "_layer" + i + "_tube", layerRmin, rmax, layerThickness / 2);
+            solids.addSolid(layerTube);
+
+            // Make layer volume.
+            Volume layerVolume = new Volume(subdetectorName + "_layer" + i + "_volume", layerTube, air);
+
+            // TODO: Make slices loop here.
+
+                        
+            structure.addVolume(layerVolume);
+
+            // Make layer placement into envelope.
+            PhysVol layerPhysVol = new PhysVol(layerVolume);
+            layerPhysVol.addPhysVolID("layer", i);
+            System.out.println("  layerCenter = " + (layerZ + layerThickness / 2));
+            layerPhysVol.setZ(layerZ + layerThickness / 2);  
+            envelopeVolume.addPhysVol(layerPhysVol);
+
+            // Set z to edge of next layer.
+            layerZ += layerThickness;            
+        }
+
+        // Add envelope's logical volume to structure.
+        structure.addVolume(envelopeVolume);
+
+        // Make rotation for positive endcap.
+        Rotation positiveEndcapRotation = new Rotation(subdetectorName + "_rotation_positive");
+        // positiveEndcapRotation.setZ(zrot);
+        lcdd.getDefine().addRotation(positiveEndcapRotation);
+
+        // Positive endcap placement.
+        PhysVol endcapPositivePhysVol = new PhysVol(envelopeVolume);
+        endcapPositivePhysVol.addPhysVolID("system", id);
+        endcapPositivePhysVol.addPhysVolID("barrel", 1);
+        endcapPositivePhysVol.setRotation(positiveEndcapRotation);
+        //endcapPositivePhysVol.setZ(zmin + thickness / 2);
+        motherVolume.addPhysVol(endcapPositivePhysVol);
+    }
+
+    public boolean isCalorimeter()
+    {
+        return true;
+    }
+}

GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd/util
Cone.java added at 1.1
diff -N Cone.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Cone.java	23 Sep 2010 22:58:03 -0000	1.1
@@ -0,0 +1,42 @@
+package org.lcsim.geometry.compact.converter.lcdd.util;
+
+public class Cone extends Solid 
+{
+	public Cone(
+			String name, 
+			double rmin1, 
+			double rmin2, 
+			double rmax1, 
+			double rmax2, 
+			double z, 
+			double startphi, 
+			double deltaphi)
+	{
+		super("cone", name);
+		setAttribute("rmin1", String.valueOf(rmin1));
+		setAttribute("rmin2", String.valueOf(rmin2));
+		setAttribute("rmax1", String.valueOf(rmax1));
+		setAttribute("rmax2", String.valueOf(rmax2));
+		setAttribute("z", String.valueOf(z));
+		setAttribute("startphi", String.valueOf(startphi));
+		setAttribute("deltaphi", String.valueOf(deltaphi));
+	}
+	
+	public Cone(
+			String name, 
+			double rmin1, 
+			double rmin2, 
+			double rmax1, 
+			double rmax2, 
+			double z)
+	{
+		super("cone", name);
+		setAttribute("rmin1", String.valueOf(rmin1));
+		setAttribute("rmin2", String.valueOf(rmin2));
+		setAttribute("rmax1", String.valueOf(rmax1));
+		setAttribute("rmax2", String.valueOf(rmax2));
+		setAttribute("z", String.valueOf(z));
+		setAttribute("startphi", String.valueOf(0));
+		setAttribute("deltaphi", String.valueOf(Math.PI * 2));
+	}
+}
\ No newline at end of file

GeomConverter/src/org/lcsim/geometry/subdetector
CylindricalEndcapCalorimeter2.java added at 1.1
diff -N CylindricalEndcapCalorimeter2.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ CylindricalEndcapCalorimeter2.java	23 Sep 2010 22:58:03 -0000	1.1
@@ -0,0 +1,25 @@
+package org.lcsim.geometry.subdetector;
+
+import org.jdom.Element;
+import org.jdom.JDOMException;
+
+/**
+ *
+ * @author tonyj
+ */
+public class CylindricalEndcapCalorimeter2 extends CylindricalCalorimeter
+{
+    CylindricalEndcapCalorimeter2(Element node) throws JDOMException
+    {
+        super(node);
+        build(node);
+    }
+    
+    public boolean isEndcap()
+    {
+        return true;
+    }
+    
+    private void build(Element node) throws JDOMException
+    {}       
+}
\ No newline at end of file

GeomConverter/testResources/org/lcsim/geometry/subdetector
CylindricalEndcapCalorimeter2Test.xml added at 1.1
diff -N CylindricalEndcapCalorimeter2Test.xml
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ CylindricalEndcapCalorimeter2Test.xml	23 Sep 2010 22:58:03 -0000	1.1
@@ -0,0 +1,39 @@
+<lccdd xmlns:compact="http://www.lcsim.org/schemas/compact/1.0"
+       xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+       xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/compact/1.0/compact.xsd">
+
+  <info name="CylindricalEndcapCalorimeter2Test"/>
+
+  <define>
+    <constant name="world_side" value="30000" />
+    <constant name="world_x" value="world_side" />
+    <constant name="world_y" value="world_side" />
+    <constant name="world_z" value="world_side" />
+    <constant name="tracking_region_radius" value="0.1*cm"/>
+    <constant name="tracking_region_zmax" value="0.1*cm"/>
+  </define>
+
+  <materials>
+  </materials>
+
+  <detectors>
+    <detector id="1" 
+              name="EMEndcap" 
+              type="CylindricalEndcapCalorimeter2" 
+              readout="EcalEndcapHits">
+        <dimensions rmin="200.0" zmin="100.0" rmax="1250.0" angle="10.0*deg" />
+        <layer repeat="10" >
+<!--          <slice material="Silicon" thickness="20.0" sensitive="yes" />-->
+          <slice material="Tungsten" thickness="50.0" />
+        </layer>
+    </detector>
+  </detectors>
+
+  <readouts>
+         <readout name="EcalEndcapHits">
+             <segmentation type="GridXYZ" gridSizeX="10.0" gridSizeY="10.0"/>
+             <id>system:3,barrel:3,layer:7,x:32:-16,y:-16</id>
+         </readout>
+   </readouts>
+
+</lccdd>
CVSspam 0.2.8