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/HPSTracker2014.java 2014-04-11 19:09:36 UTC (rev 3096)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker2014.java 2014-04-16 06:34:38 UTC (rev 3097)
@@ -38,7 +38,7 @@
*/
public class HPSTracker2014 extends LCDDSubdetector
{
- private boolean _debug = true;
+ private boolean _debug = false;
public static final double inch = 25.4;
private final double sensor_length= 98.33;
@@ -102,10 +102,25 @@
// Pick the mother volume (tracking volume).
Volume trackingVolume = lcdd.pickMotherVolume(this);
-
+ VolWrapper trackingWrap = new VolWrapper();
+ trackingWrap.name = "trackingVolume";
+ trackingWrap.vol = trackingVolume;
// create the box around the support plate: "support box"
+ makeSupport(trackingWrap, lcdd, sens );
+
+
+
+
+
+
+ }
+
+
+
+ private void makeSupport(VolWrapper trackingWrap, LCDD lcdd, SensitiveDetector sens) throws JDOMException {
+
final double support_length = 15.0*inch; // along z
final double support_width = 9.25*inch; // along x
final double support_height = 2.5*inch + 1.5*inch; // along y TODO made this up!
@@ -121,7 +136,7 @@
lcdd.add(pos);
lcdd.add(rot);
- PhysVol supportPV = new PhysVol(supportVolume, trackingVolume, pos, rot);
+ PhysVol supportPV = new PhysVol(supportVolume, trackingWrap.vol, pos, rot);
VolWrapper supportWrap = new VolWrapper();
supportWrap.vol = supportVolume;
@@ -140,58 +155,79 @@
Hep3Vector vee_pos_support_plate = new BasicHep3Vector(-1.0*ball_pos_support_plate.x(),ball_pos_support_plate.y(),ball_pos_support_plate.z());
Hep3Vector flat_pos_support_plate = new BasicHep3Vector(0.0,ball_pos_support_plate.y(),-0.5*support_length + 0.25*inch);
- VolWrapper supportPlateWrap = makeSupportPlate(supportWrap, ball_pos_support_plate, vee_pos_support_plate, flat_pos_support_plate, lcdd, sens );
+ makeSupportPlate(supportWrap, ball_pos_support_plate, vee_pos_support_plate, flat_pos_support_plate, lcdd, sens );
-
// create the module from positions of module ball, vee and flat w.r.t. support plate survey points
-
- final double module_ball_local_u = 7.7*inch;
- final double module_ball_local_v = 11.625*inch;
- // place module mounting surface at support plate surface
- // the kin mount on support plate is sunk into plate TODO check this!!
- final double module_ball_local_w = -0.3195*inch;
- Hep3Vector ball_pos_mod_local = new BasicHep3Vector(module_ball_local_u,module_ball_local_v,module_ball_local_w);
-
- final double module_vee_local_u = (support_width - (7.7+0.625)*inch ) - 0.625*inch;
- final double module_vee_local_v = module_ball_local_v;
- final double module_vee_local_w = module_ball_local_w;
- Hep3Vector vee_pos_mod_local = new BasicHep3Vector(module_vee_local_u,module_vee_local_v,module_vee_local_w);
- final double module_flat_local_u = (module_ball_local_u - module_vee_local_u) / 2.0 + module_vee_local_u;
- final double module_flat_local_v = module_ball_local_v + 0.5*inch;
- final double module_flat_local_w = module_ball_local_w;
- Hep3Vector flat_pos_mod_local = new BasicHep3Vector(module_flat_local_u,module_flat_local_v,module_flat_local_w);
-
-
- 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()));
-
// create the coordinate system of the support plate
CoordSysDef support_plate_coord = new CoordSysDef(ball_pos_support_plate, vee_pos_support_plate, flat_pos_support_plate);
Transform3D trans_support_plate_to_support = getTransformation(support_plate_coord);
+
- // transform to support frame
- 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);
- 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()));
+ print("Make modules on support plate");
- // make the module
- VolWrapper moduleWrap = makeModule(supportWrap, ball_pos_mod, vee_pos_mod, flat_pos_mod,lcdd, sens);
- supportWrap.daughters.add(moduleWrap);
+ for(int ilayer = 1; ilayer <=3; ++ilayer) {
+
+ String layerName = String.format("L%db", ilayer);
+
+ print(layerName);
+
+ final double module_ball_local_u = 7.7*inch;
+ double module_ball_local_v = 11.625*inch;
+ double offset = 0.;
+ if(ilayer == 2) {
+ offset = -100.0;
+ } else if(ilayer == 3) {
+ offset = -200.0;
+ }
+ module_ball_local_v = module_ball_local_v + offset;
+
+ // place module mounting surface at support plate surface
+ // the kin mount on support plate is sunk into plate TODO check this!!
+ final double module_ball_local_w = -0.3195*inch;
+ Hep3Vector ball_pos_mod_local = new BasicHep3Vector(module_ball_local_u,module_ball_local_v,module_ball_local_w);
+
+ final double module_vee_local_u = (support_width - (7.7+0.625)*inch ) - 0.625*inch;
+ final double module_vee_local_v = module_ball_local_v;
+ final double module_vee_local_w = module_ball_local_w;
+ Hep3Vector vee_pos_mod_local = new BasicHep3Vector(module_vee_local_u,module_vee_local_v,module_vee_local_w);
+
+ final double module_flat_local_u = (module_ball_local_u - module_vee_local_u) / 2.0 + module_vee_local_u;
+ final double module_flat_local_v = module_ball_local_v + 0.5*inch;
+ final double module_flat_local_w = module_ball_local_w;
+ Hep3Vector flat_pos_mod_local = new BasicHep3Vector(module_flat_local_u,module_flat_local_v,module_flat_local_w);
+
+ //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()));
+ //}
+
+ // transform to support frame
+ 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);
+ } // ilayer
// add support volume to lcdd
lcdd.add(supportVolume);
+
/*
@@ -242,24 +278,12 @@
} //i
-
-
-
-
-
-
-
*/
-
-
-
-
}
-
-
-
- private VolWrapper makeSupportPlate(VolWrapper supportWrap,
+
+
+ private void makeSupportPlate(VolWrapper supportWrap,
Hep3Vector ball_pos_support_plate,
Hep3Vector vee_pos_support_plate,
Hep3Vector flat_pos_support_plate, LCDD lcdd, SensitiveDetector sens) throws JDOMException {
@@ -317,23 +341,24 @@
supportPlateWrap.rot_vol = rot;
supportWrap.daughters.add(supportPlateWrap);
- return supportPlateWrap;
+
}
- private VolWrapper makeModule(VolWrapper supportWrap, Hep3Vector ball_pos_mod, Hep3Vector vee_pos_mod, Hep3Vector flat_pos_mod, LCDD lcdd, SensitiveDetector sens) throws JDOMException
+ private void makeModule(String name, VolWrapper supportWrap, Hep3Vector ball_pos_mod, Hep3Vector vee_pos_mod, Hep3Vector flat_pos_mod, LCDD lcdd, SensitiveDetector sens) throws JDOMException
{
print(String.format("----- makeModule() ------"));
- String moduleName = "module";
- //find the bounding box for the module
- //TODO get this box from Shawn
- final double x = 7*inch; // ~along sensors
- final double y = 1.0*inch; // ~perpendicular to sensors
- final double z = 2.5*inch; // ~height from support plate
+ String moduleName = "module_" + name;
+ // Find the bounding box for the module
+ //TODO find dimensions of this module box from Shawn
+ // Right now the box starts from the ball position and approximately encapsulates the two half-modules on the drawing
+ final double x = 8*inch; // ~along sensors
+ final double y = 0.526*inch + hybrid_thickness; // ~perpendicular to sensors
+ final double z = 1.543*inch + sensor_width/2.0 + sensor_length/2.0*0.1; // ~height from support plate
Box box = new Box(moduleName + "_box", x, y, z);
lcdd.add(box);
Volume moduleVolume = new Volume(moduleName + "_volume", box, lcdd.getMaterial("Vacuum"));
@@ -341,17 +366,21 @@
// create the coordinate system of the module in the support frame
CoordSysDef module_coord = new CoordSysDef(ball_pos_mod, vee_pos_mod, flat_pos_mod);
- print(String.format("module_coord:\n%s", module_coord.toString()));
-
+
+ if(_debug) {
+ print(String.format("module_coord:\n%s", module_coord.toString()));
+ }
+
VolWrapper moduleWrap = new VolWrapper();
moduleWrap.name = moduleName;
moduleWrap.vol = moduleVolume;
moduleWrap.mother = supportWrap;
moduleWrap.coord = module_coord;
- Hep3Vector box_center_local = new BasicHep3Vector(x/2.0-0.25*inch, y/2.0-0.224*inch, z/2.0);
+
+ // distance to the center of the box in the local coordinates
+ // TODO get these from Shawn
+ Hep3Vector box_center_local = new BasicHep3Vector(x/2.0-0.25*inch, y/2.0, z/2.0);
moduleWrap.center = box_center_local;
-
-
// Find the LCDD position and rotation of this module
Transform3D trans = getTransformation(module_coord); //.origin(), module_coord.u(), module_coord.v(), module_coord.w());
@@ -371,71 +400,86 @@
moduleWrap.pv = physVolume;
moduleWrap.pos_vol = pos;
moduleWrap.rot_vol = rot;
-
- print(String.format("module box center local %s",box_center_local.toString()));
- print(String.format("module box center %s",box_center.toString()));
+ if(_debug) {
+ print(String.format("module box center local %s",box_center_local.toString()));
+ print(String.format("module box center %s",box_center.toString()));
+ }
-
-
//Create the half modules
- // Find the coordinate system of the half-module w.r.t. to the module survey points
- // We are going to know the sensor center position w.r.t. module frame make half-module bounding box w.r.t. sensor center
+ // 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 frame 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.
+
+ // Start with stereo half-module
- // Place half-module dummy coordinate system
- // ball is at sensor corner on hybrid side at the bottom surface of the CF
- final double ball_pos_halfmod_local_u = 4.818*inch - sensor_length/2.0;
- final double ball_pos_halfmod_local_v = 0.224*inch - ( sensor_thickness + kapton_thickness + CF_thickness );
- final double ball_pos_halfmod_local_w = 1.543*inch - sensor_width/2;
+ final double ball_pos_halfmod_stereo_local_x = 4.818*inch;
+ final double ball_pos_halfmod_stereo_local_y = 0.526*inch - sensor_thickness/2.0;
+ final double ball_pos_halfmod_stereo_local_z = 1.543*inch;
+ 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_y = ball_pos_halfmod_stereo_local_y;
+ final double vee_pos_halfmod_stereo_local_z = ball_pos_halfmod_stereo_local_z;
+ 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);
- final double vee_pos_halfmod_local_u = ball_pos_halfmod_local_u + sensor_length;
- final double vee_pos_halfmod_local_v = ball_pos_halfmod_local_v;
- final double vee_pos_halfmod_local_w = ball_pos_halfmod_local_w ;
-
- final double flat_pos_halfmod_local_u = ball_pos_halfmod_local_u;
- final double flat_pos_halfmod_local_v = ball_pos_halfmod_local_v;
- final double flat_pos_halfmod_local_w = ball_pos_halfmod_local_w + sensor_width;
-
-
- Hep3Vector ball_pos_halfmod_local = new BasicHep3Vector(ball_pos_halfmod_local_u, ball_pos_halfmod_local_v, ball_pos_halfmod_local_w);
- Hep3Vector vee_pos_halfmod_local = new BasicHep3Vector(vee_pos_halfmod_local_u, vee_pos_halfmod_local_v,vee_pos_halfmod_local_w);
- Hep3Vector flat_pos_halfmod_local = new BasicHep3Vector(flat_pos_halfmod_local_u, flat_pos_halfmod_local_v,flat_pos_halfmod_local_w);
-
-
- if(this._debug) {
- print(String.format("ball_pos_halfmod_local %s", ball_pos_halfmod_local.toString()));
- print(String.format("vee_pos_halfmod_local %s", vee_pos_halfmod_local.toString()));
- print(String.format("flat_pos_halfmod_local %s", flat_pos_halfmod_local.toString()));
+
+ 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()));
}
- VolWrapper halfModuleWrap = makeHalfModule(moduleWrap, ball_pos_halfmod_local, vee_pos_halfmod_local, flat_pos_halfmod_local,lcdd,sens);
+ makeHalfModule("stereo",moduleWrap, ball_pos_halfmod_stereo_local, vee_pos_halfmod_stereo_local, flat_pos_halfmod_stereo_local,lcdd,sens);
- // add module volume to lcdd file
+ Hep3Vector ball_pos_halfmod_axial_local = new BasicHep3Vector(ball_pos_halfmod_stereo_local.x(),0.224*inch - sensor_thickness/2.0,ball_pos_halfmod_stereo_local.z());
+ Hep3Vector vee_pos_halfmod_axial_local = new BasicHep3Vector(ball_pos_halfmod_axial_local.x() + sensor_length/2.0, ball_pos_halfmod_axial_local.y(),ball_pos_halfmod_axial_local.z());
+ Hep3Vector flat_pos_halfmod_axial_local = new BasicHep3Vector(ball_pos_halfmod_axial_local.x(), ball_pos_halfmod_axial_local.y() + sensor_thickness/2.0,ball_pos_halfmod_axial_local.z());
+ /*
+ final double ball_pos_halfmod_axial_local_x = 4.818*inch;
+ final double ball_pos_halfmod_axial_local_y = 0.224*inch - sensor_thickness/2.0; // only difference!
+ final double ball_pos_halfmod_axial_local_z = 1.543*inch;
+ 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);
+*/
+
+
+ makeHalfModule("axial",moduleWrap, ball_pos_halfmod_axial_local, vee_pos_halfmod_axial_local, flat_pos_halfmod_axial_local,lcdd,sens);
+
+
moduleVolume.setVisAttributes(lcdd.getVisAttributes("ModuleVis"));
lcdd.add(moduleVolume);
-
-
- return moduleWrap;
}
- private VolWrapper makeHalfModule(VolWrapper moduleWrap, Hep3Vector ball_pos_halfmod, Hep3Vector vee_pos_halfmod, Hep3Vector flat_pos_halfmod, LCDD lcdd, SensitiveDetector sens) throws JDOMException {
+ 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 {
if(_debug) {
- print("--- makeHalfModule ---");
+ print("--- makeHalfModule " + side);
}
// the half-module box is built based on the location of the center of the sensor box
- String halfModuleName = "halfmodule";
+ String halfModuleName = moduleWrap.name + "_halfmodule_" + side;
//find the bounding box for the half module
- final double x = 4.818*inch + sensor_length/2.0; // ~along sensors, made this up TODO Fix this!
- final double y = CF_thickness + kapton_thickness + hybrid_thickness; //~ perpendicular to sensors
+ final double x = hybrid_length+sensor_length; //4.818*inch + 70.0/inch; //~along sensors, made this up TODO Fix this!
+ final double y = this.hybrid_thickness + this.CF_thickness + this.kapton_thickness; //2*(hybrid_thickness - sensor_thickness/2.0); //~ perpendicular to sensors
final double z = hybrid_width; // ~height in direction ~perpendicular to the support plate
Box box = new Box(halfModuleName + "Box", x, y, z);
@@ -443,11 +487,13 @@
Volume halfModuleVolume = new Volume(halfModuleName + "_volume", box, lcdd.getMaterial("Vacuum"));
CoordSysDef half_module_coord = new CoordSysDef(ball_pos_halfmod, vee_pos_halfmod, flat_pos_halfmod);
- // vector to the center of the half module box from ball position/origin
- double box_center_local_x = x/2.0 - ball_pos_halfmod.x(); // half-module starts, by construction, at ball position x of module
- double box_center_local_y = z/2.0;
- double box_center_local_z = y/2.0;
+
+ // vector to the center of the half module box from the module ball position
+ double box_center_local_x = -1.0 * ( (x - (hybrid_length + sensor_length))/2.0 + hybrid_length + sensor_length/2.0 - x/2.0);
+ double box_center_local_y = (y/2.0 - (CF_thickness + kapton_thickness + sensor_thickness/2.0));
+ double box_center_local_z = .0;
Hep3Vector box_center_local = new BasicHep3Vector( box_center_local_x, box_center_local_y, box_center_local_z);
+ //Hep3Vector box_center_local = new BasicHep3Vector( 0.,0.,0.);
if(_debug) {
print(String.format("half-module_coord:\n%s", half_module_coord.toString()));
}
@@ -462,13 +508,27 @@
- // Find the LCDD position and rotation of this module
+ // Find the LCDD position and rotation of this volume
+
Transform3D transToModuleCoord = getTransformation(half_module_coord);
Hep3Vector box_center_module_coord = transToModuleCoord.transformed(box_center_local);
- Hep3Vector box_center = VecOp.sub(box_center_module_coord, moduleWrap.center);
+ Hep3Vector lcdd_rot_angles;
+ if(side.equals("stereo")) {
+ lcdd_rot_angles = new BasicHep3Vector(0,0.1,0); //getLCDDRotation(survey_coord);
+ }
+ else {
+ lcdd_rot_angles = new BasicHep3Vector(0,0,0); //getLCDDRotation(survey_coord);
+ }
+
+ // find the displacement from the rotation around an arbitrary point in local coordinates
+ Hep3Vector box_center_module_coord_rot = getRotationDisplacement(ball_pos_halfmod, box_center_module_coord, lcdd_rot_angles);
+
+ // find the position of the center in the module box
+ Hep3Vector box_center = VecOp.sub(box_center_module_coord_rot, moduleWrap.center);
+ //Hep3Vector box_center = VecOp.sub(box_center_module_coord, moduleWrap.center);
+
+ // create the lcdd tags
Position pos = new Position(halfModuleName + "_position",box_center.x(), box_center.y(), box_center.z());
- //Position pos = new Position(volName + "_position",0,20.0,0);
- Hep3Vector lcdd_rot_angles = new BasicHep3Vector(0,0,0); //getLCDDRotation(survey_coord);
Rotation rot = new Rotation(halfModuleName + "_rotation",lcdd_rot_angles.x(), lcdd_rot_angles.y(), lcdd_rot_angles.z());
lcdd.add(pos);
lcdd.add(rot);
@@ -483,28 +543,58 @@
if(_debug) {
print(String.format("half module box center local %s", box_center_local.toString()));
print(String.format("half module box center in module coord %s", box_center_module_coord.toString()));
+ print(String.format("half module box center in module coord rot %s", box_center_module_coord_rot.toString()));
print(String.format("module box center in module coord %s", moduleWrap.center.toString()));
print(String.format("half module box center in module box %s", box_center.toString()));
}
- // create the half module components
-
- // the sensor survey points are the same as the half-module except it's at the surface of the sensor by construction
- Hep3Vector ball_pos_sensor_local = new BasicHep3Vector(0,0,CF_thickness + kapton_thickness + sensor_thickness);
- Hep3Vector vee_pos_sensor_local = new BasicHep3Vector(sensor_length, ball_pos_sensor_local.y(), ball_pos_sensor_local.z());
- Hep3Vector flat_pos_sensor_local = new BasicHep3Vector(ball_pos_sensor_local.x(), sensor_width, ball_pos_sensor_local.z());
-
+ // create the half module components based on the position of the sensor center in the half-module coordinates
+ // Note that the origin is the same and the unit vectors are parallel to the half-module
+
+ 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());
+
makeHalfModuleComponents(halfModuleWrap,ball_pos_sensor_local,vee_pos_sensor_local,flat_pos_sensor_local, lcdd, sens);
-
+ //set vis stuff
halfModuleVolume.setVisAttributes(lcdd.getVisAttributes("HalfModuleVis"));
lcdd.add(halfModuleVolume);
- return halfModuleWrap;
}
+ /**
+ * Find the displacement of a point when rotating around an arbitrary position
+ * @param origin_of_rotation
+ * @param point
+ * @param lcdd_rot_angles
+ * @return
+ */
+ private Hep3Vector getRotationDisplacement(Hep3Vector origin_of_rotation,
+ Hep3Vector point, Hep3Vector lcdd_rot_angles) {
+
+ // Find the vector from the center of rotation to the point
+ Hep3Vector s = VecOp.sub(point, origin_of_rotation );
+ //Apply the rotation to the vector
+ RotationGeant r = new RotationGeant(lcdd_rot_angles.x(), lcdd_rot_angles.y(), lcdd_rot_angles.z());
+ Hep3Vector s_prime = r.rotated(s);
+ // Find the displaced point
+ Hep3Vector point_rot = VecOp.add(origin_of_rotation, s_prime );
+ if(_debug) {
+ print("--- getRotationDisplacement---");
+ print(String.format("box_center_module_coord:\n%s", point.toString()));
+ print(String.format("ball_pos_halfmod:\n%s", origin_of_rotation.toString()));
+ print(String.format("s:\n%s", s.toString()));
+ print(String.format("r:\n%s", r.toString()));
+ print(String.format("s_prime:\n%s", s_prime.toString()));
+ print(String.format("box_center_module_coord_rot:\n%s", point_rot.toString()));
+ }
+ return point_rot;
+ }
+
+
private void makeHalfModuleComponents(VolWrapper halfModuleWrap, Hep3Vector ball_pos_sensor_local, Hep3Vector vee_pos_sensor_local, Hep3Vector flat_pos_sensor_local, LCDD lcdd, SensitiveDetector sens) throws JDOMException {
if(_debug) {
@@ -514,7 +604,7 @@
// add sensor
int sensor_number = 0;
- String sensorName = "halfmodule_sensor" + sensor_number;
+ String sensorName = halfModuleWrap.name + "_sensor" + sensor_number;
// Create the box solid for the component.
Box sensor_box = new Box(sensorName + "_box",sensor_length,sensor_thickness, sensor_width);
lcdd.add(sensor_box);
@@ -529,15 +619,18 @@
}
CoordSysDef sensor_coord = new CoordSysDef(ball_pos_sensor_local, vee_pos_sensor_local, flat_pos_sensor_local);
- print(String.format("sensor_coord:\n%s", sensor_coord.toString()));
+ if(_debug) {
+ print(String.format("sensor_coord:\n%s", sensor_coord.toString()));
+ }
// Find the LCDD position and rotation of this module
Transform3D transToHalfModuleCoord = getTransformation(sensor_coord);
- Hep3Vector sensor_box_center_local = new BasicHep3Vector(sensor_length/2.0, sensor_width/2.0, -1.0*sensor_thickness/2.0);
+ //Hep3Vector sensor_box_center_local = new BasicHep3Vector(sensor_length/2.0, sensor_width/2.0, -1.0*sensor_thickness/2.0);
+ Hep3Vector sensor_box_center_local = new BasicHep3Vector(0.,0.,0.);
Hep3Vector sensor_box_center_half_module_coord = transToHalfModuleCoord.transformed(sensor_box_center_local);
Hep3Vector sensor_box_center = VecOp.sub(sensor_box_center_half_module_coord, halfModuleWrap.center);
- Position pos = new Position(sensorName + "_position",sensor_box_center.x(), sensor_box_center.z(), sensor_box_center.y());
+ Position pos = new Position(sensorName + "_position",sensor_box_center.x(), sensor_box_center.y(), sensor_box_center.z());
//Position pos = new Position(volName + "_position",0,20.0,0);
Hep3Vector lcdd_rot_angles = new BasicHep3Vector(0,0,0); //getLCDDRotation(survey_coord);
Rotation rot = new Rotation(sensorName + "_rotation",lcdd_rot_angles.x(), lcdd_rot_angles.y(), lcdd_rot_angles.z());
@@ -588,7 +681,7 @@
// add the hybrid
- String hybrid_name = "halfmodule_hybrid" + sensor_number;
+ String hybrid_name = halfModuleWrap.name + "_hybrid" + sensor_number;
// Create the box solid for the component.
Box hybrid_box = new Box(hybrid_name + "_box",hybrid_length,hybrid_thickness, hybrid_width);
lcdd.add(hybrid_box);
@@ -596,12 +689,10 @@
// Create the volume for the module component.
Volume hybrid_volume = new Volume(hybrid_name + "_volume", hybrid_box,lcdd.getMaterial("G10"));
- // Place at the height of the kapton and back-to-back to sensor
+ // Place at the height of the sensor and back-to-back to sensor
final double hybrid_box_center_x = sensor_box_center.x() - sensor_length/2.0 - hybrid_length/2.0;
- final double hybrid_box_center_y = sensor_box_center.z() - sensor_thickness/2.0 + hybrid_thickness/2.0;
- final double hybrid_box_center_z = sensor_box_center.y();
- print(String.format("sensor box x %f sensor length %f hybrid length %f => hybrid_box_center_x %f",sensor_box_center.x(), sensor_length, hybrid_length, hybrid_box_center_x));
- print(String.format("sensor box y %f sensor th %f hybrid th %f => hybrid_box_center_y %f",sensor_box_center.z(), sensor_thickness, hybrid_thickness, hybrid_box_center_y));
+ final double hybrid_box_center_y = sensor_box_center.y() - sensor_thickness/2.0 + hybrid_thickness/2.0;
+ final double hybrid_box_center_z = sensor_box_center.z();
pos = new Position(hybrid_name + "_position",hybrid_box_center_x, hybrid_box_center_y, hybrid_box_center_z);
rot = new Rotation(hybrid_name + "_rotation", 0, 0, 0);
lcdd.add(pos);
@@ -627,14 +718,15 @@
// add the kapton
// fill the entire sensor length and width with kapton
- String kapton_name = "halfmodule_kapton" + sensor_number;
+ String kapton_name = halfModuleWrap.name + "_kapton" + sensor_number;
// Create the box solid for the component.
- Box kapton_box = new Box(kapton_name + "_box",sensor_length,kapton_thickness, sensor_width);
+ Box kapton_box = new Box(kapton_name + "_box",sensor_length+hybrid_length,kapton_thickness, sensor_width);
lcdd.add(kapton_box);
// Create the volume for the module component.
Volume kapton_volume = new Volume(kapton_name + "_volume", kapton_box,lcdd.getMaterial("Kapton"));
- pos = new Position(kapton_name + "_position", sensor_box_center.x(), sensor_box_center.z() - sensor_thickness/2.0 - kapton_thickness/2.0, sensor_box_center.y());
+ pos = new Position(kapton_name + "_position", sensor_box_center.x()-hybrid_length/2.0,
+ sensor_box_center.y() - sensor_thickness/2.0 - kapton_thickness/2.0, sensor_box_center.z());
rot = new Rotation(kapton_name + "_rotation", 0, 0, 0);
lcdd.add(pos);
lcdd.add(rot);
@@ -655,14 +747,16 @@
- String cf_name = "halfmodule_carbonfiber" + sensor_number;
+ String cf_name = halfModuleWrap.name + "_carbonfiber" + sensor_number;
// Create the box solid for the component.
- Box cf_box = new Box(cf_name + "_box",sensor_length,CF_thickness, sensor_width);
+ Box cf_box = new Box(cf_name + "_box",sensor_length+hybrid_length,CF_thickness, sensor_width);
lcdd.add(cf_box);
// Create the volume for the module component.
Volume cf_volume = new Volume(cf_name + "_volume", cf_box,lcdd.getMaterial("CarbonFiber"));
- pos = new Position(cf_name + "_position", sensor_box_center.x(), sensor_box_center.z() - sensor_thickness/2.0 - kapton_thickness - CF_thickness/2.0, sensor_box_center.y());
+ pos = new Position(cf_name + "_position", sensor_box_center.x()-hybrid_length/2.0,
+ sensor_box_center.y() - sensor_thickness/2.0 - kapton_thickness - CF_thickness/2.0,
+ sensor_box_center.z());
rot = new Rotation(cf_name + "_rotation", 0, 0, 0);
lcdd.add(pos);
lcdd.add(rot);
@@ -681,16 +775,6 @@
lcdd.add(cf_volume);
-
-
- print(String.format("sensor box y %f",sensor_box_center.z()));
- print(String.format("kapton box y %f",sensor_box_center.z() - sensor_thickness/2.0 - kapton_thickness/2.0));
- print(String.format("cf box y %f",sensor_box_center.z() - sensor_thickness/2.0 - kapton_thickness - CF_thickness/2.0));
-
-
-
-
-
}
@@ -699,7 +783,7 @@
- private VolWrapper makeEnvelope(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
+ private void makeEnvelope(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
Volume trackingVolume = lcdd.getTrackingVolume();
@@ -764,13 +848,12 @@
plateWrap.rot_vol = envelopePlateRotation;
plateWrap.mother = envWrap;
envWrap.daughters.add(plateWrap);
+ //RotationGeant g;
-
- return envWrap;
}
- private VolWrapper makeSupportPlate(VolWrapper envWrapper, LCDD lcdd, SensitiveDetector sens) throws JDOMException {
+ private void makeSupportPlate(VolWrapper envWrapper, LCDD lcdd, SensitiveDetector sens) throws JDOMException {
// Add a new support plate inside the envelope
// TODO add a volume aroundit
@@ -805,7 +888,6 @@
supportPlateWrap.mother = envWrapper;
envWrapper.daughters.add(supportPlateWrap);
- return supportPlateWrap;