Commit in GeomConverter on MAIN
src/org/lcsim/geometry/layer/LayerFromCompactCnv.java+1-61.3 -> 1.4
src/org/lcsim/geometry/compact/converter/lcdd/TPC.java+120added 1.1
src/org/lcsim/geometry/subdetector/CylindricalTracker.java+67added 1.1
                                  /TPC.java+29added 1.1
test/org/lcsim/geometry/compact/converter/lcdd/TPCConverterTest.java+27added 1.1
test/org/lcsim/geometry/subdetector/LayeredSubdetectorTest.java+51added 1.1
                                   /LayeredSubdetectorTest.xml+144added 1.1
                                   /TPCTest.java+63added 1.1
                                   /TPCTest.xml+60added 1.1
+562-6
8 added + 1 modified, total 9 files
Added classes for TPC subdetector plus tests.

GeomConverter/src/org/lcsim/geometry/layer
LayerFromCompactCnv.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- LayerFromCompactCnv.java	18 Jul 2005 22:04:11 -0000	1.3
+++ LayerFromCompactCnv.java	20 Aug 2005 19:55:59 -0000	1.4
@@ -115,11 +115,6 @@
         return layerStack;
     }
     
-//    public static double computeDetectorThickness(Element node) throws JDOMException
-//    {
-//        return LayerFromCompactCnv.makeLayerStackFromCompact(node).getTotalThickness();
-//    }
-    
     /** Compute the thickness of a single layer, ignoring the repeat attribute. */
     public static double computeSingleLayerThickness(Element node) throws JDOMException
     {
@@ -136,4 +131,4 @@
         }
         return thickness;
     }
-}
+}
\ No newline at end of file

GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
TPC.java added at 1.1
diff -N TPC.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ TPC.java	20 Aug 2005 19:56:00 -0000	1.1
@@ -0,0 +1,120 @@
+package org.lcsim.geometry.compact.converter.lcdd;
+
+import java.util.Iterator;
+import org.jdom.Attribute;
+import org.jdom.Element;
+import org.jdom.JDOMException;
+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.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;
+
+/**
+ *
+ * @author tonyj
+ */
+class TPC extends LCDDSubdetector
+{
+    TPC(Element node) throws JDOMException
+    {
+        super(node);
+    }
+    
+    public void addToLCDD(LCDD lcdd, SensitiveDetector sens) throws JDOMException
+    {
+        sens.setAttribute("combine_hits","true");
+        
+        String detectorName = node.getAttributeValue("name");
+        int id = node.getAttribute("id").getIntValue();
+        
+        Material air = lcdd.getMaterial("Air");
+        Solids solids = lcdd.getSolids();
+        Structure structure = lcdd.getStructure();
+        Volume motherVolume = lcdd.pickMotherVolume(this);
+        
+        Element dimensions = node.getChild("dimensions");
+        double z = dimensions.getAttribute("outer_z").getDoubleValue();
+        double rmin = dimensions.getAttribute("inner_r").getDoubleValue();
+        double r = rmin;
+        
+        Tube envelope = new Tube(detectorName+"_envelope");
+        Volume envelopeVolume = new Volume(detectorName+"_envelope_volume");
+        envelopeVolume.setMaterial(air);
+        envelopeVolume.setSolid(envelope);
+        
+        int n = 0;
+        for (Iterator i = node.getChildren("layer").iterator(); i.hasNext();)
+        {
+            Element layer = (Element) i.next();
+            int repeat = layer.getAttribute("repeat").getIntValue();
+            for (int ll=0; ll<repeat; ll++)
+            {
+                double rlayer = r;
+                
+                String name1 = detectorName+"_layer"+n;
+                Tube tube1 = new Tube(name1);
+                Volume volume1 = new Volume(name1+"_volume");
+                volume1.setMaterial(air);
+                volume1.setSolid(tube1);
+                
+                int m = 0;
+                for (Iterator j = layer.getChildren("slice").iterator(); j.hasNext(); m++)
+                {
+                    Element slice = (Element) j.next();
+                    double w = slice.getAttribute("thickness").getDoubleValue();
+                    Attribute s = slice.getAttribute("sensitive");
+                    boolean sensitive = s != null && s.getBooleanValue();
+                    
+                    String name = detectorName+"_layer"+n+"_slice"+m;
+                    Tube tube = new Tube(name);
+                    tube.setZ(2 * z);
+                    tube.setRMin(r);
+                    r += w;
+                    tube.setRMax(r);
+                    tube.setDeltaPhi(2*Math.PI);
+                    solids.addSolid(tube);
+                    
+                    Volume volume = new Volume(name+"_volume");
+                    volume.setMaterial(lcdd.getMaterial(slice.getAttributeValue("material")));
+                    volume.setSolid(tube);
+                    if (sensitive) volume.setSensitiveDetector(sens);
+                    structure.addVolume(volume);
+                    volume1.addPhysVol(new PhysVol(volume));
+                }
+                
+                tube1.setZ(2*z);
+                tube1.setRMin(rlayer);
+                tube1.setRMax(r);
+                tube1.setDeltaPhi(2*Math.PI);
+                
+                PhysVol physvol = new PhysVol(volume1);
+                physvol.addPhysVolID("layer",n);
+                envelopeVolume.addPhysVol(physvol);
+                structure.addVolume(volume1);
+                solids.addSolid(tube1);
+                n++;
+            }
+        }
+        
+        envelope.setZ(2*z);
+        envelope.setRMin(rmin);
+        envelope.setRMax(r);
+        envelope.setDeltaPhi(Math.PI*2);
+        PhysVol physvol = new PhysVol(envelopeVolume);
+        physvol.addPhysVolID("system",id);
+        physvol.addPhysVolID("barrel",0);
+        motherVolume.addPhysVol(physvol);
+        
+        solids.addSolid(envelope);
+        structure.addVolume(envelopeVolume);
+    }
+    
+    public boolean isTracker()
+    {
+        return true;
+    }
+}

GeomConverter/src/org/lcsim/geometry/subdetector
CylindricalTracker.java added at 1.1
diff -N CylindricalTracker.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ CylindricalTracker.java	20 Aug 2005 19:56:00 -0000	1.1
@@ -0,0 +1,67 @@
+/*
+ * CylindricalTracker.java
+ *
+ * Created on August 20, 2005, 12:58 PM
+ *
+ */
+
+package org.lcsim.geometry.subdetector;
+
+import org.jdom.Element;
+import org.jdom.JDOMException;
+import org.lcsim.geometry.CylindricalSubdetector;
+
+/**
+ *
+ * @author jeremym
+ */
+public class CylindricalTracker extends TrackerBase
+        implements CylindricalSubdetector
+{
+    private double zmax;
+    private double zmin;
+    private double rmin;
+    private double rmax;
+    
+    public CylindricalTracker(Element node) throws JDOMException
+    {
+        super(node);
+        build(node);
+    }
+    
+    private void build(Element node) throws JDOMException
+    {
+        Element dimensions = node.getChild("dimensions");
+        
+        if ( dimensions == null )
+        {
+            throw new JDOMException("Missing dimensions element.");
+        }
+        
+        rmin = dimensions.getAttribute("inner_r").getDoubleValue();
+        zmax = dimensions.getAttribute("outer_z").getDoubleValue();
+        zmin = -zmax;
+        rmax = rmin + getLayering().getLayers().getTotalThickness();
+        getLayering().setOffset(rmin);
+    }
+    
+    public double getZMax()
+    {
+        return zmax;
+    }
+    
+    public double getZMin()
+    {
+        return zmin;
+    }
+    
+    public double getOuterRadius()
+    {
+        return rmax;
+    }
+    
+    public double getInnerRadius()
+    {
+        return rmin;
+    }
+}
\ No newline at end of file

GeomConverter/src/org/lcsim/geometry/subdetector
TPC.java added at 1.1
diff -N TPC.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ TPC.java	20 Aug 2005 19:56:00 -0000	1.1
@@ -0,0 +1,29 @@
+/*
+ * TPC.java
+ *
+ * Created on August 20, 2005, 12:50 PM
+ *
+ */
+package org.lcsim.geometry.subdetector;
+
+import org.jdom.JDOMException;
+import org.jdom.Element;
+import org.lcsim.geometry.CylindricalSubdetector;
+
+/**
+ *
+ * @author jeremym
+ */
+public class TPC extends CylindricalTracker 
+{    
+    /** Creates a new instance of TPC */
+    public TPC(Element node) throws JDOMException
+    {
+        super(node);
+    }
+    
+    public boolean isBarrel()
+    {
+        return true;
+    }
+}
\ No newline at end of file

GeomConverter/test/org/lcsim/geometry/compact/converter/lcdd
TPCConverterTest.java added at 1.1
diff -N TPCConverterTest.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ TPCConverterTest.java	20 Aug 2005 19:56:00 -0000	1.1
@@ -0,0 +1,27 @@
+package org.lcsim.geometry.compact.converter.lcdd;
+
+import java.io.InputStream;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ *
+ * @author jeremym
+ */
+public class TPCConverterTest extends TestCase
+{    
+    public TPCConverterTest()
+    {
+    }
+    
+    public static TestSuite suite()
+    {
+        return new TestSuite(TPCConverterTest.class);
+    }
+    
+    public void test_TPCConverter() throws Exception
+    {
+        InputStream in = TPCConverterTest.class.getResourceAsStream("/org/lcsim/geometry/subdetector/TPCTest.xml");
+        new Main(true).convert("TPCTest",in,null);
+    }
+}

GeomConverter/test/org/lcsim/geometry/subdetector
LayeredSubdetectorTest.java added at 1.1
diff -N LayeredSubdetectorTest.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ LayeredSubdetectorTest.java	20 Aug 2005 19:56:00 -0000	1.1
@@ -0,0 +1,51 @@
+package org.lcsim.geometry.subdetector;
+
+import java.io.IOException;
+import junit.framework.*;
+import java.io.InputStream;
+import org.jdom.JDOMException;
+import org.lcsim.util.xml.ElementFactory.ElementCreationException;
+import org.lcsim.geometry.GeometryReader;
+import org.lcsim.geometry.Detector;
+import org.lcsim.geometry.layer.Layering;
+
+/**
+ *
+ * @author jeremym
+ */
+public class LayeredSubdetectorTest extends TestCase
+{
+   Detector det;
+   public LayeredSubdetectorTest(String testName)
+   {
+      super(testName);
+   }   
+   
+   public static Test suite()
+   {
+      return new TestSuite(LayeredSubdetectorTest.class);
+   }   
+
+   protected void setUp() throws Exception
+   {
+      InputStream in = LayeredSubdetectorTest.class.getResourceAsStream("/org/lcsim/geometry/subdetector/LayeredSubdetectorTest.xml");
+      GeometryReader reader = new GeometryReader();
+      det = reader.read(in);
+   }
+   
+   public void testRead() throws IOException, JDOMException, ElementCreationException
+   {
+       assert(det.getSubdetectors().size() == 4);
+   }
+   
+   public void testCalorimeterBarrel()
+   {
+       CylindricalBarrelCalorimeter calBarr = (CylindricalBarrelCalorimeter)det.getSubdetectors().get("CalorimeterBarrel");      
+       assert(calBarr != null);
+
+       Layering layering = calBarr.getLayering();
+       assert(layering != null);
+
+       assert(layering.getOffset() == 1000.0);
+   }
+}
\ No newline at end of file

GeomConverter/test/org/lcsim/geometry/subdetector
LayeredSubdetectorTest.xml added at 1.1
diff -N LayeredSubdetectorTest.xml
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ LayeredSubdetectorTest.xml	20 Aug 2005 19:56:01 -0000	1.1
@@ -0,0 +1,144 @@
+<!-- 
+     Time-stamp: <2004-12-14 11:20:57 jeremym>
+     
+     Example compact description ("lccdd") corresponding to
+     stdhep examples in SLIC: examples/stdhep/barr.lcdd.
+-->
+
+<!-- top-level compact description element -->
+<lccdd xmlns:lccdd="namespaceUrl"
+       xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"          
+       xs:noNamespaceSchemaLocation="noNamespaceUrl">
+
+  <!-- info tag containing author, version, time, unique id (url) -->
+  <info name="LayeredSubdetectorTest"
+        title="org.lcsim LayeredSubdetectorTest"
+	author="Jeremy McCormick"	
+	url="somewhere">
+    <comment>
+      This is meant to test layering.  As a detector, it makes no sense.
+    </comment>
+  </info>
+
+  <!-- Constants -->
+  <define>
+  
+    <constant name="cm" value="10"/>  
+    
+    <!-- world -->
+    <constant name="world_side" value="15000" />
+    <constant name="world_x" value="world_side" />
+    <constant name="world_y" value="world_side" />
+    <constant name="world_z" value="world_side" />
+    
+    <!-- tracking region -->
+    <constant name="tracking_region_radius" value="127.0"/>
+    <constant name="tracking_region_zmax" value="168.0"/>
+    
+    <constant name="vertex_inner_r" value="1.2"/>
+    <constant name="vertex_delta_r" value="1.2"/>
+    <constant name="vertex_outer_z" value="12.5"/>
+    
+  </define>
+
+  <materials>
+
+      <!-- so can easily replace references 
+	   with something more realistic later -->
+      <material  name="MuonAir"  >
+	<D type="density" unit="g/cm3" value="0.0012"/>
+	<fraction n="0.7803"  ref="N"/>
+	<fraction n="0.2103"  ref="O"/>
+	<fraction n="0.0094"  ref="Ar"/>
+      </material>
+
+  </materials>
+ 
+  <detectors>
+      
+     <detector id="1" name="TrackerBarrelTest" type="MultiLayerTracker" readout="TkrBarrHits">
+          <layer id="1" inner_r = "20.0" outer_z = "100.0">
+                <slice material = "G10" thickness = "3.0" />
+                <slice material = "Silicon" thickness = "2.0" sensitive = "yes" />
+          </layer>
+          <layer id="2" inner_r = "30" outer_z = "100.0">
+                <slice material = "G10" thickness = "3.0" />
+                <slice material = "Silicon" thickness = "2.0" sensitive = "yes" />
+          </layer>
+     </detector>
+     
+     <detector id="2" name="TrackerEndcapTest" type="DiskTracker" reflect="true" readout="TkrEndcapHits">
+        <layer id="1" inner_r = "0.0" inner_z = "20.0" outer_r = "20.0">
+                <slice material = "G10" thickness = "3.0" />
+                <slice material = "Silicon" thickness = "2.0" sensitive = "yes" />
+        </layer>
+        <layer id="1" inner_r = "0.0" inner_z = "30.0" outer_r = "20.0">
+               <slice material = "G10" thickness = "3.0" />
+               <slice material = "Silicon" thickness = "2.0" sensitive = "yes" />
+        </layer>       
+    </detector>
+    
+    <detector id="2" name="CalorimeterBarrel" type="CylindricalBarrelCalorimeter" readout="HcalBarrHits">  
+         <dimensions inner_r = "100.0" outer_z = "200.0" />
+         <layer repeat="2" >
+          <slice material = "G10" thickness = "3.0" />
+          <slice material = "Silicon" thickness = "2.0" sensitive = "yes" />
+        </layer>
+    </detector>  
+
+        <detector id="6" name="CalorimeterEndcapTest" reflect="true" type="CylindricalEndcapCalorimeter" readout="EcalEndcapHits">
+        <dimensions inner_r = "20.0" inner_z = "200.0" outer_r = "125.0" />
+        <layer repeat="2" >
+          <slice material = "G10" thickness = "3.0" />
+          <slice material = "Silicon" thickness = "2.0" sensitive = "yes" />
+        </layer>
+    </detector> 
+     
+  </detectors>
+  <readouts>
+         <readout name="MuonBarrHits"> 
+             <segmentation type="ProjectiveCylinder" thetaBins="150" phiBins="300"/>
+             <id>layer:7,system:3,barrel:3,theta:32:11,phi:11</id>
+         </readout>
+         <readout name="MuonEndcapHits"> 
+             <segmentation type="ProjectiveZPlane" thetaBins="150" phiBins="300"/>
+             <id>layer:7,system:3,barrel:3,theta:32:11,phi:11</id>
+         </readout>
+         <readout name="LumEndcapHits"> 
+             <segmentation type="ProjectiveZPlane" thetaBins="600" phiBins="1200"/>
+             <id>layer:7,system:3,barrel:3,theta:32:11,phi:11</id>
+         </readout>
+         <readout name="HcalEndcapHits"> 
+             <segmentation type="ProjectiveZPlane" thetaBins="600" phiBins="1200"/>
+             <id>layer:7,system:3,barrel:3,theta:32:11,phi:11</id>
+         </readout>
+         <readout name="HcalBarrHits"> 
+             <segmentation type="ProjectiveCylinder" thetaBins="600" phiBins="1200"/>
+             <id>layer:7,system:3,barrel:3,theta:32:11,phi:11</id>
+         </readout>
+         <readout name="EcalEndcapHits"> 
+           <segmentation type="ProjectiveZPlane" thetaBins="840" phiBins="1680"/>
+           <id>layer:7,system:3,barrel:3,theta:32:11,phi:11</id>
+        </readout>
+         <readout name="EcalBarrHits"> 
+             <segmentation type="ProjectiveCylinder" thetaBins="840" phiBins="1680"/>
+             <id>layer:7,system:3,barrel:3,theta:32:11,phi:11</id>
+         </readout>
+         <readout name="TkrBarrHits"> 
+             <id>layer:10,system:3,barrel:3</id>
+         </readout>
+         <readout name="TkrEndcapHits"> 
+             <id>layer:10,system:3,barrel:3</id>
+         </readout>
+         <readout name="VtxBarrHits"> 
+             <id>layer:10,system:3,barrel:3</id>
+         </readout>
+   </readouts>
+   <fields>
+    <field type="Solenoid" name="GlobalSolenoid"
+              inner_field="5.0"
+              outer_field="-0.6"
+              zmax="1000"
+              outer_radius="144+(2+1)*34"/>
+   </fields>
+</lccdd>

GeomConverter/test/org/lcsim/geometry/subdetector
TPCTest.java added at 1.1
diff -N TPCTest.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ TPCTest.java	20 Aug 2005 19:56:01 -0000	1.1
@@ -0,0 +1,63 @@
+/*
+ * ForwardDetectorTest.java
+ *
+ * Created on June 16, 2005, 1:50 PM
+ */
+
+package org.lcsim.geometry.subdetector;
+
+import java.io.InputStream;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.lcsim.geometry.GeometryReader;
+import org.lcsim.geometry.compact.Detector;
+
+/**
+ *
+ * @author jeremym
+ */
+public class TPCTest extends TestCase
+{
+    Detector det;
+    TPC tpc;
+    
+    /** Creates a new instance of ForwardDetectorTest */
+    public TPCTest()
+    {}
+    
+    protected void setUp() throws java.lang.Exception
+    {
+        InputStream in = this.getClass().getResourceAsStream("/org/lcsim/geometry/subdetector/TPCTest.xml");
+        GeometryReader reader = new GeometryReader();
+        det = reader.read(in);
+        
+        assert( det.getSubdetectors().get("TPCTest") != null );
+        
+        try
+        {
+            tpc = (TPC) det.getSubdetectors().get("TPCTest");
+        }
+        catch ( ClassCastException cce )
+        {
+            throw new RuntimeException("Failed cast to TPC.");
+        }
+    }
+    
+    public static junit.framework.Test suite()
+    {
+        return new TestSuite(TPCTest.class);
+    }
+    
+    public void test_dimensions()
+    {
+        double zmax = tpc.getZMax();
+        double zmin = tpc.getZMin();
+        double orad = tpc.getOuterRadius();
+        double irad = tpc.getInnerRadius();
+        
+        System.out.println("zmax=" + zmax);
+        System.out.println("zmin=" + zmin);
+        System.out.println("orad=" + orad);
+        System.out.println("irad=" + irad);
+    }
+}
\ No newline at end of file

GeomConverter/test/org/lcsim/geometry/subdetector
TPCTest.xml added at 1.1
diff -N TPCTest.xml
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ TPCTest.xml	20 Aug 2005 19:56:01 -0000	1.1
@@ -0,0 +1,60 @@
+<!-- top-level compact description element -->
+<lccdd xmlns:lccdd="namespaceUrl"
+       xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+       xs:noNamespaceSchemaLocation="noNamespaceUrl">
+
+  <!--
+      TODO:
+      Add in the far forward region.
+      Add redout electronics material for VXD and tracker.
+  -->
+
+  <!-- info tag containing author, version, time, unique id (url) -->
+  <info name="TPCTest"
+        title="TPCTest"
+	author="Jeremy McCormick"
+	url="NONE">
+    <comment>Test of org.lcsim.geometry.subdetector.TPC class.</comment>
+  </info>
+
+  <!-- Constants -->
+  <define>
+    <constant name="cm" value="10"/>
+
+    <!-- world -->
+    <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" />
+
+    <!-- tracking region -->
+    <constant name="tracking_region_radius" value="0.1*cm"/>
+    <constant name="tracking_region_zmax" value="0.1*cm"/>
+  </define>
+
+  <materials>
+  </materials>
+
+  <detectors>
+    <detector id="0" name="TPCTest" type="TPC" readout="TPCHits">
+         <dimensions inner_r = "100.0*cm" outer_z = "150.0*cm" />
+         <layer repeat="10">
+           <slice material="Nitrogen" thickness="1.0*cm" sensitive="true" />
+         </layer>
+    </detector>
+  </detectors>
+
+  <readouts>
+    <readout name="TPCHits"> 
+      <id>layer:10,system:3,barrel:3</id>
+    </readout>
+  </readouts>
+  
+  <fields>
+    <field type="Solenoid" name="GlobalSolenoid"
+              inner_field="5.0"
+              outer_field="-0.6"
+              zmax="1000"
+              outer_radius="(221.0+ 5.0 + 17.5 + 40./2.)*cm"/>  <!-- SolenoidCoilBarrel inner_radius + Al support + Oxygen gap + half coil-->
+   </fields>
+</lccdd>
\ No newline at end of file
CVSspam 0.2.8