Print

Print


Commit in GeomConverter/src/org/lcsim/geometry on RefactorBranch
SubdetectorIDDecoder.java+21added 1.2.2.2
CalorimeterIDDecoder.java+7-101.9.2.1 -> 1.9.2.2
Detector.java+7-31.25.2.1 -> 1.25.2.2
IDDecoder.java+16-121.8 -> 1.8.2.1
Subdetector.java+2-61.8.2.1 -> 1.8.2.2
TrackerIDDecoder.java+2-21.3.2.1 -> 1.3.2.2
compact/Readout.java+6-121.7 -> 1.7.2.1
       /Subdetector.java+2-661.8 -> 1.8.2.1
compact/converter/GODL/Main.java+1317-6601.5 -> 1.5.2.1
compact/converter/lcdd/MultiLayerTracker.java+1-11.11 -> 1.11.2.1
segmentation/NonprojectiveCylinder.java+3-31.15.2.3 -> 1.15.2.4
subdetector/AbstractSubdetector.java+1-11.1 -> 1.1.2.1
           /CalorimeterIDDecoder.java+3-11.4.2.1 -> 1.4.2.2
           /SubdetectorIDDecoder.java+6-41.3 -> 1.3.2.1
           /TrackerIDDecoder.java+4-21.1.2.1 -> 1.1.2.2
util/BaseIDDecoder.java+99added 1.1.2.1
    /IDDecoder.java+2-21.4 -> 1.4.2.1
    /IDDecoderBase.java-1081.3 removed
+1499-893
2 added + 1 removed + 15 modified, total 18 files
Cleanup and consolidation of IDDecoder stuff.

GeomConverter/src/org/lcsim/geometry
SubdetectorIDDecoder.java added at 1.2.2.2
diff -N SubdetectorIDDecoder.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ SubdetectorIDDecoder.java	28 Sep 2005 05:44:15 -0000	1.2.2.2
@@ -0,0 +1,21 @@
+/*
+ * SubdetectorID.java
+ *
+ * Created on July 17, 2005, 4:58 PM
+ *
+ */
+package org.lcsim.geometry;
+/**
+ *
+ * @author jeremym
+ */
+public interface SubdetectorIDDecoder extends IDDecoder
+{            
+    public Subdetector getSubdetector();    
+    public int getBarrelOrEndcapFlag();
+    public int getSystemNumber();    
+    public boolean isBarrel();
+    public boolean isEndcap();
+    public boolean isEndcapNorth();
+    public boolean isEndcapSouth();
+}
\ No newline at end of file

GeomConverter/src/org/lcsim/geometry
CalorimeterIDDecoder.java 1.9.2.1 -> 1.9.2.2
diff -u -r1.9.2.1 -r1.9.2.2
--- CalorimeterIDDecoder.java	28 Sep 2005 00:08:52 -0000	1.9.2.1
+++ CalorimeterIDDecoder.java	28 Sep 2005 05:44:15 -0000	1.9.2.2
@@ -1,19 +1,16 @@
 package org.lcsim.geometry;
-import org.lcsim.geometry.subdetector.SubdetectorIDDecoder;
+import org.lcsim.geometry.SubdetectorIDDecoder;
 
 /**
  *
  * @author jeremym
  */
-abstract public class CalorimeterIDDecoder extends SubdetectorIDDecoder
+public interface CalorimeterIDDecoder extends SubdetectorIDDecoder
 {
-    /* @return Calorimeter that this SubdetectorIDDecoder uses. */
-    // Fixme: This should be removed, there is no gaurantee that an IDDecoder 
-    //        belongs to a particular Subdetector.
-    abstract public Calorimeter getCalorimeter();
+    public Calorimeter getCalorimeter();
         
-    /* FIXME: Move to neighbors interface. */
-    abstract public boolean supportsNeighbours();
-    abstract public long[] getNeighbourIDs();
-    abstract public long[] getNeighbourIDs(int deltaLayer, int deltaTheta, int deltaPhi);
+    /* neighbors */
+    public boolean supportsNeighbours();
+    public long[] getNeighbourIDs();
+    public long[] getNeighbourIDs(int deltaLayer, int deltaTheta, int deltaPhi);
 }
\ No newline at end of file

GeomConverter/src/org/lcsim/geometry
Detector.java 1.25.2.1 -> 1.25.2.2
diff -u -r1.25.2.1 -r1.25.2.2
--- Detector.java	28 Sep 2005 00:27:28 -0000	1.25.2.1
+++ Detector.java	28 Sep 2005 05:44:15 -0000	1.25.2.2
@@ -48,13 +48,17 @@
         //System.out.println("Added subdet: " + sub.getName() );
     }
     
-    /* setup subdetector backlink in the iddecoder */
-    /* FIXME: There is not a 1-to-1 between subdetectors and readouts, so this function is wrong! --JM */
+    /* setup subdetector backlink in the IDDecoder */
+    /* 
+     * FIXME: There is not a 1-to-1 between subdetectors and readouts.
+     * Also, this function is just a hack to setup the IDDecoder.  There
+     * is probably a better way to do it.   
+     */
     private void setupSubdetectorIDDecoder(org.lcsim.geometry.compact.Subdetector subdet)
     {
         if ( subdet.getReadout() != null )
         {
-            SubdetectorIDDecoder decoder = subdet.getSubdetectorIDDecoder();
+            SubdetectorIDDecoder decoder = (SubdetectorIDDecoder)subdet.getSubdetectorIDDecoder();
             
             if ( decoder != null )
             {

GeomConverter/src/org/lcsim/geometry
IDDecoder.java 1.8 -> 1.8.2.1
diff -u -r1.8 -r1.8.2.1
--- IDDecoder.java	24 Aug 2005 06:10:57 -0000	1.8
+++ IDDecoder.java	28 Sep 2005 05:44:15 -0000	1.8.2.1
@@ -7,26 +7,30 @@
  * @author tonyj
  */
 public interface IDDecoder
-{
-    /* FIXME: should be called setRawID() . */
-    public void setID(long id); 
-  
-    /* FIXME: should be called getFieldValue() */
+{  
+    /* ID decoding */
+    public void setID(long id);         
     public int getValue(String field);
+    public int getValue(int index);    
     
-    /* @return the currently loaded IDDescriptor */
+    /* ID description */
+    public int getFieldCount();
+    public String getFieldName(int index);
+    public int getFieldIndex(String name);
+    public void setIDDescription(IDDescriptor id);
     public IDDescriptor getIDDescription();
-
-    /* FIXME: Can just call getValue("layer") instead ??? */
+    
+    /* 
+     * layer number
+     * WARNING: Used in at least 31 places, so better not change.
+     */
     public int getLayer(); 
     
-    /* FIXME: use Position interface or Hep3Vector */
+    /* Position interface */    
     public double[] getPosition();
-
-    /* FIXME: Move these someplace else! */
     public double getX();    
     public double getY();
     public double getZ();
     public double getPhi();
-    public double getTheta();
+    public double getTheta();    
 }
\ No newline at end of file

GeomConverter/src/org/lcsim/geometry
Subdetector.java 1.8.2.1 -> 1.8.2.2
diff -u -r1.8.2.1 -r1.8.2.2
--- Subdetector.java	28 Sep 2005 00:10:03 -0000	1.8.2.1
+++ Subdetector.java	28 Sep 2005 05:44:15 -0000	1.8.2.2
@@ -1,7 +1,7 @@
 package org.lcsim.geometry;
 
 import org.lcsim.geometry.layer.Layering;
-import org.lcsim.geometry.subdetector.SubdetectorIDDecoder;
+import org.lcsim.geometry.SubdetectorIDDecoder;
 
 /**
  * @author jeremym
@@ -10,13 +10,9 @@
 {
     String getName();
     IDDecoder getIDDecoder();
-    
-    /** @return Layering object or null if not implemented */
-//    Layering getLayering();
-    
+        
     boolean isTracker();
     boolean isCalorimeter();
-//    boolean isLayered();
     boolean isBarrel();
     boolean isEndcap();
     

GeomConverter/src/org/lcsim/geometry
TrackerIDDecoder.java 1.3.2.1 -> 1.3.2.2
diff -u -r1.3.2.1 -r1.3.2.2
--- TrackerIDDecoder.java	28 Sep 2005 00:25:14 -0000	1.3.2.1
+++ TrackerIDDecoder.java	28 Sep 2005 05:44:15 -0000	1.3.2.2
@@ -6,13 +6,13 @@
  */
 package org.lcsim.geometry;
 
-import org.lcsim.geometry.subdetector.SubdetectorIDDecoder;
+import org.lcsim.geometry.SubdetectorIDDecoder;
 
 /**
  *
  * @author jeremym
  */
-abstract public class TrackerIDDecoder extends SubdetectorIDDecoder
+public interface TrackerIDDecoder extends SubdetectorIDDecoder
 {    
     abstract public Tracker getTracker();
 }
\ No newline at end of file

GeomConverter/src/org/lcsim/geometry/compact
Readout.java 1.7 -> 1.7.2.1
diff -u -r1.7 -r1.7.2.1
--- Readout.java	26 Sep 2005 20:19:33 -0000	1.7
+++ Readout.java	28 Sep 2005 05:44:16 -0000	1.7.2.1
@@ -1,10 +1,10 @@
 package org.lcsim.geometry.compact;
 
+import org.lcsim.geometry.IDDecoder;
 import org.lcsim.geometry.subdetector.TrackerIDDecoder;
 import org.lcsim.geometry.util.IDDescriptor;
 import org.lcsim.geometry.util.IDDescriptor.IDException;
 import org.lcsim.geometry.segmentation.SegmentationBase;
-import org.lcsim.geometry.util.IDDecoderBase;
 
 import org.jdom.Element;
 import org.jdom.JDOMException;
@@ -17,20 +17,14 @@
 public class Readout implements org.lcsim.geometry.Readout
 {
     private String name;
-    private IDDecoderBase decoder;
+    private IDDecoder decoder;
     private IDDescriptor desc;
     private boolean hasSegmentation;
     
     public Readout(Element node) throws JDOMException
     {
         name = node.getAttributeValue("name");
-        
         setupIDDescriptor(node);
-                
-        if ( node.getChild("segmentation") != null )
-        {
-            hasSegmentation = true;
-        }
     }
     
     /** Create a new IDDescriptor by parsing the CDATA from the <id> tag. */
@@ -45,10 +39,9 @@
             throw new JDOMException("Invalid ID", x);
         }
     }
-        
+    
     public Segmentation getSegmentation()
     {
-        
         if(hasSegmentation)
         {
             return (Segmentation)decoder;
@@ -61,7 +54,8 @@
     
     public void setSegmentation(Segmentation segmentation)
     {
-        setIDDecoder((IDDecoderBase)segmentation);
+        setIDDecoder(segmentation);
+        hasSegmentation = true;
     }
     
     public String getName()
@@ -74,7 +68,7 @@
         return decoder;
     }
     
-    protected void setIDDecoder(IDDecoderBase d)
+    protected void setIDDecoder(IDDecoder d)
     {
         if ( d == null )
         {

GeomConverter/src/org/lcsim/geometry/compact
Subdetector.java 1.8 -> 1.8.2.1
diff -u -r1.8 -r1.8.2.1
--- Subdetector.java	24 Jul 2005 06:47:42 -0000	1.8
+++ Subdetector.java	28 Sep 2005 05:44:16 -0000	1.8.2.1
@@ -5,7 +5,7 @@
 import org.jdom.JDOMException;
 import org.lcsim.geometry.layer.Layering;
 import org.lcsim.geometry.IDDecoder;
-import org.lcsim.geometry.subdetector.SubdetectorIDDecoder;
+import org.lcsim.geometry.SubdetectorIDDecoder;
 
 /**
  *
@@ -51,122 +51,58 @@
         return getReadout().getIDDecoder();
     }
 
-    
-
     public SubdetectorIDDecoder getSubdetectorIDDecoder()
-
     {
-
         return (SubdetectorIDDecoder)getIDDecoder();
-
     }
-
-    
-
+   
     /* org.lcsim.geometry.Subdetector */
-
     public String getName()
-
     {
-
         return name;
-
     }
 
-    
-
     public int getSystemID()
-
     {
-
         return(systemID);
-
     }
-
     
-
     public boolean isBarrel() 
-
     {
-
         return false;
-
     }
 
-    
-
     public boolean isEndcap()
-
     {
-
         return false;
-
     }
 
-    
-
     /* org.lcsim.geometry.Subdetector */
-
     public boolean isCalorimeter()
-
     {
-
         return false;
-
     }
 
-    
-
     /* org.lcsim.geometry.Subdetector */
 
     public boolean isTracker()
-
     {
-
         return false;
-
     }
 
-    
-
     /* org.lcsim.geometry.Subdetector */
-
     public boolean isLayered()
-
     {
-
         return false;
-
-    }
-
-    
-
-    public Layering getLayering()
-
-    {
-
-        return null;
-
     }
-
     
-
     public double[] transformLocalToGlobal(double[] locPos)
-
     {
-
         return locPos;
-
     }
 
-    
-
     public boolean getReflect()
-
     {
-
         return reflect;
-
     }
-
 }
\ No newline at end of file

GeomConverter/src/org/lcsim/geometry/compact/converter/GODL
Main.java 1.5 -> 1.5.2.1
diff -u -r1.5 -r1.5.2.1
--- Main.java	2 Sep 2005 23:33:17 -0000	1.5
+++ Main.java	28 Sep 2005 05:44:16 -0000	1.5.2.1
@@ -1,661 +1,1318 @@
-package org.lcsim.geometry.compact.converter.GODL;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.List;
-import java.util.Set;
-import javax.swing.filechooser.FileFilter;
-import org.lcsim.geometry.compact.Header;
-import org.lcsim.geometry.compact.Constant;
-import org.lcsim.geometry.compact.Detector;
-import org.lcsim.geometry.GeometryReader;
-import org.lcsim.geometry.compact.Field;
-import org.lcsim.geometry.compact.Readout;
-import org.lcsim.geometry.compact.Subdetector;
-import org.lcsim.geometry.compact.converter.Converter;
-import org.lcsim.geometry.field.Solenoid;
-import org.lcsim.geometry.layer.Layer;
-import org.lcsim.geometry.layer.LayerSlice;
-import org.lcsim.geometry.layer.LayerStack;
-import org.lcsim.geometry.segmentation.GridXYZ;
-import org.lcsim.geometry.segmentation.NonprojectiveCylinder;
-import org.lcsim.geometry.segmentation.ProjectiveCylinder;
-import org.lcsim.geometry.segmentation.ProjectiveZPlane;
-import org.lcsim.geometry.subdetector.CylindricalBarrelCalorimeter;
-import org.lcsim.geometry.subdetector.CylindricalEndcapCalorimeter;
-import org.lcsim.geometry.subdetector.DiskTracker;
-import org.lcsim.geometry.subdetector.MultiLayerTracker;
-import org.lcsim.geometry.util.IDDecoderBase;
-import org.lcsim.geometry.util.IDDescriptor;
-import org.lcsim.material.Material;
-import org.lcsim.material.MaterialElement;
-import org.lcsim.material.MaterialManager;
-/**
- *
- * @author Willy Langeveld
- */
-public class Main implements Converter {
-    private HashSet materials;
-    private boolean existsMaterial(String mat) {
-        return(materials.contains(mat));
-    }
-    private void addMaterial(String mat) {
-        materials.add(mat);
-        return;
-    }
-    private static boolean validateDefault = true;
-    private boolean validate;
-    /**
-     * @param args the command line arguments
-     */
-    public static void main(String[] args) throws Exception {
-        if (args.length < 1 || args.length >2) usage();
-        String fn = args[0];
-        InputStream in = new BufferedInputStream(new FileInputStream(args[0]));
-        OutputStream out = (args.length == 1 ? System.out : new BufferedOutputStream(new FileOutputStream(args[1])));
-        new Main(validateDefault).convert(fn,in,out);
-    }
-    Main(boolean validate) throws Exception {
-        materials = new HashSet();
-        this.validate = validate;
-    }
-    public Main() throws Exception {
-        this(validateDefault);
-    }
-    public void line(PrintStream p, String s) {
-        if (p != null) {
-            if (s != null) p.println(s);
-            else           p.println("");
-        }
-        return;
-    }
-    public void line(PrintStream p) {
-        if (p != null) p.println("");
-        return;
-    }
-    public void val(PrintStream p, String s, String t) {
-        if (t != null) line(p, s + " = \"" + t + "\";");
-        else           line(p, s + " = \"\";");
-        return;
-    }
-    public void vald(PrintStream p, String s, String t) {
-        if (t != null) line(p, s + " = " + t + ";");
-        else           line(p, s + " = 0;");
-        return;
-    }
-    public void valdc(PrintStream p, String s, String t) {
-        if (t != null) line(p, s + " = " + t);
-        else           line(p, s + " = 0;");
-        return;
-    }
-    public void val(PrintStream p, String s, double t) {
-        line(p, s + " = " + t + ";");
-        return;
-    }
-    public void pval(PrintStream p, String s, String t) {
-        if (t != null) line(p, s + " += \"" + t + "\";");
-        return;
-    }
-    public void pvald(PrintStream p, String s, String t) {
-        if (t != null) line(p, s + " += " + t + ";");
-        return;
-    }
-    public void pval(PrintStream p, String s, double t) {
-        line(p, s + " += " + t + ";");
-        return;
-    }
-    public void preamble(PrintStream p, String inputFileName, Detector det) {
-        line(p, "###");
-        line(p, "#");
-        line(p, "# GeomConverter-generated GODL output");
-        line(p, "# -- GODL converter version 1.0 --");
-        line(p, "# From: " + inputFileName);
-        line(p, "#");
-        line(p, "###");
-        line(p, "cm  = 0.01 _meter;");
-        line(p, "m   = _meter;");
-        line(p, "g   = _gram;");
-        line(p, "atm = _atmosphere;");
-        line(p, "K   = _kelvin;");
-        line(p, "T   = _tesla;");
-        line(p, "deg = _degree;");
-        line(p, "unit(\"cm\", \"m\", \"g\", \"atm\", \"K\", \"T\", \"deg\");");
-        return;
-    }
-    public void header(PrintStream p, Detector det) {
-        line(p, "#");
-        line(p, "# Header");
-        line(p, "#");
-        
-        Header h = det.getHeader();
-        val(p, "detectorName   ", h.getDetectorName());
-        val(p, "author         ", h.getAuthor());
-        val(p, "detectorURL    ", h.getURL());
-        val(p, "comment        ", h.getComment());
-        val(p, "detectorVersion", h.getVersion());
-        return;
-    }
-    public void constants(PrintStream p, Detector det) {
-        line(p, "#");
-        line(p, "# Constants");
-        line(p, "#");
-        
-        Map<String,Constant> cl = det.getConstants();
-        Set<Map.Entry<String, Constant>> set = cl.entrySet();
-        for (Map.Entry<String, Constant> i: set) {
-            val(p, "data_" + i.getKey(), i.getValue().getValue());
-        }
-        return;
-    }
-    public void materials(PrintStream p, Detector det) {
-        line(p, "#");
-        line(p, "# Materials");
-        line(p, "#");
-        line(p, "vacuum = element(\"vacuum\");");
-        addMaterial("vacuum");
-        MaterialManager mm = MaterialManager.instance();
-        Map<String, Material> mmap = mm.materials();
-        for (Material i: mmap.values()) {
-            List<MaterialElement> el = i.getElements();
-            List<Double> elf = i.getMassFractions();
-            String formula = "";
-            if (el.size() == 1) {
-                formula += el.get(0).getName();
-                vald(p, "mat_" + i.getName(), "element(\"" + formula + "\")");
-            } else {
-                for (int j = 0; j < el.size(); j++) {
-                    formula += el.get(j).getName();
-                    formula += "" + elf.get(j);
-                }
-                vald(p, "mat_" + i.getName(), "compound(formula(\"" + formula + "\"), density("
-                        + i.getRadiationLength()/i.getRadiationLengthWithDensity() + " g/cm3))");
-            }
-            addMaterial("mat_" + i.getName());
-        }
-        return;
-    }
-    public void fields(PrintStream p, Detector det) {
-        line(p, "#");
-        line(p, "# Magnetic field");
-        line(p, "#");
-        
-        Map<String, Field> fl = det.getFields();
-        for (Field f: fl.values()) {
-            double[] fi = {0., 0., 5.0};
-            double[] fo = {0., 0., -0.6};
-            double or = 5000.0;
-            double zm = 2810.0;
-            if (f instanceof Solenoid) {
-                fi = ((Solenoid) f).getInnerField();
-                fo = ((Solenoid) f).getOuterField();
-                or = Math.sqrt(((Solenoid) f).getOuterRadius2());
-                zm = ((Solenoid) f).getZMax();
-            } else {
-                System.err.println(" -- Ignoring field " + f.getName() + ", GeomConverter doesn't support fields properly.");
-                System.err.println(" -- Using standard 5 tesla field");
-            }
-            line(p, "Field = cylinder(name(\"Secondary BField\"),");
-            line(p, "                 innerRadius(0.0 cm), outerRadius(" + or * 1.5 + " mm), length(" + 2 * zm + " mm),");
-            line(p, "                 bfield(" + fo[0] + " T, "+ fo[1] + " T, " + fo[2] + " T));");
-            line(p, "Field2 = cylinder(name(\"Main BField\"),");
-            line(p, "                  innerRadius(0.0), outerRadius(" + or + " mm), length(" + 2 * zm + " mm),");
-            line(p, "                  bfield(" + fi[0] + " T, "+ fi[1] + " T, " + fi[2] + " T));");
-            line(p, "Field += placement(@Field2);");
-        }
-        return;
-    }
-    public void readouts(PrintStream p, Detector det) {
-        line(p, "#");
-        line(p, "# ID Codes (Readouts)");
-        line(p, "# Note that the order on the stack is id1 id0.");
-        line(p, "#");
-        
-        Map<String, Readout> rl = det.getReadouts();
-        for (Readout r: rl.values()) {
-            IDDescriptor id = r.getIDDescriptor();
-            org.lcsim.geometry.IDDecoder seg = r.getIDDecoder();
-            int theta_seg = 0;
-            int phi_seg = 0;
-            double x_seg = 0;
-            double y_seg = 0;
-            double z_seg = 0;
-            if (seg instanceof ProjectiveCylinder) {
-                theta_seg = ((ProjectiveCylinder) seg).getThetaBins();
-                phi_seg = ((ProjectiveCylinder) seg).getPhiBins();
-            } else if (seg instanceof NonprojectiveCylinder) {
-                z_seg = ((NonprojectiveCylinder) seg).getGridSizeZ();
-                phi_seg = (int) (2 * Math.PI / ((NonprojectiveCylinder) seg).getGridSizePhi());
-            } else if (seg instanceof ProjectiveZPlane) {
-                theta_seg = ((ProjectiveZPlane) seg).getThetaBins();
-                phi_seg = ((ProjectiveZPlane) seg).getPhiBins();
-            } else if (seg instanceof GridXYZ) {
-                x_seg = ((GridXYZ) seg).getGridSizeX();
-                y_seg = ((GridXYZ) seg).getGridSizeY();
-                z_seg = ((GridXYZ) seg).getGridSizeZ();
-            }
-            
-            String rname = r.getName();
-            val(p, rname, "x: fp0 y: fp1 z: fp2 layer: d3 0 0");
-            boolean usingfirst = true;
-            int rotations = 0;
-            for (int i = 0; i < id.fieldCount(); i++) {
-                String name = id.fieldName(i);
-                int    start = id.fieldStart(i);
-                int    length = id.fieldLength(i);
-                if (length < 0) {
-                    length = - length;
-                }
-                String code = "";
-                if (name.equals("layer")) {
-                    code =  " layer 1 " + length + " bitshift 1 sub and";
-                } else if (name.equals("system")) {
-                    code =  " system 1 " + length + " bitshift 1 sub and";
-                } else if (name.equals("barrel")) {
-                    //
-                    // Note that barrel may be one or zero. If 1, then we make it 2 if z < 0.
-                    //
-                    code =  " barrel barrel z neg H truncate mul add 1 " + length + " bitshift 1 sub and";
-                } else if(name.equals("theta")) {
-                    code =  " x x mul y y mul add sqrt z atan2 " + theta_seg +
-                            " mul _pi div truncate 1 " + length + " bitshift 1 sub and";
-                } else if(name.equals("phi")) {
-                    code =  " y x atan2m " + phi_seg +
-                            " mul 0.5 mul _pi div truncate 1 " + length +
-                            " bitshift 1 sub and";
-                } else if(name.equals("x")) {
-                    code =  " x " + x_seg + " div truncate 1 " + length + " bitshift 1 sub and";
-                } else if(name.equals("y")) {
-                    code =  " y " + y_seg + " div truncate 1 " + length + " bitshift 1 sub and";
-                } else if(name.equals("z")) {
-                    code =  " z " + z_seg + " div truncate 1 " + length + " bitshift 1 sub and";
-                }
-                if (start > 31) {
-                    code = " exch" + code;
-                    usingfirst = false;
-                    start -= 32;
-                }
-                if (start > 0) code += " " + start + " bitshift";
-                code += " or";
-                if (!usingfirst) {
-                    usingfirst = true;
-                    code += " exch";
-                }
-                pval(p, rname, code);
-            }
-        }
-        return;
-    }
-    String findMaterial(PrintStream p, Layer layer) {
-        List<LayerSlice> lslist = layer.getSlices();
-        String material = "mat_";
-        int nslices = lslist.size();
-        if (nslices == 1) {
-            return(material +  lslist.get(0).getMaterial().getName());
-        }
-        //
-        // Create name
-        //
-        for (LayerSlice lsl: lslist) {
-            material += lsl.getMaterial().getName();
-            int t1000 = (int) (lsl.getThickness() * 1000.0);
-            material += t1000;
-        }
-        //
-        // Make a new material if this one doesn't exist yet
-        //
-        if (!existsMaterial(material)) {
-            valdc(p, material, "mixture(name(\"" + material + "\"),");
-            for (LayerSlice lsl: lslist) {
-                double t = lsl.getThickness();
-                String partname = lsl.getMaterial().getName();
-                line(p, "   part(@mat_" + partname + ", fraction(" + t + ")),");
-            }
-            line(p, "   by(\"volume\")");
-            line(p, ");");
-            addMaterial(material);
-        }
-        return(material);
-    }
-    public void beampipe(PrintStream p, Detector det) {
-        line(p, "#");
-        line(p, "# Since the GODL converter does not yet support polycone beampipes,");
-        line(p, "# we supply here a generic beampipe plus various masks");
-        line(p, "# These were taken from the SiDMay05.xml compact description,");
-        line(p, "#");
-        vald(p, "Be", "element(\"Be\");");
-        vald(p, "Ti", "element(\"Ti\");");
-        vald(p, "W", "element(\"W\");");
-        // Beam pipe:
-        //<constant name="tracking_region_zmax" value="167.9*cm" />
-        vald(p, "tracking_region_zmax", "167.9 cm");
-        //<zplane rmin="tracking_region_zmax*17./351" rmax="(tracking_region_zmax*17./351+.1)" z="-tracking_region_zmax" />
-        //<zplane rmin="1.2*cm" rmax="1.3*cm" z="-6.251*cm" />
-        line(p, "zmin   = -tracking_region_zmax;");
-        line(p, "zmax   = -6.251 cm;");
-        line(p, "length = zmax - zmin;");
-        line(p, "offset = zmin + 0.5 * length;");
-        line(p, "Pipe1  = cone(name(\"Pipe1\"),");
-        line(p, "    innerBottomRadius(tracking_region_zmax * 17.0/351.0),");
-        line(p, "    outerBottomRadius(tracking_region_zmax * 17.0/351.0 + 0.1 cm),");
-        line(p, "    innerTopRadius(1.2 cm),");
-        line(p, "    outerTopRadius(1.3 cm),");
-        line(p, "    length(length), @Be);");
-        line(p, "World += placement(@Pipe1);");
-        //<zplane rmin="1.2*cm" rmax="1.225*cm" z="-6.25*cm" />
-        line(p, "zmin   = zmax;");
-        line(p, "zmax   = -6.25 cm;");
-        line(p, "length = zmax - zmin;");
-        line(p, "offset = zmin + 0.5 * length;");
-        line(p, "Pipe2  = cone(name(\"Pipe2\"),");
-        line(p, "    innerBottomRadius(1.2 cm),");
-        line(p, "    outerBottomRadius(1.3 cm),");
-        line(p, "    innerTopRadius(1.2 cm),");
-        line(p, "    outerTopRadius(1.225 cm),");
-        line(p, "    length(length), @Be);");
-        line(p, "World += placement(@Pipe2);");
-        //<zplane rmin="1.2*cm" rmax="1.225*cm" z="6.25*cm" />
-        line(p, "zmin   = zmax;");
-        line(p, "zmax   = 6.25 cm;");
-        line(p, "length = zmax - zmin;");
-        line(p, "offset = zmin + 0.5 * length;");
-        line(p, "Pipe3  = cylinder(name(\"Pipe3\"),");
-        line(p, "    innerRadius(1.2 cm),");
-        line(p, "    outerRadius(1.225 cm),");
-        line(p, "    length(length), @Be);");
-        line(p, "World += placement(@Pipe3);");
-        //<zplane rmin="1.2*cm" rmax="1.3*cm" z="6.251*cm" />
-        line(p, "zmin   = zmax;");
-        line(p, "zmax   = 6.251 cm;");
-        line(p, "length = zmax - zmin;");
-        line(p, "offset = zmin + 0.5 * length;");
-        line(p, "Pipe4  = cone(name(\"Pipe4\"),");
-        line(p, "    innerBottomRadius(1.2 cm),");
-        line(p, "    outerBottomRadius(1.225 cm),");
-        line(p, "    innerTopRadius(1.2 cm),");
-        line(p, "    outerTopRadius(1.3 cm),");
-        line(p, "    length(length), @Be);");
-        line(p, "World += placement(@Pipe4);");
-        //<zplane rmin="tracking_region_zmax*17./351" rmax="(tracking_region_zmax*17./351+.1)" z="tracking_region_zmax" />
-        line(p, "zmin   = zmax;");
-        line(p, "zmax   = tracking_region_zmax;");
-        line(p, "length = zmax - zmin;");
-        line(p, "offset = zmin + 0.5 * length;");
-        line(p, "Pipe5  = cone(name(\"Pipe5\"),");
-        line(p, "    innerBottomRadius(1.2 cm),");
-        line(p, "    outerBottomRadius(1.3 cm),");
-        line(p, "    innerTopRadius(tracking_region_zmax * 17.0/351.0),");
-        line(p, "    outerTopRadius(tracking_region_zmax * 17.0/351.0 + 0.1 cm),");
-        line(p, "    length(length), @Be);");
-        line(p, "World += placement(@Pipe5);");
-        // Liner:
-        //<zplane z="-6.25*cm" rmin="1.195*cm" rmax="1.20*cm" />
-        //<zplane z="6.25*cm" rmin="1.195*cm" rmax="1.20*cm" />
-        line(p, "zmin   = -6.25 cm;");
-        line(p, "zmax   = 6.25 cm;");
-        line(p, "length = zmax - zmin;");
-        line(p, "offset = zmin + 0.5 * length;");
-        line(p, "Pipe_Inner_Shield = cylinder(name(\"Pipe inner shield\"),");
-        line(p, "    innerRadius(1.195 cm), outerRadius(1.2 cm),");
-        line(p, "    length(length), @Ti);");
-        line(p, "World += placement(@Pipe_Inner_Shield, translate(0, 0, offset));");
-        line(p, "#");
-        line(p, "# Masks");
-        line(p, "#");
-        //<zplane rmin="8.0*cm" rmax="19.0*cm" z="200.0*cm" />
-        //<zplane rmin="15.0*cm" rmax="19.0*cm" z="315.0*cm" />
-        line(p, "zmin   = 200.0 cm;");
-        line(p, "zmax   = 315.0 cm;");
-        line(p, "length = zmax - zmin;");
-        line(p, "offset = zmin + 0.5 * length;");
-        line(p, "Mask_Cone = cone(name(\"Mask cone\"),");
-        line(p, "               innerBottomRadius(8.0 cm), outerBottomRadius(19.0 cm),");
-        line(p, "               innerTopRadius(15 cm),     outerTopRadius(19.0 cm),");
-        line(p, "               length(length), @W, type(\"mask\"));");
-        line(p, "World += placement(@Mask_Cone, translate(0, 0, offset));");
-        line(p, "World += placement(@Mask_Cone, rotate(axis(\"x\"), angle(180 deg)), translate(0, 0, -offset));");
-        return;
-    }
-    public void detectors(PrintStream p, Detector det) {
-        line(p, "#");
-        line(p, "# Detector and subdetectors");
-        line(p, "# First create a world cylinder from the box coordinates already specified");
-        line(p, "#");
-        line(p, "data_world_r = sqrt(data_world_x * data_world_x + data_world_y * data_world_y) / 4.0;");
-        line(p, "World = cylinder(name(detectorName), radius(data_world_r mm), length(data_world_z mm), @vacuum);");
-        line(p, "#");
-        line(p, "# Now create other detectors and add them to the world");
-        line(p, "#");
-        Map<String, Subdetector> dl = det.getSubdetectors();
-        for (Subdetector s: dl.values()) {
-            if (s instanceof CylindricalBarrelCalorimeter) {
-                CylindricalBarrelCalorimeter m = (CylindricalBarrelCalorimeter) s;
-                String name     = m.getName();
-                int sysid       = m.getSystemID();
-                String rname = null;
-                if ( m.getReadout() != null ) {
-                    rname = m.getReadout().getName();
-                }
-                double innerR   = m.getInnerRadius();
-                double outerR   = m.getOuterRadius();
-                double zmin     = m.getZMin();
-                double zmax     = m.getZMax();
-                LayerStack ls   = m.getLayering().getLayerStack();
-                int nlayers     = ls.getNumberOfLayers();
-                
-                Layer layer       = ls.getLayer(0);
-                boolean sensitive = layer.findIndexOfFirstSensitiveSlice() != -1;
-                if (rname == null) sensitive = false;
-                String material   = findMaterial(p, layer);
-                
-                valdc(p, name, "cylinder(name(\"" + name + "\"), ");
-                line(p, "   @" + material + ",");
-                line(p, "   length(" + (zmax - zmin) + " mm), ");
-                line(p, "   innerRadius(" + innerR + " mm),");
-                line(p, "   outerRadius(" + outerR + " mm),");
-                String comma = "";
-                if (sensitive) comma = ",";
-                line(p, "   nLayers(" + nlayers + ")" + comma);
-                if (sensitive) {
-                    String type = "hadcal";
-                    if (name.startsWith("EM") || name.startsWith("LUM")) type = "emcal";
-                    line(p, "   type(\"" + type + "\"),");
-                    line(p, "   idCode(name(\"" + rname + "\"), code(" + rname + "),");
-                    line(p, "          data(\"system\", " + sysid + "),");
-                    line(p, "          data(\"barrel\", 0)");
-                    line(p, "   )");
-                }
-                line(p, ");");
-                line(p, "World += placement(@" + name + ", translate(0, 0, " + (0.5 * (zmax + zmin)) + " mm));");
-            } else if (s instanceof CylindricalEndcapCalorimeter) {
-                CylindricalEndcapCalorimeter m = (CylindricalEndcapCalorimeter) s;
-                String name     = m.getName();
-                int sysid       = m.getSystemID();
-                boolean reflect = m.getReflect();
-                String rname = null;
-                if ( m.getReadout() != null ) {
-                    rname = m.getReadout().getName();
-                }
-                double innerR   = m.getInnerRadius();
-                double outerR   = m.getOuterRadius();
-                double zmin     = m.getZMin();
-                double zmax     = m.getZMax();
-                LayerStack ls   = m.getLayering().getLayerStack();
-                int nlayers     = ls.getNumberOfLayers();
-                
-                Layer layer       = ls.getLayer(0);
-                boolean sensitive = layer.findIndexOfFirstSensitiveSlice() != -1;
-                if (rname == null) sensitive = false;
-                String material   = findMaterial(p, layer);
-                
-                valdc(p, name, "cylinder(name(\"" + name + "\"), ");
-                line(p, "   @" + material + ",");
-                line(p, "   length(" + (zmax - zmin) + " mm), ");
-                line(p, "   innerRadius(" + innerR + " mm),");
-                line(p, "   outerRadius(" + outerR + " mm),");
-                String comma = "";
-                if (sensitive) comma = ",";
-                line(p, "   nSlices(" + nlayers + ")" + comma);
-                if (sensitive) {
-                    String type = "hadcal";
-                    if (name.startsWith("EM") || name.startsWith("LUM")) type = "emcal";
-                    line(p, "   type(\"" + type + "\"),");
-                    line(p, "   idCode(name(\"" + rname + "\"), code(" + rname + "),");
-                    line(p, "          data(\"system\", " + sysid + "),");
-                    line(p, "          data(\"barrel\", 1)");
-                    line(p, "   )");
-                }
-                line(p, ");");
-                line(p, "World += placement(@" + name + ", translate(0, 0, " + (0.5 * (zmax + zmin)) + " mm));");
-                if (reflect) {
-                    line(p, "World += placement(@" + name
-                            + ", rotate(axis(\"x\"), angle(180 deg)), translate(0, 0, "
-                            + (- 0.5 * (zmax + zmin)) + " mm));");
-                }
-            } else if (s instanceof DiskTracker) {
-                DiskTracker m = (DiskTracker) s;
-                String name     = m.getName();
-                int sysid       = m.getSystemID();
-                boolean reflect = m.getReflect();
-                String rname = null;
-                if ( m.getReadout() != null ) {
-                    rname = m.getReadout().getName();
-                }
-                double[] innerR = m.getInnerR();
-                double[] outerR = m.getOuterR();
-                double[] innerZ = m.getInnerZ();
-                LayerStack ls   = m.getLayering().getLayerStack();
-                int nlayers     = ls.getNumberOfLayers();
-                
-                for (int i = 0; i < nlayers; i++) {
-                    Layer layer       = ls.getLayer(i);
-                    double thickness  = layer.getThickness();
-                    boolean sensitive = layer.findIndexOfFirstSensitiveSlice() != -1;
-                    if (rname == null) sensitive = false;
-                    String material   = findMaterial(p, layer);
-                    
-                    String detname = name;
-                    if (nlayers > 1) detname += "." + i;
-                    
-                    valdc(p, detname, "cylinder(name(\"" + name + "\"), ");
-                    line(p, "   @" + material + ",");
-                    line(p, "   length(" + thickness + " mm), ");
-                    line(p, "   innerRadius(" + innerR[i] + " mm),");
-                    String comma = "";
-                    if (sensitive) comma = ",";
-                    line(p, "   outerRadius(" + outerR[i] + " mm)" + comma);
-                    if (sensitive) {
-                        line(p, "   type(\"tracker\"),");
-                        line(p, "   idCode(name(\"" + rname + "\"), code(" + rname + "),");
-                        line(p, "          data(\"layer\", " + i + "),");
-                        line(p, "          data(\"system\", " + sysid + "),");
-                        line(p, "          data(\"barrel\", 1)");
-                        line(p, "   )");
-                    }
-                    line(p, ");");
-                    line(p, "World += placement(@" + detname + ", translate(0, 0, " + (innerZ[i] + 0.5 * thickness) + " mm));");
-                    if (reflect) {
-                        line(p, "World += placement(@" + detname
-                                + ", rotate(axis(\"x\"), angle(180 deg)), translate(0, 0, "
-                                + (- innerZ[i] - 0.5 * thickness) + " mm));");
-                    }
-                }
-            } else if (s instanceof MultiLayerTracker) {
-                MultiLayerTracker m = (MultiLayerTracker) s;
-                String name     = m.getName();
-                int sysid       = m.getSystemID();
-                String rname = null;
-                if ( m.getReadout() != null ) {
-                    rname    = m.getReadout().getName();
-                }
-                double[] innerR = m.getInnerR();
-                double[] outerZ = m.getOuterZ();
-                LayerStack ls   = m.getLayering().getLayerStack();
-                int nlayers     = ls.getNumberOfLayers();
-                
-                for (int i = 0; i < nlayers; i++) {
-                    Layer layer       = ls.getLayer(i);
-                    double thickness  = layer.getThickness();
-                    boolean sensitive = layer.findIndexOfFirstSensitiveSlice() != -1;
-                    if (rname == null) sensitive = false;
-                    String material   = findMaterial(p, layer);
-                    
-                    String detname = name;
-                    if (nlayers > 1) detname += "." + i;
-                    
-                    valdc(p, detname, "cylinder(name(\"" + name + "\"), ");
-                    line(p, "   @" + material + ",");
-                    line(p, "   length(" + outerZ[i] * 2 + " mm), ");
-                    line(p, "   innerRadius(" + innerR[i] + " mm),");
-                    String comma = "";
-                    if (sensitive) comma = ",";
-                    line(p, "   outerRadius(" + (innerR[i] + thickness) + " mm)" + comma);
-                    if (sensitive) {
-                        line(p, "   type(\"tracker\"),");
-                        line(p, "   idCode(name(\"" + rname + "\"), code(" + rname + "),");
-                        line(p, "          data(\"layer\", " + i + "),");
-                        line(p, "          data(\"system\", " + sysid + "),");
-                        line(p, "          data(\"barrel\", 0)");
-                        line(p, "   )");
-                    }
-                    line(p, ");");
-                    line(p, "World += placement(@" + detname + ");");
-                }
-            }
-        }
-        return;
-    }
-    
-    public void convert(String inputFileName, InputStream in, OutputStream out) throws Exception {
-        materials.clear();
-        GeometryReader reader = new GeometryReader();
-        Detector det = reader.read(in);
-        PrintStream p = null;
-        if (out != null) p = new PrintStream(out);
-        
-        preamble(p, inputFileName, det);
-        header(p,  det);
-        constants(p, det);
-        materials(p, det);
-        fields(p, det);
-        readouts(p, det);
-        detectors(p, det);
-        beampipe(p, det);
-        
-        line(p, "#");
-        line(p, "# End of file");
-        line(p, "#");
-        
-        if (out != null) out.close();
-        return;
-    }
-    
-    private static void usage() {
-        System.out.println("java "+Main.class.getName()+" <compact> [<GODL>]");
-        System.exit(0);
-    }
-    
-    public String getOutputFormat() {
-        return "GODL";
-    }
-    
-    public FileFilter getFileFilter() {
-        return new GODLFileFilter();
-    }
-    
-    private static class GODLFileFilter extends FileFilter {
-        public boolean accept(java.io.File file) {
-            return file.isDirectory() || file.getName().endsWith(".godl");
-        }
-        
-        public String getDescription() {
-            return "GODL file (*.godl)";
-        }
-    }
+package org.lcsim.geometry.compact.converter.GODL;
+
+
+
+import java.io.BufferedInputStream;
+
+import java.io.BufferedOutputStream;
+
+import java.io.FileInputStream;
+
+import java.io.FileOutputStream;
+
+import java.io.InputStream;
+
+import java.io.OutputStream;
+
+import java.io.PrintStream;
+
+import java.util.HashSet;
+
+import java.util.Map;
+
+import java.util.List;
+
+import java.util.Set;
+
+import javax.swing.filechooser.FileFilter;
+
+import org.lcsim.geometry.compact.Header;
+
+import org.lcsim.geometry.compact.Constant;
+
+import org.lcsim.geometry.compact.Detector;
+
+import org.lcsim.geometry.GeometryReader;
+
+import org.lcsim.geometry.compact.Field;
+
+import org.lcsim.geometry.compact.Readout;
+
+import org.lcsim.geometry.compact.Subdetector;
+
+import org.lcsim.geometry.compact.converter.Converter;
+
+import org.lcsim.geometry.field.Solenoid;
+
+import org.lcsim.geometry.layer.Layer;
+
+import org.lcsim.geometry.layer.LayerSlice;
+
+import org.lcsim.geometry.layer.LayerStack;
+
+import org.lcsim.geometry.segmentation.GridXYZ;
+
+import org.lcsim.geometry.segmentation.NonprojectiveCylinder;
+
+import org.lcsim.geometry.segmentation.ProjectiveCylinder;
+
+import org.lcsim.geometry.segmentation.ProjectiveZPlane;
+
+import org.lcsim.geometry.subdetector.CylindricalBarrelCalorimeter;
+
+import org.lcsim.geometry.subdetector.CylindricalEndcapCalorimeter;
+
+import org.lcsim.geometry.subdetector.DiskTracker;
+import org.lcsim.geometry.subdetector.MultiLayerTracker;
+
+import org.lcsim.geometry.util.IDDescriptor;
+
+import org.lcsim.material.Material;
+
+import org.lcsim.material.MaterialElement;
+
+import org.lcsim.material.MaterialManager;
+
+/**
+ *
+ *
+ *
+ * @author Willy Langeveld
+ *
+ */
+
+public class Main implements Converter {
+    
+    private HashSet materials;
+    
+    private boolean existsMaterial(String mat) {
+        
+        return(materials.contains(mat));
+        
+    }
+    
+    private void addMaterial(String mat) {
+        
+        materials.add(mat);
+        
+        return;
+        
+    }
+    
+    private static boolean validateDefault = true;
+    
+    private boolean validate;
+    
+    /**
+     *
+     * @param args the command line arguments
+     *
+     */
+    
+    public static void main(String[] args) throws Exception {
+        
+        if (args.length < 1 || args.length >2) usage();
+        
+        String fn = args[0];
+        
+        InputStream in = new BufferedInputStream(new FileInputStream(args[0]));
+        
+        OutputStream out = (args.length == 1 ? System.out : new BufferedOutputStream(new FileOutputStream(args[1])));
+        
+        new Main(validateDefault).convert(fn,in,out);
+        
+    }
+    
+    Main(boolean validate) throws Exception {
+        
+        materials = new HashSet();
+        
+        this.validate = validate;
+        
+    }
+    
+    public Main() throws Exception {
+        
+        this(validateDefault);
+        
+    }
+    
+    public void line(PrintStream p, String s) {
+        
+        if (p != null) {
+            
+            if (s != null) p.println(s);
+            
+            else           p.println("");
+            
+        }
+        
+        return;
+        
+    }
+    
+    public void line(PrintStream p) {
+        
+        if (p != null) p.println("");
+        
+        return;
+        
+    }
+    
+    public void val(PrintStream p, String s, String t) {
+        
+        if (t != null) line(p, s + " = \"" + t + "\";");
+        
+        else           line(p, s + " = \"\";");
+        
+        return;
+        
+    }
+    
+    public void vald(PrintStream p, String s, String t) {
+        
+        if (t != null) line(p, s + " = " + t + ";");
+        
+        else           line(p, s + " = 0;");
+        
+        return;
+        
+    }
+    
+    public void valdc(PrintStream p, String s, String t) {
+        
+        if (t != null) line(p, s + " = " + t);
+        
+        else           line(p, s + " = 0;");
+        
+        return;
+        
+    }
+    
+    public void val(PrintStream p, String s, double t) {
+        
+        line(p, s + " = " + t + ";");
+        
+        return;
+        
+    }
+    
+    public void pval(PrintStream p, String s, String t) {
+        
+        if (t != null) line(p, s + " += \"" + t + "\";");
+        
+        return;
+        
+    }
+    
+    public void pvald(PrintStream p, String s, String t) {
+        
+        if (t != null) line(p, s + " += " + t + ";");
+        
+        return;
+        
+    }
+    
+    public void pval(PrintStream p, String s, double t) {
+        
+        line(p, s + " += " + t + ";");
+        
+        return;
+        
+    }
+    
+    public void preamble(PrintStream p, String inputFileName, Detector det) {
+        
+        line(p, "###");
+        
+        line(p, "#");
+        
+        line(p, "# GeomConverter-generated GODL output");
+        
+        line(p, "# -- GODL converter version 1.0 --");
+        
+        line(p, "# From: " + inputFileName);
+        
+        line(p, "#");
+        
+        line(p, "###");
+        
+        line(p, "cm  = 0.01 _meter;");
+        
+        line(p, "m   = _meter;");
+        
+        line(p, "g   = _gram;");
+        
+        line(p, "atm = _atmosphere;");
+        
+        line(p, "K   = _kelvin;");
+        
+        line(p, "T   = _tesla;");
+        
+        line(p, "deg = _degree;");
+        
+        line(p, "unit(\"cm\", \"m\", \"g\", \"atm\", \"K\", \"T\", \"deg\");");
+        
+        return;
+        
+    }
+    
+    public void header(PrintStream p, Detector det) {
+        
+        line(p, "#");
+        
+        line(p, "# Header");
+        
+        line(p, "#");
+        
+        
+        
+        Header h = det.getHeader();
+        
+        val(p, "detectorName   ", h.getDetectorName());
+        
+        val(p, "author         ", h.getAuthor());
+        
+        val(p, "detectorURL    ", h.getURL());
+        
+        val(p, "comment        ", h.getComment());
+        
+        val(p, "detectorVersion", h.getVersion());
+        
+        return;
+        
+    }
+    
+    public void constants(PrintStream p, Detector det) {
+        
+        line(p, "#");
+        
+        line(p, "# Constants");
+        
+        line(p, "#");
+        
+        
+        
+        Map<String,Constant> cl = det.getConstants();
+        
+        Set<Map.Entry<String, Constant>> set = cl.entrySet();
+        
+        for (Map.Entry<String, Constant> i: set) {
+            
+            val(p, "data_" + i.getKey(), i.getValue().getValue());
+            
+        }
+        
+        return;
+        
+    }
+    
+    public void materials(PrintStream p, Detector det) {
+        
+        line(p, "#");
+        
+        line(p, "# Materials");
+        
+        line(p, "#");
+        
+        line(p, "vacuum = element(\"vacuum\");");
+        
+        addMaterial("vacuum");
+        
+        MaterialManager mm = MaterialManager.instance();
+        
+        Map<String, Material> mmap = mm.materials();
+        
+        for (Material i: mmap.values()) {
+            
+            List<MaterialElement> el = i.getElements();
+            
+            List<Double> elf = i.getMassFractions();
+            
+            String formula = "";
+            
+            if (el.size() == 1) {
+                
+                formula += el.get(0).getName();
[truncated at 1000 lines; 983 more skipped]

GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
MultiLayerTracker.java 1.11 -> 1.11.2.1
diff -u -r1.11 -r1.11.2.1
--- MultiLayerTracker.java	20 Aug 2005 21:57:01 -0000	1.11
+++ MultiLayerTracker.java	28 Sep 2005 05:44:17 -0000	1.11.2.1
@@ -12,7 +12,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.subdetector.SubdetectorIDDecoder;
+import org.lcsim.geometry.SubdetectorIDDecoder;
 
 /**
  *

GeomConverter/src/org/lcsim/geometry/segmentation
NonprojectiveCylinder.java 1.15.2.3 -> 1.15.2.4
diff -u -r1.15.2.3 -r1.15.2.4
--- NonprojectiveCylinder.java	28 Sep 2005 00:34:55 -0000	1.15.2.3
+++ NonprojectiveCylinder.java	28 Sep 2005 05:44:17 -0000	1.15.2.4
@@ -16,10 +16,10 @@
 import org.lcsim.geometry.layer.Layer;
 import org.lcsim.geometry.layer.LayerStack;
 import org.lcsim.geometry.CylindricalSubdetector;
+import org.lcsim.geometry.util.BaseIDDecoder;
 import org.lcsim.geometry.util.IDDescriptor;
-import org.lcsim.geometry.util.IDDecoder;
 import org.lcsim.geometry.util.IDEncoder;
-import org.lcsim.geometry.Layered;
+
 
 /**
  * @author jeremym
@@ -137,7 +137,7 @@
 //       System.out.println("Entering getNeighbourIDs: dl="+layerRange
 // 			 +", dz="+zRange+", dphi="+phiRange+", id="+printID(decoder,encoder) );
       IDEncoder gnEncoder = new IDEncoder( descriptor );
-      IDDecoder gnDecoder = new IDDecoder( descriptor );
+      BaseIDDecoder gnDecoder = new BaseIDDecoder( descriptor );
       gnEncoder.setValues(values);
       gnDecoder.setID( gnEncoder.getID() );
 

GeomConverter/src/org/lcsim/geometry/subdetector
AbstractSubdetector.java 1.1 -> 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- AbstractSubdetector.java	24 Aug 2005 07:05:08 -0000	1.1
+++ AbstractSubdetector.java	28 Sep 2005 05:44:18 -0000	1.1.2.1
@@ -13,7 +13,7 @@
 import org.jdom.Element;
 import org.jdom.JDOMException;
 import org.lcsim.geometry.HepRepProvider;
-import org.lcsim.geometry.subdetector.SubdetectorIDDecoder;
+import org.lcsim.geometry.SubdetectorIDDecoder;
 
 /**
  *

GeomConverter/src/org/lcsim/geometry/subdetector
CalorimeterIDDecoder.java 1.4.2.1 -> 1.4.2.2
diff -u -r1.4.2.1 -r1.4.2.2
--- CalorimeterIDDecoder.java	28 Sep 2005 00:12:30 -0000	1.4.2.1
+++ CalorimeterIDDecoder.java	28 Sep 2005 05:44:18 -0000	1.4.2.2
@@ -6,7 +6,9 @@
  * @author tonyj
  *
  */
-public class CalorimeterIDDecoder extends org.lcsim.geometry.CalorimeterIDDecoder
+abstract public class CalorimeterIDDecoder 
+        extends org.lcsim.geometry.subdetector.SubdetectorIDDecoder
+        implements org.lcsim.geometry.CalorimeterIDDecoder
 {
     public Calorimeter getCalorimeter()
     {

GeomConverter/src/org/lcsim/geometry/subdetector
SubdetectorIDDecoder.java 1.3 -> 1.3.2.1
diff -u -r1.3 -r1.3.2.1
--- SubdetectorIDDecoder.java	24 Aug 2005 07:05:07 -0000	1.3
+++ SubdetectorIDDecoder.java	28 Sep 2005 05:44:18 -0000	1.3.2.1
@@ -6,15 +6,17 @@
  */
 package org.lcsim.geometry.subdetector;
 
-import org.lcsim.geometry.util.IDDecoderBase;
+import org.lcsim.geometry.Subdetector;
+import org.lcsim.geometry.util.BaseIDDecoder;
 import org.lcsim.geometry.util.IDDescriptor;
-import org.lcsim.geometry.*;
+
 
 /**
  *
  * @author jeremym
  */
-public class SubdetectorIDDecoder extends IDDecoderBase
+abstract public class SubdetectorIDDecoder extends BaseIDDecoder
+        implements org.lcsim.geometry.SubdetectorIDDecoder
 {
     public static final int BARREL = 0;
     public static final int ENDCAP_NORTH = 1;
@@ -49,7 +51,7 @@
         return values[layerIndex];
     }
     
-    private int getBarrelOrEndcapFlag()
+    public int getBarrelOrEndcapFlag()
     {
         return getValue("barrel");
     }

GeomConverter/src/org/lcsim/geometry/subdetector
TrackerIDDecoder.java 1.1.2.1 -> 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- TrackerIDDecoder.java	28 Sep 2005 00:25:14 -0000	1.1.2.1
+++ TrackerIDDecoder.java	28 Sep 2005 05:44:18 -0000	1.1.2.2
@@ -13,7 +13,9 @@
  *
  * @author jeremym
  */
-public class TrackerIDDecoder extends org.lcsim.geometry.TrackerIDDecoder
+public class TrackerIDDecoder 
+        extends org.lcsim.geometry.subdetector.SubdetectorIDDecoder
+        implements org.lcsim.geometry.TrackerIDDecoder
 {   
     Tracker tracker;
     
@@ -25,4 +27,4 @@
     {
         return tracker;
     }
-}
+}
\ No newline at end of file

GeomConverter/src/org/lcsim/geometry/util
BaseIDDecoder.java added at 1.1.2.1
diff -N BaseIDDecoder.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ BaseIDDecoder.java	28 Sep 2005 05:44:19 -0000	1.1.2.1
@@ -0,0 +1,99 @@
+/*
+ * BaseIDDecoder.java
+ *
+ * Created on September 27, 2005, 10:18 PM
+ *
+ * To change this template, choose Tools | Options and locate the template under
+ * the Source Creation and Management node. Right-click the template and choose
+ * Open. You can then make changes to the template in the Source Editor.
+ */
+
+package org.lcsim.geometry.util;
+
+import org.lcsim.geometry.IDDecoder;
+
+/**
+ *
+ * @author jeremym
+ */
+
+public class BaseIDDecoder
+        implements org.lcsim.geometry.IDDecoder {
+    protected org.lcsim.geometry.util.IDDecoder decoder;
+    protected IDDescriptor descriptor;
+    protected int[] values;
+    
+    public BaseIDDecoder() {
+    }
+    
+    public BaseIDDecoder( IDDescriptor id) {
+        setIDDescription(id);
+    }
+    
+    public double getX() {
+        return 0;
+    }
+    
+    public double getY() {
+        return 0;
+    }
+    
+    public double getZ() {
+        return 0;
+    }
+    
+    public int getLayer() {
+        return -1;
+    }
+    
+    public double getPhi() {
+        return 0;
+    }
+    
+    public double getTheta() {
+        return 0;
+    }
+    
+    public double[] getPosition() {
+        return new double[] { getX(), getY(), getZ() };
+    }
+    
+    public void setID(long id) {
+        decoder.setID(id);
+        decoder.getValues(values);
+    }
+    
+    public int getValue(String field) {
+        return decoder.getValue(field);
+    }
+    
+    public int getValue(int index) {
+        return decoder.getValue(index);
+    }
+    
+    public String getFieldName(int index) {
+        return decoder.getFieldName(index);
+    }
+    
+    public int getFieldIndex(String name) {
+        return decoder.getFieldIndex(name);
+    }
+    
+    public int getFieldCount() {
+        return values.length;
+    }
+    
+    public void setIDDescription(IDDescriptor id) {
+        descriptor = id;
+        decoder = new org.lcsim.geometry.util.IDDecoder(id);
+        values = new int[id.fieldCount()];
+    }
+    
+    public IDDescriptor getIDDescription() {
+        return descriptor;
+    }
+    
+    public String toString() {
+        return decoder == null ? "NoDecoder" : decoder.toString();
+    }    
+}
\ No newline at end of file

GeomConverter/src/org/lcsim/geometry/util
IDDecoder.java 1.4 -> 1.4.2.1
diff -u -r1.4 -r1.4.2.1
--- IDDecoder.java	13 Jul 2005 23:38:13 -0000	1.4
+++ IDDecoder.java	28 Sep 2005 05:44:18 -0000	1.4.2.1
@@ -4,7 +4,7 @@
  *
  * @author tonyj
  */
-public class IDDecoder
+class IDDecoder
 {
     private IDDescriptor desc;
     private long id;
@@ -78,4 +78,4 @@
         }
         return sb.toString();
     }
-}
+}
\ No newline at end of file

GeomConverter/src/org/lcsim/geometry/util
IDDecoderBase.java removed after 1.3
diff -N IDDecoderBase.java
--- IDDecoderBase.java	29 Jul 2005 23:08:13 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,108 +0,0 @@
-/*
- * IDDecoderBase.java
- *
- * Created on July 17, 2005, 11:13 PM
- */
-package org.lcsim.geometry.util;
-import org.lcsim.geometry.util.*;
-
-/**
- *
- * Base class for extensions to ID encoding.
- *
- * See also CalorimeterIDDecoder, TrackerIDDecoder
- * for base classes to extend.
- *
- */
-public class IDDecoderBase implements org.lcsim.geometry.IDDecoder
-{
-    protected IDDecoder decoder;
-    protected IDDescriptor descriptor;
-    protected int[] values;
-    
-    public IDDecoderBase()
-    {}
-    
-    public double getX()
-    {
-        return 0;
-    }
-    
-    public double getY()
-    {
-        return 0;
-    }
-    
-    public double getZ()
-    {
-        return 0;
-    }
-    
-    public int getLayer()
-    {
-        return -1;
-    }
-    
-    public double getPhi()
-    {
-        return 0;
-    }
-    
-    public double getTheta()
-    {
-        return 0;
-    }
-    
-    public double[] getPosition()
-    {
-        return new double[] { getX(), getY(), getZ() };
-    }
-    
-    public void setID(long id)
-    {
-        decoder.setID(id);
-        decoder.getValues(values);
-    }
-    
-    public void setIDDescription(IDDescriptor id)
-    {
-        descriptor = id;
-        decoder = new org.lcsim.geometry.util.IDDecoder(id);
-        values = new int[id.fieldCount()];
-    }
-    
-    public IDDescriptor getIDDescription()
-    {
-        return descriptor;
-    }
-    
-    public int getValue(String field)
-    {
-        return decoder.getValue(field);
-    }
-    
-    public int getValue(int index)
-    {
-        return decoder.getValue(index);
-    }
-    
-    public String getFieldName(int index)
-    {
-        return decoder.getFieldName(index);
-    }
-    
-    public int getFieldIndex(String name)
-    {
-        return decoder.getFieldIndex(name);
-    }
-    
-    public int getFieldCount()
-    {
-        return values.length;
-    }
-    
-    public String toString()
-    {
-        return decoder == null ? "NoDecoder" : decoder.toString();
-    }
-}
CVSspam 0.2.8