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  October 2014

LCDET-SVN October 2014

Subject:

r3408 - in /projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter: HPSTestRunTracker2014LCDDBuilder.java HPSTracker2014LCDDBuilder.java lcdd/HPSTracker2014.java

From:

[log in to unmask]

Reply-To:

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

Date:

Fri, 31 Oct 2014 23:41:17 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (1163 lines)

Author: phansson
Date: Fri Oct 31 16:41:15 2014
New Revision: 3408

Log:
Adding 2014 LCDD converter skeleton.

Added:
    projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014LCDDBuilder.java
Modified:
    projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014LCDDBuilder.java
    projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker2014.java

Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014LCDDBuilder.java
 =============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014LCDDBuilder.java	(original)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014LCDDBuilder.java	Fri Oct 31 16:41:15 2014
@@ -33,7 +33,7 @@
 	public void build(Volume worldVolume) {
 		
 		// build geometry
-        setBuilder(new HPSTestRunTracker2014GeometryDefinition(this._debug, this.node));
+        setBuilder(new HPSTestRunTracker2014GeometryDefinition(_debug, node));
 
 		if(_builder==null) throw new RuntimeException("need to set builder class before calling build!");
 

Added: 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	(added)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014LCDDBuilder.java	Fri Oct 31 16:41:15 2014
@@ -0,0 +1,19 @@
+package org.lcsim.geometry.compact.converter;
+
+import org.jdom.Element;
+import org.lcsim.geometry.compact.converter.lcdd.util.LCDD;
+import org.lcsim.geometry.compact.converter.lcdd.util.SensitiveDetector;
+
+public class HPSTracker2014LCDDBuilder extends HPSTestRunTracker2014LCDDBuilder {
+
+    public HPSTracker2014LCDDBuilder(boolean debugFlag, Element node,
+            LCDD lcdd, SensitiveDetector sens) {
+        
+        super(debugFlag, node, lcdd, sens);
+        
+    }
+    
+    
+    
+
+}

Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker2014.java
 =============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker2014.java	(original)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker2014.java	Fri Oct 31 16:41:15 2014
@@ -1,1083 +1,34 @@
 package org.lcsim.geometry.compact.converter.lcdd;
-
-import hep.physics.vec.BasicHep3Matrix;
-import hep.physics.vec.BasicHep3Vector;
-import hep.physics.vec.Hep3Matrix;
-import hep.physics.vec.Hep3Vector;
-import hep.physics.vec.VecOp;
-
-import java.util.ArrayList;
-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.detector.ITransform3D;
-import org.lcsim.detector.Rotation3D;
-import org.lcsim.detector.RotationGeant;
-import org.lcsim.detector.Transform3D;
-import org.lcsim.detector.Translation3D;
-import org.lcsim.geometry.compact.converter.lcdd.util.Box;
+import org.lcsim.geometry.compact.converter.HPSTracker2014LCDDBuilder;
+import org.lcsim.geometry.compact.converter.HPSTrackerLCDDBuilder;
 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.PhysVol;
-import org.lcsim.geometry.compact.converter.lcdd.util.Position;
-import org.lcsim.geometry.compact.converter.lcdd.util.Rotation;
 import org.lcsim.geometry.compact.converter.lcdd.util.SensitiveDetector;
-import org.lcsim.geometry.compact.converter.lcdd.util.Volume;
 
 /**
  * 
- * Convert an SiTrackerBarrel subdetector to the LCDD format.
+ * Convert the HPS Test run tracker 2014 to the LCDD format.
  * 
- * @author Jeremy McCormick <[log in to unmask]>
- * @author Tim Nelson <[log in to unmask]>
+ * @author Per Hansson <[log in to unmask]>
  *
  */
-public class HPSTracker2014 extends LCDDSubdetector
+public class HPSTracker2014 extends HPSTracker2014Base
 {
-	private boolean _debug = false; 
-	public static final double inch = 25.4;
+    public HPSTracker2014(Element node) throws JDOMException
+    {
+        super(node);
+    }
 
-	private final double sensor_length= 98.33;
-	private final double sensor_width = 38.3399;
-	private final double sensor_thickness = 0.32;
-	private final double hybrid_length = 55.0; // excluding the "tung" where the sensor lays on
-	private final double hybrid_width  = sensor_width;
-	private final double hybrid_width_L46  = 45.34;
-	private final double hybrid_thickness = 4.0/64.0*inch;
-	//TODO Check these numbers
-	private final double CF_thickness = 0.150;
-	private final double kapton_thickness = 0.050;
-	
-	
-
-	
-	
-	
-	public HPSTracker2014(Element node) throws JDOMException
-	{
-		super(node);
-	}
-
-	
-	public boolean isTracker() {
-		return true;
-	}
-	
-	/**
-	 * 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
-	{
-		
-		/** General comments
-		// 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)
-		**/
-		
-		
-		
-		
-		// 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 trackingVolume = lcdd.pickMotherVolume(this);
-		
-		VolWrapper trackingWrap = new VolWrapper();
-		trackingWrap.name = "trackingVolume";
-		trackingWrap.vol = trackingVolume;
-	
-		// create the box around the support plate: "support box"
-		makeSupport(trackingWrap, lcdd, sens );
-		
-		
-	
-		
-		
-		
-		
-	}
-	
-	
-	
-	private void makeSupport(VolWrapper trackingWrap, LCDD lcdd, SensitiveDetector sens) throws JDOMException {
-		
-		final double support_length = 15.0*inch; // along z
-		final double support_width = 9.25*inch; // along x
-		final double support_height = 2.5*inch + 1.5*inch; // along y TODO made this up!
-		
-		
-		String volName = "support";
-		Box box = new Box(volName + "Box", support_width, support_height , support_length);
-		lcdd.add(box);
-		Volume supportVolume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
-
-		Position pos = new Position( volName + "_position", 0,0,0); 
-		Rotation rot = new Rotation( volName + "_rotation",0,0,0);
-		lcdd.add(pos);
-		lcdd.add(rot);
-		
-		PhysVol supportPV = new PhysVol(supportVolume, trackingWrap.vol, pos, rot);
-		
-		VolWrapper supportWrap = new VolWrapper();
-		supportWrap.vol = supportVolume;
-		supportWrap.name = volName;
-		supportWrap.pos_vol = pos;
-		supportWrap.rot_vol = rot;
-		
-		
-		
-		
-		// create the support plate inside the support box
-		
-		// build the position of the support plate in the support box volume
-		// easy since the support box position is arbitrary here.
-		Hep3Vector ball_pos_support_plate = new BasicHep3Vector(support_width/2.0-0.625*inch, -1.0*support_height/2.0 + 0.755*inch, support_length/2.0 - 0.25*inch);
-		Hep3Vector vee_pos_support_plate = new BasicHep3Vector(-1.0*ball_pos_support_plate.x(),ball_pos_support_plate.y(),ball_pos_support_plate.z());
-		Hep3Vector flat_pos_support_plate = new BasicHep3Vector(0.0,ball_pos_support_plate.y(),-0.5*support_length + 0.25*inch);
-		
-		makeSupportPlate(supportWrap, ball_pos_support_plate, vee_pos_support_plate, flat_pos_support_plate, lcdd, sens );
-		
-		// create the module from positions of module ball, vee and flat w.r.t. support plate survey points
-
-		// create the coordinate system of the support plate
-		CoordSysDef support_plate_coord = new CoordSysDef(ball_pos_support_plate, vee_pos_support_plate, flat_pos_support_plate);		
-		Transform3D trans_support_plate_to_support = getTransformation(support_plate_coord);
-
-		
-		
-		print("Make modules on support plate");
-		
-		for(int ilayer = 1; ilayer <=3; ++ilayer) {
-
-			String layerName = String.format("L%db", ilayer);
-			
-			print(layerName);
-						
-			final double module_ball_local_u =  7.7*inch;
-			double module_ball_local_v = 11.625*inch;
-			double offset = 0.;
-			if(ilayer == 2) {
-					offset = -100.0;
-			} else if(ilayer == 3) {
-					offset = -200.0;
-			}
-			module_ball_local_v =  module_ball_local_v + offset;	
-			
-			// place module mounting surface at support plate surface
-			// the kin mount on support plate is sunk into plate TODO check this!!
-			final double module_ball_local_w =  -0.3195*inch; 
-			Hep3Vector ball_pos_mod_local = new BasicHep3Vector(module_ball_local_u,module_ball_local_v,module_ball_local_w);
-
-			final double module_vee_local_u =  (support_width - (7.7+0.625)*inch ) - 0.625*inch;
-			final double module_vee_local_v =  module_ball_local_v;
-			final double module_vee_local_w =  module_ball_local_w;
-			Hep3Vector vee_pos_mod_local = new BasicHep3Vector(module_vee_local_u,module_vee_local_v,module_vee_local_w);
-
-			final double module_flat_local_u =  (module_ball_local_u - module_vee_local_u) / 2.0 + module_vee_local_u;
-			final double module_flat_local_v =  module_ball_local_v + 0.5*inch;
-			final double module_flat_local_w =  module_ball_local_w;
-			Hep3Vector flat_pos_mod_local = new BasicHep3Vector(module_flat_local_u,module_flat_local_v,module_flat_local_w);
-
-			//if(_debug) {
-				print(String.format("ball_pos_mod_local %s", ball_pos_mod_local.toString()));
-				print(String.format("vee_pos_mod_local  %s", vee_pos_mod_local.toString()));
-				print(String.format("flat_pos_mod_local %s", flat_pos_mod_local.toString()));
-			//}
-
-			// transform to support frame
-			Hep3Vector ball_pos_mod = trans_support_plate_to_support.transformed(ball_pos_mod_local);
-			Hep3Vector ball_pos_mod_rot = trans_support_plate_to_support.rotated(ball_pos_mod_local);
-			Hep3Vector ball_pos_mod_tr = trans_support_plate_to_support.translated(ball_pos_mod_local);
-			Hep3Vector vee_pos_mod = trans_support_plate_to_support.transformed(vee_pos_mod_local);
-			Hep3Vector flat_pos_mod = trans_support_plate_to_support.transformed(flat_pos_mod_local);
-			
-			if(_debug) {
-				print(String.format("ball_pos_mod_rot %s", ball_pos_mod_rot.toString()));
-				print(String.format("ball_pos_mod_tr %s", ball_pos_mod_tr.toString()));
-				print(String.format("ball_pos_mod %s", ball_pos_mod.toString()));
-				print(String.format("vee_pos_mod  %s", vee_pos_mod.toString()));
-				print(String.format("flat_pos_mod %s", flat_pos_mod.toString()));
-			}
-			
-			// make the module
-			makeModule(layerName,supportWrap, ball_pos_mod, vee_pos_mod, flat_pos_mod,lcdd, sens);
-		
-		} // ilayer
-		// add support volume to lcdd
-		lcdd.add(supportVolume);
-		
-
-
-		
-	/*
-				
-		// Get corrections to survey ball positions from compact file to support plate positions (from e.g. survey)
-		Map<String, Hep3Vector> corr_balls = new HashMap<String,Hep3Vector>(); // save for debugging
-		for(Iterator i = node.getChildren("support_plate").iterator(); i.hasNext();) {
-			Element e = (Element)i.next();
-			if(e.getAttributeValue("name").equals("SupportPlateL1-3bot")) {
-				for(Iterator ii = e.getChildren("position").iterator(); ii.hasNext();) {
-					Element element = (Element) ii.next();
-					String name = element.getAttribute("name").getValue();
-					// get vector correction
-					Hep3Vector corr = new BasicHep3Vector(element.getAttribute("x").getDoubleValue(), element.getAttribute("y").getDoubleValue(), element.getAttribute("z").getDoubleValue());
-					if( name.equals("ball")) {
-						VecOp.add(ball_pos, corr);
-						corr_balls.put("ball", corr);
-					}
-					else if( name.equals("vee")) {
-						VecOp.add(vee_pos, corr);
-						corr_balls.put("vee", corr);
-					}
-					else if( name.equals("flat")) {
-						VecOp.add(flat_pos, corr);
-						corr_balls.put("flat", corr);
-					} 
-					else {
-						print(String.format("wrong alignment name for support plate: \"%s\"", name));
-						System.exit(1);
-					}
-				} //ii
-			}
-		} //i
-	
-		
-		// Find the local alignment corrections to the support plate
-		Hep3Vector local_translation = new BasicHep3Vector(0,0,0);
-		Hep3Vector local_rotation = new BasicHep3Vector(0,0,0);
-		for(Iterator i = node.getChildren("support_plate").iterator(); i.hasNext();) {
-			Element e = (Element)i.next();
-			if(e.getAttributeValue("name").equals("SupportPlateL1-3bot")) {
-				for(Iterator ii = e.getChildren("alignment").iterator(); ii.hasNext();) {
-					Element element = (Element) ii.next();
-					local_translation = new BasicHep3Vector(element.getAttribute("x").getDoubleValue(), element.getAttribute("y").getDoubleValue(), element.getAttribute("z").getDoubleValue());
-					local_rotation = new BasicHep3Vector(element.getAttribute("rx").getDoubleValue(), element.getAttribute("ry").getDoubleValue(), element.getAttribute("rz").getDoubleValue());
-
-				} //ii
-			}
-		} //i
-				
-	
-				
-		*/
-	}
-
-
-	private void makeSupportPlate(VolWrapper supportWrap,
-			Hep3Vector ball_pos_support_plate,
-			Hep3Vector vee_pos_support_plate,
-			Hep3Vector flat_pos_support_plate, LCDD lcdd, SensitiveDetector sens) throws JDOMException {
-
-		final double support_plate_height = 3.0/8.0*inch;
-		final double support_plate_length = 15.0*inch;
-		final double support_plate_width = 9.25*inch;
-
-
-
-		String volName = "supportplate";
-		Box box = new Box(volName + "Box", support_plate_width, support_plate_height , support_plate_length);
-		lcdd.add(box);
-		Volume supportPlateVolume = new Volume(volName + "_volume", box, lcdd.getMaterial("Aluminum"));
-		
-		
-		// create the coordinate system
-		CoordSysDef support_plate_coord = new CoordSysDef(ball_pos_support_plate, vee_pos_support_plate, flat_pos_support_plate);
-		
-		print(String.format("support_plate ball %s", ball_pos_support_plate.toString()));
-		print(String.format("support_plate vee  %s", vee_pos_support_plate.toString()));
-		print(String.format("support_plate flat %s", flat_pos_support_plate.toString()));
-		print(String.format("support_plate:\n%s", support_plate_coord.toString()));
-
-		// Find the LCDD position and rotation of this support plate
-		Transform3D trans_support_plate_to_support = getTransformation(support_plate_coord.origin(), support_plate_coord.u(), support_plate_coord.v(), support_plate_coord.w());
-		double du = support_plate_width/2.0-0.625*inch; // 
-		double dv = support_plate_length/2.0 - 0.25*inch;
-		double dw = support_plate_height/2.0 - 0.3195*inch; // TODO how far is the kin mount sunk into the plate?
-		Hep3Vector box_center_support_plate_local = new BasicHep3Vector(du, dv, dw);
-		Hep3Vector box_center_support_plate = trans_support_plate_to_support.transformed(box_center_support_plate_local);
-		
-		print(String.format("box_center_support_plate_local  %s", box_center_support_plate_local.toString()));
-		print(String.format("box_center_support_plate        %s", box_center_support_plate.toString()));
-		
-		
-		Position pos = new Position(volName + "_position",box_center_support_plate.x(), box_center_support_plate.y(), box_center_support_plate.z());
-		//Find LCDD rotation angles from coordinate system unit vectors
-		Hep3Vector lcdd_rot_angles = new BasicHep3Vector(0,0,0); //getLCDDRotation(support_plate_coord);
-		Rotation rot = new Rotation(volName + "_rotation",lcdd_rot_angles.x(), lcdd_rot_angles.y(), lcdd_rot_angles.z());
-		lcdd.add(pos);
-		lcdd.add(rot);
-		PhysVol supportPlatePV = new PhysVol(supportPlateVolume, supportWrap.vol, pos, rot);
-		// add volume to lcdd
-		
-		supportPlateVolume.setVisAttributes(lcdd.getVisAttributes("SupportPlateVis"));
-		
-		lcdd.add(supportPlateVolume);
-		
-		VolWrapper supportPlateWrap = new VolWrapper();
-		supportPlateWrap.mother = supportWrap;
-		supportPlateWrap.vol = supportPlateVolume;
-		supportPlateWrap.name = volName;
-		supportPlateWrap.pos_vol = pos;
-		supportPlateWrap.rot_vol = rot;		
-		supportWrap.daughters.add(supportPlateWrap);
-		
-		
-		
-	}
-
-
-	private void makeModule(String name, VolWrapper supportWrap, Hep3Vector ball_pos_mod, Hep3Vector vee_pos_mod, Hep3Vector flat_pos_mod, LCDD lcdd, SensitiveDetector sens) throws JDOMException 
-    {
-
-		print(String.format("----- makeModule() ------"));
-
-		
-		String moduleName = "module_" + name;
-		// Find the bounding box for the module
-		//TODO find dimensions of this module box from Shawn
-		// Right now the box starts from the ball position and approximately encapsulates the two half-modules on the drawing
-		final double x = 8*inch; // ~along sensors 
-		final double y = 0.526*inch + hybrid_thickness; // ~perpendicular to sensors 
-		final double z = 1.543*inch + sensor_width/2.0 + sensor_length/2.0*0.1; // ~height from support plate		
-		Box box = new Box(moduleName + "_box", x, y, z);
-		lcdd.add(box);
-		Volume moduleVolume = new Volume(moduleName + "_volume", box, lcdd.getMaterial("Vacuum"));
-		
-		
-		// create the coordinate system of the module in the support frame
-		CoordSysDef module_coord = new CoordSysDef(ball_pos_mod, vee_pos_mod, flat_pos_mod);
-		
-		if(_debug) {
-			print(String.format("module_coord:\n%s", module_coord.toString()));
-		}
-		
-		VolWrapper moduleWrap = new VolWrapper();
-		moduleWrap.name = moduleName;
-		moduleWrap.vol = moduleVolume;
-		moduleWrap.mother = supportWrap;
-		moduleWrap.coord = module_coord;
-		
-		// distance to the center of the box in the local coordinates
-		// TODO get these from Shawn
-		Hep3Vector box_center_local = new BasicHep3Vector(x/2.0-0.25*inch, y/2.0, z/2.0); 
-		moduleWrap.center = box_center_local;
-				
-		// Find the LCDD position and rotation of this module
-		Transform3D trans = getTransformation(module_coord); //.origin(), module_coord.u(), module_coord.v(), module_coord.w());
-		// vector to the center of module box from ball position/origin
-		Hep3Vector box_center = trans.transformed(box_center_local);
-		//Position pos = new Position(volName + "_position",box_center.x(), box_center.y(), box_center.z());
-		Position pos = new Position(moduleName + "_position",box_center.x(), box_center.y(), box_center.z());
-		//Find LCDD rotation angles from coordinate system unit vectors
-		Hep3Vector lcdd_rot_angles = new BasicHep3Vector(Math.PI/2.0,0,0); //getLCDDRotation(survey_coord);
-		//Hep3Vector lcdd_rot_angles = new BasicHep3Vector(0,0,0); //getLCDDRotation(survey_coord);
-		Rotation rot = new Rotation(moduleName + "_rotation",lcdd_rot_angles.x(), lcdd_rot_angles.y(), lcdd_rot_angles.z());
-		lcdd.add(pos);
-		lcdd.add(rot);
-		
-		PhysVol physVolume = new PhysVol(moduleVolume, supportWrap.vol, pos, rot);
-		supportWrap.daughters.add(moduleWrap);
-		moduleWrap.pv = physVolume;
-		moduleWrap.pos_vol = pos;
-		moduleWrap.rot_vol = rot;
-
-		if(_debug) {
-			print(String.format("module box center local %s",box_center_local.toString()));
-			print(String.format("module box center %s",box_center.toString()));
-		}
-		
-		//Create the half modules
-
-		// Find the coordinate system of the half-modules w.r.t. to the module survey points
-		// We are going to know the sensor center position w.r.t. module frame so the half-module 
-		// is really just a dummy volume to contain the daughters. Therefore place it at the same place 
-		// as where the sensor coordinate system will be to make things simpler.
-		
-		// Start with stereo half-module
-
-		final double ball_pos_halfmod_stereo_local_x =  4.818*inch;
-		final double ball_pos_halfmod_stereo_local_y =  0.526*inch - sensor_thickness/2.0;
-		final double ball_pos_halfmod_stereo_local_z =  1.543*inch;
-		final double vee_pos_halfmod_stereo_local_x =  ball_pos_halfmod_stereo_local_x + sensor_length/2.0;
-		final double vee_pos_halfmod_stereo_local_y =  ball_pos_halfmod_stereo_local_y;
-		final double vee_pos_halfmod_stereo_local_z =  ball_pos_halfmod_stereo_local_z;
-		final double flat_pos_halfmod_stereo_local_x =  ball_pos_halfmod_stereo_local_x;
-		final double flat_pos_halfmod_stereo_local_y =  ball_pos_halfmod_stereo_local_y + sensor_thickness/2.0;
-		final double flat_pos_halfmod_stereo_local_z =  ball_pos_halfmod_stereo_local_z ;		
-		Hep3Vector ball_pos_halfmod_stereo_local = new BasicHep3Vector(ball_pos_halfmod_stereo_local_x, ball_pos_halfmod_stereo_local_y, ball_pos_halfmod_stereo_local_z);
-		Hep3Vector vee_pos_halfmod_stereo_local = new BasicHep3Vector(vee_pos_halfmod_stereo_local_x, vee_pos_halfmod_stereo_local_y,vee_pos_halfmod_stereo_local_z);
-		Hep3Vector flat_pos_halfmod_stereo_local = new BasicHep3Vector(flat_pos_halfmod_stereo_local_x, flat_pos_halfmod_stereo_local_y,flat_pos_halfmod_stereo_local_z);
-
-		
-		if(_debug) {
-			print(String.format("ball_pos_halfmod_stereo_local %s", ball_pos_halfmod_stereo_local.toString()));
-			print(String.format("vee_pos_halfmod_stereo_local %s", vee_pos_halfmod_stereo_local.toString()));
-			print(String.format("flat_pos_halfmod_stereo_local %s", flat_pos_halfmod_stereo_local.toString()));
-		}
-		
-		makeHalfModule("stereo",moduleWrap, ball_pos_halfmod_stereo_local, vee_pos_halfmod_stereo_local, flat_pos_halfmod_stereo_local,lcdd,sens);
-		
-		Hep3Vector ball_pos_halfmod_axial_local = new BasicHep3Vector(ball_pos_halfmod_stereo_local.x(),0.224*inch - sensor_thickness/2.0,ball_pos_halfmod_stereo_local.z());
-		Hep3Vector vee_pos_halfmod_axial_local = new BasicHep3Vector(ball_pos_halfmod_axial_local.x() + sensor_length/2.0, ball_pos_halfmod_axial_local.y(),ball_pos_halfmod_axial_local.z());
-		Hep3Vector flat_pos_halfmod_axial_local = new BasicHep3Vector(ball_pos_halfmod_axial_local.x(), ball_pos_halfmod_axial_local.y() + sensor_thickness/2.0,ball_pos_halfmod_axial_local.z());
-		
-			/*	
-		final double ball_pos_halfmod_axial_local_x =  4.818*inch;
-		final double ball_pos_halfmod_axial_local_y =  0.224*inch - sensor_thickness/2.0; // only difference!
-		final double ball_pos_halfmod_axial_local_z =  1.543*inch;
-		final double vee_pos_halfmod_axial_local_x =  ball_pos_halfmod_axial_local_x + sensor_length/2.0;
-		final double vee_pos_halfmod_axial_local_y =  ball_pos_halfmod_axial_local_y;
-		final double vee_pos_halfmod_axial_local_z =  ball_pos_halfmod_axial_local_z;
-		final double flat_pos_halfmod_axial_local_x =  ball_pos_halfmod_axial_local_x;
-		final double flat_pos_halfmod_axial_local_y =  ball_pos_halfmod_axial_local_y + sensor_thickness/2.0;
-		final double flat_pos_halfmod_axial_local_z =  ball_pos_halfmod_axial_local_z ;		
-		Hep3Vector ball_pos_halfmod_axial_local = new BasicHep3Vector(ball_pos_halfmod_axial_local_x, ball_pos_halfmod_axial_local_y, ball_pos_halfmod_axial_local_z);
-		Hep3Vector vee_pos_halfmod_axial_local = new BasicHep3Vector(vee_pos_halfmod_axial_local_x, vee_pos_halfmod_axial_local_y,vee_pos_halfmod_axial_local_z);
-		Hep3Vector flat_pos_halfmod_axial_local = new BasicHep3Vector(flat_pos_halfmod_axial_local_x, flat_pos_halfmod_axial_local_y,flat_pos_halfmod_axial_local_z);
-*/
-		
-		
-		makeHalfModule("axial",moduleWrap, ball_pos_halfmod_axial_local, vee_pos_halfmod_axial_local, flat_pos_halfmod_axial_local,lcdd,sens);
-		
-		
-		moduleVolume.setVisAttributes(lcdd.getVisAttributes("ModuleVis"));
-		
-		lcdd.add(moduleVolume);	
-
-
+    /* (non-Javadoc)
+     * @see org.lcsim.geometry.compact.converter.lcdd.HPSTracker2014Base#initializeBuilder(org.lcsim.geometry.compact.converter.lcdd.util.LCDD, org.lcsim.geometry.compact.converter.lcdd.util.SensitiveDetector)
+     */
+    protected HPSTrackerLCDDBuilder initializeBuilder(LCDD lcdd, SensitiveDetector sens) {
+        HPSTrackerLCDDBuilder b = new HPSTracker2014LCDDBuilder(_debug,node,lcdd,sens);
+        return b;
     }
-	
-	
-	private void makeHalfModule(String side, VolWrapper moduleWrap, Hep3Vector ball_pos_halfmod, Hep3Vector vee_pos_halfmod, Hep3Vector flat_pos_halfmod, LCDD lcdd, SensitiveDetector sens) throws JDOMException {
-	
-		if(_debug) {
-			print("--- makeHalfModule " + side);
-		}
-		
-		
-		// the half-module box is built based on the location of the center of the sensor box
-		String halfModuleName = moduleWrap.name + "_halfmodule_" + side;
-		//find the bounding box for the half module
-		final double x = hybrid_length+sensor_length; //4.818*inch + 70.0/inch; //~along sensors, made this up TODO Fix this!
-		final double y = this.hybrid_thickness + this.CF_thickness + this.kapton_thickness; //2*(hybrid_thickness - sensor_thickness/2.0); //~ perpendicular to sensors
-		final double z = hybrid_width;	// ~height in direction ~perpendicular to the support plate
-		
-		Box box = new Box(halfModuleName + "Box", x, y, z);
-		lcdd.add(box);
-		Volume halfModuleVolume = new Volume(halfModuleName + "_volume", box, lcdd.getMaterial("Vacuum"));
-
-		CoordSysDef half_module_coord = new CoordSysDef(ball_pos_halfmod, vee_pos_halfmod, flat_pos_halfmod);		
-		
-		// vector to the center of the half module box from the module ball position
-		double box_center_local_x = -1.0 * ( (x - (hybrid_length + sensor_length))/2.0 + hybrid_length + sensor_length/2.0 - x/2.0);
-		double box_center_local_y = (y/2.0 - (CF_thickness + kapton_thickness + sensor_thickness/2.0));
-		double box_center_local_z = .0;
-		Hep3Vector box_center_local = new BasicHep3Vector( box_center_local_x, box_center_local_y, box_center_local_z); 
-		//Hep3Vector box_center_local = new BasicHep3Vector( 0.,0.,0.);
-		if(_debug) {
-			print(String.format("half-module_coord:\n%s", half_module_coord.toString()));
-		}
-
-		
-		VolWrapper halfModuleWrap = new VolWrapper();
-		halfModuleWrap.name = halfModuleName;
-		halfModuleWrap.vol = halfModuleVolume;
-		halfModuleWrap.coord = half_module_coord;
-		halfModuleWrap.center = box_center_local;
-
-		
-		
-				
-		// Find the LCDD position and rotation of this volume
-		
-		Transform3D transToModuleCoord = getTransformation(half_module_coord); 
-		Hep3Vector box_center_module_coord = transToModuleCoord.transformed(box_center_local);
-		Hep3Vector lcdd_rot_angles;
-		if(side.equals("stereo")) {
-			lcdd_rot_angles = new BasicHep3Vector(0,0.1,0); //getLCDDRotation(survey_coord);
-		} 
-		else {
-			lcdd_rot_angles = new BasicHep3Vector(0,0,0); //getLCDDRotation(survey_coord);			
-		}
-
-		// find the displacement from the rotation around an arbitrary point in local coordinates
-		Hep3Vector box_center_module_coord_rot = getRotationDisplacement(ball_pos_halfmod, box_center_module_coord, lcdd_rot_angles);
-		
-		// find the position of the center in the module box
-		Hep3Vector box_center = VecOp.sub(box_center_module_coord_rot, moduleWrap.center);
-		//Hep3Vector box_center = VecOp.sub(box_center_module_coord, moduleWrap.center);
-
-		// create the lcdd tags
-		Position pos = new Position(halfModuleName + "_position",box_center.x(), box_center.y(), box_center.z());
-		Rotation rot = new Rotation(halfModuleName + "_rotation",lcdd_rot_angles.x(), lcdd_rot_angles.y(), lcdd_rot_angles.z());
-		lcdd.add(pos);
-		lcdd.add(rot);
-		
-		PhysVol physVolume = new PhysVol(halfModuleVolume, moduleWrap.vol, pos, rot);
-		halfModuleWrap.pv = physVolume;
-		halfModuleWrap.pos_vol = pos;
-		halfModuleWrap.rot_vol = rot;
-		halfModuleWrap.mother = moduleWrap;
-		moduleWrap.daughters.add(halfModuleWrap);
-		
-		if(_debug) {
-			print(String.format("half module box center local %s", box_center_local.toString()));
-			print(String.format("half module box center in module coord  %s", box_center_module_coord.toString()));
-			print(String.format("half module box center in module coord rot %s", box_center_module_coord_rot.toString()));
-			print(String.format("module box center in module coord  %s", moduleWrap.center.toString()));
-			print(String.format("half module box center in module box  %s", box_center.toString()));
-		}
-		
-		// create the half module components based on the position of the sensor center in the half-module coordinates
-		// Note that the origin is the same and the unit vectors are parallel to the half-module
-	
-		Hep3Vector ball_pos_sensor_local = new BasicHep3Vector(0,0,0);
-		Hep3Vector vee_pos_sensor_local = new BasicHep3Vector(ball_pos_sensor_local.x() + sensor_length/2.0, ball_pos_sensor_local.y(), ball_pos_sensor_local.z());
-		Hep3Vector flat_pos_sensor_local = new BasicHep3Vector(ball_pos_sensor_local.x(),ball_pos_sensor_local.y() + sensor_thickness/2.0, ball_pos_sensor_local.z());
-		
-		makeHalfModuleComponents(halfModuleWrap,ball_pos_sensor_local,vee_pos_sensor_local,flat_pos_sensor_local, lcdd, sens);
-
-		//set vis stuff
-		halfModuleVolume.setVisAttributes(lcdd.getVisAttributes("HalfModuleVis"));
-
-		lcdd.add(halfModuleVolume);
-		
-		
-	}
-	
-	/**
-	 * Find the displacement of a point when rotating around an arbitrary position
-	 * @param origin_of_rotation
-	 * @param point
-	 * @param lcdd_rot_angles
-	 * @return
-	 */
-	private Hep3Vector getRotationDisplacement(Hep3Vector origin_of_rotation,
-			Hep3Vector point, Hep3Vector lcdd_rot_angles) {
-
-		// Find the vector from the center of rotation to the point
-		Hep3Vector s = VecOp.sub(point, origin_of_rotation );
-		//Apply the rotation to the vector
-		RotationGeant r = new RotationGeant(lcdd_rot_angles.x(), lcdd_rot_angles.y(), lcdd_rot_angles.z());
-		Hep3Vector s_prime = r.rotated(s);
-		// Find the displaced point
-		Hep3Vector point_rot = VecOp.add(origin_of_rotation, s_prime );
-		if(_debug) {
-			print("--- getRotationDisplacement---");
-			print(String.format("box_center_module_coord:\n%s", point.toString()));
-			print(String.format("ball_pos_halfmod:\n%s", origin_of_rotation.toString()));
-			print(String.format("s:\n%s", s.toString()));
-			print(String.format("r:\n%s", r.toString()));
-			print(String.format("s_prime:\n%s", s_prime.toString()));
-			print(String.format("box_center_module_coord_rot:\n%s", point_rot.toString()));
-		}
-		return point_rot;
-	}
-
-
-	private void makeHalfModuleComponents(VolWrapper halfModuleWrap, Hep3Vector ball_pos_sensor_local, Hep3Vector vee_pos_sensor_local, Hep3Vector flat_pos_sensor_local, LCDD lcdd, SensitiveDetector sens) throws JDOMException {
-		
-		if(_debug) {
-			print("--- makeHalfModuleComponents ---");
-		}
-		
-		// add sensor
-		
-		int sensor_number = 0;
-		String sensorName = halfModuleWrap.name + "_sensor" + sensor_number;		
-		// Create the box solid for the component.
-		Box sensor_box = new Box(sensorName + "_box",sensor_length,sensor_thickness, sensor_width);
-		lcdd.add(sensor_box);
-
-		// Create the volume for the module component.
-		Volume sensor_volume = new Volume(sensorName + "_volume", sensor_box,lcdd.getMaterial("Silicon"));
-		
-		if(_debug) {
-			print(String.format("ball_pos_sensor_local %s", ball_pos_sensor_local.toString()));
-			print(String.format("vee_pos_sensor_local %s", vee_pos_sensor_local.toString()));
-			print(String.format("flat_pos_sensor_local %s", flat_pos_sensor_local.toString()));
-		}
-		
-		CoordSysDef sensor_coord = new CoordSysDef(ball_pos_sensor_local, vee_pos_sensor_local, flat_pos_sensor_local);		
-		
-		if(_debug) {
-			print(String.format("sensor_coord:\n%s", sensor_coord.toString()));
-		}
-		
-		// Find the LCDD position and rotation of this module
-		Transform3D transToHalfModuleCoord = getTransformation(sensor_coord); 
-		//Hep3Vector sensor_box_center_local = new BasicHep3Vector(sensor_length/2.0, sensor_width/2.0, -1.0*sensor_thickness/2.0);
-		Hep3Vector sensor_box_center_local = new BasicHep3Vector(0.,0.,0.);
-		Hep3Vector sensor_box_center_half_module_coord = transToHalfModuleCoord.transformed(sensor_box_center_local);
-		Hep3Vector sensor_box_center = VecOp.sub(sensor_box_center_half_module_coord, halfModuleWrap.center);
-		Position pos = new Position(sensorName + "_position",sensor_box_center.x(), sensor_box_center.y(), sensor_box_center.z());
-		//Position pos = new Position(volName + "_position",0,20.0,0);
-		Hep3Vector lcdd_rot_angles = new BasicHep3Vector(0,0,0); //getLCDDRotation(survey_coord);
-		Rotation rot = new Rotation(sensorName + "_rotation",lcdd_rot_angles.x(), lcdd_rot_angles.y(), lcdd_rot_angles.z());
-		lcdd.add(pos);
-		lcdd.add(rot);
-
-		
-		
-		PhysVol sensor_physvol = new PhysVol(sensor_volume, halfModuleWrap.vol, pos, rot);
-		sensor_volume.setSensitiveDetector(sens);
-		sensor_physvol.addPhysVolID("sensor", sensor_number);
-		sensor_physvol.addPhysVolID("system", 0);
-		sensor_physvol.addPhysVolID("barrel", 0);
-		sensor_physvol.addPhysVolID("layer", 0);
-		sensor_physvol.addPhysVolID("module", 0);    
-		
-		
-	
-		
-		
-		VolWrapper sensorWrap = new VolWrapper();
-		sensorWrap.name = sensorName;
-		sensorWrap.pv = sensor_physvol;
-		sensorWrap.vol = sensor_volume;
-		sensorWrap.pos_vol = pos;
-		sensorWrap.rot_vol = rot;
-		sensorWrap.mother = halfModuleWrap;
-		sensorWrap.center = sensor_box_center_local;
-		sensorWrap.coord = sensor_coord;
-		halfModuleWrap.daughters.add(sensorWrap);
-	
-		
-		sensor_volume.setVisAttributes(lcdd.getVisAttributes("SensorVis"));
-		
-		
-		lcdd.add(sensor_volume);
-		
-		
-		if(_debug) {
-			print(String.format("sensor box center local %s", sensor_box_center_local.toString()));
-			print(String.format("sensor box center in half module coord  %s", sensor_box_center_half_module_coord.toString()));
-			print(String.format("half module box center in half module coord  %s", halfModuleWrap.center.toString()));
-			print(String.format("sensor box center in half module box  %s", sensor_box_center.toString()));
-		}
-		
-		
-
-
-		// add the hybrid
-		
-		String hybrid_name = halfModuleWrap.name + "_hybrid" + sensor_number;		
-		// Create the box solid for the component.
-		Box hybrid_box = new Box(hybrid_name + "_box",hybrid_length,hybrid_thickness, hybrid_width);
-		lcdd.add(hybrid_box);
-
-		// Create the volume for the module component.
-		Volume hybrid_volume = new Volume(hybrid_name + "_volume", hybrid_box,lcdd.getMaterial("G10"));
-		
-		// Place at the height of the sensor and back-to-back to sensor
-		final double hybrid_box_center_x = sensor_box_center.x() - sensor_length/2.0 - hybrid_length/2.0;
-		final double hybrid_box_center_y = sensor_box_center.y() - sensor_thickness/2.0 + hybrid_thickness/2.0;
-		final double hybrid_box_center_z = sensor_box_center.z();
-		pos = new Position(hybrid_name + "_position",hybrid_box_center_x, hybrid_box_center_y, hybrid_box_center_z);
-		rot = new Rotation(hybrid_name + "_rotation", 0, 0, 0);
-		lcdd.add(pos);
-		lcdd.add(rot);
-		PhysVol hybrid_physvol = new PhysVol(hybrid_volume, halfModuleWrap.vol, pos, rot);
-		
-		VolWrapper hybridWrap = new VolWrapper();
-		hybridWrap.name = hybrid_name;
-		hybridWrap.pv = hybrid_physvol;
-		hybridWrap.vol = hybrid_volume;
-		hybridWrap.pos_vol = pos;
-		hybridWrap.rot_vol = rot;
-		hybridWrap.mother = halfModuleWrap;
-		halfModuleWrap.daughters.add(hybridWrap);
-	
-		hybrid_volume.setVisAttributes(lcdd.getVisAttributes("HybridVis"));
-		
-		lcdd.add(hybrid_volume);
-		
-		
-		
-
-		// add the kapton
-		// fill the entire sensor length and width with kapton
-		
-		String kapton_name = halfModuleWrap.name + "_kapton" + sensor_number;		
-		// Create the box solid for the component.
-		Box kapton_box = new Box(kapton_name + "_box",sensor_length+hybrid_length,kapton_thickness, sensor_width);
-		lcdd.add(kapton_box);
-
-		// Create the volume for the module component.
-		Volume kapton_volume = new Volume(kapton_name + "_volume", kapton_box,lcdd.getMaterial("Kapton"));
-		pos = new Position(kapton_name + "_position", sensor_box_center.x()-hybrid_length/2.0, 
-														sensor_box_center.y() - sensor_thickness/2.0 - kapton_thickness/2.0, sensor_box_center.z());
-		rot = new Rotation(kapton_name + "_rotation", 0, 0, 0);
-		lcdd.add(pos);
-		lcdd.add(rot);
-		PhysVol kapton_physvol = new PhysVol(kapton_volume, halfModuleWrap.vol, pos, rot);
-		
-		VolWrapper kaptonWrap = new VolWrapper();
-		kaptonWrap.name = kapton_name;
-		kaptonWrap.pv = kapton_physvol;
-		kaptonWrap.vol = kapton_volume;
-		kaptonWrap.pos_vol = pos;
-		kaptonWrap.rot_vol = rot;
-		kaptonWrap.mother = halfModuleWrap;
-		halfModuleWrap.daughters.add(kaptonWrap);
-	
-		kapton_volume.setVisAttributes(lcdd.getVisAttributes("KaptonVis"));
-
-		lcdd.add(kapton_volume);
-		
-		
-		
-		String cf_name = halfModuleWrap.name + "_carbonfiber" + sensor_number;		
-		// Create the box solid for the component.
-		Box cf_box = new Box(cf_name + "_box",sensor_length+hybrid_length,CF_thickness, sensor_width);
-		lcdd.add(cf_box);
-
-		// Create the volume for the module component.
-		Volume cf_volume = new Volume(cf_name + "_volume", cf_box,lcdd.getMaterial("CarbonFiber"));
-		pos = new Position(cf_name + "_position", sensor_box_center.x()-hybrid_length/2.0, 
-													sensor_box_center.y() - sensor_thickness/2.0 - kapton_thickness - CF_thickness/2.0, 
-													sensor_box_center.z());
-		rot = new Rotation(cf_name + "_rotation", 0, 0, 0);
-		lcdd.add(pos);
-		lcdd.add(rot);
-		PhysVol cf_physvol = new PhysVol(cf_volume, halfModuleWrap.vol, pos, rot);
-		
-		VolWrapper cfWrap = new VolWrapper();
-		cfWrap.name = cf_name;
-		cfWrap.pv = cf_physvol;
-		cfWrap.vol = cf_volume;
-		cfWrap.pos_vol = pos;
-		cfWrap.rot_vol = rot;
-		cfWrap.mother = halfModuleWrap;
-		halfModuleWrap.daughters.add(cfWrap);
-	
-		cf_volume.setVisAttributes(lcdd.getVisAttributes("CarbonFiberVis"));
-		
-		lcdd.add(cf_volume);
-		
-
-	}
-
-	
-	
-	
-	
-	
-	private void makeEnvelope(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
-	
-		Volume trackingVolume = lcdd.getTrackingVolume();
-		
-		
-		String volName = "envelope";
-		int componentNumber = 0;
-		String envelopeName = "envelope";
-		final double trackingEnvelopeBoxLength = 50.5*inch;
-		final double trackingEnvelopeBoxWidth = 16.0*inch;
-		final double trackingEnvelopeBoxHeight = 8.0*inch;		
-		Box envelopeBox = new Box(envelopeName + "Box", trackingEnvelopeBoxLength, trackingEnvelopeBoxWidth, trackingEnvelopeBoxHeight);
-		lcdd.add(envelopeBox);
-		Volume envelopeVolume = new Volume(envelopeName + "_volume", envelopeBox, lcdd.getMaterial("Vacuum"));
-		Position envelopePosition = new Position(envelopeName + "_position",0, 0, 0);
-		Rotation envelopeRotation = new Rotation(envelopeName + "_rotation",0, 0, 0);
-		lcdd.add(envelopePosition);
-		lcdd.add(envelopeRotation);
-		
-		
-		PhysVol envelopePV = new PhysVol(envelopeVolume, trackingVolume, envelopePosition, envelopeRotation);
-		envelopePV.addPhysVolID(envelopeName, 0);		
-		
-		
-		VolWrapper envWrap = new VolWrapper();
-		envWrap.name = volName;
-		envWrap.pv = envelopePV;
-		envWrap.vol = envelopeVolume;
-		envWrap.pos_vol = envelopePosition;
-		envWrap.rot_vol = envelopeRotation;
-			
-		
-		// now add the base plate solid
-		
-		volName = "envelope";
-		componentNumber = 0;
-		String envelopePlateName = volName + "_base" + componentNumber;
-		Material envelopePlateMaterial = lcdd.getMaterial("Aluminum"); //Oxide"); // TODO fix material!
-		final double envelopePlateLength = trackingEnvelopeBoxLength;
-		final double envelopePlateWidth = trackingEnvelopeBoxWidth;
-		final double envelopePlateHeight = 0.3125*inch;
-		Box envelopePlateBox = new Box(envelopePlateName + "Box", envelopePlateLength, envelopePlateWidth, envelopePlateHeight);
-		lcdd.add(envelopePlateBox);
-		
-		Volume envelopePlateVolume = new Volume(envelopePlateName + "_volume", envelopePlateBox, envelopePlateMaterial);
-		
-		Position envelopePlatePosition = new Position(envelopePlateName + "_position", 0, 0, 0);
-		Rotation envelopePlateRotation = new Rotation(envelopePlateName + "_rotation", 0, 0, 0);
-		lcdd.add(envelopePlatePosition);
-		lcdd.add(envelopePlateRotation);
-		
-		//PhysVol envelopePlatePV = new PhysVol(envelopePlateVolume, lcdd.pickMotherVolume(this) /*envelopeVolume*/, envelopePlatePosition, envelopePlateRotation);
-		PhysVol envelopePlatePV = new PhysVol(envelopePlateVolume, envelopeVolume, envelopePlatePosition, envelopePlateRotation);
-		envelopePlatePV.addPhysVolID(envelopePlateName, 0);		
-		lcdd.add(envelopePlateVolume);
-		lcdd.add(envelopeVolume);
-		
-		VolWrapper plateWrap = new VolWrapper();
-		plateWrap.name = envelopePlateName;
-		plateWrap.vol = envelopePlateVolume;
-		plateWrap.pv = envelopePlatePV;
-		plateWrap.pos_vol = envelopePlatePosition;
-		plateWrap.rot_vol = envelopePlateRotation;
-		plateWrap.mother = envWrap;
-		envWrap.daughters.add(plateWrap);
-		//RotationGeant g;
-		
-
-	}
-	
-	private void makeSupportPlate(VolWrapper envWrapper, LCDD lcdd, SensitiveDetector sens) throws JDOMException {
-
-		// Add a new support plate inside the envelope
-		// TODO add a volume aroundit 
-		
-		//final double length = (50.5 - 3.5 - 0.5)*inch;
-		//final double width = (16.0 - 1.0*2)*inch;
-		//final double envelopePlateHeight = 0.3125*inch;
-		
-		
-		String volName = "supportplate";
-		int componentNumber = 0;
-		final double length = 15.0*inch;
-		final double width = 9.25*inch;
-		final double height = 3.0/8.0*inch;		
-		Box box = new Box(volName + "Box", length, width, height);
-		lcdd.add(box);
-		Volume volume = new Volume(volName + "_volume", box, lcdd.getMaterial("Aluminum"));
-		Position position = new Position(volName + "_position",0, 0, 0);
-		Rotation rotation = new Rotation(volName + "_rotation",0, 0, 0);
-		lcdd.add(position);
-		lcdd.add(rotation);
-		
-		PhysVol pv = new PhysVol(volume, lcdd.pickMotherVolume(this) /*envWrapper.vol*/, /*lcdd.pickMotherVolume(this)*/ /*envelopeVolume*/ position, rotation);
-		pv.addPhysVolID(volName, 0);		
-		lcdd.add(volume);
-		
-		VolWrapper supportPlateWrap = new VolWrapper();
-		supportPlateWrap.name = volName;
-		supportPlateWrap.vol = volume;
-		supportPlateWrap.pos_vol = position;
-		supportPlateWrap.rot_vol = rotation;
-		supportPlateWrap.mother = envWrapper;
-		envWrapper.daughters.add(supportPlateWrap);
-		
-		
-		
-		
-		
-		/*
-
-		
-		
-		
-		
-		
-		// calculate the transform to the envelope
-		Hep3Vector ball_pos = new BasicHep3Vector(-0.5*envelopePlateLength + 3.5*inch, -0.5*envelopePlateWidth, -1.0*envelopePlateHeight + 0.755);
-		Hep3Vector vee_pos = new BasicHep3Vector(ball_pos.x(), 0.5*envelopePlateWidth, ball_pos.z());
-		Hep3Vector flat_pos = new BasicHep3Vector(0.5*envelopePlateLength - 0.5*inch, 0., ball_pos.z());
-
-		
-		// create the coordinate system
-		CoordSysDef envelope_coord = new CoordSysDef(ball_pos, vee_pos, flat_pos);
-		
-		// Find the transform between the two frames	
-		Transform3D trackingToEnvelopeTransform = getTransformation(envelope_coord);
-		//getTransformation(envelope_coord.origin(), envelope_coord.u(), envelope_coord.v(), envelope_coord.w());
-		RotationGeant trackingToEnvelopeRotation = new RotationGeant(Math.PI, 0, Math.PI/2.0);
-		
-		// Get translation and rotation from mother to local
-		//Rotation componentRotation = getLCDDRotation(trackingToEnvelopeTransform, componentName);
-		
-		//Hep3Vector box_vec = new BasicHep3Vector(trackingEnvelopeBoxLength, trackingEnvelopeBoxWidth, trackingEnvelopeBoxHeight);
-		
-		
-		//Hep3Vector box_vec_mother = trackingToEnvelopeTransform.inverse().transformed(box_vec_local);
-		
-		if(_debug) {
-			print(String.format("Envelope survey ball positions in mother:"));
-			print(String.format("ball at %s",ball_pos.toString()));
-			print(String.format("vee  at %s",vee_pos.toString()));
-			print(String.format("flat at %s",flat_pos.toString()));
-			print(String.format("Resulting envelope coord system:\n%s",envelope_coord.toString()));
-			//print(String.format("box vec local  %s",box_vec_local.toString()));
-			print(String.format("transformation \n%s",trackingToEnvelopeTransform.inverse().toString()));
-			//print(String.format("box vec mother %s",box_vec_mother.toString()));
-		}
-
-		*/
-	
-	}
-	
-	
-	private static class VolWrapper {
-		public String name;
-		Volume vol = null;
-		PhysVol pv = null;
-		Position pos_vol = null;
-		Rotation rot_vol = null;
-		VolWrapper mother = null;
-		List<VolWrapper> daughters = new ArrayList<VolWrapper>();
-		CoordSysDef coord = null;
-		Hep3Vector center = null;
-		public VolWrapper() {
-		}
-	}
-	
-	private void print(String str) {
-		System.out.printf("%s: %s\n", this.getClass().getSimpleName(),str);
-	}
-	
-	
-	private Transform3D getTransformation(CoordSysDef coordSys) {
-		return getTransformation(coordSys.origin(), coordSys.u(), coordSys.v(), coordSys.w());
-	}
-	
-	/**
-	 * Find @ITransform3D to the coordinate system defined by the input. 
-	 * @param origin of new coordinate system
-	 * @param u unit vector
-	 * @param v unit vector
-	 * @param w unit vector
-	 * @return resulting 3D transform 
-	 */
-	private Transform3D getTransformation(Hep3Vector origin, Hep3Vector u, Hep3Vector v, Hep3Vector w) {		
-		// Find the transform between the two frames - use transform classes here (not really needed)
-				Translation3D translation = new Translation3D(origin.x(), origin.y(), origin.z());
-				//RotationGeant trackingToEnvelopeRotation = new RotationGeant(0, 0, 0);
-		        Rotation3D rotation = new Rotation3D(
-		        		new BasicHep3Matrix(
-						u.x(),v.x(),w.x(),
-						u.y(),v.y(),w.y(),
-						u.z(),v.z(),w.z()
-						));
-				Transform3D envelopeToSupportTransform = new Transform3D(translation, rotation);
-				return envelopeToSupportTransform;
-	}
-	
-	private Position getLCDDPosition(ITransform3D transform, String name) {
-		Position componentPosition = new Position(name + "_position", 
-				transform.getTranslation().x(), 
-				transform.getTranslation().y(),
-				transform.getTranslation().z());
-		return componentPosition;
-	}
-	
-	private Rotation getLCDDRotation(Transform3D transform, String name) {
-		Hep3Matrix rotationMatrix = transform.getRotation().getRotationMatrix();
-		// Extract the rotation angles from the combined matrix
-	// Assumes rotation matrix built A = RzRyRx 
-	double rotation_z = Math.atan2(rotationMatrix.e(2, 0), rotationMatrix.e(2, 1));
-	double rotation_y = Math.acos(rotationMatrix.e(2, 2));
-	double rotation_x = -1.0 * Math.atan2(rotationMatrix.e(0, 2), rotationMatrix.e(1, 2));
-	
-	Rotation componentRotation = new Rotation(name + "_rotation",rotation_x, rotation_y, rotation_z);
-	return componentRotation;
-	}
-			
-
-
-	private static class CoordSysDef {
-		private Hep3Vector origin;
-		private Hep3Vector u;
-		private Hep3Vector v;
-		private Hep3Vector w;
-
-		public CoordSysDef(Hep3Vector org, Hep3Vector unit_x, Hep3Vector unit_y, Hep3Vector unit_z) {
-			origin = org;
-			u = unit_x;
-			v = unit_y;
-			w = unit_z;
-		}
-
-		private void check() {
-			if(u.magnitude()-1>0.00001 || v.magnitude()-1>0.00001 || v.magnitude()-1>0.00001) {
-				System.out.printf("Error: this coordinate system is ill-defined\n%s\n",this.toString());
-				System.exit(1);
-			}
-		}
-		
-		public CoordSysDef(Hep3Vector ball, Hep3Vector vee, Hep3Vector flat) {
-			origin = ball;
-			Hep3Vector ball_to_vee = VecOp.sub(vee, ball);
-			u = VecOp.unit(ball_to_vee);
-			Hep3Vector ball_to_flat = VecOp.sub(flat, ball);
-			w = VecOp.unit(VecOp.cross(ball_to_vee,ball_to_flat));
-			v = VecOp.cross(w, u);
-		}
-		public void rotate(Hep3Vector euler_angles) {
-			RotationGeant rotation = new RotationGeant(euler_angles.x(), euler_angles.y(), euler_angles.z());
-			rotation.rotate(u);
-			rotation.rotate(v);
-			rotation.rotate(w);
-		}
-/*
-		public void rotate(Hep3Vector euler_angles) {
-			RotationGeant rotation = new RotationGeant(euler_angles.x(), euler_angles.y(), euler_angles.z());
-			rotation.rotate(u);
-			rotation.rotate(v);
-			rotation.rotate(w);
-		}
-		*/
-		public void translate(Hep3Vector translation) {
-			// update origin with local translation in u,v,w
-			origin = VecOp.add(origin, translation);
-		}
-		public Hep3Vector origin() {
-			return origin;
-		}
-		public Hep3Vector u() {
-			return u;
-		}
-		public Hep3Vector v() {
-			return v;
-		}
-		public Hep3Vector w() {
-			return w;
-		}
-		public String toString() {
-			return "Coordinate system: \norigin " + origin.toString() + "\nu " + u.toString() + "\nv " + v.toString() + "\nw " + w.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

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