Commit in projects/lcsim/trunk/detector-framework/src on MAIN | |||
main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014.java | +102 | -112 | 3121 -> 3122 |
test/resources/org/lcsim/geometry/subdetector/HPSTestRunTracker2014.xml | +1 | -1 | 3121 -> 3122 |
+103 | -113 |
base, baseplate and supportplate in better shape with consistent treatment of local-to-global
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014.java 2014-05-09 23:01:45 UTC (rev 3121) +++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014.java 2014-05-11 17:37:49 UTC (rev 3122) @@ -218,12 +218,6 @@
- - - - - -
}
@@ -455,7 +449,7 @@
final double vee_pos_csup_x = 385.0 - 51.15; final double vee_pos_csup_y = 115.02; final double vee_pos_csup_z = 0.0;
- // find the arbitrary flat
+ // find the arbitrary flat position (10.0mm in support plate direction)
// this is the rotation angle around the local w of the c-support final double rot_angle_local_w = Math.asin( (vee_pos_csup_y - ball_pos_csup_y)/(vee_pos_csup_x - ball_pos_csup_x)); final double flat_pos_csup_x = ball_pos_csup_x - 10.0 * Math.sin(rot_angle_local_w);
@@ -466,10 +460,6 @@
Hep3Vector vee_pos_csup = new BasicHep3Vector(vee_pos_csup_x,vee_pos_csup_y,vee_pos_csup_z); Hep3Vector flat_pos_csup = new BasicHep3Vector(flat_pos_csup_x,flat_pos_csup_y,flat_pos_csup_z);
-// Hep3Vector ball_pos_support_plate = new BasicHep3Vector(-1.0 * support_width/2.0, -1.0 * support_height/2.0 + support_plate_bottom_height , support_length/2.0); -// Hep3Vector vee_pos_support_plate = new BasicHep3Vector(ball_pos_support_plate.x() + support_plate_bottom_width, ball_pos_support_plate.y(),ball_pos_support_plate.z()); -// Hep3Vector flat_pos_support_plate = new BasicHep3Vector(ball_pos_support_plate.x(), ball_pos_support_plate.y(),ball_pos_support_plate.z() - support_plate_bottom_length); -
if(_debug) { print(String.format("rot_angle_local_w %f", rot_angle_local_w)); print(String.format("ball_pos_csup %s", ball_pos_csup.toString()));
@@ -477,47 +467,16 @@
print(String.format("flat_pos_csup %s", flat_pos_csup.toString())); }
- //makeSupport("bottom", baseWrap, ball_pos_csup, vee_pos_csup, flat_pos_csup, lcdd, sens );
+ makeSupport("bottom", baseWrap, ball_pos_csup, vee_pos_csup, flat_pos_csup, lcdd, sens );
- //baseVolume.setVisAttributes(lcdd.getVisAttributes("BasePlateVis"));
+
-/*
- volName = "supportplatetest"; - Box bbox = new Box(volName + "Box", support_plate_bottom_width, support_plate_bottom_height , support_plate_bottom_length); - lcdd.add(bbox); - Volume supportPlateVolume = new Volume(volName + "_volume", bbox, lcdd.getMaterial("Aluminum")); - pos = new Position(volName + "_position",0,0,0); - rot = new Rotation(volName + "_rotation",0,0,0); - lcdd.add(pos); - lcdd.add(rot); - //PhysVol supportPlatePV = new PhysVol(supportPlateVolume);// (supportPlateVolume, supportVolume, pos, rot); - PhysVol supportPlatePV = new PhysVol(supportPlateVolume, baseWrap.vol, pos, rot);
- - - volName = "supportplatetest2"; - bbox = new Box(volName + "Box", support_plate_bottom_width/2, support_plate_bottom_height/2 , support_plate_bottom_length/2); - lcdd.add(bbox); - Volume supportPlateVolume2 = new Volume(volName + "_volume", bbox, lcdd.getMaterial("Aluminum")); - pos = new Position(volName + "_position",0,0,0); - rot = new Rotation(volName + "_rotation",0,0,0); - lcdd.add(pos); - lcdd.add(rot); - PhysVol supportPlatePV2 = new PhysVol(supportPlateVolume2, supportPlateVolume, pos, rot); - lcdd.add(supportPlateVolume2); - - lcdd.add(supportPlateVolume); - - */ - - - - -
+ //baseVolume.setVisAttributes(lcdd.getVisAttributes("BasePlateVis"));
lcdd.add(baseVolume);
@@ -592,11 +551,9 @@
// Create the LCDD position Position pos = new Position(volName + "_position",box_center.x(), box_center.y(), box_center.z());
- //Position pos = new Position(volName + "_position",box_center_base_plate.x(), box_center_base_plate.y(), box_center_base_plate.z()); - //Position pos = new Position(volName + "_position",0,0,0);
//Find LCDD Euler rotation angles from coordinate system unit vectors
- Hep3Vector lcdd_rot_angles = getEulerAngles(new BasicHep3Vector(1,0,0),new BasicHep3Vector(0,1,0), base_plate_coord.u, base_plate_coord.v);
+ Hep3Vector lcdd_rot_angles = getEulerAngles(base_plate_coord.u, base_plate_coord.v, new BasicHep3Vector(1,0,0),new BasicHep3Vector(0,1,0));
//Hep3Vector lcdd_rot_angles = new BasicHep3Vector(0,0,0); Rotation rot = new Rotation(volName + "_rotation",lcdd_rot_angles.x(), lcdd_rot_angles.y(), lcdd_rot_angles.z()); lcdd.add(pos);
@@ -646,7 +603,6 @@
double support_height = -99999.9; if( name == "bottom" ) {
-
support_length = support_bottom_length; support_width = support_bottom_width; support_height = support_bottom_height;
@@ -664,52 +620,70 @@
// create the coordinate system of the c-support CoordSysDef csup_coord = new CoordSysDef(ball_pos_csup, vee_pos_csup, flat_pos_csup);
- Transform3D trans_csup_to_base_plate = getTransformation(csup_coord); - Transform3D trans_base_plate_to_base = getTransformation(baseWrap.coord);
+ Transform3D trans_csup_to_base = getTransformation(csup_coord); + Transform3D trans_base_to_tracking = getTransformation(baseWrap.coord);
if(_debug) { print(String.format("ball_pos_csup %s", ball_pos_csup.toString())); print(String.format("vee_pos_csup %s", vee_pos_csup.toString())); print(String.format("flat_pos_csup %s", flat_pos_csup.toString()));
- print(String.format("trans_csup_to_base_plate:\n%s", trans_csup_to_base_plate.toString())); - print(String.format("trans_base_plate_to_base:\n%s", trans_base_plate_to_base.toString()));
+ print(String.format("trans_csup_to_base:\n%s", trans_csup_to_base.toString())); + print(String.format("trans_base_to_tracking:\n%s", trans_base_to_tracking.toString()));
}
- // Create the support box
+ // Create the support box in the local coordinate system
Hep3Vector box_dim_local = new BasicHep3Vector(support_width, support_length, support_height);
- Hep3Vector box_dim_base_plate = trans_csup_to_base_plate.rotated(box_dim_local); - Hep3Vector box_dim = trans_base_plate_to_base.rotated(box_dim_base_plate); -
+ //Hep3Vector box_dim_base_plate = trans_csup_to_base_plate.rotated(box_dim_local); + //Hep3Vector box_dim = trans_base_plate_to_base.rotated(box_dim_base_plate); + Hep3Vector box_dim = box_dim_local; +
if(_debug) { print(String.format("box_dim_local %s", box_dim_local.toString()));
- print(String.format("box_dim_base_plate %s", box_dim_base_plate.toString()));
+ //print(String.format("box_dim_base_plate %s", box_dim_base_plate.toString()));
print(String.format("box_dim %s", box_dim.toString())); }
- // Place the support box wrt to the c-support coordinate system
+ // Place the support box in the local coordinate system
- //Find rotation around x-axis - Hep3Vector u = csup_coord.u; -
// Find distance to center
- Hep3Vector box_center_support_local = new BasicHep3Vector(support_plate_bottom_width/2.0, support_plate_bottom_length/2.0, -1.0 * support_plate_bottom_height/2.0); - Hep3Vector box_center_support_base_plate = trans_csup_to_base_plate.transformed(box_center_support_local);
+ Hep3Vector box_center_support_local = new BasicHep3Vector(support_bottom_width/2.0, support_bottom_length/2.0, support_bottom_height/2.0);
- print(String.format("box_center_support_local %s", box_center_support_local.toString())); - print(String.format("box_center_support_base_plate %s", box_center_support_base_plate.toString())); - - // Find the equivalent lcdd rotation angles from the coordinate system
+ // Rotate the local coordinates into the mother coordinate system + Hep3Vector box_center_support_base = trans_csup_to_base.transformed(box_center_support_local); + Hep3Vector box_center_support_tracking = trans_base_to_tracking.transformed(box_center_support_base);
- //Hep3Vector lcdd_rot_angles = new BasicHep3Vector(Math.PI,-0.1,0); - - // 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_sub = VecOp.sub(box_center_module_coord_rot, moduleWrap.center);
+ + // find the displacement of the center of the box from the rotation around an arbitrary point in local coordinates +// +// // Find the vector from the center of rotation to a point +// Hep3Vector s = VecOp.sub(box_center_support_base, ball_pos_csup); +// //Apply the rotation to that vector to find its displacement +// Hep3Vector s_rot = trans_csup_to_base.rotated(s); +// // adjust the center for that rotation +// Hep3Vector box_center_rot = VecOp.add(box_center_support_base, s_rot); +// +// + + // find the position of the center in the lcdd box + Hep3Vector box_center = VecOp.sub(box_center_support_base, baseWrap.center);
//Hep3Vector box_center = transModuleToSupportCoord.rotated(box_center_sub);
+ + if(_debug) { + print(String.format("box_center_support_local %s", box_center_support_local.toString())); + print(String.format("box_center_support_base %s", box_center_support_base.toString())); + print(String.format("baseWrap.center %s", baseWrap.center.toString())); + print(String.format("box_center %s", box_center.toString())); + print(String.format("box_center_support_tracking %s", box_center_support_tracking.toString())); + } + + + // Find the lcdd Euler angles to go to the mother coordinate system + Hep3Vector lcdd_rot_angles = this.getEulerAngles(csup_coord.u, csup_coord.v, new BasicHep3Vector(1,0,0),new BasicHep3Vector(0,1,0)); + +
// fix the rotation //Hep3Vector lcdd_rot_angles_support = transModuleToSupportCoord.rotated(lcdd_rot_angles);
@@ -721,10 +695,7 @@
//lcdd.add(rot);
- Hep3Vector box_center_support = trans_base_plate_to_base.transformed(box_center_support_base_plate);
- print(String.format("box_center_support %s", box_center_support.toString())); -
String volName = "support_" + name; Box box = new Box(volName + "Box", box_dim.x(), box_dim.y(), box_dim.z()); lcdd.add(box);
@@ -732,11 +703,12 @@
Volume supportVolume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
-
+ // Create the LCDD position + Position pos = new Position(volName + "_position",box_center.x(), box_center.y(), box_center.z());
- Position pos = new Position(volName + "_position",box_center_support.x(), box_center_support.y(), box_center_support.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);
@@ -760,9 +732,12 @@
// vee: corner of the hinge end at the surface on the positron side // flat: middle of plate at upstream end at the surface
- Hep3Vector ball_pos_support_plate = new BasicHep3Vector(0.0, -1.0 * support_height/2.0 + support_plate_bottom_height , support_length/2.0);
+ Hep3Vector ball_pos_support_plate = new BasicHep3Vector(0.0, 0.0, 0.0);
Hep3Vector vee_pos_support_plate = new BasicHep3Vector(ball_pos_support_plate.x() + support_plate_bottom_width, ball_pos_support_plate.y(),ball_pos_support_plate.z());
- Hep3Vector flat_pos_support_plate = new BasicHep3Vector(ball_pos_support_plate.x(), ball_pos_support_plate.y(),ball_pos_support_plate.z() - support_plate_bottom_length);
+ Hep3Vector flat_pos_support_plate = new BasicHep3Vector(ball_pos_support_plate.x(), ball_pos_support_plate.y() + support_plate_bottom_length,ball_pos_support_plate.z());
+ //Hep3Vector ball_pos_support_plate = new BasicHep3Vector(0.0, -1.0 * support_height/2.0 + support_plate_bottom_height , support_length/2.0);
+ //Hep3Vector vee_pos_support_plate = new BasicHep3Vector(ball_pos_support_plate.x() + support_plate_bottom_width, ball_pos_support_plate.y(),ball_pos_support_plate.z());
+ //Hep3Vector flat_pos_support_plate = new BasicHep3Vector(ball_pos_support_plate.x(), ball_pos_support_plate.y(),ball_pos_support_plate.z() - support_plate_bottom_length);
//Hep3Vector ball_pos_support_plate = new BasicHep3Vector(-1.0 * support_width/2.0, -1.0 * support_height/2.0 + support_plate_bottom_height , support_length/2.0); //Hep3Vector vee_pos_support_plate = new BasicHep3Vector(ball_pos_support_plate.x() + support_plate_bottom_width, ball_pos_support_plate.y(),ball_pos_support_plate.z()); //Hep3Vector flat_pos_support_plate = new BasicHep3Vector(ball_pos_support_plate.x(), ball_pos_support_plate.y(),ball_pos_support_plate.z() - support_plate_bottom_length);
@@ -842,7 +817,7 @@
} // make the module
- makeModule(layerName,supportWrap, ball_pos_mod, vee_pos_mod, flat_pos_mod,lcdd, sens);
+ //makeModule(layerName,supportWrap, ball_pos_mod, vee_pos_mod, flat_pos_mod,lcdd, sens);
} // ilayer
@@ -915,53 +890,65 @@
Hep3Vector vee_pos_support_plate, Hep3Vector flat_pos_support_plate, LCDD lcdd, SensitiveDetector sens) throws JDOMException {
+ if(_debug) { + print("--- makeSupportPlate for half ----"); + + }
+
-
+ // Create the box in mother coordinates
String volName = supportWrap.name + "_supportplate";
- Box box = new Box(volName + "Box", support_plate_bottom_width, support_plate_bottom_height , support_plate_bottom_length);
+ Box box = new Box(volName + "Box", support_plate_bottom_width, support_plate_bottom_length, support_plate_bottom_height);
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("ball_pos_support_plate %s", ball_pos_support_plate.toString())); - 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()));
- // Find distance to center in the local coordinate system
+ if(_debug) { + print(String.format("ball_pos_support_plate %s", ball_pos_support_plate.toString())); + 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_plate_to_support = getTransformation(support_plate_coord);
- Hep3Vector box_center_support_plate_local = new BasicHep3Vector(support_plate_bottom_width/2.0, support_plate_bottom_length/2.0, -1.0 * support_plate_bottom_height/2.0); - 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()));
+ // Find distance to center in the local coordinate system + Hep3Vector box_center_support_plate_local = new BasicHep3Vector(support_plate_bottom_width/2.0, support_plate_bottom_length/2.0, support_plate_bottom_height/2.0);
- Position pos = new Position(volName + "_position",box_center_support_plate.x(), box_center_support_plate.y(), box_center_support_plate.z());
+ //translate to the mother coordinate system + Hep3Vector box_center_support = trans_support_plate_to_support.transformed(box_center_support_plate_local); + + + // 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 mother coord + Hep3Vector box_center = VecOp.sub(box_center_support, supportWrap.center); + + if(_debug) { + 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.toString())); + print(String.format("supportWrap.center %s", supportWrap.center.toString())); + print(String.format("box_center %s", box_center.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 = new BasicHep3Vector(0,0,0); //getLCDDRotation(support_plate_coord);
+ Hep3Vector lcdd_rot_angles = this.getEulerAngles(support_plate_coord.u, support_plate_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);
- print ("supportVolume solidref: " + supportWrap.vol.getSolidRef()); - print ("supportVolume getVolumeName: " + supportWrap.vol.getVolumeName()); - print ("supportPlateVolume solidref: " + supportPlateVolume.getSolidRef()); - print ("supportPlateVolume getVolumeName: " + supportPlateVolume.getVolumeName()); - //print("supportPlateVolume: " + supportPlateVolume.); - //print("supportWrap.vol: " + supportWrap.vol.toString()); - //PhysVol supportPlatePV = new PhysVol(supportPlateVolume);//, supportWrap.vol, pos, rot);
PhysVol supportPlatePV = new PhysVol(supportPlateVolume, supportWrap.vol, pos, rot);
- //supportPlateVolume.addPhysVol(supportPlatePV); - //supportPlateVolume.getAttributes() - supportPlateVolume.setVisAttributes(lcdd.getVisAttributes("SupportPlateVis"));
- lcdd.add(supportPlateVolume); -
VolWrapper supportPlateWrap = new VolWrapper(); supportPlateWrap.mother = supportWrap; supportPlateWrap.vol = supportPlateVolume;
@@ -970,8 +957,11 @@
supportPlateWrap.rot_vol = rot; supportWrap.daughters.add(supportPlateWrap);
+ + supportPlateVolume.setVisAttributes(lcdd.getVisAttributes("SupportPlateVis")); + lcdd.add(supportPlateVolume); +
-
}
@@ -2001,7 +1991,7 @@
} print("XYZ angles " + euler.toString()); //euler = VecOp.mult(-1.0, euler);
- print("XYZ angles " + euler.toString() + " (passive)");
+ //print("XYZ angles " + euler.toString() + " (passive)");
--- projects/lcsim/trunk/detector-framework/src/test/resources/org/lcsim/geometry/subdetector/HPSTestRunTracker2014.xml 2014-05-09 23:01:45 UTC (rev 3121) +++ projects/lcsim/trunk/detector-framework/src/test/resources/org/lcsim/geometry/subdetector/HPSTestRunTracker2014.xml 2014-05-11 17:37:49 UTC (rev 3122) @@ -38,7 +38,7 @@
<vis name="ModuleVis" alpha="1.0" r="1.0" g="1.0" b="1.0" drawingStyle="wireframe" lineStyle="dotted" showDaughters="true" visible="true"/> <vis name="SupportPlateVis" alpha="1.0" r="0.75" g="0.73" b="0.75" drawingStyle="solid" lineStyle="dashed" showDaughters="true" visible="true"/> <vis name="SupportVolumeVis" alpha="1.0" r="0.75" g="0.73" b="0.75" drawingStyle="wireframe" lineStyle="dashed" showDaughters="true" visible="true"/>
- <vis name="BasePlateVis" alpha="1.0" r="0.75" g="0.73" b="0.75" drawingStyle="solid" lineStyle="dashed" showDaughters="true" visible="true"/>
+ <vis name="BasePlateVis" alpha="1.0" r="0.75" g="0.73" b="0.75" drawingStyle="wireframe" lineStyle="dashed" showDaughters="true" visible="true"/>
<vis name="LayerVis" alpha="0.0" r="0.0" g="0.0" b="1.0" drawingStyle="wireframe" showDaughters="true" visible="false"/> <vis name="ComponentVis" alpha="0.0" r="0.0" g="0.2" b="0.4" drawingStyle="solid" showDaughters="false" visible="false"/>
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