Print

Print


Commit in projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd on MAIN
HPSTestRunTracker2014.java+38-473319 -> 3320
HPSTestRunTracker2014GeometryDefinition.java+68-263319 -> 3320
+106-73
2 modified files
more commits

projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd
HPSTestRunTracker2014.java 3319 -> 3320
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014.java	2014-09-12 19:06:18 UTC (rev 3319)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014.java	2014-09-12 19:07:36 UTC (rev 3320)
@@ -1,35 +1,21 @@
 package org.lcsim.geometry.compact.converter.lcdd;
 
 import static java.lang.Math.PI;
-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.text.NumberFormat;
-import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
 
-import javax.management.RuntimeErrorException;
-
-import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
 import org.jdom.DataConversionException;
 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.HPSTestRunTracker2014LCDDBuilder.LCDDBaseGeometry;
-import org.lcsim.geometry.compact.converter.lcdd.HPSTestRunTracker2014LCDDBuilder.GhostLCDDBaseGeometry;
+import org.lcsim.geometry.compact.converter.lcdd.HPSTrackerLCDDBuilder.GhostLCDDBaseGeometry;
+import org.lcsim.geometry.compact.converter.lcdd.HPSTrackerLCDDBuilder.LCDDBaseGeometry;
 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.PhysVol;
 import org.lcsim.geometry.compact.converter.lcdd.util.Position;
 import org.lcsim.geometry.compact.converter.lcdd.util.Rotation;
@@ -49,7 +35,8 @@
 	private boolean _debug = false; 
 	private final boolean buildBeamPlane = true;
 	// Builder class to handle all geometry information
-	private static HPSTestRunTracker2014LCDDBuilder builder;
+	//private static HPSTestRunTracker2014LCDDBuilder builder;
+	private static HPSTrackerLCDDBuilder builder;
 	
 	
 	
@@ -286,34 +273,9 @@
 	
 	
 	
-	
-	/*
 
 	
-
-	private Hep3Vector transformToMotherCoord(Hep3Vector vec, VolWrapper motherWrap, String targetCoordName) {
-		if(_debug) print(String.format("vec %s motherWrap %s target %s", vec.toString(), motherWrap.name, targetCoordName));
-		if(motherWrap.name.equals(targetCoordName)) {
-			if(_debug) print(String.format("found the vec %s", vec.toString()));
-			return vec;
-		} else {
-			if(motherWrap.name.equals("trackingVolume")) {
-				return null;
-			}
-			Transform3D trans = getTransformation(motherWrap.coord); 
-			Hep3Vector vec_t = trans.transformed(vec);
-			if(_debug) print(String.format("continue searching"));
-			return transformToMotherCoord(vec_t, motherWrap.mother, targetCoordName);
-		}
-		
-	}
 	
-	*/
-	
-	
-
-	
-	
 	private void print(String str) {
 		System.out.printf("%s: %s\n", this.getClass().getSimpleName(),str);
 	}
@@ -395,15 +357,44 @@
 			System.out.println("y_3D_pp_2 (" + y_3D_pp_2.getX() + "," + y_3D_pp_2.getY() + "," + y_3D_pp_2.getZ());
 			System.out.println("------- ");
 		}
+		return euler;
+	}
 		
+		public static Hep3Vector getActiveEulerAngles(Hep3Vector u, Hep3Vector v, Hep3Vector u_prime, Hep3Vector v_prime) {
+			int debug = 0;
+			if (debug>0) System.out.printf("getEulerAngles: u %s v%s -> %s %s\n",u.toString(),v.toString(),u_prime.toString(),v_prime.toString());
+			// Convert to correct API
+			org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(u.v());
+			org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(v.v());
+			org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_prime_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(u_prime.v());
+			org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_prime_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(v_prime.v());
+			//Create the rotation
+			// Note that the constructor used here creates the rotation using active transformations
+			org.apache.commons.math3.geometry.euclidean.threed.Rotation rot = new org.apache.commons.math3.geometry.euclidean.threed.Rotation(u_3D,v_3D,u_prime_3D,v_prime_3D);
+			// The the Cardan angles of the rotation
+			double res[] = rot.getAngles(org.apache.commons.math3.geometry.euclidean.threed.RotationOrder.XYZ);
+			Hep3Vector euler = new BasicHep3Vector(res[0],res[1],res[2]);
 
-		
-		
-		
 		return euler;
+	}
+			
+	
+	public static double[][] getActiveEulerAnglesMatrix(Hep3Vector u, Hep3Vector v, Hep3Vector u_prime, Hep3Vector v_prime) {
+		int debug = 0;
+		if (debug>0) System.out.printf("getEulerAngles: u %s v%s -> %s %s\n",u.toString(),v.toString(),u_prime.toString(),v_prime.toString());
+		// Convert to correct API
+		org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(u.v());
+		org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(v.v());
+		org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_prime_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(u_prime.v());
+		org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_prime_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(v_prime.v());
+		//Create the rotation
+		// Note that the constructor used here creates the rotation using active transformations
+		org.apache.commons.math3.geometry.euclidean.threed.Rotation rot = new org.apache.commons.math3.geometry.euclidean.threed.Rotation(u_3D,v_3D,u_prime_3D,v_prime_3D);
+		// The the Cardan angles of the rotation
+		// Since the rotation was created based on active transformations convert to passive right here. 
+		// This conversion is simply to reverse the order of rotations.
+		return rot.getMatrix();
 		
-		
-
 	}
 			
 	

projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd
HPSTestRunTracker2014GeometryDefinition.java 3319 -> 3320
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014GeometryDefinition.java	2014-09-12 19:06:18 UTC (rev 3319)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014GeometryDefinition.java	2014-09-12 19:07:36 UTC (rev 3320)
@@ -28,6 +28,8 @@
 	
 		//General
 		private static final double inch = 25.4; //mm
+		protected static final boolean useSiStripsConvention = true;
+		protected static final boolean use30mradRotation = false;
 		
 		// Global position references	
 		private static final double target_pos_wrt_base_plate_x = 162.3; //from Marco's 3D model
@@ -58,7 +60,7 @@
 			private Hep3Vector center;
 			private Hep3Vector boxDim;
 			//store explicit rotations - if exist should be used instead of those extracted from coord
-			// TODO This is a workaround as I should really rotate the coord system to make things consistent. Figure this out later. 
+			// TODO This is a workaround as I should really rotate the local coord system to make things consistent. Figure this out later. 
 			public Hep3Vector explicit_rot_angles = null;
 			
 			public BaseGeometry(String name, BaseGeometry m) {
@@ -294,8 +296,8 @@
 			private static final double ball_pos_csup_pin_bottom_y = 115.02;
 			private static final double ball_pos_csup_pin_bottom_z = 0.0;
 			private static final double vee_pos_csup_pin_bottom_x = 271.05;
-			private static final double vee_pos_csup_pin_bottom_y = 121.62;
-			private static final double vee_pos_csup_pin_bottom_z = 0.0;
+			private static  double vee_pos_csup_pin_bottom_y = 121.62;
+			private static  double vee_pos_csup_pin_bottom_z = 0.0;
 			
 			
 			public CSupport(String name, BaseGeometry mother) {
@@ -303,28 +305,48 @@
 				init();
 			}			
 			private void calcAndSetFlatPos() {
-				// find the rotation to place the flat point
-				org.apache.commons.math3.geometry.euclidean.threed.Rotation rot1_csup = 
-						new org.apache.commons.math3.geometry.euclidean.threed.Rotation(
-								new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(vee_pos_csup_pin_bottom_x-ball_pos_csup_pin_bottom_x,
-																								vee_pos_csup_pin_bottom_y-ball_pos_csup_pin_bottom_y,
-																								vee_pos_csup_pin_bottom_z-ball_pos_csup_pin_bottom_z),
-																								new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(1,0,0));
-								
-				org.apache.commons.math3.geometry.euclidean.threed.Vector3D flat_pos_csup_pin_bottom_3D_rot = rot1_csup.applyTo(new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(0,10.0,0));
-				// translate
-				double flat_pos_csup_pin_bottom_x = ball_pos_csup_pin_bottom_x + flat_pos_csup_pin_bottom_3D_rot.getX();
-				double flat_pos_csup_pin_bottom_y = ball_pos_csup_pin_bottom_y + flat_pos_csup_pin_bottom_3D_rot.getY();
-				double flat_pos_csup_pin_bottom_z = ball_pos_csup_pin_bottom_z + flat_pos_csup_pin_bottom_3D_rot.getZ();
-				setFlatPos(flat_pos_csup_pin_bottom_x,flat_pos_csup_pin_bottom_y,flat_pos_csup_pin_bottom_z);
+				if(HPSTestRunTracker2014GeometryDefinition.use30mradRotation) {
+					// find the rotation to place the flat point
+					org.apache.commons.math3.geometry.euclidean.threed.Rotation rot1_csup = 
+							new org.apache.commons.math3.geometry.euclidean.threed.Rotation(
+									new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(vee_pos_csup_pin_bottom_x-ball_pos_csup_pin_bottom_x,
+											vee_pos_csup_pin_bottom_y-ball_pos_csup_pin_bottom_y,
+											vee_pos_csup_pin_bottom_z-ball_pos_csup_pin_bottom_z),
+											new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(1,0,0));
+
+					org.apache.commons.math3.geometry.euclidean.threed.Vector3D flat_pos_csup_pin_bottom_3D_rot = rot1_csup.applyTo(new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(0,10.0,0));
+					// translate
+					double flat_pos_csup_pin_bottom_x = ball_pos_csup_pin_bottom_x + flat_pos_csup_pin_bottom_3D_rot.getX();
+					double flat_pos_csup_pin_bottom_y = ball_pos_csup_pin_bottom_y + flat_pos_csup_pin_bottom_3D_rot.getY();
+					double flat_pos_csup_pin_bottom_z = ball_pos_csup_pin_bottom_z + flat_pos_csup_pin_bottom_3D_rot.getZ();
+
+					setFlatPos(flat_pos_csup_pin_bottom_x,flat_pos_csup_pin_bottom_y,flat_pos_csup_pin_bottom_z);
+					System.out.println("rotated setPos for csupport: \n" + getFlatPos().toString());
+
+				} else {
+				
+					 //vee_pos_csup_pin_bottom_x = ball_pos_csup_pin_bottom_x + 0;
+					 vee_pos_csup_pin_bottom_y = ball_pos_csup_pin_bottom_y;
+					 vee_pos_csup_pin_bottom_z = ball_pos_csup_pin_bottom_z + 0;
+
+					double flat_pos_csup_pin_bottom_x = ball_pos_csup_pin_bottom_x + 0;
+					double flat_pos_csup_pin_bottom_y = ball_pos_csup_pin_bottom_y + 10.0;
+					double flat_pos_csup_pin_bottom_z = ball_pos_csup_pin_bottom_z + 0;
+
+					setFlatPos(flat_pos_csup_pin_bottom_x,flat_pos_csup_pin_bottom_y,flat_pos_csup_pin_bottom_z);
+					System.out.println("setPos for csupport: \n" + getFlatPos().toString());
+					
+				}
 			}
 			protected void setPos() {
+				calcAndSetFlatPos();
 				setBallPos(ball_pos_csup_pin_bottom_x,ball_pos_csup_pin_bottom_y,ball_pos_csup_pin_bottom_z);
 				setVeePos(vee_pos_csup_pin_bottom_x,vee_pos_csup_pin_bottom_y,vee_pos_csup_pin_bottom_z);
-				calcAndSetFlatPos();
+				System.out.println("setPos for csupport: \n" + getFlatPos().toString());
 			}
 			protected void setCoord() {
 				setCoord(null);
+				System.out.println("coord for csupport: \n" + this.getCoord().toString());
 			}
 			protected void setCenter() {
 				// this is never used since it's only a reference volume
@@ -1171,9 +1193,15 @@
 				return getSensorHeight();
 			}
 			protected void setPos() {
-				setBallPos(0,0,0);
-				setVeePos(ballPos.x() + getSensorLength()/2.0, ballPos.y(), ballPos.z());
-				setFlatPos(ballPos.x(),ballPos.y() + getSensorThickness()/2.0, ballPos.z());
+				if(HPSTestRunTracker2014GeometryDefinition.useSiStripsConvention) {
+					setBallPos(0,0,0);
+					setVeePos(ballPos.x(), ballPos.y(), ballPos.z() + getSensorWidth()/2.0);
+					setFlatPos(ballPos.x() + getSensorLength()/2.0,ballPos.y(), ballPos.z());					
+				} else {
+					setBallPos(0,0,0);
+					setVeePos(ballPos.x() + getSensorLength()/2.0, ballPos.y(), ballPos.z());
+					setFlatPos(ballPos.x(),ballPos.y() + getSensorThickness()/2.0, ballPos.z());
+				}
 			}
 			protected void setCoord() {
 				setCoord(null);
@@ -1182,7 +1210,11 @@
 				setCenter(0,0,0);
 			}
 			protected void setBoxDim() {
-				setBoxDim(getSensorLength(),getSensorThickness(),getSensorWidth());
+				if(HPSTestRunTracker2014GeometryDefinition.useSiStripsConvention) {
+					setBoxDim(getSensorWidth(),getSensorLength(),getSensorThickness());
+				} else {
+					setBoxDim(getSensorLength(),getSensorThickness(),getSensorWidth());
+				}
 			}
 			protected double getThickness() {
 				return getSensorThickness();
@@ -1219,9 +1251,15 @@
 				return getActiveSensorHeight();
 			}
 			protected void setPos() {
-				ballPos = new BasicHep3Vector(0,0,0);
-				veePos = new BasicHep3Vector(getActiveSensorWidth()/2.0,0,0);
-				flatPos = new BasicHep3Vector(0,getActiveSensorLength()/2.0,0);
+				if(HPSTestRunTracker2014GeometryDefinition.useSiStripsConvention) {
+					ballPos = new BasicHep3Vector(0,0,0);
+					veePos = new BasicHep3Vector(getActiveSensorWidth()/2.0,0,0);
+					flatPos = new BasicHep3Vector(0,getActiveSensorLength()/2.0,0);
+				} else {
+					ballPos = new BasicHep3Vector(0,0,0);
+					veePos = new BasicHep3Vector(getActiveSensorWidth()/2.0,0,0);
+					flatPos = new BasicHep3Vector(0,getActiveSensorLength()/2.0,0);
+				}
 			}
 			protected void setCoord() {
 				setCoord(null);
@@ -1231,7 +1269,11 @@
 			}
 			@Override
 			protected void setBoxDim() {
-				setBoxDim(getActiveSensorLength(),getActiveSensorThickness(),getActiveSensorWidth());
+				if(HPSTestRunTracker2014GeometryDefinition.useSiStripsConvention) {
+					setBoxDim(getActiveSensorWidth(), getActiveSensorLength(), getActiveSensorThickness());
+				} else {
+					setBoxDim(getActiveSensorLength(),getActiveSensorThickness(),getActiveSensorWidth());
+				}
 			}
 		}
 		
SVNspam 0.1


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