10 modified files
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-09-15 19:24:26 UTC (rev 3322)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/converter/compact/HPSTestRunTracker2014Converter.java 2014-09-16 22:04:11 UTC (rev 3323)
@@ -3,8 +3,6 @@
*/
package org.lcsim.detector.converter.compact;
-import javax.swing.text.html.HTMLDocument.HTMLReader.IsindexAction;
-
import org.jdom.Element;
import org.lcsim.detector.DetectorElement;
import org.lcsim.detector.DetectorElementStore;
@@ -41,7 +39,7 @@
*/
public class HPSTestRunTracker2014Converter extends AbstractSubdetectorConverter {
- private boolean _debug = false;
+ private boolean _debug = true;
private IMaterial trackingMaterial = null;
private static HPSTrackerJavaBuilder builder;
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-15 19:24:26 UTC (rev 3322)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/converter/compact/HPSTestRunTracker2014Test1JavaBuilder.java 2014-09-16 22:04:11 UTC (rev 3323)
@@ -88,18 +88,8 @@
// Check that it had a mother
if(hmb==null) throw new RuntimeException("Cound't find hm bundle");
- TestRunHalfModule hm = hmb.halfModule;
- TestRunHalfModuleAxial hma = null;
- if(hm instanceof TestRunHalfModuleAxial) {
- hma = (TestRunHalfModuleAxial) hm;
- }
- // Check that it had a mother
- if(hma==null) throw new RuntimeException("Cound't find hma");
+ addHalfModule(hmb, mother);
- int oldCompactModuleId = 0;
- JavaBaseGeometry lcddHM = new JavaBaseGeometry(hma, mother,oldCompactModuleId);
- add(lcddHM);
-
if(isDebug()) System.out.printf("%s: DONE build module %s\n", getClass().getSimpleName(), m.module.getName());
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-09-15 19:24:26 UTC (rev 3322)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014.java 2014-09-16 22:04:11 UTC (rev 3323)
@@ -32,7 +32,7 @@
*/
public class HPSTestRunTracker2014 extends LCDDSubdetector
{
- private boolean _debug = false;
+ private boolean _debug = true;
private final boolean buildBeamPlane = true;
// Builder class to handle all geometry information
private static HPSTrackerLCDDBuilder builder;
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/HPSTestRunTracker2014Builder.java 2014-09-15 19:24:26 UTC (rev 3322)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014Builder.java 2014-09-16 22:04:11 UTC (rev 3323)
@@ -64,7 +64,7 @@
}
//if(isDebug()) {
- System.out.printf("%s: DONE constructing the geometry objects kuk\n", this.getClass().getSimpleName());
+ 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());
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/HPSTestRunTracker2014GeometryDefinition.java 2014-09-15 19:24:26 UTC (rev 3322)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014GeometryDefinition.java 2014-09-16 22:04:11 UTC (rev 3323)
@@ -321,7 +321,7 @@
double flat_pos_csup_pin_bottom_z = ball_pos_csup_pin_bottom_z + flat_pos_csup_pin_bottom_3D_rot.getZ();
setFlatPos(flat_pos_csup_pin_bottom_x,flat_pos_csup_pin_bottom_y,flat_pos_csup_pin_bottom_z);
- System.out.println("rotated setPos for csupport: \n" + getFlatPos().toString());
+ if(debug) System.out.println("rotated setPos for csupport: \n" + getFlatPos().toString());
} else {
@@ -334,7 +334,7 @@
double flat_pos_csup_pin_bottom_z = ball_pos_csup_pin_bottom_z + 0;
setFlatPos(flat_pos_csup_pin_bottom_x,flat_pos_csup_pin_bottom_y,flat_pos_csup_pin_bottom_z);
- System.out.println("setPos for csupport: \n" + getFlatPos().toString());
+ if(debug) System.out.println("setPos for csupport: \n" + getFlatPos().toString());
}
}
@@ -342,11 +342,11 @@
calcAndSetFlatPos();
setBallPos(ball_pos_csup_pin_bottom_x,ball_pos_csup_pin_bottom_y,ball_pos_csup_pin_bottom_z);
setVeePos(vee_pos_csup_pin_bottom_x,vee_pos_csup_pin_bottom_y,vee_pos_csup_pin_bottom_z);
- System.out.println("setPos for csupport: \n" + getFlatPos().toString());
+ if(debug) System.out.println("setPos for csupport: \n" + getFlatPos().toString());
}
protected void setCoord() {
setCoord(null);
- System.out.println("coord for csupport: \n" + this.getCoord().toString());
+ if(debug) System.out.println("coord for csupport: \n" + this.getCoord().toString());
}
protected void setCenter() {
// this is never used since it's only a reference volume
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/HPSTestRunTracker2014LCDDBuilder.java 2014-09-15 19:24:26 UTC (rev 3322)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014LCDDBuilder.java 2014-09-16 22:04:11 UTC (rev 3323)
@@ -35,7 +35,7 @@
// 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);
+ LCDDBaseGeometry trackingGeometry = new LCDDBaseGeometry(getBaseGeometry(TrackingBase.class), worldVolume);
add(trackingGeometry);
baseTrackerGeometry = new LCDDBaseGeometry(getBaseGeometry(Base.class), lcdd, trackingGeometry);
add(baseTrackerGeometry);
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 2014-09-15 19:24:26 UTC (rev 3322)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014Test1LCDDBuilder.java 2014-09-16 22:04:11 UTC (rev 3323)
@@ -6,6 +6,7 @@
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.HPSTrackerBuilder.HalfModuleBundle;
import org.lcsim.geometry.compact.converter.lcdd.HPSTrackerBuilder.ModuleBundle;
import org.lcsim.geometry.compact.converter.lcdd.HPSTrackerLCDDBuilder.LCDDBaseGeometry;
import org.lcsim.geometry.compact.converter.lcdd.util.Volume;
@@ -41,7 +42,7 @@
// 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);
+ LCDDBaseGeometry trackingGeometry = new LCDDBaseGeometry(getBaseGeometry(TrackingBase.class), worldVolume);
add(trackingGeometry);
//baseTrackerGeometry = new LCDDBaseGeometry(getBaseGeometry(Base.class), lcdd, trackingGeometry);
//add(baseTrackerGeometry);
@@ -69,23 +70,13 @@
m.print();
}
- HalfModuleBundle hmb = m.halfModuleAxial;
+ HalfModuleBundle bundle = m.halfModuleAxial;
- // Check that it had a mother
- if(hmb==null) throw new RuntimeException("Cound't find hm bundle");
-
- TestRunHalfModule hm = hmb.halfModule;
- TestRunHalfModuleAxial hma = null;
- if(hm instanceof TestRunHalfModuleAxial) {
- hma = (TestRunHalfModuleAxial) hm;
- }
- // Check that it had a mother
- if(hma==null) throw new RuntimeException("Cound't find hma");
- //BaseGeometry halfModule = getBaseGeometry(TestRunHalfModuleAxial.class);
- LCDDBaseGeometry lcddHM = new LCDDBaseGeometry(hma, lcdd, mother);
- add(lcddHM);
-
+ addHalfModule(bundle, mother);
+
+
+
}
@@ -106,5 +97,35 @@
}
+ /**
+ * Rules for adding the LCDD half module geometry.
+ * @param bundle - module to be added
+ * @param mother - mother LCDD geometry object
+ */
+ private void addHalfModule(HalfModuleBundle bundle, LCDDBaseGeometry mother) {
+ // This could perhaps be fixed if there is a relation with daughters in geometry definition?
+ // create the half-module
+ LCDDBaseGeometry lcddHM = new LCDDBaseGeometry(bundle.halfModule, lcdd, mother);
+ add(lcddHM);
+ // create the sensor
+ LCDDBaseGeometry lcddS = new LCDDBaseGeometry(bundle.sensor, lcdd, lcddHM);
+ add(lcddS);
+ // create the active sensor
+ LCDDBaseGeometry lcddAS = new LCDDBaseGeometry(bundle.activeSensor, lcdd, lcddS);
+ add(lcddAS);
+
+// // create the lamination
+// LCDDBaseGeometry lcddL = new LCDDBaseGeometry(bundle.lamination, lcdd, lcddHM);
+// add(lcddL);
+// // create the carbon fiber frame
+// LCDDBaseGeometry lcddCF = new LCDDBaseGeometry(bundle.carbonFiber, lcdd, lcddHM);
+// add(lcddCF);
+// // create the hybrid frame
+// LCDDBaseGeometry lcddH = new LCDDBaseGeometry(bundle.hybrid, lcdd, lcddHM);
+// add(lcddH);
+ }
+
+
+
}
\ No newline at end of file
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/HPSTrackerBuilder.java 2014-09-15 19:24:26 UTC (rev 3322)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTrackerBuilder.java 2014-09-16 22:04:11 UTC (rev 3323)
@@ -253,7 +253,7 @@
* @return transform.
*/
public static Transform3D getTransform(Transform3D t, BaseGeometry mother, String targetMotherName) {
- int debug=0;
+ int debug=1;
if(debug>0) System.out.printf("getTransform mother %s target %s with current transform\n%s\n", mother.getName(), targetMotherName,t.toString());
if(mother==null) throw new RuntimeException("Trying to get mother transform but there is no mother?!");
if(mother.getName().equals(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/HPSTrackerJavaBuilder.java 2014-09-15 19:24:26 UTC (rev 3322)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTrackerJavaBuilder.java 2014-09-16 22:04:11 UTC (rev 3323)
@@ -319,27 +319,28 @@
if(isDebug()) System.out.printf("%s: mother and physical mother is the same\n",getClass().getSimpleName());
}
-
- if(isDebug()) System.out.printf("%s: unit vectors to get Cardan angles from become unit_u %s unit_v %s unit_w %s\n", this.getClass().getSimpleName(),unit_u.toString(),unit_v.toString(),unit_w.toString());
- if(isDebug()) System.out.printf("%s: unit vectors u %s v %s w %s\n", this.getClass().getSimpleName(),base.getCoord().u().toString(),base.getCoord().v().toString(),base.getCoord().w().toString());
+ if(isDebug()) {
+ System.out.printf("%s: unit vectors to get Cardan angles from become unit_u %s unit_v %s unit_w %s\n", this.getClass().getSimpleName(),unit_u.toString(),unit_v.toString(),unit_w.toString());
+ System.out.printf("%s: unit vectors u %s v %s w %s\n", this.getClass().getSimpleName(),base.getCoord().u().toString(),base.getCoord().v().toString(),base.getCoord().w().toString());
+ }
//Hep3Vector lcdd_rot_angles = HPSTestRunTracker2014.getEulerAngles(unit_u,unit_v,base.getCoord().u(), base.getCoord().v());
Hep3Vector lcdd_rot_angles = HPSTestRunTracker2014.getEulerAngles(base.getCoord().u(), base.getCoord().v(), unit_u,unit_v);
//Hep3Vector lcdd_rot_angles_active = HPSTestRunTracker2014.getActiveEulerAngles(base.getCoord().v(), base.getCoord().w(), unit_v,unit_w);
- double rot_mat[][] = HPSTestRunTracker2014.getActiveEulerAnglesMatrix(base.getCoord().v(), base.getCoord().w(), unit_v,unit_w);
- Rotation3D rot_xcheck = new Rotation3D();
- BasicHep3Matrix rot_mat_hep = new BasicHep3Matrix();
- for(int c=0;c<=2;++c) {
- for(int r=0;r<=2;++r) {
- rot_mat_hep.setElement(r, c, rot_xcheck.getComponent(r, c));
- }
- }
- rot_xcheck.setRotationMatrix(rot_mat_hep);
- if(isDebug()) {
- System.out.printf("%s: xcheck active rotation matrix:\n", this.getClass().getSimpleName());
- HPSTestRunTracker2014.printMatrix(rot_mat);
- rot_xcheck.toString();
- }
-
+// double rot_mat[][] = HPSTestRunTracker2014.getActiveEulerAnglesMatrix(base.getCoord().v(), base.getCoord().w(), unit_v,unit_w);
+// Rotation3D rot_xcheck = new Rotation3D();
+// BasicHep3Matrix rot_mat_hep = new BasicHep3Matrix();
+// for(int c=0;c<=2;++c) {
+// for(int r=0;r<=2;++r) {
+// rot_mat_hep.setElement(r, c, rot_xcheck.getComponent(r, c));
+// }
+// }
+// rot_xcheck.setRotationMatrix(rot_mat_hep);
+// if(isDebug()) {
+// System.out.printf("%s: xcheck active rotation matrix:\n", this.getClass().getSimpleName());
+// HPSTestRunTracker2014.printMatrix(rot_mat);
+// rot_xcheck.toString();
+// }
+//
/*
// Check if there are explicit rotations built into the object itself which overrides
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/HPSTrackerLCDDBuilder.java 2014-09-15 19:24:26 UTC (rev 3322)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTrackerLCDDBuilder.java 2014-09-16 22:04:11 UTC (rev 3323)
@@ -9,7 +9,12 @@
import java.util.Map;
import org.jdom.JDOMException;
+import org.lcsim.detector.RotationGeant;
+import org.lcsim.detector.Transform3D;
+import org.lcsim.detector.Translation3D;
import org.lcsim.geometry.compact.converter.lcdd.HPSTestRunTracker2014GeometryDefinition.BaseGeometry;
+import org.lcsim.geometry.compact.converter.lcdd.HPSTrackerJavaBuilder.GhostJavaBaseGeom;
+import org.lcsim.geometry.compact.converter.lcdd.HPSTrackerJavaBuilder.JavaBaseGeometry;
import org.lcsim.geometry.compact.converter.lcdd.util.Box;
import org.lcsim.geometry.compact.converter.lcdd.util.LCDD;
import org.lcsim.geometry.compact.converter.lcdd.util.Material;
@@ -26,13 +31,32 @@
protected List<LCDDBaseGeometry> lcddGeometries;
private SensitiveDetector sensitiveDetector;
+
+
+ public HPSTrackerLCDDBuilder(boolean debugFlag) {
+ super(debugFlag);
+ }
+
+ public void setSensitiveDetector(SensitiveDetector sens) {
+ this.sensitiveDetector = sens;
+ }
+
+ public SensitiveDetector getSensitiveDetector() {
+ return this.sensitiveDetector;
+ }
+
+
+
+
+
+
/**
* Interface to the LCDD converter geometry for the geometry definition.
*
* @author Per Hansson Adrian <[log in to unmask]>
*/
public static class LCDDBaseGeometry extends LCDDBaseGeometryVisualization {
- private boolean debug = false;
+ private boolean debug = true;
private String name;
private Box box= null;
private Volume volume = null;
@@ -50,6 +74,23 @@
}
/**
+ * Initialize this object with a known volume and no mother. Typically the world volume would use this.
+ * @param base - object used to get geometry definitions
+ * @param vol - given volume
+ */
+ public LCDDBaseGeometry(BaseGeometry base, Volume volume) {
+ super();
+ if(isDebug()) System.out.printf("%s: constructing LCDD object %s with given volume name %s\n", this.getClass().getSimpleName(),base.getName(),volume.getName());
+ setName(base.getName());
+ setVolume(volume);
+ if(isDebug()) System.out.printf("%s: DONE constructing LCDD object %s\n", this.getClass().getSimpleName(),base.getName());
+ Hep3Vector lcdd_rot_angles = HPSTestRunTracker2014.getEulerAngles(base.getCoord().v(), base.getCoord().w(), new BasicHep3Vector(0,1,0),new BasicHep3Vector(0,0,1));
+ setPos(new Position(getName() + "_position", 0, 0, 0));
+ setRot(new Rotation(getName() + "_rotation",lcdd_rot_angles.x(), lcdd_rot_angles.y(), lcdd_rot_angles.z()));
+ if(isDebug()) System.out.printf("%s: DONE JavaBaseGeometry %s\n", this.getClass().getSimpleName(),base.getName());
+ }
+
+ /**
* Interface to the LCDD converter geometry for the geometry definition.
* @param base - input geometry definition
* @param lcdd - lcdd file
@@ -89,22 +130,68 @@
protected void setPositionAndRotation(BaseGeometry base) {
+ if(isDebug()) System.out.printf("%s: set position and rotation for volume %s\n", this.getClass().getSimpleName(),getName());
// NOTE:
// This sets position and reference w.r.t. mother coordinate system.
// If I'm not building that volume this will be wrong.
// TODO Similar to in the JAVA converter this should be something like the physical mother.
+ if(base.getMother()==null) throw new RuntimeException("trying to set coordinates w/o mother defined for "+base.getName());
- if(isDebug()) System.out.printf("%s: set position and rotation for volume %s\n", this.getClass().getSimpleName(),getName());
// Vector from origin to center of box locally
Hep3Vector box_center_base_local = base.getCenter();
+
//translate to the mother coordinate system
- Hep3Vector box_center_base = base.getCoord().getTransformation().transformed(box_center_base_local);
+ LCDDBaseGeometry physMother = getPhysMother();
+ if(isDebug()) System.out.printf("%s: physical mother to transform to is %s; find the transform to it\n", this.getClass().getSimpleName(),physMother.getName());
+ Transform3D trf = getTransform(base.getCoord().getTransformation(),base.getMother(),physMother.getName());
+ if(isDebug()) System.out.printf("%s: found transform to physical mother \n%s\n\n", this.getClass().getSimpleName(),trf.toString());
+
+ // find the position of the center in the physical mother coord
+ Hep3Vector box_center_base = trf.transformed(box_center_base_local);
+
+ // find the position of the center of the box in the mother coordinate system, make sure to use the physical mother coordinates
+ if(isDebug()) System.out.printf("%s: find center of box in physical mother coord %s \n", this.getClass().getSimpleName(),physMother.getName());
+ // hack since my getTransform function needs a mother TODO Fix this!
+ BaseGeometry gm = base;
+ if(isDebug()) System.out.printf("%s: look for physical mother %s starting from mother %s \n", this.getClass().getSimpleName(),physMother.getName(),gm.getMother()!=null?gm.getMother().getName():"-- no mother --");
+ while((gm=gm.getMother()).getName()!=physMother.getName()) {
+ if(isDebug()) System.out.printf("%s: gm is %s \n", this.getClass().getSimpleName(),gm.getName());
+ //gm = gm.getMother();
+ }
+ if(isDebug()) System.out.printf("%s: found physical mother %s with center at %s \n", this.getClass().getSimpleName(),gm.getName(), gm.getCenter());
+
+ Hep3Vector mother_center = gm.getCenter();
+
// find the position of the center in the mother coord
- Hep3Vector box_center = VecOp.sub(box_center_base, base.getMother().getCenter());
+ Hep3Vector box_center = VecOp.sub(box_center_base, mother_center);
+
//Find LCDD Euler rotation angles from coordinate system unit vectors
- Hep3Vector lcdd_rot_angles = HPSTestRunTracker2014.getEulerAngles(base.getCoord().v(), base.getCoord().w(), new BasicHep3Vector(0,1,0),new BasicHep3Vector(0,0,1));
+ //Note that this has to be rotation wrt to physical mother and not just mother as normally is the case
+ //Use apache lib to get angles, but in principle I should already have it from the trf above
+ //Hep3Vector lcdd_rot_angles = HPSTestRunTracker2014.getEulerAngles(base.getCoord().v(), base.getCoord().w(), new BasicHep3Vector(0,1,0),new BasicHep3Vector(0,0,1));
+ if(isDebug()) System.out.printf("%s: find LCDD Cardan rotation angles - need to find mother to physical mother transform \n", this.getClass().getSimpleName(),physMother.getName());
+ Hep3Vector unit_u = new BasicHep3Vector(1,0,0);
+ Hep3Vector unit_v = new BasicHep3Vector(0,1,0);
+ Hep3Vector unit_w = new BasicHep3Vector(0,0,1);
+ if(!base.getMother().getName().equals(physMother.getName())) {
+ Transform3D trf_mother = getTransform(base.getMother().getCoord().getTransformation(),base.getMother().getMother(),physMother.getName());
+ unit_u = VecOp.unit(trf_mother.rotated(unit_u));
+ unit_v = VecOp.unit(trf_mother.rotated(unit_v));
+ unit_w = VecOp.unit(trf_mother.rotated(unit_w));
+ if(isDebug()) System.out.printf("%s: found transform from mother to physical mother \n%s\n", this.getClass().getSimpleName(),trf_mother.toString());
+ } else {
+ if(isDebug()) System.out.printf("%s: mother and physical mother is the same\n",getClass().getSimpleName());
+ }
+
+ if(isDebug()) {
+ System.out.printf("%s: unit vectors to get Cardan angles from become unit_u %s unit_v %s unit_w %s\n", this.getClass().getSimpleName(),unit_u.toString(),unit_v.toString(),unit_w.toString());
+ System.out.printf("%s: unit vectors u %s v %s w %s\n", this.getClass().getSimpleName(),base.getCoord().u().toString(),base.getCoord().v().toString(),base.getCoord().w().toString());
+ }
+ //Hep3Vector lcdd_rot_angles = HPSTestRunTracker2014.getEulerAngles(unit_u,unit_v,base.getCoord().u(), base.getCoord().v());
+ Hep3Vector lcdd_rot_angles = HPSTestRunTracker2014.getEulerAngles(base.getCoord().u(), base.getCoord().v(), unit_u,unit_v);
+
// Check if there are explicit rotations built into the object itself which overrides
// TODO this should be included in the definition of the coordinate system. Fix this for the affected components.
/*
@@ -127,6 +214,7 @@
// Create the LCDD position
setPos(new Position(getName() + "_position",box_center.x(), box_center.y(), box_center.z()));
+ /*
if(getName().contains("module_L1t") && !getName().contains("halfmodule") && !getName().contains("cold")) {
lcdd_rot_angles = new BasicHep3Vector(-Math.PI,0,0.03);
lcdd_rot_angles = HPSTestRunTracker2014.getEulerAngles(base.getCoord().u(), base.getCoord().v(), new BasicHep3Vector(1,0,0),new BasicHep3Vector(0,1,0));
@@ -135,13 +223,13 @@
if(getName().contains("module_L1b") && !getName().contains("halfmodule") && !getName().contains("cold")) {
lcdd_rot_angles = new BasicHep3Vector(0,0,-0.030);
}
+ */
-
setRot(new Rotation(getName() + "_rotation",lcdd_rot_angles.x(), lcdd_rot_angles.y(), lcdd_rot_angles.z()));
if(isDebug()) {
System.out.printf("%s: box_center_base_local %s\n", this.getClass().getSimpleName(), box_center_base_local.toString());
System.out.printf("%s: box_center_base %s\n", this.getClass().getSimpleName(), box_center_base.toString());
- System.out.printf("%s: mother center %s\n", this.getClass().getSimpleName(), base.getMother().getCenter().toString());
+ System.out.printf("%s: mother center %s\n", this.getClass().getSimpleName(), mother_center.toString());
System.out.printf("%s: box_center %s\n", this.getClass().getSimpleName(), box_center.toString());
System.out.printf("%s: pos %s\n", this.getClass().getSimpleName(), getPos().toString());
System.out.printf("%s: euler %s\n", this.getClass().getSimpleName(), lcdd_rot_angles.toString());
@@ -153,6 +241,21 @@
}
}
+ /**
+ * Find the first non-ghost volume among parents.
+ * @return mother object
+ */
+ public LCDDBaseGeometry getPhysMother() {
+ //if(isDebug()) System.out.printf("%s: finding physical mother to %s\n", this.getClass().getSimpleName(), getName());
+ if(mother==null) throw new RuntimeException("Trying to get phys mother but there is no mother!");
+ if(mother instanceof GhostLCDDBaseGeometry) {
+ return mother.getPhysMother();
+ } else {
+ //if(isDebug()) System.out.printf("%s: found a non-ghost volume: %s\n", this.getClass().getSimpleName(), mother.getName());
+ return mother;
+ }
+ }
+
protected Volume getVolume() {
return volume;
}
@@ -260,19 +363,8 @@
*/
protected static class GhostLCDDBaseGeometry extends LCDDBaseGeometry {
- /**
- * Initialize this object with a known volume and no mother. Typically the world volume would use this.
- * @param base - object used to get geometry definitions
- * @param vol - given volume
- */
- public GhostLCDDBaseGeometry(BaseGeometry base, Volume volume) {
- super();
- if(isDebug()) System.out.printf("%s: constructing LCDD ghost object %s\n", this.getClass().getSimpleName(),base.getName());
- setName(base.getName());
- setVolume(volume);
- if(isDebug()) System.out.printf("%s: DONE constructing LCDD object %s\n", this.getClass().getSimpleName(),base.getName());
- }
+
/**
* Initialize with base and mother. This is typically for a reference geometry object
* that is used for referencing coordinate systems but that doesn't have a volume itself.
@@ -308,18 +400,7 @@
}
- public HPSTrackerLCDDBuilder(boolean debugFlag) {
- super(debugFlag);
- }
- public void setSensitiveDetector(SensitiveDetector sens) {
- this.sensitiveDetector = sens;
- }
-
- public SensitiveDetector getSensitiveDetector() {
- return this.sensitiveDetector;
- }
-
public void setVisualization() {
SVNspam 0.1