Print

Print


Author: phansson
Date: Thu Nov  6 17:24:26 2014
New Revision: 3414

Log:
Add 1st version of chamber, svt box, L1-3 uchannel and L1-3 modules.

Modified:
    projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/converter/compact/DetectorConverter.java
    projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/CompactSurveyVolume.java
    projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014GeometryDefinition.java
    projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014LCDDBuilder.java
    projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerBuilder.java
    projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerGeometryDefinition.java
    projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/SurveyCoordinateSystem.java
    projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/util/TransformationUtils.java
    projects/lcsim/trunk/detector-framework/src/test/resources/org/lcsim/geometry/subdetector/HPSTracker2014.xml

Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/converter/compact/DetectorConverter.java
 =============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/converter/compact/DetectorConverter.java	(original)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/converter/compact/DetectorConverter.java	Thu Nov  6 17:24:26 2014
@@ -115,6 +115,7 @@
         addSubdetectorConverter(new HPSEcal3Converter());
         addSubdetectorConverter(new HPSMuonCalorimeterConverter());
         addSubdetectorConverter(new HPSTestRunTracker2014Converter());
+        //addSubdetectorConverter(new HPSTracker2014Converter());
 
         // Support structures.
         addSubdetectorConverter(new PolyconeSupportConverter());

Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/CompactSurveyVolume.java
 =============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/CompactSurveyVolume.java	(original)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/CompactSurveyVolume.java	Thu Nov  6 17:24:26 2014
@@ -55,11 +55,11 @@
                     throw new RuntimeException("no eCoord for " + getName() + " found in compact file");
                 } 
                 
-                Element eOrigin = eCoord.getChild("origin");
-                
-                if(eOrigin==null) {
-                    throw new RuntimeException("no eOrigin for " + getName() + " found in compact file");
-                } 
+//                Element eOrigin = eCoord.getChild("origin");
+//                
+//                if(eOrigin==null) {
+//                    throw new RuntimeException("no eOrigin for " + getName() + " found in compact file");
+//                } 
 
 //                origin = null;
 //                try {

Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014GeometryDefinition.java
 =============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014GeometryDefinition.java	(original)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014GeometryDefinition.java	Thu Nov  6 17:24:26 2014
@@ -3,8 +3,12 @@
  */
 package org.lcsim.geometry.compact.converter;
 
-import java.util.ArrayList;
-
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Vector;
+import hep.physics.vec.VecOp;
+
+import org.apache.commons.math3.geometry.euclidean.threed.Rotation;
+import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
 import org.jdom.Element;
 
 
@@ -43,28 +47,27 @@
         HPSTrackerGeometryDefinition.TrackingVolume tracking = new HPSTrackerGeometryDefinition.TrackingVolume("trackingVolume",null);
         surveyVolumes.add(tracking);
 
-        
-        TrackerEnvelope base = new TrackerEnvelope("base",tracking);
-        surveyVolumes.add(base);
-
-        AlignmentCorrection alignmentCorrectionRingSupport = null;
-        SupportRing supportRing = new SupportRing("c_support", base, alignmentCorrectionRingSupport, node); 
+        PSVacuumChamber chamber = new PSVacuumChamber("chamber", tracking, null);
+        surveyVolumes.add(chamber);
+        
+        SvtBox svtBox = new SvtBox("base",chamber, null);
+        surveyVolumes.add(svtBox);
+
+        SvtBoxBasePlate svtBoxBasePlate = new SvtBoxBasePlate("base_plate",svtBox,null);
+        surveyVolumes.add(svtBoxBasePlate);
+        
+        SupportRing supportRing = new SupportRing("c_support", svtBox, null, svtBoxBasePlate); 
         surveyVolumes.add(supportRing);
-
-        // The uChannel is referenced at the kinematic mount on the downstream side
-        // For L1-3 this basically handles tilt angle of support plate
-        AlignmentCorrection alignmentCorrectionUChannelBottomL13 = null;
-        UChannelL13Bottom uChannelL13Bottom = new UChannelL13Bottom("support_bottom_L13", base, alignmentCorrectionUChannelBottomL13, supportRing, node); 
+       
+        SupportRingL13BottomKinMount supportRingKinL13Bottom = new SupportRingL13BottomKinMount("c_support_kin_L13b", svtBox, null, supportRing); 
+        surveyVolumes.add(supportRingKinL13Bottom);
+        
+        UChannelL13Bottom uChannelL13Bottom = new UChannelL13Bottom("support_bottom_L13", svtBox, null, supportRingKinL13Bottom); 
         surveyVolumes.add(uChannelL13Bottom);
         
-        // build the uChannel plate
-        AlignmentCorrection alignmentCorrectionUChannelBottomL13Plate = null;
-        UChannelL13BottomPlate uChannelL13BottomPlate = new UChannelL13BottomPlate("support_plate_bottom_L13", base , alignmentCorrectionUChannelBottomL13Plate, uChannelL13Bottom, node); 
+        UChannelL13BottomPlate uChannelL13BottomPlate = new UChannelL13BottomPlate("support_plate_bottom_L13", uChannelL13Bottom, null); 
         surveyVolumes.add(uChannelL13BottomPlate);
         
-     // Modules are built using an encapsulating class that keeps tracks of all components
-        modules = new ArrayList<ModuleBundle>();
-
         for(int l=1; l<=6;++l) {
             if(doLayer(l)) {
                 if(doBottom) makeModuleBundle(l,"bottom");
@@ -119,56 +122,141 @@
     }
 
     
-    
-    /**
-     * @SurveyVolume volume defining the envelope corresponding to inner volume of PS magnet system. 
-     * It is referenced to the tracking coordinate system.
+    /**
+     * @SurveyVolume volume defining the pair spectrometer (PS) vacuum chamber
+     * Reference: tracking volume coordinate system
+     * Origin: same as reference
+     * Orientation:  same as reference
      * 
      * @author Per Hansson Adrian <[log in to unmask]>
      *
      */
-    public static class TrackerEnvelope extends SurveyVolume {
-        public static final double height = PS_vac_box_inner_height - HPSTestRunTracker2014GeometryDefinition.BasePlate.base_plate_offset_height; 
-        public static final double width = HPSTestRunTracker2014GeometryDefinition.BasePlate.base_plate_width;
-        public static final double length = HPSTestRunTracker2014GeometryDefinition.BasePlate.base_plate_length;
-
-        public TrackerEnvelope(String name, SurveyVolume mother) {
-            super(name,mother, null);
+    public static class PSVacuumChamber extends SurveyVolume {
+        public static final double height = PS_vac_box_inner_height; 
+        public static final double width = PS_vac_box_inner_width;
+        public static final double length = PS_vac_box_inner_length;
+        
+        
+        
+        public PSVacuumChamber(String name, SurveyVolume mother, AlignmentCorrection alignmentCorrection) {
+            super(name, mother, alignmentCorrection);
             init();
-        }
-        protected void setPos() {
-            final double ball_pos_x = -1.0*target_pos_wrt_base_plate_x;
-            final double ball_pos_base_y = -1.0*target_pos_wrt_base_plate_y;
-            final double ball_pos_base_z = target_pos_wrt_base_plate_z;     
-            setBallPos(ball_pos_x,ball_pos_base_y,ball_pos_base_z);
-            setVeePos(ball_pos_x + width,ball_pos_base_y,ball_pos_base_z);
-            setFlatPos(ball_pos_x,ball_pos_base_y,ball_pos_base_z - length);
-//            setBallPos(0,0,0);
-//            setVeePos(width,0,0);
-//            setFlatPos(0,0,-1.0*length);
-        }
-        protected void setCenter() {
-            setCenter(width/2.0, length/2.0, height/2.0);
+         }
+        
+        protected void setCenter() {
+            setCenter(0, 0, 0);
         }
         protected void setBoxDim() {
             setBoxDim(width,length,height);
         }
-    }
-    
+        protected void setPos() {
+            ballPos = new BasicHep3Vector(0, 0, 500.0); //TODO fix this random offset
+            veePos = new BasicHep3Vector(ballPos.x() + 1, ballPos.y(), ballPos.z());
+            flatPos = new BasicHep3Vector(ballPos.x(), ballPos.y(), ballPos.z()-1);
+            
+        }
+    }
+    
+    
+    /**
+     * @SurveyVolume volume defining the SVT box envelope 
+     * Reference: PS vacuum chamber coordinate system.
+     * Origin: intersection of midplanes vertically and horizontally
+     * Orientation: u - width towards positron side, v - length towards upstream
+     * 
+     * @author Per Hansson Adrian <[log in to unmask]>
+     *
+     */
+    public static class SvtBox extends SurveyVolume {
+        public static final double height = 6.740*inch;
+        public static final double width = SvtBoxBasePlate.width;
+        public static final double length = SvtBoxBasePlate.length;
+        
+        
+        
+        public SvtBox(String name, SurveyVolume mother, AlignmentCorrection alignmentCorrection) {
+            super(name, mother, alignmentCorrection);
+            init();
+         }
+        
+        protected void setCenter() {
+            setCenter(0,0,0);
+        }
+        protected void setBoxDim() {
+            setBoxDim(width,length,height);
+        }
+        protected void setPos() {
+            
+            ballPos = new BasicHep3Vector(0, 0, 0);
+            veePos = new BasicHep3Vector(ballPos.x()+1, ballPos.y(), ballPos.z());
+            flatPos = new BasicHep3Vector(ballPos.x(), ballPos.y()+1, ballPos.z());
+            
+        }
+    }
+    
+    
+    /**
+     * @SurveyVolume volume defining the base plate of the SVT box.
+     * Reference: @SvtBox  coordinate system.
+     * Origin: surface of base plate intersection with center of hole for adjustment screw on positron side
+     * Orientation: same as reference
+     * 
+     * @author Per Hansson Adrian <[log in to unmask]>
+     *
+     */
+    public static class SvtBoxBasePlate extends SurveyVolume {
+        public static final double length = 50.5*inch;
+        public static final double width = 16.0*inch;
+        public static final double height = 0.25*inch;
+        public static final double kin_mount_to_edge_of_plate_x = (8.0-5.0)*inch; 
+        public static final double kin_mount_to_edge_of_plate_y = 0.375*inch;
+        public static final double adj_screw_height = 0.13*inch; // amount screw sticks out from plate
+        public static final double adj_screw_width = 0.13*inch; // amount screw sticks out on side
+        
+        
+        public SvtBoxBasePlate(String name, SurveyVolume mother, AlignmentCorrection alignmentCorrection) {
+           super(name, mother, alignmentCorrection);
+           setMaterial("Aluminum");
+           init();
+        }
+        
+        protected void setCenter() {
+            final double x = -kin_mount_to_edge_of_plate_x + SvtBoxBasePlate.width/2.0;
+            final double y = -kin_mount_to_edge_of_plate_y + SvtBoxBasePlate.length/2.0;
+            final double z = -SvtBoxBasePlate.height/2.0;     
+            setCenter(new BasicHep3Vector(x, y, z));
+        }
+        protected void setBoxDim() {
+            setBoxDim(width, length, height);
+        }
+        protected void setPos() {
+            final double x = -width/2.0 + kin_mount_to_edge_of_plate_x;
+            final double y = -length/2.0 + kin_mount_to_edge_of_plate_y;
+            final double z = -SvtBox.height/2.0 + height;
+            ballPos = new BasicHep3Vector(x, y, z);
+            veePos = new BasicHep3Vector(ballPos.x()+1, ballPos.y(), ballPos.z());
+            flatPos = new BasicHep3Vector(ballPos.x(), ballPos.y()+1, ballPos.z());
+        }
+        
+    }
     
     
     
     
     /**
      * @SurveyVolume volume defining the coordinate system of the support ring in the SVT box coordinate system
-     *
-     * @author Per Hansson Adrian <[log in to unmask]>
-     *
-     */
-    public static class SupportRing extends CompactSurveyVolume {
-
-        public SupportRing(String name, SurveyVolume mother, AlignmentCorrection alignmentCorrection, Element node) {
-           super(name, mother, alignmentCorrection, node);
+     *  Reference: tracker envelope coordinate system.
+     *  Origin: pin position of support ring (it's on the electron side)
+     *  Orientation: hole position is vee position (it's on the positron side).
+     *  
+     * @author Per Hansson Adrian <[log in to unmask]>
+     *
+     */
+    public static class SupportRing extends SurveyVolume {
+        private static final double plate_thickness = 0.25*inch; // TODO not sure if this is correct
+
+        public SupportRing(String name, SurveyVolume mother, AlignmentCorrection alignmentCorrection, SurveyVolume ref) {
+           super(name, mother, alignmentCorrection, ref);
            init();
         }
         protected void setCenter() {
@@ -177,73 +265,222 @@
         protected void setBoxDim() {
             // do nothing
         }
+        protected void setPos() {
+
+            //if(debug) 
+            //System.out.printf("%s: setPos\n", this.getClass().getSimpleName());
+
+            final double ball_pos_x = -SvtBoxBasePlate.kin_mount_to_edge_of_plate_x + SvtBoxBasePlate.width/2.0 - 6.622*inch;
+            final double ball_pos_y = -SvtBoxBasePlate.kin_mount_to_edge_of_plate_y + SvtBoxBasePlate.length -28.531*inch;
+            final double ball_pos_z = 0.0;
+
+            
+            final double vee_pos_x = -SvtBoxBasePlate.kin_mount_to_edge_of_plate_x + SvtBoxBasePlate.width/2.0 + 6.622*inch;
+            final double vee_pos_y = -SvtBoxBasePlate.kin_mount_to_edge_of_plate_y + SvtBoxBasePlate.length - 28.127*inch;
+            final double vee_pos_z = 0.0;
+            
+            
+            ballPos = new BasicHep3Vector(ball_pos_x, ball_pos_y, ball_pos_z);
+            veePos = new BasicHep3Vector(vee_pos_x, vee_pos_y, vee_pos_z);
+            flatPos = new BasicHep3Vector(0,0,0);
+            //if(debug) {
+            //System.out.printf("%s: before setting flat:\n", this.getClass().getSimpleName());
+            //printSurveyPos();
+            //}
+            Hep3Vector uPrime = VecOp.unit(VecOp.sub(veePos, ballPos));
+            //TransformationUtils.getCardanAngles(new BasicHep3Vector(1,0,0), uPrime, u_prime, v_prime)
+            Rotation r = new Rotation(new Vector3D(1,0,0),new Vector3D(0,0,1), new Vector3D(uPrime.v()), new Vector3D(0,0,1));
+            Hep3Vector vPrime = new BasicHep3Vector(r.applyTo(new Vector3D(0, 1, 0)).toArray());
+            flatPos = VecOp.add(ballPos, vPrime);
+            //if(debug) {
+            //System.out.printf("%s: after setting flat:\n", this.getClass().getSimpleName());
+            //printSurveyPos();
+            //}
+            
+            
+        }
         
     }
    
-    /**
-     * @SurveyVolume volume defining the coordinate system of the u-channel in the @SupportRing coordinate system
-     *
-     * @author Per Hansson Adrian <[log in to unmask]>
-     *
-     */
-    public static class UChannelL13Bottom extends CompactSurveyVolume {
+    
+    
+    /**
+     * @SurveyVolume volume defining the coordinate system from the kinematic mount positions
+     *  Reference: @SupportRing coordinate system
+     *  Origin: cone mount (it's on the electron side)
+     *  Orientation: slot mount is vee position.
+     *  
+     * @author Per Hansson Adrian <[log in to unmask]>
+     *
+     */
+    public static class SupportRingL13BottomKinMount extends SurveyVolume {
+
+        public static final double kin_mount_offset_vertically = 0.113*inch; // TODO fix this offset
+        
+        public SupportRingL13BottomKinMount(String name, SurveyVolume mother, AlignmentCorrection alignmentCorrection, SurveyVolume ref) {
+           super(name, mother, alignmentCorrection, ref);
+           init();
+        }
+        protected void setCenter() {
+            setCenter(null); //dummy
+        }
+        protected void setBoxDim() {
+            // do nothing
+        }
+        protected void setPos() {
+
+            //if(debug) 
+            //System.out.printf("%s: setPos\n", this.getClass().getSimpleName());
+
+            final double ball_pos_x = (7.0 - 5.444) *inch;
+            final double ball_pos_y = 0.574*inch;
+            final double ball_pos_z = SupportRing.plate_thickness + kin_mount_offset_vertically;
+            ballPos = new BasicHep3Vector(ball_pos_x, ball_pos_y, ball_pos_z);
+            
+            final double vee_pos_x = (2*7.0)*inch;
+            final double vee_pos_y = ball_pos_y;
+            final double vee_pos_z = ball_pos_z;
+            veePos = new BasicHep3Vector(vee_pos_x, vee_pos_y, vee_pos_z);
+            
+            final double flat_pos_x = ball_pos_x;
+            final double flat_pos_y = ball_pos_y + 1.0; // random distance
+            final double flat_pos_z = ball_pos_z;
+            flatPos = new BasicHep3Vector(flat_pos_x,flat_pos_y,flat_pos_z);
+        }
+        
+    }
+    
+    
+    
+    /**
+     * @SurveyVolume volume defining the coordinate system of the u-channel 
+     *  Reference: SupportRingL13BottomKinMount coordinate system
+     *  Origin: midpoint between upstream survey cones
+     *  Orientation: u - width pointing towards electron side, v - pointing along the U-channel in the beam direction
+     *  
+     *  @author Per Hansson Adrian <[log in to unmask]>
+     *
+     */
+    public static class UChannelL13Bottom extends SurveyVolume {
         public final static double width = UChannelL13BottomPlate.width;
         public final static double length = UChannelL13BottomPlate.length;
-        public final static double height = 50.0;
+        public final static double height = 2.575*inch;
+        public static final double kin_mount_to_edge_of_plate_x = width/2.0-4.0*inch; 
+        public static final double kin_mount_to_edge_of_plate_y = length-15.8*inch;
+        public final static double cone_to_edge_of_plate_y = 12.25*inch; 
+        public final static double cone_to_L1_hole_y = cone_to_edge_of_plate_y - kin_mount_to_edge_of_plate_y; 
+        public final static double side_plate_cone_y = 2.0*inch;
+        
+        
+        
         
         public UChannelL13Bottom(String name, SurveyVolume m,
                 AlignmentCorrection alignmentCorrection,
-                SurveyVolume ref, Element node2) {
-            super(name, m, alignmentCorrection, ref, node2);
+                SurveyVolume ref) {
+            super(name, m, alignmentCorrection, ref);
             init();
         }
         protected void setCenter() {
-            //TODO set UChannelL13Bottom position properly
-            setCenter(width/2.0, length/2.0, height/2.0);
+            final double x = 0.0;
+            final double y = cone_to_L1_hole_y + kin_mount_to_edge_of_plate_y - length/2.0;
+            final double z = -side_plate_cone_y - UChannelL13BottomPlate.height + height/2.0;
+            setCenter(x,y,z);
         }
         protected void setBoxDim() {
             setBoxDim(width,length,height);
         }
-    }
-
-    /**
-     * @SurveyVolume volume defining the coordinate system of the u-channel plate in the @UChannelL13Bottom coordinate system
-     *
-     * @author Per Hansson Adrian <[log in to unmask]>
-     *
-     */
-    public static class UChannelL13BottomPlate extends CompactSurveyVolume {
-        public final static double width = 200.0;
-        public final static double length = 400.0;
-        public final static double height = 0.5*inch;
-
+        protected void setPos() {
+            //locate cone from pin hole
+            final double ball_pos_x = 4*inch;
+            final double ball_pos_y = (4.175 + 2*3.937) * inch; 
+            final double ball_pos_z = side_plate_cone_y; // TODO need to find distance to surface from kin mount
+            
+            ballPos = new BasicHep3Vector(ball_pos_x, ball_pos_y, ball_pos_z);
+            veePos = new BasicHep3Vector(ballPos.x()-1, ballPos.y(), ballPos.z());
+            flatPos = new BasicHep3Vector(ballPos.x(), ballPos.y()-1, ballPos.z());
+        }
+    }
+
+    
+    
+    public abstract static class UChannelL13Plate extends SurveyVolume {
+        public final static double pocket_depth_L1 = 0.025;
+        public final static double pocket_depth_L2 = pocket_depth_L1 + 0.059;
+        public final static double pocket_depth_L3 = pocket_depth_L2 + 0.059;
+        public final static double hole_to_hole_x =3.937*inch;
+        
+        public UChannelL13Plate(String name, SurveyVolume m,
+                AlignmentCorrection alignmentCorrection) {
+            super(name, m, alignmentCorrection);
+        }
+        
+        /**
+         * Get pocket depth for this plate
+         * @param layer
+         * @return pocket depth
+         */
+        public static double getPocketDepth(int layer) {
+             if(layer==1) return pocket_depth_L1;
+             else if(layer==2) return pocket_depth_L2;
+             else if(layer==3) return pocket_depth_L3;
+             else {
+                 throw new RuntimeException("Trying to create a L1-3 module with invalid layer nr: " + layer);
+             }
+        }
+        
+    }
+        
+    
+    /**
+     * @SurveyVolume volume defining the coordinate system of the u-channel plate
+     * Reference:  @UChannelL13Bottom coordinate system
+     * Origin:  same as reference
+     * Orientation: same as reference
+     *
+     * @author Per Hansson Adrian <[log in to unmask]>
+     *
+     */
+    public static class UChannelL13BottomPlate extends UChannelL13Plate {
+        public final static double width = 9.25*inch;
+        public final static double length = 16.0*inch;
+        public final static double height = 0.375*inch;
+       
+        
         public UChannelL13BottomPlate(String name, SurveyVolume m,
-                AlignmentCorrection alignmentCorrection,
-                SurveyVolume ref, Element node2) {
-            super(name, m, alignmentCorrection, ref, node2);
+                AlignmentCorrection alignmentCorrection) {
+            super(name, m, alignmentCorrection);
+            setMaterial("Aluminum");
             init();
         }
 
         protected void setCenter() {
-            //TODO set UChannelL13Bottom position properly
-            setCenter(0, 0, 0);
+            final double x = 0.0;
+            final double y = UChannelL13Bottom.cone_to_edge_of_plate_y - length/2.0;
+            final double z = -UChannelL13Bottom.side_plate_cone_y - height/2.0;
+            setCenter(x,y,z);
         }
         protected void setBoxDim() {
             setBoxDim(width,length,height);
         }
-
-    }
-
-    
-    public static abstract class BaseModule extends CompactSurveyVolume {
+        protected void setPos() {
+           ballPos = new BasicHep3Vector(0, 0, 0);
+           veePos = new BasicHep3Vector(1, 0, 0);
+           flatPos = new BasicHep3Vector(0, 1, 0);
+        }
+
+        
+       
+    }
+    
+    public static abstract class BaseModule extends SurveyVolume {
         private int layer;
         private String half;
         protected final static double box_extra_length = 10.0;// random at this point
         protected final static double box_extra_width = 15.0;// random at this point
         protected final static double box_extra_height = 1.0;// random at this point
 
-        public BaseModule(String name, SurveyVolume mother, AlignmentCorrection alignmentCorrection, SurveyVolume ref, Element node2) {
-            super(name, mother, alignmentCorrection, ref, node2);
+        public BaseModule(String name, SurveyVolume mother, AlignmentCorrection alignmentCorrection, SurveyVolume ref) {
+            super(name, mother, alignmentCorrection, ref);
             setLayer(getLayerFromVolumeName(name));
             setHalf(getHalfFromName(name));
             isValid();
@@ -276,29 +513,104 @@
     }
     
     
-    
-
-    
-    public static class ModuleL13 extends BaseModule {
-        
-        protected static final double length = 205.2 + box_extra_length; // includes lexan spacer and cold block
-        protected static final double height = 12.5 + box_extra_height; // includes screws height
-        protected static final double width = 71.3 - 13.0 + box_extra_width; // height from cold block to encapsulate the whole module
-       
-        public ModuleL13(String name, SurveyVolume mother, AlignmentCorrection alignmentCorrection, SurveyVolume ref, Element node2) {
-            super(name, mother, alignmentCorrection, ref, node2);
+
+    /**
+     * @SurveyVolume volume defining the coordinate system of module L1-3
+     * Reference:  @UChannelL13Bottom coordinate system
+     * Origin:  hole position on mounting surface (sensor side)
+     * Orientation: u - is normal to the surface, v - points along module away from hybrid side.
+     * 
+     * @author Per Hansson Adrian <[log in to unmask]>
+     *
+     */
+    public abstract static class ModuleL13 extends BaseModule {
+        public static final double hole_to_center_of_plate_x = 3.75*inch;
+        private static final double tension_lever_y = 2.5*inch;
+        public static final double length = 8.0*inch;  
+        public static final double height = 1.0*inch;
+        public static final double width = tension_lever_y;//TODO find the right length to encapsualte L1-3 module
+        public static final double hole_to_end_of_module_x = 7.750*inch;
+        
+        public ModuleL13(String name, SurveyVolume mother, AlignmentCorrection alignmentCorrection, SurveyVolume ref) {
+            super(name, mother, alignmentCorrection, ref);
+            
+        }
+        protected void setCenter() {
+            //TODO the position of this module is not correct.
+            setCenter(width/2.0, -hole_to_center_of_plate_x, height/2.0);
+        }
+        protected void setBoxDim() {
+            setBoxDim(width, length, height);
+        }
+        protected void setPos() {
+            ballPos = getHole();
+            veePos = new BasicHep3Vector(ballPos.x(), ballPos.y(), ballPos.z()+1.0);
+            flatPos = new BasicHep3Vector(ballPos.x()-1, ballPos.y(), ballPos.z());
+        }
+        protected abstract Hep3Vector getHole();
+    }
+    
+    
+    public static class ModuleL1 extends ModuleL13 {
+
+        public ModuleL1(String name, SurveyVolume mother,
+                AlignmentCorrection alignmentCorrection, SurveyVolume ref) {
+            super(name, mother, alignmentCorrection, ref);
             init();
         }
-        protected void setCenter() {
-            setCenter(0.0, 0.0, 0.0);
-        }
-        protected void setBoxDim() {
-            setBoxDim(width, length, height);
-        }
-
-    }
-    
-    
+        protected Hep3Vector getHole() {
+            //hole position (sensor side)
+            double x = -hole_to_center_of_plate_x;
+            double y = 0.0; // TODO assume that cone and module mount pin hole is at same y. Check if true.
+            double z = -UChannelL13Bottom.side_plate_cone_y - UChannelL13Plate.pocket_depth_L1;
+            return new BasicHep3Vector(x, y, z);
+        }
+        
+    }
+    
+    
+    public static class ModuleL2 extends ModuleL13 {
+
+        public ModuleL2(String name, SurveyVolume mother,
+                AlignmentCorrection alignmentCorrection, SurveyVolume ref) {
+            super(name, mother, alignmentCorrection, ref);
+            init();
+        }
+        protected Hep3Vector getHole() {
+            //hole position (sensor side)
+            double x = -hole_to_center_of_plate_x;
+            double y = UChannelL13BottomPlate.hole_to_hole_x;
+            double z = -UChannelL13Bottom.side_plate_cone_y - UChannelL13Plate.pocket_depth_L2;
+            return new BasicHep3Vector(x, y, z);
+        }
+        
+    }
+    
+    public static class ModuleL3 extends ModuleL13 {
+
+        public ModuleL3(String name, SurveyVolume mother,
+                AlignmentCorrection alignmentCorrection, SurveyVolume ref) {
+            super(name, mother, alignmentCorrection, ref);
+            init();
+        }
+        protected Hep3Vector getHole() {
+            //hole position (sensor side)
+            double x = -hole_to_center_of_plate_x;
+            double y = 2*UChannelL13BottomPlate.hole_to_hole_x;
+            double z = -UChannelL13Bottom.side_plate_cone_y - UChannelL13Plate.pocket_depth_L3;
+            return new BasicHep3Vector(x, y, z);
+        }
+        
+    }
+        
+    
+    
+    /**
+     * Bundle volumes into a module. 
+     * 
+     * @author Per Hansson Adrian <[log in to unmask]>
+     *
+     */
     public static class SVTModuleBundle extends ModuleBundle {
         SVTModuleBundle(BaseModule m) {
             module = m;
@@ -326,31 +638,32 @@
         // build the module name
         String volName = "module_L"+ layer + (half=="bottom"?"b":"t");      
 
-        boolean isL13 = ( layer >=1 && layer <=3 ) ? true : false;          
-
         // find the mother and reference geometry
         // Note that the reference geometry is the support plate and since that is assumed to be 
         // created through it's references we don't need more than one reference to reach the mother coordinate system
-        final SurveyVolume mother;
+        final SurveyVolume mother = getSurveyVolume(SvtBox.class);
         final SurveyVolume ref;
         AlignmentCorrection alignmentCorrection = null;
         if(half == "bottom") {
-            mother = getSurveyVolume(TrackerEnvelope.class);
-            ref = getSurveyVolume(UChannelL13BottomPlate.class);
+            if(layer < 4) {
+                ref = getSurveyVolume(UChannelL13Bottom.class);
+            } else {
+                throw new UnsupportedOperationException("L4-6 not implemented yet");
+            }
         } else {
             throw new UnsupportedOperationException("top not implemented yet");
-            //            mother= getSurveyVolume(TrackerEnvelope.class);
-//            ref = getSurveyVolume(UChannelL13TopPlate.class);
         }
 
         //Create the module
         BaseModule module;
-        if(isL13) {
-            module = new ModuleL13(volName, mother, alignmentCorrection, ref, node); 
-                   
+        if(layer==1) {
+            module = new ModuleL1(volName, mother, alignmentCorrection, ref); 
+        } else if(layer==2) {
+            module = new ModuleL2(volName, mother, alignmentCorrection, ref); 
+        } else if(layer==3) {
+            module = new ModuleL3(volName, mother, alignmentCorrection, ref); 
         } else {
-            throw new UnsupportedOperationException("L4-6 not implemented yet");
-            //module = new TestRunModuleL45(volName, mother, ref, layer, half);
+            throw new UnsupportedOperationException("Layer " + layer + " not implemented yet");
         }
 
 

Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014LCDDBuilder.java
 =============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014LCDDBuilder.java	(original)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014LCDDBuilder.java	Thu Nov  6 17:24:26 2014
@@ -1,7 +1,11 @@
 package org.lcsim.geometry.compact.converter;
 
 import org.jdom.Element;
-import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.TrackerEnvelope;
+import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.PSVacuumChamber;
+import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.SupportRing;
+import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.SupportRingL13BottomKinMount;
+import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.SvtBoxBasePlate;
+import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.SvtBox;
 import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.UChannelL13Bottom;
 import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.UChannelL13BottomPlate;
 import org.lcsim.geometry.compact.converter.HPSTrackerBuilder.ModuleBundle;
@@ -50,14 +54,30 @@
         LCDDSurveyVolume trackingGeometry = new LCDDSurveyVolume(_builder.getSurveyVolume(TrackingVolume.class), worldVolume);
         add(trackingGeometry);
 
-        baseSurveyVolume = new LCDDSurveyVolume(_builder.getSurveyVolume(TrackerEnvelope.class), lcdd, trackingGeometry);
+        baseSurveyVolume = new LCDDSurveyVolume(_builder.getSurveyVolume(PSVacuumChamber.class), lcdd, trackingGeometry);
         add(baseSurveyVolume); 
+
+        LCDDSurveyVolume svtBox = new LCDDSurveyVolume(_builder.getSurveyVolume(SvtBox.class), lcdd, baseSurveyVolume);
+        add(svtBox); 
+
+       
+        LCDDSurveyVolume svtBoxBasePlate = new LCDDSurveyVolume(_builder.getSurveyVolume(SvtBoxBasePlate.class), lcdd, svtBox);
+        add(svtBoxBasePlate); 
+
+       
+        // probably not needed?!
+        //LCDDSurveyVolume supportRing = new LCDDGhostSurveyVolume(_builder.getSurveyVolume(SupportRing.class), svtBox);
+        //add(supportRing); 
+
+        // probably not needed?!        
+        //LCDDSurveyVolume supportRingKinL13b = new LCDDGhostSurveyVolume(_builder.getSurveyVolume(SupportRingL13BottomKinMount.class), svtBox);
+        //add(supportRingKinL13b); 
         
-        LCDDSurveyVolume uSupportBottomL13 = new LCDDGhostSurveyVolume(_builder.getSurveyVolume(UChannelL13Bottom.class), baseSurveyVolume);
-        add(uSupportBottomL13);
-
-        LCDDSurveyVolume uSupportPlateBottomL13 = new LCDDSurveyVolume(_builder.getSurveyVolume(UChannelL13BottomPlate.class), lcdd, baseSurveyVolume);
-        add(uSupportPlateBottomL13);
+        LCDDSurveyVolume uChannelL13Bottom = new LCDDSurveyVolume(_builder.getSurveyVolume(UChannelL13Bottom.class),lcdd,  svtBox);
+        add(uChannelL13Bottom);
+        
+        LCDDSurveyVolume uChannelL13BottomPlate = new LCDDSurveyVolume(_builder.getSurveyVolume(UChannelL13BottomPlate.class), lcdd, uChannelL13Bottom);
+        add(uChannelL13BottomPlate);
         
         
         // build modules    

Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerBuilder.java
 =============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerBuilder.java	(original)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerBuilder.java	Thu Nov  6 17:24:26 2014
@@ -15,7 +15,7 @@
 public abstract class HPSTrackerBuilder {
 
 	private boolean debug = true;
-	public List<ModuleBundle> modules;
+	public List<ModuleBundle> modules = new ArrayList<ModuleBundle>();
 	protected List<SurveyVolume> surveyVolumes = new ArrayList<SurveyVolume>();
     protected Element node;
     protected List<MilleParameter> milleparameters = new ArrayList<MilleParameter>();
@@ -146,7 +146,6 @@
 	
 	/**
      * Bundle volumes into a module. 
-     * TODO If the geometry definition has access to daughter information I could avoid this? 
      * 
      * @author Per Hansson Adrian <[log in to unmask]>
      *

Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerGeometryDefinition.java
 =============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerGeometryDefinition.java	(original)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerGeometryDefinition.java	Thu Nov  6 17:24:26 2014
@@ -38,6 +38,11 @@
     protected static final double target_pos_wrt_base_plate_y = 80.55; //from Tim's sketchup //68.75; //from Marco's 3D model
     protected static final double target_pos_wrt_base_plate_z = 926.59; //from Marco's 3D model
     protected static final double PS_vac_box_inner_height = 7.0*inch;
+    protected static final double PS_vac_box_inner_width = 16.38*inch;
+    // Inner length of the vacuum box is defined here until the horizontal fan-out. 
+    // It's a little random as I'm actually not creating a volume for it here and thus
+    // it just needs to capture the SVT box.
+    protected static final double PS_vac_box_inner_length = 53.4*inch; 
 
 
 

Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/SurveyCoordinateSystem.java
 =============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/SurveyCoordinateSystem.java	(original)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/SurveyCoordinateSystem.java	Thu Nov  6 17:24:26 2014
@@ -147,6 +147,8 @@
 			Transform3D envelopeToSupportTransform = new Transform3D(translation, rotation);
 			return envelopeToSupportTransform;
 		}
-
+		
+		
+		
 		
 	}

Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/util/TransformationUtils.java
 =============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/util/TransformationUtils.java	(original)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/util/TransformationUtils.java	Thu Nov  6 17:24:26 2014
@@ -172,6 +172,7 @@
     	return point_rot;
     }
 
+
     
     
 }

Modified: projects/lcsim/trunk/detector-framework/src/test/resources/org/lcsim/geometry/subdetector/HPSTracker2014.xml
 =============================================================================
--- projects/lcsim/trunk/detector-framework/src/test/resources/org/lcsim/geometry/subdetector/HPSTracker2014.xml	(original)
+++ projects/lcsim/trunk/detector-framework/src/test/resources/org/lcsim/geometry/subdetector/HPSTracker2014.xml	Thu Nov  6 17:24:26 2014
@@ -55,12 +55,21 @@
   <detectors>
     <detector id="1" name="Tracker" type="HPSTracker2014" readout="TrackerHits">
         <SurveyVolumes>
-            <SurveyVolume name="c_support">
-                <SurveyPos>
-                    <point name="ball"  x="192.5" y="608.0" z="0.0"/>
-                    <point name="vee"   x="193.5" y="608.0" z="0.0"/>
-                    <point name="flat"  x="192.5" y="609.0" z="0.0"/>                    
+            <SurveyVolume name="base">
+            <SurveyPos>
+                <point name="ball"  x="0.0" y="0.0" z="0.0"/>
+                <point name="vee"   x="1.0" y="0.0" z="0.0"/>
+                <point name="flat"  x="0.0" y="0.0" z="-1.0"/> 
+                </SurveyPos>                  
+            </SurveyVolume>
+            <SurveyVolume name="base_plate">
+            <SurveyPos>
+            <point name="ball"  x="0.0" y="0.0" z="0.0"/>
+                <point name="vee"   x="1.0" y="0.0" z="0.0"/>
+                <point name="flat"  x="0.0" y="1.0" z="0.0"/>     
                 </SurveyPos>
+            </SurveyVolume>
+            
                 <!-- 
                 <SurveyCoord>
                     <origin x="" y="" z=""/>
@@ -69,7 +78,6 @@
                     <unitVec name="w"  x="0.0" y="1.0" z="0.0"/>                    
                 </SurveyCoord>
                  -->
-            </SurveyVolume>
             <SurveyVolume name="support_bottom_L13">
                 <SurveyPos>
                     <point name="ball"  x="0.0" y="0.0" z="0.0"/>

########################################################################
Use REPLY-ALL to reply to list

To unsubscribe from the LCDET-SVN list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCDET-SVN&A=1