Commit in GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd on MAIN
DiskTracker.java+106-1001.10 -> 1.11
MultiLayerTracker.java+61.8 -> 1.9
util/LCDD.java+19-31.12 -> 1.13
+131-103
3 modified files
Fixed up world volume picking for trackers, some of which don't go in the tracking region.

GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
DiskTracker.java 1.10 -> 1.11
diff -u -r1.10 -r1.11
--- DiskTracker.java	15 Jul 2005 00:47:50 -0000	1.10
+++ DiskTracker.java	15 Jul 2005 01:17:46 -0000	1.11
@@ -19,104 +19,110 @@
  * @author tonyj
  */
 class DiskTracker extends LCDDSubdetector
-{ 
-   DiskTracker(Element node) throws JDOMException
-   {
-      super(node); 
-   }
-  
-   public void addToLCDD(LCDD lcdd, SensitiveDetector sens) throws JDOMException
-   {      
-      int id = node.getAttribute("id").getIntValue();
-      String detectorName = node.getAttributeValue("name");
-      boolean reflect = node.getAttribute("reflect").getBooleanValue();
-      
-      Material air = lcdd.getMaterial("Air");
-      Rotation reflection = lcdd.getDefine().getRotation("reflect_rot");
-      Solids solids = lcdd.getSolids();
-      Structure structure = lcdd.getStructure();
-      
-      Volume trackingVolume = lcdd.pickMotherVolume(this);
-      
-      int n = 0;
-      for (Iterator i = node.getChildren("layer").iterator(); i.hasNext(); n++)
-      {
-         Element layer = (Element) i.next();
-         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;
-         double zmin = layer.getAttribute("inner_z").getDoubleValue();
-         double rmin = layer.getAttribute("inner_r").getDoubleValue();
-         double rmax = layer.getAttribute("outer_r").getDoubleValue();
-         double z = zmin;
-         
-         double layerWidth = 0;
-         for (Iterator j = layer.getChildren("slice").iterator(); j.hasNext();)
-         {
-            Element slice = (Element) j.next();
-            double w = slice.getAttribute("thickness").getDoubleValue();
-            layerWidth += w;
-         }
-         
-         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(w);
-            tube.setRMin(rmin);
-            tube.setRMax(rmax);
-            tube.setDeltaPhi(Math.PI*2);
-            solids.addSolid(tube);
-            
-            Volume volume = new Volume(name+"_volume");
-            volume.setMaterial(lcdd.getMaterial(slice.getAttributeValue("material")));
-            volume.setSolid(tube);
-            if (sensitive) volume.setSensitiveDetector(sens);
-            
-            PhysVol physvol = new PhysVol(volume);
-            physvol.setZ(z-zmin -layerWidth/2 + w/2);
-            physvol.addPhysVolID("layer",n);
-            volume1.addContent(physvol);
-            structure.addVolume(volume);
-            
-            z += w;
-         }
-         
-         tube1.setZ(layerWidth);
-         tube1.setRMin(rmin);
-         tube1.setRMax(rmax);
-         tube1.setDeltaPhi(Math.PI*2);
-         
-         PhysVol physvol = new PhysVol(volume1);
-         physvol.setZ(zmin+layerWidth/2);
-         physvol.addPhysVolID("system",id);
-         physvol.addPhysVolID("barrel",1);
-         trackingVolume.addPhysVol(physvol);
-         
-         if (reflect)
-         {
-            PhysVol physvol2 = new PhysVol(volume1);
-            physvol2.setZ(-zmin-layerWidth/2);
-            physvol2.setRotation(reflection);
-            physvol2.addPhysVolID("system",id);
-            physvol2.addPhysVolID("barrel",2);
-            trackingVolume.addPhysVol(physvol2);
-         }
-         solids.addContent(tube1);
-         structure.addContent(volume1);
-      }
-   }
-   public boolean isTracker()
-   {
-      return true;
-   }
+{
+    DiskTracker(Element node) throws JDOMException
+    {
+        super(node);
+        
+        /* Make sure there is setting for tracking vol. */
+        if ( node.getAttribute("insideTrackingVolume") == null )
+        {
+            node.setAttribute("insideTrackingVolume", "true");
+        }
+    }
+    
+    public void addToLCDD(LCDD lcdd, SensitiveDetector sens) throws JDOMException
+    {
+        int id = node.getAttribute("id").getIntValue();
+        String detectorName = node.getAttributeValue("name");
+        boolean reflect = node.getAttribute("reflect").getBooleanValue();
+        
+        Material air = lcdd.getMaterial("Air");
+        Rotation reflection = lcdd.getDefine().getRotation("reflect_rot");
+        Solids solids = lcdd.getSolids();
+        Structure structure = lcdd.getStructure();
+        
+        Volume trackingVolume = lcdd.pickMotherVolume(this);
+        
+        int n = 0;
+        for (Iterator i = node.getChildren("layer").iterator(); i.hasNext(); n++)
+        {
+            Element layer = (Element) i.next();
+            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;
+            double zmin = layer.getAttribute("inner_z").getDoubleValue();
+            double rmin = layer.getAttribute("inner_r").getDoubleValue();
+            double rmax = layer.getAttribute("outer_r").getDoubleValue();
+            double z = zmin;
+            
+            double layerWidth = 0;
+            for (Iterator j = layer.getChildren("slice").iterator(); j.hasNext();)
+            {
+                Element slice = (Element) j.next();
+                double w = slice.getAttribute("thickness").getDoubleValue();
+                layerWidth += w;
+            }
+            
+            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(w);
+                tube.setRMin(rmin);
+                tube.setRMax(rmax);
+                tube.setDeltaPhi(Math.PI*2);
+                solids.addSolid(tube);
+                
+                Volume volume = new Volume(name+"_volume");
+                volume.setMaterial(lcdd.getMaterial(slice.getAttributeValue("material")));
+                volume.setSolid(tube);
+                if (sensitive) volume.setSensitiveDetector(sens);
+                
+                PhysVol physvol = new PhysVol(volume);
+                physvol.setZ(z-zmin -layerWidth/2 + w/2);
+                physvol.addPhysVolID("layer",n);
+                volume1.addContent(physvol);
+                structure.addVolume(volume);
+                
+                z += w;
+            }
+            
+            tube1.setZ(layerWidth);
+            tube1.setRMin(rmin);
+            tube1.setRMax(rmax);
+            tube1.setDeltaPhi(Math.PI*2);
+            
+            PhysVol physvol = new PhysVol(volume1);
+            physvol.setZ(zmin+layerWidth/2);
+            physvol.addPhysVolID("system",id);
+            physvol.addPhysVolID("barrel",1);
+            trackingVolume.addPhysVol(physvol);
+            
+            if (reflect)
+            {
+                PhysVol physvol2 = new PhysVol(volume1);
+                physvol2.setZ(-zmin-layerWidth/2);
+                physvol2.setRotation(reflection);
+                physvol2.addPhysVolID("system",id);
+                physvol2.addPhysVolID("barrel",2);
+                trackingVolume.addPhysVol(physvol2);
+            }
+            solids.addContent(tube1);
+            structure.addContent(volume1);
+        }
+    }
+    public boolean isTracker()
+    {
+        return true;
+    }
 }

GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
MultiLayerTracker.java 1.8 -> 1.9
diff -u -r1.8 -r1.9
--- MultiLayerTracker.java	15 Jul 2005 00:47:50 -0000	1.8
+++ MultiLayerTracker.java	15 Jul 2005 01:17:46 -0000	1.9
@@ -22,6 +22,12 @@
    MultiLayerTracker(Element node) throws JDOMException
    {
       super(node); 
+      
+      /* Make sure there is setting for tracking vol. */
+      if ( node.getAttribute("insideTrackingVolume") == null ) 
+      {
+        node.setAttribute("insideTrackingVolume", "true");
+      }
    }
    
    public void addToLCDD(LCDD lcdd, SensitiveDetector sens) throws JDOMException

GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd/util
LCDD.java 1.12 -> 1.13
diff -u -r1.12 -r1.13
--- LCDD.java	15 Jul 2005 00:47:50 -0000	1.12
+++ LCDD.java	15 Jul 2005 01:17:47 -0000	1.13
@@ -229,27 +229,43 @@
     /** 
      * Pick the world or tracking volume for a subdetector's mother volume,
      * depending on the value of the insideTrackingVolume attribute. 
+     *
+     * Trackers will always place themselves inside the trackingVolume, and
+     * so should not call this function.
+     *
      * @param subdet LCDD subdetector
      */
     public Volume pickMotherVolume(LCDDSubdetector subdet)
     {        
-        Attribute insideTrackingVolume = subdet.getElement().getAttribute("insideTrackingVolume");
+        Attribute insideAttrib = subdet.getElement().getAttribute("insideTrackingVolume");
         boolean inside;
         try {
-            inside = (insideTrackingVolume == null) || (insideTrackingVolume.getBooleanValue() );
+            if ( insideAttrib == null )
+            {
+                inside = false;
+            }
+            else 
+            {
+                inside = insideAttrib.getBooleanValue();
+            }
+            
+            //System.out.println("inside: " + inside);
         }
         catch (org.jdom.DataConversionException dce)
         {
             throw new RuntimeException("Error converting insideTrackingVolume attribute.", dce);
         }
         
-        Volume motherVolume = inside ? getStructure().getTrackingVolume() : getStructure().getWorldVolume();
+        Volume motherVolume = ( inside ? getStructure().getTrackingVolume() : getStructure().getWorldVolume() );
         
         if ( motherVolume == null )
         {
             throw new RuntimeException("Picked a null mother volume.");
         }
         
+//        System.out.println("subdet " + subdet.getElement().getAttributeValue("name") + " -> " 
+//                + motherVolume.getAttributeValue("name") + "; insideTrackingVolume=" + inside);
+        
         return motherVolume;
     }
 }
\ No newline at end of file
CVSspam 0.2.8