Print

Print


Author: [log in to unmask]
Date: Sat Apr 25 15:23:58 2015
New Revision: 3593

Log:
Fixed bug that returned to base class of the half-module. Create base class to be more cleanly able to create a new converter by simply overriding one module. Add some docs, more needed. 

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/HPSTracker2014v1GeometryDefinition.java
    projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerBuilder.java

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	Sat Apr 25 15:23:58 2015
@@ -1672,7 +1672,24 @@
 
     
     
-    public static class LongAxialSlotHalfModule extends LongHalfModule {
+    public abstract static class LongAxialSlotHalfModuleBase extends LongHalfModule {
+
+        private final static double sensor_x = 1.382*inch;
+        private final static double sensor_y = 7.863*inch;
+
+        public LongAxialSlotHalfModuleBase(String name, SurveyVolume mother,
+                AlignmentCorrection alignmentCorrection, int layer,
+                String half) {
+            super(name, mother, alignmentCorrection, layer, half);
+        }
+       
+        protected Hep3Vector getSensorPosition() {
+            return new BasicHep3Vector(-sensor_x, sensor_y, -sensor_z);
+        }
+
+    }
+
+    public static class LongAxialSlotHalfModule extends LongAxialSlotHalfModuleBase {
 
         private final static double sensor_x = 1.382*inch;
         private final static double sensor_y = 7.863*inch;
@@ -1688,11 +1705,8 @@
         protected Hep3Vector getSensorPosition() {
             return new BasicHep3Vector(-sensor_x, sensor_y, -sensor_z);
         }
-       
-
-
-    }
-
+    }
+    
 
     public abstract static class LongStereoHalfModule extends LongHalfModule {
 
@@ -1717,12 +1731,18 @@
             // Build full rotation
             Rotation r = r2.applyTo(r1);
             //Rotation r = r1;
-            if(debug) System.out.printf("%s: Coord before corrections\n%s\n", getClass().getSimpleName(),getCoord().toString());
-            if(debug) System.out.printf("%s: box center before corrections\n%s\n", getClass().getSimpleName(),getBoxDim().toString());
+            if(debug) {
+                System.out.printf("%s: LongStereoHalfModule Generic Corrections\n", getClass().getSimpleName());
+                System.out.printf("%s: Coord before corrections\n%s\n", getClass().getSimpleName(),getCoord().toString());
+                System.out.printf("%s: box center before corrections\n%s\n", getClass().getSimpleName(),getBoxDim().toString());
+            }
+            
             getCoord().rotateApache(r);
-            if(debug) System.out.printf("%s: Coord after corrections\n%s\n", getClass().getSimpleName(),getCoord().toString());
-            if(debug) System.out.printf("%s: box center after corrections\n%s\n", getClass().getSimpleName(),getBoxDim().toString());
-
+            
+            if(debug) {
+                System.out.printf("%s: Coord after corrections\n%s\n", getClass().getSimpleName(),getCoord().toString());
+                System.out.printf("%s: box center after corrections\n%s\n", getClass().getSimpleName(),getBoxDim().toString());
+            }
 
         }
         
@@ -1752,24 +1772,31 @@
 
 
     
-    public static class LongStereoSlotHalfModule extends LongStereoHalfModule {
+    public static abstract class LongStereoSlotHalfModuleBase extends LongStereoHalfModule {
 
         private final static double sensor_x = 1.481*inch;
         private final static double sensor_y = 7.861*inch;
         
+        public LongStereoSlotHalfModuleBase(String name, SurveyVolume mother,
+                AlignmentCorrection alignmentCorrection, int layer,
+                String half) {
+            super(name, mother, alignmentCorrection, layer, half);
+        }
+
+        protected Hep3Vector getSensorPosition() {
+            return new BasicHep3Vector(-sensor_x, sensor_y, -sensor_z);
+        }
+    }
+
+    public static class LongStereoSlotHalfModule extends LongStereoSlotHalfModuleBase {
         public LongStereoSlotHalfModule(String name, SurveyVolume mother,
                 AlignmentCorrection alignmentCorrection, int layer,
                 String half) {
             super(name, mother, alignmentCorrection, layer, half);
             init();
         }
-
-        protected Hep3Vector getSensorPosition() {
-            return new BasicHep3Vector(-sensor_x, sensor_y, -sensor_z);
-        }
-
-    }
-
+    }
+    
 
     /**
      * @SurveyVolume volume defining the coordinate system of the axial half-module in module L1-3
@@ -1908,12 +1935,7 @@
         protected void setBoxDim() {
             setBoxDim(width, length, height);
         }
-
-       
-        
-        
-    }
-    
+    }    
     
     
     
@@ -2139,11 +2161,10 @@
     
     
         // create the half module components 
-    
         makeHalfModuleComponentSensor(halfModule);
-    
+
         makeLongHalfModuleComponentKapton(halfModule);
-    
+
         //makeHalfModuleComponentCF(halfModule);
     
         //makeHalfModuleComponentHybrid(halfModule);
@@ -2192,12 +2213,30 @@
         
     }
     
+    /**
+     * Create {@link LongAxialSlotHalfModule} {@link SurveyVolume}. 
+     * @param name
+     * @param mother
+     * @param alignmentCorrection
+     * @param layer
+     * @param half
+     * @return
+     */
     protected LongHalfModule createLongAxialSlotHalfModule(String name, SurveyVolume mother,
             AlignmentCorrection alignmentCorrection, int layer,
             String half) {
         return new LongAxialSlotHalfModule(name, mother, alignmentCorrection, layer, half);
     }
 
+    /**
+     * Create {@link LongStereoSlotHalfModule} {@link SurveyVolume}. 
+     * @param name
+     * @param mother
+     * @param alignmentCorrection
+     * @param layer
+     * @param half
+     * @return
+     */
     protected LongHalfModule createLongStereoSlotHalfModule(String name, SurveyVolume mother,
             AlignmentCorrection alignmentCorrection, int layer,
             String half) {

Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014v1GeometryDefinition.java
 =============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014v1GeometryDefinition.java	(original)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014v1GeometryDefinition.java	Sat Apr 25 15:23:58 2015
@@ -17,44 +17,63 @@
         super(debug, node);
     }
 
-    public static class LongAxialSlotHalfModule extends HPSTracker2014GeometryDefinition.LongAxialSlotHalfModule  {
+    public static class LongAxialSlotHalfModule extends HPSTracker2014GeometryDefinition.LongAxialSlotHalfModuleBase  {
 
         public LongAxialSlotHalfModule(String name, SurveyVolume mother,
                 AlignmentCorrection alignmentCorrection, int layer,
                 String half) {
             super(name, mother, alignmentCorrection, layer, half);
+            init();
         }
        
         @Override
         protected void applyGenericCoordinateSystemCorrections() {
+            
             super.applyGenericCoordinateSystemCorrections();
-            // apply 180 degree rotation around w ~ normal to the sensor plane
-            if(debug) System.out.printf("%s: Coord before corrections\n%s\n", getClass().getSimpleName(),getCoord().toString());
-            if(debug) System.out.printf("%s: box center before corrections\n%s\n", getClass().getSimpleName(),getBoxDim().toString());
+            
+            // apply 180 degree rotation around w to get hybrid on the correct side
+            
+            if(debug) {
+                System.out.printf("%s: Coord before corrections\n%s\n", getClass().getSimpleName(),getCoord().toString());
+                System.out.printf("%s: box center before corrections\n%s\n", getClass().getSimpleName(),getBoxDim().toString());
+            }
             getCoord().rotateApache(getSlotRotation());
-            if(debug) System.out.printf("%s: Coord after corrections\n%s\n", getClass().getSimpleName(),getCoord().toString());
-            if(debug) System.out.printf("%s: box center after corrections\n%s\n", getClass().getSimpleName(),getBoxDim().toString());
+
+            if(debug) {
+                System.out.printf("%s: Coord after corrections\n%s\n", getClass().getSimpleName(),getCoord().toString());
+                System.out.printf("%s: box center after corrections\n%s\n", getClass().getSimpleName(),getBoxDim().toString());
+            }
         }
     }
     
-    public static class LongStereoSlotHalfModule extends HPSTracker2014GeometryDefinition.LongStereoSlotHalfModule {
+    public static class LongStereoSlotHalfModule extends HPSTracker2014GeometryDefinition.LongStereoSlotHalfModuleBase {
 
         public LongStereoSlotHalfModule(String name, SurveyVolume mother,
                 AlignmentCorrection alignmentCorrection, int layer, String half) {
             super(name, mother, alignmentCorrection, layer, half);
+            init();
         }
         
         @Override
         protected void applyGenericCoordinateSystemCorrections() {
-            // TODO Auto-generated method stub
+            
             super.applyGenericCoordinateSystemCorrections();
-            // apply 180 degree rotation around w ~ normal to the sensor plane
-            if(debug) System.out.printf("%s: Coord before corrections\n%s\n", getClass().getSimpleName(),getCoord().toString());
-            if(debug) System.out.printf("%s: box center before corrections\n%s\n", getClass().getSimpleName(),getBoxDim().toString());
+
+            if(debug) {
+                System.out.printf("%s: v1 LongStereoSlotHalfModule Generic Corrections\n", getClass().getSimpleName());
+                System.out.printf("%s: Coord before corrections\n%s\n", getClass().getSimpleName(),getCoord().toString());
+                System.out.printf("%s: box center before corrections\n%s\n", getClass().getSimpleName(),getBoxDim().toString());
+            }
+            
             getCoord().rotateApache(getSlotRotation());
-            if(debug) System.out.printf("%s: Coord after corrections\n%s\n", getClass().getSimpleName(),getCoord().toString());
-            if(debug) System.out.printf("%s: box center after corrections\n%s\n", getClass().getSimpleName(),getBoxDim().toString());
+            
+            if(debug) {
+                System.out.printf("%s: Coord after corrections\n%s\n", getClass().getSimpleName(),getCoord().toString());
+                System.out.printf("%s: box center after corrections\n%s\n", getClass().getSimpleName(),getBoxDim().toString());
+            }
         }
+
+        
     }
 
     @Override
@@ -69,9 +88,7 @@
             SurveyVolume mother, AlignmentCorrection alignmentCorrection,
             int layer, String half) {
         
-        // TODO Auto-generated method stub
-        return super.createLongStereoSlotHalfModule(name, mother, alignmentCorrection,
-                layer, half);
+        return new LongStereoSlotHalfModule(name, mother, alignmentCorrection, layer, half);
     }
 
     

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	Sat Apr 25 15:23:58 2015
@@ -198,8 +198,8 @@
         public HalfModuleBundle() {
         }
         public void print() {
-            System.out.printf("%s: %s\n", this.getClass().getSimpleName(),halfModule.toString());
-            System.out.printf("%s: %s\n", this.getClass().getSimpleName(),activeSensor.toString());
+            if(halfModule!=null) System.out.printf("%s: %s\n", this.getClass().getSimpleName(),halfModule.toString());
+            if(activeSensor!=null) System.out.printf("%s: %s\n", this.getClass().getSimpleName(),activeSensor.toString());
         }
     }
 	

########################################################################
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