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/HPSTestRunTracker2014Test1JavaBuilder.java 2014-09-26 23:50:42 UTC (rev 3346)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/converter/compact/HPSTestRunTracker2014Test1JavaBuilder.java 2014-09-26 23:52:08 UTC (rev 3347)
@@ -1,204 +0,0 @@
-/**
- *
- */
-package org.lcsim.detector.converter.compact;
-
-import java.util.ArrayList;
-
-import org.lcsim.detector.ILogicalVolume;
-import org.lcsim.geometry.compact.converter.lcdd.HPSTestRunTracker2014GeometryDefinition.TestRunHalfModule;
-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.HPSTestRunTracker2014Builder;
-import org.lcsim.geometry.compact.converter.lcdd.HPSTestRunTracker2014Test1Builder;
-import org.lcsim.geometry.compact.converter.lcdd.HPSTrackerBuilder.HalfModuleBundle;
-import org.lcsim.geometry.compact.converter.lcdd.HPSTrackerBuilder.ModuleBundle;
-import org.lcsim.geometry.compact.converter.lcdd.HPSTrackerJavaBuilder;
-
-
-/**
- * Class used by java converter to build java run time objects for the detector
- * It encapsulates and adds the LCDD specific information to the generic @HPSTestRunTracker2014Builder.
- *
- * @author Per Hansson Adrian <[log in to unmask]>
- *
- */
-public class HPSTestRunTracker2014Test1JavaBuilder extends HPSTrackerJavaBuilder {
-
-
-
- /**
- * Default constructor
- */
- public HPSTestRunTracker2014Test1JavaBuilder(boolean debugFlag) {
- super(debugFlag);
- }
-
-
-
- /**
- * Build the JAVA geometry objects from the geometry definition.
- * @param trackingVolume - the reference volume.
- */
- public void build(ILogicalVolume trackingVolume) {
- // build geometry
- setBuilder(new HPSTestRunTracker2014Test1Builder(this._debug));
-
- 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 JAVA geometry objects\n", getClass().getSimpleName());
-
- // initialize the list to store a reference to each object
- java_objects = new ArrayList<JavaBaseGeometry>();
-
- // Go through the list of volumes to build that is created in the generic builder class
- JavaBaseGeometry trackingGeometry = new JavaBaseGeometry(_builder.getBaseGeometry(TrackingBase.class), trackingVolume);
- add(trackingGeometry);
- setBaseTrackerGeometry(trackingGeometry);
-// setBaseTrackerGeometry(new GhostJavaBaseGeom(getBaseGeometry(Base.class), trackingGeometry));
-// add(getBaseTrackerGeometry());
-// JavaBaseGeometry basePlateGeometry = new GhostJavaBaseGeom(getBaseGeometry(BasePlate.class), getBaseTrackerGeometry());
-// add(basePlateGeometry);
-// // skip the c-support, this is purely a reference volume in the builder so should have no use here!?
-// //JavaBaseGeometry cSupportGeometry = new GhostJavaBaseGeom(getBaseGeometry(CSupport.class), baseTrackerGeometry);
-// //add(cSupportGeometry);
-// JavaBaseGeometry supportBottomGeometry = new GhostJavaBaseGeom(getBaseGeometry(SupportBottom.class), getBaseTrackerGeometry());
-// add(supportBottomGeometry);
-// JavaBaseGeometry supportPlateBottomGeometry = new GhostJavaBaseGeom(getBaseGeometry(SupportPlateBottom.class), getBaseTrackerGeometry());
-// add(supportPlateBottomGeometry);
-// JavaBaseGeometry supportTopGeometry = new GhostJavaBaseGeom(getBaseGeometry(SupportTop.class), getBaseTrackerGeometry());
-// add(supportTopGeometry);
-// JavaBaseGeometry supportPlateTopGeometry = new GhostJavaBaseGeom(getBaseGeometry(SupportPlateTop.class), getBaseTrackerGeometry());
-// add(supportPlateTopGeometry);
-
- // build modules
-
- if(isDebug()) System.out.printf("%s: build JAVA modules\n", getClass().getSimpleName());
-
- // Loop over all modules created
- for(ModuleBundle m : _builder.modules) {
-
- // Do only L1?
- if(HPSTestRunTracker2014Test1Builder.onlyL1 && m.getLayer()!=1) continue;
-
- if(HPSTestRunTracker2014Test1Builder.onlyBottom && m.getHalf()!="bottom") continue;
-
- 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();
- }
-
- JavaBaseGeometry mother = getBaseTrackerGeometry();
-
-
- HalfModuleBundle hmb = m.halfModuleAxial;
-
- // Check that it had a mother
- if(hmb==null) throw new RuntimeException("Cound't find hm bundle");
-
- addHalfModule(hmb, mother);
-
- if(isDebug()) System.out.printf("%s: DONE build module %s\n", getClass().getSimpleName(), m.module.getName());
-
-
- }
-
- if(isDebug()) System.out.printf("%s: DONE build JAVA modules\n", getClass().getSimpleName());
-
-
- if(isDebug()) System.out.printf("%s: DONE building the JAVA geometry objects\n", getClass().getSimpleName());
- //if(isDebug()) {
- System.out.printf("%s: DONE building the JAVA geometry objects\n", getClass().getSimpleName());
- System.out.printf("%s: List of all the JAVA geometry objects built\n", this.getClass().getSimpleName());
- for(JavaBaseGeometry bg : java_objects) {
- System.out.printf("-------\n%s\n", bg.toString());
- }
- //}
-
-
- // Set visualization features
- //setVis();
-
-
- }
-
-
- /**
- * Rules for adding the JAVA half module geometry.
- * @param bundle - module to be added
- * @param mother - mother JAVA geometry object
- */
- private void addHalfModule(HalfModuleBundle bundle, JavaBaseGeometry mother) {
- // Create the half-module
- // This is not a ghost element but reflects the module
- // concept in the old compact description
- // TODO fix the layer IDs
- int oldCompactModuleId = 0;
- JavaBaseGeometry lcddHM = new JavaBaseGeometry(bundle.halfModule, mother,oldCompactModuleId);
- add(lcddHM);
-
- // ComponentNumber is taken from old geometry where it is simply a counter when adding the xml daughters to the TestRunModule.
- // It is simply 0 for sensor and 1 for carbon fiber in the old geometry
- int componentNumber = bundle.sensor.getId();
-
- // create the sensor
- JavaBaseGeometry lcddS = new JavaBaseGeometry(bundle.sensor, lcddHM, componentNumber);
- add(lcddS);
-
- // create the active sensor
- JavaBaseGeometry lcddAS = new JavaBaseGeometry(bundle.activeSensor, lcddS, componentNumber);
- add(lcddAS);
-
-// if(isDebug()) {
-// System.out.printf("%s: added sensor %s \n",this.getClass().getSimpleName(), lcddS.getName());
-// System.out.printf("%s: local coordinate system\n%s\n",this.getClass().getSimpleName(), bundle.sensor.getCoord().toString());
-// dsd
-// }
-
-
- }
-
-
-
-
-
-// /**
-// * Find the transform to a given parent volume.
-// * @param t transformation of the object.
-// * @param mother of the object
-// * @param targetMotherName is the name of the parent volume to transform to.
-// * @return translation to the target mother volume.
-// */
-// public static ITransform3D getParentTransform(Transform3D t, JavaBaseGeometry mother, String targetMotherName) {
-// boolean debug = true;
-// if(mother==null) throw new RuntimeException("Trying to get mother transform but there is no mother?!");
-// if(debug) System.out.printf("getParentTransform for mother %s target mother %s with current transform\n%s\n",mother.getName(), targetMotherName, t.toString());
-// if(mother.getName().equals(targetMotherName)) {
-// if(debug) System.out.printf("found the target object\n");
-// return t;
-// } else {
-// // Compound the transforms
-// ITranslation3D p = mother.getPos();
-// IRotation3D r = mother.getRot();
-// if(p==null) throw new RuntimeException("cannot compound transform since the mother " + mother.getName() + " has no translation!?");
-// if(r==null) throw new RuntimeException("cannot compound transform since the mother " + mother.getName() + " has no rotation!?");
-// Transform3D tM = new Transform3D(p, r);
-// if(debug) System.out.printf("add transform\n%s\n",tM.toString());
-// t.multiplyBy(tM);
-// if(debug) System.out.printf("resulting transform\n%s\n",((Transform3D)t).toString());
-// if(debug) System.out.printf("continue searching\n");
-// return getParentTransform(t, mother.getMother(), targetMotherName);
-// }
-// }
-//
-
-
-
-
-}