projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014.java 2014-07-12 01:27:46 UTC (rev 3176)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014.java 2014-07-14 00:55:24 UTC (rev 3177)
@@ -22,6 +22,10 @@
import org.lcsim.detector.RotationGeant;
import org.lcsim.detector.Transform3D;
import org.lcsim.detector.Translation3D;
+import org.lcsim.geometry.compact.converter.lcdd.HPSTestRunTracker2014GeomDef.HalfModuleLamination;
+import org.lcsim.geometry.compact.converter.lcdd.HPSTestRunTracker2014GeomDef.TestRunColdBlockL13;
+import org.lcsim.geometry.compact.converter.lcdd.HPSTestRunTracker2014GeomDef.TestRunColdBlockL45;
+import org.lcsim.geometry.compact.converter.lcdd.HPSTestRunTracker2014GeomDef.TestRunModule;
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;
@@ -48,14 +52,17 @@
private static HPSTestRunTracker2014GeomDef.TrackingBase tracking;
private static HPSTestRunTracker2014GeomDef.Base base;
private static HPSTestRunTracker2014GeomDef.BasePlate basePlate;
+ private static HPSTestRunTracker2014GeomDef.CSupport cSupport;
private static HPSTestRunTracker2014GeomDef.SupportBottom supportBottom;
private static HPSTestRunTracker2014GeomDef.SupportPlateBottom supportPlateBottom;
private static HPSTestRunTracker2014GeomDef.SupportTop supportTop;
private static HPSTestRunTracker2014GeomDef.SupportPlateTop supportPlateTop;
+ private static List<HPSTestRunTracker2014GeomDef.TestRunModule> modules;
+
//General
public final double inch = 25.4;
@@ -132,77 +139,23 @@
// vee: slot
// flat: middle of pocket defining local w out of the pocket vertically
- // bottom
- private final Hep3Vector ball_pos_module1_support_plate_bottom_local = new BasicHep3Vector(25.0, 661.1, HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L1-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth);
- private final Hep3Vector vee_pos_module1_support_plate_bottom_local = new BasicHep3Vector(95.0, 661.1, HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L1-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth);
- private final Hep3Vector flat_pos_module1_support_plate_bottom_local = new BasicHep3Vector(60.0, 667.10, HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L1-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth);
- private final Hep3Vector ball_pos_module2_support_plate_bottom_local = new BasicHep3Vector(25.0, 561.1, HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L2-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth);
- private final Hep3Vector vee_pos_module2_support_plate_bottom_local = new BasicHep3Vector(95.0, 561.1, HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L2-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth);
- private final Hep3Vector flat_pos_module2_support_plate_bottom_local = new BasicHep3Vector(60.0, 567.10, HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L2-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth);
- private final Hep3Vector ball_pos_module3_support_plate_bottom_local = new BasicHep3Vector(25.0, 461.1, HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L3-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth);
- private final Hep3Vector vee_pos_module3_support_plate_bottom_local = new BasicHep3Vector(95.0, 461.1, HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L3-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth);
- private final Hep3Vector flat_pos_module3_support_plate_bottom_local = new BasicHep3Vector(60.0, 467.10, HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L3-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth);
- private final Hep3Vector ball_pos_module4_support_plate_bottom_local = new BasicHep3Vector(25.0, 261.1, HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L4-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth);
- private final Hep3Vector vee_pos_module4_support_plate_bottom_local = new BasicHep3Vector(95.0, 261.1, HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L4-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth);
- private final Hep3Vector flat_pos_module4_support_plate_bottom_local = new BasicHep3Vector(60.0, 267.10, HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L4-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth);
- private final Hep3Vector ball_pos_module5_support_plate_bottom_local = new BasicHep3Vector(25.0, 61.1, HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L5-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth);
- private final Hep3Vector vee_pos_module5_support_plate_bottom_local = new BasicHep3Vector(95.0, 61.1, HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L5-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth);
- private final Hep3Vector flat_pos_module5_support_plate_bottom_local = new BasicHep3Vector(60.0, 67.10, HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L5-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth);
- // top
- // top has a fixed offset of 15mm along plate on module pocket positions w.r.t. bottom
- // top local coordinates is rotation pi around u-vec so need to adjust pocket depth coordinate
- private final Hep3Vector ball_pos_module1_support_plate_top_local = new BasicHep3Vector(25.0, 676.1, -1.0 * (HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L1-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth));
- private final Hep3Vector vee_pos_module1_support_plate_top_local = new BasicHep3Vector(95.0, 676.1, -1.0 * (HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L1-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth));
- private final Hep3Vector flat_pos_module1_support_plate_top_local = new BasicHep3Vector(60.0, 670.1, -1.0 * (HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L1-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth));
- private final Hep3Vector ball_pos_module2_support_plate_top_local = new BasicHep3Vector(25.0, 576.1, -1.0 * (HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L2-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth));
- private final Hep3Vector vee_pos_module2_support_plate_top_local = new BasicHep3Vector(95.0, 576.1, -1.0 * (HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L2-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth));
- private final Hep3Vector flat_pos_module2_support_plate_top_local = new BasicHep3Vector(60.0, 570.1, -1.0 * (HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L2-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth));
- private final Hep3Vector ball_pos_module3_support_plate_top_local = new BasicHep3Vector(25.0, 476.1, -1.0 * (HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L3-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth));
- private final Hep3Vector vee_pos_module3_support_plate_top_local = new BasicHep3Vector(95.0, 476.1, -1.0 * (HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L3-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth));
- private final Hep3Vector flat_pos_module3_support_plate_top_local = new BasicHep3Vector(60.0, 470.1, -1.0 * (HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L3-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth));
- private final Hep3Vector ball_pos_module4_support_plate_top_local = new BasicHep3Vector(25.0, 276.1, -1.0 * (HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L4-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth));
- private final Hep3Vector vee_pos_module4_support_plate_top_local = new BasicHep3Vector(95.0, 276.1, -1.0 * (HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L4-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth));
- private final Hep3Vector flat_pos_module4_support_plate_top_local = new BasicHep3Vector(60.0, 270.1, -1.0 * (HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L4-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth));
- private final Hep3Vector ball_pos_module5_support_plate_top_local = new BasicHep3Vector(25.0, 76.1, -1.0 * (HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L5-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth));
- private final Hep3Vector vee_pos_module5_support_plate_top_local = new BasicHep3Vector(95.0, 76.1, -1.0 * (HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L5-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth));
- private final Hep3Vector flat_pos_module5_support_plate_top_local = new BasicHep3Vector(60.0, 70.1, -1.0 * (HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L5-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth));
+
- //half-module references
- // The half-module is only approximated with boxes here so be careful
- 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;
- //TODO Check these numbers
- private final double cf_length = 200.;
- private final double cf_width = 45.;
- private final double cf_thickness = 0.250;
- private final double kapton_length = 184.0;
- private final double kapton_width = 40.0;
- private final double kapton_thickness = 0.050;
- private final double half_module_thickness = this.hybrid_thickness + this.cf_thickness + this.kapton_thickness;
- private final double half_module_length = this.cf_length;
- private final double half_module_width = 6.83 + this.sensor_width;
-
-
public HPSTestRunTracker2014(Element node) throws JDOMException
{
super(node);
tracking = new HPSTestRunTracker2014GeomDef.TrackingBase("trackingVolume",null);
base = new HPSTestRunTracker2014GeomDef.Base("base",tracking);
basePlate = new HPSTestRunTracker2014GeomDef.BasePlate("baseplate",base);
- //cSupportBottom = new HPSTestRunTracker2014GeomDef.CSupportBottom("c_support_bottom", base);
- supportBottom = new HPSTestRunTracker2014GeomDef.SupportBottom("support_bottom", base);
+ cSupport = new HPSTestRunTracker2014GeomDef.CSupport("c_support", base);
+ supportBottom = new HPSTestRunTracker2014GeomDef.SupportBottom("support_bottom", base,cSupport);
supportPlateBottom = new HPSTestRunTracker2014GeomDef.SupportPlateBottom("support_plate_bottom", supportBottom);
- supportTop = new HPSTestRunTracker2014GeomDef.SupportTop("support_top", base);
+ supportTop = new HPSTestRunTracker2014GeomDef.SupportTop("support_top", base, cSupport);
supportPlateTop= new HPSTestRunTracker2014GeomDef.SupportPlateTop("support_plate_top", supportTop);
+ modules = new ArrayList<HPSTestRunTracker2014GeomDef.TestRunModule>();
+
}
@@ -829,108 +782,10 @@
String layerName = String.format("L%d%s", ilayer,half=="bottom"?"b":"t");
print(layerName);
-
- Hep3Vector ball_pos_mod_local = null;
- Hep3Vector vee_pos_mod_local = null;
- Hep3Vector flat_pos_mod_local = null;
- if(ilayer == 1) {
- if(half == "bottom") {
- ball_pos_mod_local = ball_pos_module1_support_plate_bottom_local;
- vee_pos_mod_local = vee_pos_module1_support_plate_bottom_local;
- flat_pos_mod_local = flat_pos_module1_support_plate_bottom_local;
- } else {
- ball_pos_mod_local = ball_pos_module1_support_plate_top_local;
- vee_pos_mod_local = vee_pos_module1_support_plate_top_local;
- flat_pos_mod_local = flat_pos_module1_support_plate_top_local;
- }
- }
- else if (ilayer == 2) {
- if(half == "bottom") {
- ball_pos_mod_local = ball_pos_module2_support_plate_bottom_local;
- vee_pos_mod_local = vee_pos_module2_support_plate_bottom_local;
- flat_pos_mod_local = flat_pos_module2_support_plate_bottom_local;
- } else {
- ball_pos_mod_local = ball_pos_module2_support_plate_top_local;
- vee_pos_mod_local = vee_pos_module2_support_plate_top_local;
- flat_pos_mod_local = flat_pos_module2_support_plate_top_local;
- }
- }
- else if (ilayer == 3) {
- if(half == "bottom") {
- ball_pos_mod_local = ball_pos_module3_support_plate_bottom_local;
- vee_pos_mod_local = vee_pos_module3_support_plate_bottom_local;
- flat_pos_mod_local = flat_pos_module3_support_plate_bottom_local;
- } else {
- ball_pos_mod_local = ball_pos_module3_support_plate_top_local;
- vee_pos_mod_local = vee_pos_module3_support_plate_top_local;
- flat_pos_mod_local = flat_pos_module3_support_plate_top_local;
- }
- }
- else if (ilayer == 4) {
- if(half == "bottom") {
- ball_pos_mod_local = ball_pos_module4_support_plate_bottom_local;
- vee_pos_mod_local = vee_pos_module4_support_plate_bottom_local;
- flat_pos_mod_local = flat_pos_module4_support_plate_bottom_local;
- } else {
- ball_pos_mod_local = ball_pos_module4_support_plate_top_local;
- vee_pos_mod_local = vee_pos_module4_support_plate_top_local;
- flat_pos_mod_local = flat_pos_module4_support_plate_top_local;
- }
- } else if (ilayer == 5) {
- if(half == "bottom") {
- ball_pos_mod_local = ball_pos_module5_support_plate_bottom_local;
- vee_pos_mod_local = vee_pos_module5_support_plate_bottom_local;
- flat_pos_mod_local = flat_pos_module5_support_plate_bottom_local;
- } else {
- ball_pos_mod_local = ball_pos_module5_support_plate_top_local;
- vee_pos_mod_local = vee_pos_module5_support_plate_top_local;
- flat_pos_mod_local = flat_pos_module5_support_plate_top_local;
- }
- } else {
- print("Not more than 5 layers!");
- System.exit(1);
- }
-
- 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()));
- }
-
-
- //
- // Note that the mother volume is the support wrap box which can be different than support plate coord system.
- // Thus I need to take that into account when making the modules
- // create the coordinate system of the support plate in the support box
- //HPSTestRunTracker2014GeomDef.Coord support_plate_coord = new HPSTestRunTracker2014GeomDef.Coord(ball_pos_support_plate, vee_pos_support_plate, flat_pos_support_plate);
- //Transform3D trans_support_plate_to_support = getTransformation(support_plate_coord);
- //HPSTestRunTracker2014GeomDef.Coord support_plate_coord = new HPSTestRunTracker2014GeomDef.Coord(ball_pos_support_plate, vee_pos_support_plate, flat_pos_support_plate);
- Transform3D trans_support_plate_to_support;
- if(half == "bottom") {
- trans_support_plate_to_support = supportBottom.getCoord().getTransformation();
- } else {
- trans_support_plate_to_support = supportTop.getCoord().getTransformation();
- }
-
- // transform module coordinates to support frame in case they are different
- 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);
makeModule(half,layerName,supportVolume,lcdd, sens);
+
} // ilayer
@@ -949,7 +804,7 @@
-
+ /*
private void makeSupport(String half, VolWrapper baseWrap,
Hep3Vector ball_pos_csup, Hep3Vector vee_pos_csup, Hep3Vector flat_pos_csup,
@@ -1219,15 +1074,12 @@
supportVolume.setVisAttributes(lcdd.getVisAttributes("SupportVolumeVis"));
lcdd.add(supportVolume);
-
-
-
-
-
}
+ */
+
private void makeSupportPlate(String half, Volume motherVolume, LCDD lcdd, SensitiveDetector sens) throws JDOMException {
@@ -1414,100 +1266,76 @@
- private void makeModule(String half,String name, Volume motherVolume, LCDD lcdd, SensitiveDetector sens) throws JDOMException
+ private void makeModule(String half, String name, Volume motherVolume, LCDD lcdd, SensitiveDetector sens) throws JDOMException
{
- print(String.format("----- makeModule() " + name + " " + half + " ------"));
+ print(String.format("----- makeModule " + name + " " + half + " ------"));
// build the module name
String volName = "module_" + name;
// find the module layer
- int layer = this.getLayerFromVolumeName(volName);
+ int layer = getLayerFromVolumeName(volName);
- // find the mother
+ boolean isL13 = ( layer >=1 && layer <=3 ) ? true : false;
+
+ // find the mother and reference geom
final HPSTestRunTracker2014GeomDef.BaseGeom mother;
+ // reference is a intermediate geom object that are referenced but not it's direct mother
+ final HPSTestRunTracker2014GeomDef.BaseGeom ref;
if(half == "bottom") {
mother = supportBottom;
+ ref = supportPlateBottom;
} else {
- mother = supportTop;
+ mother= supportTop;
+ ref = supportPlateTop;
}
//Create the module
- HPSTestRunTracker2014GeomDef.Module module = new HPSTestRunTracker2014GeomDef.Module(volName, mother, layer, half);
- Hep3Vector ball_pos_mod = module.getBallPos();
- Hep3Vector vee_pos_mod = module.getVeePos();
- Hep3Vector flat_pos_mod = module.getFlatPos();
-
-
- // Create the box
- double coldblock_thickness = -99999.9;
- double dist_lower_sensor_edge_to_cold_block_mounting_surface = -99999.9;
- double module_box_length = -99999.9;
- double module_box_height = -99999.9;
- double module_box_width = -99999.9;
- if( layer >=1 && layer <=3 ) {
- module_box_length = HPSTestRunTracker2014GeomDef.Module.module_box_L13_length;
- module_box_height = HPSTestRunTracker2014GeomDef.Module.module_box_L13_height;
- module_box_width = HPSTestRunTracker2014GeomDef.Module.module_box_L13_width;
- coldblock_thickness = HPSTestRunTracker2014GeomDef.Module.coldblock_L13_thickness;
- dist_lower_sensor_edge_to_cold_block_mounting_surface = 12.66;
-
+ HPSTestRunTracker2014GeomDef.TestRunModule module;
+ if(isL13) {
+ module = new HPSTestRunTracker2014GeomDef.TestRunModuleL13(volName, mother, ref, layer, half);
} else {
- module_box_length = HPSTestRunTracker2014GeomDef.Module.module_box_L45_length;
- module_box_height = HPSTestRunTracker2014GeomDef.Module.module_box_L45_height;
- module_box_width = HPSTestRunTracker2014GeomDef.Module.module_box_L45_width;
- coldblock_thickness = HPSTestRunTracker2014GeomDef.Module.coldblock_L45_thickness;
- dist_lower_sensor_edge_to_cold_block_mounting_surface = 7.662;
+ module = new HPSTestRunTracker2014GeomDef.TestRunModuleL45(volName, mother, ref, layer, half);
}
-
- //box_dim_local = new BasicHep3Vector(module_box_length,module_box_height,module_box_thickness);
+ // add it to list of module
+ modules.add(module);
- Box box = new Box(volName + "_box", module_box_length, module_box_height, module_box_width);
+ Box box = new Box(volName + "_box", module.getBoxDim().x(), module.getBoxDim().y(), module.getBoxDim().z());
lcdd.add(box);
Volume moduleVolume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
-
- // create the coordinate system
- HPSTestRunTracker2014GeomDef.Coord module_coord = new HPSTestRunTracker2014GeomDef.Coord(ball_pos_mod, vee_pos_mod, flat_pos_mod);
- Transform3D trans_module_to_support = getTransformation(module_coord);
-
if(_debug) {
- print(String.format("ball_pos_mod %s", ball_pos_mod.toString()));
- print(String.format("ball_pos_mod %s", ball_pos_mod.toString()));
- print(String.format("ball_pos_mod %s", ball_pos_mod.toString()));
+ print(String.format("module.getBallPos() %s", module.getBallPos().toString()));
+ print(String.format("module.getVeePos() %s", module.getVeePos().toString()));
+ print(String.format("module.getFlatPos() %s", module.getFlatPos().toString()));
print(String.format("module_coord:\n%s", module.getCoord().toString()));
-// Hep3Vector ball_pos_mod_tmp1 = transformToMotherCoord(ball_pos_mod, supportWrap, "support_bottom");
-// if(ball_pos_mod_tmp1==null) {
-// ball_pos_mod_tmp1 = transformToMotherCoord(ball_pos_mod, supportWrap, "support_top");
-// }
-// print(String.format("ball_pos_mod tracking %s", ball_pos_mod_tmp1.toString()));
}
// Find distance to center in the local coordinate system
- Hep3Vector box_center_local = new BasicHep3Vector(module_box_length/2.0-5.0, 0.0, module_box_width/2.0);
+ Hep3Vector box_center_local = module.getCenter();
//translate to the mother coordinate system
- Hep3Vector box_center_support = trans_module_to_support.transformed(box_center_local);
+ Hep3Vector box_center_support = module.getCoord().getTransformation().transformed(box_center_local);
// find the position of the center in the mother coord
Hep3Vector box_center = VecOp.sub(box_center_support, mother.getCenter());
if(_debug) {
print(String.format("box_center_local %s", box_center_local.toString()));
- print(String.format("box_center_support %s", box_center_support.toString()));
- print(String.format("mother center %s", mother.getCenter().toString()));
- print(String.format("box_center %s", box_center.toString()));
+ print(String.format("box_center_support %s", box_center_support.toString()));
+ print(String.format("mother center %s", mother.getCenter().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 = this.getEulerAngles(module_coord.u(), module_coord.v(), new BasicHep3Vector(1,0,0), new BasicHep3Vector(0,1,0));
+ Hep3Vector lcdd_rot_angles = this.getEulerAngles(module.getCoord().u(), module.getCoord().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);
@@ -1515,163 +1343,18 @@
PhysVol physVolume = new PhysVol(moduleVolume, motherVolume, pos, rot);
+
-
-
-
- // 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 coordinate system 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.
-
- // Hints:
- // The local half-module coord system for axial sensor will be built
- // with apv25 chips in more negative v-direction than sensor
- // i.e. v-direction is pointing upstream
- // For the stereo it is
- //
-
- // Distance from sensor to CF edge: 180mm
- // Distance from CF edge to screw hole: 30mm
- // Distance from screw hole to edge of cold block: 33.75mm
- // Distance from edge of cold block to hole/ball position: 5mm
- final double dist_sensor_center_to_coldblock_hole_vdir = (180.0 - 30.0 + (33.75 - 5.0)) - sensor_length/2.0;
- final double ball_pos_halfmod_axial_local_x = dist_sensor_center_to_coldblock_hole_vdir;
- final double ball_pos_halfmod_axial_local_y = -1.0* (coldblock_thickness/2.0 + this.cf_thickness + this.kapton_thickness + this.sensor_thickness/2.0);
- final double ball_pos_halfmod_axial_local_z = dist_lower_sensor_edge_to_cold_block_mounting_surface + sensor_width/2.0;
- 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);
-
-
- if(_debug) {
- print(String.format("ball_pos_halfmod_axial_local %s", ball_pos_halfmod_axial_local.toString()));
- print(String.format("vee_pos_halfmod_axial_local %s", vee_pos_halfmod_axial_local.toString()));
- print(String.format("flat_pos_halfmod_axial_local %s", flat_pos_halfmod_axial_local.toString()));
- }
-
//makeHalfModule("axial",moduleWrap, ball_pos_halfmod_axial_local, vee_pos_halfmod_axial_local, flat_pos_halfmod_axial_local,lcdd,sens);
+ makeHalfModule("axial", volName ,moduleVolume, lcdd,sens);
-
- // cold block position w.r.t. module box coordinate system
- // this is a dummy coordinate system, make it simple
- // edge of cold block on the mounting surface
-
- final double ball_pos_coldblock_local_x = -5.00;
- final double ball_pos_coldblock_local_y = 0.00;
- final double ball_pos_coldblock_local_z = 0.00;
- final double vee_pos_coldblock_local_x = ball_pos_coldblock_local_x + 1.0; //arbitrary distance
- final double vee_pos_coldblock_local_y = ball_pos_coldblock_local_y;
- final double vee_pos_coldblock_local_z = ball_pos_coldblock_local_z;
- final double flat_pos_coldblock_local_x = ball_pos_coldblock_local_x;
- final double flat_pos_coldblock_local_y = ball_pos_coldblock_local_y + 1.0; //arbitrary distance
- final double flat_pos_coldblock_local_z = ball_pos_coldblock_local_z;
-
-
- Hep3Vector ball_pos_coldblock_local = new BasicHep3Vector(ball_pos_coldblock_local_x, ball_pos_coldblock_local_y, ball_pos_coldblock_local_z);
- Hep3Vector vee_pos_coldblock_local = new BasicHep3Vector(vee_pos_coldblock_local_x, vee_pos_coldblock_local_y,vee_pos_coldblock_local_z);
- Hep3Vector flat_pos_coldblock_local = new BasicHep3Vector(flat_pos_coldblock_local_x, flat_pos_coldblock_local_y,flat_pos_coldblock_local_z);
-
-
- if(_debug) {
- print(String.format("ball_pos_coldblock_local %s", ball_pos_coldblock_local.toString()));
- print(String.format("vee_pos_coldblock_local %s", vee_pos_coldblock_local.toString()));
- print(String.format("flat_pos_coldblock_local %s", flat_pos_coldblock_local.toString()));
- }
-
+
//makeColdBlock(moduleWrap, ball_pos_coldblock_local, vee_pos_coldblock_local, flat_pos_coldblock_local,lcdd,sens);
-
+ makeColdBlock(volName, moduleVolume, lcdd,sens);
-
- // stereo module
-
-
-
- final double ball_pos_halfmod_stereo_local_x = ball_pos_halfmod_axial_local_x;
- final double ball_pos_halfmod_stereo_local_y = -1.0 * ball_pos_halfmod_axial_local_y; // note minus sign to separate from axial
- final double ball_pos_halfmod_stereo_local_z = ball_pos_halfmod_axial_local_z;
- 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_x = ball_pos_halfmod_stereo_local_x + sensor_length/2.0*Math.cos(stereo_angle);
- 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 vee_pos_halfmod_stereo_local_z = ball_pos_halfmod_stereo_local_z + sensor_length/2.0*Math.sin(stereo_angle);
- 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()));
- }
-
- /*
- // determine stereo angle
- // note that the sign of the stereo angle in this rotation is based on an active rotation, a convention different from lcdd.
- // I first flip around local u
-
- double sinTheta = Math.sin(Math.PI/2.0);
- double cosTheta = Math.cos(Math.PI/2.0);
- Hep3Matrix mat1 = new BasicHep3Matrix(1,0,0,0,cosTheta,-sinTheta,0,sinTheta,cosTheta);
- Rotation3D rot1 = new Rotation3D(mat1);
-
- // and then do a clockwise rotation (negative) of the stereo angle around local v
- double stereo_angle;
- if(layer<4) {
- stereo_angle = -0.1;
- } else {
- stereo_angle = -0.05;
- }
-
- sinTheta = Math.sin(stereo_angle);
- cosTheta = Math.cos(stereo_angle);
-
- Hep3Matrix mat2 = new BasicHep3Matrix(cosTheta,0,sinTheta,0,1,0,-sinTheta,0,cosTheta);
- Rotation3D rot2 = new Rotation3D(mat2);
-
- if(_debug) {
- print(String.format("flip for stereo half-module\nrot1:\n %s", rot1.toString()));
-
- }
-
- // apply to coordinate system to rotate into place
- rot1.rotate(ball_pos_halfmod_stereo_local);
- rot1.rotate(vee_pos_halfmod_stereo_local);
- rot1.rotate(flat_pos_halfmod_stereo_local);
-
-
- 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()));
- }
-
- print(String.format("stereo angle rotationfor stereo half-module\nrot2:\n %s", rot2.toString()));
-
- // apply to coordinate system to rotate into place
- rot2.rotate(ball_pos_halfmod_stereo_local);
- rot2.rotate(vee_pos_halfmod_stereo_local);
- rot2.rotate(flat_pos_halfmod_stereo_local);
-
- 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);
+ makeHalfModule("stereo", volName ,moduleVolume, lcdd,sens);
moduleVolume.setVisAttributes(lcdd.getVisAttributes("ModuleVis"));
@@ -1685,7 +1368,7 @@
-
+ /*
private void makeModule(String name, VolWrapper supportWrap,
@@ -1710,17 +1393,17 @@
double module_box_height = -99999.9;
double module_box_width = -99999.9;
if( layer >=1 && layer <=3 ) {
- module_box_length = HPSTestRunTracker2014GeomDef.Module.module_box_L13_length;
- module_box_height = HPSTestRunTracker2014GeomDef.Module.module_box_L13_height;
- module_box_width = HPSTestRunTracker2014GeomDef.Module.module_box_L13_width;
- coldblock_thickness = HPSTestRunTracker2014GeomDef.Module.coldblock_L13_thickness;
+ module_box_length = HPSTestRunTracker2014GeomDef.TestRunModuleL13.module_box_L13_length;
+ module_box_height = HPSTestRunTracker2014GeomDef.TestRunModuleL13.module_box_L13_height;
+ module_box_width = HPSTestRunTracker2014GeomDef.TestRunModuleL13.module_box_L13_width;
+ coldblock_thickness = TestRunColdBlockL13.coldblock_L13_thickness;
dist_lower_sensor_edge_to_cold_block_mounting_surface = 12.66;
} else {
- module_box_length = HPSTestRunTracker2014GeomDef.Module.module_box_L45_length;
- module_box_height = HPSTestRunTracker2014GeomDef.Module.module_box_L45_height;
- module_box_width = HPSTestRunTracker2014GeomDef.Module.module_box_L45_width;
- coldblock_thickness = HPSTestRunTracker2014GeomDef.Module.coldblock_L45_thickness;
+ module_box_length = HPSTestRunTracker2014GeomDef.TestRunModuleL45.module_box_L45_length;
+ module_box_height = HPSTestRunTracker2014GeomDef.TestRunModuleL45.module_box_L45_height;
+ module_box_width = HPSTestRunTracker2014GeomDef.TestRunModuleL45.module_box_L45_width;
+ coldblock_thickness = TestRunColdBlockL45.coldblock_L45_thickness;
dist_lower_sensor_edge_to_cold_block_mounting_surface = 7.662;
}
@@ -1806,15 +1489,15 @@
// Distance from CF edge to screw hole: 30mm
// Distance from screw hole to edge of cold block: 33.75mm
// Distance from edge of cold block to hole/ball position: 5mm
- final double dist_sensor_center_to_coldblock_hole_vdir = (180.0 - 30.0 + (33.75 - 5.0)) - sensor_length/2.0;
+ final double dist_sensor_center_to_coldblock_hole_vdir = (180.0 - 30.0 + (33.75 - 5.0)) - HPSTestRunTracker2014GeomDef.Sensor.getSensorLength()/2.0;
final double ball_pos_halfmod_axial_local_x = dist_sensor_center_to_coldblock_hole_vdir;
- final double ball_pos_halfmod_axial_local_y = -1.0* (coldblock_thickness/2.0 + this.cf_thickness + this.kapton_thickness + this.sensor_thickness/2.0);
- final double ball_pos_halfmod_axial_local_z = dist_lower_sensor_edge_to_cold_block_mounting_surface + sensor_width/2.0;
- final double vee_pos_halfmod_axial_local_x = ball_pos_halfmod_axial_local_x + sensor_length/2.0;
+ final double ball_pos_halfmod_axial_local_y = -1.0* (coldblock_thickness/2.0 + HPSTestRunTracker2014GeomDef.TestRunHalfModule.getCFThickness() + HPSTestRunTracker2014GeomDef.TestRunHalfModule.getKaptonThickness() + HPSTestRunTracker2014GeomDef.Sensor.getSensorThickness()/2.0);
+ final double ball_pos_halfmod_axial_local_z = dist_lower_sensor_edge_to_cold_block_mounting_surface + HPSTestRunTracker2014GeomDef.Sensor.getSensorWidth()/2.0;
+ final double vee_pos_halfmod_axial_local_x = ball_pos_halfmod_axial_local_x + HPSTestRunTracker2014GeomDef.Sensor.getSensorLength()/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_y = ball_pos_halfmod_axial_local_y + HPSTestRunTracker2014GeomDef.Sensor.getSensorThickness()/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);
@@ -1827,7 +1510,7 @@
print(String.format("flat_pos_halfmod_axial_local %s", flat_pos_halfmod_axial_local.toString()));
}
- makeHalfModule("axial",moduleWrap, ball_pos_halfmod_axial_local, vee_pos_halfmod_axial_local, flat_pos_halfmod_axial_local,lcdd,sens);
+ //makeHalfModule("axial",moduleWrap, ball_pos_halfmod_axial_local, vee_pos_halfmod_axial_local, flat_pos_halfmod_axial_local,lcdd,sens);
@@ -1868,13 +1551,13 @@
final double ball_pos_halfmod_stereo_local_x = ball_pos_halfmod_axial_local_x;
final double ball_pos_halfmod_stereo_local_y = -1.0 * ball_pos_halfmod_axial_local_y; // note minus sign to separate from axial
final double ball_pos_halfmod_stereo_local_z = ball_pos_halfmod_axial_local_z;
- 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_x = ball_pos_halfmod_stereo_local_x + sensor_length/2.0*Math.cos(stereo_angle);
+ final double vee_pos_halfmod_stereo_local_x = ball_pos_halfmod_stereo_local_x + HPSTestRunTracker2014GeomDef.Sensor.getSensorLength()/2.0;
+ //final double vee_pos_halfmod_stereo_local_x = ball_pos_halfmod_stereo_local_x + HPSTestRunTracker2014GeomDef.Sensor.getSensorLength()/2.0*Math.cos(stereo_angle);
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 vee_pos_halfmod_stereo_local_z = ball_pos_halfmod_stereo_local_z + sensor_length/2.0*Math.sin(stereo_angle);
+ //final double vee_pos_halfmod_stereo_local_z = ball_pos_halfmod_stereo_local_z + HPSTestRunTracker2014GeomDef.Sensor.getSensorLength()/2.0*Math.sin(stereo_angle);
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_y = ball_pos_halfmod_stereo_local_y + HPSTestRunTracker2014GeomDef.Sensor.getSensorThickness()/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);
@@ -1887,79 +1570,247 @@
print(String.format("flat_pos_halfmod_stereo_local %s", flat_pos_halfmod_stereo_local.toString()));
}
- /*
- // determine stereo angle
- // note that the sign of the stereo angle in this rotation is based on an active rotation, a convention different from lcdd.
- // I first flip around local u
+
+// // determine stereo angle
+// // note that the sign of the stereo angle in this rotation is based on an active rotation, a convention different from lcdd.
+// // I first flip around local u
+//
+// double sinTheta = Math.sin(Math.PI/2.0);
+// double cosTheta = Math.cos(Math.PI/2.0);
+// Hep3Matrix mat1 = new BasicHep3Matrix(1,0,0,0,cosTheta,-sinTheta,0,sinTheta,cosTheta);
+// Rotation3D rot1 = new Rotation3D(mat1);
+//
+// // and then do a clockwise rotation (negative) of the stereo angle around local v
+// double stereo_angle;
+// if(layer<4) {
+// stereo_angle = -0.1;
+// } else {
+// stereo_angle = -0.05;
+// }
+//
+// sinTheta = Math.sin(stereo_angle);
+// cosTheta = Math.cos(stereo_angle);
+//
+// Hep3Matrix mat2 = new BasicHep3Matrix(cosTheta,0,sinTheta,0,1,0,-sinTheta,0,cosTheta);
+// Rotation3D rot2 = new Rotation3D(mat2);
+//
+// if(_debug) {
+// print(String.format("flip for stereo half-module\nrot1:\n %s", rot1.toString()));
+//
+// }
+//
+// // apply to coordinate system to rotate into place
+// rot1.rotate(ball_pos_halfmod_stereo_local);
+// rot1.rotate(vee_pos_halfmod_stereo_local);
+// rot1.rotate(flat_pos_halfmod_stereo_local);
+//
+//
+// 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()));
+// }
+//
+// print(String.format("stereo angle rotationfor stereo half-module\nrot2:\n %s", rot2.toString()));
+//
+// // apply to coordinate system to rotate into place
+// rot2.rotate(ball_pos_halfmod_stereo_local);
+// rot2.rotate(vee_pos_halfmod_stereo_local);
+// rot2.rotate(flat_pos_halfmod_stereo_local);
+//
+// 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);
- double sinTheta = Math.sin(Math.PI/2.0);
- double cosTheta = Math.cos(Math.PI/2.0);
- Hep3Matrix mat1 = new BasicHep3Matrix(1,0,0,0,cosTheta,-sinTheta,0,sinTheta,cosTheta);
- Rotation3D rot1 = new Rotation3D(mat1);
+
+ moduleVolume.setVisAttributes(lcdd.getVisAttributes("ModuleVis"));
+
+ lcdd.add(moduleVolume);
- // and then do a clockwise rotation (negative) of the stereo angle around local v
- double stereo_angle;
- if(layer<4) {
- stereo_angle = -0.1;
+
+ }
+
+ */
+
+
+ private HPSTestRunTracker2014GeomDef.BaseGeom findModule(String moduleName) {
+ for(HPSTestRunTracker2014GeomDef.TestRunModule m : modules) {
+ if(m.getName().equals(moduleName)) return m;
+ }
+ return null;
+ }
+
+
+
+
+
+
+
+ private void makeHalfModule(String side, String moduleName, Volume motherVolume, LCDD lcdd, SensitiveDetector sens) throws JDOMException {
+
+ if(_debug) {
+ print("--- makeHalfModule " + side + " for module " + moduleName);
+ }
+
+
+ String volName = moduleName + "_halfmodule_" + side;
+
+ // top or bottom?
+ String half = this.getHalfFromName(moduleName);
+
+ // find layer
+ int layer = this.getLayerFromVolumeName(moduleName);
+
+ // find the mother
+ HPSTestRunTracker2014GeomDef.BaseGeom mother = findModule(moduleName);
+
+ if(mother==null) {
+ throw new RuntimeException("Couldn't find mother " + moduleName + " to " + volName);
+ }
+
+ // Build the half-module
+ HPSTestRunTracker2014GeomDef.TestRunHalfModule halfModule;
+ if(side == "axial") {
+ halfModule = new HPSTestRunTracker2014GeomDef.TestRunHalfModuleAxial(volName, mother, layer, half);
+ } else if(side == "stereo") {
+ halfModule = new HPSTestRunTracker2014GeomDef.TestRunHalfModuleStereo(volName, mother, layer, half);
} else {
- stereo_angle = -0.05;
+ throw new IllegalArgumentException("not a valid half-module side " + side);
}
+
+ Box box = new Box(volName + "Box", halfModule.getBoxDim().x(), halfModule.getBoxDim().y(), halfModule.getBoxDim().z());
+ lcdd.add(box);
+ Volume halfModuleVolume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
- sinTheta = Math.sin(stereo_angle);
- cosTheta = Math.cos(stereo_angle);
-
- Hep3Matrix mat2 = new BasicHep3Matrix(cosTheta,0,sinTheta,0,1,0,-sinTheta,0,cosTheta);
- Rotation3D rot2 = new Rotation3D(mat2);
-
+
if(_debug) {
- print(String.format("flip for stereo half-module\nrot1:\n %s", rot1.toString()));
+ print(String.format("half_module_coord:\n%s", halfModule.getCoord().toString()));
+ }
- }
+ Hep3Vector box_center_local = halfModule.getCenter();
- // apply to coordinate system to rotate into place
- rot1.rotate(ball_pos_halfmod_stereo_local);
- rot1.rotate(vee_pos_halfmod_stereo_local);
- rot1.rotate(flat_pos_halfmod_stereo_local);
+ //translate to the mother coordinate system
+ Hep3Vector box_center_module_coord = halfModule.getCoord().getTransformation().transformed(box_center_local);
+ //Find LCDD rotation angles
+ // Since we want to keep the local coordinate system the same for both axial and stereo
+ // sensors we rotate the half-modules in place "by-hand" and not only from system unit vectors
- 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()));
+ Hep3Vector lcdd_rot_angles = this.getEulerAngles(halfModule.getCoord().u(), halfModule.getCoord().v(), new BasicHep3Vector(1,0,0), new BasicHep3Vector(0,1,0));
+
+ if(side.equals("stereo")) {
+ double stereo_angle;
+ if(layer<4) {
+ stereo_angle = -0.1;
+ } else {
+ stereo_angle = -0.05;
+ }
+
+ org.apache.commons.math3.geometry.euclidean.threed.Rotation rot_stereo = new org.apache.commons.math3.geometry.euclidean.threed.Rotation(org.apache.commons.math3.geometry.euclidean.threed.RotationOrder.XYZ, Math.PI, stereo_angle,0);
+ double res[] = rot_stereo.getAngles(org.apache.commons.math3.geometry.euclidean.threed.RotationOrder.XYZ);
+ Hep3Vector lcdd_rot_angles_2 = new BasicHep3Vector(res);
+
+ if(_debug) {
+ print(String.format("lcdd_rot_angles %s", lcdd_rot_angles.toString()));
+ print(String.format("lcdd_rot_angles_2 %s", lcdd_rot_angles_2.toString()));
+ }
+
+ lcdd_rot_angles = lcdd_rot_angles_2;
}
-
- print(String.format("stereo angle rotationfor stereo half-module\nrot2:\n %s", rot2.toString()));
+
+ // Find the displacement of the box center due to rotation about different origin
+ Hep3Vector box_center_module_coord_rot = getRotationDisplacement(halfModule.getCoord().origin(), box_center_module_coord, lcdd_rot_angles);
+
+ // find the position of the center in the mother coord
+ Hep3Vector box_center = VecOp.sub(box_center_module_coord_rot, mother.getCenter());
- // apply to coordinate system to rotate into place
- rot2.rotate(ball_pos_halfmod_stereo_local);
- rot2.rotate(vee_pos_halfmod_stereo_local);
- rot2.rotate(flat_pos_halfmod_stereo_local);
-
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()));
+ print(String.format("box_center_local %s", box_center_local.toString()));
+ print(String.format("box_center_module_coord %s", box_center_module_coord.toString()));
+ print(String.format("box_center_module_coord_rot %s", box_center_module_coord_rot.toString()));
+ print(String.format("mother center %s", mother.getCenter().toString()));
+ print(String.format("box_center %s", box_center.toString()));
}
- */
- makeHalfModule("stereo",moduleWrap, ball_pos_halfmod_stereo_local, vee_pos_halfmod_stereo_local, flat_pos_halfmod_stereo_local,lcdd,sens);
+ // Create the LCDD position
+ Position pos = new Position(volName + "_position",box_center.x(), box_center.y(), box_center.z());
+ // Create the LCDD rotation
+ 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(halfModuleVolume, motherVolume, pos, rot);
- moduleVolume.setVisAttributes(lcdd.getVisAttributes("ModuleVis"));
- lcdd.add(moduleVolume);
+
+
+
+ // create the half module components
+
+ makeHalfModuleComponentSensor(halfModule, halfModuleVolume, lcdd, sens);
+ makeHalfModuleComponentKapton(halfModule,halfModuleVolume, lcdd, sens);
- }
+
+ /*
+
+
+
+
+
+ final double ball_pos_cf_local_x = -1 * (180.0 - HPSTestRunTracker2014GeomDef.Sensor.getSensorLength()/2.0);
+ final double ball_pos_cf_local_y = (HPSTestRunTracker2014GeomDef.Sensor.getSensorThickness()/2.0 + HPSTestRunTracker2014GeomDef.TestRunHalfModule.getKaptonThickness() + HPSTestRunTracker2014GeomDef.TestRunHalfModule.getCFThickness()/2.0);
+ final double ball_pos_cf_local_z = -1 * (HPSTestRunTracker2014GeomDef.Sensor.getSensorWidth()/2.0 + 12.66) + 8.83 - 3.00;
+ final double vee_pos_cf_local_x = ball_pos_cf_local_x + 1.0; // arbitrary distance
+ final double vee_pos_cf_local_y = ball_pos_cf_local_y;
+ final double vee_pos_cf_local_z = ball_pos_cf_local_z;
+ final double flat_pos_cf_local_x = ball_pos_cf_local_x;
+ final double flat_pos_cf_local_y = ball_pos_cf_local_y + HPSTestRunTracker2014GeomDef.TestRunHalfModule.getCFThickness()/2.0; // arbitrary distance
+ final double flat_pos_cf_local_z = ball_pos_cf_local_z;
+
+ Hep3Vector ball_pos_cf_local = new BasicHep3Vector(ball_pos_cf_local_x,ball_pos_cf_local_y,ball_pos_cf_local_z);
+ Hep3Vector vee_pos_cf_local = new BasicHep3Vector(vee_pos_cf_local_x,vee_pos_cf_local_y,vee_pos_cf_local_z);
+ Hep3Vector flat_pos_cf_local = new BasicHep3Vector(flat_pos_cf_local_x,flat_pos_cf_local_y,flat_pos_cf_local_z);
+
+ makeHalfModuleComponentCF(halfModuleWrap,ball_pos_cf_local,vee_pos_cf_local,flat_pos_cf_local, lcdd, sens);
+
+
+
+
+ final double ball_pos_hybrid_local_x = -1 * (170.0 - HPSTestRunTracker2014GeomDef.Sensor.getSensorLength()/2.0);
+ final double ball_pos_hybrid_local_y = (HPSTestRunTracker2014GeomDef.Sensor.getSensorThickness()/2.0 - HPSTestRunTracker2014GeomDef.TestRunHalfModule.getHybridThickness()/2.0);
+ final double ball_pos_hybrid_local_z = -1 * (HPSTestRunTracker2014GeomDef.Sensor.getSensorWidth()/2.0);
+ final double vee_pos_hybrid_local_x = ball_pos_hybrid_local_x + 1.0; // arbitrary distance
+ final double vee_pos_hybrid_local_y = ball_pos_hybrid_local_y;
+ final double vee_pos_hybrid_local_z = ball_pos_hybrid_local_z;
+ final double flat_pos_hybrid_local_x = ball_pos_hybrid_local_x;
+ final double flat_pos_hybrid_local_y = ball_pos_hybrid_local_y + HPSTestRunTracker2014GeomDef.TestRunHalfModule.getHybridThickness()/2.0; // arbitrary distance
+ final double flat_pos_hybrid_local_z = ball_pos_hybrid_local_z;
+
+ Hep3Vector ball_pos_hybrid_local = new BasicHep3Vector(ball_pos_hybrid_local_x,ball_pos_hybrid_local_y,ball_pos_hybrid_local_z);
+ Hep3Vector vee_pos_hybrid_local = new BasicHep3Vector(vee_pos_hybrid_local_x,vee_pos_hybrid_local_y,vee_pos_hybrid_local_z);
+ Hep3Vector flat_pos_hybrid_local = new BasicHep3Vector(flat_pos_hybrid_local_x,flat_pos_hybrid_local_y,flat_pos_hybrid_local_z);
+
+ makeHalfModuleComponentHybrid(halfModuleWrap,ball_pos_hybrid_local,vee_pos_hybrid_local,flat_pos_hybrid_local, lcdd, sens);
+
+ */
+
+
+ //set vis stuff
+ halfModuleVolume.setVisAttributes(lcdd.getVisAttributes("HalfModuleVis"));
+
+ lcdd.add(halfModuleVolume);
+
+
+ }
-
-
-
-
-
-
-
+ /*
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 {
@@ -1973,7 +1824,7 @@
String volName = moduleWrap.name + "_halfmodule_" + side;
- Box box = new Box(volName + "Box", half_module_length, half_module_thickness, half_module_width);
+ Box box = new Box(volName + "Box", HPSTestRunTracker2014GeomDef.TestRunHalfModule.getLength(), HPSTestRunTracker2014GeomDef.TestRunHalfModule.getThickness(), HPSTestRunTracker2014GeomDef.TestRunHalfModule.getWidth());
lcdd.add(box);
Volume halfModuleVolume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
@@ -1997,9 +1848,9 @@
// Note that this can be different between axial and stereo since the survey positions determine the local coordinate
// system now.
// I'm not sure this feels good but this has to be done somewhere
- double box_center_local_x = this.half_module_length/2.0 - ( (170.00 + 10.00) - this.sensor_length/2.0);
- double box_center_local_y = -1.0*this.half_module_thickness/2.0 + (cf_thickness + kapton_thickness + sensor_thickness/2.0);
- double box_center_local_z = this.half_module_width/2.0 - ( 12.66 - (8.83 -3.00) + this.sensor_width/2.0 );
+ double box_center_local_x = HPSTestRunTracker2014GeomDef.TestRunHalfModule.getLength()/2.0 - ( (170.00 + 10.00) - HPSTestRunTracker2014GeomDef.Sensor.getSensorLength()/2.0);
+ double box_center_local_y = -1.0*HPSTestRunTracker2014GeomDef.TestRunHalfModule.getThickness()/2.0 + (HPSTestRunTracker2014GeomDef.TestRunHalfModule.getCFThickness() + HPSTestRunTracker2014GeomDef.TestRunHalfModule.getKaptonThickness() + HPSTestRunTracker2014GeomDef.Sensor.getSensorThickness()/2.0);
+ double box_center_local_z = HPSTestRunTracker2014GeomDef.TestRunHalfModule.getWidth()/2.0 - ( 12.66 - (8.83 -3.00) + HPSTestRunTracker2014GeomDef.Sensor.getSensorWidth()/2.0 );
// stereo sensor is located at the same place but flipped pi around so v and w switches sign
//if(side.equalsIgnoreCase("stereo")) {
@@ -2083,20 +1934,20 @@
// create the half module components
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());
+ Hep3Vector vee_pos_sensor_local = new BasicHep3Vector(ball_pos_sensor_local.x() + HPSTestRunTracker2014GeomDef.Sensor.getSensorLength()/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() + HPSTestRunTracker2014GeomDef.Sensor.getSensorThickness()/2.0, ball_pos_sensor_local.z());
makeHalfModuleComponentSensor(halfModuleWrap,ball_pos_sensor_local,vee_pos_sensor_local,flat_pos_sensor_local, lcdd, sens);
- final double ball_pos_kapton_local_x = -1 * (180.0 - this.sensor_length/2.0) + 8.5;
- final double ball_pos_kapton_local_y = (this.sensor_thickness/2.0 + this.kapton_thickness/2.0);
- final double ball_pos_kapton_local_z = -1 * (this.sensor_width/2.0 + 12.66) + 8.83 - 3.00 + 6.00 ;
+ final double ball_pos_kapton_local_x = -1 * (180.0 - HPSTestRunTracker2014GeomDef.Sensor.getSensorLength()/2.0) + 8.5;
+ final double ball_pos_kapton_local_y = (HPSTestRunTracker2014GeomDef.Sensor.getSensorThickness()/2.0 + HPSTestRunTracker2014GeomDef.TestRunHalfModule.getKaptonThickness()/2.0);
+ final double ball_pos_kapton_local_z = -1 * (HPSTestRunTracker2014GeomDef.Sensor.getSensorWidth()/2.0 + 12.66) + 8.83 - 3.00 + 6.00 ;
final double vee_pos_kapton_local_x = ball_pos_kapton_local_x + 1.0; // arbitrary distance
final double vee_pos_kapton_local_y = ball_pos_kapton_local_y;
final double vee_pos_kapton_local_z = ball_pos_kapton_local_z;
final double flat_pos_kapton_local_x = ball_pos_kapton_local_x;
- final double flat_pos_kapton_local_y = ball_pos_kapton_local_y + this.kapton_thickness/2.0; // arbitrary distance
+ final double flat_pos_kapton_local_y = ball_pos_kapton_local_y + HPSTestRunTracker2014GeomDef.TestRunHalfModule.getKaptonThickness()/2.0; // arbitrary distance
final double flat_pos_kapton_local_z = ball_pos_kapton_local_z;
Hep3Vector ball_pos_kapton_local = new BasicHep3Vector(ball_pos_kapton_local_x,ball_pos_kapton_local_y,ball_pos_kapton_local_z);
@@ -2107,14 +1958,14 @@
- final double ball_pos_cf_local_x = -1 * (180.0 - this.sensor_length/2.0);
- final double ball_pos_cf_local_y = (this.sensor_thickness/2.0 + this.kapton_thickness + this.cf_thickness/2.0);
- final double ball_pos_cf_local_z = -1 * (this.sensor_width/2.0 + 12.66) + 8.83 - 3.00;
+ final double ball_pos_cf_local_x = -1 * (180.0 - HPSTestRunTracker2014GeomDef.Sensor.getSensorLength()/2.0);
+ final double ball_pos_cf_local_y = (HPSTestRunTracker2014GeomDef.Sensor.getSensorThickness()/2.0 + HPSTestRunTracker2014GeomDef.TestRunHalfModule.getKaptonThickness() + HPSTestRunTracker2014GeomDef.TestRunHalfModule.getCFThickness()/2.0);
+ final double ball_pos_cf_local_z = -1 * (HPSTestRunTracker2014GeomDef.Sensor.getSensorWidth()/2.0 + 12.66) + 8.83 - 3.00;
final double vee_pos_cf_local_x = ball_pos_cf_local_x + 1.0; // arbitrary distance
final double vee_pos_cf_local_y = ball_pos_cf_local_y;
final double vee_pos_cf_local_z = ball_pos_cf_local_z;
final double flat_pos_cf_local_x = ball_pos_cf_local_x;
- final double flat_pos_cf_local_y = ball_pos_cf_local_y + this.cf_thickness/2.0; // arbitrary distance
+ final double flat_pos_cf_local_y = ball_pos_cf_local_y + HPSTestRunTracker2014GeomDef.TestRunHalfModule.getCFThickness()/2.0; // arbitrary distance
final double flat_pos_cf_local_z = ball_pos_cf_local_z;
Hep3Vector ball_pos_cf_local = new BasicHep3Vector(ball_pos_cf_local_x,ball_pos_cf_local_y,ball_pos_cf_local_z);
@@ -2126,14 +1977,14 @@
[truncated at 1000 lines; 488 more skipped]
projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014GeomDef.java 2014-07-12 01:27:46 UTC (rev 3176)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014GeomDef.java 2014-07-14 00:55:24 UTC (rev 3177)
@@ -6,6 +6,7 @@
import org.lcsim.detector.Rotation3D;
import org.lcsim.detector.Transform3D;
import org.lcsim.detector.Translation3D;
+import org.lcsim.geometry.compact.converter.lcdd.util.Box;
import hep.physics.vec.BasicHep3Matrix;
import hep.physics.vec.BasicHep3Vector;
@@ -33,14 +34,19 @@
protected static class BaseGeom {
private String name;
private BaseGeom mother;
+ // If the survey positions are referenced to an intermediate coordinate system
+ // normally this is null.
+ private BaseGeom referenceGeom;
private Coord coord;
protected Hep3Vector ballPos;
protected Hep3Vector veePos;
protected Hep3Vector flatPos;
private Hep3Vector center;
private Hep3Vector boxDim;
- public BaseGeom(BaseGeom m, String name) {
+
+ public BaseGeom(String name, BaseGeom m) {
setMother(m);
+ setReferenceGeom(null);
coord = null;
ballPos = null;
veePos = null;
@@ -116,13 +122,25 @@
public void setMother(BaseGeom mother) {
this.mother = mother;
}
+ public BaseGeom getReferenceGeom() {
+ return referenceGeom;
+ }
+ public void setReferenceGeom(BaseGeom referenceGeom) {
+ this.referenceGeom = referenceGeom;
+ }
+ public void printSurveyPos() {
+ System.out.printf("Survey pos for %s:\n",getName());
+ System.out.printf("ballPos %s\n", ballPos.toString());
+ System.out.printf("veePos %s\n", veePos.toString());
+ System.out.printf("flatPos %s\n", flatPos.toString());
+ }
}
public static class TrackingBase extends BaseGeom {
public TrackingBase(String name, BaseGeom mother) {
- super(mother,name);
+ super(name,mother);
ballPos = new BasicHep3Vector(1,0,0);
veePos = new BasicHep3Vector(0,1,0);
flatPos = new BasicHep3Vector(0,0,1);
@@ -139,7 +157,7 @@
protected static final double base_length = BasePlate.base_plate_length;
public Base(String name, BaseGeom mother) {
- super(mother,name);
+ super(name,mother);
final double ball_pos_base_x = -1.0*target_pos_wrt_base_plate_x;
final double ball_pos_base_y = -1.0*target_pos_wrt_base_plate_y;
final double ball_pos_base_z = target_pos_wrt_base_plate_z;
@@ -170,7 +188,7 @@
public BasePlate(String name, BaseGeom mother) {
- super(mother,name);
+ super(name,mother);
ballPos = new BasicHep3Vector(0,0,0);
setVeePos(base_plate_width,ballPos.y(),ballPos.z());
setFlatPos(ballPos.x(),base_plate_length,ballPos.z());
@@ -195,7 +213,7 @@
public CSupport(String name, BaseGeom mother) {
- super(mother,name);
+ super(name,mother);
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();
@@ -236,15 +254,21 @@
public SupportTop(String name, BaseGeom mother) {
- super(mother,name);
+ super(name,mother);
setPos();
setCoord();
setBoxDim(support_top_width,support_top_length,support_top_height);
setCenter(support_top_width/2.0+1.0, support_top_length/2.0 + (17.00-10.50/2.0), -1.0 * (support_top_height/2.0 - (12.70-6.66-1.34)));
+ }
+ public SupportTop(String name, BaseGeom mother, BaseGeom referenceGeom) {
+ super(name,mother);
+ setReferenceGeom(referenceGeom);
+ setPos();
+ setCoord();
+ setBoxDim(support_top_width,support_top_length,support_top_height);
+ setCenter(support_top_width/2.0+1.0, support_top_length/2.0 + (17.00-10.50/2.0), -1.0 * (support_top_height/2.0 - (12.70-6.66-1.34)));
+ }
-
-
- }
private void setPos() {
System.out.printf("setPos support top\n");
@@ -253,12 +277,8 @@
// the top has the same bearing positions as the bottom c-support except for the offset vertically from base plate
// the tilt angle is independent though.
- Hep3Vector ball_pos_csup_bearings_top = new BasicHep3Vector(SupportBottom.ball_pos_csup_bearings_bottom_x,
- SupportBottom.ball_pos_csup_bearings_bottom_y,
- ball_pos_csup_bearings_top_z);
- Hep3Vector vee_pos_csup_bearings_top = new BasicHep3Vector(SupportBottom.vee_pos_csup_bearings_bottom_x,
- SupportBottom.vee_pos_csup_bearings_bottom_y,
- ball_pos_csup_bearings_top_z);
+ setBallPos(SupportBottom.ball_pos_csup_bearings_bottom_x, SupportBottom.ball_pos_csup_bearings_bottom_y, ball_pos_csup_bearings_top_z);
+ setVeePos(SupportBottom.vee_pos_csup_bearings_bottom_x, SupportBottom.vee_pos_csup_bearings_bottom_y, ball_pos_csup_bearings_top_z);
// build the rotation to find the proper location of the flat
@@ -269,36 +289,32 @@
org.apache.commons.math3.geometry.euclidean.threed.Vector3D flat_pos_csup_bearings_top_3D_rot =
rot_csup_top.applyTo(new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(0.0,10.0,0.0));
// translate the flat position
- final double flat_pos_csup_bearings_top_x = ball_pos_csup_bearings_top.x() + flat_pos_csup_bearings_top_3D_rot.getX();
- final double flat_pos_csup_bearings_top_y = ball_pos_csup_bearings_top.y() + flat_pos_csup_bearings_top_3D_rot.getY();
- final double flat_pos_csup_bearings_top_z = ball_pos_csup_bearings_top.z() + flat_pos_csup_bearings_top_3D_rot.getZ();
- Hep3Vector flat_pos_csup_bearings_top = new BasicHep3Vector(flat_pos_csup_bearings_top_x,flat_pos_csup_bearings_top_y,flat_pos_csup_bearings_top_z);
+ final double flat_pos_csup_bearings_top_x = getBallPos().x() + flat_pos_csup_bearings_top_3D_rot.getX();
+ final double flat_pos_csup_bearings_top_y = getBallPos().y() + flat_pos_csup_bearings_top_3D_rot.getY();
+ final double flat_pos_csup_bearings_top_z = getBallPos().z() + flat_pos_csup_bearings_top_3D_rot.getZ();
+ setFlatPos(flat_pos_csup_bearings_top_x,flat_pos_csup_bearings_top_y,flat_pos_csup_bearings_top_z);
- System.out.printf("ball_pos_csup_bearings_top %s\n",ball_pos_csup_bearings_top);
- System.out.printf("vee_pos_csup_bearings_top %s\n",vee_pos_csup_bearings_top);
- System.out.printf("flat_pos_csup_bearings_top %s\n",flat_pos_csup_bearings_top);
+ // since we don't care (no volume is built) about the local position of the bearings in the pin coord system we'll get rid of it
+ // and find the bearings position in the base coordinate system directly
+ BaseGeom ref = getReferenceGeom();
+ if(ref==null) {
+ throw new RuntimeException("No ref found for " + getName());
+ }
+ System.out.printf("before ref %s transform\n",ref.getName());
+ printSurveyPos();
- // create the coordinate system of the c-support bearings
- //HPSTestRunTracker2014GeomDef.Coord csup_bearings_top_coord = new HPSTestRunTracker2014GeomDef.Coord(ball_pos_csup_bearings_top, vee_pos_csup_bearings_top, flat_pos_csup_bearings_top);
- //Transform3D trans_csup_bearings_to_pin = getTransformation(csup_pin_coord);
-
- HPSTestRunTracker2014GeomDef.CSupport csup = new HPSTestRunTracker2014GeomDef.CSupport("c_support_bottom", getMother());
- Transform3D trans_csup_pin_to_base = csup.getCoord().getTransformation();
-
- System.out.printf("csup coord \n%s\n",csup.getCoord().toString());
+ System.out.printf("%s coord\n%s\n",ref.getName(),ref.getCoord().toString());
- // similar to for bottom, find the bearing positions in the base coord directly
- ballPos = trans_csup_pin_to_base.transformed(ball_pos_csup_bearings_top);
- veePos = trans_csup_pin_to_base.transformed(vee_pos_csup_bearings_top);
- flatPos = trans_csup_pin_to_base.transformed(flat_pos_csup_bearings_top);
+ ref.getCoord().getTransformation().transform(ballPos);
+ ref.getCoord().getTransformation().transform(veePos);
+ ref.getCoord().getTransformation().transform(flatPos);
- System.out.printf("ballPos %s\n",ballPos);
- System.out.printf("veePos %s\n",veePos);
- System.out.printf("flatPos %s\n",flatPos);
-
+ System.out.printf("after ref %s transform\n",ref.getName());
+ printSurveyPos();
+
}
}
@@ -317,21 +333,26 @@
//these are for the box surrounding the whole support including modules
protected static final double support_bottom_length = SupportPlateBottom.support_plate_bottom_length;
- protected static final double support_bottom_width = (25.0-5.0) + Module.module_box_L13_length;
- protected static final double support_bottom_height = SupportPlateBottom.support_plate_bottom_height - SupportPlateBottom.support_plate_pocket_depth + Module.module_box_L13_width + SupportPlateBottom.pedestal_height_L1;
+ protected static final double support_bottom_width = (25.0-5.0) + TestRunModuleL13.module_box_L13_length;
+ protected static final double support_bottom_height = SupportPlateBottom.support_plate_bottom_height - SupportPlateBottom.support_plate_pocket_depth + TestRunModuleL13.module_box_L13_width + SupportPlateBottom.pedestal_height_L1;
-
-
public SupportBottom(String name, BaseGeom mother) {
- super(mother,name);
+ super(name,mother);
setPos();
setCoord();
setBoxDim(support_bottom_width,support_bottom_length,support_bottom_height);
setCenter(support_bottom_width/2.0+1.0, support_bottom_length/2.0 + (17.00-10.50/2.0), support_bottom_height/2.0 - (12.70-6.66-1.34));
-
-
}
+ public SupportBottom(String name, BaseGeom mother, BaseGeom referenceGeom) {
+ super(name,mother);
+ setReferenceGeom(referenceGeom);
+ setPos();
+ setCoord();
+ setBoxDim(support_bottom_width,support_bottom_length,support_bottom_height);
+ setCenter(support_bottom_width/2.0+1.0, support_bottom_length/2.0 + (17.00-10.50/2.0), support_bottom_height/2.0 - (12.70-6.66-1.34));
+ }
+
private void setPos() {
System.out.printf("setPos support bottom\n");
@@ -352,35 +373,33 @@
final double flat_pos_csup_bearings_bottom_z = ball_pos_csup_bearings_bottom_z + flat_pos_csup_bearings_bottom_3D_rot.getZ();
// make vectors
- Hep3Vector ball_pos_csup_bearings_bottom = new BasicHep3Vector(ball_pos_csup_bearings_bottom_x,ball_pos_csup_bearings_bottom_y,ball_pos_csup_bearings_bottom_z);
- Hep3Vector vee_pos_csup_bearings_bottom = new BasicHep3Vector(vee_pos_csup_bearings_bottom_x,vee_pos_csup_bearings_bottom_y,vee_pos_csup_bearings_bottom_z);
- Hep3Vector flat_pos_csup_bearings_bottom = new BasicHep3Vector(flat_pos_csup_bearings_bottom_x,flat_pos_csup_bearings_bottom_y,flat_pos_csup_bearings_bottom_z);
+ setBallPos(ball_pos_csup_bearings_bottom_x,ball_pos_csup_bearings_bottom_y,ball_pos_csup_bearings_bottom_z);
+ setVeePos(vee_pos_csup_bearings_bottom_x,vee_pos_csup_bearings_bottom_y,vee_pos_csup_bearings_bottom_z);
+ setFlatPos(flat_pos_csup_bearings_bottom_x,flat_pos_csup_bearings_bottom_y,flat_pos_csup_bearings_bottom_z);
- System.out.printf("ball_pos_csup_bearings_bottom %s\n",ball_pos_csup_bearings_bottom);
- System.out.printf("vee_pos_csup_bearings_bottom %s\n",vee_pos_csup_bearings_bottom);
- System.out.printf("flat_pos_csup_bearings_bottom %s\n",flat_pos_csup_bearings_bottom);
-
// create the coordinate system of the c-support bearings
//HPSTestRunTracker2014GeomDef.Coord csup_bearings_bottom_coord = new HPSTestRunTracker2014GeomDef.Coord(ball_pos_csup_bearings_bottom, vee_pos_csup_bearings_bottom, flat_pos_csup_bearings_bottom);
// since we don't care (no volume is built) about the local position of the bearings in the pin coord system we'll get rid of it
// and find the bearings position in the base coordinate system directly
- HPSTestRunTracker2014GeomDef.CSupport csup = new HPSTestRunTracker2014GeomDef.CSupport("c_support_bottom", getMother());
- Transform3D trans_csup_pin_to_base = csup.getCoord().getTransformation();
+ BaseGeom ref = getReferenceGeom();
+ if(ref==null) {
+ throw new RuntimeException("No ref found for " + getName());
+ }
- System.out.printf("csup coord \n%s\n",csup.getCoord().toString());
+ System.out.printf("before ref %s transform\n",ref.getName());
+ printSurveyPos();
+ System.out.printf("%s coord\n%s\n",ref.getName(),ref.getCoord().toString());
- ballPos = trans_csup_pin_to_base.transformed(ball_pos_csup_bearings_bottom);
- veePos = trans_csup_pin_to_base.transformed(vee_pos_csup_bearings_bottom);
- flatPos = trans_csup_pin_to_base.transformed(flat_pos_csup_bearings_bottom);
+ ref.getCoord().getTransformation().transform(ballPos);
+ ref.getCoord().getTransformation().transform(veePos);
+ ref.getCoord().getTransformation().transform(flatPos);
- System.out.printf("ballPos %s\n",ballPos);
- System.out.printf("veePos %s\n",veePos);
- System.out.printf("flatPos %s\n",flatPos);
-
-
+ System.out.printf("after ref %s transform\n",ref.getName());
+ printSurveyPos();
+
}
}
@@ -394,7 +413,7 @@
protected static final double pedestal_height_L4 = 10.00;
protected static final double pedestal_height_L5 = 7.00;
public SupportPlate(BaseGeom mother, String name) {
- super(mother,name);
+ super(name,mother);
}
}
@@ -446,34 +465,107 @@
+
+ public static class TestRunModuleL45 extends TestRunModule {
+ protected static final double module_box_L45_length = 205.2; // includes lexan spacer and cold block
+ protected static final double module_box_L45_height = 12.5; // includes screws height
+ protected static final double module_box_L45_width = 65.3-12.0;
+ protected static final double dist_lower_sensor_edge_to_cold_block_mounting_surface = 7.662;
+
+
+ public TestRunModuleL45(String name, BaseGeom mother, int layer,String half) {
+ super(name, mother, layer, half);
+ }
+ public TestRunModuleL45(String name, BaseGeom mother, BaseGeom ref, int layer, String half) {
+ super(name, mother, ref, layer, half);
+ }
+ protected double getColdBlockThickness() {
+ return TestRunColdBlockL45.coldblock_L45_thickness;
+ }
+ protected double getModuleBoxLength() {
+ return module_box_L45_length;
+ }
+ protected double getModuleBoxWidth() {
+ return module_box_L45_width;
+ }
+ protected double getModuleBoxHeight() {
+ return module_box_L45_height;
+ }
+ protected double get_dist_lower_sensor_edge_to_cold_block_mounting_surface() {
+ return dist_lower_sensor_edge_to_cold_block_mounting_surface;
+ }
+
+ }
-
-
- public static class Module extends BaseGeom {
+ public static class TestRunModuleL13 extends TestRunModule {
// module references
protected static final double module_box_L13_length = 205.2; // includes lexan spacer and cold block
protected static final double module_box_L13_height = 12.5; // includes screws height
protected static final double module_box_L13_width = 71.3 - 13.0; // height from cold block to encapsulate the whole module
- protected static final double module_box_L45_length = 205.2; // includes lexan spacer and cold block
- protected static final double module_box_L45_height = 12.5; // includes screws height
- protected static final double module_box_L45_width = 65.3-12.0;
- protected static final double coldblock_L13_length = 82.00;
- protected static final double coldblock_L13_width = 52.50;
- protected static final double coldblock_L13_thickness = 6.00;
- protected static final double coldblock_L45_length = 82.00;
- protected static final double coldblock_L45_width = 51.00;
- protected static final double coldblock_L45_thickness = 6.00;
+ protected static final double dist_lower_sensor_edge_to_cold_block_mounting_surface = 12.66;
- public Module(String name, BaseGeom mother, int layer, String half) {
- super(mother, name);
- setPos(layer,half);
+ public TestRunModuleL13(String name, BaseGeom mother, int layer, String half) {
+ super(name, mother, layer, half);
+ }
+ public TestRunModuleL13(String name, BaseGeom mother, BaseGeom ref, int layer, String half) {
+ super(name, mother, ref, layer, half);
+ }
+ protected double getColdBlockThickness() {
+ return TestRunColdBlockL13.coldblock_L13_thickness;
+ }
+ protected double getModuleBoxLength() {
+ return module_box_L13_length;
+ }
+ protected double getModuleBoxWidth() {
+ return module_box_L13_width;
+ }
+ protected double getModuleBoxHeight() {
+ return module_box_L13_height;
+ }
+ protected double get_dist_lower_sensor_edge_to_cold_block_mounting_surface() {
+ return dist_lower_sensor_edge_to_cold_block_mounting_surface;
+ }
+
+
+
+ }
+
+
+ public static abstract class TestRunModule extends BaseModule {
+ public TestRunModule(String name, BaseGeom mother, int layer, String half) {
+ super(name, mother,layer,half);
+ setPos();
setCoord();
+ setBoxDim();
+ setCenter();
+ }
+ public TestRunModule(String name, BaseGeom mother, BaseGeom reference, int layer, String half) {
+ super(name, mother,layer,half);
+ setReferenceGeom(reference);
+ setPos();
+ setCoord();
+ setBoxDim();
+ setCenter();
+ }
+ protected abstract double getColdBlockThickness();
+ protected abstract double getModuleBoxLength();
+ protected abstract double getModuleBoxWidth();
+ protected abstract double getModuleBoxHeight();
+ protected abstract double get_dist_lower_sensor_edge_to_cold_block_mounting_surface();
+
+ protected void setBoxDim() {
+ //TODO why is this not: width,length,height as for the other volumes!?
+ setBoxDim(new BasicHep3Vector(getModuleBoxLength(),getModuleBoxHeight(),getModuleBoxWidth()));
}
- private void setPos(int layer, String half) {
+ protected void setCenter() {
+ setCenter(getModuleBoxLength()/2.0-5.0, 0.0, getModuleBoxWidth()/2.0);
+ }
+
+ protected void setPos() {
// bottom
- if(half=="bottom") {
- switch (layer) {
+ if(isBottom()) {
+ switch (getLayer()) {
case 1:
ballPos = new BasicHep3Vector(25.0, 661.1, HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L1-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth);
veePos = new BasicHep3Vector(95.0, 661.1, HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L1-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth);
@@ -500,17 +592,17 @@
flatPos = new BasicHep3Vector(60.0, 67.10, HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L5-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth);
break;
default:
- System.out.printf("ERROR invalid layer %d for half %s\n",layer,half);
+ System.out.printf("ERROR invalid layer %d for half %s\n",getLayer(),getHalf());
System.exit(1);
break;
}
- } else if(half=="top") {
+ } else {
// top
// top has a fixed offset of 15mm along plate on module pocket positions w.r.t. bottom
// top local coordinates is rotation pi around u-vec so need to adjust pocket depth coordinate
- switch (layer) {
+ switch (getLayer()) {
case 1:
ballPos = new BasicHep3Vector(25.0, 676.1, -1.0 * (HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L1-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth));
veePos = new BasicHep3Vector(95.0, 676.1, -1.0 * (HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L1-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth));
@@ -533,28 +625,415 @@
break;
case 5:
ballPos = new BasicHep3Vector(25.0, 76.1, -1.0 * (HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L5-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth));
- veePos = new BasicHep3Vector(95.0, 76.1, -1.0 * (HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L5-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth));
+ veePos = new BasicHep3Vector(95.0, 76.1, -1.0 * (HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L5-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth));
flatPos = new BasicHep3Vector(60.0, 70.1, -1.0 * (HPSTestRunTracker2014GeomDef.SupportPlateBottom.pedestal_height_L5-HPSTestRunTracker2014GeomDef.SupportPlateBottom.support_plate_pocket_depth));
break;
default:
- System.out.printf("ERROR invalid layer %d for half %s\n",layer,half);
+ System.out.printf("ERROR invalid layer %d for half %s\n",getLayer(),getHalf());
System.exit(1);
break;
}
+ }
+
+ System.out.printf("test run module in support plate coord\n");
+ printSurveyPos();
+
+ //
+ // Note that the mother volume is the support wrap box which can be different than support plate coord system.
+ // Thus I need to take that into account when making the modules by referencing through the support plate
+ BaseGeom ref = getReferenceGeom();
+ if(ref==null) {
+ throw new RuntimeException("No reference geom found for " + getName());
+ }
-
- } else {
+ System.out.printf("ref coord system %s\n%s\n",ref.getName(),ref.getCoord().toString());
+
+
+ // transform the survey points
+ ref.getCoord().getTransformation().transform(ballPos);
+ ref.getCoord().getTransformation().transform(veePos);
+ ref.getCoord().getTransformation().transform(flatPos);
+
+ System.out.printf("test run module after support plate coord-> support coord transformation\n");
+ printSurveyPos();
+
+ }
+
+ }
+
+
+ public static class BaseModule extends BaseGeom {
+ private int layer;
+ private String half;
+
+ public BaseModule(String name, BaseGeom mother, int layer, String half) {
+ super(name, mother);
+ if(half!="bottom" && half!="top") {
System.out.printf("ERROR invalid half %s\n",half);
System.exit(1);
}
+ setLayer(layer);
+ setHalf(half);
}
+
+ public int getLayer() {
+ return layer;
+ }
+
+ public void setLayer(int layer) {
+ this.layer = layer;
+ }
+
+ public String getHalf() {
+ return half;
+ }
+
+ public void setHalf(String half) {
+ this.half = half;
+ }
+
+ public boolean isBottom() {
+ return getHalf() == "bottom" ? true : false;
+ }
+
}
+
+
+ public abstract static class TestRunHalfModule extends BaseModule {
+ // 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 coordinate system 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.
+
+ // Distance from sensor to CF edge: 180mm
+ // Distance from CF edge to screw hole: 30mm
+ // Distance from screw hole to edge of cold block: 33.75mm
+ // Distance from edge of cold block to hole/ball position: 5mm
+ protected static final double dist_sensor_center_to_coldblock_hole_vdir = (180.0 - 30.0 + (33.75 - 5.0)) - Sensor.sensor_length/2.0;
+ protected static final double cf_length = 200.;
+ protected static final double cf_width = 45.;
+ protected static final double cf_thickness = 0.250;
+
+ protected static final double hybrid_length = 170.0 - HPSTestRunTracker2014GeomDef.Sensor.getSensorLength(); // sensor b-to-b with hybrid
+ protected static final double hybrid_width = HPSTestRunTracker2014GeomDef.Sensor.getSensorWidth();
+ protected static final double hybrid_thickness = 4.0/64.0*inch;
+
+ protected static final double half_module_thickness = HPSTestRunTracker2014GeomDef.TestRunHalfModule.getHybridThickness() + HPSTestRunTracker2014GeomDef.TestRunHalfModule.getCFThickness() + HalfModuleLamination.getKaptonThickness();
+ protected static final double half_module_length = HPSTestRunTracker2014GeomDef.TestRunHalfModule.getCFLength();
+ protected static final double half_module_width = 6.83 + HPSTestRunTracker2014GeomDef.Sensor.getSensorWidth();
+
+
+ public TestRunHalfModule(String name, BaseGeom mother, int layer, String half) {
+ super(name,mother, layer, half);
+ setPos();
+ setCoord();
+ setBoxDim(getLength(), getThickness(), getWidth());
+ setCenter();
+
+ }
+
+ protected abstract void setPos();
+
+ private void setCenter() {
+ // Find distance to center in the local coordinate system
+ // Note that this can be different between axial and stereo since the survey positions determine the local coordinate
+ // system now.
+ // I'm not sure this feels good but this has to be done somewhere
+ double box_center_local_x = HPSTestRunTracker2014GeomDef.TestRunHalfModule.getLength()/2.0 - ( (170.00 + 10.00) - HPSTestRunTracker2014GeomDef.Sensor.getSensorLength()/2.0);
+ double box_center_local_y = -1.0*HPSTestRunTracker2014GeomDef.TestRunHalfModule.getThickness()/2.0 + (HPSTestRunTracker2014GeomDef.TestRunHalfModule.getCFThickness() + HalfModuleLamination.getKaptonThickness() + HPSTestRunTracker2014GeomDef.Sensor.getSensorThickness()/2.0);
+ double box_center_local_z = HPSTestRunTracker2014GeomDef.TestRunHalfModule.getWidth()/2.0 - ( 12.66 - (8.83 -3.00) + HPSTestRunTracker2014GeomDef.Sensor.getSensorWidth()/2.0 );
+ setCenter(box_center_local_x, box_center_local_y, box_center_local_z);
+ }
+
+ public static double getCFThickness() {
+ return cf_thickness;
+ }
+ public static double getCFLength() {
+ return cf_length;
+ }
+ public static double getCFWidth() {
+ return cf_width;
+ }
+ public static double getHybridLength() {
+ return hybrid_length;
+ }
+ public static double getHybridWidth() {
+ return hybrid_width;
+ }
+ public static double getHybridThickness() {
+ return hybrid_thickness;
+ }
+ public static double getThickness() {
+ return half_module_thickness;
+ }
+ public static double getLength() {
+ return half_module_length;
+ }
+ public static double getWidth() {
+ return half_module_width;
+ }
+
+
+ }
+ public static class TestRunHalfModuleAxial extends TestRunHalfModule {
+
+ public TestRunHalfModuleAxial(String name, BaseGeom mother, int layer, String half) {
+ super(name, mother, layer, half);
+ }
+
+ protected void setPos() {
+ final double coldBlockThick = getLayer() <=3 ? TestRunColdBlockL13.coldblock_L13_thickness : TestRunColdBlockL45.coldblock_L45_thickness;
+ final double dist_lower_sensor_edge_to_cold_block_mounting_surface = getLayer() <=3 ? TestRunModuleL13.dist_lower_sensor_edge_to_cold_block_mounting_surface : TestRunModuleL45.dist_lower_sensor_edge_to_cold_block_mounting_surface;
+
+ final double ball_pos_halfmod_axial_local_x = dist_sensor_center_to_coldblock_hole_vdir;
+ final double ball_pos_halfmod_axial_local_y = -1.0* (coldBlockThick/2.0 + TestRunHalfModule.getCFThickness() + HalfModuleLamination.getKaptonThickness() + HPSTestRunTracker2014GeomDef.Sensor.getSensorThickness()/2.0);
+ final double ball_pos_halfmod_axial_local_z = dist_lower_sensor_edge_to_cold_block_mounting_surface + Sensor.getSensorWidth()/2.0;
+ final double vee_pos_halfmod_axial_local_x = ball_pos_halfmod_axial_local_x + Sensor.getSensorLength()/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.getSensorThickness()/2.0;
+ final double flat_pos_halfmod_axial_local_z = ball_pos_halfmod_axial_local_z;
+ ballPos = new BasicHep3Vector(ball_pos_halfmod_axial_local_x, ball_pos_halfmod_axial_local_y, ball_pos_halfmod_axial_local_z);
+ veePos = new BasicHep3Vector(vee_pos_halfmod_axial_local_x, vee_pos_halfmod_axial_local_y,vee_pos_halfmod_axial_local_z);
+ flatPos = new BasicHep3Vector(flat_pos_halfmod_axial_local_x, flat_pos_halfmod_axial_local_y,flat_pos_halfmod_axial_local_z);
+
+ }
+
+ }
+
+ public static class TestRunHalfModuleStereo extends TestRunHalfModule {
+
+ public TestRunHalfModuleStereo(String name, BaseGeom mother, int layer, String half) {
+ super(name, mother, layer, half);
+ }
+
+ protected void setPos() {
+
+ //very similar to axial, see note below
+
+ final double coldBlockThick = getLayer() <=3 ? TestRunColdBlockL13.coldblock_L13_thickness : TestRunColdBlockL45.coldblock_L45_thickness;
+ final double dist_lower_sensor_edge_to_cold_block_mounting_surface = getLayer() <=3 ? TestRunModuleL13.dist_lower_sensor_edge_to_cold_block_mounting_surface : TestRunModuleL45.dist_lower_sensor_edge_to_cold_block_mounting_surface;
+
+ final double ball_pos_halfmod_axial_local_x = dist_sensor_center_to_coldblock_hole_vdir;
+ // note minus sign to separate from axial
+ final double ball_pos_halfmod_axial_local_y = -1.0 * (-1.0* (coldBlockThick/2.0 + TestRunHalfModule.getCFThickness() + HalfModuleLamination.getKaptonThickness() + HPSTestRunTracker2014GeomDef.Sensor.getSensorThickness()/2.0));
+ final double ball_pos_halfmod_axial_local_z = dist_lower_sensor_edge_to_cold_block_mounting_surface + Sensor.getSensorWidth()/2.0;
+ final double vee_pos_halfmod_axial_local_x = ball_pos_halfmod_axial_local_x + Sensor.getSensorLength()/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.getSensorThickness()/2.0;
+ final double flat_pos_halfmod_axial_local_z = ball_pos_halfmod_axial_local_z;
+ ballPos = new BasicHep3Vector(ball_pos_halfmod_axial_local_x, ball_pos_halfmod_axial_local_y, ball_pos_halfmod_axial_local_z);
+ veePos = new BasicHep3Vector(vee_pos_halfmod_axial_local_x, vee_pos_halfmod_axial_local_y,vee_pos_halfmod_axial_local_z);
+ flatPos = new BasicHep3Vector(flat_pos_halfmod_axial_local_x, flat_pos_halfmod_axial_local_y,flat_pos_halfmod_axial_local_z);
+ }
+ }
+
+ public static abstract class TestRunColdBlock extends BaseGeom {
+ private int layer;
+ public TestRunColdBlock(String name, BaseGeom mother, int layer) {
+ super(name, mother);
+ this.layer = layer;
+ setPos();
+ setCoord();
+ setBoxDim(getLength(), getHeight(), getWidth());
+ setCenter(getLength()/2.0, 0.0, getWidth()/2.0);
+ }
+ protected abstract double getWidth();
+ protected abstract double getLength();
+ protected abstract double getHeight();
+ public int getLayer() {
+ return layer;
+ }
+ public void setLayer(int layer) {
+ this.layer = layer;
+ }
+ private void setPos() {
+ // cold block position w.r.t. module box coordinate system
+ // this is a dummy coordinate system, make it simple
+ // edge of cold block on the mounting surface
+ final double ball_pos_coldblock_local_x = -5.00;
+ final double ball_pos_coldblock_local_y = 0.00;
+ final double ball_pos_coldblock_local_z = 0.00;
+ final double vee_pos_coldblock_local_x = ball_pos_coldblock_local_x + 1.0; //arbitrary distance
+ final double vee_pos_coldblock_local_y = ball_pos_coldblock_local_y;
+ final double vee_pos_coldblock_local_z = ball_pos_coldblock_local_z;
+ final double flat_pos_coldblock_local_x = ball_pos_coldblock_local_x;
+ final double flat_pos_coldblock_local_y = ball_pos_coldblock_local_y + 1.0; //arbitrary distance
+ final double flat_pos_coldblock_local_z = ball_pos_coldblock_local_z;
+
+ setBallPos(ball_pos_coldblock_local_x, ball_pos_coldblock_local_y, ball_pos_coldblock_local_z);
+ setVeePos(vee_pos_coldblock_local_x, vee_pos_coldblock_local_y,vee_pos_coldblock_local_z);
+ setFlatPos(flat_pos_coldblock_local_x, flat_pos_coldblock_local_y,flat_pos_coldblock_local_z);
+
+ }
+ }
+
+ public static class TestRunColdBlockL13 extends TestRunColdBlock {
+ protected static final double coldblock_L13_length = 82.00;
+ protected static final double coldblock_L13_width = 52.50;
+ protected static final double coldblock_L13_thickness = 6.00;
+
+ public TestRunColdBlockL13(String name, BaseGeom mother, int layer) {
+ super(name, mother, layer);
+ }
+ protected double getWidth() {
+ return coldblock_L13_width;
+ }
+ protected double getLength() {
+ return coldblock_L13_length;
+ }
+ protected double getHeight() {
+ return coldblock_L13_thickness;
+ }
+ protected double getThickness() {
+ return getHeight();
+ }
+ }
+
+ public static class TestRunColdBlockL45 extends TestRunColdBlock {
+ protected static final double coldblock_L45_length = 82.00;
+ protected static final double coldblock_L45_width = 51.00;
+ protected static final double coldblock_L45_thickness = 6.00;
+
+ public TestRunColdBlockL45(String name, BaseGeom mother, int layer) {
+ super(name, mother, layer);
+ }
+ protected double getWidth() {
+ return coldblock_L45_width;
+ }
+ protected double getLength() {
+ return coldblock_L45_length;
+ }
+ protected double getHeight() {
+ return coldblock_L45_thickness;
+ }
+ protected double getThickness() {
+ return getHeight();
+ }
+ }
+
+
+ public static class Sensor extends BaseGeom {
+ private int id;
+ private static final double sensor_length= 100.00; //98.33;
+ private static final double sensor_width = 40.34; //38.3399;
+ private static final double sensor_thickness = 0.32;
+ public Sensor(String name, BaseGeom m, int id) {
+ super(name, m);
+ this.id = id;
+ setPos();
+ setCoord();
+ setCenter(0,0,0);
+ setBoxDim(getSensorLength(),getSensorThickness(),getSensorWidth());
+ }
+ public static double getSensorLength() {
+ return sensor_length;
+ }
+ public static double getSensorWidth() {
+ return sensor_width;
+ }
+ public static double getSensorHeight() {
+ return sensor_thickness;
+ }
+ public static double getSensorThickness() {
+ return getSensorHeight();
+ }
+ private void setPos() {
+ setBallPos(0,0,0);
+ setVeePos(ballPos.x() + HPSTestRunTracker2014GeomDef.Sensor.getSensorLength()/2.0, ballPos.y(), ballPos.z());
+ setFlatPos(ballPos.x(),ballPos.y() + HPSTestRunTracker2014GeomDef.Sensor.getSensorThickness()/2.0, ballPos.z());
+ }
+ public int getId() {
+ return id;
+ }
+ public void setId(int id) {
+ this.id = id;
+ }
+
+
+ }
+
+ public static class ActiveSensor extends BaseGeom {
+ private static final double sensor_active_length= 98.33;
+ private static final double sensor_active_width = 38.3399;
+ private static final double sensor_active_thickness = Sensor.sensor_thickness;
+ public ActiveSensor(String name, BaseGeom m) {
+ super(name, m);
+ setPos();
+ setCoord();
+ setCenter(0,0,0);
+ setBoxDim(getActiveSensorLength(),getActiveSensorThickness(),getActiveSensorWidth());
+ }
+ public static double getActiveSensorLength() {
+ return sensor_active_length;
+ }
+ public static double getActiveSensorWidth() {
+ return sensor_active_width;
+ }
+ public static double getActiveSensorHeight() {
+ return sensor_active_thickness;
+ }
+ public static double getActiveSensorThickness() {
+ return getActiveSensorHeight();
+ }
+ private void setPos() {
+ ballPos = new BasicHep3Vector(0,0,0);
+ veePos = new BasicHep3Vector(getActiveSensorWidth()/2.0,0,0);
+ flatPos = new BasicHep3Vector(0,getActiveSensorLength()/2.0,0);
+
+ }
+ }
+
+
+ public static class HalfModuleLamination extends BaseGeom {
+ protected static final double kapton_length = 184.0;
+ protected static final double kapton_width = 40.0;
+ protected static final double kapton_thickness = 0.050;
+ public HalfModuleLamination(String name, BaseGeom m) {
+ super(name, m);
+ setPos();
+ setCoord();
+ setCenter(HalfModuleLamination.getKaptonLength()/2.0, 0.0, HalfModuleLamination.getKaptonWidth()/2.0);
+ setBoxDim(HalfModuleLamination.getKaptonLength(),HalfModuleLamination.getKaptonThickness(),HalfModuleLamination.getKaptonWidth());
+ }
+ private void setPos() {
+ final double ball_pos_kapton_local_x = -1 * (180.0 - HPSTestRunTracker2014GeomDef.Sensor.getSensorLength()/2.0) + 8.5;
+ final double ball_pos_kapton_local_y = (HPSTestRunTracker2014GeomDef.Sensor.getSensorThickness()/2.0 + HalfModuleLamination.getKaptonThickness()/2.0);
+ final double ball_pos_kapton_local_z = -1 * (HPSTestRunTracker2014GeomDef.Sensor.getSensorWidth()/2.0 + 12.66) + 8.83 - 3.00 + 6.00 ;
+ final double vee_pos_kapton_local_x = ball_pos_kapton_local_x + 1.0; // arbitrary distance
+ final double vee_pos_kapton_local_y = ball_pos_kapton_local_y;
+ final double vee_pos_kapton_local_z = ball_pos_kapton_local_z;
+ final double flat_pos_kapton_local_x = ball_pos_kapton_local_x;
+ final double flat_pos_kapton_local_y = ball_pos_kapton_local_y + HalfModuleLamination.getKaptonThickness()/2.0; // arbitrary distance
+ final double flat_pos_kapton_local_z = ball_pos_kapton_local_z;
+
+ ballPos = new BasicHep3Vector(ball_pos_kapton_local_x,ball_pos_kapton_local_y,ball_pos_kapton_local_z);
+ veePos = new BasicHep3Vector(vee_pos_kapton_local_x,vee_pos_kapton_local_y,vee_pos_kapton_local_z);
+ flatPos = new BasicHep3Vector(flat_pos_kapton_local_x,flat_pos_kapton_local_y,flat_pos_kapton_local_z);
+
+ }
+ public static double getKaptonThickness() {
+ return kapton_thickness;
+ }
+ public static double getKaptonWidth() {
+ return kapton_width;
+ }
+ public static double getKaptonLength() {
+ return kapton_length;
+ }
+ }
+
+
+
public static class Coord {
private Hep3Vector origin;
private Hep3Vector u;