projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker2014.java (rev 0)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker2014.java 2014-03-27 01:08:22 UTC (rev 3065)
@@ -0,0 +1,139 @@
+package org.lcsim.geometry.compact.converter.lcdd;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.jdom.Element;
+import org.jdom.JDOMException;
+import org.lcsim.geometry.compact.converter.lcdd.LCDDSubdetector;
+import org.lcsim.geometry.compact.converter.lcdd.util.Box;
+import org.lcsim.geometry.compact.converter.lcdd.util.LCDD;
+import org.lcsim.geometry.compact.converter.lcdd.util.Material;
+import org.lcsim.geometry.compact.converter.lcdd.util.SensitiveDetector;
+import org.lcsim.geometry.compact.converter.lcdd.util.Solids;
+import org.lcsim.geometry.compact.converter.lcdd.util.Structure;
+import org.lcsim.geometry.compact.converter.lcdd.util.VisAttributes;
+import org.lcsim.geometry.compact.converter.lcdd.util.Volume;
+
+/**
+ *
+ * Convert an SiTrackerBarrel subdetector to the LCDD format.
+ *
+ * @author Jeremy McCormick <[log in to unmask]>
+ * @author Tim Nelson <[log in to unmask]>
+ *
+ */
+public class HPSTracker2014 extends LCDDSubdetector
+{
+ private boolean _debug = true;
+
+ public HPSTracker2014(Element node) throws JDOMException
+ {
+ super(node);
+ }
+
+ /**
+ * Build the LCDD for the subdetector.
+ * @param lcdd The LCDD file being created.
+ * @param sens The SD for this subdetector.
+ */
+ public void addToLCDD(LCDD lcdd, SensitiveDetector sens) throws JDOMException
+ {
+ // ID of the detector.
+ int id = this.node.getAttribute("id").getIntValue();
+
+ // Name of the detector.
+ String detector_name = this.node.getAttributeValue("name");
+
+ if(_debug) {
+ print(String.format("detector id %d name %s", id,detector_name));
+ }
+
+ // Pick the mother volume (tracking volume).
+ Volume tracking_volume = lcdd.pickMotherVolume(this);
+
+ // Build tracking box
+ Box trackingBox = new Box("trackingBox", 60., 20, 110.); //cm
+ lcdd.add(trackingBox);
+ // Create
+ Volume trackingBoxVolume = new Volume("trackingBoxVolume", trackingBox, lcdd.getMaterial("Vacuum"));
+ lcdd.add(trackingBoxVolume);
+
+
+
+ // Loop over the support plates
+ for(Iterator iter_support = node.getChildren("support_plate").iterator(); iter_support.hasNext();) {
+
+ // Get the next support
+ Element support_element = (Element) iter_support.next();
+
+ // Get a reference element to the modules that will be placed on this support plate
+ List<Element> modules = support_element.getChildren("module");
+
+ if(_debug) {
+ print(String.format("%d modules for support plate name %s", modules.size(),support_element.getAttribute("name").getValue()));
+ for(Element module : modules) {
+ print(String.format("module layer %d", module.getAttribute("layer").getIntValue()));
+ }
+ }
+
+ // Roll: rotation around x
+ // pitch: rotation around y
+ // yaw: rotation around z
+
+ // kinematic mounts:
+ // ball (constraints x,y,z)
+ // vee (constraints pitch & yaw)
+ // flat (constraints roll)
+
+ // We should build the support plate here
+ // All positions w.r.t. tracking box
+ double support_plate_length = 50.0;
+ double support_plate_width = 20.0;
+
+ // position of ball (primary constraint: position x,y,z)
+ double support_plate_ball_x = 0.;
+ double support_plate_ball_y = 5.;
+ double support_plate_ball_z = -70.;
+
+ // position of vee (secondary constraint: pitch & yaw)
+ double support_plate_vee_x = 0.;
+ double support_plate_vee_y = 0.;
+ double support_plate_vee_z = 0.;
+
+ // position of flat (tertiary constraint: roll)
+ double support_plate_flat_x = 0.;
+ double support_plate_flat_y = 0.;
+ double support_plate_flat_z = 0.;
+
+ // local corrections to each surveyed ball positions
+ double support_plate_dx = support_element.getChild("alignment").getAttribute("x").getDoubleValue();
+ double support_plate_dy = support_element.getChild("alignment").getAttribute("y").getDoubleValue();
+ double support_plate_dz = support_element.getChild("alignment").getAttribute("z").getDoubleValue();
+ double support_plate_drx = support_element.getChild("alignment").getAttribute("rx").getDoubleValue();
+ double support_plate_dry = support_element.getChild("alignment").getAttribute("ry").getDoubleValue();
+ double support_plate_drz = support_element.getChild("alignment").getAttribute("rz").getDoubleValue();
+
+ // Build the coordinate system for the support plate
+
+
+
+
+
+
+
+
+ }
+
+
+
+ }
+
+ private void print(String str) {
+ System.out.printf("%s: %s\n", this.getClass().getSimpleName(),str);
+ }
+
+
+}
projects/lcsim/trunk/detector-framework/src/test/resources/org/lcsim/geometry/subdetector
--- projects/lcsim/trunk/detector-framework/src/test/resources/org/lcsim/geometry/subdetector/HPSTracker2014.xml 2014-03-26 23:39:16 UTC (rev 3064)
+++ projects/lcsim/trunk/detector-framework/src/test/resources/org/lcsim/geometry/subdetector/HPSTracker2014.xml 2014-03-27 01:08:22 UTC (rev 3065)
@@ -12,13 +12,18 @@
<constant name="world_x" value="world_side" />
<constant name="world_y" value="world_side" />
<constant name="world_z" value="world_side" />
- </define>
+ <!-- tracking region -->
+ <constant name="tracking_region_radius" value="200.0*cm"/>
+ <constant name="tracking_region_min" value="5.0*cm"/>
+ <constant name="tracking_region_zmax" value="131.8*cm"/>
+ </define>
+
<materials>
<!-- Set tracking material to vacuum. -->
<material name="TrackingMaterial">
<D type="density" unit="g/cm3" value="0.0000000000000001" />
- <fraction n="1.0" ref="Air" />
+ <fraction n="1.0" ref="Vacuum" />
</material>
</materials>