Commit in projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim on MAIN | |||
detector/converter/compact/HPSTestRunTracker2014Converter.java | +1 | 3371 -> 3372 | |
geometry/compact/converter/AlignmentCorrection.java | +39 | added 3372 | |
/HPSTestRunTracker2014GeometryDefinition.java | +145 | -452 | 3371 -> 3372 |
/HPSTestRunTracker2014JavaBuilder.java | +12 | -9 | 3371 -> 3372 |
/HPSTestRunTracker2014LCDDBuilder.java | +9 | -8 | 3371 -> 3372 |
/HPSTrackerBuilder.java | +56 | -61 | 3371 -> 3372 |
/HPSTrackerJavaBuilder.java | -1 | 3371 -> 3372 | |
/HPSTrackerLCDDBuilder.java | +1 | -2 | 3371 -> 3372 |
/SurveyCoordinateSystem.java | +118 | added 3372 | |
/SurveyVolume.java | +209 | added 3372 | |
geometry/compact/converter/lcdd/HPSTestRunTracker2014.java | +2 | -1 | 3371 -> 3372 |
+592 | -534 |
Refactoring to better separate generic blocks and avoid too many large static nested classes.
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/converter/compact/HPSTestRunTracker2014Converter.java 2014-10-17 20:52:02 UTC (rev 3371) +++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/converter/compact/HPSTestRunTracker2014Converter.java 2014-10-17 23:03:49 UTC (rev 3372) @@ -67,6 +67,7 @@
// check tracking material trackingMaterial = MaterialStore.getInstance().get("Vacuum");
+ //trackingMaterial = MaterialStore.getInstance().get("Vacuum");
if(trackingMaterial==null) { System.out.printf("%s: error the tracking material was not found!\n", this.getClass().getSimpleName()); System.exit(1);
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/AlignmentCorrection.java (rev 0) +++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/AlignmentCorrection.java 2014-10-17 23:03:49 UTC (rev 3372) @@ -0,0 +1,39 @@
+package org.lcsim.geometry.compact.converter; + +import hep.physics.vec.Hep3Vector; + +import org.apache.commons.math3.geometry.euclidean.threed.Rotation; +import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; + +/** + * Class containing the final translation and rotation correction from alignment. + * + * @author Per Hansson Adrian <[log in to unmask]> + * + */ +public class AlignmentCorrection { + private Rotation rotation = null; + private Hep3Vector translation = null; + public AlignmentCorrection() { + } + public Rotation getRotation() { + return rotation; + } + public void setRotation(Rotation rotation) { + this.rotation = rotation; + } + public void setRotation(double rot_x, double rot_y, double rot_z) { + Rotation rx = new Rotation(new Vector3D(1,0,0),rot_x); + Rotation ry = new Rotation(new Vector3D(0,1,0),rot_y); + Rotation rz = new Rotation(new Vector3D(0,0,1),rot_z); + // Build full rotation + Rotation rzyx = rz.applyTo(ry.applyTo(rx)); + setRotation(rzyx); + } + public Hep3Vector getTranslation() { + return translation; + } + public void setTranslation(Hep3Vector translation) { + this.translation = translation; + } +}
\ No newline at end of file
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014GeometryDefinition.java 2014-10-17 20:52:02 UTC (rev 3371) +++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014GeometryDefinition.java 2014-10-17 23:03:49 UTC (rev 3372) @@ -3,10 +3,7 @@
*/ package org.lcsim.geometry.compact.converter;
-import hep.physics.vec.BasicHep3Matrix;
import hep.physics.vec.BasicHep3Vector;
-import hep.physics.vec.Hep3Vector; -import hep.physics.vec.VecOp;
import java.util.ArrayList; import java.util.List;
@@ -15,10 +12,6 @@
import org.apache.commons.math3.geometry.euclidean.threed.RotationOrder; import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; import org.jdom.Element;
-import org.lcsim.detector.Rotation3D; -import org.lcsim.detector.Transform3D; -import org.lcsim.detector.Translation3D; -import org.lcsim.geometry.util.TransformationUtils;
/** *
@@ -67,23 +60,23 @@
// Build the geometry from the basic building blocks in the geometry definition class // Keep the order correct. // Each item has knowledge of its mother but not its daughters
- HPSTestRunTracker2014GeometryDefinition.TrackingBase tracking = new HPSTestRunTracker2014GeometryDefinition.TrackingBase("trackingVolume",null);
+ TrackingVolume tracking = new TrackingVolume("trackingVolume",null);
geometries.add(tracking);
- HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope base = new HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope("base",tracking);
+ TrackerEnvelope base = new TrackerEnvelope("base",tracking);
geometries.add(base);
- HPSTestRunTracker2014GeometryDefinition.BasePlate basePlate = new HPSTestRunTracker2014GeometryDefinition.BasePlate("baseplate",base, "Aluminum");
+ BasePlate basePlate = new BasePlate("baseplate",base, "Aluminum");
geometries.add(basePlate);
- HPSTestRunTracker2014GeometryDefinition.CSupport cSupport = new HPSTestRunTracker2014GeometryDefinition.CSupport("c_support", base);
+ CSupport cSupport = new CSupport("c_support", base);
geometries.add(cSupport);
- HPSTestRunTracker2014GeometryDefinition.SupportBottom supportBottom = new HPSTestRunTracker2014GeometryDefinition.SupportBottom("support_bottom", base, cSupport);
+ SupportBottom supportBottom = new SupportBottom("support_bottom", base, cSupport);
geometries.add(supportBottom); // The support survey positions are now with respect to its mother and not the reference coord. system. // So to get the reference for the support plate I don't need to apply that extra transformation
- HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom supportPlateBottom = new HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom("support_plate_bottom", base, supportBottom, "Aluminum");
+ SupportPlateBottom supportPlateBottom = new SupportPlateBottom("support_plate_bottom", base, supportBottom, "Aluminum");
geometries.add(supportPlateBottom);
- HPSTestRunTracker2014GeometryDefinition.SupportTop supportTop = new HPSTestRunTracker2014GeometryDefinition.SupportTop("support_top", base, cSupport);
+ SupportTop supportTop = new SupportTop("support_top", base, cSupport);
geometries.add(supportTop);
- HPSTestRunTracker2014GeometryDefinition.SupportPlateTop supportPlateTop = new HPSTestRunTracker2014GeometryDefinition.SupportPlateTop("support_plate_top", base, supportTop, "Aluminum");
+ SupportPlateTop supportPlateTop = new SupportPlateTop("support_plate_top", base, supportTop, "Aluminum");
geometries.add(supportPlateTop); // Modules are built using an encapsulating class that keeps tracks of all components
@@ -126,27 +119,27 @@
// find the mother and reference geometry // Note that the reference geometry is the support plate and since that is assumed to be // created through it's references we don't need more than one reference to reach the mother coordinate system
- final HPSTestRunTracker2014GeometryDefinition.SurveyVolume mother; - final HPSTestRunTracker2014GeometryDefinition.SurveyVolume ref;
+ final SurveyVolume mother; + final SurveyVolume ref;
if(half == "bottom") {
- mother = getBaseGeometry(HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.class); - ref = getBaseGeometry(HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.class);
+ mother = getBaseGeometry(TrackerEnvelope.class); + ref = getBaseGeometry(SupportPlateBottom.class);
} else {
- mother= getBaseGeometry(HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.class); - ref = getBaseGeometry(HPSTestRunTracker2014GeometryDefinition.SupportPlateTop.class);
+ mother= getBaseGeometry(TrackerEnvelope.class); + ref = getBaseGeometry(SupportPlateTop.class);
} //Create the module
- HPSTestRunTracker2014GeometryDefinition.TestRunModule module;
+ TestRunModule module;
if(isL13) {
- module = new HPSTestRunTracker2014GeometryDefinition.TestRunModuleL13(volName, mother, ref, layer, half);
+ module = new TestRunModuleL13(volName, mother, ref, layer, half);
} else {
- module = new HPSTestRunTracker2014GeometryDefinition.TestRunModuleL45(volName, mother, ref, layer, half);
+ module = new TestRunModuleL45(volName, mother, ref, layer, half);
} // create the bundle for this module
- ModuleBundle bundle = new ModuleBundle(module);
+ TestRunModuleBundle bundle = new TestRunModuleBundle(module);
addModuleBundle(bundle); if(doAxial) makeHalfModule("axial", module);
@@ -167,7 +160,7 @@
* Create the cold block object. * @param mother to the cold block */
- private void makeColdBlock(HPSTestRunTracker2014GeometryDefinition.TestRunModule mother) {
+ private void makeColdBlock(TestRunModule mother) {
String moduleName = mother.getName();
@@ -181,12 +174,12 @@
int layer = getLayerFromVolumeName(moduleName); // Build the half-module
- HPSTestRunTracker2014GeometryDefinition.TestRunColdBlock coldBlock;
+ TestRunColdBlock coldBlock;
if(layer >= 1 && layer <=3) {
- coldBlock = new HPSTestRunTracker2014GeometryDefinition.TestRunColdBlockL13(volName, mother, layer);
+ coldBlock = new TestRunColdBlockL13(volName, mother, layer);
} else if(layer >= 4 && layer <=5) {
- coldBlock = new HPSTestRunTracker2014GeometryDefinition.TestRunColdBlockL45(volName, mother, layer);
+ coldBlock = new TestRunColdBlockL45(volName, mother, layer);
} else { throw new RuntimeException("wrong layer for " + volName); }
@@ -202,7 +195,7 @@
* @param side - stereo or axial * @param mother to the half-module */
- private void makeHalfModule(String side, HPSTestRunTracker2014GeometryDefinition.TestRunModule mother) {
+ private void makeHalfModule(String side, TestRunModule mother) {
String moduleName = mother.getName();
@@ -216,18 +209,18 @@
// find layer int layer = mother.getLayer();
- ModuleBundle bundle = getModuleBundle(mother); - HalfModuleBundle halfModuleBundle;
+ TestRunModuleBundle bundle = (TestRunModuleBundle)getModuleBundle(mother); + TestRunHalfModuleBundle halfModuleBundle;
// Build the half-module
- HPSTestRunTracker2014GeometryDefinition.TestRunHalfModule halfModule;
+ TestRunHalfModule halfModule;
if(side == "axial") {
- halfModule = new HPSTestRunTracker2014GeometryDefinition.TestRunHalfModuleAxial(volName, mother, layer, half); - halfModuleBundle = new HalfModuleBundle(halfModule);
+ halfModule = new TestRunHalfModuleAxial(volName, mother, layer, half); + halfModuleBundle = new TestRunHalfModuleBundle(halfModule);
bundle.halfModuleAxial = halfModuleBundle; } else if(side == "stereo") {
- halfModule = new HPSTestRunTracker2014GeometryDefinition.TestRunHalfModuleStereo(volName, mother, layer, half); - halfModuleBundle = new HalfModuleBundle(halfModule);
+ halfModule = new TestRunHalfModuleStereo(volName, mother, layer, half); + halfModuleBundle = new TestRunHalfModuleBundle(halfModule);
bundle.halfModuleStereo = halfModuleBundle; } else { throw new IllegalArgumentException("not a valid half-module side " + side);
@@ -251,7 +244,7 @@
- private void makeHalfModuleComponentHybrid(HPSTestRunTracker2014GeometryDefinition.TestRunHalfModule mother) {
+ private void makeHalfModuleComponentHybrid(TestRunHalfModule mother) {
if(isDebug()) System.out.printf("%s: makeHalfModuleComponentHybrid for %s \n", this.getClass().getSimpleName(), mother.getName());
@@ -262,10 +255,10 @@
// id is hard coded int component_number = 3;
- HPSTestRunTracker2014GeometryDefinition.Hybrid hybrid = new HPSTestRunTracker2014GeometryDefinition.Hybrid(volName,mother,component_number);
+ Hybrid hybrid = new Hybrid(volName,mother,component_number);
hybrid.setMaterial("G10");
- HalfModuleBundle hm = getHalfModuleBundle((HPSTestRunTracker2014GeometryDefinition.TestRunModule) mother.getMother(), mother.getName());
+ TestRunHalfModuleBundle hm = (TestRunHalfModuleBundle) getHalfModuleBundle((TestRunModule) mother.getMother(), mother.getName());
hm.hybrid = hybrid; if(isDebug()) System.out.printf("%s: added hybrid to half-module with name %s \n", this.getClass().getSimpleName(), hm.halfModule.getName());
@@ -275,7 +268,7 @@
- private void makeHalfModuleComponentCF(HPSTestRunTracker2014GeometryDefinition.TestRunHalfModule mother) {
+ private void makeHalfModuleComponentCF(TestRunHalfModule mother) {
if(isDebug()) System.out.printf("%s: makeHalfModuleComponentCF for %s \n", this.getClass().getSimpleName(), mother.getName());
@@ -287,10 +280,10 @@
// id is hard coded int component_number = 1;
- HPSTestRunTracker2014GeometryDefinition.CarbonFiber cf = new HPSTestRunTracker2014GeometryDefinition.CarbonFiber(volName,mother,component_number);
+ CarbonFiber cf = new CarbonFiber(volName,mother,component_number);
cf.setMaterial("CarbonFiber");
- HalfModuleBundle hm = getHalfModuleBundle((HPSTestRunTracker2014GeometryDefinition.TestRunModule) mother.getMother(), mother.getName());
+ TestRunHalfModuleBundle hm = (TestRunHalfModuleBundle) getHalfModuleBundle((TestRunModule) mother.getMother(), mother.getName());
hm.carbonFiber = cf; }
@@ -298,7 +291,7 @@
- private void makeHalfModuleComponentKapton(HPSTestRunTracker2014GeometryDefinition.TestRunHalfModule mother) {
+ private void makeHalfModuleComponentKapton(TestRunHalfModule mother) {
if(isDebug()) System.out.printf("%s: makeHalfModuleComponentKapton for %s \n", this.getClass().getSimpleName(), mother.getName());
@@ -309,17 +302,17 @@
// id is hard coded int component_number = 2;
- HPSTestRunTracker2014GeometryDefinition.HalfModuleLamination lamination = new HPSTestRunTracker2014GeometryDefinition.HalfModuleLamination(volName,mother,component_number);
+ HalfModuleLamination lamination = new HalfModuleLamination(volName,mother,component_number);
lamination.setMaterial("Kapton");
- HalfModuleBundle hm = getHalfModuleBundle((HPSTestRunTracker2014GeometryDefinition.TestRunModule) mother.getMother(), mother.getName());
+ TestRunHalfModuleBundle hm = (TestRunHalfModuleBundle) getHalfModuleBundle((TestRunModule) mother.getMother(), mother.getName());
hm.lamination = lamination; }
- private void makeHalfModuleComponentSensor(HPSTestRunTracker2014GeometryDefinition.TestRunHalfModule mother) {
+ private void makeHalfModuleComponentSensor(TestRunHalfModule mother) {
if(isDebug()) System.out.printf("%s: makeHalfModuleComponentSensor for %s \n", this.getClass().getSimpleName(), mother.getName());
@@ -329,10 +322,10 @@
int component_number = 0; //
- HPSTestRunTracker2014GeometryDefinition.Sensor sensor = new HPSTestRunTracker2014GeometryDefinition.Sensor(volName, mother, component_number);
+ Sensor sensor = new Sensor(volName, mother, component_number);
sensor.setMaterial("Silicon");
- HalfModuleBundle hm = getHalfModuleBundle((HPSTestRunTracker2014GeometryDefinition.TestRunModule) mother.getMother(), mother.getName());
+ TestRunHalfModuleBundle hm = (TestRunHalfModuleBundle) getHalfModuleBundle((TestRunModule) mother.getMother(), mother.getName());
hm.sensor = sensor;
@@ -342,16 +335,16 @@
}
- private void makeHalfModuleComponentActiveSensor(HPSTestRunTracker2014GeometryDefinition.Sensor mother) {
+ private void makeHalfModuleComponentActiveSensor(Sensor mother) {
if(isDebug()) System.out.printf("%s: makeHalfModuleComponentActiveSensor for %s \n", this.getClass().getSimpleName(), mother.getName()); String volName = mother.getName() + "_active";
- HPSTestRunTracker2014GeometryDefinition.ActiveSensor active_sensor = new HPSTestRunTracker2014GeometryDefinition.ActiveSensor(volName, mother);
+ ActiveSensor active_sensor = new ActiveSensor(volName, mother);
active_sensor.setMaterial("Silicon");
- HalfModuleBundle hm = getHalfModuleBundle((HPSTestRunTracker2014GeometryDefinition.TestRunModule) mother.getMother().getMother(), mother.getMother().getName());
+ TestRunHalfModuleBundle hm = (TestRunHalfModuleBundle) getHalfModuleBundle((TestRunModule) mother.getMother().getMother(), mother.getMother().getName());
hm.activeSensor = active_sensor; }
@@ -363,244 +356,10 @@
/**
- * Class containing the final translation and rotation from alignment corrections. - * - * @author Per Hansson Adrian <[log in to unmask]> - * - */ - public static class AlignmentCorrection { - private Rotation rotation = null; - private Hep3Vector translation = null; - public AlignmentCorrection() { - } - public Rotation getRotation() { - return rotation; - } - public void setRotation(Rotation rotation) { - this.rotation = rotation; - } - public void setRotation(double rot_x, double rot_y, double rot_z) { - Rotation rx = new Rotation(new Vector3D(1,0,0),rot_x); - Rotation ry = new Rotation(new Vector3D(0,1,0),rot_y); - Rotation rz = new Rotation(new Vector3D(0,0,1),rot_z); - // Build full rotation - Rotation rzyx = rz.applyTo(ry.applyTo(rx)); - setRotation(rzyx); - } - public Hep3Vector getTranslation() { - return translation; - } - public void setTranslation(Hep3Vector translation) { - this.translation = translation; - } - } - - - /** - * - * Base geometry class for generating volumes based on survey information. - * - */ - public static abstract class SurveyVolume { - protected boolean debug = false; - private String name; - private String material = "Vacuum"; - private SurveyVolume mother; - // 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 - protected List<SurveyVolume> referenceGeom = null; - private Coord coord; - protected Hep3Vector ballPos; - protected Hep3Vector veePos; - protected Hep3Vector flatPos; - private Hep3Vector center; - private Hep3Vector boxDim; - private AlignmentCorrection alignmentCorrections; - - public SurveyVolume(String name, SurveyVolume m) { - setName(name); - setMother(m); - } - public SurveyVolume(String name, SurveyVolume m, SurveyVolume ref) { - setName(name); - setMother(m); - addReferenceGeom(ref); - } - public SurveyVolume(String name, SurveyVolume m, List<SurveyVolume> ref) { - setName(name); - setMother(m); - addReferenceGeom(ref); - } - - protected abstract void setPos(); - protected abstract void setCoord(); - protected abstract void setCenter(); - protected abstract void setBoxDim(); - - protected void init() { - setPos(); - setCoord(); - setCenter(); - setBoxDim(); - applyGenericCoordinateSystemCorrections(); - applyAlignmentCorrections(); - } - - protected void applyGenericCoordinateSystemCorrections() { - //do nothing here unless overridden - } - - private void applyAlignmentCorrections() { - // Apply alignment corrections to local coordinate system that is already built - - if(this.coord==null) throw new RuntimeException("no coordinate system was set before trying to apply alignment corrections."); - - if(alignmentCorrections!=null) { - - if(debug) System.out.printf("%s: Apply alignment corrections to this coord system:\n%s\n",this.getClass().getSimpleName(),getCoord().toString()); - - // translate - if(alignmentCorrections.getTranslation()!=null) { - - if(debug) System.out.printf("%s: Apply translation %s to coordinate system\n", this.getClass().getSimpleName(),alignmentCorrections.getTranslation().toString()); - - getCoord().translate(alignmentCorrections.getTranslation()); - - } else { - if(debug) System.out.printf("%s: No translation to coordinate system\n", this.getClass().getSimpleName()); - } - - // rotate - if(alignmentCorrections.getRotation()!=null) { - - if(debug) { - System.out.printf("%s: Apply rotation to coordinate system. Matrix:\n", this.getClass().getSimpleName()); - double mat[][] = alignmentCorrections.getRotation().getMatrix(); - TransformationUtils.printMatrix(mat); - // Get the Cardan angles of the rotation - double res[] = alignmentCorrections.getRotation().getAngles(RotationOrder.ZYX); - // Since the rotation was created based on active transformations convert to passive right here. - // This conversion is simply to reverse the order of rotations. - Hep3Vector res_passive = new BasicHep3Vector(res[2],res[1],res[0]); - System.out.printf("%s: Corresponding LCDD Cardan angles:\n", this.getClass().getSimpleName(), res_passive.toString()); - } - - getCoord().rotateApache(alignmentCorrections.getRotation()); - - } else { - if(debug) System.out.printf("%s: No rotation to coordinate system\n", this.getClass().getSimpleName()); - } - - if(debug) System.out.printf("%s: coordinate system after alignment corrections:\n%s\n",this.getClass().getSimpleName(),getCoord().toString()); - - } else { - if(debug) System.out.printf("%s: No aligment corrections to coordinate system\n", this.getClass().getSimpleName()); - } - - } - - public void setBallPos(double x, double y, double z) { - ballPos = new BasicHep3Vector(x,y,z); - } - public void setVeePos(double x, double y, double z) { - veePos = new BasicHep3Vector(x,y,z); - } - public void setFlatPos(double x, double y, double z) { - flatPos = new BasicHep3Vector(x,y,z); - } - public Hep3Vector getBallPos() { - return ballPos; - } - public Hep3Vector getVeePos() { - return veePos; - } - public Hep3Vector getFlatPos() { - return flatPos; - } - 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!"); - } - if(origin!=null) { - coord = new Coord(origin, ballPos, veePos, flatPos); - } else { - coord = new Coord(ballPos, veePos, flatPos); - } - } - public Coord getCoord() { - if(coord == null) { - throw new RuntimeException("Need to setCoord!"); - } - return coord; - } - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public Hep3Vector getCenter() { - return center; - } - public void setCenter(Hep3Vector center) { - this.center = center; - } - public void setCenter(double x, double y, double z) { - this.center = new BasicHep3Vector(x,y,z); - } - public Hep3Vector getBoxDim() { - return boxDim; - } - public void setBoxDim(double x, double y, double z) { - this.boxDim = new BasicHep3Vector(x,y,z); - } - public SurveyVolume getMother() { - return mother; - } - public void setMother(SurveyVolume mother) { - this.mother = mother; - } - public void addReferenceGeom(SurveyVolume refGeom) { - if(refGeom!=null) { // check that it's not a dummy call - if(referenceGeom == null) { - referenceGeom = new ArrayList<SurveyVolume>(); - } - referenceGeom.add(refGeom); - } - } - public void addReferenceGeom(List<SurveyVolume> refGeomList) { - if(referenceGeom == null) { - referenceGeom = new ArrayList<SurveyVolume>(); - } - referenceGeom.addAll(refGeomList); - } - public void printSurveyPos() { - if(debug) System.out.printf("Survey pos for %s:\n",getName()); - if(debug) System.out.printf("ballPos %s\n", ballPos.toString()); - if(debug) System.out.printf("veePos %s\n", veePos.toString()); - if(debug) System.out.printf("flatPos %s\n", flatPos.toString()); - } - public String getMaterial() { - return material; - } - public void setMaterial(String material) { - this.material = material; - } - public String toString() { - String s = "BaseGeometry " + getName(); - s += "\n" + this.getCoord().toString(); - return s; - } - - } - - - /**
* Tracking volume geometry definition. */
- public static class TrackingBase extends SurveyVolume { - public TrackingBase(String name, SurveyVolume mother) {
+ public static class TrackingVolume extends SurveyVolume { + public TrackingVolume(String name, SurveyVolume mother) {
super(name,mother); init(); }
@@ -718,7 +477,7 @@
init(); } private void calcAndSetFlatPos() {
- if(HPSTestRunTracker2014GeometryDefinition.use30mradRotation) {
+ if(use30mradRotation) {
// find the rotation to place the flat point Rotation rot1_csup = new Rotation(
@@ -1175,29 +934,29 @@
if(isBottom()) { switch (getLayer()) { case 1:
- ballPos = new BasicHep3Vector(25.0, 661.1, HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.pedestal_height_L1-HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.support_plate_pocket_depth); - veePos = new BasicHep3Vector(95.0, 661.1, HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.pedestal_height_L1-HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.support_plate_pocket_depth); - flatPos = new BasicHep3Vector(60.0, 667.10, HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.pedestal_height_L1-HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.support_plate_pocket_depth);
+ ballPos = new BasicHep3Vector(25.0, 661.1, SupportPlateBottom.pedestal_height_L1-SupportPlateBottom.support_plate_pocket_depth); + veePos = new BasicHep3Vector(95.0, 661.1, SupportPlateBottom.pedestal_height_L1-SupportPlateBottom.support_plate_pocket_depth); + flatPos = new BasicHep3Vector(60.0, 667.10, SupportPlateBottom.pedestal_height_L1-SupportPlateBottom.support_plate_pocket_depth);
break; case 2:
- ballPos = new BasicHep3Vector(25.0, 561.1, HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.pedestal_height_L2-HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.support_plate_pocket_depth); - veePos = new BasicHep3Vector(95.0, 561.1, HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.pedestal_height_L2-HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.support_plate_pocket_depth); - flatPos = new BasicHep3Vector(60.0, 567.10, HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.pedestal_height_L2-HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.support_plate_pocket_depth);
+ ballPos = new BasicHep3Vector(25.0, 561.1, SupportPlateBottom.pedestal_height_L2-SupportPlateBottom.support_plate_pocket_depth); + veePos = new BasicHep3Vector(95.0, 561.1, SupportPlateBottom.pedestal_height_L2-SupportPlateBottom.support_plate_pocket_depth); + flatPos = new BasicHep3Vector(60.0, 567.10, SupportPlateBottom.pedestal_height_L2-SupportPlateBottom.support_plate_pocket_depth);
break; case 3:
- ballPos = new BasicHep3Vector(25.0, 461.1, HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.pedestal_height_L3-HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.support_plate_pocket_depth); - veePos = new BasicHep3Vector(95.0, 461.1, HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.pedestal_height_L3-HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.support_plate_pocket_depth); - flatPos = new BasicHep3Vector(60.0, 467.10, HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.pedestal_height_L3-HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.support_plate_pocket_depth);
+ ballPos = new BasicHep3Vector(25.0, 461.1, SupportPlateBottom.pedestal_height_L3-SupportPlateBottom.support_plate_pocket_depth); + veePos = new BasicHep3Vector(95.0, 461.1, SupportPlateBottom.pedestal_height_L3-SupportPlateBottom.support_plate_pocket_depth); + flatPos = new BasicHep3Vector(60.0, 467.10, SupportPlateBottom.pedestal_height_L3-SupportPlateBottom.support_plate_pocket_depth);
break; case 4:
- ballPos = new BasicHep3Vector(25.0, 261.1, HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.pedestal_height_L4-HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.support_plate_pocket_depth); - veePos = new BasicHep3Vector(95.0, 261.1, HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.pedestal_height_L4-HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.support_plate_pocket_depth); - flatPos = new BasicHep3Vector(60.0, 267.10, HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.pedestal_height_L4-HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.support_plate_pocket_depth);
+ ballPos = new BasicHep3Vector(25.0, 261.1, SupportPlateBottom.pedestal_height_L4-SupportPlateBottom.support_plate_pocket_depth); + veePos = new BasicHep3Vector(95.0, 261.1, SupportPlateBottom.pedestal_height_L4-SupportPlateBottom.support_plate_pocket_depth); + flatPos = new BasicHep3Vector(60.0, 267.10, SupportPlateBottom.pedestal_height_L4-SupportPlateBottom.support_plate_pocket_depth);
break; case 5:
- ballPos = new BasicHep3Vector(25.0, 61.1, HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.pedestal_height_L5-HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.support_plate_pocket_depth); - veePos = new BasicHep3Vector(95.0, 61.1, HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.pedestal_height_L5-HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.support_plate_pocket_depth); - flatPos = new BasicHep3Vector(60.0, 67.10, HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.pedestal_height_L5-HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.support_plate_pocket_depth);
+ ballPos = new BasicHep3Vector(25.0, 61.1, SupportPlateBottom.pedestal_height_L5-SupportPlateBottom.support_plate_pocket_depth); + veePos = new BasicHep3Vector(95.0, 61.1, SupportPlateBottom.pedestal_height_L5-SupportPlateBottom.support_plate_pocket_depth); + flatPos = new BasicHep3Vector(60.0, 67.10, SupportPlateBottom.pedestal_height_L5-SupportPlateBottom.support_plate_pocket_depth);
break; default: System.out.printf("ERROR invalid layer %d for half %s\n",getLayer(),getHalf());
@@ -1212,29 +971,29 @@
switch (getLayer()) { case 1:
- ballPos = new BasicHep3Vector(25.0, 676.1, -1.0 * (HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.pedestal_height_L1-HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.support_plate_pocket_depth)); - veePos = new BasicHep3Vector(95.0, 676.1, -1.0 * (HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.pedestal_height_L1-HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.support_plate_pocket_depth)); - flatPos = new BasicHep3Vector(60.0, 670.1, -1.0 * (HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.pedestal_height_L1-HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.support_plate_pocket_depth));
+ ballPos = new BasicHep3Vector(25.0, 676.1, -1.0 * (SupportPlateBottom.pedestal_height_L1-SupportPlateBottom.support_plate_pocket_depth)); + veePos = new BasicHep3Vector(95.0, 676.1, -1.0 * (SupportPlateBottom.pedestal_height_L1-SupportPlateBottom.support_plate_pocket_depth)); + flatPos = new BasicHep3Vector(60.0, 670.1, -1.0 * (SupportPlateBottom.pedestal_height_L1-SupportPlateBottom.support_plate_pocket_depth));
break; case 2:
- ballPos = new BasicHep3Vector(25.0, 576.1, -1.0 * (HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.pedestal_height_L2-HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.support_plate_pocket_depth)); - veePos = new BasicHep3Vector(95.0, 576.1, -1.0 * (HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.pedestal_height_L2-HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.support_plate_pocket_depth)); - flatPos = new BasicHep3Vector(60.0, 570.1, -1.0 * (HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.pedestal_height_L2-HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.support_plate_pocket_depth));
+ ballPos = new BasicHep3Vector(25.0, 576.1, -1.0 * (SupportPlateBottom.pedestal_height_L2-SupportPlateBottom.support_plate_pocket_depth)); + veePos = new BasicHep3Vector(95.0, 576.1, -1.0 * (SupportPlateBottom.pedestal_height_L2-SupportPlateBottom.support_plate_pocket_depth)); + flatPos = new BasicHep3Vector(60.0, 570.1, -1.0 * (SupportPlateBottom.pedestal_height_L2-SupportPlateBottom.support_plate_pocket_depth));
break; case 3:
- ballPos = new BasicHep3Vector(25.0, 476.1, -1.0 * (HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.pedestal_height_L3-HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.support_plate_pocket_depth)); - veePos = new BasicHep3Vector(95.0, 476.1, -1.0 * (HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.pedestal_height_L3-HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.support_plate_pocket_depth)); - flatPos =new BasicHep3Vector(60.0, 470.1, -1.0 * (HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.pedestal_height_L3-HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.support_plate_pocket_depth));
+ ballPos = new BasicHep3Vector(25.0, 476.1, -1.0 * (SupportPlateBottom.pedestal_height_L3-SupportPlateBottom.support_plate_pocket_depth)); + veePos = new BasicHep3Vector(95.0, 476.1, -1.0 * (SupportPlateBottom.pedestal_height_L3-SupportPlateBottom.support_plate_pocket_depth)); + flatPos =new BasicHep3Vector(60.0, 470.1, -1.0 * (SupportPlateBottom.pedestal_height_L3-SupportPlateBottom.support_plate_pocket_depth));
break; case 4:
- ballPos = new BasicHep3Vector(25.0, 276.1, -1.0 * (HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.pedestal_height_L4-HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.support_plate_pocket_depth)); - veePos = new BasicHep3Vector(95.0, 276.1, -1.0 * (HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.pedestal_height_L4-HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.support_plate_pocket_depth)); - flatPos = new BasicHep3Vector(60.0, 270.1, -1.0 * (HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.pedestal_height_L4-HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.support_plate_pocket_depth));
+ ballPos = new BasicHep3Vector(25.0, 276.1, -1.0 * (SupportPlateBottom.pedestal_height_L4-SupportPlateBottom.support_plate_pocket_depth)); + veePos = new BasicHep3Vector(95.0, 276.1, -1.0 * (SupportPlateBottom.pedestal_height_L4-SupportPlateBottom.support_plate_pocket_depth)); + flatPos = new BasicHep3Vector(60.0, 270.1, -1.0 * (SupportPlateBottom.pedestal_height_L4-SupportPlateBottom.support_plate_pocket_depth));
break; case 5:
- ballPos = new BasicHep3Vector(25.0, 76.1, -1.0 * (HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.pedestal_height_L5-HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.support_plate_pocket_depth)); - veePos = new BasicHep3Vector(95.0, 76.1, -1.0 * (HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.pedestal_height_L5-HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.support_plate_pocket_depth)); - flatPos = new BasicHep3Vector(60.0, 70.1, -1.0 * (HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.pedestal_height_L5-HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.support_plate_pocket_depth));
+ ballPos = new BasicHep3Vector(25.0, 76.1, -1.0 * (SupportPlateBottom.pedestal_height_L5-SupportPlateBottom.support_plate_pocket_depth)); + veePos = new BasicHep3Vector(95.0, 76.1, -1.0 * (SupportPlateBottom.pedestal_height_L5-SupportPlateBottom.support_plate_pocket_depth)); + flatPos = new BasicHep3Vector(60.0, 70.1, -1.0 * (SupportPlateBottom.pedestal_height_L5-SupportPlateBottom.support_plate_pocket_depth));
break; default: System.out.printf("ERROR invalid layer %d for half %s\n",getLayer(),getHalf());
@@ -1332,9 +1091,9 @@
// 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 = HPSTestRunTracker2014GeometryDefinition.TestRunHalfModule.getHybridThickness() + HPSTestRunTracker2014GeometryDefinition.TestRunHalfModule.getCFThickness() + HalfModuleLamination.kapton_thickness; - protected static final double half_module_length = HPSTestRunTracker2014GeometryDefinition.TestRunHalfModule.getCFLength(); - protected static final double half_module_width = 6.83 + HPSTestRunTracker2014GeometryDefinition.Sensor.getSensorWidth();
+ protected static final double half_module_thickness = TestRunHalfModule.getHybridThickness() + TestRunHalfModule.getCFThickness() + HalfModuleLamination.kapton_thickness; + protected static final double half_module_length = TestRunHalfModule.getCFLength(); + protected static final double half_module_width = 6.83 + Sensor.getSensorWidth();
protected double stereo_angle = 0.0;
@@ -1347,9 +1106,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 = HPSTestRunTracker2014GeometryDefinition.TestRunHalfModule.getLength()/2.0 - ( (170.00 + 10.00) - HPSTestRunTracker2014GeometryDefinition.Sensor.getSensorLength()/2.0); - double box_center_local_y = -1.0*HPSTestRunTracker2014GeometryDefinition.TestRunHalfModule.getThickness()/2.0 + (HPSTestRunTracker2014GeometryDefinition.TestRunHalfModule.getCFThickness() + HalfModuleLamination.kapton_thickness + HPSTestRunTracker2014GeometryDefinition.Sensor.getSensorThickness()/2.0); - double box_center_local_z = HPSTestRunTracker2014GeometryDefinition.TestRunHalfModule.getWidth()/2.0 - ( 12.66 - (8.83 -3.00) + HPSTestRunTracker2014GeometryDefinition.Sensor.getSensorWidth()/2.0 );
+ double box_center_local_x = TestRunHalfModule.getLength()/2.0 - ( (170.00 + 10.00) - Sensor.getSensorLength()/2.0); + double box_center_local_y = -1.0*TestRunHalfModule.getThickness()/2.0 + (TestRunHalfModule.getCFThickness() + HalfModuleLamination.kapton_thickness + Sensor.getSensorThickness()/2.0); + double box_center_local_z = TestRunHalfModule.getWidth()/2.0 - ( 12.66 - (8.83 -3.00) + Sensor.getSensorWidth()/2.0 );
setCenter(box_center_local_x, box_center_local_y, box_center_local_z); } protected void setCoord() {
@@ -1408,8 +1167,8 @@
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; double ball_pos_halfmod_local_x = dist_sensor_center_to_coldblock_hole_vdir;
- double ball_pos_halfmod_local_y = -1.0* (coldBlockThick/2.0 + TestRunHalfModule.getCFThickness() + HalfModuleLamination.kapton_thickness + HPSTestRunTracker2014GeometryDefinition.Sensor.getSensorThickness()/2.0); - if(HPSTestRunTracker2014GeometryDefinition.useFakeHalfModuleAxialPos) {
+ double ball_pos_halfmod_local_y = -1.0* (coldBlockThick/2.0 + TestRunHalfModule.getCFThickness() + HalfModuleLamination.kapton_thickness + Sensor.getSensorThickness()/2.0); + if(useFakeHalfModuleAxialPos) {
ball_pos_halfmod_local_x = ball_pos_halfmod_local_x*2.0; ball_pos_halfmod_local_y = -2.0*ball_pos_halfmod_local_y; }
@@ -1448,7 +1207,7 @@
final double ball_pos_halfmod_local_x = dist_sensor_center_to_coldblock_hole_vdir; // note minus sign to separate from axial
- final double ball_pos_halfmod_local_y = -1.0 * (-1.0* (coldBlockThick/2.0 + TestRunHalfModule.getCFThickness() + HalfModuleLamination.kapton_thickness + HPSTestRunTracker2014GeometryDefinition.Sensor.getSensorThickness()/2.0));
+ final double ball_pos_halfmod_local_y = -1.0 * (-1.0* (coldBlockThick/2.0 + TestRunHalfModule.getCFThickness() + HalfModuleLamination.kapton_thickness + Sensor.getSensorThickness()/2.0));
final double ball_pos_halfmod_local_z = dist_lower_sensor_edge_to_cold_block_mounting_surface + Sensor.getSensorWidth()/2.0; final double vee_pos_halfmod_local_x = ball_pos_halfmod_local_x + Sensor.getSensorLength()/2.0; final double vee_pos_halfmod_local_y = ball_pos_halfmod_local_y;
@@ -1606,7 +1365,7 @@
return getSensorHeight(); } protected void setPos() {
- if(HPSTestRunTracker2014GeometryDefinition.useSiStripsConvention) {
+ if(useSiStripsConvention) {
setBallPos(0,0,0); setVeePos(ballPos.x(), ballPos.y(), ballPos.z() + getSensorWidth()/2.0); setFlatPos(ballPos.x() + getSensorLength()/2.0,ballPos.y(), ballPos.z());
@@ -1623,7 +1382,7 @@
setCenter(0,0,0); } protected void setBoxDim() {
- if(HPSTestRunTracker2014GeometryDefinition.useSiStripsConvention) {
+ if(useSiStripsConvention) {
setBoxDim(getSensorWidth(),getSensorLength(),getSensorThickness()); } else { setBoxDim(getSensorLength(),getSensorThickness(),getSensorWidth());
@@ -1664,7 +1423,7 @@
return getActiveSensorHeight(); } protected void setPos() {
- if(HPSTestRunTracker2014GeometryDefinition.useSiStripsConvention) {
+ if(useSiStripsConvention) {
ballPos = new BasicHep3Vector(0,0,0); veePos = new BasicHep3Vector(getActiveSensorWidth()/2.0,0,0); flatPos = new BasicHep3Vector(0,getActiveSensorLength()/2.0,0);
@@ -1682,7 +1441,7 @@
} @Override protected void setBoxDim() {
- if(HPSTestRunTracker2014GeometryDefinition.useSiStripsConvention) {
+ if(useSiStripsConvention) {
setBoxDim(getActiveSensorWidth(), getActiveSensorLength(), getActiveSensorThickness()); } else { setBoxDim(getActiveSensorLength(),getActiveSensorThickness(),getActiveSensorWidth());
@@ -1717,9 +1476,9 @@
init(); } protected void setPos() {
- final double ball_pos_kapton_local_x = -1 * (180.0 - HPSTestRunTracker2014GeometryDefinition.Sensor.getSensorLength()/2.0) + 8.5; - final double ball_pos_kapton_local_y = (HPSTestRunTracker2014GeometryDefinition.Sensor.getSensorThickness()/2.0 + HalfModuleLamination.kapton_thickness/2.0); - final double ball_pos_kapton_local_z = -1 * (HPSTestRunTracker2014GeometryDefinition.Sensor.getSensorWidth()/2.0 + 12.66) + 8.83 - 3.00 + 6.00 ;
+ final double ball_pos_kapton_local_x = -1 * (180.0 - Sensor.getSensorLength()/2.0) + 8.5; + final double ball_pos_kapton_local_y = (Sensor.getSensorThickness()/2.0 + HalfModuleLamination.kapton_thickness/2.0); + final double ball_pos_kapton_local_z = -1 * (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;
@@ -1761,14 +1520,14 @@
init(); } protected void setPos() {
- final double ball_pos_cf_local_x = -1 * (180.0 - HPSTestRunTracker2014GeometryDefinition.Sensor.getSensorLength()/2.0); - final double ball_pos_cf_local_y = (HPSTestRunTracker2014GeometryDefinition.Sensor.getSensorThickness()/2.0 + HPSTestRunTracker2014GeometryDefinition.HalfModuleLamination.kapton_thickness + HPSTestRunTracker2014GeometryDefinition.TestRunHalfModule.getCFThickness()/2.0); - final double ball_pos_cf_local_z = -1 * (HPSTestRunTracker2014GeometryDefinition.Sensor.getSensorWidth()/2.0 + 12.66) + 8.83 - 3.00;
+ final double ball_pos_cf_local_x = -1 * (180.0 - Sensor.getSensorLength()/2.0); + final double ball_pos_cf_local_y = (Sensor.getSensorThickness()/2.0 + HalfModuleLamination.kapton_thickness + TestRunHalfModule.getCFThickness()/2.0); + final double ball_pos_cf_local_z = -1 * (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 + HPSTestRunTracker2014GeometryDefinition.TestRunHalfModule.getCFThickness()/2.0; // arbitrary distance
+ final double flat_pos_cf_local_y = ball_pos_cf_local_y + TestRunHalfModule.getCFThickness()/2.0; // arbitrary distance
final double flat_pos_cf_local_z = ball_pos_cf_local_z; 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);
@@ -1796,22 +1555,22 @@
public static class Hybrid extends HalfModuleComponent {
- protected static final double hybrid_length = 170.0 - HPSTestRunTracker2014GeometryDefinition.Sensor.getSensorLength(); // sensor b-to-b with hybrid - protected static final double hybrid_width = HPSTestRunTracker2014GeometryDefinition.Sensor.getSensorWidth();
+ protected static final double hybrid_length = 170.0 - Sensor.getSensorLength(); // sensor b-to-b with hybrid + protected static final double hybrid_width = Sensor.getSensorWidth();
protected static final double hybrid_thickness = 4.0/64.0*inch; public Hybrid(String name, SurveyVolume m, int id) { super(name, m, id); init(); } protected void setPos() {
- final double ball_pos_hybrid_local_x = -1 * (170.0 - HPSTestRunTracker2014GeometryDefinition.Sensor.getSensorLength()/2.0); - final double ball_pos_hybrid_local_y = (HPSTestRunTracker2014GeometryDefinition.Sensor.getSensorThickness()/2.0 - HPSTestRunTracker2014GeometryDefinition.TestRunHalfModule.getHybridThickness()/2.0); - final double ball_pos_hybrid_local_z = -1 * (HPSTestRunTracker2014GeometryDefinition.Sensor.getSensorWidth()/2.0);
+ final double ball_pos_hybrid_local_x = -1 * (170.0 - Sensor.getSensorLength()/2.0); + final double ball_pos_hybrid_local_y = (Sensor.getSensorThickness()/2.0 - TestRunHalfModule.getHybridThickness()/2.0); + final double ball_pos_hybrid_local_z = -1 * (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 + HPSTestRunTracker2014GeometryDefinition.TestRunHalfModule.getHybridThickness()/2.0; // arbitrary distance
+ final double flat_pos_hybrid_local_y = ball_pos_hybrid_local_y + TestRunHalfModule.getHybridThickness()/2.0; // arbitrary distance
final double flat_pos_hybrid_local_z = ball_pos_hybrid_local_z; setBallPos(ball_pos_hybrid_local_x,ball_pos_hybrid_local_y,ball_pos_hybrid_local_z); setVeePos(vee_pos_hybrid_local_x,vee_pos_hybrid_local_y,vee_pos_hybrid_local_z);
@@ -1837,121 +1596,55 @@
setBoxDim(getLength(),getThickness(), getWidth()); } }
- - - - - - /** - * - * Class that keeps tracks of unit vectors and origin for a 3D coordinate system. - * - */ - public static class Coord { - private final boolean debug = false; - private Hep3Vector origin; - private Hep3Vector u; - private Hep3Vector v; - private Hep3Vector w;
- public Coord(Hep3Vector org, Hep3Vector unit_x, Hep3Vector unit_y, Hep3Vector unit_z) { - origin = org; - u = unit_x; - v = unit_y; - w = unit_z; - }
- public Coord(Hep3Vector ball, Hep3Vector vee, Hep3Vector flat) { - origin = ball; - Hep3Vector ball_to_vee = VecOp.sub(vee, ball); - u = VecOp.unit(ball_to_vee); - 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(); - } - - private void check() { - checkUnitLength(); - checkAngles(); - }
+ + public static class TestRunModuleBundle extends ModuleBundle { + TestRunModuleBundle(TestRunModule m) { + module = m; + } + public int getLayer() { + if(module==null) throw new RuntimeException("Need to add module to bundle first!"); + return HPSTrackerBuilder.getLayerFromVolumeName(module.getName()); + } + public String getHalf() { + if(module==null) throw new RuntimeException("Need to add module to bundle first!"); + return HPSTrackerBuilder.getHalfFromName(module.getName()); + } + /** + * Find mother to this module. + * @return mother + */ + public SurveyVolume getMother() { + if(module==null) throw new RuntimeException("Need to add module to bundle first!"); + return module.getMother(); + } + public void print() { + if(module!=null) System.out.printf("%s: %s\n", this.getClass().getSimpleName(),module.getName()); + if(halfModuleAxial!=null) halfModuleAxial.print(); + if(coldBlock!=null)System.out.printf("%s: %s\n", this.getClass().getSimpleName(),coldBlock.getName()); + if(halfModuleStereo!=null) halfModuleStereo.print(); + } + }
- private void checkUnitLength() { - if(u.magnitude()-1>0.00001 || v.magnitude()-1>0.00001 || v.magnitude()-1>0.00001) { - throw new RuntimeException("Error: the unit vectors of the coordinate system is ill-defined " + toString()); - } - }
- private void checkAngles() { - if( (VecOp.dot(u, v)-1)>0.00001 || (VecOp.dot(u, w)-1)>0.00001 || (VecOp.dot(v, w)-1)>0.00001 ) { - throw new RuntimeException("Error: the angles in coordinate system is ill-defined " + toString()); - } - } - - public void rotateApache(Rotation r) { - if(debug) System.out.printf("%s: apply apache rotation to this coord system\n%s\n", getClass().getSimpleName(),toString()); - this.u = new BasicHep3Vector(r.applyTo(new Vector3D(u.v())).toArray()); - this.v = new BasicHep3Vector(r.applyTo(new Vector3D(v.v())).toArray()); - this.w = new BasicHep3Vector(r.applyTo(new Vector3D(w.v())).toArray()); - if(debug) System.out.printf("%s: new coord system after apache rotation to this coord system\n%s\n", getClass().getSimpleName(),toString()); - }
+ public static class TestRunHalfModuleBundle extends HalfModuleBundle { + public SurveyVolume sensor = null; + public SurveyVolume activeSensor = null; + protected SurveyVolume lamination = null; + protected SurveyVolume carbonFiber = null; + protected SurveyVolume hybrid = null; + TestRunHalfModuleBundle(TestRunHalfModule hm) { + halfModule = hm; + } + public void print() { + System.out.printf("%s: %s\n", this.getClass().getSimpleName(),halfModule.getName()); + } + }
- - /* - public void rotate(Hep3Vector euler_angles) { - RotationGeant rotation = new RotationGeant(euler_angles.x(), euler_angles.y(), euler_angles.z()); - rotation.rotate(u); - rotation.rotate(v); - rotation.rotate(w); - } - */ - public void translate(Hep3Vector translation) { - // update origin with local translation in u,v,w - origin = VecOp.add(origin, translation); - } - public Hep3Vector origin() { - return origin; - } - public Hep3Vector u() { - return u; - } - public Hep3Vector v() { - return v; - } - public Hep3Vector w() { - return w; - } - - public String toString() { - return "Coordinate system: \norigin " + origin.toString() + "\nu " + u.toString() + "\nv " + v.toString() + "\nw " + w.toString(); - } - - - /** - * Find @ITransform3D to the coordinate system defined by the input. - * @return resulting 3D transform - */ - public Transform3D getTransformation() { - // Find the transform between the two frames - use transform classes here (not really needed) - Translation3D translation = new Translation3D(origin.x(), origin.y(), origin.z()); - //RotationGeant trackingToEnvelopeRotation = new RotationGeant(0, 0, 0); - Rotation3D rotation = new Rotation3D( - new BasicHep3Matrix( - u.x(),v.x(),w.x(), - u.y(),v.y(),w.y(), - u.z(),v.z(),w.z() - )); - Transform3D envelopeToSupportTransform = new Transform3D(translation, rotation); - return envelopeToSupportTransform; - }
- - }
- - -
}
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014JavaBuilder.java 2014-10-17 20:52:02 UTC (rev 3371) +++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014JavaBuilder.java 2014-10-17 23:03:49 UTC (rev 3372) @@ -7,13 +7,16 @@
import org.jdom.Element; import org.lcsim.detector.ILogicalVolume;
+import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.Sensor; +import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TestRunHalfModuleBundle; +import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TestRunModuleBundle;
import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope; import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.BasePlate; import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.SupportBottom; import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom; import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.SupportPlateTop; import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.SupportTop;
-import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TrackingBase;
+import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TrackingVolume;
import org.lcsim.geometry.compact.converter.HPSTrackerBuilder.HalfModuleBundle; import org.lcsim.geometry.compact.converter.HPSTrackerBuilder.ModuleBundle;
@@ -62,7 +65,7 @@
java_objects = new ArrayList<JavaBaseGeometry>(); // Go through the list of volumes to build that is created in the generic builder class
- JavaBaseGeometry trackingGeometry = new JavaBaseGeometry(_builder.getBaseGeometry(TrackingBase.class), trackingVolume);
+ JavaBaseGeometry trackingGeometry = new JavaBaseGeometry(_builder.getBaseGeometry(TrackingVolume.class), trackingVolume);
add(trackingGeometry); //setBaseTrackerGeometry(new GhostJavaBaseGeom(_builder.getBaseGeometry(Base.class), trackingGeometry)); setBaseTrackerGeometry(new JavaBaseGeometry(_builder.getBaseGeometry(TrackerEnvelope.class), trackingGeometry,1));
@@ -86,8 +89,8 @@
if(isDebug()) System.out.printf("%s: build JAVA modules\n", getClass().getSimpleName()); // Loop over all modules created
- for(ModuleBundle m : _builder.modules) { -
+ for(ModuleBundle mod : _builder.modules) { + TestRunModuleBundle m = (TestRunModuleBundle) mod;
if(isDebug()) { System.out.printf("%s: build module %s (layer %d half %s)\n", getClass().getSimpleName(),m.module.getName(),m.getLayer(),m.getHalf()); m.print();
@@ -139,7 +142,7 @@
* @param bundle - module to be added * @param mother - mother JAVA geometry object */
- private void addModule(ModuleBundle bundle, JavaBaseGeometry mother) {
+ private void addModule(TestRunModuleBundle bundle, JavaBaseGeometry mother) {
if(isDebug()) { System.out.printf("%s: addModule %s containing:\n",this.getClass().getSimpleName(), bundle.module.getName());
@@ -151,8 +154,8 @@
add(lcddM); // add half modules
- if(bundle.halfModuleAxial!=null) addHalfModule(bundle.halfModuleAxial,lcddM); - if(bundle.halfModuleStereo!=null) addHalfModule(bundle.halfModuleStereo,lcddM);
+ if(bundle.halfModuleAxial!=null) addHalfModule((TestRunHalfModuleBundle)bundle.halfModuleAxial,lcddM); + if(bundle.halfModuleStereo!=null) addHalfModule((TestRunHalfModuleBundle)bundle.halfModuleStereo,lcddM);
if(isDebug()) {
@@ -167,7 +170,7 @@
* @param bundle - module to be added * @param mother - mother JAVA geometry object */
- private void addHalfModule(HalfModuleBundle bundle, JavaBaseGeometry mother) {
+ private void addHalfModule(TestRunHalfModuleBundle bundle, JavaBaseGeometry mother) {
// Create the half-module // This is not a ghost element but reflects the module // concept in the old compact description
@@ -178,7 +181,7 @@
// ComponentNumber is taken from old geometry where it is simply a counter when adding the xml daughters to the TestRunModule. // It is simply 0 for sensor and 1 for carbon fiber in the old geometry
- int componentNumber = bundle.sensor.getId();
+ int componentNumber = ((Sensor)bundle.sensor).getId();
// create the sensor JavaBaseGeometry lcddS = new JavaBaseGeometry(bundle.sensor, lcddHM, componentNumber);
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014LCDDBuilder.java 2014-10-17 20:52:02 UTC (rev 3371) +++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014LCDDBuilder.java 2014-10-17 23:03:49 UTC (rev 3372) @@ -1,6 +1,8 @@
package org.lcsim.geometry.compact.converter; import org.jdom.Element;
+import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TestRunHalfModuleBundle; +import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TestRunModuleBundle;
import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope; import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.BasePlate; import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.CSupport;
@@ -8,8 +10,7 @@
import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom; import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.SupportPlateTop; import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.SupportTop;
-import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TrackingBase; -import org.lcsim.geometry.compact.converter.HPSTrackerBuilder.HalfModuleBundle;
+import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TrackingVolume;
import org.lcsim.geometry.compact.converter.HPSTrackerBuilder.ModuleBundle; import org.lcsim.geometry.compact.converter.lcdd.util.LCDD; import org.lcsim.geometry.compact.converter.lcdd.util.SensitiveDetector;
@@ -48,7 +49,7 @@
// Go through the list of volumes to build that is created in the generic builder class // TODO this is manual now since I don't have a way of knowing in the generic builder class what is a ghost volume at this point.
- LCDDBaseGeometry trackingGeometry = new LCDDBaseGeometry(_builder.getBaseGeometry(TrackingBase.class), worldVolume);
+ LCDDBaseGeometry trackingGeometry = new LCDDBaseGeometry(_builder.getBaseGeometry(TrackingVolume.class), worldVolume);
add(trackingGeometry); baseTrackerGeometry = new LCDDBaseGeometry(_builder.getBaseGeometry(TrackerEnvelope.class), lcdd, trackingGeometry); add(baseTrackerGeometry);
@@ -71,9 +72,9 @@
if(isDebug()) System.out.printf("%s: build modules\n", getClass().getSimpleName()); // Loop over all modules created
- for(ModuleBundle m : _builder.modules) {
+ for(ModuleBundle mod : _builder.modules) {
+ TestRunModuleBundle m = (TestRunModuleBundle) mod;
-
if(isDebug()) { System.out.printf("%s: module layer %d half %s\n", getClass().getSimpleName(),m.getLayer(),m.getHalf()); m.print();
@@ -127,9 +128,9 @@
// create the module LCDDBaseGeometry lcddM = new LCDDBaseGeometry(bundle.module, lcdd, mother); add(lcddM);
- if(bundle.halfModuleAxial!=null) addHalfModule(bundle.halfModuleAxial,lcddM);
+ if(bundle.halfModuleAxial!=null) addHalfModule((TestRunHalfModuleBundle)bundle.halfModuleAxial,lcddM);
if(bundle.coldBlock!=null) add(new LCDDBaseGeometry(bundle.coldBlock, lcdd, lcddM));
- if(bundle.halfModuleStereo!=null) addHalfModule(bundle.halfModuleStereo,lcddM);
+ if(bundle.halfModuleStereo!=null) addHalfModule((TestRunHalfModuleBundle)bundle.halfModuleStereo,lcddM);
} /**
@@ -137,7 +138,7 @@
* @param bundle - module to be added * @param mother - mother LCDD geometry object */
- private void addHalfModule(HalfModuleBundle bundle, LCDDBaseGeometry mother) {
+ private void addHalfModule(TestRunHalfModuleBundle bundle, LCDDBaseGeometry mother) {
// This could perhaps be fixed if there is a relation with daughters in geometry definition? // create the half-module LCDDBaseGeometry lcddHM = new LCDDBaseGeometry(bundle.halfModule, lcdd, mother);
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerBuilder.java 2014-10-17 20:52:02 UTC (rev 3371) +++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerBuilder.java 2014-10-17 23:03:49 UTC (rev 3372) @@ -7,27 +7,73 @@
import org.jdom.Element; import org.lcsim.detector.Transform3D;
-import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.SurveyVolume; -import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TestRunColdBlock;
+import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.ActiveSensor; +import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.CarbonFiber; +import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.HalfModuleLamination; +import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.Hybrid; +import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.Sensor; +import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TestRunHalfModule;
import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TestRunModule; public abstract class HPSTrackerBuilder { private boolean debug = true; public List<ModuleBundle> modules;
- protected List<HPSTestRunTracker2014GeometryDefinition.SurveyVolume> geometries = new ArrayList<HPSTestRunTracker2014GeometryDefinition.SurveyVolume>();
+ protected List<SurveyVolume> geometries = new ArrayList<SurveyVolume>();
protected Element node;
+ /** + * Default constructor to create a geometry. + * @param debug output flag + * @param node to have access to compact xml + */
public HPSTrackerBuilder(boolean debug, Element node) { this.debug = debug; this.node = node; }
+ /** + * Build the local geometry + * + */
public abstract void build();
+ /** + * Bundle volumes into a module. + * TODO If the geometry definition has access to daughter information I could avoid this? + * + * @author Per Hansson Adrian <[log in to unmask]> + * + */ + public static abstract class ModuleBundle { + public SurveyVolume module = null; + public HalfModuleBundle halfModuleAxial = null; + public HalfModuleBundle halfModuleStereo = null; + protected SurveyVolume coldBlock = null; + abstract public int getLayer(); + abstract public String getHalf(); + abstract public SurveyVolume getMother(); + abstract public void print(); + } + + /** + * Bundle volumes into a half-module. + * TODO If the geometry definition has access to daughter information I could avoid this? + * + * @author Per Hansson Adrian <[log in to unmask]> + * + */ + public static abstract class HalfModuleBundle { + public SurveyVolume halfModule = null; + public HalfModuleBundle() { + } + abstract public void print(); + } + +
public static String getHalfFromName(String name) { String half = ""; if(name.contains("bottom")) {
@@ -109,47 +155,9 @@
return false; }
- /** - * Bundle geometry objects in a module. - * This was done in order to package module geometry objects into a simpler form. - * If the geometry definition has access to daughter information I could avoid this? TODO check this? - * - * @author Per Hansson Adrian <[log in to unmask]> - * - */ - public static class ModuleBundle { - public TestRunModule module = null; - public HalfModuleBundle halfModuleAxial = null; - public HalfModuleBundle halfModuleStereo = null; - protected TestRunColdBlock coldBlock = null; - ModuleBundle(TestRunModule m) { - module = m; - } - public int getLayer() { - if(module==null) throw new RuntimeException("Need to add module to bundle first!"); - return getLayerFromVolumeName(module.getName()); - } - public String getHalf() { - if(module==null) throw new RuntimeException("Need to add module to bundle first!"); - return getHalfFromName(module.getName()); - } - /** - * Find mother to this module. - * @return mother - */ - public SurveyVolume getMother() { - if(module==null) throw new RuntimeException("Need to add module to bundle first!"); - return module.getMother(); - } - public void print() { - if(module!=null) System.out.printf("%s: %s\n", this.getClass().getSimpleName(),module.getName()); - if(halfModuleAxial!=null) halfModuleAxial.print(); - if(coldBlock!=null)System.out.printf("%s: %s\n", this.getClass().getSimpleName(),coldBlock.getName()); - if(halfModuleStereo!=null) halfModuleStereo.print(); - } - } - - protected boolean isDebug() {
+ + + protected boolean isDebug() {
return debug; }
@@ -198,7 +206,7 @@
* @param module - to find * @return bundle */
- protected ModuleBundle getModuleBundle(HPSTestRunTracker2014GeometryDefinition.TestRunModule module) {
+ protected ModuleBundle getModuleBundle(TestRunModule module) {
return getModuleBundle(module.getLayer(), module.getHalf()); }
@@ -207,7 +215,7 @@
* @param module - to find * @return bundle */
- protected HalfModuleBundle getHalfModuleBundle(HPSTestRunTracker2014GeometryDefinition.TestRunModule module, String halfModuleName) {
+ protected HalfModuleBundle getHalfModuleBundle(TestRunModule module, String halfModuleName) {
ModuleBundle m = getModuleBundle(module.getLayer(), module.getHalf()); HalfModuleBundle hm = null; if(m!=null) {
@@ -240,7 +248,7 @@
* * @return true if it is, false if it is a stereo sensor */
- private boolean isAxial(boolean isTopLayer, int layer) {
+ public static boolean isAxial(boolean isTopLayer, int layer) {
if (isTopLayer && layer % 2 == 1) { return true; } else if (!isTopLayer && layer % 2 == 0) {
@@ -249,20 +257,7 @@
return false; }
- public static class HalfModuleBundle { - public HPSTestRunTracker2014GeometryDefinition.TestRunHalfModule halfModule = null; - public HPSTestRunTracker2014GeometryDefinition.Sensor sensor = null; - public HPSTestRunTracker2014GeometryDefinition.ActiveSensor activeSensor = null; - protected HPSTestRunTracker2014GeometryDefinition.HalfModuleLamination lamination = null; - protected HPSTestRunTracker2014GeometryDefinition.CarbonFiber carbonFiber = null; - protected HPSTestRunTracker2014GeometryDefinition.Hybrid hybrid = null; - HalfModuleBundle(HPSTestRunTracker2014GeometryDefinition.TestRunHalfModule hm) { - halfModule = hm; - } - public void print() { - System.out.printf("%s: %s\n", this.getClass().getSimpleName(),halfModule.getName()); - } - }
+
/** * Find transform to parent volume coordinate system.
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerJavaBuilder.java 2014-10-17 20:52:02 UTC (rev 3371) +++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerJavaBuilder.java 2014-10-17 23:03:49 UTC (rev 3372) @@ -27,7 +27,6 @@
import org.lcsim.detector.solids.Box; import org.lcsim.detector.tracker.silicon.SiTrackerModule; import org.lcsim.geometry.compact.Subdetector;
-import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.SurveyVolume;
import org.lcsim.geometry.util.TransformationUtils; public abstract class HPSTrackerJavaBuilder implements IHPSTrackerJavaBuilder {
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerLCDDBuilder.java 2014-10-17 20:52:02 UTC (rev 3371) +++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerLCDDBuilder.java 2014-10-17 23:03:49 UTC (rev 3372) @@ -11,7 +11,6 @@
import org.jdom.Element; import org.jdom.JDOMException; import org.lcsim.detector.Transform3D;
-import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.SurveyVolume;
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;
@@ -106,7 +105,7 @@
Hep3Vector lcdd_rot_angles = TransformationUtils.getCardanAngles(base.getCoord().v(), base.getCoord().w(), new BasicHep3Vector(0,1,0),new BasicHep3Vector(0,0,1)); setPos(new Position(getName() + "_position", 0, 0, 0)); setRot(new Rotation(getName() + "_rotation",lcdd_rot_angles.x(), lcdd_rot_angles.y(), lcdd_rot_angles.z()));
- if(isDebug()) System.out.printf("%s: DONE JavaBaseGeometry %s\n", this.getClass().getSimpleName(),base.getName());
+ if(isDebug()) System.out.printf("%s: DONE %s\n", this.getClass().getSimpleName(),base.getName());
} /**
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/SurveyCoordinateSystem.java (rev 0) +++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/SurveyCoordinateSystem.java 2014-10-17 23:03:49 UTC (rev 3372) @@ -0,0 +1,118 @@
+package org.lcsim.geometry.compact.converter; + +import hep.physics.vec.BasicHep3Matrix; +import hep.physics.vec.BasicHep3Vector; +import hep.physics.vec.Hep3Vector; +import hep.physics.vec.VecOp; + +import org.apache.commons.math3.geometry.euclidean.threed.Rotation; +import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; +import org.lcsim.detector.Rotation3D; +import org.lcsim.detector.Transform3D; +import org.lcsim.detector.Translation3D; + + /** + * Class describing a simple coordinate system used to define the [log in to unmask] + * + * @author Per Hansson Adrian <[log in to unmask]> + */ + public class SurveyCoordinateSystem { + private final boolean debug = false; + private Hep3Vector origin; + private Hep3Vector u; + private Hep3Vector v; + private Hep3Vector w; + + public SurveyCoordinateSystem(Hep3Vector org, Hep3Vector unit_x, Hep3Vector unit_y, Hep3Vector unit_z) { + origin = org; + u = unit_x; + v = unit_y; + w = unit_z; + } + + public SurveyCoordinateSystem(Hep3Vector ball, Hep3Vector vee, Hep3Vector flat) { + origin = ball; + Hep3Vector ball_to_vee = VecOp.sub(vee, ball); + u = VecOp.unit(ball_to_vee); + 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(); + } + + private void check() { + checkUnitLength(); + checkAngles(); + } + + private void checkUnitLength() { + if(u.magnitude()-1>0.00001 || v.magnitude()-1>0.00001 || v.magnitude()-1>0.00001) { + throw new RuntimeException("Error: the unit vectors of the coordinate system is ill-defined " + toString()); + } + } + + private void checkAngles() { + if( (VecOp.dot(u, v)-1)>0.00001 || (VecOp.dot(u, w)-1)>0.00001 || (VecOp.dot(v, w)-1)>0.00001 ) { + throw new RuntimeException("Error: the angles in coordinate system is ill-defined " + toString()); + } + } + + public void rotateApache(Rotation r) { + if(debug) System.out.printf("%s: apply apache rotation to this coord system\n%s\n", getClass().getSimpleName(),toString()); + this.u = new BasicHep3Vector(r.applyTo(new Vector3D(u.v())).toArray()); + this.v = new BasicHep3Vector(r.applyTo(new Vector3D(v.v())).toArray()); + this.w = new BasicHep3Vector(r.applyTo(new Vector3D(w.v())).toArray()); + if(debug) System.out.printf("%s: new coord system after apache rotation to this coord system\n%s\n", getClass().getSimpleName(),toString()); + } + + +/* + public void rotate(Hep3Vector euler_angles) { + RotationGeant rotation = new RotationGeant(euler_angles.x(), euler_angles.y(), euler_angles.z()); + rotation.rotate(u); + rotation.rotate(v); + rotation.rotate(w); + } + */ + public void translate(Hep3Vector translation) { + // update origin with local translation in u,v,w + origin = VecOp.add(origin, translation); + } + public Hep3Vector origin() { + return origin; + } + public Hep3Vector u() { + return u; + } + public Hep3Vector v() { + return v; + } + public Hep3Vector w() { + return w; + } + + public String toString() { + return "Coordinate system: \norigin " + origin.toString() + "\nu " + u.toString() + "\nv " + v.toString() + "\nw " + w.toString(); + } + + + /** + * Find @ITransform3D to the coordinate system defined by the input. + * @return resulting 3D transform + */ + public Transform3D getTransformation() { + // Find the transform between the two frames - use transform classes here (not really needed) + Translation3D translation = new Translation3D(origin.x(), origin.y(), origin.z()); + //RotationGeant trackingToEnvelopeRotation = new RotationGeant(0, 0, 0); + Rotation3D rotation = new Rotation3D( + new BasicHep3Matrix( + u.x(),v.x(),w.x(), + u.y(),v.y(),w.y(), + u.z(),v.z(),w.z() + )); + Transform3D envelopeToSupportTransform = new Transform3D(translation, rotation); + return envelopeToSupportTransform; + } + + + }
\ No newline at end of file
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/SurveyVolume.java (rev 0) +++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/SurveyVolume.java 2014-10-17 23:03:49 UTC (rev 3372) @@ -0,0 +1,209 @@
+package org.lcsim.geometry.compact.converter; + +import hep.physics.vec.BasicHep3Vector; +import hep.physics.vec.Hep3Vector; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.math3.geometry.euclidean.threed.RotationOrder; +import org.lcsim.geometry.util.TransformationUtils; + +/** + * + * Class containing the basic geometry information for building a volume based on survey positions. + * + */ +public abstract class SurveyVolume { + protected boolean debug = false; + private String name; + private String material = "Vacuum"; + private SurveyVolume mother; + // 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 + protected List<SurveyVolume> referenceGeom = null; + private SurveyCoordinateSystem coord; + protected Hep3Vector ballPos; + protected Hep3Vector veePos; + protected Hep3Vector flatPos; + private Hep3Vector center; + private Hep3Vector boxDim; + private AlignmentCorrection alignmentCorrections; + + public SurveyVolume(String name, SurveyVolume m) { + setName(name); + setMother(m); + } + public SurveyVolume(String name, SurveyVolume m, SurveyVolume ref) { + setName(name); + setMother(m); + addReferenceGeom(ref); + } + public SurveyVolume(String name, SurveyVolume m, List<SurveyVolume> ref) { + setName(name); + setMother(m); + addReferenceGeom(ref); + } + + protected abstract void setPos(); + protected abstract void setCoord(); + protected abstract void setCenter(); + protected abstract void setBoxDim(); + + protected void init() { + setPos(); + setCoord(); + setCenter(); + setBoxDim(); + applyGenericCoordinateSystemCorrections(); + applyAlignmentCorrections(); + } + + protected void applyGenericCoordinateSystemCorrections() { + //do nothing here unless overridden + } + + private void applyAlignmentCorrections() { + // Apply alignment corrections to local coordinate system that is already built + + if(this.coord==null) throw new RuntimeException("no coordinate system was set before trying to apply alignment corrections."); + + if(alignmentCorrections!=null) { + + if(debug) System.out.printf("%s: Apply alignment corrections to this coord system:\n%s\n",this.getClass().getSimpleName(),getCoord().toString()); + + // translate + if(alignmentCorrections.getTranslation()!=null) { + + if(debug) System.out.printf("%s: Apply translation %s to coordinate system\n", this.getClass().getSimpleName(),alignmentCorrections.getTranslation().toString()); + + getCoord().translate(alignmentCorrections.getTranslation()); + + } else { + if(debug) System.out.printf("%s: No translation to coordinate system\n", this.getClass().getSimpleName()); + } + + // rotate + if(alignmentCorrections.getRotation()!=null) { + + if(debug) { + System.out.printf("%s: Apply rotation to coordinate system. Matrix:\n", this.getClass().getSimpleName()); + double mat[][] = alignmentCorrections.getRotation().getMatrix(); + TransformationUtils.printMatrix(mat); + // Get the Cardan angles of the rotation + double res[] = alignmentCorrections.getRotation().getAngles(RotationOrder.ZYX); + // Since the rotation was created based on active transformations convert to passive right here. + // This conversion is simply to reverse the order of rotations. + Hep3Vector res_passive = new BasicHep3Vector(res[2],res[1],res[0]); + System.out.printf("%s: Corresponding LCDD Cardan angles:\n", this.getClass().getSimpleName(), res_passive.toString()); + } + + getCoord().rotateApache(alignmentCorrections.getRotation()); + + } else { + if(debug) System.out.printf("%s: No rotation to coordinate system\n", this.getClass().getSimpleName()); + } + + if(debug) System.out.printf("%s: coordinate system after alignment corrections:\n%s\n",this.getClass().getSimpleName(),getCoord().toString()); + + } else { + if(debug) System.out.printf("%s: No aligment corrections to coordinate system\n", this.getClass().getSimpleName()); + } + + } + + public void setBallPos(double x, double y, double z) { + ballPos = new BasicHep3Vector(x,y,z); + } + public void setVeePos(double x, double y, double z) { + veePos = new BasicHep3Vector(x,y,z); + } + public void setFlatPos(double x, double y, double z) { + flatPos = new BasicHep3Vector(x,y,z); + } + public Hep3Vector getBallPos() { + return ballPos; + } + public Hep3Vector getVeePos() { + return veePos; + } + public Hep3Vector getFlatPos() { + return flatPos; + } + 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!"); + } + if(origin!=null) { + coord = new SurveyCoordinateSystem(origin, ballPos, veePos, flatPos); + } else { + coord = new SurveyCoordinateSystem(ballPos, veePos, flatPos); + } + } + public SurveyCoordinateSystem getCoord() { + if(coord == null) { + throw new RuntimeException("Need to setCoord!"); + } + return coord; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public Hep3Vector getCenter() { + return center; + } + public void setCenter(Hep3Vector center) { + this.center = center; + } + public void setCenter(double x, double y, double z) { + this.center = new BasicHep3Vector(x,y,z); + } + public Hep3Vector getBoxDim() { + return boxDim; + } + public void setBoxDim(double x, double y, double z) { + this.boxDim = new BasicHep3Vector(x,y,z); + } + public SurveyVolume getMother() { + return mother; + } + public void setMother(SurveyVolume mother) { + this.mother = mother; + } + public void addReferenceGeom(SurveyVolume refGeom) { + if(refGeom!=null) { // check that it's not a dummy call + if(referenceGeom == null) { + referenceGeom = new ArrayList<SurveyVolume>(); + } + referenceGeom.add(refGeom); + } + } + public void addReferenceGeom(List<SurveyVolume> refGeomList) { + if(referenceGeom == null) { + referenceGeom = new ArrayList<SurveyVolume>(); + } + referenceGeom.addAll(refGeomList); + } + public void printSurveyPos() { + if(debug) System.out.printf("Survey pos for %s:\n",getName()); + if(debug) System.out.printf("ballPos %s\n", ballPos.toString()); + if(debug) System.out.printf("veePos %s\n", veePos.toString()); + if(debug) System.out.printf("flatPos %s\n", flatPos.toString()); + } + public String getMaterial() { + return material; + } + public void setMaterial(String material) { + this.material = material; + } + public String toString() { + String s = "BaseGeometry " + getName(); + s += "\n" + this.getCoord().toString(); + return s; + } + +}
\ No newline at end of file
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014.java 2014-10-17 20:52:02 UTC (rev 3371) +++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014.java 2014-10-17 23:03:49 UTC (rev 3372) @@ -16,6 +16,7 @@
import org.lcsim.geometry.compact.converter.HPSTrackerLCDDBuilder; import org.lcsim.geometry.compact.converter.HPSTrackerLCDDBuilder.GhostLCDDBaseGeometry; import org.lcsim.geometry.compact.converter.HPSTrackerLCDDBuilder.LCDDBaseGeometry;
+import org.lcsim.geometry.compact.converter.SurveyCoordinateSystem;
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.PhysVol;
@@ -313,7 +314,7 @@
Hep3Vector ball_pos_beamplane = ball_pos_base_plate; Hep3Vector vee_pos_beamplane = vee_pos_base_plate; Hep3Vector flat_pos_beamplane = flat_pos_base_plate;
- HPSTestRunTracker2014GeometryDefinition.Coord beamplane_coord = new HPSTestRunTracker2014GeometryDefinition.Coord(ball_pos_beamplane, vee_pos_beamplane, flat_pos_beamplane);
+ SurveyCoordinateSystem beamplane_coord = new SurveyCoordinateSystem(ball_pos_beamplane, vee_pos_beamplane, flat_pos_beamplane);
Transform3D trans_beamplane_to_tracking = beamplane_coord.getTransformation(); final double beamPlaneThickness = 0.00000001;
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