Author: phansson Date: Fri Nov 7 17:13:07 2014 New Revision: 3415 Log: Added first version with modules and re-used half-modules from TestRun implementation for L1-3 bottom U-channel. Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014GeometryDefinition.java projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014JavaBuilder.java projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014LCDDBuilder.java projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014GeometryDefinition.java projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerBuilder.java projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerGeometryDefinition.java projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/SurveyVolume.java projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014.java Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014GeometryDefinition.java ============================================================================= --- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014GeometryDefinition.java (original) +++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014GeometryDefinition.java Fri Nov 7 17:13:07 2014 @@ -114,7 +114,7 @@ * @param layer - of the module * @param half - top or bottom half of the tracker */ - private void makeModuleBundle(int layer, String half) + protected void makeModuleBundle(int layer, String half) { if(isDebug()) System.out.printf("%s: makeModule for layer %d %s \n", this.getClass().getSimpleName(), layer, half); @@ -148,7 +148,7 @@ // create the bundle for this module - TestRunModuleBundle bundle = new TestRunModuleBundle(module); + ModuleBundle bundle = new ModuleBundle(module); addModuleBundle(bundle); if(doAxial) makeHalfModule("axial", module); @@ -162,29 +162,27 @@ } } - - /** * Create the cold block object. * @param mother to the cold block */ - private void makeColdBlock(TestRunModule mother) { - - + protected void makeColdBlock(TestRunModule mother) { + + String moduleName = mother.getName(); - + if(isDebug()) System.out.printf("%s: makeColdBlock for %s \n", this.getClass().getSimpleName(), moduleName); - - + + String volName = moduleName + "_coldblock"; - + // find layer int layer = getLayerFromVolumeName(moduleName); - + // Build the half-module TestRunColdBlock coldBlock; - + if(layer >= 1 && layer <=3) { coldBlock = new TestRunColdBlockL13(volName, mother, layer); } else if(layer >= 4 && layer <=5) { @@ -192,215 +190,14 @@ } else { throw new RuntimeException("wrong layer for " + volName); } - + ModuleBundle bundle = getModuleBundle(mother); bundle.coldBlock = coldBlock; } - - - - /** - * Create the half-module. - * @param side - stereo or axial - * @param mother to the half-module - */ - private void makeHalfModule(String side, TestRunModule mother) { - - String moduleName = mother.getName(); - - if(isDebug()) System.out.printf("%s: makeHalfModule for %s %s \n", this.getClass().getSimpleName(), moduleName, side); - - String volName = moduleName + "_halfmodule_" + side; - - // top or bottom? - String half = mother.getHalf(); - boolean isTopLayer = !mother.isBottom(); - - // find layer - int layer = mother.getLayer(); - - // axial or stereo - boolean isAxial = isAxialFromName(volName); - - // find layer according to old definition - int oldLayer = getOldGeomDefLayerFromVolumeName(isTopLayer, layer, isAxial); - //if(isDebug()) System.out.printf("%s: half? %s layer %d oldlayer %d axial? %s\n", - // this.getClass().getSimpleName(), isTopLayer?"top":"bottom", layer,oldLayer,isAxial?"yes":"no"); - - // find alignment correction to this volume - AlignmentCorrection alignmentCorrection = getHalfModuleAlignmentCorrection(isTopLayer, oldLayer); - - - // find the bundle that it will be added to - TestRunModuleBundle bundle = (TestRunModuleBundle)getModuleBundle(mother); - TestRunHalfModuleBundle halfModuleBundle; - - - // Build the half-module - TestRunHalfModule halfModule; - if(isAxial) { - halfModule = new TestRunHalfModuleAxial(volName, mother, alignmentCorrection, layer, half); - halfModuleBundle = new TestRunHalfModuleBundle(halfModule); - bundle.halfModuleAxial = halfModuleBundle; - } else { - halfModule = new TestRunHalfModuleStereo(volName, mother, alignmentCorrection, layer, half); - halfModuleBundle = new TestRunHalfModuleBundle(halfModule); - bundle.halfModuleStereo = halfModuleBundle; - } - - - // create the half module components - - makeHalfModuleComponentSensor(halfModule); - - makeHalfModuleComponentKapton(halfModule); - - makeHalfModuleComponentCF(halfModule); - - makeHalfModuleComponentHybrid(halfModule); - - - - - } - - - - private void makeHalfModuleComponentHybrid(TestRunHalfModule mother) { - - if(isDebug()) System.out.printf("%s: makeHalfModuleComponentHybrid for %s \n", this.getClass().getSimpleName(), mother.getName()); - - String volName = mother.getName() + "_hybrid"; - - // Build the half-module - - // id is hard coded - int component_number = 3; - - Hybrid hybrid = new Hybrid(volName,mother,component_number); - hybrid.setMaterial("G10"); - - 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()); - - - } - - - - private void makeHalfModuleComponentCF(TestRunHalfModule mother) { - - if(isDebug()) System.out.printf("%s: makeHalfModuleComponentCF for %s \n", this.getClass().getSimpleName(), mother.getName()); - - - String volName = mother.getName() + "_cf"; - - // Build the half-module - - // id is hard coded - int component_number = 1; - - CarbonFiber cf = new CarbonFiber(volName,mother,component_number); - cf.setMaterial("CarbonFiber"); - - TestRunHalfModuleBundle hm = (TestRunHalfModuleBundle) getHalfModuleBundle((TestRunModule) mother.getMother(), mother.getName()); - hm.carbonFiber = cf; - - } - - - - - private void makeHalfModuleComponentKapton(TestRunHalfModule mother) { - - if(isDebug()) System.out.printf("%s: makeHalfModuleComponentKapton for %s \n", this.getClass().getSimpleName(), mother.getName()); - - String volName = mother.getName() + "_lamination"; - - // Build the half-module - - // id is hard coded - int component_number = 2; - - HalfModuleLamination lamination = new HalfModuleLamination(volName,mother,component_number); - lamination.setMaterial("Kapton"); - - - TestRunHalfModuleBundle hm = (TestRunHalfModuleBundle) getHalfModuleBundle((TestRunModule) mother.getMother(), mother.getName()); - hm.lamination = lamination; - - } - - - private void makeHalfModuleComponentSensor(TestRunHalfModule mother) { - - if(isDebug()) System.out.printf("%s: makeHalfModuleComponentSensor for %s \n", this.getClass().getSimpleName(), mother.getName()); - - String volName = mother.getName() + "_sensor"; - - // sensor id is hard coded in old geometry to be zero by counting over the components of the module - int component_number = 0; - - // - Sensor sensor = new Sensor(volName, mother, null, component_number); - sensor.setMaterial("Silicon"); - - TestRunHalfModuleBundle hm = (TestRunHalfModuleBundle) getHalfModuleBundle((TestRunModule) mother.getMother(), mother.getName()); - hm.sensor = sensor; - - - makeHalfModuleComponentActiveSensor(sensor); - - - } - - - 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"; - - ActiveSensor active_sensor = new ActiveSensor(volName, mother); - active_sensor.setMaterial("Silicon"); - - TestRunHalfModuleBundle hm = (TestRunHalfModuleBundle) getHalfModuleBundle((TestRunModule) mother.getMother().getMother(), mother.getMother().getName()); - hm.activeSensor = active_sensor; - - } - - - /** - * Tracking volume geometry definition. - */ - /* - public static class TrackingVolume extends SurveyVolume { - public TrackingVolume(String name, SurveyVolume mother) { - super(name,mother, null); - init(); - } - protected void setPos() { - // Dummy survey positions to setup a coordinate system - ballPos = new BasicHep3Vector(1,0,0); - veePos = new BasicHep3Vector(0,1,0); - flatPos = new BasicHep3Vector(0,0,1); - } - protected void setCoord() { - // at the origin - setCoord(new BasicHep3Vector(0,0,0)); - } - protected void setCenter() { - // at the origin - setCenter(new BasicHep3Vector(0,0,0)); - } - protected void setBoxDim() { - // do nothing since we are not building a tracking volume - } - } - -*/ + + + + public static class TrackerEnvelope extends SurveyVolume { // height of the dummy box holding the entire SVT: // this means the bottom of the base plate to the the inner surface of of the PS vac box for now @@ -1941,20 +1738,6 @@ } } - - - public static class TestRunModuleBundle extends ModuleBundle { - TestRunModuleBundle(TestRunModule m) { - module = m; - } - 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(); - } - } - public static class TestRunHalfModuleBundle extends HalfModuleBundle { public SurveyVolume sensor = null; @@ -1971,6 +1754,21 @@ } + protected TestRunHalfModuleAxial createTestRunHalfModuleAxial(String volName, + BaseModule mother, AlignmentCorrection alignmentCorrection, + int layer, String half) { + return new TestRunHalfModuleAxial(volName, mother, alignmentCorrection, layer, half); + + } + + + protected TestRunHalfModuleStereo createTestRunHalfModuleStereo( + String volName, BaseModule mother, + AlignmentCorrection alignmentCorrection, int layer, String half) { + return new TestRunHalfModuleStereo(volName, mother, alignmentCorrection, layer, half); + } + + Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014JavaBuilder.java ============================================================================= --- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014JavaBuilder.java (original) +++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014JavaBuilder.java Fri Nov 7 17:13:07 2014 @@ -14,7 +14,6 @@ import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.SupportPlateTop; import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.SupportTop; 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.HPSTrackerBuilder.ModuleBundle; @@ -87,8 +86,7 @@ if(isDebug()) System.out.printf("%s: build JAVA modules\n", getClass().getSimpleName()); // Loop over all modules created - for(ModuleBundle mod : _builder.modules) { - TestRunModuleBundle m = (TestRunModuleBundle) mod; + for(ModuleBundle m : _builder.modules) { 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(); @@ -140,7 +138,7 @@ * @param bundle - module to be added * @param mother - mother JAVA geometry object */ - private void addModule(TestRunModuleBundle bundle, JavaSurveyVolume mother) { + private void addModule(ModuleBundle bundle, JavaSurveyVolume mother) { if(isDebug()) { System.out.printf("%s: addModule %s containing:\n",this.getClass().getSimpleName(), bundle.module.getName()); Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014LCDDBuilder.java ============================================================================= --- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014LCDDBuilder.java (original) +++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014LCDDBuilder.java Fri Nov 7 17:13:07 2014 @@ -8,7 +8,6 @@ import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.SupportPlateTop; import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.SupportTop; 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.HPSTrackerBuilder.HalfModuleBundle; import org.lcsim.geometry.compact.converter.HPSTrackerBuilder.ModuleBundle; @@ -77,9 +76,8 @@ if(isDebug()) System.out.printf("%s: build modules\n", getClass().getSimpleName()); // Loop over all modules created - for(ModuleBundle mod : _builder.modules) { - TestRunModuleBundle m = (TestRunModuleBundle) mod; - + for(ModuleBundle m : _builder.modules) { + if(isDebug()) { System.out.printf("%s: module layer %d half %s\n", getClass().getSimpleName(),m.getLayer(),m.getHalf()); m.print(); Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014GeometryDefinition.java ============================================================================= --- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014GeometryDefinition.java (original) +++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014GeometryDefinition.java Fri Nov 7 17:13:07 2014 @@ -10,6 +10,11 @@ import org.apache.commons.math3.geometry.euclidean.threed.Rotation; import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; import org.jdom.Element; +import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.BaseModule; +import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.CarbonFiber; +import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.HalfModuleLamination; +import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.Sensor; +import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TestRunHalfModule; /** @@ -25,8 +30,8 @@ public HPSTracker2014GeometryDefinition(boolean debug, Element node) { super(debug, node); - doAxial = false; - doStereo = false; + doAxial = true; + doStereo = true; doColdBlock = false; doBottom = true; doTop = false; @@ -75,41 +80,7 @@ } } - /* - - BasePlate basePlate = new BasePlate("baseplate",base, "Aluminum"); - geometries.add(basePlate); - - CSupport cSupport = new CSupport("c_support", base); - geometries.add(cSupport); - - AlignmentCorrection alignmentCorrectionSupportBottom = getSupportAlignmentCorrection(false); - SupportBottom supportBottom = new SupportBottom("support_bottom", base, alignmentCorrectionSupportBottom, 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 - - SupportPlateBottom supportPlateBottom = new SupportPlateBottom("support_plate_bottom", base, supportBottom, "Aluminum"); - geometries.add(supportPlateBottom); - - AlignmentCorrection alignmentCorrectionSupportTop = getSupportAlignmentCorrection(true); - SupportTop supportTop = new SupportTop("support_top", base, alignmentCorrectionSupportTop, cSupport); - geometries.add(supportTop); - - 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 - modules = new ArrayList<ModuleBundle>(); - - for(int l=1; l<=5;++l) { - if(doLayer(l)) { - if(doBottom) makeModuleBundle(l,"bottom"); - if(doTop) makeModuleBundle(l,"top"); - } - } - -*/ + if(isDebug()) { System.out.printf("%s: DONE constructing the geometry objects\n", this.getClass().getSimpleName()); @@ -150,7 +121,7 @@ setBoxDim(width,length,height); } protected void setPos() { - ballPos = new BasicHep3Vector(0, 0, 500.0); //TODO fix this random offset + ballPos = new BasicHep3Vector(SvtBox.center_to_target_x, SvtBox.center_to_target_y, SvtBox.center_to_target_z); veePos = new BasicHep3Vector(ballPos.x() + 1, ballPos.y(), ballPos.z()); flatPos = new BasicHep3Vector(ballPos.x(), ballPos.y(), ballPos.z()-1); @@ -171,6 +142,13 @@ public static final double height = 6.740*inch; public static final double width = SvtBoxBasePlate.width; public static final double length = SvtBoxBasePlate.length; + + // position of the target w.r.t. center of this box. + // the coordinate frame is the JLab coordinates..confusing. + public static final double center_to_target_z = 13.777*inch; + public static final double center_to_target_x = 0.84*inch; + public static final double center_to_target_y = 0.0; + @@ -472,45 +450,7 @@ } - public static abstract class BaseModule extends SurveyVolume { - private int layer; - private String half; - protected final static double box_extra_length = 10.0;// random at this point - protected final static double box_extra_width = 15.0;// random at this point - protected final static double box_extra_height = 1.0;// random at this point - - public BaseModule(String name, SurveyVolume mother, AlignmentCorrection alignmentCorrection, SurveyVolume ref) { - super(name, mother, alignmentCorrection, ref); - setLayer(getLayerFromVolumeName(name)); - setHalf(getHalfFromName(name)); - isValid(); - } - private void isValid() { - if(half!="bottom" && half!="top") { - System.out.printf("ERROR invalid half %s for BaseModule\n",half); - System.exit(1); - } - } - public int getLayer() { - return layer; - } - public void setLayer(int layer) { - this.layer = layer; - } - - public String getHalf() { - return half; - } - - public void setHalf(String half) { - this.half = half; - } - - public boolean isBottom() { - return getHalf() == "bottom" ? true : false; - } - - } + @@ -518,33 +458,42 @@ * @SurveyVolume volume defining the coordinate system of module L1-3 * Reference: @UChannelL13Bottom coordinate system * Origin: hole position on mounting surface (sensor side) - * Orientation: u - is normal to the surface, v - points along module away from hybrid side. + * Orientation: u - is normal to the surface pointing vertically down, v - points along module away from hybrid side. * * @author Per Hansson Adrian <[log in to unmask]> * */ public abstract static class ModuleL13 extends BaseModule { - public static final double hole_to_center_of_plate_x = 3.75*inch; + protected final static double box_extra_length = 10.0;// random at this point + protected final static double box_extra_height = 15.0;// random at this point + protected final static double box_extra_width = 0.5*inch;// random at this point + private static final double tension_lever_y = 2.5*inch; - public static final double length = 8.0*inch; - public static final double height = 1.0*inch; - public static final double width = tension_lever_y;//TODO find the right length to encapsualte L1-3 module + // TODO the dimension of this volume is padded manually. Check if this can cause overlap problems + public static final double length = 8.0*inch + box_extra_length; + public static final double height = 1.0*inch + box_extra_height; + public static final double width = tension_lever_y + 0.04*inch + box_extra_width;//TODO find the right length to encapsualte L1-3 module public static final double hole_to_end_of_module_x = 7.750*inch; + public static final double hole_to_module_edge_height_dir = height - 0.875*inch; + public static final double hole_to_center_of_plate_width_dir = 3.75*inch; + public static final double hole_to_module_edge_length_dir = 0.25*inch; public ModuleL13(String name, SurveyVolume mother, AlignmentCorrection alignmentCorrection, SurveyVolume ref) { - super(name, mother, alignmentCorrection, ref); - - } - protected void setCenter() { - //TODO the position of this module is not correct. - setCenter(width/2.0, -hole_to_center_of_plate_x, height/2.0); + super(name, mother, alignmentCorrection, ref, getLayerFromVolumeName(name), getHalfFromName(name)); + + } + protected void setCenter() { + final double x = -width/2.0; + final double y = -hole_to_module_edge_length_dir + length/2.0; + final double z = hole_to_module_edge_height_dir - height/2.0; + setCenter(x,y,z); } protected void setBoxDim() { setBoxDim(width, length, height); } protected void setPos() { ballPos = getHole(); - veePos = new BasicHep3Vector(ballPos.x(), ballPos.y(), ballPos.z()+1.0); + veePos = new BasicHep3Vector(ballPos.x(), ballPos.y(), ballPos.z()-1.0); flatPos = new BasicHep3Vector(ballPos.x()-1, ballPos.y(), ballPos.z()); } protected abstract Hep3Vector getHole(); @@ -560,7 +509,7 @@ } protected Hep3Vector getHole() { //hole position (sensor side) - double x = -hole_to_center_of_plate_x; + double x = hole_to_center_of_plate_width_dir; double y = 0.0; // TODO assume that cone and module mount pin hole is at same y. Check if true. double z = -UChannelL13Bottom.side_plate_cone_y - UChannelL13Plate.pocket_depth_L1; return new BasicHep3Vector(x, y, z); @@ -578,7 +527,7 @@ } protected Hep3Vector getHole() { //hole position (sensor side) - double x = -hole_to_center_of_plate_x; + double x = hole_to_center_of_plate_width_dir; double y = UChannelL13BottomPlate.hole_to_hole_x; double z = -UChannelL13Bottom.side_plate_cone_y - UChannelL13Plate.pocket_depth_L2; return new BasicHep3Vector(x, y, z); @@ -595,7 +544,7 @@ } protected Hep3Vector getHole() { //hole position (sensor side) - double x = -hole_to_center_of_plate_x; + double x = hole_to_center_of_plate_width_dir; double y = 2*UChannelL13BottomPlate.hole_to_hole_x; double z = -UChannelL13Bottom.side_plate_cone_y - UChannelL13Plate.pocket_depth_L3; return new BasicHep3Vector(x, y, z); @@ -604,24 +553,126 @@ } - - /** - * Bundle volumes into a module. + /** + * @SurveyVolume volume defining the coordinate system of the axial half-module in module L1-3 + * Reference: @ModuleL13 coordinate system + * Origin: sensor center + * Orientation: w - is normal to the surface pointing from p-side to n-side, v - points along strips away from signal bond pads * * @author Per Hansson Adrian <[log in to unmask]> * */ - public static class SVTModuleBundle extends ModuleBundle { - SVTModuleBundle(BaseModule m) { - module = m; - } - 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(); - } - } + public static class HalfModuleAxial extends HPSTestRunTracker2014GeometryDefinition.TestRunHalfModule { + + public static final double sensor_x = -1.543*inch; + public static final double sensor_y = 4.868*inch; + public static final double sensor_z = -0.23*inch; + + + public HalfModuleAxial(String name, SurveyVolume mother, + AlignmentCorrection alignmentCorrection, int layer, String half) { + super(name, mother, alignmentCorrection, layer, half); + init(); + } + protected void setPos() { + // Sensor positions from Shawn's 3D model + final double x = sensor_x; + final double y = sensor_y; + final double z = sensor_z; + ballPos = new BasicHep3Vector(x, y, z); + veePos = new BasicHep3Vector(ballPos.x()+1, ballPos.y(), ballPos.z()); + flatPos = new BasicHep3Vector(ballPos.x(), ballPos.y()+1, ballPos.z()); + } + protected void setCenter() { + double x = -1.0 * (TestRunHalfModule.getWidth()/2.0 - ( 12.66 - (8.83 -3.00) + Sensor.getSensorWidth()/2.0 ) ); + double y = TestRunHalfModule.getLength()/2.0 - ( (170.00 + 10.00) - Sensor.getSensorLength()/2.0); + double z = -Sensor.getSensorThickness()/2.0 - HalfModuleLamination.kapton_thickness - CarbonFiber.cf_thickness + half_module_thickness/2.0; + setCenter(x, y, z); + } + + +// double box_center_local_x = TestRunHalfModule.getLength()/2.0 - ( (170.00 + 10.00) - Sensor.getSensorLength()/2.0); +// double box_center_local_y = - Sensor.getSensorThickness()/2.0 - HalfModuleLamination.kapton_thickness - CarbonFiber.cf_thickness + half_module_thickness/2.0; +// double box_center_local_z = TestRunHalfModule.getWidth()/2.0 - ( 12.66 - (8.83 -3.00) + Sensor.getSensorWidth()/2.0 ); +// +// +// if(useSiStripsConvention) { +// //setCenter(box_center_local_z, box_center_local_x, box_center_local_y); +// setCenter(-1.0*box_center_local_z, box_center_local_x, box_center_local_y); +// } else { +// setCenter(box_center_local_x, box_center_local_y, box_center_local_z); +// } +// + + + + } + + + + /** + * @SurveyVolume volume defining the coordinate system of the stereo half-module in module L1-3 + * Reference: @ModuleL13 coordinate system + * Origin: sensor center + * Orientation: same as axial - the module is rotated later. + * + * @author Per Hansson Adrian <[log in to unmask]> + * + */ + public static class HalfModuleStereo extends HPSTestRunTracker2014GeometryDefinition.TestRunHalfModule { + + public static final double sensor_z = -0.52*inch; + + public HalfModuleStereo(String name, SurveyVolume mother, + AlignmentCorrection alignmentCorrection, int layer, String half) { + super(name, mother, alignmentCorrection, layer, half); + if(layer>=1 && layer<=3) stereo_angle = 0.1; + else throw new RuntimeException("Layer " + layer + " is ill-defined for test run modules"); + init(); + } + protected void setPos() { + // Sensor positions from Shawn's 3D model + final double x = HalfModuleAxial.sensor_x; + final double y = HalfModuleAxial.sensor_y; + final double z = sensor_z; + ballPos = new BasicHep3Vector(x, y, z); + veePos = new BasicHep3Vector(ballPos.x()+1, ballPos.y(), ballPos.z()); + flatPos = new BasicHep3Vector(ballPos.x(), ballPos.y()+1, ballPos.z()); + } + protected void setCenter() { + double x = -1.0 * (TestRunHalfModule.getWidth()/2.0 - ( 12.66 - (8.83 -3.00) + Sensor.getSensorWidth()/2.0 ) ); + double y = TestRunHalfModule.getLength()/2.0 - ( (170.00 + 10.00) - Sensor.getSensorLength()/2.0); + double z = -Sensor.getSensorThickness()/2.0 - HalfModuleLamination.kapton_thickness - CarbonFiber.cf_thickness + half_module_thickness/2.0; + setCenter(x, y, z); + } + protected void applyGenericCoordinateSystemCorrections() { + + // Rotate into the right place for the stereo - just offset compared to axial before this. + // My rotations here are active rotations in the mother coordinate system frame + // Sloppy description of the frame: + // x: direction along strips towards the readout bonds/apv25's + // v: normal to sensor plane pointing from the back-plane (n-side) to strip side (p-side) + // w: measurement direction with direction from right hand-rule + + // flip around strip direction - sign doesn't matter + Rotation r1 = new Rotation(new Vector3D(0,1,0),Math.PI); + // apply stereo angle around v + Rotation r2 = new Rotation(new Vector3D(0,0,1),stereo_angle); + // Build full rotation + Rotation r = r2.applyTo(r1); + //Rotation r = r1; + if(debug) System.out.printf("%s: Coord before corrections\n%s\n", getClass().getSimpleName(),getCoord().toString()); + if(debug) System.out.printf("%s: box center before corrections\n%s\n", getClass().getSimpleName(),getBoxDim().toString()); + getCoord().rotateApache(r); + if(debug) System.out.printf("%s: Coord after corrections\n%s\n", getClass().getSimpleName(),getCoord().toString()); + if(debug) System.out.printf("%s: box center after corrections\n%s\n", getClass().getSimpleName(),getBoxDim().toString()); + + } + + + } + + /** @@ -629,7 +680,7 @@ * @param layer - of the module * @param half - top or bottom half of the tracker */ - private void makeModuleBundle(int layer, String half) + protected void makeModuleBundle(int layer, String half) { if(isDebug()) System.out.printf("%s: makeModule for layer %d %s \n", this.getClass().getSimpleName(), layer, half); @@ -668,12 +719,12 @@ // create the bundle for this module - SVTModuleBundle bundle = new SVTModuleBundle(module); + ModuleBundle bundle = new ModuleBundle(module); addModuleBundle(bundle); -// if(doAxial) makeHalfModule("axial", module); + if(doAxial) makeHalfModule("axial", module); // if(doColdBlock) makeColdBlock(module); -// if(doStereo) makeHalfModule("stereo", module); + if(doStereo) makeHalfModule("stereo", module); if(isDebug()) { @@ -682,6 +733,24 @@ } } + + + + protected HPSTestRunTracker2014GeometryDefinition.TestRunHalfModule createTestRunHalfModuleAxial(String volName, + BaseModule mother, AlignmentCorrection alignmentCorrection, + int layer, String half) { + return new HalfModuleAxial(volName, mother, alignmentCorrection, layer, half); + + } + + protected HPSTestRunTracker2014GeometryDefinition.TestRunHalfModule createTestRunHalfModuleStereo(String volName, + BaseModule mother, AlignmentCorrection alignmentCorrection, + int layer, String half) { + return new HalfModuleStereo(volName, mother, alignmentCorrection, layer, half); + + } + + } Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerBuilder.java ============================================================================= --- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerBuilder.java (original) +++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerBuilder.java Fri Nov 7 17:13:07 2014 @@ -10,7 +10,7 @@ import org.jdom.DataConversionException; import org.jdom.Element; import org.lcsim.detector.Transform3D; -import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TestRunModule; +import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.BaseModule; public abstract class HPSTrackerBuilder { @@ -150,12 +150,14 @@ * @author Per Hansson Adrian <[log in to unmask]> * */ - public static abstract class ModuleBundle { + public static class ModuleBundle { public SurveyVolume module = null; public HalfModuleBundle halfModuleAxial = null; public HalfModuleBundle halfModuleStereo = null; protected SurveyVolume coldBlock = null; - abstract public void print(); + public ModuleBundle(BaseModule m) { + module = m; + } public int getLayer() { if(module==null) throw new RuntimeException("Need to add module to bundle first!"); return HPSTrackerBuilder.getLayerFromVolumeName(module.getName()); @@ -167,6 +169,12 @@ 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(); } } @@ -317,7 +325,7 @@ * @param module - to find * @return bundle */ - protected ModuleBundle getModuleBundle(TestRunModule module) { + protected ModuleBundle getModuleBundle(BaseModule module) { return getModuleBundle(module.getLayer(), module.getHalf()); } @@ -326,7 +334,7 @@ * @param module - to find * @return bundle */ - protected HalfModuleBundle getHalfModuleBundle(TestRunModule module, String halfModuleName) { + protected HalfModuleBundle getHalfModuleBundle(BaseModule module, String halfModuleName) { ModuleBundle m = getModuleBundle(module.getLayer(), module.getHalf()); HalfModuleBundle hm = null; if(m!=null) { Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerGeometryDefinition.java ============================================================================= --- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerGeometryDefinition.java (original) +++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerGeometryDefinition.java Fri Nov 7 17:13:07 2014 @@ -6,6 +6,17 @@ import hep.physics.vec.BasicHep3Vector; import org.jdom.Element; +import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.ActiveSensor; +import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.BaseModule; +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.TestRunHalfModuleAxial; +import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TestRunHalfModuleBundle; +import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TestRunHalfModuleStereo; +import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TestRunModule; /** * @@ -50,9 +61,185 @@ super(debug, node); } + + protected abstract void makeModuleBundle(int layer, String half); + protected abstract TestRunHalfModule createTestRunHalfModuleAxial(String volName, BaseModule mother, AlignmentCorrection alignmentCorrection, int layer, String half); + protected abstract TestRunHalfModule createTestRunHalfModuleStereo(String volName, BaseModule mother, AlignmentCorrection alignmentCorrection, int layer, String half); + protected boolean doLayer(int layer) { int a = (1<<(layer-1)) & layerBitMask; return a!=0?true:false; + } + + + + + /** + * Create the half-module. + * @param side - stereo or axial + * @param mother to the half-module + */ + protected void makeHalfModule(String side, BaseModule mother) { + + String moduleName = mother.getName(); + + if(isDebug()) System.out.printf("%s: makeHalfModule for %s %s \n", this.getClass().getSimpleName(), moduleName, side); + + String volName = moduleName + "_halfmodule_" + side; + + // top or bottom? + String half = mother.getHalf(); + boolean isTopLayer = !mother.isBottom(); + + // find layer + int layer = mother.getLayer(); + + // axial or stereo + boolean isAxial = isAxialFromName(volName); + + // find layer according to old definition + int oldLayer = getOldGeomDefLayerFromVolumeName(isTopLayer, layer, isAxial); + //if(isDebug()) System.out.printf("%s: half? %s layer %d oldlayer %d axial? %s\n", + // this.getClass().getSimpleName(), isTopLayer?"top":"bottom", layer,oldLayer,isAxial?"yes":"no"); + + // find alignment correction to this volume + AlignmentCorrection alignmentCorrection = getHalfModuleAlignmentCorrection(isTopLayer, oldLayer); + + + // find the bundle that it will be added to + //TestRunModuleBundle bundle = (TestRunModuleBundle)getModuleBundle(mother); + //TestRunHalfModuleBundle halfModuleBundle; + ModuleBundle bundle = getModuleBundle(mother); + HalfModuleBundle halfModuleBundle; + + + // Build the half-module + TestRunHalfModule halfModule; + if(isAxial) { + halfModule = createTestRunHalfModuleAxial(volName, mother, alignmentCorrection, layer, half); + halfModuleBundle = new TestRunHalfModuleBundle(halfModule); + bundle.halfModuleAxial = halfModuleBundle; + } else { + halfModule = createTestRunHalfModuleStereo(volName, mother, alignmentCorrection, layer, half); + halfModuleBundle = new TestRunHalfModuleBundle(halfModule); + bundle.halfModuleStereo = halfModuleBundle; + } + + + // create the half module components + + makeHalfModuleComponentSensor(halfModule); + + makeHalfModuleComponentKapton(halfModule); + + makeHalfModuleComponentCF(halfModule); + + makeHalfModuleComponentHybrid(halfModule); + + + + + } + + + + + void makeHalfModuleComponentHybrid(TestRunHalfModule mother) { + + if(isDebug()) System.out.printf("%s: makeHalfModuleComponentHybrid for %s \n", this.getClass().getSimpleName(), mother.getName()); + + String volName = mother.getName() + "_hybrid"; + + // Build the half-module + + // id is hard coded + int component_number = 3; + + Hybrid hybrid = new Hybrid(volName,mother,component_number); + hybrid.setMaterial("G10"); + + TestRunHalfModuleBundle hm = (TestRunHalfModuleBundle) getHalfModuleBundle((BaseModule) 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()); + + + } + + void makeHalfModuleComponentCF(TestRunHalfModule mother) { + + if(isDebug()) System.out.printf("%s: makeHalfModuleComponentCF for %s \n", this.getClass().getSimpleName(), mother.getName()); + + + String volName = mother.getName() + "_cf"; + + // Build the half-module + + // id is hard coded + int component_number = 1; + + CarbonFiber cf = new CarbonFiber(volName,mother,component_number); + cf.setMaterial("CarbonFiber"); + + TestRunHalfModuleBundle hm = (TestRunHalfModuleBundle) getHalfModuleBundle((BaseModule) mother.getMother(), mother.getName()); + hm.carbonFiber = cf; + + } + + void makeHalfModuleComponentKapton(TestRunHalfModule mother) { + + if(isDebug()) System.out.printf("%s: makeHalfModuleComponentKapton for %s \n", this.getClass().getSimpleName(), mother.getName()); + + String volName = mother.getName() + "_lamination"; + + // Build the half-module + + // id is hard coded + int component_number = 2; + + HalfModuleLamination lamination = new HalfModuleLamination(volName,mother,component_number); + lamination.setMaterial("Kapton"); + + + TestRunHalfModuleBundle hm = (TestRunHalfModuleBundle) getHalfModuleBundle((BaseModule) mother.getMother(), mother.getName()); + hm.lamination = lamination; + + } + + void makeHalfModuleComponentSensor(TestRunHalfModule mother) { + + if(isDebug()) System.out.printf("%s: makeHalfModuleComponentSensor for %s \n", this.getClass().getSimpleName(), mother.getName()); + + String volName = mother.getName() + "_sensor"; + + // sensor id is hard coded in old geometry to be zero by counting over the components of the module + int component_number = 0; + + // + Sensor sensor = new Sensor(volName, mother, null, component_number); + sensor.setMaterial("Silicon"); + + TestRunHalfModuleBundle hm = (TestRunHalfModuleBundle) getHalfModuleBundle((BaseModule)mother.getMother(), mother.getName()); + hm.sensor = sensor; + + + makeHalfModuleComponentActiveSensor(sensor); + + + } + + 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"; + + ActiveSensor active_sensor = new ActiveSensor(volName, mother); + active_sensor.setMaterial("Silicon"); + + TestRunHalfModuleBundle hm = (TestRunHalfModuleBundle) getHalfModuleBundle((BaseModule) mother.getMother().getMother(), mother.getMother().getName()); + hm.activeSensor = active_sensor; + } Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/SurveyVolume.java ============================================================================= --- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/SurveyVolume.java (original) +++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/SurveyVolume.java Fri Nov 7 17:13:07 2014 @@ -281,10 +281,12 @@ 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()); + if(debug) { + System.out.printf("%s: Survey pos for %s:\n",getClass().getSimpleName(),getName()); + System.out.printf("%s: ballPos %s\n",getClass().getSimpleName(), ballPos.toString()); + System.out.printf("%s: veePos %s\n",getClass().getSimpleName(), veePos.toString()); + System.out.printf("%s: flatPos %s\n",getClass().getSimpleName(), flatPos.toString()); + } } public String getMaterial() { return material; @@ -293,8 +295,10 @@ this.material = material; } public String toString() { - String s = "BaseGeometry " + getName(); - s += "\n" + this.getCoord().toString(); + String s = "==\n" + getName() + ":\n"; + if(getCenter()!=null) s += "Center of box in local coordinates: %s \n" + getCenter().toString(); + if( getBoxDim()!=null) s += "Box dimensions: %s \n" + getBoxDim().toString(); + s += "Coordinate system:\n" + getCoord().toString(); return s; } Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014.java ============================================================================= --- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014.java (original) +++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014.java Fri Nov 7 17:13:07 2014 @@ -8,6 +8,7 @@ import org.jdom.JDOMException; import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition; import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014LCDDBuilder; +import org.lcsim.geometry.compact.converter.HPSTrackerGeometryDefinition; import org.lcsim.geometry.compact.converter.HPSTrackerLCDDBuilder; import org.lcsim.geometry.compact.converter.lcdd.util.Box; import org.lcsim.geometry.compact.converter.lcdd.util.LCDD; ######################################################################## 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