Print

Print


Commit in GeomConverter/src/org/lcsim/geometry on MAIN
compact/converter/lcdd/PolyhedraEndcapCalorimeter2.java+132added 1.1
                      /SiTrackerEndcap.java+5-51.18 -> 1.19
subdetector/PolyhedraEndcapCalorimeter2.java+17added 1.1
+154-5
2 added + 1 modified, total 3 files
JM: work in progress on new endcap

GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
PolyhedraEndcapCalorimeter2.java added at 1.1
diff -N PolyhedraEndcapCalorimeter2.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ PolyhedraEndcapCalorimeter2.java	6 Feb 2009 16:36:23 -0000	1.1
@@ -0,0 +1,132 @@
+package org.lcsim.geometry.compact.converter.lcdd;
+
+import java.util.Iterator;
+
+import org.jdom.Element;
+import org.jdom.JDOMException;
+import org.lcsim.geometry.compact.converter.lcdd.util.Define;
+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.PolyhedraRegular;
+import org.lcsim.geometry.compact.converter.lcdd.util.Position;
+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.Volume;
+import org.lcsim.geometry.layer.LayerStack;
+import org.lcsim.geometry.layer.Layering;
+
+public class PolyhedraEndcapCalorimeter2 extends LCDDSubdetector
+{
+    public PolyhedraEndcapCalorimeter2(Element node) throws JDOMException
+    {
+        super(node);
+        this.node = node;
+    }
+
+    public void addToLCDD(LCDD lcdd, SensitiveDetector sens) throws JDOMException
+    {
+        Solids solids = lcdd.getSolids();
+        Structure structure = lcdd.getStructure();
+        Volume motherVolume = lcdd.pickMotherVolume(this);
+        Material air = lcdd.getMaterial("Air");
+        Define define = lcdd.getDefine();
+        Rotation identityRotation = define.getRotation("identity_rot");
+        
+        String subdetectorName = node.getAttributeValue("name");
+        int id = node.getAttribute("id").getIntValue();
+        
+        if (node.getChild("dimensions") == null)
+            throw new RuntimeException("PolhedraEndcapCalorimeter2 " + subdetectorName
+                    + " is missing required <dimensions> element.");        
+        
+        Element dimensions = node.getChild("dimensions");
+        double zmin = dimensions.getAttribute("zmin").getDoubleValue();
+        double rmin = dimensions.getAttribute("rmin").getDoubleValue();
+        double rmax = dimensions.getAttribute("rmax").getDoubleValue();
+        int numsides = dimensions.getAttribute("numsides").getIntValue();
+     
+        LayerStack layers = Layering.makeLayering(this.node).getLayerStack();
+        
+        double subdetectorThickness = org.lcsim.geometry.layer.LayerFromCompactCnv.computeDetectorTotalThickness(node);                        
+        double radialThickness = rmax - rmin;
+        
+        System.out.println("subdetectorThickness: " + subdetectorThickness);
+        PolyhedraRegular envelopeSolid = new PolyhedraRegular(subdetectorName + "_envelope", numsides, rmin, rmax, subdetectorThickness);
+        solids.addSolid(envelopeSolid);
+        Volume envelopeVolume = new Volume(subdetectorName + "_volume", envelopeSolid, air);
+        
+        int layerNumber = 0;
+        int layerType = 0;
+        double layerZ = subdetectorThickness/2;
+        for (Iterator i = node.getChildren("layer").iterator(); i.hasNext();)
+        {
+            Element layerElement = (Element) i.next();
+            double layerThickness = layers.getLayer(layerNumber).getThickness();
+            String layerTypeName = subdetectorName + "_layer" + layerType;            
+            if (layerElement.getAttribute("repeat") == null)
+            {
+                throw new RuntimeException("Missing the repeat number in layering for " + subdetectorName);
+            }
+            PolyhedraRegular layerSolid = new PolyhedraRegular(layerTypeName + "_solid", numsides, rmin, rmax, layerThickness);
+            solids.addSolid(layerSolid);
+            Volume layerVolume = new Volume(layerTypeName + "_volume", envelopeSolid, air);
+            
+            int sliceNumber = 0;
+            double sliceZ = layerThickness/2;
+            for (Iterator j = layerElement.getChildren("slice").iterator(); j.hasNext();)
+            {
+                String sliceName = layerTypeName + "_slice" + sliceNumber;
+                Element sliceElement = (Element) j.next();
+                if (sliceElement.getAttribute("thickness") == null)
+                    throw new RuntimeException("Missing thickness attribute.");
+                double sliceThickness = sliceElement.getAttribute("thickness").getDoubleValue();
+                if (sliceElement.getAttribute("material") == null)
+                    throw new RuntimeException("Missing material attribute.");
+                String materialName = sliceElement.getAttribute("material").getValue();
+                Material sliceMaterial = lcdd.getMaterial(materialName);
+                PolyhedraRegular sliceSolid = new PolyhedraRegular(sliceName + "_solid", numsides, rmin, rmax, sliceThickness);
+                solids.addSolid(sliceSolid);
+                Volume sliceVolume = new Volume(sliceName + "_volume", sliceSolid, sliceMaterial);
+                structure.addVolume(sliceVolume);
+                sliceZ -= sliceThickness/2;
+                Position slicePosition = new Position(sliceName + "_position", 0, 0, sliceZ);
+                define.addPosition(slicePosition);
+                sliceZ -= sliceThickness/2;
+                new PhysVol(sliceVolume, layerVolume, slicePosition, identityRotation);
+                sliceNumber++;
+            }
+            structure.addVolume(layerVolume);
+            sliceNumber = 0;                        
+            int repeat = (int)layerElement.getAttribute("repeat").getDoubleValue();
+            if (repeat <= 0)
+                throw new RuntimeException("The repeat value of " + repeat + " is invalid.");          
+            for ( int j=0; j<repeat; j++)
+            {
+                String physLayerName = subdetectorName + "_layer" + layerNumber; 
+                layerZ -= layerThickness/2;
+                System.out.println("layer" + layerNumber + ": " + layerZ);
+                Position layerPosition = new Position(physLayerName + "_position", 0, 0, layerZ);
+                define.addPosition(layerPosition);
+                new PhysVol(layerVolume, envelopeVolume, layerPosition, identityRotation);
+                layerZ -= layerThickness/2;
+                ++layerNumber;
+                
+                // DEBUG
+                break;
+            }
+            ++layerType;            
+        }
+        structure.addVolume(envelopeVolume);
+        Position testPosition = new Position(subdetectorName + "_position",0,0,zmin + subdetectorThickness/2);
+        define.addPosition(testPosition);
+        new PhysVol(envelopeVolume, motherVolume, testPosition, identityRotation);
+    }
+    
+    public boolean isCalorimeter()
+    {
+        return true;
+    }    
+}

GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
SiTrackerEndcap.java 1.18 -> 1.19
diff -u -r1.18 -r1.19
--- SiTrackerEndcap.java	4 Feb 2009 23:54:59 -0000	1.18
+++ SiTrackerEndcap.java	6 Feb 2009 16:36:23 -0000	1.19
@@ -253,11 +253,11 @@
             throw new RuntimeException(x);
         }
         
-        Trapezoid moduleTrd = (Trapezoid)lcdd.getSolid(wedgeLV.getSolidRef());
-        double dz = moduleTrd.z();
-        double dx1 = moduleTrd.x1();
-        double dx2 = moduleTrd.x2();
-        double dy = moduleTrd.y1();
+        Trapezoid wedgeTrd = (Trapezoid)lcdd.getSolid(wedgeLV.getSolidRef());
+        double dz = wedgeTrd.z();
+        double dx1 = wedgeTrd.x1();
+        double dx2 = wedgeTrd.x2();
+        double dy = wedgeTrd.y1();
         double deltax = dx2 - dx1;
         double side_slope = deltax / (2*dz);
         

GeomConverter/src/org/lcsim/geometry/subdetector
PolyhedraEndcapCalorimeter2.java added at 1.1
diff -N PolyhedraEndcapCalorimeter2.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ PolyhedraEndcapCalorimeter2.java	6 Feb 2009 16:36:23 -0000	1.1
@@ -0,0 +1,17 @@
+package org.lcsim.geometry.subdetector;
+
+import org.jdom.Element;
+import org.jdom.JDOMException;
+
+public class PolyhedraEndcapCalorimeter2 extends AbstractPolyhedraCalorimeter
+{
+    public PolyhedraEndcapCalorimeter2(Element node) throws JDOMException
+    {
+        super(node);
+    }
+    
+    public boolean isEndcap()
+    {
+        return true;
+    }
+}
CVSspam 0.2.8