Author: [log in to unmask] Date: Mon Jan 25 11:17:35 2016 New Revision: 4135 Log: Add new 2016 converters. Java still to be tested. Added: java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSTracker2016Converter.java java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2016GeometryDefinition.java java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2016JavaBuilder.java java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2016LCDDBuilder.java java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker2016.java java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/geometry/subdetector/HPSTracker2016.java Added: java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSTracker2016Converter.java ============================================================================= --- java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSTracker2016Converter.java (added) +++ java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSTracker2016Converter.java Mon Jan 25 11:17:35 2016 @@ -0,0 +1,67 @@ +package org.lcsim.detector.converter.compact; + +import org.jdom.Element; +import org.lcsim.geometry.compact.converter.HPSTracker2016JavaBuilder; +import org.lcsim.geometry.compact.converter.HPSTrackerBuilder; +import org.lcsim.geometry.compact.converter.HPSTrackerJavaBuilder; +import org.lcsim.geometry.subdetector.HPSTracker2016; + +public class HPSTracker2016Converter extends HPSTracker2014v1Converter { + + public HPSTracker2016Converter() { + super(); + } + + /* (non-Javadoc) + * @see org.lcsim.detector.converter.compact.HPSTracker2014ConverterBase#initializeBuilder(org.jdom.Element) + */ + protected HPSTrackerJavaBuilder initializeBuilder(Element node) { + return new HPSTracker2016JavaBuilder(_debug, node); + } + + /* (non-Javadoc) + * @see org.lcsim.detector.converter.compact.AbstractSubdetectorConverter#getSubdetectorType() + */ + public Class getSubdetectorType() { + return HPSTracker2016.class; + } + + /* + * Override this to handle different layer structure. + * (non-Javadoc) + * @see org.lcsim.detector.converter.compact.HPSTracker2014ConverterBase#getModuleNumber(org.lcsim.geometry.compact.converter.JavaSurveyVolume) + */ + protected int getModuleNumber(String surveyVolume) { + boolean isTopLayer = HPSTrackerBuilder.getHalfFromName(surveyVolume).equals("top") ? true : false; + int layer = HPSTrackerBuilder.getLayerFromVolumeName(surveyVolume); + int moduleNumber = -1; + if(isTopLayer) { + if(layer < 5 ) { + moduleNumber = 0; + } else { + if(HPSTrackerBuilder.isHoleFromName(surveyVolume)) { + moduleNumber = 0; + } else { + moduleNumber = 2; + } + } + } else { + if(layer < 5 ) { + moduleNumber = 1; + } else { + if(HPSTrackerBuilder.isHoleFromName(surveyVolume)) { + moduleNumber = 1; + } else { + moduleNumber = 3; + } + } + } + + if(moduleNumber<0) throw new RuntimeException("Invalid module nr found for " + surveyVolume); + + return moduleNumber; + } + + + +} Added: java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2016GeometryDefinition.java ============================================================================= --- java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2016GeometryDefinition.java (added) +++ java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2016GeometryDefinition.java Mon Jan 25 11:17:35 2016 @@ -0,0 +1,693 @@ +package org.lcsim.geometry.compact.converter; + +import hep.physics.vec.BasicHep3Vector; +import hep.physics.vec.Hep3Vector; + +import java.util.logging.Logger; + +import org.jdom.Element; +import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.BaseModule; + +/** + * + * Updated geometry information for the HPS tracker 2016 + * + * @author Per Hansson Adrian <[log in to unmask]> + * + */ +public class HPSTracker2016GeometryDefinition extends HPSTracker2014v1GeometryDefinition { + + private static final Logger LOGGER = Logger.getLogger(HPSTracker2014GeometryDefinition.class.getPackage().getName()); + + public HPSTracker2016GeometryDefinition(boolean debug, Element node) { + super(debug, node); + layerBitMask = 0x7F; + } + + @Override + public void build() { + + // Create alignment correction objects + // THis is really a ugly approach with MP corrections initialized before + // and + // the survey corrections based on the XML node + // FIX THIS! //TODO + AlignmentCorrection alignmentCorrections = new AlignmentCorrection(); + alignmentCorrections.setNode(node); + AlignmentCorrection supBotCorr = getL13UChannelAlignmentCorrection(false); + supBotCorr.setNode(node); + AlignmentCorrection supTopCorr = this.getL13UChannelAlignmentCorrection(true); + supTopCorr.setNode(node); + + // 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 + HPSTrackerGeometryDefinition.TrackingVolume tracking = new HPSTrackerGeometryDefinition.TrackingVolume("trackingVolume", null); + surveyVolumes.add(tracking); + + PSVacuumChamber chamber = new PSVacuumChamber("chamber", tracking, null); + surveyVolumes.add(chamber); + + SvtBox svtBox = new SvtBox("base", chamber, null); + surveyVolumes.add(svtBox); + + SvtBoxBasePlate svtBoxBasePlate = new SvtBoxBasePlate("base_plate", svtBox, null); + surveyVolumes.add(svtBoxBasePlate); + + SupportRingL13BottomKinMount supportRingKinL13Bottom = new SupportRingL13BottomKinMount("c_support_kin_L13b", svtBox, supBotCorr); + surveyVolumes.add(supportRingKinL13Bottom); + + LOGGER.info("Construct uChannelL14Bottom"); + + UChannelL13 uChannelL14Bottom = new UChannelL14Bottom("support_bottom_L14", svtBox, alignmentCorrections, supportRingKinL13Bottom); + surveyVolumes.add(uChannelL14Bottom); + + LOGGER.info("Construct uChannelL14BottomPlate"); + + UChannelL14Plate uChannelL14BottomPlate = new UChannelL14BottomPlate("support_plate_bottom_L14", svtBox, null, uChannelL14Bottom); + surveyVolumes.add(uChannelL14BottomPlate); + + LOGGER.info("Constructed uChannelL14BottomPlate: " + uChannelL14BottomPlate.toString()); + + SupportRingL13TopKinMount supportRingKinL13Top = new SupportRingL13TopKinMount("c_support_kin_L13t", svtBox, supTopCorr); + surveyVolumes.add(supportRingKinL13Top); + + UChannelL13 uChannelL14Top = new UChannelL14Top("support_top_L14", svtBox, alignmentCorrections, supportRingKinL13Top); + surveyVolumes.add(uChannelL14Top); + + UChannelL14Plate uChannelL14TopPlate = new UChannelL14TopPlate("support_plate_top_L14", svtBox, null, uChannelL14Top); + surveyVolumes.add(uChannelL14TopPlate); + + UChannelL46 uChannelL46Bottom = new UChannelL46Bottom("support_bottom_L46", svtBox, alignmentCorrections); + surveyVolumes.add(uChannelL46Bottom); + + UChannelL46Plate uChannelL46BottomPlate = new UChannelL46BottomPlate("support_plate_bottom_L46", svtBox, null, uChannelL46Bottom); + surveyVolumes.add(uChannelL46BottomPlate); + + UChannelL46 uChannelL46Top = new UChannelL46Top("support_top_L46", svtBox, alignmentCorrections); + surveyVolumes.add(uChannelL46Top); + + UChannelL46Plate uChannelL46TopPlate = new UChannelL46TopPlate("support_plate_top_L46", svtBox, null, uChannelL46Top); + surveyVolumes.add(uChannelL46TopPlate); + + + LOGGER.info( "Construct modules"); + + for(int l=1; l<=7;++l) { + if(doLayer(l)) { + LOGGER.info( "Construct layer " + l + " modules"); + final SurveyVolume moduleMother = getSurveyVolume(SvtBox.class); + SurveyVolume moduleRef; + if(doBottom) { + if(l < 5) + moduleRef = getSurveyVolume(UChannelL14Bottom.class); + else + moduleRef = getSurveyVolume(UChannelL46Bottom.class); + + LOGGER.info( "Make the bundle for layer " + l + " bottom"); + makeModuleBundle(l, "bottom", moduleMother, moduleRef); + } + + if(doTop) { + if(l < 5) + moduleRef = getSurveyVolume(UChannelL14Top.class); + else + moduleRef = getSurveyVolume(UChannelL46Top.class); + + LOGGER.info( "Make the bundle for layer " + l + " top"); + makeModuleBundle(l, "top", moduleMother, moduleRef); + } + } + } + + + LOGGER.info(String.format("%s: Constructed %d geometry objects", this.getClass().getSimpleName(), surveyVolumes.size())); + LOGGER.info(String.format("%s: Constructed %d module bundles", this.getClass().getSimpleName(), modules.size())); + + if (isDebug()) { + System.out.printf("%s: DONE constructing the geometry objects\n", this.getClass().getSimpleName()); + System.out.printf("%s: List of the survey volumes built\n", this.getClass().getSimpleName()); + for (SurveyVolume bg : surveyVolumes) { + System.out.printf("-------\n%s\n", bg.toString()); + } + } + if (isDebug()) { + System.out.printf("%s: List of the module bundles built\n", this.getClass().getSimpleName()); + for (BaseModuleBundle bundle : this.modules) { + bundle.print(); + } + } + + } + + + /* (non-Javadoc) + * @see org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition#makeModuleBundle(int, java.lang.String, org.lcsim.geometry.compact.converter.SurveyVolume, org.lcsim.geometry.compact.converter.SurveyVolume) + */ + @Override + protected void makeModuleBundle(int layer, String half, SurveyVolume mother, SurveyVolume ref) + { + + LOGGER.info( "makeModule for layer " + layer + " " + half); + + //Create the module + BaseModule module = createModule(half, layer, mother, ref); + + BaseModuleBundle bundle; + + if(layer<=4) { + bundle = new TestRunModuleBundle(module); + addModuleBundle(bundle); + if(doAxial) makeHalfModule("axial", module); + // if(doColdBlock) makeColdBlock(module); + if(doStereo) makeHalfModule("stereo", module); + } else { + bundle = new LongModuleBundle(module); + addModuleBundle(bundle); + if(doAxial) { + makeLongHalfModule("axial","hole", module); + makeLongHalfModule("axial","slot", module); + } + // if(doColdBlock) makeColdBlock(module); + if(doStereo) { + makeLongHalfModule("stereo","hole", module); + makeLongHalfModule("stereo","slot", module); + } + } + + LOGGER.info("created module bundle:\n" + bundle.toString() + "\n" + "Now there are " + modules.size() + " modules"); + + } + + + /* (non-Javadoc) + * @see org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition#createModule(java.lang.String, int, org.lcsim.geometry.compact.converter.SurveyVolume, org.lcsim.geometry.compact.converter.SurveyVolume) + */ + @Override + protected BaseModule createModule(String half, int layer, SurveyVolume mother, SurveyVolume ref) { + + // build the module name + String volName = "module_L"+ layer + (half=="bottom"?"b":"t"); + + // find alignment corrections + AlignmentCorrection alignmentCorrection = new AlignmentCorrection(); + alignmentCorrection.setNode(node); + + BaseModule module; + if(half == "bottom") { + switch (layer) { + case 1: + module = new ModuleL1Bot(volName, mother, alignmentCorrection, ref); + break; + case 2: + module = new ModuleL2Bot(volName, mother, alignmentCorrection, ref); + break; + case 3: + module = new ModuleL3Bot(volName, mother, alignmentCorrection, ref); + break; + case 4: + module = new ModuleL4Bot(volName, mother, alignmentCorrection, ref); + break; + case 5: + module = new ModuleL5Bot(volName, mother, alignmentCorrection, ref); + break; + case 6: + module = new ModuleL6Bot(volName, mother, alignmentCorrection, ref); + break; + case 7: + module = new ModuleL7Bot(volName, mother, alignmentCorrection, ref); + break; + default: + throw new IllegalArgumentException("Can't make layer " + layer); + } + } else { + switch (layer) { + case 1: + module = new ModuleL1Top(volName, mother, alignmentCorrection, ref); + break; + case 2: + module = new ModuleL2Top(volName, mother, alignmentCorrection, ref); + break; + case 3: + module = new ModuleL3Top(volName, mother, alignmentCorrection, ref); + break; + case 4: + module = new ModuleL4Top(volName, mother, alignmentCorrection, ref); + break; + case 5: + module = new ModuleL5Top(volName, mother, alignmentCorrection, ref); + break; + case 6: + module = new ModuleL6Top(volName, mother, alignmentCorrection, ref); + break; + case 7: + module = new ModuleL7Top(volName, mother, alignmentCorrection, ref); + break; + default: + throw new IllegalArgumentException("Can't make layer " + layer); + } + } + return module; + } + + + + + public abstract static class UChannelL14Plate extends HPSTracker2014GeometryDefinition.UChannelL13Plate { + protected final static double length = HPSTracker2014GeometryDefinition.UChannelL13Plate.length + 50.0; + protected final static double height = HPSTracker2014GeometryDefinition.UChannelL13Plate.height; + protected static final double width = HPSTracker2014GeometryDefinition.UChannelL13Plate.width; + + public UChannelL14Plate(String name, SurveyVolume m, AlignmentCorrection alignmentCorrection, SurveyVolume ref) { + super(name, m, alignmentCorrection, ref); + } + + @Override + public double getLength() { + return length; + } + + @Override + public double getHeight() { + return height; + } + + @Override + public double getWidth() { + return width; + } + + } + + public static abstract class UChannelL14 extends HPSTracker2014GeometryDefinition.UChannelL13 { + protected static final double length = UChannelL14BottomPlate.length; + private static final double width = UChannelL14BottomPlate.width; + protected static final double height = HPSTracker2014GeometryDefinition.UChannelL13.height; + protected static final double side_plate_cone_y = HPSTracker2014GeometryDefinition.UChannelL13.side_plate_cone_y; + + public UChannelL14(String name, SurveyVolume m, AlignmentCorrection alignmentCorrection, SurveyVolume ref) { + super(name, m, alignmentCorrection, ref); + } + + @Override + protected double getLength() { + return length; + } + + @Override + protected double getWidth() { + return width; + } + + @Override + protected double getHeight() { + return height; + } + + } + + public static class UChannelL14BottomPlate extends UChannelL14Plate { + + public UChannelL14BottomPlate(String name, SurveyVolume m, AlignmentCorrection alignmentCorrection, SurveyVolume ref) { + super(name, m, alignmentCorrection, ref); + init(); + } + + @Override + protected void setCenter() { + System.out.println("UChannelL14BottomPlate setCenter"); + + final double x = 0.0; + double y = UChannelL14Bottom.cone_to_edge_of_plate_y - getLength() / 2.0; + // with coordinate system 'y' pointing from L1 to L3 we want to + // subtract the difference in length + y -= UChannelL14Bottom.length_diff; + final double z = -UChannelL13.side_plate_cone_y - getHeight() / 2.0; + setCenter(x, y, z); + } + + } + + public static class UChannelL14Bottom extends UChannelL13Bottom { + protected static final double length = UChannelL14BottomPlate.length; + private static final double width = UChannelL14BottomPlate.width; + protected static final double height = HPSTracker2014GeometryDefinition.UChannelL13.height; + // this length need to be longer by the difference in length + protected static final double length_diff = length - HPSTracker2014GeometryDefinition.UChannelL13Bottom.length; + protected static final double cone_to_edge_of_plate_y = HPSTracker2014GeometryDefinition.UChannelL13Bottom.cone_to_edge_of_plate_y + length_diff; + + public UChannelL14Bottom(String name, SurveyVolume m, AlignmentCorrection alignmentCorrection, SurveyVolume ref) { + super(name, m, alignmentCorrection, ref); + } + + protected void setCenter() { + final double x = 0.0; + double y = cone_to_edge_of_plate_y - getLength() / 2.0; + // with coordinate system 'y' pointing from L1 to L3 we want to + // subtract the difference in length + y -= UChannelL14Bottom.length_diff; + final double z = -side_plate_cone_y - UChannelL14Plate.height + getHeight() / 2.0; + setCenter(x, y, z); + } + + @Override + protected double getLength() { + return length; + } + + @Override + protected double getWidth() { + return width; + } + + @Override + protected double getHeight() { + return height; + } + + } + + + + public static class UChannelL14TopPlate extends UChannelL14Plate { + + public UChannelL14TopPlate(String name, SurveyVolume m, AlignmentCorrection alignmentCorrection, SurveyVolume ref) { + super(name, m, alignmentCorrection, ref); + init(); + } + + @Override + protected void setCenter() { + System.out.println("UChannelL14TopPlate setCenter"); + + final double x = 0.0; + double y = UChannelL14Top.cone_to_edge_of_plate_y - getLength() / 2.0; + // with coordinate system 'y' pointing from L1 to L3 we want to + // subtract the difference in length + y -= UChannelL14Top.length_diff; + final double z = -UChannelL13.side_plate_cone_y - getHeight() / 2.0; + setCenter(x, y, z); + } + + } + + + + public static class UChannelL14Top extends UChannelL13Top { + protected static final double length = UChannelL14TopPlate.length; + private static final double width = UChannelL14TopPlate.width; + protected static final double height = HPSTracker2014GeometryDefinition.UChannelL13.height; + // this length need to be longer by the difference in length + protected static final double length_diff = length - HPSTracker2014GeometryDefinition.UChannelL13Top.length; + protected static final double cone_to_edge_of_plate_y = HPSTracker2014GeometryDefinition.UChannelL13Top.cone_to_edge_of_plate_y + length_diff; + + public UChannelL14Top(String name, SurveyVolume m, AlignmentCorrection alignmentCorrection, SurveyVolume ref) { + super(name, m, alignmentCorrection, ref); + } + + protected void setCenter() { + final double x = 0.0; + double y = cone_to_edge_of_plate_y - getLength() / 2.0; + // with coordinate system 'y' pointing from L1 to L3 we want to + // subtract the difference in length + y -= UChannelL14Top.length_diff; + final double z = -side_plate_cone_y - UChannelL14Plate.height + getHeight() / 2.0; + setCenter(x, y, z); + } + + @Override + protected double getLength() { + return length; + } + + @Override + protected double getWidth() { + return width; + } + + @Override + protected double getHeight() { + return height; + } + + } + + + + + + + + + + + + + + + + + + + public static class ModuleL1Bot extends HPSTracker2014GeometryDefinition.ModuleL1Bot { + + //protected final static double cone_to_hole_along_uchannel = HPSTracker2014GeometryDefinition.ModuleL1Bot.cone_to_hole_along_uchannel; + // shift 50mm along the U-channel and adjust also the vertical distance from the beam due to the 15mrad opening angle + private final static double shift = 50.; + private final static double shift_vertical = 15e-3 * shift; + protected final static double cone_to_hole_along_uchannel = HPSTracker2014GeometryDefinition.ModuleL1Bot.cone_to_hole_along_uchannel - shift; + protected final static double cone_to_hole_vertical_from_uchannel = HPSTracker2014GeometryDefinition.ModuleL1Bot.cone_to_hole_vertical_from_uchannel + shift_vertical; + protected final static double cone_to_hole_across_uchannel = HPSTracker2014GeometryDefinition.ModuleL13Bot.cone_to_hole_across_uchannel; + + public ModuleL1Bot(String name, SurveyVolume mother, AlignmentCorrection alignmentCorrection, SurveyVolume ref) { + super(name, mother, alignmentCorrection, ref); + } + + @Override + protected Hep3Vector getHolePosition() { + double x = cone_to_hole_across_uchannel; + double y = cone_to_hole_along_uchannel; + double z = cone_to_hole_vertical_from_uchannel; + return new BasicHep3Vector(x, y, z); + } + + } + + + + public static class ModuleL1Top extends HPSTracker2014GeometryDefinition.ModuleL1Top { + + //protected final static double cone_to_hole_along_uchannel = HPSTracker2014GeometryDefinition.ModuleL1Top.cone_to_hole_along_uchannel; + // shift 50mm along the U-channel and adjust also the vertical distance from the beam due to the 15mrad opening angle + private final static double shift = 50.; + private final static double shift_vertical = 15e-3 * shift; + protected final static double cone_to_hole_along_uchannel = HPSTracker2014GeometryDefinition.ModuleL1Top.cone_to_hole_along_uchannel - shift; + protected final static double cone_to_hole_vertical_from_uchannel = HPSTracker2014GeometryDefinition.ModuleL1Top.cone_to_hole_vertical_from_uchannel + shift_vertical; + protected final static double cone_to_hole_across_uchannel = HPSTracker2014GeometryDefinition.ModuleL13Top.cone_to_hole_across_uchannel; + + public ModuleL1Top(String name, SurveyVolume mother, AlignmentCorrection alignmentCorrection, SurveyVolume ref) { + super(name, mother, alignmentCorrection, ref); + } + + @Override + protected Hep3Vector getHolePosition() { + double x = cone_to_hole_across_uchannel; + double y = cone_to_hole_along_uchannel; + double z = cone_to_hole_vertical_from_uchannel; + return new BasicHep3Vector(x, y, z); + } + + } + + public static class ModuleL2Bot extends ModuleL13Bot { + // Note the L1 measures are used here + protected final static double cone_to_hole_along_uchannel = HPSTracker2014GeometryDefinition.ModuleL1Bot.cone_to_hole_along_uchannel; + protected final static double cone_to_hole_vertical_from_uchannel = HPSTracker2014GeometryDefinition.ModuleL1Bot.cone_to_hole_vertical_from_uchannel; + + public ModuleL2Bot(String name, SurveyVolume mother, + AlignmentCorrection alignmentCorrection, SurveyVolume ref) { + super(name, mother, alignmentCorrection, ref); + init(); + } + protected Hep3Vector getHolePosition() { + double x = cone_to_hole_across_uchannel; + double y = cone_to_hole_along_uchannel; + double z = cone_to_hole_vertical_from_uchannel; + return new BasicHep3Vector(x, y, z); + } + + } + + public static class ModuleL2Top extends ModuleL13Top { + // Note the L1 measures are used here + protected final static double cone_to_hole_along_uchannel = HPSTracker2014GeometryDefinition.ModuleL1Top.cone_to_hole_along_uchannel; + protected final static double cone_to_hole_vertical_from_uchannel = HPSTracker2014GeometryDefinition.ModuleL1Top.cone_to_hole_vertical_from_uchannel; + + public ModuleL2Top(String name, SurveyVolume mother, + AlignmentCorrection alignmentCorrection, SurveyVolume ref) { + super(name, mother, alignmentCorrection, ref); + init(); + } + protected Hep3Vector getHolePosition() { + double x = cone_to_hole_across_uchannel; + double y = cone_to_hole_along_uchannel; + double z = cone_to_hole_vertical_from_uchannel; + return new BasicHep3Vector(x, y, z); + } + + } + + public static class ModuleL3Bot extends ModuleL13Bot { + // Note the L2 measures are used here + protected final static double cone_to_hole_along_uchannel = HPSTracker2014GeometryDefinition.ModuleL2Bot.cone_to_hole_along_uchannel; + protected final static double cone_to_hole_vertical_from_uchannel = HPSTracker2014GeometryDefinition.ModuleL2Bot.cone_to_hole_vertical_from_uchannel; + + public ModuleL3Bot(String name, SurveyVolume mother, + AlignmentCorrection alignmentCorrection, SurveyVolume ref) { + super(name, mother, alignmentCorrection, ref); + init(); + } + protected Hep3Vector getHolePosition() { + double x = cone_to_hole_across_uchannel; + double y = cone_to_hole_along_uchannel; + double z = cone_to_hole_vertical_from_uchannel; + return new BasicHep3Vector(x, y, z); + } + + } + + public static class ModuleL3Top extends ModuleL13Top { + // Note the L2 measures are used here + protected final static double cone_to_hole_along_uchannel = HPSTracker2014GeometryDefinition.ModuleL2Top.cone_to_hole_along_uchannel; + protected final static double cone_to_hole_vertical_from_uchannel = HPSTracker2014GeometryDefinition.ModuleL2Top.cone_to_hole_vertical_from_uchannel; + + public ModuleL3Top(String name, SurveyVolume mother, + AlignmentCorrection alignmentCorrection, SurveyVolume ref) { + super(name, mother, alignmentCorrection, ref); + init(); + } + protected Hep3Vector getHolePosition() { + double x = cone_to_hole_across_uchannel; + double y = cone_to_hole_along_uchannel; + double z = cone_to_hole_vertical_from_uchannel; + return new BasicHep3Vector(x, y, z); + } + + } + + public static class ModuleL4Bot extends ModuleL13Bot { + // Note the L2 measures are used here + protected final static double cone_to_hole_along_uchannel = HPSTracker2014GeometryDefinition.ModuleL3Bot.cone_to_hole_along_uchannel; + protected final static double cone_to_hole_vertical_from_uchannel = HPSTracker2014GeometryDefinition.ModuleL3Bot.cone_to_hole_vertical_from_uchannel; + + public ModuleL4Bot(String name, SurveyVolume mother, + AlignmentCorrection alignmentCorrection, SurveyVolume ref) { + super(name, mother, alignmentCorrection, ref); + init(); + } + protected Hep3Vector getHolePosition() { + double x = cone_to_hole_across_uchannel; + double y = cone_to_hole_along_uchannel; + double z = cone_to_hole_vertical_from_uchannel; + return new BasicHep3Vector(x, y, z); + } + + } + + public static class ModuleL4Top extends ModuleL13Top { + // Note the L2 measures are used here + protected final static double cone_to_hole_along_uchannel = HPSTracker2014GeometryDefinition.ModuleL3Top.cone_to_hole_along_uchannel; + protected final static double cone_to_hole_vertical_from_uchannel = HPSTracker2014GeometryDefinition.ModuleL3Top.cone_to_hole_vertical_from_uchannel; + + public ModuleL4Top(String name, SurveyVolume mother, + AlignmentCorrection alignmentCorrection, SurveyVolume ref) { + super(name, mother, alignmentCorrection, ref); + init(); + } + protected Hep3Vector getHolePosition() { + double x = cone_to_hole_across_uchannel; + double y = cone_to_hole_along_uchannel; + double z = cone_to_hole_vertical_from_uchannel; + return new BasicHep3Vector(x, y, z); + } + + } + + + public static class ModuleL5Bot extends HPSTracker2014GeometryDefinition.ModuleL4Bot { + + public ModuleL5Bot(String name, SurveyVolume mother, AlignmentCorrection alignmentCorrection, SurveyVolume ref) { + super(name, mother, alignmentCorrection, ref); + } + } + + public static class ModuleL5Top extends HPSTracker2014GeometryDefinition.ModuleL4Top { + + public ModuleL5Top(String name, SurveyVolume mother, AlignmentCorrection alignmentCorrection, SurveyVolume ref) { + super(name, mother, alignmentCorrection, ref); + } + } + + public static class ModuleL6Bot extends HPSTracker2014GeometryDefinition.ModuleL5Bot { + + public ModuleL6Bot(String name, SurveyVolume mother, AlignmentCorrection alignmentCorrection, SurveyVolume ref) { + super(name, mother, alignmentCorrection, ref); + } + } + + public static class ModuleL6Top extends HPSTracker2014GeometryDefinition.ModuleL5Top { + + public ModuleL6Top(String name, SurveyVolume mother, AlignmentCorrection alignmentCorrection, SurveyVolume ref) { + super(name, mother, alignmentCorrection, ref); + } + } + + public static class ModuleL7Bot extends HPSTracker2014GeometryDefinition.ModuleL6Bot { + + public ModuleL7Bot(String name, SurveyVolume mother, AlignmentCorrection alignmentCorrection, SurveyVolume ref) { + super(name, mother, alignmentCorrection, ref); + } + } + + public static class ModuleL7Top extends HPSTracker2014GeometryDefinition.ModuleL6Top { + + public ModuleL7Top(String name, SurveyVolume mother, AlignmentCorrection alignmentCorrection, SurveyVolume ref) { + super(name, mother, alignmentCorrection, ref); + } + } + + + + + /* (non-Javadoc) + * @see org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition#getMillepedeLayer(java.lang.String) + */ + @Override + public int getMillepedeLayer(String name) { + + boolean isTopLayer = getHalfFromName(name).equals("top") ? true : false; + + // find layer + int layer = getLayerFromVolumeName(name); + + // axial or stereo + boolean isAxial = isAxialFromName(name); + + // use default layer numbering for L1-4 + if(layer<5) { + return getOldLayerDefinition(isTopLayer, layer, isAxial); + } + + // hole or slot + boolean isHole = isHoleFromName(name); + + return getMillepedeLayer(isTopLayer, layer, isAxial, isHole); + + } + + + + + +} Added: java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2016JavaBuilder.java ============================================================================= --- java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2016JavaBuilder.java (added) +++ java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2016JavaBuilder.java Mon Jan 25 11:17:35 2016 @@ -0,0 +1,17 @@ +package org.lcsim.geometry.compact.converter; + +import org.jdom.Element; + +public class HPSTracker2016JavaBuilder extends HPSTracker2014v1JavaBuilder { + + public HPSTracker2016JavaBuilder(boolean debugFlag, Element node) { + super(debugFlag, node); + } + + @Override + public HPSTrackerGeometryDefinition createGeometryDefinition(boolean debug, Element node) { + return new HPSTracker2016GeometryDefinition(debug, node); + } + + +} Added: java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2016LCDDBuilder.java ============================================================================= --- java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2016LCDDBuilder.java (added) +++ java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2016LCDDBuilder.java Mon Jan 25 11:17:35 2016 @@ -0,0 +1,139 @@ +package org.lcsim.geometry.compact.converter; + +import org.jdom.Element; +import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.PSVacuumChamber; +import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.SvtBox; +import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.SvtBoxBasePlate; +import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.UChannelL13Bottom; +import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.UChannelL13BottomPlate; +import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.UChannelL13Top; +import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.UChannelL13TopPlate; +import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.UChannelL46Bottom; +import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.UChannelL46BottomPlate; +import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.UChannelL46Top; +import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.UChannelL46TopPlate; +import org.lcsim.geometry.compact.converter.HPSTracker2016GeometryDefinition.UChannelL14Bottom; +import org.lcsim.geometry.compact.converter.HPSTracker2016GeometryDefinition.UChannelL14BottomPlate; +import org.lcsim.geometry.compact.converter.HPSTracker2016GeometryDefinition.UChannelL14Top; +import org.lcsim.geometry.compact.converter.HPSTracker2016GeometryDefinition.UChannelL14TopPlate; +import org.lcsim.geometry.compact.converter.HPSTrackerBuilder.BaseModuleBundle; +import org.lcsim.geometry.compact.converter.HPSTrackerGeometryDefinition.TrackingVolume; +import org.lcsim.geometry.compact.converter.lcdd.util.LCDD; +import org.lcsim.geometry.compact.converter.lcdd.util.SensitiveDetector; +import org.lcsim.geometry.compact.converter.lcdd.util.Volume; + +public class HPSTracker2016LCDDBuilder extends HPSTracker2014v1LCDDBuilder { + + public HPSTracker2016LCDDBuilder(boolean debugFlag, Element node, + LCDD lcdd, SensitiveDetector sens) { + super(debugFlag, node, lcdd, sens); + } + + @Override + public HPSTrackerGeometryDefinition createGeometryDefinition(boolean debug, + Element node) { + return new HPSTracker2016GeometryDefinition(_debug, node); + } + + + + + @Override + public void build(Volume worldVolume) { + + + // set and build geometry + setBuilder(); + + if(_builder==null) throw new RuntimeException("need to set builder class before calling build!"); + + if(isDebug()) System.out.printf("%s: build the base geometry objects\n", getClass().getSimpleName()); + + _builder.build(); + + if(isDebug()) System.out.printf("%s: DONE build the base geometry objects\n", getClass().getSimpleName()); + + + if(isDebug()) System.out.printf("%s: build the LCDD geometry objects\n", getClass().getSimpleName()); + + + LCDDSurveyVolume trackingGeometry = new LCDDSurveyVolume(_builder.getSurveyVolume(TrackingVolume.class), worldVolume); + add(trackingGeometry); + +// baseSurveyVolume = new LCDDSurveyVolume(_builder.getSurveyVolume(PSVacuumChamber.class), lcdd, trackingGeometry); +// add(baseSurveyVolume); + LCDDSurveyVolume vacuumChamberVolume = new LCDDGhostSurveyVolume(_builder.getSurveyVolume(PSVacuumChamber.class), trackingGeometry); + add(vacuumChamberVolume); + +// LCDDSurveyVolume svtBox = new LCDDSurveyVolume(_builder.getSurveyVolume(SvtBox.class), lcdd, baseSurveyVolume); +// add(svtBox); + + LCDDSurveyVolume svtBox = new LCDDSurveyVolume(_builder.getSurveyVolume(SvtBox.class), lcdd, vacuumChamberVolume); + baseSurveyVolume = svtBox; + add(baseSurveyVolume); + + + LCDDSurveyVolume svtBoxBasePlate = new LCDDSurveyVolume(_builder.getSurveyVolume(SvtBoxBasePlate.class), lcdd, svtBox); + add(svtBoxBasePlate); + + + LCDDSurveyVolume uChannelL14Bottom = new LCDDGhostSurveyVolume(_builder.getSurveyVolume(UChannelL14Bottom.class), svtBox); + add(uChannelL14Bottom); + + SurveyVolume v = _builder.getSurveyVolume(UChannelL14BottomPlate.class); + if(v==null) { + System.out.printf("%s: couldnt find UChannelL14BottomPlate class among %d volumes\n", this.getClass().getSimpleName(), _builder.surveyVolumes.size()); + for (SurveyVolume vol : _builder.surveyVolumes) System.out.printf("%s:vol %s\n", this.getClass().getSimpleName(), vol.toString()); + } + LCDDSurveyVolume uChannelL14BottomPlate = new LCDDSurveyVolume(_builder.getSurveyVolume(UChannelL14BottomPlate.class), lcdd, svtBox); + add(uChannelL14BottomPlate); + + LCDDSurveyVolume uChannelL14Top = new LCDDGhostSurveyVolume(_builder.getSurveyVolume(UChannelL14Top.class), svtBox); + add(uChannelL14Top); + + LCDDSurveyVolume uChannelL14TopPlate = new LCDDSurveyVolume(_builder.getSurveyVolume(UChannelL14TopPlate.class), lcdd, svtBox); + add(uChannelL14TopPlate); + + LCDDSurveyVolume uChannelL46Bottom = new LCDDGhostSurveyVolume(_builder.getSurveyVolume(UChannelL46Bottom.class), svtBox); + add(uChannelL46Bottom); + + LCDDSurveyVolume uChannelL46BottomPlate = new LCDDSurveyVolume(_builder.getSurveyVolume(UChannelL46BottomPlate.class), lcdd, svtBox); + add(uChannelL46BottomPlate); + + LCDDSurveyVolume uChannelL46Top = new LCDDGhostSurveyVolume(_builder.getSurveyVolume(UChannelL46Top.class), svtBox); + add(uChannelL46Top); + + LCDDSurveyVolume uChannelL46TopPlate = new LCDDSurveyVolume(_builder.getSurveyVolume(UChannelL46TopPlate.class), lcdd, svtBox); + add(uChannelL46TopPlate); + + + // build modules + + if(isDebug()) System.out.printf("%s: build modules\n", getClass().getSimpleName()); + + addModules(); + + System.out.printf("%s: Built %d LCDD geometry objects\n", getClass().getSimpleName(), lcddSurveyVolumes.size()); + + if(isDebug()) { + System.out.printf("%s: List of all %d LCDD geometry objects built\n", this.getClass().getSimpleName(), lcddSurveyVolumes.size()); + for(SurveyVolumeImpl bg : lcddSurveyVolumes) { + System.out.printf("-------\n%s\n", bg.toString()); + } + } + + + + // Set visualization features + setVisualization(); + + + + } + + + + + + +} Added: java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker2016.java ============================================================================= --- java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker2016.java (added) +++ java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker2016.java Mon Jan 25 11:17:35 2016 @@ -0,0 +1,63 @@ +package org.lcsim.geometry.compact.converter.lcdd; + +import org.jdom.Element; +import org.jdom.JDOMException; +import org.lcsim.geometry.compact.converter.HPSTracker2016LCDDBuilder; +import org.lcsim.geometry.compact.converter.HPSTrackerBuilder; +import org.lcsim.geometry.compact.converter.HPSTrackerLCDDBuilder; +import org.lcsim.geometry.compact.converter.lcdd.util.LCDD; +import org.lcsim.geometry.compact.converter.lcdd.util.SensitiveDetector; + +public class HPSTracker2016 extends HPSTracker2014v1 +{ + public HPSTracker2016(Element node) throws JDOMException + { + super(node); + } + + /* (non-Javadoc) + * @see org.lcsim.geometry.compact.converter.lcdd.HPSTracker2014Base#initializeBuilder(org.lcsim.geometry.compact.converter.lcdd.util.LCDD, org.lcsim.geometry.compact.converter.lcdd.util.SensitiveDetector) + */ + protected HPSTrackerLCDDBuilder initializeBuilder(LCDD lcdd, SensitiveDetector sens) { + return new HPSTracker2016LCDDBuilder(_debug,node,lcdd,sens); + } + + + /* + * Override this to handle different layer numbering. + * + * (non-Javadoc) + * @see org.lcsim.geometry.compact.converter.lcdd.HPSTracker2014#getModuleNumber(java.lang.String) + */ + protected int getModuleNumber(String surveyVolume) { + boolean isTopLayer = HPSTrackerBuilder.getHalfFromName(surveyVolume).equals("top") ? true : false; + int layer = HPSTrackerBuilder.getLayerFromVolumeName(surveyVolume); + int moduleNumber = -1; + if(isTopLayer) { + if(layer < 5 ) { + moduleNumber = 0; + } else { + if(HPSTrackerBuilder.isHoleFromName(surveyVolume)) { + moduleNumber = 2; + } else { + moduleNumber = 0; + } + } + } else { + if(layer < 5 ) { + moduleNumber = 1; + } else { + if(HPSTrackerBuilder.isHoleFromName(surveyVolume)) { + moduleNumber = 1; + } else { + moduleNumber = 3; + } + } + } + + if(moduleNumber<0) throw new RuntimeException("Invalid module nr found for " + surveyVolume); + + return moduleNumber; + } + +} Added: java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/geometry/subdetector/HPSTracker2016.java ============================================================================= --- java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/geometry/subdetector/HPSTracker2016.java (added) +++ java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/geometry/subdetector/HPSTracker2016.java Mon Jan 25 11:17:35 2016 @@ -0,0 +1,15 @@ +package org.lcsim.geometry.subdetector; + +import org.jdom.Element; +import org.jdom.JDOMException; + +public class HPSTracker2016 extends HPSTracker2014v1 { + + public HPSTracker2016(Element node) throws JDOMException + { + super(node); + } + + + +}