Commit in projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd on MAIN | |||
HPSTestRunTracker2014.java | +2 | -102 | 3193 -> 3194 |
HPSTestRunTracker2014GeomDef.java | +271 | -165 | 3193 -> 3194 |
+273 | -267 |
Fixed constructor initialization order.
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014.java 2014-07-17 19:54:09 UTC (rev 3193) +++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014.java 2014-07-17 20:16:38 UTC (rev 3194) @@ -62,88 +62,6 @@
- - - //General - public final double inch = 25.4; - - //private final double target_pos_wrt_base_plate_x = 162.3; //from Marco's 3D model - //private final double target_pos_wrt_base_plate_y = 80.55; //from Tim's sketchup //68.75; //from Marco's 3D model - //private final double target_pos_wrt_base_plate_z = 926.59; //from Marco's 3D model - - // Base plate references -// private final double base_plate_thickness = 0.25*inch; -// private final double base_plate_width = 385.00; -// private final double base_plate_length = 1216.00; -// private final double base_plate_offset_height = 2.0; //from Marco's 3D model -// private final double PS_vac_box_inner_height = 7.0*inch; - // height of the dummy box holding the entire SVT: - // this means the bottom of the base plate to the the inner surface of of the PS vac box for now - //private final double base_height = PS_vac_box_inner_height - HPSTestRunTracker2014GeomDef.BasePlate.base_plate_offset_height; - //private final double base_width = HPSTestRunTracker2014GeomDef.BasePlate.base_plate_width; - //private final double base_length = HPSTestRunTracker2014GeomDef.BasePlate.base_plate_length; - private final double beamPlaneThickness = 0.00000001; - - // c-support references - // pin position on base plate surface -// double ball_pos_csup_pin_bottom_x = 51.15; -// double ball_pos_csup_pin_bottom_y = 115.02; -// double ball_pos_csup_pin_bottom_z = 0.0; -// double vee_pos_csup_pin_bottom_x = 271.05; -// double vee_pos_csup_pin_bottom_y = 121.62; -// double vee_pos_csup_pin_bottom_z = 0.0; - - // point on axis of rotation on the inside of the c-support frame where the insert get's attached - // this is referenced to the pin position coord system above -// private final double ball_pos_csup_bearings_bottom_x = 240.0 - 265.0 + 14.0; -// private final double ball_pos_csup_bearings_bottom_y = (-6.0 + 22.0); -// private final double ball_pos_csup_bearings_bottom_z = 14.7; -// private final double vee_pos_csup_bearings_bottom_x = 240.0- 129.0; -// private final double vee_pos_csup_bearings_bottom_y = (-6.0 + 22.0); -// private final double vee_pos_csup_bearings_bottom_z = 14.7; -// // Top only needs a vertical offset to be specified -// private final double ball_pos_csup_bearings_top_z = 146.4; -// - // support plate references - // use a settable rotation to effectively determine the flat and therefore the tilt of the support - // 0.000723559 should put L1 sensor on beam plane -// private final double support_plate_bottom_tilt_angle = 0.0; //0.000723559; -// private final double support_plate_top_tilt_angle = 0.0; //-0.000723559; -// private final double support_plate_bottom_height = 12.7; -// private final double support_plate_bottom_length = 736.1; -// private final double support_plate_bottom_width = 120.0; -// private final double support_plate_top_length = support_plate_bottom_length; -// private final double support_plate_top_width = support_plate_bottom_width; -// private final double support_plate_pocket_depth = 6.65; // Tim's sketchup, drawing says 6.66mm? -// private final double pedestal_height_L1 = 11.00; -// private final double pedestal_height_L2 = 9.50; -// private final double pedestal_height_L3 = 8.00; -// private final double pedestal_height_L4 = 10.00; -// private final double pedestal_height_L5 = 7.00; - //these are for the box surrounding the whole support including modules -// private final double support_bottom_length = support_plate_bottom_length; -// private final double support_bottom_width = (25.0-5.0) + HPSTestRunTracker2014GeomDef.Module.module_box_L13_length; -// private final double support_bottom_height = support_plate_bottom_height - support_plate_pocket_depth + HPSTestRunTracker2014GeomDef.Module.module_box_L13_width + this.pedestal_height_L1; -// private final double support_top_length = support_bottom_length; -// private final double support_top_width = support_bottom_width; -// private final double support_top_height = support_bottom_height; - - // module references -// private final double module_box_L13_length = 205.2; // includes lexan spacer and cold block -// private final double module_box_L13_height = 12.5; // includes screws height -// private final double module_box_L13_width = 71.3 - 13.0; // height from cold block to encapsulate the whole module -// private final double module_box_L45_length = 205.2; // includes lexan spacer and cold block -// private final double module_box_L45_height = 12.5; // includes screws height -// private final double module_box_L45_width = 65.3-12.0; - // survey positions for each module is the pockets: - // ball: hole - // vee: slot - // flat: middle of pocket defining local w out of the pocket vertically - - - - -
public HPSTestRunTracker2014(Element node) throws JDOMException { super(node);
@@ -151,7 +69,7 @@
base = new HPSTestRunTracker2014GeomDef.Base("base",tracking); basePlate = new HPSTestRunTracker2014GeomDef.BasePlate("baseplate",base); cSupport = new HPSTestRunTracker2014GeomDef.CSupport("c_support", base);
- supportBottom = new HPSTestRunTracker2014GeomDef.SupportBottom("support_bottom", base,cSupport);
+ supportBottom = new HPSTestRunTracker2014GeomDef.SupportBottom("support_bottom", base, cSupport);
supportPlateBottom = new HPSTestRunTracker2014GeomDef.SupportPlateBottom("support_plate_bottom", supportBottom); supportTop = new HPSTestRunTracker2014GeomDef.SupportTop("support_top", base, cSupport); supportPlateTop= new HPSTestRunTracker2014GeomDef.SupportPlateTop("support_plate_top", supportTop);
@@ -204,9 +122,6 @@
if(buildBeamPlane ) { // beam plane at global z=0
- Hep3Vector ball_pos_base_plate = basePlate.getBallPos(); - Hep3Vector vee_pos_base_plate = basePlate.getVeePos(); - Hep3Vector flat_pos_base_plate = basePlate.getFlatPos();
Hep3Vector ball_pos_beamplane = new BasicHep3Vector(-1.0*HPSTestRunTracker2014GeomDef.BasePlate.base_plate_width/2.0,0.0,HPSTestRunTracker2014GeomDef.BasePlate.base_plate_length/2.0); Hep3Vector vee_pos_beamplane = new BasicHep3Vector(ball_pos_beamplane.x()+HPSTestRunTracker2014GeomDef.BasePlate.base_plate_width,ball_pos_beamplane.y(),ball_pos_beamplane.z()); Hep3Vector flat_pos_beamplane = new BasicHep3Vector(ball_pos_beamplane.x(), ball_pos_beamplane.y(), ball_pos_beamplane.z()-HPSTestRunTracker2014GeomDef.BasePlate.base_plate_length/2.0);
@@ -295,15 +210,6 @@
print("Make c-support positions on base plate for bottom"); }
- // This is the sequence of locating the support plate positions: - // The c-support pin positions are found - // the points on the axis of rotation are used as references for building the box surrounding the support plates (incl sensors). - // this should make it more straightforward when applying a tilt angle - // c-support: - // ball position is C-support pin position on electron side on the base plate surface - // vee position is C-support pin position on positron side on the base plate surface - // flat position is a randomly chosen point perpendicular to ball to vee vector and offset 10mm along the plate. - // Note that the flat here sets the tilt angle of the support plates.
makeSupport("bottom",volume, lcdd, sens );
@@ -336,10 +242,6 @@
print("--- makeBasePlate----"); }
- Hep3Vector ball_pos_base_plate = basePlate.getBallPos(); - Hep3Vector vee_pos_base_plate = basePlate.getVeePos(); - Hep3Vector flat_pos_base_plate = basePlate.getFlatPos(); -
HPSTestRunTracker2014GeomDef.Coord base_plate_coord = basePlate.getCoord(); String volName = basePlate.getName();
@@ -349,9 +251,6 @@
if(_debug) {
- print(String.format("ball_pos_base_plate %s", ball_pos_base_plate.toString())); - print(String.format("vee_pos_base_plate %s", vee_pos_base_plate.toString())); - print(String.format("flat_pos_base_plate %s", flat_pos_base_plate.toString()));
print(String.format("base_plate_coord:\n%s", base_plate_coord.toString())); }
@@ -1449,6 +1348,7 @@
HPSTestRunTracker2014GeomDef.Coord beamplane_coord = new HPSTestRunTracker2014GeomDef.Coord(ball_pos_beamplane, vee_pos_beamplane, flat_pos_beamplane); Transform3D trans_beamplane_to_tracking = beamplane_coord.getTransformation();
+ final double beamPlaneThickness = 0.00000001;
String volName = "beamPlaneVol"; Box box = new Box(volName + "Box", HPSTestRunTracker2014GeomDef.Base.base_width, HPSTestRunTracker2014GeomDef.Base.base_length*2, beamPlaneThickness); lcdd.add(box);
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014GeomDef.java 2014-07-17 19:54:09 UTC (rev 3193) +++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014GeomDef.java 2014-07-17 20:16:38 UTC (rev 3194) @@ -20,6 +20,10 @@
* @author Per Hansson Adrian <[log in to unmask]> * */
+/** + * @author phansson + * + */
public final class HPSTestRunTracker2014GeomDef { //General
@@ -31,11 +35,19 @@
private static final double target_pos_wrt_base_plate_z = 926.59; //from Marco's 3D model protected static final double PS_vac_box_inner_height = 7.0*inch;
- protected static class BaseGeom {
+ + + /** + * + * Base geometry class for generating volumes based on survey information. + * + */ + protected static abstract class BaseGeom {
private String name; private BaseGeom mother;
- // If the survey positions are referenced to an intermediate coordinate system - // normally this is null.
+ // The reference geometry is used when the survey points are w.r.t. to + // a different/intermediate coord system. So that transformation has to be used when + // transforming to the mother system
private BaseGeom referenceGeom; private Coord coord; protected Hep3Vector ballPos;
@@ -45,16 +57,30 @@
private Hep3Vector boxDim; public BaseGeom(String name, BaseGeom m) {
+ setName(name);
setMother(m); setReferenceGeom(null);
- coord = null; - ballPos = null; - veePos = null; - flatPos = null; - setCenter(null); - setBoxDim(null);
+ } + public BaseGeom(String name, BaseGeom m, BaseGeom ref) {
setName(name);
+ setMother(m); + setReferenceGeom(ref);
}
+ + protected abstract void setPos(); + protected abstract void setCoord(); + protected abstract void setCenter(); + protected abstract void setBoxDim(); + + /** + * Initialize the survey constants, volume positions and dimensions + */ + protected void init() { + setPos(); + setCoord(); + setCenter(); + setBoxDim(); + }
public void setBallPos(double x, double y, double z) { ballPos = new BasicHep3Vector(x,y,z); }
@@ -73,9 +99,6 @@
public Hep3Vector getFlatPos() { return flatPos; }
- public void setCoord() { - setCoord(null); - }
public void setCoord(Hep3Vector origin) { if(ballPos==null || veePos==null || flatPos==null) { throw new RuntimeException("Need to set ball, vee and flat before building coord system!");
@@ -110,9 +133,6 @@
public Hep3Vector getBoxDim() { return boxDim; }
- public void setBoxDim(Hep3Vector boxDim) { - this.boxDim = boxDim; - }
public void setBoxDim(double x, double y, double z) { this.boxDim = new BasicHep3Vector(x,y,z); }
@@ -138,15 +158,31 @@
}
+ /** + * Tracking volume geometry definition. + */
public static class TrackingBase extends BaseGeom { public TrackingBase(String name, BaseGeom mother) { super(name,mother);
+ init(); + } + protected void setPos() { + // Dummy survey positions to setup a coordinate system
ballPos = new BasicHep3Vector(1,0,0); veePos = new BasicHep3Vector(0,1,0); flatPos = new BasicHep3Vector(0,0,1);
+ } + protected void setCoord() { + // at the origin
setCoord(new BasicHep3Vector(0,0,0));
+ } + protected void setCenter() { + // at the origin
setCenter(new BasicHep3Vector(0,0,0)); }
+ protected void setBoxDim() { + // do nothing since we are not building a tracking volume + }
} public static class Base extends BaseGeom {
@@ -158,6 +194,9 @@
public Base(String name, BaseGeom mother) { super(name,mother);
+ init(); + } + protected void setPos() {
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,10 +209,16 @@
setBallPos(ball_pos_base_x,ball_pos_base_y,ball_pos_base_z); setVeePos(vee_pos_base_x,vee_pos_base_y,vee_pos_base_z); setFlatPos(flat_pos_base_x, flat_pos_base_y, flat_pos_base_z);
- setCoord(); - setBoxDim(base_width,base_length,base_height);
+ } + protected void setCoord() { + setCoord(null); + } + protected void setCenter() {
setCenter(base_width/2.0, base_length/2.0, base_height/2.0 - BasePlate.base_plate_thickness); }
+ protected void setBoxDim() { + setBoxDim(base_width,base_length,base_height); + }
}
@@ -185,23 +230,40 @@
protected static final double base_plate_length = 1216.00; //height from vacuum chamber surface protected static final double base_plate_offset_height = 2.0; //from Marco's 3D model
- -
public BasePlate(String name, BaseGeom mother) { super(name,mother);
- ballPos = new BasicHep3Vector(0,0,0);
+ init(); + } + protected void setPos() { + setBallPos(0,0,0);
setVeePos(base_plate_width,ballPos.y(),ballPos.z()); setFlatPos(ballPos.x(),base_plate_length,ballPos.z());
- setCoord(); - setBoxDim(base_plate_width,base_plate_length, base_plate_thickness);
+ } + protected void setCoord() { + setCoord(null); + } + protected void setCenter() {
setCenter(base_plate_width/2.0, base_plate_length/2.0, -base_plate_thickness/2.0); }
+ protected void setBoxDim() { + setBoxDim(base_plate_width,base_plate_length, base_plate_thickness); + }
} public static class CSupport extends BaseGeom {
+ // This is the sequence of locating the support plate positions: + // The c-support pin positions are found + // the points on the axis of rotation are used as references for building the box surrounding the support plates (incl sensors). + // this should make it more straightforward when applying a tilt angle + // c-support: + // ball position is C-support pin position on electron side on the base plate surface + // vee position is C-support pin position on positron side on the base plate surface + // flat position is a randomly chosen point perpendicular to ball to vee vector and offset 10mm along the plate. + // Note that the flat here sets the tilt angle of the support plates. +
// c-support references // pin position on base plate surface private static final double ball_pos_csup_pin_bottom_x = 51.15;
@@ -214,10 +276,7 @@
public CSupport(String name, BaseGeom mother) { 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(); - setCoord();
+ init();
} private void calcAndSetFlatPos() { // find the rotation to place the flat point
@@ -235,6 +294,20 @@
double flat_pos_csup_pin_bottom_z = ball_pos_csup_pin_bottom_z + flat_pos_csup_pin_bottom_3D_rot.getZ(); setFlatPos(flat_pos_csup_pin_bottom_x,flat_pos_csup_pin_bottom_y,flat_pos_csup_pin_bottom_z); }
+ protected void setPos() { + 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(); + } + protected void setCoord() { + setCoord(null); + } + protected void setCenter() { + // this is never used since it's only a reference volume + setCenter(null); + } + protected void setBoxDim() { + }
}
@@ -244,57 +317,41 @@
public static class SupportTop extends BaseGeom { // Top only needs a vertical offset to be specified private static final double ball_pos_csup_bearings_top_z = 146.4;
-
//these are for the box surrounding the whole support including modules protected static final double support_top_length = SupportBottom.support_bottom_length; protected static final double support_top_width = SupportBottom.support_bottom_width; protected static final double support_top_height = SupportBottom.support_bottom_height;
-
- -
public SupportTop(String name, BaseGeom mother) { 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)));
+ init();
} 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)));
+ super(name,mother,referenceGeom); + init();
}
- private void setPos() { -
+ protected void setPos() {
System.out.printf("setPos support top\n");
- -
// 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.
-
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 org.apache.commons.math3.geometry.euclidean.threed.Rotation rot_csup_top = new org.apache.commons.math3.geometry.euclidean.threed.Rotation(org.apache.commons.math3.geometry.euclidean.threed.RotationOrder.XYZ, SupportPlateTop.support_plate_top_tilt_angle, 0.0, 0.0 );
+
// apply to flat local position (as for bottom it is arbitrary offset) 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 = 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);
-
// 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();
@@ -313,16 +370,22 @@
System.out.printf("after ref %s transform\n",ref.getName()); printSurveyPos();
- -
}
-
+ protected void setCoord() { + setCoord(null); + } + protected void setCenter() { + 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))); + } + protected void setBoxDim() { + setBoxDim(support_top_width,support_top_length,support_top_height); + }
} public static class SupportBottom extends BaseGeom {
- // point on axis of rotation on the inside of the c-support frame where the insert get's attached
+ // "bearings" are points on axis of rotation on the inside of the c-support frame where the insert get's attached
// this is referenced to the pin position of the c-support private static final double ball_pos_csup_bearings_bottom_x = 240.0 - 265.0 + 14.0; private static final double ball_pos_csup_bearings_bottom_y = (-6.0 + 22.0);
@@ -337,23 +400,12 @@
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(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));
+ super(name,mother,referenceGeom); + init();
}
- private void setPos() {
+ protected void setPos() {
System.out.printf("setPos support bottom\n");
@@ -401,11 +453,20 @@
printSurveyPos(); }
+ protected void setCoord() { + setCoord(null); + } + protected void setCenter() { + 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)); + } + protected void setBoxDim() { + setBoxDim(support_bottom_width,support_bottom_length,support_bottom_height); + }
}
- protected static class SupportPlate extends BaseGeom {
+ protected static abstract class SupportPlate extends BaseGeom {
protected static final double support_plate_pocket_depth = 6.65; // Tim's sketchup, drawing says 6.66mm? protected static final double pedestal_height_L1 = 11.00; protected static final double pedestal_height_L2 = 9.50;
@@ -429,17 +490,26 @@
protected static final double support_plate_bottom_height = 12.7; protected static final double support_plate_bottom_length = 736.1; protected static final double support_plate_bottom_width = 120.0;
-
public SupportPlateBottom(String name, BaseGeom mother) { super(mother,name);
+ init(); + } + protected void setPos() {
ballPos = new BasicHep3Vector(1.0, (17.0-5.0), 6.66+1.34); veePos = new BasicHep3Vector(ballPos.x() + support_plate_bottom_length, ballPos.y(),ballPos.z()); flatPos = new BasicHep3Vector(ballPos.x(), ballPos.y() + support_plate_bottom_length,ballPos.z());
- setCoord(); - setBoxDim(support_plate_bottom_width,support_plate_bottom_length,support_plate_bottom_height);
+ } + protected void setCoord() { + setCoord(null); + } + protected void setCenter() {
setCenter(support_plate_bottom_width/2.0, support_plate_bottom_length/2.0, -1.0 * support_plate_bottom_height/2.0); }
+ @Override + protected void setBoxDim() { + setBoxDim(support_plate_bottom_width,support_plate_bottom_length,support_plate_bottom_height); + }
}
@@ -453,14 +523,23 @@
public SupportPlateTop(String name, BaseGeom mother) { super(mother,name);
+ init(); + } + protected void setPos() {
ballPos = new BasicHep3Vector(1.0, (17.0-5.0), -1.0 * (6.66+1.34)); veePos = new BasicHep3Vector(ballPos.x() + support_plate_top_width, ballPos.y(),ballPos.z()); flatPos = new BasicHep3Vector(ballPos.x(), ballPos.y() + support_plate_top_length,ballPos.z());
- setCoord(); - setBoxDim(support_plate_top_width, support_plate_top_length, support_plate_top_height);
+ } + protected void setCoord() { + setCoord(null); + } + protected void setCenter() {
setCenter(support_plate_top_width/2.0, support_plate_top_length/2.0, support_plate_top_height/2.0);
-
}
+ @Override + protected void setBoxDim() { + setBoxDim(support_plate_top_width, support_plate_top_length, support_plate_top_height); + }
}
@@ -525,27 +604,17 @@
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();
+ init();
}
- public TestRunModule(String name, BaseGeom mother, BaseGeom reference, int layer, String half) { - super(name, mother,layer,half); - setReferenceGeom(reference); - setPos(); - setCoord(); - setBoxDim(); - setCenter();
+ public TestRunModule(String name, BaseGeom mother, BaseGeom ref, int layer, String half) { + super(name, mother,ref,layer,half); + init();
} protected abstract double getColdBlockThickness(); protected abstract double getModuleBoxLength();
@@ -554,14 +623,14 @@
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()));
+ setBoxDim(getModuleBoxLength(),getModuleBoxHeight(),getModuleBoxWidth());
}
-
+ protected void setCoord() { + setCoord(null); + }
protected void setCenter() { setCenter(getModuleBoxLength()/2.0-5.0, 0.0, getModuleBoxWidth()/2.0);
- } -
+ }
protected void setPos() { // bottom if(isBottom()) {
@@ -662,25 +731,31 @@
}
- public static class BaseModule extends BaseGeom {
+ public static abstract class BaseModule extends BaseGeom {
private int layer; private String half; public BaseModule(String name, BaseGeom mother, int layer, String half) { super(name, mother);
+ setLayer(layer); + setHalf(half); + isValid(); + } + public BaseModule(String name, BaseGeom mother, BaseGeom ref, int layer, String half) { + super(name, mother,ref); + setLayer(layer); + setHalf(half); + isValid(); + } + private void isValid() {
if(half!="bottom" && half!="top") {
- System.out.printf("ERROR invalid half %s\n",half);
+ System.out.printf("ERROR invalid half %s for BaseModule\n",half);
System.exit(1); }
- setLayer(layer); - setHalf(half);
}
- -
public int getLayer() { return layer; }
-
public void setLayer(int layer) { this.layer = layer; }
@@ -713,33 +788,31 @@
// 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 half_module_thickness = HPSTestRunTracker2014GeomDef.TestRunHalfModule.getHybridThickness() + HPSTestRunTracker2014GeomDef.TestRunHalfModule.getCFThickness() + HalfModuleLamination.getThickness();
+ protected static final double half_module_thickness = HPSTestRunTracker2014GeomDef.TestRunHalfModule.getHybridThickness() + HPSTestRunTracker2014GeomDef.TestRunHalfModule.getCFThickness() + HalfModuleLamination.kapton_thickness;
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() {
+ + protected 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.getThickness() + HPSTestRunTracker2014GeomDef.Sensor.getSensorThickness()/2.0);
+ double box_center_local_y = -1.0*HPSTestRunTracker2014GeomDef.TestRunHalfModule.getThickness()/2.0 + (HPSTestRunTracker2014GeomDef.TestRunHalfModule.getCFThickness() + HalfModuleLamination.kapton_thickness + 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); }
-
+ protected void setCoord() { + setCoord(null); + } + protected void setBoxDim() { + setBoxDim(getLength(), getThickness(), getWidth()); + }
public static double getCFThickness() { return CarbonFiber.cf_thickness; }
@@ -776,6 +849,7 @@
public TestRunHalfModuleAxial(String name, BaseGeom mother, int layer, String half) { super(name, mother, layer, half);
+ init();
} protected void setPos() {
@@ -783,7 +857,7 @@
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.getThickness() + HPSTestRunTracker2014GeomDef.Sensor.getSensorThickness()/2.0);
+ final double ball_pos_halfmod_axial_local_y = -1.0* (coldBlockThick/2.0 + TestRunHalfModule.getCFThickness() + HalfModuleLamination.kapton_thickness + 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;
@@ -796,7 +870,6 @@
flatPos = new BasicHep3Vector(flat_pos_halfmod_axial_local_x, flat_pos_halfmod_axial_local_y,flat_pos_halfmod_axial_local_z); }
-
}
@@ -804,6 +877,7 @@
public TestRunHalfModuleStereo(String name, BaseGeom mother, int layer, String half) { super(name, mother, layer, half);
+ init();
} protected void setPos() {
@@ -815,7 +889,7 @@
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.getThickness() + HPSTestRunTracker2014GeomDef.Sensor.getSensorThickness()/2.0));
+ final double ball_pos_halfmod_axial_local_y = -1.0 * (-1.0* (coldBlockThick/2.0 + TestRunHalfModule.getCFThickness() + HalfModuleLamination.kapton_thickness + 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;
@@ -833,11 +907,8 @@
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);
+ setLayer(layer); + init();
} protected abstract double getWidth(); protected abstract double getLength();
@@ -848,7 +919,13 @@
public void setLayer(int layer) { this.layer = layer; }
- private void setPos() {
+ protected void setCoord() { + setCoord(null); + } + protected void setCenter() { + setCenter(getLength()/2.0, 0.0, getWidth()/2.0); + } + protected 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
@@ -861,12 +938,13 @@
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);
-
}
+ protected void setBoxDim() { + setBoxDim(getLength(), getHeight(), getWidth()); + }
} public static class TestRunColdBlockL13 extends TestRunColdBlock {
@@ -922,10 +1000,7 @@
public Sensor(String name, BaseGeom m, int id) { super(name, m); this.id = id;
- setPos(); - setCoord(); - setCenter(0,0,0); - setBoxDim(getSensorLength(),getSensorThickness(),getSensorWidth());
+ init();
} public static double getSensorLength() { return sensor_length;
@@ -939,19 +1014,26 @@
public static double getSensorThickness() { return getSensorHeight(); }
- private void setPos() {
+ protected 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());
+ setVeePos(ballPos.x() + getSensorLength()/2.0, ballPos.y(), ballPos.z()); + setFlatPos(ballPos.x(),ballPos.y() + getSensorThickness()/2.0, ballPos.z());
}
+ protected void setCoord() { + setCoord(null); + }
public int getId() { return id; } public void setId(int id) { this.id = id; }
- -
+ protected void setCenter() { + setCenter(0,0,0); + } + protected void setBoxDim() { + setBoxDim(getSensorLength(),getSensorThickness(),getSensorWidth()); + }
} public static class ActiveSensor extends BaseGeom {
@@ -960,10 +1042,7 @@
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());
+ init();
} public static double getActiveSensorLength() { return sensor_active_length;
@@ -977,49 +1056,53 @@
public static double getActiveSensorThickness() { return getActiveSensorHeight(); }
- private void setPos() {
+ protected void setPos() {
ballPos = new BasicHep3Vector(0,0,0); veePos = new BasicHep3Vector(getActiveSensorWidth()/2.0,0,0); flatPos = new BasicHep3Vector(0,getActiveSensorLength()/2.0,0);
-
}
+ protected void setCoord() { + setCoord(null); + } + protected void setCenter() { + setCenter(0,0,0); + } + @Override + protected void setBoxDim() { + setBoxDim(getActiveSensorLength(),getActiveSensorThickness(),getActiveSensorWidth()); + }
} public static abstract class HalfModuleComponent extends BaseGeom { public HalfModuleComponent(String name, BaseGeom m) { super(name, m);
- setPos(); - setCoord();
}
- protected abstract void setPos();
protected abstract double getThickness(); protected abstract double getHeigth(); protected abstract double getWidth(); protected abstract double getLength();
- - - } - - public static class HalfModuleLamination extends BaseGeom {
+ protected void setCoord() { + setCoord(null); + } + } + + public static class HalfModuleLamination extends HalfModuleComponent {
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(getLength()/2.0, 0.0, getWidth()/2.0); - setBoxDim(getLength(),getThickness(),getWidth());
+ init();
}
- private void setPos() {
+ protected 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.getThickness()/2.0);
+ final double ball_pos_kapton_local_y = (HPSTestRunTracker2014GeomDef.Sensor.getSensorThickness()/2.0 + HalfModuleLamination.kapton_thickness/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.getThickness()/2.0; // arbitrary distance
+ final double flat_pos_kapton_local_y = ball_pos_kapton_local_y + HalfModuleLamination.kapton_thickness/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);
@@ -1027,18 +1110,24 @@
flatPos = new BasicHep3Vector(flat_pos_kapton_local_x,flat_pos_kapton_local_y,flat_pos_kapton_local_z); }
- public static double getThickness() {
+ protected void setCenter() { + setCenter(getLength()/2.0, 0.0, getWidth()/2.0); + } + protected double getThickness() {
return kapton_thickness; }
- public static double getHeight() {
+ protected double getHeigth() {
return getThickness(); }
- public static double getWidth() {
+ protected double getWidth() {
return kapton_width; }
- public static double getLength() {
+ protected double getLength() {
return kapton_length; }
+ protected void setBoxDim() { + setBoxDim(getLength(),getThickness(),getWidth()); + }
} public static class CarbonFiber extends HalfModuleComponent {
@@ -1047,12 +1136,11 @@
protected static final double cf_thickness = 0.250; public CarbonFiber(String name, BaseGeom m) { super(name, m);
- setCenter(getLength()/2.0, 0.0, getWidth()/2.0); - setBoxDim(getLength(),getThickness(),getWidth());
+ init();
} protected void setPos() { 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.HalfModuleLamination.getThickness() + HPSTestRunTracker2014GeomDef.TestRunHalfModule.getCFThickness()/2.0);
+ final double ball_pos_cf_local_y = (HPSTestRunTracker2014GeomDef.Sensor.getSensorThickness()/2.0 + HPSTestRunTracker2014GeomDef.HalfModuleLamination.kapton_thickness + 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;
@@ -1063,8 +1151,10 @@
setBallPos(ball_pos_cf_local_x,ball_pos_cf_local_y,ball_pos_cf_local_z); setVeePos(vee_pos_cf_local_x,vee_pos_cf_local_y,vee_pos_cf_local_z); setFlatPos(flat_pos_cf_local_x,flat_pos_cf_local_y,flat_pos_cf_local_z);
-
}
+ protected void setCenter() { + setCenter(getLength()/2.0, 0.0, getWidth()/2.0); + }
protected double getThickness() { return cf_thickness; }
@@ -1077,6 +1167,9 @@
protected double getHeigth() { return getThickness(); }
+ protected void setBoxDim() { + setBoxDim(getLength(),getThickness(),getWidth()); + }
}
@@ -1086,9 +1179,7 @@
protected static final double hybrid_thickness = 4.0/64.0*inch; public Hybrid(String name, BaseGeom m) { super(name, m);
- setCenter(getLength()/2.0, 0.0, getWidth()/2.0); - setBoxDim(getLength(),getThickness(), getWidth()); -
+ init();
} protected void setPos() { final double ball_pos_hybrid_local_x = -1 * (170.0 - HPSTestRunTracker2014GeomDef.Sensor.getSensorLength()/2.0);
@@ -1105,6 +1196,9 @@
setFlatPos(flat_pos_hybrid_local_x,flat_pos_hybrid_local_y,flat_pos_hybrid_local_z); }
+ protected void setCenter() { + setCenter(getLength()/2.0, 0.0, getWidth()/2.0); + }
protected double getThickness() { return hybrid_thickness; }
@@ -1117,8 +1211,20 @@
protected double getLength() { return hybrid_length; }
+ protected void setBoxDim() { + setBoxDim(getLength(),getThickness(), getWidth()); + }
}
+ + + + + /** + * + * Class that keeps tracks of unit vectors and origin for a 3D coordinate system. + * + */
public static class Coord { private Hep3Vector origin; private Hep3Vector u;
@@ -1134,8 +1240,7 @@
private void check() { if(u.magnitude()-1>0.00001 || v.magnitude()-1>0.00001 || v.magnitude()-1>0.00001) {
- System.out.printf("Error: this coordinate system is ill-defined\n%s\n",this.toString()); - System.exit(1);
+ throw new RuntimeException("Error: this coordinate system is ill-defined " + toString());
} }
@@ -1146,6 +1251,7 @@
Hep3Vector ball_to_flat = VecOp.sub(flat, ball); w = VecOp.unit(VecOp.cross(ball_to_vee,ball_to_flat)); v = VecOp.cross(w, u);
+ check();
} /* public void rotate(Hep3Vector euler_angles) {
Use REPLY-ALL to reply to list
To unsubscribe from the LCDET-SVN list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCDET-SVN&A=1