Commit in GeomConverter on MAIN
resources/org/lcsim/schemas/compact/1.0/compact.xsd+11.6 -> 1.7
src/org/lcsim/geometry/compact/Segmentation.java+91.10 -> 1.11
src/org/lcsim/geometry/compact/converter/lcdd/LCDDDetector.java+9-131.23 -> 1.24
src/org/lcsim/geometry/compact/converter/lcdd/util/Calorimeter.java+111.3 -> 1.4
                                                  /UnsegmentedCalorimeter.java+8-11.1 -> 1.2
+38-14
5 modified files
more updates to get id written using unseg cal

GeomConverter/resources/org/lcsim/schemas/compact/1.0
compact.xsd 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- compact.xsd	9 Dec 2009 01:32:06 -0000	1.6
+++ compact.xsd	8 Dec 2010 23:07:23 -0000	1.7
@@ -232,6 +232,7 @@
                             <xs:element name="segmentation" minOccurs="0" maxOccurs="1">
                                 <xs:complexType>
                                     <xs:attribute name="name" type="xs:string"/>
+                                    <xs:attribute name="useForHitPosition" type="xs:boolean" use="optional" default="true" />
                                     <xs:anyAttribute processContents="lax" />
                                 </xs:complexType>
                             </xs:element>

GeomConverter/src/org/lcsim/geometry/compact
Segmentation.java 1.10 -> 1.11
diff -u -r1.10 -r1.11
--- Segmentation.java	17 Nov 2010 00:13:44 -0000	1.10
+++ Segmentation.java	8 Dec 2010 23:07:23 -0000	1.11
@@ -14,10 +14,19 @@
 extends BaseIDDecoder
 {    
     protected List<Double> cellSizes = new ArrayList<Double>(2);
+    boolean useForHitPosition = true;
     
     protected Segmentation(Element segmentation)
     {
         super();
+        
+        // Flag if hit position is to be kept independent of cell position.
+        useForHitPosition = Boolean.parseBoolean( segmentation.getAttribute( "useForHitPosition" ).getValue() );
+    }
+    
+    public boolean useForHitPosition()
+    {
+        return this.useForHitPosition;
     }
     
     public double getCellSizeU()

GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
LCDDDetector.java 1.23 -> 1.24
diff -u -r1.23 -r1.24
--- LCDDDetector.java	7 Dec 2010 20:18:24 -0000	1.23
+++ LCDDDetector.java	8 Dec 2010 23:07:23 -0000	1.24
@@ -179,21 +179,19 @@
                 else if ( sub.isCalorimeter() )
                 {
                     // Standard segmented calorimeter.
-                    if ( readout.getSegmentation() != null )
+                    if ( readout.getSegmentation() != null && 
+                            readout.getSegmentation().useForHitPosition() )
                     {
                         sens = new Calorimeter( sub.getName() );
                     }
                     // Unsegmented calorimeter for detailed readout studies.
+                    // May still have Segmentation but not used for hit positions.
                     else
                     {
                         sens = new UnsegmentedCalorimeter( sub.getName() );
                     }
                 }
-                // TODO Add optical cal here.
-
-                // TEST
-                // System.out.println(sens.getName() + " - " +
-                // readout.getClass().getCanonicalName());
+                // TODO Add optical cal handling here.
 
                 if ( sens != null )
                 {
@@ -208,12 +206,13 @@
                     {
                         if ( readout.getSegmentation() != null )
                         {
+                            //System.out.println(readout.getSegmentation().getClass().getCanonicalName());
                             LCDDSegmentation seg = ( LCDDSegmentation ) readout.getSegmentation();
                             seg.setSegmentation( ( Calorimeter ) sens );
                         }
                     }
                     catch ( Throwable x )
-                    {                        
+                    {
                         throw new RuntimeException( "Readout " + readout.getName() + " is not a valid Segmentation object.",
                                                     x );
                     }
@@ -304,15 +303,12 @@
     private static class NullOutputStream extends OutputStream
     {
         public void write( byte[] b, int off, int len ) throws IOException
-        {
-        }
+        {}
 
         public void write( byte[] b ) throws IOException
-        {
-        }
+        {}
 
         public void write( int b ) throws IOException
-        {
-        }
+        {}
     }
 }

GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd/util
Calorimeter.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- Calorimeter.java	7 Dec 2010 20:17:13 -0000	1.3
+++ Calorimeter.java	8 Dec 2010 23:07:23 -0000	1.4
@@ -10,6 +10,17 @@
    {
       super("calorimeter",name);
    }
+   
+   /**
+    * Constructor for subclasses with a different XML element name.
+    * @param elementName The name of the element.
+    * @param name The unique name of the calorimeter.
+    */
+   public Calorimeter(String elementName, String name)
+   {
+      super(elementName, name);
+   }
+   
    public void setSegmentation(Segmentation segmentation)
    {
       addContent(segmentation);

GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd/util
UnsegmentedCalorimeter.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- UnsegmentedCalorimeter.java	7 Dec 2010 20:17:01 -0000	1.1
+++ UnsegmentedCalorimeter.java	8 Dec 2010 23:07:23 -0000	1.2
@@ -4,10 +4,17 @@
  * 
  * @author tonyj
  */
-public class UnsegmentedCalorimeter extends SensitiveDetector
+public class UnsegmentedCalorimeter extends Calorimeter
 {
     public UnsegmentedCalorimeter( String name )
     {
         super( "unsegmented_calorimeter", name );
     }
+    
+    /*
+    public void setSegmentation(Segmentation segmentation)
+    {
+       addContent(segmentation);
+    }
+    */
 }
\ No newline at end of file
CVSspam 0.2.8