projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/converter/compact
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/converter/compact/HPSTestRunTracker2014Converter.java 2014-10-17 19:26:21 UTC (rev 3368)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/converter/compact/HPSTestRunTracker2014Converter.java 2014-10-17 19:37:10 UTC (rev 3369)
@@ -26,7 +26,6 @@
import org.lcsim.detector.tracker.silicon.SiTrackerModule;
import org.lcsim.geometry.compact.Detector;
import org.lcsim.geometry.compact.Subdetector;
-import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014Builder;
import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014JavaBuilder;
import org.lcsim.geometry.compact.converter.HPSTrackerBuilder;
import org.lcsim.geometry.compact.converter.HPSTrackerJavaBuilder;
@@ -219,7 +218,7 @@
//int layer = HPSTestRunTracker2014Builder.getLayerFromVolumeName(geometryObject.getName());
int layer = HPSTrackerBuilder.getOldGeomDefLayerFromVolumeName(geometryObject.getName());
layerPosId.setValue(builder.getDetectorIdentifierHelper().getFieldIndex("layer"), layer);
- if(_debug) System.out.printf("%s: layerPosId layer = %d (compare with new layer %d)\n", getClass().getSimpleName(),layer, HPSTestRunTracker2014Builder.getLayerFromVolumeName(geometryObject.getName()));
+ if(_debug) System.out.printf("%s: layerPosId layer = %d (compare with new layer %d)\n", getClass().getSimpleName(),layer, HPSTrackerBuilder.getLayerFromVolumeName(geometryObject.getName()));
// find the base DE as mother
IDetectorElement baseDe = builder.getBaseDetectorElement();
projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014Builder.java 2014-10-17 19:26:21 UTC (rev 3368)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014Builder.java 2014-10-17 19:37:10 UTC (rev 3369)
@@ -1,386 +0,0 @@
-/**
- *
- */
-package org.lcsim.geometry.compact.converter;
-
-import java.util.ArrayList;
-
-import org.jdom.Element;
-import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.ActiveSensor;
-import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.Base;
-import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.BaseGeometry;
-import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.BasePlate;
-import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.CSupport;
-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.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.TestRunColdBlock;
-import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TestRunColdBlockL13;
-import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TestRunColdBlockL45;
-import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TestRunHalfModule;
-import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TestRunHalfModuleAxial;
-import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TestRunHalfModuleStereo;
-import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TestRunModule;
-import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TestRunModuleL13;
-import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TestRunModuleL45;
-import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TrackingBase;
-import org.lcsim.geometry.compact.converter.HPSTrackerBuilder.HalfModuleBundle;
-import org.lcsim.geometry.compact.converter.HPSTrackerBuilder.ModuleBundle;
-
-/**
- *
- * Class used to encapsulate the rules for building geometry based building blocks defined in {@link HPSTestRunTracker2014GeometryDefinition}
- *
- * @author Per Hansson Adrian <[log in to unmask]>
- *
- */
-public class HPSTestRunTracker2014Builder extends HPSTrackerBuilder {
-
- public final boolean doAxial = true;
- public final boolean doStereo = true;
- public final boolean doColdBlock = false;
- public final boolean doBottom = true;
- public final boolean doTop = true;
- public final int layerBitMask = 0x1F;
-
-
- /**
- * Default constructor.
- */
- public HPSTestRunTracker2014Builder(boolean debugFlag, Element node) {
- super(debugFlag,node);
- }
-
-
-
- public void build() {
- if(isDebug()) System.out.printf("%s: constructing the geometry objects\n", this.getClass().getSimpleName());
-
- // 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);
- geometries.add(tracking);
- HPSTestRunTracker2014GeometryDefinition.Base base = new HPSTestRunTracker2014GeometryDefinition.Base("base",tracking);
- geometries.add(base);
- HPSTestRunTracker2014GeometryDefinition.BasePlate basePlate = new HPSTestRunTracker2014GeometryDefinition.BasePlate("baseplate",base, "Aluminum");
- geometries.add(basePlate);
- HPSTestRunTracker2014GeometryDefinition.CSupport cSupport = new HPSTestRunTracker2014GeometryDefinition.CSupport("c_support", base);
- geometries.add(cSupport);
- HPSTestRunTracker2014GeometryDefinition.SupportBottom supportBottom = new HPSTestRunTracker2014GeometryDefinition.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");
- geometries.add(supportPlateBottom);
- HPSTestRunTracker2014GeometryDefinition.SupportTop supportTop = new HPSTestRunTracker2014GeometryDefinition.SupportTop("support_top", base, cSupport);
- geometries.add(supportTop);
- HPSTestRunTracker2014GeometryDefinition.SupportPlateTop supportPlateTop = new HPSTestRunTracker2014GeometryDefinition.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)) continue;
- 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());
- System.out.printf("%s: List of all the geometry objects built\n", this.getClass().getSimpleName());
- for(BaseGeometry bg : geometries) {
- System.out.printf("-------\n%s\n", bg.toString());
- }
- }
- }
-
-
- /**
- * Create the module.
- * @param layer - of the module
- * @param half - top or bottom half of the tracker
- */
- private void makeModuleBundle(int layer, String half)
- {
-
- if(isDebug()) System.out.printf("%s: makeModule for layer %d %s \n", this.getClass().getSimpleName(), layer, half);
-
-
- // build the module name
- String volName = "module_L"+ layer + (half=="bottom"?"b":"t");
-
- boolean isL13 = ( layer >=1 && layer <=3 ) ? true : false;
-
- // 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.BaseGeometry mother;
- final HPSTestRunTracker2014GeometryDefinition.BaseGeometry ref;
- if(half == "bottom") {
- mother = getBaseGeometry(HPSTestRunTracker2014GeometryDefinition.Base.class);
- ref = getBaseGeometry(HPSTestRunTracker2014GeometryDefinition.SupportPlateBottom.class);
- } else {
- mother= getBaseGeometry(HPSTestRunTracker2014GeometryDefinition.Base.class);
- ref = getBaseGeometry(HPSTestRunTracker2014GeometryDefinition.SupportPlateTop.class);
- }
-
- //Create the module
- HPSTestRunTracker2014GeometryDefinition.TestRunModule module;
- if(isL13) {
- module = new HPSTestRunTracker2014GeometryDefinition.TestRunModuleL13(volName, mother, ref, layer, half);
- } else {
- module = new HPSTestRunTracker2014GeometryDefinition.TestRunModuleL45(volName, mother, ref, layer, half);
- }
-
-
- // create the bundle for this module
- ModuleBundle bundle = new ModuleBundle(module);
- addModuleBundle(bundle);
-
- if(doAxial) makeHalfModule("axial", module);
- if(doColdBlock) makeColdBlock(module);
- if(doStereo) makeHalfModule("stereo", module);
-
-
- if(isDebug()) {
- System.out.printf("%s: created module bundle:\n", this.getClass().getSimpleName());
- bundle.print();
- }
-
- }
-
-
-
- /**
- * Create the cold block object.
- * @param mother to the cold block
- */
- private void makeColdBlock(HPSTestRunTracker2014GeometryDefinition.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
- HPSTestRunTracker2014GeometryDefinition.TestRunColdBlock coldBlock;
-
- if(layer >= 1 && layer <=3) {
- coldBlock = new HPSTestRunTracker2014GeometryDefinition.TestRunColdBlockL13(volName, mother, layer);
- } else if(layer >= 4 && layer <=5) {
- coldBlock = new HPSTestRunTracker2014GeometryDefinition.TestRunColdBlockL45(volName, mother, layer);
- } 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, HPSTestRunTracker2014GeometryDefinition.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();
-
- // find layer
- int layer = mother.getLayer();
-
- ModuleBundle bundle = getModuleBundle(mother);
- HalfModuleBundle halfModuleBundle;
-
- // Build the half-module
- HPSTestRunTracker2014GeometryDefinition.TestRunHalfModule halfModule;
- if(side == "axial") {
- halfModule = new HPSTestRunTracker2014GeometryDefinition.TestRunHalfModuleAxial(volName, mother, layer, half);
- halfModuleBundle = new HalfModuleBundle(halfModule);
- bundle.halfModuleAxial = halfModuleBundle;
- } else if(side == "stereo") {
- halfModule = new HPSTestRunTracker2014GeometryDefinition.TestRunHalfModuleStereo(volName, mother, layer, half);
- halfModuleBundle = new HalfModuleBundle(halfModule);
- bundle.halfModuleStereo = halfModuleBundle;
- } else {
- throw new IllegalArgumentException("not a valid half-module side " + side);
- }
-
-
- // create the half module components
-
- makeHalfModuleComponentSensor(halfModule);
-
- makeHalfModuleComponentKapton(halfModule);
-
- makeHalfModuleComponentCF(halfModule);
-
- makeHalfModuleComponentHybrid(halfModule);
-
-
-
-
- }
-
-
-
- private void makeHalfModuleComponentHybrid(HPSTestRunTracker2014GeometryDefinition.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;
-
- HPSTestRunTracker2014GeometryDefinition.Hybrid hybrid = new HPSTestRunTracker2014GeometryDefinition.Hybrid(volName,mother,component_number);
- hybrid.setMaterial("G10");
-
- HalfModuleBundle hm = getHalfModuleBundle((HPSTestRunTracker2014GeometryDefinition.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(HPSTestRunTracker2014GeometryDefinition.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;
-
- HPSTestRunTracker2014GeometryDefinition.CarbonFiber cf = new HPSTestRunTracker2014GeometryDefinition.CarbonFiber(volName,mother,component_number);
- cf.setMaterial("CarbonFiber");
-
- HalfModuleBundle hm = getHalfModuleBundle((HPSTestRunTracker2014GeometryDefinition.TestRunModule) mother.getMother(), mother.getName());
- hm.carbonFiber = cf;
-
- }
-
-
-
-
- private void makeHalfModuleComponentKapton(HPSTestRunTracker2014GeometryDefinition.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;
-
- HPSTestRunTracker2014GeometryDefinition.HalfModuleLamination lamination = new HPSTestRunTracker2014GeometryDefinition.HalfModuleLamination(volName,mother,component_number);
- lamination.setMaterial("Kapton");
-
-
- HalfModuleBundle hm = getHalfModuleBundle((HPSTestRunTracker2014GeometryDefinition.TestRunModule) mother.getMother(), mother.getName());
- hm.lamination = lamination;
-
- }
-
-
- private void makeHalfModuleComponentSensor(HPSTestRunTracker2014GeometryDefinition.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;
-
- //
- HPSTestRunTracker2014GeometryDefinition.Sensor sensor = new HPSTestRunTracker2014GeometryDefinition.Sensor(volName, mother, component_number);
- sensor.setMaterial("Silicon");
-
- HalfModuleBundle hm = getHalfModuleBundle((HPSTestRunTracker2014GeometryDefinition.TestRunModule) mother.getMother(), mother.getName());
- hm.sensor = sensor;
-
-
- makeHalfModuleComponentActiveSensor(sensor);
-
-
- }
-
-
- private void makeHalfModuleComponentActiveSensor(HPSTestRunTracker2014GeometryDefinition.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);
- active_sensor.setMaterial("Silicon");
-
- HalfModuleBundle hm = getHalfModuleBundle((HPSTestRunTracker2014GeometryDefinition.TestRunModule) mother.getMother().getMother(), mother.getMother().getName());
- hm.activeSensor = active_sensor;
-
- }
-
- public boolean doLayer(int layer) {
- int a = (1<<(layer-1)) & layerBitMask;
- return a!=0?true:false;
- }
-
-
- /*
- public static Hep3Vector transformToMotherCoord(Hep3Vector vec, BaseGeometry mother, String targetMotherName) {
- int debug =1;
- if(debug>0) System.out.printf("transformToMotherCoord vec %s mother %s target %s\n", vec.toString(), mother.getName(), targetMotherName);
- if(mother.name.equals(targetMotherName)) {
- if(debug>0) System.out.printf(String.format("found the transformed vec %s\n", vec.toString()));
- return vec;
- } else {
- if(mother.name.equals("trackingVolume")) {
- if(debug>0) System.out.print("reached tracking volume. return null?!\n");
- return null;
- }
-
- Transform3D trans = new Transform3D(mother.pos, mother.rot);
- Hep3Vector vec_t = trans.transformed(vec);
- if(debug>0) System.out.print("continue searching\n");
- return transformToMotherCoord(vec_t, mother.mother, targetMotherName);
- }
-
- }
- */
-
-
-
-
-}
projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014.java 2014-10-17 19:26:21 UTC (rev 3368)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014.java 2014-10-17 19:37:10 UTC (rev 3369)
@@ -10,7 +10,6 @@
import org.jdom.Element;
import org.jdom.JDOMException;
import org.lcsim.detector.Transform3D;
-import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014Builder;
import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition;
import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014LCDDBuilder;
import org.lcsim.geometry.compact.converter.HPSTrackerBuilder;