Print

Print


Commit in projects/lcsim/trunk/detector-framework/src on MAIN
main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014.java+174-383169 -> 3170
test/resources/org/lcsim/geometry/subdetector/HPSTestRunTracker2014.xml+13169 -> 3170
+175-38
2 modified files
Fixed absolute global position. Added local to global transform.

projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd
HPSTestRunTracker2014.java 3169 -> 3170
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014.java	2014-07-03 00:45:20 UTC (rev 3169)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014.java	2014-07-03 18:15:42 UTC (rev 3170)
@@ -44,9 +44,31 @@
 	private boolean _debug = true; 
 	public static final double inch = 25.4;
 	
+	private final double target_pos_wrt_base_plate_x = 162.3; //from Marco's 3D model
+	private final double target_pos_wrt_base_plate_y = 80.55; //from Tim's sketchup //68.75; //from Marco's 3D model
+	private final double target_pos_wrt_base_plate_z = 926.59; //from Marco's 3D model
+
+	
+	private final double base_plate_thickness = 0.25*inch;
+	private final double base_plate_width = 385.00;
+	private final double base_plate_length = 1216.00;
+	private final double base_plate_offset_height = 2.0; //from Marco's 3D model
+	private final double PS_vac_box_inner_height = 7.0*inch;
+	// height of the dummy box holding the entire SVT: this means the bottom of the base plate to the the inner surface of of the PS vac box for now
+	private final double base_height = PS_vac_box_inner_height - base_plate_offset_height; 
+	private final double base_width = base_plate_width;
+	private final double base_length = base_plate_length;
+	private final double beamPlaneThickness = 0.00000001;
+
+	
+	
 	private final double sensor_length= 100.00; //98.33;
 	private final double sensor_width = 40.34; //38.3399;
 	private final double sensor_thickness = 0.32;
+	private final double sensor_active_length= 98.33;
+	private final double sensor_active_width = 38.3399;
+	private final double sensor_active_thickness = sensor_thickness;
+
 	private final double hybrid_length = 170.0 - sensor_length; // sensor b-to-b with hybrid
 	private final double hybrid_width  = sensor_width;
 	private final double hybrid_thickness = 4.0/64.0*inch;
@@ -155,25 +177,7 @@
 	
 	
 	
-	private final double base_plate_thickness = 0.25*inch;
-	private final double base_plate_width = 385.00;
-	private final double base_plate_length = 1216.00;
-	private final double base_plate_offset_height = 0.0;
-	private final double PS_vac_box_inner_height = 7.0*inch;
-	private final double PS_vac_box_plate_thickness = 0.75*inch;
-	// height of the dummy box holding the entire SVT: this means the bottom of the base plate to the the inner surface of of the PS vac box for now
-	private final double base_height = PS_vac_box_inner_height - base_plate_offset_height; 
-	private final double base_width = base_plate_width;
-	private final double base_length = base_plate_length;
-	private final double beamPlaneThickness = 0.00000001;
-	private final double base_plate_offset_from_edge = 1.0*inch;
 	
-
-	
-
-	
-	
-	
 	public HPSTestRunTracker2014(Element node) throws JDOMException
 	{
 		super(node);
@@ -252,9 +256,12 @@
 		// The x=0 is centered on the support plate width at the target position in z( TODO: really?)
 		// The beam is at y=0 in the center of the PS vac box
 		
-		final double ball_pos_base_plate_x = -1.0*base_plate_width/2.0;
-		final double ball_pos_base_plate_y = -1.0*PS_vac_box_inner_height/2.0 + base_plate_thickness + base_plate_offset_height;
-		final double ball_pos_base_plate_z = base_plate_length - 12.0*inch + base_plate_offset_from_edge ;
+		final double ball_pos_base_plate_x = -1.0*target_pos_wrt_base_plate_x;
+		final double ball_pos_base_plate_y = -1.0*target_pos_wrt_base_plate_y;
+		final double ball_pos_base_plate_z = target_pos_wrt_base_plate_z;		
+		//final double ball_pos_base_plate_x = -1.0*base_plate_width/2.0;
+		//final double ball_pos_base_plate_y = -1.0*PS_vac_box_inner_height/2.0 + base_plate_thickness + base_plate_offset_height;
+		//final double ball_pos_base_plate_z = base_plate_length - 12.0*inch;
 		final double vee_pos_base_plate_x = ball_pos_base_plate_x + base_plate_width;
 		final double vee_pos_base_plate_y = ball_pos_base_plate_y;
 		final double vee_pos_base_plate_z = ball_pos_base_plate_z;
@@ -313,7 +320,7 @@
 		Transform3D trans_base_to_tracking = getTransformation(base_coord);
 		
 		String volName = "base";
-		Box box = new Box(volName + "Box", base_width, base_length, base_height);
+		Box box = new Box(volName + "Box", base_width, base_length, base_height); 
 		lcdd.add(box);
 		Volume baseVolume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
 
@@ -442,7 +449,6 @@
 			print(String.format("flat_pos_csup_pin_bottom_3D_rot   (%f,%f,%f) ", flat_pos_csup_pin_bottom_3D_rot.getX(),flat_pos_csup_pin_bottom_3D_rot.getY(),flat_pos_csup_pin_bottom_3D_rot.getZ()));
 			print(String.format("flat_pos_csup_pin_bottom           %s", flat_pos_csup_pin_bottom.toString()));
 			print(String.format("csup_pin_coord:\n%s ", csup_pin_coord.toString()));
-			print(String.format("trans_csup_pin_to_base:\n%s ", trans_csup_pin_to_base.toString()));
 			
 		}
 		
@@ -485,7 +491,7 @@
 
 		// create the coordinate system of the c-support bearings
 		CoordSysDef csup_bearings_bottom_coord = new CoordSysDef(ball_pos_csup_bearings_bottom, vee_pos_csup_bearings_bottom, flat_pos_csup_bearings_bottom);		
-		//Transform3D trans_csup_bearings_to_pin = getTransformation(csup_pin_coord);
+		
 
 		
 
@@ -496,7 +502,9 @@
 			print(String.format("csup_bottom_rot_angle_local_u           %f", csup_bottom_rot_angle_local_u ));
 			print(String.format("flat_pos_csup_bearings_bottom           %s", flat_pos_csup_bearings_bottom.toString()));
 			print(String.format("csup_bearings_coord:\n%s ", csup_bearings_bottom_coord.toString()));
-			//print(String.format("trans_csup_bearings_to_pin:\n%s ", trans_csup_bearings_to_pin.toString()));
+			//Transform3D trans_csup_bearings_to_base = getTransformation(csup_pin_coord);
+			print(String.format("ball_pos_csup_bearings_bottom (in base) %s", trans_csup_pin_to_base.transformed(ball_pos_csup_bearings_bottom).toString()));
+			
 		}
 
 
@@ -529,10 +537,10 @@
 		
 		Hep3Vector ball_pos_csup_bearings_top = new BasicHep3Vector(ball_pos_csup_bearings_bottom.x(),
 																	ball_pos_csup_bearings_bottom.y(),
-																	ball_pos_csup_bearings_bottom.z() + 146.4);
+																	146.4);
 		Hep3Vector vee_pos_csup_bearings_top = new BasicHep3Vector(vee_pos_csup_bearings_bottom.x(),
 																	vee_pos_csup_bearings_bottom.y(),
-																	vee_pos_csup_bearings_bottom.z() + 146.4);
+																	146.4);
 		
 		// use a settable rotation to effectively determine the flat and therefore the tilt of the support 
 		final double csup_top_rot_angle_local_u = 0.0;
@@ -793,6 +801,8 @@
 			print(String.format("flat_pos_csup %s", flat_pos_csup.toString()));
 			print(String.format("csup_coord:\n%s", csup_coord.toString()));
 			print(String.format("baseWrap.coord:\n%s", baseWrap.coord.toString()));
+			Transform3D trans_to_base = getTransformation(baseWrap.coord);
+			print(String.format("ball_pos_csup (in  %s) %s", baseWrap.name, trans_to_base.transformed(ball_pos_csup).toString()));
 		}
 		
 
@@ -862,14 +872,14 @@
 		Hep3Vector vee_pos_support_plate;
 		Hep3Vector flat_pos_support_plate;
 		if(half == "bottom") {
-			ball_pos_support_plate = new BasicHep3Vector(1.0, (17.00-10.50/2.0), 6.66+1.34); 
+			ball_pos_support_plate = new BasicHep3Vector(1.0, (17.0-5.0), 6.66+1.34); 
 			vee_pos_support_plate = new BasicHep3Vector(ball_pos_support_plate.x() + support_plate_width, ball_pos_support_plate.y(),ball_pos_support_plate.z());
 			flat_pos_support_plate = new BasicHep3Vector(ball_pos_support_plate.x(), ball_pos_support_plate.y() + support_plate_length,ball_pos_support_plate.z());
 			//ball_pos_support_plate = new BasicHep3Vector(0.0, 0.0, support_plate_height); // TODO figure out what height this should be from the C-support drawings
 			//vee_pos_support_plate = new BasicHep3Vector(ball_pos_support_plate.x() + support_plate_width, ball_pos_support_plate.y(),ball_pos_support_plate.z());
 			//flat_pos_support_plate = new BasicHep3Vector(ball_pos_support_plate.x(), ball_pos_support_plate.y() + support_plate_length,ball_pos_support_plate.z());
 		} else {
-			ball_pos_support_plate = new BasicHep3Vector(1.0, (17.00-10.50/2.0), -1.0 * (6.66+1.34)); // TODO figure out what height this should be from the C-support drawings
+			ball_pos_support_plate = new BasicHep3Vector(1.0, (17.0-5.0), -1.0 * (6.66+1.34)); // TODO figure out what height this should be from the C-support drawings
 			vee_pos_support_plate = new BasicHep3Vector(ball_pos_support_plate.x() + support_plate_width, ball_pos_support_plate.y(),ball_pos_support_plate.z());
 			flat_pos_support_plate = new BasicHep3Vector(ball_pos_support_plate.x(), ball_pos_support_plate.y() + support_plate_length,ball_pos_support_plate.z());
 		}
@@ -1043,6 +1053,9 @@
 			print(String.format("vee_pos_support_plate  %s", vee_pos_support_plate.toString()));
 			print(String.format("flat_pos_support_plate %s", flat_pos_support_plate.toString()));
 			print(String.format("support_plate_coord:\n%s", support_plate_coord.toString()));
+			Transform3D trans_support_to_mother = getTransformation(supportWrap.coord);
+			print(String.format("ball_pos_support_plate (in %s) %s", supportWrap.mother.name,trans_support_to_mother.transformed(ball_pos_support_plate).toString()));
+			
 		}
 		
 		
@@ -1710,8 +1723,6 @@
 		// create the coordinate system
 		CoordSysDef sensor_coord = new CoordSysDef(ball_pos_sensor_local, vee_pos_sensor_local, flat_pos_sensor_local);		
 		Transform3D transToHalfModuleCoord = getTransformation(sensor_coord); 
-		//Transform3D transToModuleCoord = getTransformation(halfModuleWrap.coord); 
-		//Transform3D transToSupportCoord = getTransformation(halfModuleWrap.mother.coord); 
 
 		if(_debug) {
 			print(String.format("ball_pos_sensor_local %s", ball_pos_sensor_local.toString()));
@@ -1749,13 +1760,6 @@
 
 
 		PhysVol physVolume = new PhysVol(sensor_volume, halfModuleWrap.vol, pos, rot);
-
-		sensor_volume.setSensitiveDetector(sens);
-		physVolume.addPhysVolID("sensor", sensor_number);
-		physVolume.addPhysVolID("system", 0);
-		physVolume.addPhysVolID("barrel", 0);
-		physVolume.addPhysVolID("layer", 0);
-		physVolume.addPhysVolID("module", 0);    
 			
 		
 		VolWrapper sensorWrap = new VolWrapper();
@@ -1769,7 +1773,16 @@
 		sensorWrap.coord = sensor_coord;
 		halfModuleWrap.daughters.add(sensorWrap);
 	
+
+		// Active sensor volume
+		// ball is center of sensor
+		// vee is middle point along long edge of sensor
+		Hep3Vector ball_pos_sensor_active = new BasicHep3Vector(0,0,0);
+		Hep3Vector vee_pos_sensor_active = new BasicHep3Vector(sensor_active_width/2.0,0,0);
+		Hep3Vector flat_pos_sensor_active = new BasicHep3Vector(0,sensor_active_length/2.0,0);
 		
+		makeHalfModuleComponentActiveSensor(sensorWrap,ball_pos_sensor_active,vee_pos_sensor_active,flat_pos_sensor_active,lcdd,sens);
+		
 		sensor_volume.setVisAttributes(lcdd.getVisAttributes("SensorVis"));
 		
 		lcdd.add(sensor_volume);
@@ -1780,6 +1793,129 @@
 	
 	
 	
+	
+	
+	private Hep3Vector transformToMotherCoord(Hep3Vector vec, VolWrapper motherWrap, String targetCoordName) {
+		print(String.format("vec %s motherWrap %s target %s", vec.toString(), motherWrap.name, targetCoordName));
+		if(motherWrap.name.equals(targetCoordName)) {
+			print(String.format("found the vec %s", vec.toString()));
+			return vec;
+		} else {
+			Transform3D trans = getTransformation(motherWrap.coord); 
+			Hep3Vector vec_t = trans.transformed(vec);
+			print(String.format("continue searching"));
+			return transformToMotherCoord(vec_t, motherWrap.mother, targetCoordName);
+		}
+		
+	}
+	
+	
+	
+	private void makeHalfModuleComponentActiveSensor(VolWrapper motherWrap, 
+			Hep3Vector ball_pos, Hep3Vector vee_pos, Hep3Vector flat_pos, 
+			LCDD lcdd, SensitiveDetector sens) throws JDOMException {
+		
+		if(_debug) {
+			print("--- makeHalfModuleComponentActiveSensor ---");
+		}
+		
+		
+		//___________________________________________
+		
+		int sensor_number = 0;
+		String volName = motherWrap.name + "_active_sensor" + sensor_number;		
+		Box box = new Box(volName + "_box",sensor_active_length,sensor_active_thickness,sensor_active_width);
+		lcdd.add(box);
+		Volume volume = new Volume(volName + "_volume", box,lcdd.getMaterial("Silicon"));
+		
+		// create the coordinate system
+		CoordSysDef coord = new CoordSysDef(ball_pos, vee_pos, flat_pos);		
+		Transform3D localToMother = getTransformation(coord); 
+
+		if(_debug) {
+			print(String.format("ball_pos %s", ball_pos.toString()));
+			print(String.format("vee_pos  %s", vee_pos.toString()));
+			print(String.format("flat_pos %s", flat_pos.toString()));
+			print(String.format("coord:\n%s", coord.toString()));
+			Hep3Vector ball_pos_tmp = this.transformToMotherCoord(ball_pos, motherWrap, "base");
+			print(String.format("ball_pos tmp %s %s", volName, ball_pos_tmp.toString()));
+//			Transform3D motherTrans = getTransformation(motherWrap.coord); 
+//			print(String.format("ball_pos (%s): %s", motherWrap.mother.name, motherTrans.transformed(ball_pos).toString()));
+//			Transform3D motherMotherTrans = getTransformation(motherWrap.mother.coord); 
+//			print(String.format("ball_pos (%s): %s", motherWrap.mother.mother.name, motherMotherTrans.transformed(motherTrans.transformed(ball_pos)).toString()));
+//			Transform3D motherMotherMotherTrans = getTransformation(motherWrap.mother.mother.coord); 
+//			print(String.format("ball_pos (%s): %s", motherWrap.mother.mother.mother.name, motherMotherMotherTrans.transformed(motherMotherTrans.transformed(ball_pos)).toString()));
+//			Transform3D motherMotherMotherMotherTrans = getTransformation(motherWrap.mother.mother.mother.coord); 
+//			print(String.format("ball_pos (%s): %s", motherWrap.mother.mother.mother.mother.name, motherMotherMotherMotherTrans.transformed(motherMotherMotherTrans.transformed(ball_pos)).toString()));
+//			Transform3D motherMotherMotherMotherMotherTrans = getTransformation(motherWrap.mother.mother.mother.mother.coord); 
+//			print(String.format("ball_pos %s (%s): %s", volName, motherWrap.mother.mother.mother.mother.name, motherMotherMotherMotherMotherTrans.transformed(motherMotherMotherMotherTrans.transformed(ball_pos)).toString()));
+//			
+
+		}
+
+
+		// Find distance to center in the local coordinate system 
+		Hep3Vector box_center_local = new BasicHep3Vector(0.,0.,0.);
+
+		//translate to the mother coordinate system
+		Hep3Vector box_center_mother = localToMother.transformed(box_center_local);
+
+		// find the position of the center in the mother coord
+		Hep3Vector box_center = VecOp.sub(box_center_mother, motherWrap.center);
+
+
+		if(_debug) {
+			print(String.format("box_center_local       %s", box_center_local.toString()));
+			print(String.format("box_center_mother      %s", box_center_mother.toString()));
+			print(String.format("motherWrap.center      %s", motherWrap.center.toString()));
+			print(String.format("box_center             %s", box_center.toString()));
+	
+			print(String.format("motherWrap.center      %s", motherWrap.coord.toString()));
+			
+		}
+
+		// Create the LCDD position
+		Position pos = new Position(volName + "_position",box_center.x(), box_center.y(), box_center.z());
+
+		//Find LCDD rotation angles from coordinate system unit vectors
+		Hep3Vector lcdd_rot_angles = this.getEulerAngles(coord.u, coord.v, new BasicHep3Vector(1,0,0), new BasicHep3Vector(0,1,0));
+		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 physVolume = new PhysVol(volume, motherWrap.vol, pos, rot);
+
+		volume.setSensitiveDetector(sens);
+		physVolume.addPhysVolID("sensor", sensor_number);
+		physVolume.addPhysVolID("system", 0);
+		physVolume.addPhysVolID("barrel", 0);
+		physVolume.addPhysVolID("layer", 0);
+		physVolume.addPhysVolID("module", 0);    
+			
+		
+		VolWrapper wrap = new VolWrapper();
+		wrap.name = volName;
+		wrap.pv = physVolume;
+		wrap.vol = volume;
+		wrap.pos_vol = pos;
+		wrap.rot_vol = rot;
+		wrap.mother = motherWrap;
+		wrap.center = box_center_local;
+		wrap.coord = coord;
+		motherWrap.daughters.add(wrap);
+	
+
+		volume.setVisAttributes(lcdd.getVisAttributes("ActiveSensorVis"));
+		
+		lcdd.add(volume);
+	
+	}
+
+	
+	
+	
+	
 	private void makeHalfModuleComponentKapton(VolWrapper halfModuleWrap, Hep3Vector ball_pos_kapton_local, Hep3Vector vee_pos_kapton_local, Hep3Vector flat_pos_kapton_local, LCDD lcdd, SensitiveDetector sens) throws JDOMException {
 		
 		if(_debug) {

projects/lcsim/trunk/detector-framework/src/test/resources/org/lcsim/geometry/subdetector
HPSTestRunTracker2014.xml 3169 -> 3170
--- projects/lcsim/trunk/detector-framework/src/test/resources/org/lcsim/geometry/subdetector/HPSTestRunTracker2014.xml	2014-07-03 00:45:20 UTC (rev 3169)
+++ projects/lcsim/trunk/detector-framework/src/test/resources/org/lcsim/geometry/subdetector/HPSTestRunTracker2014.xml	2014-07-03 18:15:42 UTC (rev 3170)
@@ -30,6 +30,7 @@
   <display>
 	
     <vis name="SensorVis" alpha="1.0" r="1.0" g="0.0" b="0.0" drawingStyle="wireframe" lineStyle="unbroken" showDaughters="true" visible="true"/>
+    <vis name="ActiveSensorVis" alpha="1.0" r="1.0" g="0.0" b="0.0" drawingStyle="wireframe" lineStyle="unbroken" showDaughters="true" visible="true"/>
     <vis name="CarbonFiberVis" alpha="1.0" r="0.88" g="0.88" b="0.88" drawingStyle="wireframe" lineStyle="unbroken" showDaughters="true" visible="false"/>
     <vis name="KaptonVis" alpha="1.0" r="0.91" g="0.77" b="0.06" drawingStyle="wireframe" lineStyle="unbroken" showDaughters="true" visible="false"/>
     <vis name="HybridVis" alpha="1.0" r="0.0" g="1.0" b="0" drawingStyle="wireframe" lineStyle="unbroken" showDaughters="true" visible="false"/>
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