Commit in GeomConverter on MAIN
src/org/lcsim/geometry/compact/converter/lcdd/CylindricalEndcapCalorimeter2.java+53-181.1 -> 1.2
testResources/org/lcsim/geometry/subdetector/CylindricalEndcapCalorimeter2Test.xml+3-31.1 -> 1.2
+56-21
2 modified files
first working version of cylindrical cal for muon collider studies

GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
CylindricalEndcapCalorimeter2.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- CylindricalEndcapCalorimeter2.java	23 Sep 2010 22:58:03 -0000	1.1
+++ CylindricalEndcapCalorimeter2.java	24 Sep 2010 18:35:57 -0000	1.2
@@ -1,5 +1,6 @@
 package org.lcsim.geometry.compact.converter.lcdd;
 
+import org.freehep.graphicsio.swf.DefineShape;
 import org.jdom.Element;
 import org.jdom.JDOMException;
 import org.lcsim.geometry.compact.converter.lcdd.util.Cone;
@@ -12,6 +13,7 @@
 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.LayerSlice;
 import org.lcsim.geometry.layer.LayerStack;
 import org.lcsim.geometry.layer.Layering;
 
@@ -66,10 +68,7 @@
                 
         // 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();
 
@@ -87,41 +86,77 @@
             // Make layer volume.
             Volume layerVolume = new Volume(subdetectorName + "_layer" + i + "_volume", layerTube, air);
 
-            // TODO: Make slices loop here.
-
-                        
+            // Slice loop.
+            double sliceZ = -layerThickness / 2;
+            int sliceCount = 0;
+            for (LayerSlice slice : layers.getLayer(i).getSlices())
+            {                
+                // Get slice thickness.
+                double sliceThickness = slice.getThickness();
+
+                // Make slice tube.
+                Tube sliceTube = 
+                    new Tube(subdetectorName + "_layer" + i + "_slice" + sliceCount + "_tube", layerRmin, rmax, sliceThickness / 2);
+                solids.addSolid(sliceTube);
+                
+                // Make slice volume.
+                Volume sliceVolume = new Volume(subdetectorName + "_layer" + i + "_slice" + sliceCount + "_volume", sliceTube, lcdd.getMaterial(slice.getMaterial().getName()));
+                structure.addVolume(sliceVolume);
+                
+                // Set volume sensitivity.
+                if (slice.isSensitive())
+                    sliceVolume.setSensitiveDetector(sens);
+                
+                // Make slice placement.
+                PhysVol slicePhysVol = new PhysVol(sliceVolume);
+                slicePhysVol.setZ(sliceZ + sliceThickness / 2);
+                slicePhysVol.addPhysVolID("slice", sliceCount);
+                layerVolume.addPhysVol(slicePhysVol);
+                
+                // Add slice's thickness to slice Z position.
+                sliceZ += sliceThickness;
+                
+                // Increment slice count.
+                ++sliceCount;
+            }
+             
+            // Add layer volume to structure.
             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;            
+            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);
+        endcapPositivePhysVol.addPhysVolID("barrel", 1);        
+        endcapPositivePhysVol.setZ(zmin + thickness / 2);
         motherVolume.addPhysVol(endcapPositivePhysVol);
+        
+        // Negative endcap placement.
+        PhysVol endcapNegativePhysVol = new PhysVol(envelopeVolume);
+        endcapNegativePhysVol.addPhysVolID("system", id);
+        endcapNegativePhysVol.addPhysVolID("barrel", 2);
+        endcapNegativePhysVol.setZ(-zmin - thickness / 2);
+        Rotation negativeEndcapRotation = new Rotation(subdetectorName + "_negative_rotation");
+        lcdd.getDefine().addRotation(negativeEndcapRotation);
+        negativeEndcapRotation.setX(Math.PI);
+        endcapNegativePhysVol.setRotation(negativeEndcapRotation);
+        motherVolume.addPhysVol(endcapNegativePhysVol);
     }
 
     public boolean isCalorimeter()
     {
         return true;
     }
-}^M
+}
\ No newline at end of file

GeomConverter/testResources/org/lcsim/geometry/subdetector
CylindricalEndcapCalorimeter2Test.xml 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- CylindricalEndcapCalorimeter2Test.xml	23 Sep 2010 22:58:03 -0000	1.1
+++ CylindricalEndcapCalorimeter2Test.xml	24 Sep 2010 18:35:57 -0000	1.2
@@ -22,9 +22,9 @@
               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 repeat="5" >
+          <slice material="Silicon" thickness="20.0" sensitive="yes" />
+          <slice material="Tungsten" thickness="80.0" />
         </layer>
     </detector>
   </detectors>
CVSspam 0.2.8