LISTSERV mailing list manager LISTSERV 16.5

Help for LCDET-SVN Archives


LCDET-SVN Archives

LCDET-SVN Archives


LCDET-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

LCDET-SVN Home

LCDET-SVN Home

LCDET-SVN  November 2014

LCDET-SVN November 2014

Subject:

r3431 - in /projects/lcsim/trunk/detector-framework/src: main/java/org/lcsim/detector/converter/compact/ main/java/org/lcsim/geometry/compact/converter/ main/java/org/lcsim/geometry/subdetector/ test/java/org/lcsim/geometry/subdetector/

From:

[log in to unmask]

Reply-To:

Notification of commits to the lcdet svn repository <[log in to unmask]>

Date:

Tue, 25 Nov 2014 07:41:27 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (840 lines)

Author: [log in to unmask]
Date: Mon Nov 24 23:41:19 2014
New Revision: 3431

Log:
Adding Java builder for 2014 tracker. Add 2014 detector to list of converters. Add 2014 Java converter test. Fix 2014 LCDD ghost volumes and update support plates: still someting not quite right about L13 top plate position.

Added:
    projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/converter/compact/HPSTracker2014Converter.java
    projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014JavaBuilder.java
    projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/subdetector/HPSTracker2014.java
    projects/lcsim/trunk/detector-framework/src/test/java/org/lcsim/geometry/subdetector/HPSTracker2014Test.java
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/HPSTestRunTracker2014Converter.java
    projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/converter/compact/HPSTracker2014ConverterBase.java
    projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014JavaBuilder.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/test/java/org/lcsim/geometry/subdetector/HPSTestRunTracker2014Test.java

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	Mon Nov 24 23:41:19 2014
@@ -115,7 +115,7 @@
         addSubdetectorConverter(new HPSEcal3Converter());
         addSubdetectorConverter(new HPSMuonCalorimeterConverter());
         addSubdetectorConverter(new HPSTestRunTracker2014Converter());
-        //addSubdetectorConverter(new HPSTracker2014Converter());
+        addSubdetectorConverter(new HPSTracker2014Converter());
 
         // Support structures.
         addSubdetectorConverter(new PolyconeSupportConverter());

Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/converter/compact/HPSTestRunTracker2014Converter.java
 =============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/converter/compact/HPSTestRunTracker2014Converter.java	(original)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/converter/compact/HPSTestRunTracker2014Converter.java	Mon Nov 24 23:41:19 2014
@@ -6,9 +6,10 @@
 import org.jdom.Element;
 import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014JavaBuilder;
 import org.lcsim.geometry.compact.converter.HPSTrackerJavaBuilder;
+import org.lcsim.geometry.subdetector.HPSTestRunTracker2014;
 
 /**
- * Converters the HPSTestRunTracker2014 compact description into Java runtime objects
+ * Converts the HPSTestRunTracker2014 compact description into Java runtime objects
  * @author Per Hansson Adrian <[log in to unmask]>
  *
  */
@@ -25,6 +26,8 @@
 	     return new HPSTestRunTracker2014JavaBuilder(_debug,node);
 	 }
     
-	
+	public Class getSubdetectorType() {
+        return HPSTestRunTracker2014.class;
+    }
 	
 }

Added: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/converter/compact/HPSTracker2014Converter.java
 =============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/converter/compact/HPSTracker2014Converter.java	(added)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/converter/compact/HPSTracker2014Converter.java	Mon Nov 24 23:41:19 2014
@@ -0,0 +1,29 @@
+package org.lcsim.detector.converter.compact;
+
+import org.jdom.Element;
+import org.lcsim.geometry.compact.converter.HPSTracker2014JavaBuilder;
+import org.lcsim.geometry.compact.converter.HPSTrackerJavaBuilder;
+import org.lcsim.geometry.subdetector.HPSTracker2014;
+
+
+/**
+ * Converts the HPSTracker2014 compact description into Java runtime objects
+ * @author Per Hansson Adrian <[log in to unmask]>
+ *
+ */
+public class HPSTracker2014Converter extends HPSTracker2014ConverterBase {
+
+    public HPSTracker2014Converter() {
+        super();
+    }
+
+    protected HPSTrackerJavaBuilder initializeBuilder(Element node) {
+       return new HPSTracker2014JavaBuilder(_debug, node);
+    }
+
+    public Class getSubdetectorType() {
+        return HPSTracker2014.class;
+    }
+
+}
+

Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/converter/compact/HPSTracker2014ConverterBase.java
 =============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/converter/compact/HPSTracker2014ConverterBase.java	(original)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/converter/compact/HPSTracker2014ConverterBase.java	Mon Nov 24 23:41:19 2014
@@ -4,13 +4,13 @@
 import org.lcsim.detector.DetectorElement;
 import org.lcsim.detector.DetectorElementStore;
 import org.lcsim.detector.DetectorIdentifierHelper;
+import org.lcsim.detector.DetectorIdentifierHelper.SystemMap;
 import org.lcsim.detector.IDetectorElement;
 import org.lcsim.detector.IGeometryInfo;
 import org.lcsim.detector.ILogicalVolume;
 import org.lcsim.detector.IPhysicalVolume;
 import org.lcsim.detector.PhysicalVolume;
 import org.lcsim.detector.Transform3D;
-import org.lcsim.detector.DetectorIdentifierHelper.SystemMap;
 import org.lcsim.detector.identifier.ExpandedIdentifier;
 import org.lcsim.detector.identifier.IExpandedIdentifier;
 import org.lcsim.detector.identifier.IIdentifier;
@@ -27,7 +27,6 @@
 import org.lcsim.geometry.compact.converter.HPSTrackerJavaBuilder;
 import org.lcsim.geometry.compact.converter.JavaGhostSurveyVolume;
 import org.lcsim.geometry.compact.converter.JavaSurveyVolume;
-import org.lcsim.geometry.subdetector.HPSTestRunTracker2014;
 
 /**
  * Converters the compact description into Java runtime objects
@@ -51,15 +50,12 @@
      * @return builder.
      */
     abstract protected HPSTrackerJavaBuilder initializeBuilder(Element node);
-        
     
     public IIdentifierHelper makeIdentifierHelper(Subdetector subdetector, SystemMap systemMap) {
     	return new SiTrackerIdentifierHelper(subdetector.getDetectorElement(), makeIdentifierDictionary(subdetector), systemMap);
     }
 
-    public Class getSubdetectorType() {
-    	return HPSTestRunTracker2014.class;
-    }
+    
 
     /* (non-Javadoc)
      * @see org.lcsim.detector.converter.compact.AbstractSubdetectorConverter#convert(org.lcsim.geometry.compact.Subdetector, org.lcsim.geometry.compact.Detector)

Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014JavaBuilder.java
 =============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014JavaBuilder.java	(original)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014JavaBuilder.java	Mon Nov 24 23:41:19 2014
@@ -109,7 +109,7 @@
 			if(isDebug()) System.out.printf("%s: found mother %s to module %s\n", getClass().getSimpleName(),mother.getName(),m.module.getName());
 			
 			// put the module in the list of objects that will be added to LCDD
-			addModule(m, mother);
+			addTestRunModule(m, mother);
 			
 			if(isDebug()) System.out.printf("%s: DONE build module %s\n", getClass().getSimpleName(), m.module.getName());
 
@@ -140,7 +140,7 @@
 	 * @param bundle - module to be added
 	 * @param mother - mother JAVA geometry object
 	 */
-	private void addModule(TestRunModuleBundle bundle, JavaSurveyVolume mother) {
+	protected void addTestRunModule(TestRunModuleBundle bundle, JavaSurveyVolume mother) {
 		
 		if(isDebug()) {
 			System.out.printf("%s: addModule %s containing:\n",this.getClass().getSimpleName(), bundle.module.getName());

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	Mon Nov 24 23:41:19 2014
@@ -72,7 +72,7 @@
         UChannelL13 uChannelL13Bottom = new UChannelL13Bottom("support_bottom_L13", svtBox, null, supportRingKinL13Bottom); 
         surveyVolumes.add(uChannelL13Bottom);
         
-        UChannelL13Plate uChannelL13BottomPlate = new UChannelL13BottomPlate("support_plate_bottom_L13", uChannelL13Bottom, null); 
+        UChannelL13Plate uChannelL13BottomPlate = new UChannelL13BottomPlate("support_plate_bottom_L13", svtBox, null, uChannelL13Bottom); 
         surveyVolumes.add(uChannelL13BottomPlate);
 
         SupportRingL13TopKinMount supportRingKinL13Top = new SupportRingL13TopKinMount("c_support_kin_L13t", svtBox, null, supportRing); 
@@ -81,19 +81,19 @@
         UChannelL13Top uChannelL13Top = new UChannelL13Top("support_top_L13", svtBox, null, supportRingKinL13Top); 
         surveyVolumes.add(uChannelL13Top);
         
-        UChannelL13Plate uChannelL13TopPlate = new UChannelL13TopPlate("support_plate_top_L13", uChannelL13Top, null); 
+        UChannelL13Plate uChannelL13TopPlate = new UChannelL13TopPlate("support_plate_top_L13", svtBox, null, uChannelL13Top); 
         surveyVolumes.add(uChannelL13TopPlate);
         
         UChannelL46 uChannelL46Bottom = new UChannelL46Bottom("support_bottom_L46", svtBox, null);
         surveyVolumes.add(uChannelL46Bottom);
         
-        UChannelL46Plate uChannelL46BottomPlate = new UChannelL46BottomPlate("support_plate_bottom_L46", uChannelL46Bottom, null);
+        UChannelL46Plate uChannelL46BottomPlate = new UChannelL46BottomPlate("support_plate_bottom_L46", svtBox, null, uChannelL46Bottom);
         surveyVolumes.add(uChannelL46BottomPlate);
 
         UChannelL46 uChannelL46Top = new UChannelL46Top("support_top_L46", svtBox, null);
         surveyVolumes.add(uChannelL46Top);
         
-        UChannelL46Plate uChannelL46TopPlate = new UChannelL46TopPlate("support_plate_top_L46", uChannelL46Top, null);
+        UChannelL46Plate uChannelL46TopPlate = new UChannelL46TopPlate("support_plate_top_L46", svtBox, null, uChannelL46Top);
         surveyVolumes.add(uChannelL46TopPlate);
 
         
@@ -392,7 +392,7 @@
      *  @author Per Hansson Adrian <[log in to unmask]>
      */
     public abstract static class UChannelL13 extends SurveyVolume {
-
+        public final static double length = UChannelL13Plate.length;
         public static final double width = UChannelL13Plate.width;
         public static final double height = 2.575*inch;
         public static final double kin_mount_to_edge_of_plate_x = width/2.0-4.0*inch;
@@ -406,17 +406,15 @@
         protected void setBoxDim() {
             setBoxDim(getWidth(),getLength(),getHeight());
         }
-        
+        protected double getLength() {
+            return length;
+        }
         protected double getWidth() {
             return width;
         }
-        
-        protected abstract double getLength();
-        
         protected double getHeight() {
             return height;
         }
-        
     }
     
     /**
@@ -429,10 +427,9 @@
      *
      */
     public static class UChannelL13Bottom extends UChannelL13 {
-        public final static double length = UChannelL13BottomPlate.length;
-        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; 
+        private static final double kin_mount_to_edge_of_plate_y = length-15.8*inch;
+        private final static double cone_to_edge_of_plate_y = 12.25*inch; 
+        //private final static double cone_to_L1_hole_y = cone_to_edge_of_plate_y - kin_mount_to_edge_of_plate_y; 
         public UChannelL13Bottom(String name, SurveyVolume m,
                 AlignmentCorrection alignmentCorrection,
                 SurveyVolume ref) {
@@ -441,25 +438,21 @@
         }
         protected void setCenter() {
             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 y = cone_to_edge_of_plate_y - length/2.0;
             final double z = -side_plate_cone_y - UChannelL13Plate.height + height/2.0;
             setCenter(x,y,z);
         }
         protected void setPos() {
             final double ball_pos_x = 4*inch;
-            final double ball_pos_y = (4.175 + 2*3.937) * inch; 
+            //final double ball_pos_y = (4.175 + 2*3.937) * inch; 
+            final double ball_pos_y =  cone_to_edge_of_plate_y - kin_mount_to_edge_of_plate_y;
             final double ball_pos_z = -SupportRingL13KinMount.kin_mount_offset_vertically + UChannelL13Plate.height + side_plate_cone_y; 
             
             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());
         }
-        
-        protected double getLength() {
-           return length;
-        }
-    }
-
+    }
     
     /**
      * @SurveyVolume volume defining the coordinate system of the top L1-3 u-channel 
@@ -472,10 +465,10 @@
      *
      */
     public static class UChannelL13Top extends UChannelL13 {
-        public final static double length = UChannelL13TopPlate.length;
-        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 = 10.999*inch; 
-        public final static double cone_to_L1_hole_y = cone_to_edge_of_plate_y - kin_mount_to_edge_of_plate_y; 
+        private final static double length = UChannelL13.length;
+        private static final double kin_mount_to_edge_of_plate_y = length-15.8*inch;
+        private final static double cone_to_edge_of_plate_y = 10.999*inch; 
+        //private final static double cone_to_L1_hole_y = cone_to_edge_of_plate_y - kin_mount_to_edge_of_plate_y; 
         public UChannelL13Top(String name, SurveyVolume m,
                 AlignmentCorrection alignmentCorrection,
                 SurveyVolume ref) {
@@ -484,13 +477,14 @@
         }
         protected void setCenter() {
             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 y = cone_to_edge_of_plate_y - length/2.0;
             final double z = -side_plate_cone_y - UChannelL13Plate.height + height/2.0;
             setCenter(x,y,z);
         }
         protected void setPos() {
             final double ball_pos_x = 4*inch;
-            final double ball_pos_y = (4.175 + 2*3.937) * inch;
+            //final double ball_pos_y = (4.175 + 2*3.937) * inch;
+            final double ball_pos_y = cone_to_edge_of_plate_y - kin_mount_to_edge_of_plate_y;
             // TODO need to find proper position of from kin mount
             final double ball_pos_z = SupportRingL13KinMount.kin_mount_offset_vertically - side_plate_cone_y; 
             // The coordinate system is flipped pi around v compared to bottom
@@ -513,17 +507,17 @@
      *
      */
     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 module_mounting_hole_to_hole_x =3.937*inch;
-        public static final double width = 9.25*inch;
-        public static final double height = 0.375*inch;
-        public final static double length = 16.0*inch;
+        private final static double pocket_depth_L1 = 0.025;
+        private final static double pocket_depth_L2 = pocket_depth_L1 + 0.059;
+        private final static double pocket_depth_L3 = pocket_depth_L2 + 0.059;
+        private final static double module_mounting_hole_to_hole_x =3.937*inch;
+        private static final double width = 9.25*inch;
+        protected static final double height = 0.375*inch;
+        protected final static double length = 16.0*inch;
         
         public UChannelL13Plate(String name, SurveyVolume m,
-                AlignmentCorrection alignmentCorrection) {
-            super(name, m, alignmentCorrection);
+                AlignmentCorrection alignmentCorrection, SurveyVolume ref) {
+            super(name, m, alignmentCorrection, ref);
             setMaterial("Aluminum");
         }
         
@@ -575,8 +569,8 @@
      */
     public static class UChannelL13BottomPlate extends UChannelL13Plate {
         public UChannelL13BottomPlate(String name, SurveyVolume m,
-                AlignmentCorrection alignmentCorrection) {
-            super(name, m, alignmentCorrection);
+                AlignmentCorrection alignmentCorrection, SurveyVolume ref) {
+            super(name, m, alignmentCorrection, ref);
             init();
         }
 
@@ -599,22 +593,17 @@
      *
      */
     public static class UChannelL13TopPlate extends UChannelL13Plate {
-        public final static double length = 16.0*inch;
         public UChannelL13TopPlate(String name, SurveyVolume m,
-                AlignmentCorrection alignmentCorrection) {
-            super(name, m, alignmentCorrection);
+                AlignmentCorrection alignmentCorrection, SurveyVolume ref) {
+            super(name, m, alignmentCorrection, ref);
             init();
         }
 
         protected void setCenter() {
             final double x = 0.0;
-            final double y = UChannelL13Bottom.cone_to_edge_of_plate_y - length/2.0;
+            final double y = UChannelL13Top.cone_to_edge_of_plate_y - length/2.0;
             final double z = -UChannelL13.side_plate_cone_y - height/2.0;
             setCenter(x,y,z);
-        }
-
-        public double getLength() {
-            return length;
         }
        
     }
@@ -627,14 +616,14 @@
      */
     public abstract static class UChannelL46 extends SurveyVolume {
 
-        public static final double width = UChannelL46Plate.width;
-        public static final double length = UChannelL46Plate.length;
-        public static final double height = 2.575*inch;
-        public static final double kin_mount_to_edge_of_plate_x = width/2.0-5.75*inch;
-        public static final double kin_mount_to_edge_of_plate_y = 0.2*inch;
-        public static final double cone_to_edge_of_plate_y = 2.75*inch;
-        public static final double side_plate_cone_y = 2.0*inch;
-        public static final double cone_to_L1_hole_y = cone_to_edge_of_plate_y - kin_mount_to_edge_of_plate_y;
+        protected static final double width = UChannelL46Plate.width;
+        protected static final double length = UChannelL46Plate.length;
+        protected static final double height = 2.575*inch;
+        private static final double kin_mount_to_edge_of_plate_x = width/2.0-5.75*inch;
+        private static final double kin_mount_to_edge_of_plate_y = 0.2*inch;
+        protected static final double cone_to_edge_of_plate_y = 2.75*inch;
+        protected static final double side_plate_cone_y = 2.0*inch;
+        private static final double cone_to_L1_hole_y = cone_to_edge_of_plate_y - kin_mount_to_edge_of_plate_y;
 
         public UChannelL46(String name, SurveyVolume m,
                 AlignmentCorrection alignmentCorrection) {
@@ -742,8 +731,8 @@
         public static final double height = 0.5*inch;
         
         public UChannelL46Plate(String name, SurveyVolume m,
-                AlignmentCorrection alignmentCorrection) {
-            super(name, m, alignmentCorrection);
+                AlignmentCorrection alignmentCorrection, SurveyVolume ref) {
+            super(name, m, alignmentCorrection, ref);
             setMaterial("Aluminum");
         }
         
@@ -795,8 +784,8 @@
      */
     public static class UChannelL46BottomPlate extends UChannelL46Plate {
         public UChannelL46BottomPlate(String name, SurveyVolume m,
-                AlignmentCorrection alignmentCorrection) {
-            super(name, m, alignmentCorrection);
+                AlignmentCorrection alignmentCorrection, SurveyVolume ref) {
+            super(name, m, alignmentCorrection, ref);
             init();
         }
 
@@ -821,8 +810,8 @@
      */
     public static class UChannelL46TopPlate extends UChannelL46Plate {
         public UChannelL46TopPlate(String name, SurveyVolume m,
-                AlignmentCorrection alignmentCorrection) {
-            super(name, m, alignmentCorrection);
+                AlignmentCorrection alignmentCorrection, SurveyVolume ref) {
+            super(name, m, alignmentCorrection, ref);
             init();
         }
 

Added: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014JavaBuilder.java
 =============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014JavaBuilder.java	(added)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014JavaBuilder.java	Mon Nov 24 23:41:19 2014
@@ -0,0 +1,198 @@
+/**
+ * 
+ */
+package org.lcsim.geometry.compact.converter;
+
+import java.util.ArrayList;
+
+import org.jdom.Element;
+import org.lcsim.detector.ILogicalVolume;
+import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.Sensor;
+import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.LongHalfModuleBundle;
+import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.LongModuleBundle;
+import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.PSVacuumChamber;
+import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.SvtBox;
+import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.SvtBoxBasePlate;
+import org.lcsim.geometry.compact.converter.HPSTrackerBuilder.BaseModuleBundle;
+import org.lcsim.geometry.compact.converter.HPSTrackerBuilder.HalfModuleBundle;
+import org.lcsim.geometry.compact.converter.HPSTrackerGeometryDefinition.TestRunModuleBundle;
+import org.lcsim.geometry.compact.converter.HPSTrackerGeometryDefinition.TrackingVolume;
+
+
+/**
+ * Class used by java converter to build java run time objects for the detector
+ * It encapsulates and adds the LCDD specific information to the generic @HPSTestRunTracker2014Builder. 
+ * 
+ * @author Per Hansson Adrian <[log in to unmask]>
+ *
+ */
+public class HPSTracker2014JavaBuilder extends HPSTestRunTracker2014JavaBuilder {
+
+	
+	
+	/**
+	 * Default constructor
+	 * @param node 
+	 */
+	public HPSTracker2014JavaBuilder(boolean debugFlag, Element node) {
+		super(debugFlag, node);
+	}
+	
+	
+	
+	/**
+	 * Build the JAVA geometry objects from the geometry definition.
+	 * @param trackingVolume - the reference volume.
+	 */
+	public void build(ILogicalVolume trackingVolume) {
+
+		// build geometry
+        setBuilder(new HPSTracker2014GeometryDefinition(this._debug, node));
+		
+		if(_builder==null) throw new RuntimeException("need to set builder class before calling build!");
+
+		if(isDebug()) System.out.printf("%s: build the base geometry objects\n", getClass().getSimpleName());
+		
+		_builder.build();
+
+		if(isDebug()) System.out.printf("%s: DONE build the base geometry objects\n", getClass().getSimpleName());
+
+		if(isDebug()) System.out.printf("%s: build the JAVA geometry objects\n", getClass().getSimpleName());
+		
+		// initialize the list to store a reference to each object
+		javaSurveyVolumes = new ArrayList<JavaSurveyVolume>();
+
+		// Go through the list of volumes to build that is created in the generic builder class
+		JavaSurveyVolume tracking = new JavaSurveyVolume(_builder.getSurveyVolume(TrackingVolume.class), trackingVolume);
+		add(tracking);
+		JavaSurveyVolume chamber = new JavaGhostSurveyVolume(_builder.getSurveyVolume(PSVacuumChamber.class), tracking);
+		add(chamber);
+		setBaseTrackerGeometry(new JavaSurveyVolume(_builder.getSurveyVolume(SvtBox.class), chamber,1));
+		add(getBaseTrackerGeometry());
+		JavaSurveyVolume svtBoxBasePlate = new JavaGhostSurveyVolume(_builder.getSurveyVolume(SvtBoxBasePlate.class), getBaseTrackerGeometry());
+		add(svtBoxBasePlate);
+
+		
+		// build modules	
+		
+		if(isDebug()) System.out.printf("%s: build JAVA modules\n", getClass().getSimpleName());
+
+		// Loop over all modules created
+		for(BaseModuleBundle mod : _builder.modules) {
+			BaseModuleBundle m = mod;
+		    if(isDebug()) { 
+				System.out.printf("%s: build module %s (layer %d half %s)\n", getClass().getSimpleName(),m.module.getName(),m.getLayer(),m.getHalf());
+				m.print();
+			}
+
+			// Find the mother among the objects using its name, should probably have a better way...
+			String name_mother = m.getMother().getName();
+			JavaSurveyVolume mother = null;
+			for(JavaSurveyVolume g : javaSurveyVolumes) {
+				if(g.getName().equals(name_mother)) {
+					mother = g;
+					break;
+				}
+			}
+			// Check that it had a mother
+			if(mother==null) throw new RuntimeException("Cound't find mother to module " + m.module.getName());
+
+			if(isDebug()) System.out.printf("%s: found mother %s to module %s\n", getClass().getSimpleName(),mother.getName(),m.module.getName());
+			
+			// put the module in the list of objects that will be added to LCDD
+			addModule(m, mother);
+			
+			if(isDebug()) System.out.printf("%s: DONE build module %s\n", getClass().getSimpleName(), m.module.getName());
+
+			
+		}
+		
+		if(isDebug()) System.out.printf("%s: DONE build JAVA modules\n", getClass().getSimpleName());
+
+		
+		if(isDebug()) System.out.printf("%s: DONE building the JAVA geometry objects\n", getClass().getSimpleName());
+		if(isDebug()) {
+		    System.out.printf("%s: DONE building the JAVA geometry objects\n", getClass().getSimpleName());
+		    System.out.printf("%s: List of all the JAVA geometry objects built\n", this.getClass().getSimpleName());
+		    for(JavaSurveyVolume bg : javaSurveyVolumes) {
+		        System.out.printf("-------\n%s\n", bg.toString());
+		    }
+		}
+
+
+		// Set visualization features
+		//setVis();
+
+
+	}
+
+	/**
+	 * Rules for adding the JAVA module geometry.
+	 * @param bundle - module to be added
+	 * @param mother - mother JAVA geometry object
+	 */
+	private void addModule(BaseModuleBundle bundle, JavaSurveyVolume mother) {
+	    if(bundle instanceof TestRunModuleBundle) {
+	           addTestRunModule((TestRunModuleBundle) bundle, mother);
+	       } else if(bundle instanceof LongModuleBundle) {
+	           addLongModule((LongModuleBundle) bundle, mother);
+	       } else {
+	           throw new RuntimeException("The bundle is of unknown class type!");
+	       }
+	}
+	
+	/**
+     * Rules for adding the LCDD module geometry.
+     * @param bundle - module to be added
+     * @param mother - mother LCDD geometry object
+     */
+    private void addLongModule(LongModuleBundle bundle, JavaSurveyVolume mother) {
+        // This could perhaps be fixed if there is a relation with daughters in geometry definition?
+        // create the module
+        JavaSurveyVolume lcddM = new JavaGhostSurveyVolume(bundle.module, mother);
+        add(lcddM);
+        if(bundle.halfModuleAxialHole!=null)  addLongHalfModule(bundle.halfModuleAxialHole,lcddM);
+        if(bundle.halfModuleAxialSlot!=null)  addLongHalfModule(bundle.halfModuleAxialSlot,lcddM);
+        //if(bundle.coldBlock!=null)        add(new LCDDSurveyVolume(bundle.coldBlock, lcdd, lcddM));     
+        if(bundle.halfModuleStereoHole!=null)  addLongHalfModule(bundle.halfModuleStereoHole,lcddM);
+        if(bundle.halfModuleStereoSlot!=null)  addLongHalfModule(bundle.halfModuleStereoSlot,lcddM);
+    }
+
+
+
+    private void addLongHalfModule(HalfModuleBundle bundle2, JavaSurveyVolume mother) {
+        LongHalfModuleBundle bundle = (LongHalfModuleBundle) bundle2;
+        // Create the half-module
+        // This is not a ghost element but reflects the module 
+        // concept in the old compact description
+        int oldCompactModuleId = 0;
+        JavaSurveyVolume lcddHM = new JavaSurveyVolume(bundle.halfModule, mother,oldCompactModuleId);
+        add(lcddHM);
+        
+        // ComponentNumber is taken from old geometry where it is simply a counter when adding the xml daughters to the TestRunModule.
+        // It is simply 0 for sensor and 1 for carbon fiber in the old geometry 
+        int componentNumber = ((Sensor)bundle.sensor).getId();
+
+        // create the sensor
+        JavaSurveyVolume lcddS = new JavaSurveyVolume(bundle.sensor, lcddHM, componentNumber);
+        add(lcddS);
+
+        // create the active sensor
+        JavaSurveyVolume lcddAS = new JavaSurveyVolume(bundle.activeSensor, lcddS, componentNumber);
+        add(lcddAS);
+        
+//      if(isDebug()) {
+//          System.out.printf("%s: added sensor %s \n",this.getClass().getSimpleName(), lcddS.getName());
+//          System.out.printf("%s: local coordinate system\n%s\n",this.getClass().getSimpleName(), bundle.sensor.getCoord().toString());
+//          dsd
+//      }
+        
+        
+    }
+	
+
+	
+	
+	
+
+}

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	Mon Nov 24 23:41:19 2014
@@ -72,37 +72,29 @@
         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 uChannelL13Bottom = new LCDDSurveyVolume(_builder.getSurveyVolume(UChannelL13Bottom.class),lcdd,  svtBox);
+        
+        LCDDSurveyVolume uChannelL13Bottom = new LCDDGhostSurveyVolume(_builder.getSurveyVolume(UChannelL13Bottom.class),  svtBox);
         add(uChannelL13Bottom);
         
-        LCDDSurveyVolume uChannelL13BottomPlate = new LCDDSurveyVolume(_builder.getSurveyVolume(UChannelL13BottomPlate.class), lcdd, uChannelL13Bottom);
+        LCDDSurveyVolume uChannelL13BottomPlate = new LCDDSurveyVolume(_builder.getSurveyVolume(UChannelL13BottomPlate.class), lcdd, svtBox);
         add(uChannelL13BottomPlate);
 
-        LCDDSurveyVolume uChannelL13Top = new LCDDSurveyVolume(_builder.getSurveyVolume(UChannelL13Top.class),lcdd,  svtBox);
+        LCDDSurveyVolume uChannelL13Top = new LCDDGhostSurveyVolume(_builder.getSurveyVolume(UChannelL13Top.class), svtBox);
         add(uChannelL13Top);
         
-        LCDDSurveyVolume uChannelL13TopPlate = new LCDDSurveyVolume(_builder.getSurveyVolume(UChannelL13TopPlate.class), lcdd, uChannelL13Top);
+        LCDDSurveyVolume uChannelL13TopPlate = new LCDDSurveyVolume(_builder.getSurveyVolume(UChannelL13TopPlate.class), lcdd, svtBox);
         add(uChannelL13TopPlate);
         
-        LCDDSurveyVolume uChannelL46Bottom = new LCDDSurveyVolume(_builder.getSurveyVolume(UChannelL46Bottom.class), lcdd, svtBox);
+        LCDDSurveyVolume uChannelL46Bottom = new LCDDGhostSurveyVolume(_builder.getSurveyVolume(UChannelL46Bottom.class), svtBox);
         add(uChannelL46Bottom);        
         
-        LCDDSurveyVolume uChannelL46BottomPlate = new LCDDSurveyVolume(_builder.getSurveyVolume(UChannelL46BottomPlate.class), lcdd, uChannelL46Bottom);
+        LCDDSurveyVolume uChannelL46BottomPlate = new LCDDSurveyVolume(_builder.getSurveyVolume(UChannelL46BottomPlate.class), lcdd, svtBox);
         add(uChannelL46BottomPlate);        
 
-        LCDDSurveyVolume uChannelL46Top = new LCDDSurveyVolume(_builder.getSurveyVolume(UChannelL46Top.class), lcdd, svtBox);
+        LCDDSurveyVolume uChannelL46Top = new LCDDGhostSurveyVolume(_builder.getSurveyVolume(UChannelL46Top.class), svtBox);
         add(uChannelL46Top);        
         
-        LCDDSurveyVolume uChannelL46TopPlate = new LCDDSurveyVolume(_builder.getSurveyVolume(UChannelL46TopPlate.class), lcdd, uChannelL46Top);
+        LCDDSurveyVolume uChannelL46TopPlate = new LCDDSurveyVolume(_builder.getSurveyVolume(UChannelL46TopPlate.class), lcdd, svtBox);
         add(uChannelL46TopPlate);        
 
         

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	Mon Nov 24 23:41:19 2014
@@ -256,8 +256,14 @@
 	}
 
 	   public static boolean isHalfModule(String name) {
-	        if(name.endsWith("halfmodule_axial") || name.endsWith("halfmodule_stereo")) {
-	            return true;
+	       if(name.endsWith("halfmodule_axial") || 
+	               name.endsWith("halfmodule_axial_slot") ||
+	               name.endsWith("halfmodule_axial_hole") ||
+	               name.endsWith("halfmodule_stereo") ||
+	               name.endsWith("halfmodule_stereo_slot") ||
+	               name.endsWith("halfmodule_stereo_hole"
+	                       )) {
+	           return true;
 	        }
 	        return false;
 	    }

Added: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/subdetector/HPSTracker2014.java
 =============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/subdetector/HPSTracker2014.java	(added)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/subdetector/HPSTracker2014.java	Mon Nov 24 23:41:19 2014
@@ -0,0 +1,30 @@
+package org.lcsim.geometry.subdetector;
+
+import hep.graphics.heprep.HepRep;
+import hep.graphics.heprep.HepRepFactory;
+
+import org.jdom.Element;
+import org.jdom.JDOMException;
+import org.lcsim.detector.converter.heprep.DetectorElementToHepRepConverter;
+
+public class HPSTracker2014 extends AbstractTracker {
+    
+    public HPSTracker2014(Element node) throws JDOMException 
+    {
+        super(node);
+    }
+
+    public void appendHepRep(HepRepFactory factory, HepRep heprep) 
+    {
+        DetectorElementToHepRepConverter.convert(getDetectorElement(), factory, heprep, -1, false, getVisAttributes().getColor());
+    }
+    
+    public boolean isEndcap() {
+        return false;
+    }
+    
+    public boolean isBarrel() {
+        return true;
+    }
+
+}

Modified: projects/lcsim/trunk/detector-framework/src/test/java/org/lcsim/geometry/subdetector/HPSTestRunTracker2014Test.java
 =============================================================================
--- projects/lcsim/trunk/detector-framework/src/test/java/org/lcsim/geometry/subdetector/HPSTestRunTracker2014Test.java	(original)
+++ projects/lcsim/trunk/detector-framework/src/test/java/org/lcsim/geometry/subdetector/HPSTestRunTracker2014Test.java	Mon Nov 24 23:41:19 2014
@@ -1,6 +1,8 @@
 package org.lcsim.geometry.subdetector;
 
 import java.io.InputStream;
+
+import junit.framework.TestCase;
 
 import org.lcsim.detector.DetectorElementStore;
 import org.lcsim.detector.IDetectorElement;
@@ -8,11 +10,6 @@
 import org.lcsim.detector.PhysicalVolumePath;
 import org.lcsim.geometry.Detector;
 import org.lcsim.geometry.GeometryReader;
-import org.lcsim.geometry.compact.converter.lcdd.HPSTestRunTracker2014;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
 
 /**
  * @author Per Hansson Adrian <[log in to unmask]>
@@ -29,7 +26,6 @@
 	protected void setUp() throws Exception {
 		GeometryReader geometryReader = new GeometryReader();
 		geometryReader.setBuildDetailed(true);
-		//String pathToCompactFile = "/org/lcsim/geometry/subdetector/HPSTestRun2014-v0.xml";
 		String pathToCompactFile = "/org/lcsim/geometry/subdetector/HPSTestRunTracker2014.xml";
 
 		InputStream in = HPSTestRunTracker2014Test.class.getResourceAsStream(pathToCompactFile);

Added: projects/lcsim/trunk/detector-framework/src/test/java/org/lcsim/geometry/subdetector/HPSTracker2014Test.java
 =============================================================================
--- projects/lcsim/trunk/detector-framework/src/test/java/org/lcsim/geometry/subdetector/HPSTracker2014Test.java	(added)
+++ projects/lcsim/trunk/detector-framework/src/test/java/org/lcsim/geometry/subdetector/HPSTracker2014Test.java	Mon Nov 24 23:41:19 2014
@@ -0,0 +1,51 @@
+package org.lcsim.geometry.subdetector;
+
+import java.io.InputStream;
+
+import org.lcsim.detector.DetectorElementStore;
+import org.lcsim.detector.IDetectorElement;
+import org.lcsim.detector.IDetectorElementStore;
+import org.lcsim.detector.PhysicalVolumePath;
+import org.lcsim.geometry.Detector;
+import org.lcsim.geometry.GeometryReader;
+
+import junit.framework.TestCase;
+
+/**
+ * @author Per Hansson Adrian <[log in to unmask]>
+ *
+ */
+public class HPSTracker2014Test extends TestCase {
+
+    
+    Detector det;
+    public HPSTracker2014Test(String name) {
+        super(name);
+    }
+    
+    protected void setUp() throws Exception {
+        GeometryReader geometryReader = new GeometryReader();
+        geometryReader.setBuildDetailed(true);
+        String pathToCompactFile = "/org/lcsim/geometry/subdetector/HPSTracker2014.xml";
+
+        InputStream in = HPSTracker2014Test.class.getResourceAsStream(pathToCompactFile);
+        det = geometryReader.read(in);
+        
+        System.out.printf("%s: detector name converted: %s\n",this.getClass().getSimpleName(), det.getName());
+        
+        
+    }
+    
+    public void test() {
+        
+        
+        IDetectorElementStore store =  DetectorElementStore.getInstance();
+        System.out.printf("%s: Printing %d DE:\n",this.getClass().getSimpleName(), store.size());
+        System.out.printf("%s: %50s %40s %50s %50s\n",this.getClass().getSimpleName(), "name", "pos", "path","mother");
+        for(IDetectorElement e : store) {
+            System.out.printf("%s: %50s %40s %50s %50s \n",this.getClass().getSimpleName(), e.getName(),e.hasGeometryInfo()?e.getGeometry().getPosition().toString():" - ",e.hasGeometryInfo()?((PhysicalVolumePath)e.getGeometry().getPath()).toString():" - ",e.getParent()==null?" - ":e.getParent().getName());
+        }
+    }
+   
+
+}

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

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use