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/HPSTestRunTracker2014Test1Builder.java (rev 0)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014Test1Builder.java 2014-09-12 19:03:20 UTC (rev 3317)
@@ -0,0 +1,113 @@
+/**
+ *
+ */
+package org.lcsim.geometry.compact.converter.lcdd;
+
+import hep.physics.vec.Hep3Vector;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.lcsim.detector.Transform3D;
+import org.lcsim.geometry.compact.converter.lcdd.HPSTestRunTracker2014GeometryDefinition.BaseGeometry;
+import org.lcsim.geometry.compact.converter.lcdd.HPSTestRunTracker2014GeometryDefinition.TestRunHalfModule;
+import org.lcsim.geometry.compact.converter.lcdd.HPSTestRunTracker2014GeometryDefinition.TrackingBase;
+
+/**
+ *
+ * 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 HPSTestRunTracker2014Test1Builder extends HPSTrackerBuilder {
+
+
+ protected static boolean onlyAxial = true;
+ protected static boolean onlyBottom = true;
+ protected static boolean onlyL1 = true;
+
+
+
+ /**
+ * Default constructor.
+ */
+ public HPSTestRunTracker2014Test1Builder(boolean debugFlag) {
+ setDebug(debugFlag);
+
+ 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
+ TrackingBase tracking = new TrackingBase("trackingVolume",null);
+ geometries.add(tracking);
+
+
+ // 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(onlyL1 && l!=1) continue;
+ makeModuleBundle(l,"bottom");
+ if(!onlyBottom)
+ makeModuleBundle(l,"top");
+
+ }
+
+ //if(isDebug()) {
+ System.out.printf("%s: DONE constructing the geometry objects kuk\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)
+ {
+
+ //String moduleName = mother.getName();
+ String moduleName = "module_L"+ layer + (half=="bottom"?"b":"t");
+ String side = "axial";
+
+ if(isDebug()) System.out.printf("%s: makeHalfModule for %s %s \n", this.getClass().getSimpleName(), moduleName, side);
+
+ String volName = moduleName + "_halfmodule_" + side;
+
+
+
+ // 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 BaseGeometry mother = getBaseGeometry(TrackingBase.class);
+
+ TestRunHalfModule halfModule = new HPSTestRunTracker2014GeometryDefinition.TestRunHalfModuleAxial(volName, mother, layer, half);
+
+
+
+
+
+ if(isDebug()) {
+ System.out.printf("%s: created module bundle:\n", this.getClass().getSimpleName());
+
+ }
+
+ }
+
+
+
+
+
+
+
+
+
+}
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/HPSTestRunTracker2014Test1LCDDBuilder.java (rev 0)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014Test1LCDDBuilder.java 2014-09-12 19:03:20 UTC (rev 3317)
@@ -0,0 +1,82 @@
+package org.lcsim.geometry.compact.converter.lcdd;
+
+import java.util.ArrayList;
+
+import org.lcsim.geometry.compact.converter.lcdd.HPSTestRunTracker2014GeometryDefinition.BaseGeometry;
+import org.lcsim.geometry.compact.converter.lcdd.HPSTestRunTracker2014GeometryDefinition.TestRunHalfModuleAxial;
+import org.lcsim.geometry.compact.converter.lcdd.HPSTestRunTracker2014GeometryDefinition.TrackingBase;
+import org.lcsim.geometry.compact.converter.lcdd.util.Volume;
+
+/**
+ * Class used by LCDD converter to build detector for SLIC.
+ * It encapsulates and adds the LCDD specific information to the generic @HPSTestRunTracker2014Builder.
+ *
+ * @author Per Hansson Adrian <[log in to unmask]>
+ *
+ */
+public class HPSTestRunTracker2014Test1LCDDBuilder extends HPSTrackerLCDDBuilder {
+
+ /**
+ * Default constructor
+ */
+ public HPSTestRunTracker2014Test1LCDDBuilder(boolean debugFlag) {
+ super(debugFlag);
+ }
+
+
+
+ /**
+ * Build the LCDD geometry objects.
+ * @param worldVolume - the reference volume.
+ */
+ public void build(Volume worldVolume) {
+
+ if(isDebug()) System.out.printf("%s: build the LCDD geometry objects\n", getClass().getSimpleName());
+
+ // initialize the list to store a reference to each object
+ lcddGeometries = new ArrayList<LCDDBaseGeometry>();
+
+ // Go through the list of volumes to build that is created in the generic builder class
+ // TODO this is manual now since I don't have a way of knowing in the generic builder class what is a ghost volume at this point.
+ LCDDBaseGeometry trackingGeometry = new GhostLCDDBaseGeometry(getBaseGeometry(TrackingBase.class), worldVolume);
+ add(trackingGeometry);
+ //baseTrackerGeometry = new LCDDBaseGeometry(getBaseGeometry(Base.class), lcdd, trackingGeometry);
+ //add(baseTrackerGeometry);
+ baseTrackerGeometry = trackingGeometry;
+
+ // build modules
+
+ if(isDebug()) System.out.printf("%s: build modules\n", getClass().getSimpleName());
+
+
+
+ // Find the mother among the LCDD objects using its name, should probably have a better way...
+ LCDDBaseGeometry mother = trackingGeometry;
+
+
+ // create the half-module
+
+ BaseGeometry halfModule = getBaseGeometry(TestRunHalfModuleAxial.class);
+ LCDDBaseGeometry lcddHM = new LCDDBaseGeometry(halfModule, lcdd, mother);
+ add(lcddHM);
+
+
+
+ //if(isDebug()) {
+ System.out.printf("%s: DONE building the LCDD geometry objects\n", getClass().getSimpleName());
+ System.out.printf("%s: List of all %d LCDD geometry objects built\n", this.getClass().getSimpleName(), lcddGeometries.size());
+ for(LCDDBaseGeometry bg : lcddGeometries) {
+ System.out.printf("-------\n%s\n", bg.toString());
+ }
+ //}
+
+
+
+ // Set visualization features
+ setVisualization();
+
+
+ }
+
+
+}
\ No newline at end of file