Author: phansson
Date: Fri Nov 21 16:45:51 2014
New Revision: 3426
Log:
Adding L4-6 half-modules consisting, for now, of sensor and lamination (visualization help essentially)
Modified:
projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014GeometryDefinition.java
projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014JavaBuilder.java
projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014LCDDBuilder.java
projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014GeometryDefinition.java
projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014LCDDBuilder.java
projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerBuilder.java
projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerGeometryDefinition.java
projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerLCDDBuilder.java
Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014GeometryDefinition.java
=============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014GeometryDefinition.java (original)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014GeometryDefinition.java Fri Nov 21 16:45:51 2014
@@ -5,7 +5,6 @@
import hep.physics.vec.BasicHep3Vector;
-import java.util.ArrayList;
import java.util.List;
import org.apache.commons.math3.geometry.euclidean.threed.Rotation;
@@ -86,9 +85,6 @@
SupportPlateTop supportPlateTop = new SupportPlateTop("support_plate_top", base, supportTop, "Aluminum");
surveyVolumes.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)) {
if(doBottom) makeModuleBundle(l,"bottom");
@@ -148,7 +144,7 @@
// create the bundle for this module
- ModuleBundle bundle = new ModuleBundle(module);
+ TestRunModuleBundle bundle = new TestRunModuleBundle(module);
addModuleBundle(bundle);
if(doAxial) makeHalfModule("axial", module);
@@ -191,7 +187,7 @@
throw new RuntimeException("wrong layer for " + volName);
}
- ModuleBundle bundle = getModuleBundle(mother);
+ TestRunModuleBundle bundle = (TestRunModuleBundle) getModuleBundle(mother);
bundle.coldBlock = coldBlock;
}
@@ -887,8 +883,8 @@
public static abstract class BaseModule extends SurveyVolume {
- private int layer;
- private String half;
+ protected int layer;
+ protected String half;
public BaseModule(String name, SurveyVolume mother, AlignmentCorrection alignmentCorrection, int layer, String half) {
super(name, mother, alignmentCorrection);
@@ -1738,15 +1734,15 @@
}
}
+
+
+
public static class TestRunHalfModuleBundle extends HalfModuleBundle {
- public SurveyVolume sensor = null;
- public SurveyVolume activeSensor = null;
- protected SurveyVolume lamination = null;
protected SurveyVolume carbonFiber = null;
protected SurveyVolume hybrid = null;
- TestRunHalfModuleBundle(TestRunHalfModule hm) {
- halfModule = hm;
+ TestRunHalfModuleBundle(SurveyVolume hm) {
+ super(hm);
}
public void print() {
System.out.printf("%s: %s\n", this.getClass().getSimpleName(),halfModule.getName());
@@ -1769,6 +1765,34 @@
}
+ /* (non-Javadoc)
+ * @see org.lcsim.geometry.compact.converter.HPSTrackerGeometryDefinition#getHalfModuleBundle(org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.BaseModule, java.lang.String)
+ */
+ protected HalfModuleBundle getHalfModuleBundle(BaseModule module, String halfModuleName) {
+ BaseModuleBundle m = getModuleBundle(module.getLayer(), module.getHalf());
+ HalfModuleBundle hm = null;
+ // TODO this needs to change when I build quarter-modules for the long half-modules.
+ if(m!=null) {
+ if( m instanceof TestRunModuleBundle) {
+ TestRunModuleBundle mtr = (TestRunModuleBundle) m;
+ if(halfModuleName.contains("axial")) {
+ hm = mtr.halfModuleAxial;
+ }
+ else if(halfModuleName.contains("stereo")) {
+ hm = mtr.halfModuleStereo;
+ }
+ else {
+ throw new RuntimeException("No axial or stereo string found in half module bundle name " + halfModuleName);
+ }
+ }
+ else {
+ throw new RuntimeException("The type of this module bundle is incorrect. Should be a TestRunModuleBundle.");
+ }
+ } else {
+ throw new RuntimeException("No module found for " + module.getLayer() + " and half " + module.getHalf());
+ }
+ return hm;
+ }
Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014JavaBuilder.java
=============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014JavaBuilder.java (original)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014JavaBuilder.java Fri Nov 21 16:45:51 2014
@@ -15,7 +15,8 @@
import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.SupportTop;
import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TestRunHalfModuleBundle;
import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope;
-import org.lcsim.geometry.compact.converter.HPSTrackerBuilder.ModuleBundle;
+import org.lcsim.geometry.compact.converter.HPSTrackerBuilder.BaseModuleBundle;
+import org.lcsim.geometry.compact.converter.HPSTrackerGeometryDefinition.TestRunModuleBundle;
/**
@@ -86,8 +87,9 @@
if(isDebug()) System.out.printf("%s: build JAVA modules\n", getClass().getSimpleName());
// Loop over all modules created
- for(ModuleBundle m : _builder.modules) {
- if(isDebug()) {
+ for(BaseModuleBundle mod : _builder.modules) {
+ TestRunModuleBundle m = (TestRunModuleBundle) mod;
+ 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();
}
@@ -138,7 +140,7 @@
* @param bundle - module to be added
* @param mother - mother JAVA geometry object
*/
- private void addModule(ModuleBundle bundle, JavaSurveyVolume mother) {
+ private void addModule(TestRunModuleBundle bundle, JavaSurveyVolume mother) {
if(isDebug()) {
System.out.printf("%s: addModule %s containing:\n",this.getClass().getSimpleName(), bundle.module.getName());
Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014LCDDBuilder.java
=============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014LCDDBuilder.java (original)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014LCDDBuilder.java Fri Nov 21 16:45:51 2014
@@ -9,8 +9,9 @@
import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.SupportTop;
import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TestRunHalfModuleBundle;
import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope;
+import org.lcsim.geometry.compact.converter.HPSTrackerBuilder.BaseModuleBundle;
import org.lcsim.geometry.compact.converter.HPSTrackerBuilder.HalfModuleBundle;
-import org.lcsim.geometry.compact.converter.HPSTrackerBuilder.ModuleBundle;
+import org.lcsim.geometry.compact.converter.HPSTrackerGeometryDefinition.TestRunModuleBundle;
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;
@@ -76,8 +77,8 @@
if(isDebug()) System.out.printf("%s: build modules\n", getClass().getSimpleName());
// Loop over all modules created
- for(ModuleBundle m : _builder.modules) {
-
+ for(BaseModuleBundle mod : _builder.modules) {
+ TestRunModuleBundle m = (TestRunModuleBundle) mod;
if(isDebug()) {
System.out.printf("%s: module layer %d half %s\n", getClass().getSimpleName(),m.getLayer(),m.getHalf());
m.print();
@@ -98,7 +99,7 @@
if(isDebug()) System.out.printf("%s: found mother %s for module layer %d half %s\n", getClass().getSimpleName(),mother.getName(),m.getLayer(),m.getHalf());
// add the module to the list of objects that will be added to LCDD
- addModule(m, mother);
+ addTestRunModule(m, mother);
}
@@ -126,14 +127,14 @@
* @param bundle - module to be added
* @param mother - mother LCDD geometry object
*/
- protected void addModule(ModuleBundle bundle, LCDDSurveyVolume mother) {
+ protected void addTestRunModule(TestRunModuleBundle bundle, LCDDSurveyVolume mother) {
// This could perhaps be fixed if there is a relation with daughters in geometry definition?
// create the module
LCDDSurveyVolume lcddM = new LCDDSurveyVolume(bundle.module, lcdd, mother);
add(lcddM);
- if(bundle.halfModuleAxial!=null) addHalfModule(bundle.halfModuleAxial,lcddM);
+ if(bundle.halfModuleAxial!=null) addTestRunHalfModule(bundle.halfModuleAxial,lcddM);
if(bundle.coldBlock!=null) add(new LCDDSurveyVolume(bundle.coldBlock, lcdd, lcddM));
- if(bundle.halfModuleStereo!=null) addHalfModule((TestRunHalfModuleBundle)bundle.halfModuleStereo,lcddM);
+ if(bundle.halfModuleStereo!=null) addTestRunHalfModule((TestRunHalfModuleBundle)bundle.halfModuleStereo,lcddM);
// if(bundle.halfModuleAxial!=null) addHalfModule((TestRunHalfModuleBundle)bundle.halfModuleAxial,lcddM);
// if(bundle.coldBlock!=null) add(new LCDDSurveyVolume(bundle.coldBlock, lcdd, lcddM));
// if(bundle.halfModuleStereo!=null) addHalfModule((TestRunHalfModuleBundle)bundle.halfModuleStereo,lcddM);
@@ -145,7 +146,7 @@
* @param bundle - module to be added
* @param mother - mother LCDD geometry object
*/
- private void addHalfModule(HalfModuleBundle bundle2, LCDDSurveyVolume mother) {
+ private void addTestRunHalfModule(HalfModuleBundle bundle2, LCDDSurveyVolume mother) {
// This could perhaps be fixed if there is a relation with daughters in geometry definition?
TestRunHalfModuleBundle bundle = (TestRunHalfModuleBundle) bundle2;
Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014GeometryDefinition.java
=============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014GeometryDefinition.java (original)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014GeometryDefinition.java Fri Nov 21 16:45:51 2014
@@ -7,6 +7,7 @@
import hep.physics.vec.Hep3Vector;
import hep.physics.vec.VecOp;
+import org.apache.commons.lang3.NotImplementedException;
import org.apache.commons.math3.geometry.euclidean.threed.Rotation;
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
import org.jdom.Element;
@@ -15,6 +16,7 @@
import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.HalfModuleLamination;
import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.Sensor;
import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TestRunHalfModule;
+import org.lcsim.geometry.compact.converter.HPSTrackerBuilder.HalfModuleBundle;
/**
@@ -35,7 +37,7 @@
doColdBlock = false;
doBottom = true;
doTop = false;
- layerBitMask = 0x7;
+ layerBitMask = 0x3F;
}
@@ -73,7 +75,7 @@
UChannelL13BottomPlate uChannelL13BottomPlate = new UChannelL13BottomPlate("support_plate_bottom_L13", uChannelL13Bottom, null);
surveyVolumes.add(uChannelL13BottomPlate);
- UChannelL46Bottom uChannelL46Bottom = new UChannelL46Bottom("support_bottom_L46", svtBox, null, svtBoxBasePlate);
+ UChannelL46Bottom uChannelL46Bottom = new UChannelL46Bottom("support_bottom_L46", svtBox, null);
surveyVolumes.add(uChannelL46Bottom);
UChannelL46BottomPlate uChannelL46BottomPlate = new UChannelL46BottomPlate("support_plate_bottom_L46", uChannelL46Bottom, null);
@@ -104,7 +106,7 @@
* @SurveyVolume volume defining the pair spectrometer (PS) vacuum chamber
* Reference: tracking volume coordinate system
* Origin: same as reference
- * Orientation: same as reference
+ * Orientation: u - points in x direction (towards positron side), v - points upstream
*
* @author Per Hansson Adrian <[log in to unmask]>
*
@@ -140,7 +142,7 @@
* @SurveyVolume volume defining the SVT box envelope
* Reference: PS vacuum chamber coordinate system.
* Origin: intersection of midplanes vertically and horizontally
- * Orientation: u - width towards positron side, v - length towards upstream
+ * Orientation: same as reference
*
* @author Per Hansson Adrian <[log in to unmask]>
*
@@ -392,7 +394,7 @@
public final static double pocket_depth_L1 = 0.025;
public final static double pocket_depth_L2 = pocket_depth_L1 + 0.059;
public final static double pocket_depth_L3 = pocket_depth_L2 + 0.059;
- public final static double hole_to_hole_x =3.937*inch;
+ public final static double module_mounting_hole_to_hole_x =3.937*inch;
public UChannelL13Plate(String name, SurveyVolume m,
AlignmentCorrection alignmentCorrection) {
@@ -461,7 +463,7 @@
/**
* @SurveyVolume volume defining the coordinate system of the u-channel
- * Reference: SVTBox base plate coordinate system
+ * Reference: SVTBox coordinate system
* Origin: midpoint between upstream survey cones
* Orientation: u - width pointing towards electron side, v - pointing along the U-channel in the beam direction
*
@@ -477,14 +479,19 @@
public final static double cone_to_edge_of_plate_y = 2.75*inch;
public final static double side_plate_cone_y = 2.0*inch;
public final static double cone_to_L1_hole_y = cone_to_edge_of_plate_y - kin_mount_to_edge_of_plate_y;
+ // position of positron side upstream cone surface/intercept with normal from center of cone
+ private final static double cone_x = -6.977*inch;
+ private final static double cone_y = SvtBox.length/2.0 - 31.668*inch;
+ private final static double cone_z = -0.3316*inch;
+
+
public UChannelL46Bottom(String name, SurveyVolume m,
- AlignmentCorrection alignmentCorrection,
- SurveyVolume ref) {
- super(name, m, alignmentCorrection, ref);
+ AlignmentCorrection alignmentCorrection) {
+ super(name, m, alignmentCorrection);
init();
}
protected void setCenter() {
@@ -497,14 +504,10 @@
setBoxDim(width,length,height);
}
protected void setPos() {
- //locate cone from pin hole
-// final double ball_pos_x = 4*inch;
-// final double ball_pos_y = (4.175 + 2*3.937) * inch;
-// final double ball_pos_z = side_plate_cone_y; // TODO need to find distance to surface from kin mount
- final double ball_pos_x = 0.0;
- final double ball_pos_y = 0.0;
- final double ball_pos_z = 0.0;
-
+ //locate coordinate system from cone in mother coordinate system
+ final double ball_pos_x = cone_x + width/2.0;
+ final double ball_pos_y = cone_y;
+ final double ball_pos_z = cone_z;
ballPos = new BasicHep3Vector(ball_pos_x, ball_pos_y, ball_pos_z);
veePos = new BasicHep3Vector(ballPos.x()-1, ballPos.y(), ballPos.z());
flatPos = new BasicHep3Vector(ballPos.x(), ballPos.y()-1, ballPos.z());
@@ -518,7 +521,7 @@
public final static double pocket_depth_L4 = 0.1;
public final static double pocket_depth_L5 = pocket_depth_L4 + 0.118;
public final static double pocket_depth_L6 = pocket_depth_L5 + 0.118;
- public final static double hole_to_hole_x =7.874*inch;
+ public final static double module_mounting_hole_to_hole_x =7.874*inch;
public UChannelL46Plate(String name, SurveyVolume m,
AlignmentCorrection alignmentCorrection) {
@@ -585,8 +588,8 @@
/**
* @SurveyVolume volume defining the coordinate system of module L1-3
* Reference: @UChannelL13Bottom coordinate system
- * Origin: hole position on mounting surface (sensor side)
- * Orientation: u - is normal to the surface pointing vertically down, v - points along module away from hybrid side.
+ * Origin: hole position on mounting surface (on electron side)
+ * Orientation: u - is normal to the surface pointing vertically down, v - points along module away from hybrid side (i.e. positron direction).
*
* @author Per Hansson Adrian <[log in to unmask]>
*
@@ -656,7 +659,7 @@
protected Hep3Vector getHole() {
//hole position (sensor side)
double x = hole_to_center_of_plate_width_dir;
- double y = UChannelL13BottomPlate.hole_to_hole_x;
+ double y = UChannelL13BottomPlate.module_mounting_hole_to_hole_x;
double z = -UChannelL13Bottom.side_plate_cone_y - UChannelL13Plate.pocket_depth_L2;
return new BasicHep3Vector(x, y, z);
}
@@ -673,7 +676,7 @@
protected Hep3Vector getHole() {
//hole position (sensor side)
double x = hole_to_center_of_plate_width_dir;
- double y = 2*UChannelL13BottomPlate.hole_to_hole_x;
+ double y = 2*UChannelL13BottomPlate.module_mounting_hole_to_hole_x;
double z = -UChannelL13Bottom.side_plate_cone_y - UChannelL13Plate.pocket_depth_L3;
return new BasicHep3Vector(x, y, z);
}
@@ -681,6 +684,275 @@
}
+
+
+
+
+
+ /**
+ * @SurveyVolume volume defining the coordinate system of module L4-6
+ * Reference: @UChannelL46Bottom coordinate system
+ * Origin: hole position on mounting surface (electron side)
+ * Orientation: u - is normal to the surface pointing vertically down, v - points along module towards positron side.
+ *
+ * @author Per Hansson Adrian <[log in to unmask]>
+ *
+ */
+ public abstract static class ModuleL46 extends BaseModule {
+ protected final static double hole_to_center_of_plate_width_dir = 5.875*inch;
+ protected final static double hole_to_module_edge_height_dir = 0.875*inch;
+ protected static final double hole_to_module_edge_length_dir = 0.25*inch;
+ protected final static double box_extra_length = 10.0;// random at this point
+ protected final static double box_extra_height = 15.0;// random at this point
+ protected final static double box_extra_width = 0.5*inch;// random at this point
+
+ private static final double tension_lever_y = 2.5*inch;
+ // TODO the dimension of the L4-6 module is completely made up
+ public static final double length = 12.25*inch;
+ public static final double height = 1.0*inch;
+ public static final double width = tension_lever_y + 0.04*inch + box_extra_width;
+
+ public ModuleL46(String name, SurveyVolume mother, AlignmentCorrection alignmentCorrection, SurveyVolume ref) {
+ super(name, mother, alignmentCorrection, ref, getLayerFromVolumeName(name), getHalfFromName(name));
+
+ }
+ protected void setCenter() {
+ final double x = -width/2.0;
+ final double y = -hole_to_module_edge_length_dir + length/2.0;
+ final double z = -hole_to_module_edge_height_dir + height/2.0;
+ setCenter(x,y,z);
+ }
+ protected void setBoxDim() {
+ setBoxDim(width, length, height);
+ }
+ protected void setPos() {
+ ballPos = getHole();
+ veePos = new BasicHep3Vector(ballPos.x(), ballPos.y(), ballPos.z()-1.0);
+ flatPos = new BasicHep3Vector(ballPos.x()-1.0, ballPos.y(), ballPos.z());
+ }
+ protected abstract Hep3Vector getHole();
+ }
+
+
+
+
+ public static class ModuleL4 extends ModuleL46 {
+
+ public ModuleL4(String name, SurveyVolume mother,
+ AlignmentCorrection alignmentCorrection, SurveyVolume ref) {
+ super(name, mother, alignmentCorrection, ref);
+ init();
+ }
+
+ protected Hep3Vector getHole() {
+ double x = hole_to_center_of_plate_width_dir;
+ double y = 0.0; // TODO assume that cone and module mount pin hole is at same y. Check if true.
+ double z = -UChannelL46Bottom.side_plate_cone_y - UChannelL46Plate.pocket_depth_L4;
+ return new BasicHep3Vector(x, y, z);
+ }
+
+ }
+
+
+ public static class ModuleL5 extends ModuleL46 {
+
+ public ModuleL5(String name, SurveyVolume mother,
+ AlignmentCorrection alignmentCorrection, SurveyVolume ref) {
+ super(name, mother, alignmentCorrection, ref);
+ init();
+ }
+
+ protected Hep3Vector getHole() {
+ double x = hole_to_center_of_plate_width_dir;
+ double y = UChannelL46BottomPlate.module_mounting_hole_to_hole_x;
+ double z = -UChannelL46Bottom.side_plate_cone_y - UChannelL46Plate.pocket_depth_L5;
+ return new BasicHep3Vector(x, y, z);
+ }
+
+ }
+
+ public static class ModuleL6 extends ModuleL46 {
+
+ public ModuleL6(String name, SurveyVolume mother,
+ AlignmentCorrection alignmentCorrection, SurveyVolume ref) {
+ super(name, mother, alignmentCorrection, ref);
+ init();
+ }
+
+ protected Hep3Vector getHole() {
+ double x = hole_to_center_of_plate_width_dir;
+ double y = 2.0*UChannelL46BottomPlate.module_mounting_hole_to_hole_x;
+ double z = -UChannelL46Bottom.side_plate_cone_y - UChannelL46Plate.pocket_depth_L6;
+ return new BasicHep3Vector(x, y, z);
+ }
+
+ }
+
+
+
+
+
+ public abstract static class LongHalfModule extends BaseModule {
+
+ private static final double randomoffset = 5.0; //TODO this will be replaced when I fix the size of the half-module
+ public static final double width = Sensor.getSensorWidth() + randomoffset;
+ public static final double length = Sensor.getSensorLength() + randomoffset/10.0;
+ public static final double height = Sensor.getSensorThickness() + randomoffset/10.0;
+
+
+ public LongHalfModule(String name, SurveyVolume mother,
+ AlignmentCorrection alignmentCorrection, int layer,
+ String half) {
+ super(name, mother, alignmentCorrection, layer, half);
+ }
+
+ protected abstract Hep3Vector getSensorPosition();
+
+ protected void setBoxDim() {
+ setBoxDim(width, length, height);
+ }
+
+ protected void setCenter() {
+ setCenter(0.0,0.0,0.0);
+ }
+
+ protected void setPos() {
+ ballPos = getSensorPosition(); //TODO make this get each coordinate instead.
+ veePos = new BasicHep3Vector(ballPos.x()+1, ballPos.y(), ballPos.z());
+ flatPos = new BasicHep3Vector(ballPos.x(), ballPos.y()+1, ballPos.z());
+ }
+
+ }
+
+
+
+
+ public static class LongAxialHoleHalfModule extends LongHalfModule {
+
+ private final static double sensor_x = 1.382*inch;
+ private final static double sensor_y = 3.817*inch;
+ private final static double sensor_z = 0.32*inch;
+
+
+ public LongAxialHoleHalfModule(String name, SurveyVolume mother,
+ AlignmentCorrection alignmentCorrection, int layer,
+ String half) {
+ super(name, mother, alignmentCorrection, layer, half);
+ init();
+ }
+
+ protected Hep3Vector getSensorPosition() {
+ return new BasicHep3Vector(-sensor_x, sensor_y, -sensor_z);
+ }
+
+
+ }
+
+
+
+
+ public static class LongAxialSlotHalfModule extends LongHalfModule {
+
+ private final static double sensor_x = 1.382*inch;
+ private final static double sensor_y = 7.863*inch;
+ private final static double sensor_z = 0.32*inch;
+
+
+ public LongAxialSlotHalfModule(String name, SurveyVolume mother,
+ AlignmentCorrection alignmentCorrection, int layer,
+ String half) {
+ super(name, mother, alignmentCorrection, layer, half);
+ init();
+ }
+
+ protected Hep3Vector getSensorPosition() {
+ return new BasicHep3Vector(-sensor_x, sensor_y, -sensor_z);
+ }
+
+
+
+ }
+
+
+ public abstract static class LongStereoHalfModule extends LongHalfModule {
+
+ protected final static double stereo_angle = 0.05;
+
+ public LongStereoHalfModule(String name, SurveyVolume mother,
+ AlignmentCorrection alignmentCorrection, int layer, String half) {
+ super(name, mother, alignmentCorrection, layer, half);
+ }
+
+
+ protected void applyGenericCoordinateSystemCorrections() {
+
+ // Rotate these into the right place for the stereo
+ // My rotations here are active rotations in the mother coordinate system frame
+
+ // flip around v ~ along the strips
+ Rotation r1 = new Rotation(new Vector3D(0,1,0),Math.PI);
+ // apply stereo angle around w ~ normal to the sensor plane
+ Rotation r2 = new Rotation(new Vector3D(0,0,1),stereo_angle);
+ // Build full rotation
+ Rotation r = r2.applyTo(r1);
+ //Rotation r = r1;
+ if(debug) System.out.printf("%s: Coord before corrections\n%s\n", getClass().getSimpleName(),getCoord().toString());
+ if(debug) System.out.printf("%s: box center before corrections\n%s\n", getClass().getSimpleName(),getBoxDim().toString());
+ getCoord().rotateApache(r);
+ if(debug) System.out.printf("%s: Coord after corrections\n%s\n", getClass().getSimpleName(),getCoord().toString());
+ if(debug) System.out.printf("%s: box center after corrections\n%s\n", getClass().getSimpleName(),getBoxDim().toString());
+
+
+ }
+
+
+
+
+ }
+
+
+ public static class LongStereoHoleHalfModule extends LongStereoHalfModule {
+
+ private final static double sensor_x = 1.282*inch;
+ private final static double sensor_y = 3.889*inch;
+ private final static double sensor_z = 0.52*inch;
+
+ public LongStereoHoleHalfModule(String name, SurveyVolume mother,
+ AlignmentCorrection alignmentCorrection, int layer,
+ String half) {
+ super(name, mother, alignmentCorrection, layer, half);
+ init();
+ }
+
+ protected Hep3Vector getSensorPosition() {
+ return new BasicHep3Vector(-sensor_x, sensor_y, -sensor_z);
+ }
+
+ }
+
+
+
+ public static class LongStereoSlotHalfModule extends LongStereoHalfModule {
+
+ private final static double sensor_x = 1.481*inch;
+ private final static double sensor_y = 7.861*inch;
+ private final static double sensor_z = 0.52*inch;
+
+
+ public LongStereoSlotHalfModule(String name, SurveyVolume mother,
+ AlignmentCorrection alignmentCorrection, int layer,
+ String half) {
+ super(name, mother, alignmentCorrection, layer, half);
+ init();
+ }
+
+ protected Hep3Vector getSensorPosition() {
+ return new BasicHep3Vector(-sensor_x, sensor_y, -sensor_z);
+ }
+
+ }
+
+
/**
* @SurveyVolume volume defining the coordinate system of the axial half-module in module L1-3
* Reference: @ModuleL13 coordinate system
@@ -718,20 +990,7 @@
setCenter(x, y, z);
}
-
-// double box_center_local_x = TestRunHalfModule.getLength()/2.0 - ( (170.00 + 10.00) - Sensor.getSensorLength()/2.0);
-// double box_center_local_y = - Sensor.getSensorThickness()/2.0 - HalfModuleLamination.kapton_thickness - CarbonFiber.cf_thickness + half_module_thickness/2.0;
-// double box_center_local_z = TestRunHalfModule.getWidth()/2.0 - ( 12.66 - (8.83 -3.00) + Sensor.getSensorWidth()/2.0 );
-//
-//
-// if(useSiStripsConvention) {
-// //setCenter(box_center_local_z, box_center_local_x, box_center_local_y);
-// setCenter(-1.0*box_center_local_z, box_center_local_x, box_center_local_y);
-// } else {
-// setCenter(box_center_local_x, box_center_local_y, box_center_local_z);
-// }
-//
-
+
}
@@ -801,6 +1060,46 @@
}
+ public static class HalfLongModuleLamination extends HPSTestRunTracker2014GeometryDefinition.HalfModuleComponent {
+ protected static final double width = Sensor.getSensorWidth();
+ protected static final double length = Sensor.getSensorLength();
+ protected static final double height = Sensor.getSensorThickness();
+
+ public HalfLongModuleLamination(String name, SurveyVolume mother, int id) {
+ super(name, mother, null, id);
+ init();
+ }
+
+ protected double getThickness() {
+ return height;
+ }
+ protected double getHeigth() {
+ return height;
+ }
+ protected double getWidth() {
+ return width;
+ }
+ protected double getLength() {
+ return length;
+ }
+ protected void setPos() {
+ ballPos = new BasicHep3Vector(0, 0, -(Sensor.getSensorThickness()/2.0 + height/2.0));
+ veePos = new BasicHep3Vector(ballPos.x()+1, ballPos.y(), ballPos.z());
+ flatPos = new BasicHep3Vector(ballPos.x(), ballPos.y()+1, ballPos.z());
+ }
+ protected void setCenter() {
+ setCenter(0, 0, 0);
+ }
+ protected void setBoxDim() {
+ setBoxDim(width, length, height);
+ }
+
+
+
+
+ }
+
+
/**
@@ -827,7 +1126,7 @@
if(layer < 4) {
ref = getSurveyVolume(UChannelL13Bottom.class);
} else {
- throw new UnsupportedOperationException("L4-6 not implemented yet");
+ ref = getSurveyVolume(UChannelL46Bottom.class);
}
} else {
throw new UnsupportedOperationException("top not implemented yet");
@@ -841,28 +1140,209 @@
module = new ModuleL2(volName, mother, alignmentCorrection, ref);
} else if(layer==3) {
module = new ModuleL3(volName, mother, alignmentCorrection, ref);
+ } else if(layer==4) {
+ module = new ModuleL4(volName, mother, alignmentCorrection, ref);
+ } else if(layer==5) {
+ module = new ModuleL5(volName, mother, alignmentCorrection, ref);
+ } else if(layer==6) {
+ module = new ModuleL6(volName, mother, alignmentCorrection, ref);
} else {
throw new UnsupportedOperationException("Layer " + layer + " not implemented yet");
}
// 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();
- }
-
- }
-
-
+ // need to create it and add to list before half-module is created
+ // as it uses the list to find the bundle. Ugly. TODO fix this.
+ BaseModuleBundle bundle;
+
+ if(layer<=3) {
+ 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);
+ }
+ }
+
+
+
+ //if(isDebug()) {
+ System.out.printf("%s: created module bundle:\n", this.getClass().getSimpleName());
+ bundle.print();
+ System.out.printf("%s: Now there are %d modules\n", this.getClass().getSimpleName(),modules.size());
+ //}
+
+
+
+ }
+
+
+
+
+
+ /**
+ * @author Per Hansson Adrian <[log in to unmask]>
+ *
+ */
+ public static class LongModuleBundle extends BaseModuleBundle {
+ public HalfModuleBundle halfModuleAxialHole = null;
+ public HalfModuleBundle halfModuleStereoHole = null;
+ public HalfModuleBundle halfModuleAxialSlot = null;
+ public HalfModuleBundle halfModuleStereoSlot = null;
+ protected SurveyVolume coldBlock = null;
+ public LongModuleBundle(BaseModule m) {
+ super(m);
+ }
+ public void print() {
+ if(module!=null) System.out.printf("%s: %s\n", this.getClass().getSimpleName(),module.getName());
+ if(halfModuleAxialHole!=null) halfModuleAxialHole.print();
+ if(halfModuleAxialSlot!=null) halfModuleAxialSlot.print();
+ if(coldBlock!=null)System.out.printf("%s: %s\n", this.getClass().getSimpleName(),coldBlock.getName());
+ if(halfModuleStereoHole!=null) halfModuleStereoHole.print();
+ if(halfModuleStereoSlot!=null) halfModuleStereoSlot.print();
+ }
+ }
+
+
+ /**
+ * @author Per Hansson Adrian <[log in to unmask]>
+ *
+ */
+ public static class LongHalfModuleBundle extends HalfModuleBundle {
+ public LongHalfModuleBundle() {
+ super();
+ }
+ public LongHalfModuleBundle(SurveyVolume hm) {
+ super(hm);
+ }
+ public void print() {
+ System.out.printf("%s: %s\n", this.getClass().getSimpleName(),halfModule.getName());
+ }
+ }
+
+
+
+ /**
+ * Create the half-module.
+ * @param side - stereo or axial
+ * @param type - hole or slot
+ * @param mother to the half-module
+ */
+ protected void makeLongHalfModule(String side, String type , BaseModule mother) {
+
+ String moduleName = mother.getName();
+
+ if(isDebug()) System.out.printf("%s: makeHalfModule for %s %s %s \n", this.getClass().getSimpleName(), moduleName, side, type);
+
+ String volName = moduleName + "_halfmodule_" + side + "_" + type;
+
+ // top or bottom?
+ String half = mother.getHalf();
+ boolean isTopLayer = !mother.isBottom();
+
+ // find layer
+ int layer = mother.getLayer();
+
+ // axial or stereo
+ boolean isAxial = isAxialFromName(volName);
+
+ // hole or slot
+ boolean isHole = isHoleFromName(volName);
+
+ // find layer according to old definition
+ int oldLayer = getOldLayerDefinition(isTopLayer, layer, isAxial);
+
+ // find alignment correction to this volume
+ AlignmentCorrection alignmentCorrection = getHalfModuleAlignmentCorrection(isTopLayer, oldLayer);
+
+
+ // find the module bundle that it will be added to
+ //TestRunModuleBundle bundle = (TestRunModuleBundle)getModuleBundle(mother);
+ //TestRunHalfModuleBundle halfModuleBundle;
+ LongModuleBundle bundle = (LongModuleBundle)getModuleBundle(mother);
+
+
+
+
+ // Build the half-module bundle and half-module
+ //TODO clean this up to a separate method
+ LongHalfModule halfModule;
+ HalfModuleBundle halfModuleBundle;
+ if(isAxial) {
+ halfModuleBundle = new LongHalfModuleBundle();
+ if(isHole) {
+ halfModule = new LongAxialHoleHalfModule(volName, mother, alignmentCorrection, layer, half);
+ bundle.halfModuleAxialHole = halfModuleBundle;
+ } else {
+ halfModule = new LongAxialSlotHalfModule(volName, mother, alignmentCorrection, layer, half);
+ bundle.halfModuleAxialSlot = halfModuleBundle;
+ }
+ } else {
+ halfModuleBundle = new LongHalfModuleBundle();
+ if(isHole) {
+ halfModule = new LongStereoHoleHalfModule(volName, mother, alignmentCorrection, layer, half);
+ bundle.halfModuleStereoHole = halfModuleBundle;
+ } else {
+ halfModule = new LongStereoSlotHalfModule(volName, mother, alignmentCorrection, layer, half);
+ bundle.halfModuleStereoSlot = halfModuleBundle;
+ }
+ }
+ halfModuleBundle.halfModule = halfModule;
+
+
+
+
+ // create the half module components
+
+ makeHalfModuleComponentSensor(halfModule);
+
+ makeLongHalfModuleComponentKapton(halfModule);
+
+ //makeHalfModuleComponentCF(halfModule);
+
+ //makeHalfModuleComponentHybrid(halfModule);
+
+
+
+
+ }
+
+
+ protected void makeLongHalfModuleComponentKapton(BaseModule 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;
+
+ HalfLongModuleLamination lamination = new HalfLongModuleLamination(volName,mother,component_number);
+ lamination.setMaterial("Kapton");
+
+
+ HalfModuleBundle hm = getHalfModuleBundle((BaseModule) mother.getMother(), mother.getName());
+ hm.lamination = lamination;
+
+ }
+
+
+
+
protected HPSTestRunTracker2014GeometryDefinition.TestRunHalfModule createTestRunHalfModuleAxial(String volName,
BaseModule mother, AlignmentCorrection alignmentCorrection,
@@ -880,6 +1360,58 @@
+ /* (non-Javadoc)
+ * @see org.lcsim.geometry.compact.converter.HPSTrackerGeometryDefinition#getHalfModuleBundle(org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.BaseModule, java.lang.String)
+ */
+ protected HalfModuleBundle getHalfModuleBundle(BaseModule module, String halfModuleName) {
+ BaseModuleBundle moduleBundle = getModuleBundle(module);
+ HalfModuleBundle hm = null;
+ // TODO this should to change when I build quarter-modules for the long half-modules. I think. I should probably not rely on names but types btu not sure how to fix that one now.
+ if(moduleBundle!=null) {
+ if( moduleBundle instanceof TestRunModuleBundle) {
+ TestRunModuleBundle mtr = (TestRunModuleBundle) moduleBundle;
+ if(halfModuleName.contains("axial")) {
+ hm = mtr.halfModuleAxial;
+ }
+ else if(halfModuleName.contains("stereo")) {
+ hm = mtr.halfModuleStereo;
+ }
+ else {
+ throw new RuntimeException("NO axial or stereo string found in half module bundle name " + halfModuleName);
+ }
+ }
+ else if(moduleBundle instanceof LongModuleBundle) {
+ LongModuleBundle longModuleBundle = (LongModuleBundle) moduleBundle;
+ if(halfModuleName.contains("axial")) {
+ if(halfModuleName.contains("hole")) {
+ hm = longModuleBundle.halfModuleAxialHole;
+ } else if(halfModuleName.contains("slot")) {
+ hm = longModuleBundle.halfModuleAxialSlot;
+ } else {
+ throw new RuntimeException("This half-module name \"" + halfModuleName + " \" is invalid. Need to contain hole or slot for this type.");
+ }
+ } else if(halfModuleName.contains("stereo")) {
+ if(halfModuleName.contains("hole")) {
+ hm = longModuleBundle.halfModuleStereoHole;
+ } else if(halfModuleName.contains("slot")) {
+ hm = longModuleBundle.halfModuleStereoSlot;
+ } else {
+ throw new RuntimeException("This half-module name \"" + halfModuleName + " \" is invalid. Need to contain hole or slot for this type.");
+ }
+ } else {
+ throw new RuntimeException("This half-module name \"" + halfModuleName + " \" is invalid. Need to contain axial or stereo.");
+ }
+ }
+ else {
+ throw new NotImplementedException("This type of module bundle is not implemented!?");
+ }
+ } else {
+ throw new RuntimeException("Couldn't find module " + module.getName() + " and layer " + module.getLayer() + " and half " + module.getHalf());
+ }
+ return hm;
+ }
+
+
}
Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014LCDDBuilder.java
=============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014LCDDBuilder.java (original)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014LCDDBuilder.java Fri Nov 21 16:45:51 2014
@@ -1,16 +1,18 @@
package org.lcsim.geometry.compact.converter;
import org.jdom.Element;
+import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.LongHalfModuleBundle;
+import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.LongModuleBundle;
import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.PSVacuumChamber;
-import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.SupportRing;
-import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.SupportRingL13BottomKinMount;
+import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.SvtBox;
import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.SvtBoxBasePlate;
-import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.SvtBox;
import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.UChannelL13Bottom;
import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.UChannelL13BottomPlate;
import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.UChannelL46Bottom;
import org.lcsim.geometry.compact.converter.HPSTracker2014GeometryDefinition.UChannelL46BottomPlate;
-import org.lcsim.geometry.compact.converter.HPSTrackerBuilder.ModuleBundle;
+import org.lcsim.geometry.compact.converter.HPSTrackerBuilder.BaseModuleBundle;
+import org.lcsim.geometry.compact.converter.HPSTrackerBuilder.HalfModuleBundle;
+import org.lcsim.geometry.compact.converter.HPSTrackerGeometryDefinition.TestRunModuleBundle;
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;
@@ -93,9 +95,9 @@
if(isDebug()) System.out.printf("%s: build modules\n", getClass().getSimpleName());
// Loop over all modules created
- for(ModuleBundle mod : _builder.modules) {
+ for(BaseModuleBundle mod : _builder.modules) {
//SVTModuleBundle m = (SVTModuleBundle) mod;
- ModuleBundle m = mod;
+ BaseModuleBundle m = mod;
if(isDebug()) {
System.out.printf("%s: module layer %d half %s\n", getClass().getSimpleName(),m.getLayer(),m.getHalf());
m.print();
@@ -139,7 +141,67 @@
}
+ /**
+ * Rules for adding the LCDD module geometry.
+ * @param bundle - module to be added
+ * @param mother - mother LCDD geometry object
+ */
+ private void addModule(BaseModuleBundle bundle, LCDDSurveyVolume mother) {
+ if(bundle instanceof TestRunModuleBundle) {
+ addTestRunModule((TestRunModuleBundle) bundle, mother);
+ } else if(bundle instanceof LongModuleBundle) {
+ addLongModule((LongModuleBundle) bundle, mother);
+ } else {
+ throw new RuntimeException("The bundle is of unknown class type!");
+ }
+ }
-
+ /**
+ * Rules for adding the LCDD module geometry.
+ * @param bundle - module to be added
+ * @param mother - mother LCDD geometry object
+ */
+ protected void addLongModule(LongModuleBundle bundle, LCDDSurveyVolume mother) {
+ // This could perhaps be fixed if there is a relation with daughters in geometry definition?
+ // create the module
+ LCDDSurveyVolume lcddM = new LCDDSurveyVolume(bundle.module, lcdd, mother);
+ add(lcddM);
+ if(bundle.halfModuleAxialHole!=null) addLongHalfModule(bundle.halfModuleAxialHole,lcddM);
+ if(bundle.halfModuleAxialSlot!=null) addLongHalfModule(bundle.halfModuleAxialSlot,lcddM);
+ if(bundle.coldBlock!=null) add(new LCDDSurveyVolume(bundle.coldBlock, lcdd, lcddM));
+ if(bundle.halfModuleStereoHole!=null) addLongHalfModule(bundle.halfModuleStereoHole,lcddM);
+ if(bundle.halfModuleStereoSlot!=null) addLongHalfModule(bundle.halfModuleStereoSlot,lcddM);
+ }
+
+
+ /**
+ * Rules for adding the LCDD half module geometry.
+ * @param bundle - module to be added
+ * @param mother - mother LCDD geometry object
+ */
+ private void addLongHalfModule(HalfModuleBundle bundle2, LCDDSurveyVolume mother) {
+ LongHalfModuleBundle bundle = (LongHalfModuleBundle) bundle2;
+
+ // create the half-module
+ LCDDSurveyVolume lcddHM = new LCDDSurveyVolume(bundle.halfModule, lcdd, mother);
+ add(lcddHM);
+ // create the sensor
+ LCDDSurveyVolume lcddS = new LCDDSurveyVolume(bundle.sensor, lcdd, lcddHM);
+ add(lcddS);
+ // create the active sensor
+ LCDDSurveyVolume lcddAS = new LCDDSurveyVolume(bundle.activeSensor, lcdd, lcddS);
+ add(lcddAS);
+ // create the lamination
+ LCDDSurveyVolume lcddL = new LCDDSurveyVolume(bundle.lamination, lcdd, lcddHM);
+ add(lcddL);
+ /*
+ // create the carbon fiber frame
+ LCDDSurveyVolume lcddCF = new LCDDSurveyVolume(bundle.carbonFiber, lcdd, lcddHM);
+ add(lcddCF);
+ // create the hybrid frame
+ LCDDSurveyVolume lcddH = new LCDDSurveyVolume(bundle.hybrid, lcdd, lcddHM);
+ add(lcddH);
+*/
+ }
}
Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerBuilder.java
=============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerBuilder.java (original)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerBuilder.java Fri Nov 21 16:45:51 2014
@@ -11,11 +11,12 @@
import org.jdom.Element;
import org.lcsim.detector.Transform3D;
import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.BaseModule;
+import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TestRunHalfModule;
public abstract class HPSTrackerBuilder {
private boolean debug = true;
- public List<ModuleBundle> modules = new ArrayList<ModuleBundle>();
+ public List<BaseModuleBundle> modules = new ArrayList<BaseModuleBundle>();
protected List<SurveyVolume> surveyVolumes = new ArrayList<SurveyVolume>();
protected Element node;
protected List<MilleParameter> milleparameters = new ArrayList<MilleParameter>();
@@ -144,18 +145,18 @@
public abstract void build();
- /**
+
+
+
+ /**
* Bundle volumes into a module.
*
* @author Per Hansson Adrian <[log in to unmask]>
*
*/
- public static class ModuleBundle {
+ public abstract static class BaseModuleBundle {
public SurveyVolume module = null;
- public HalfModuleBundle halfModuleAxial = null;
- public HalfModuleBundle halfModuleStereo = null;
- protected SurveyVolume coldBlock = null;
- public ModuleBundle(BaseModule m) {
+ public BaseModuleBundle(BaseModule m) {
module = m;
}
public int getLayer() {
@@ -170,13 +171,8 @@
if(module==null) throw new RuntimeException("Need to add module to bundle first!");
return module.getMother();
}
- public void print() {
- if(module!=null) System.out.printf("%s: %s\n", this.getClass().getSimpleName(),module.getName());
- if(halfModuleAxial!=null) halfModuleAxial.print();
- if(coldBlock!=null)System.out.printf("%s: %s\n", this.getClass().getSimpleName(),coldBlock.getName());
- if(halfModuleStereo!=null) halfModuleStereo.print();
- }
- }
+ public abstract void print();
+ }
/**
* Bundle volumes into a half-module.
@@ -187,6 +183,12 @@
*/
public static abstract class HalfModuleBundle {
public SurveyVolume halfModule = null;
+ public SurveyVolume lamination = null;
+ public SurveyVolume sensor = null;
+ public SurveyVolume activeSensor = null;
+ public HalfModuleBundle(SurveyVolume hm) {
+ halfModule = hm;
+ }
public HalfModuleBundle() {
}
abstract public void print();
@@ -234,7 +236,7 @@
public static int getLayerFromVolumeName(String name) {
int layer = -1;
- for(int i=1; i<= 5; ++i) {
+ for(int i=1; i<= 6; ++i) {
if(name.contains(String.format("module_L%d", i))) {
layer = i;
}
@@ -301,7 +303,7 @@
throw new RuntimeException("Coulnd't find instance of " + c.getSimpleName() + " among the " + surveyVolumes.size() + " tracker items!");
}
- protected List<ModuleBundle> getModules() {
+ protected List<BaseModuleBundle> getModules() {
return modules;
}
@@ -311,8 +313,8 @@
* @param half - top or bottom half
* @return module or null if not found
*/
- protected ModuleBundle getModuleBundle(int layer, String half) {
- for(ModuleBundle m : modules) {
+ protected BaseModuleBundle getModuleBundle(int layer, String half) {
+ for(BaseModuleBundle m : modules) {
if(m.getLayer()==layer && m.getHalf().equals(half)) {
return m;
}
@@ -325,34 +327,17 @@
* @param module - to find
* @return bundle
*/
- protected ModuleBundle getModuleBundle(BaseModule module) {
+ protected BaseModuleBundle getModuleBundle(BaseModule module) {
return getModuleBundle(module.getLayer(), module.getHalf());
}
- /**
- * Find half module among the existing bundles.
- * @param module - to find
- * @return bundle
- */
- protected HalfModuleBundle getHalfModuleBundle(BaseModule module, String halfModuleName) {
- ModuleBundle m = getModuleBundle(module.getLayer(), module.getHalf());
- HalfModuleBundle hm = null;
- if(m!=null) {
- if(halfModuleName.contains("axial")) hm = m.halfModuleAxial;
- else if(halfModuleName.contains("stereo")) hm = m.halfModuleStereo;
- else throw new RuntimeException("NO axial or stereo string found in half module bundle name " + halfModuleName);
- } else {
- throw new RuntimeException("No module found for " + module.getLayer() + " and half " + module.getHalf());
- }
- return hm;
- }
-
+
/**
* Add module to list.
* @param bundle - module to add.
*/
- protected void addModuleBundle(ModuleBundle bundle) {
- ModuleBundle b = getModuleBundle(bundle.getLayer(), bundle.getHalf());
+ protected void addModuleBundle(BaseModuleBundle bundle) {
+ BaseModuleBundle b = getModuleBundle(bundle.getLayer(), bundle.getHalf());
if(b==null) {
modules.add(bundle);
} else {
@@ -460,26 +445,45 @@
else if(half=="bottom") isTopLayer = false;
else throw new RuntimeException("no half found from " + name);
boolean isAxial = isAxialFromName(name);
- return getOldGeomDefLayerFromVolumeName(isTopLayer, l, isAxial);
- }
-
- /**
- * Get axial or stereo key name from name
- * @param name that contains layer and half information.
- * @return the layer.
+ return getOldLayerDefinition(isTopLayer, l, isAxial);
+ }
+
+ /**
+ * Get axial or stereo key name from string
+ * @param name
+ * @return axial or not boolean
*/
public static boolean isAxialFromName(String name) {
- boolean isAxial = false;
+ boolean isAxial;
if(name.contains("axial")) isAxial=true;
else if(name.contains("stereo")) isAxial=false;
else throw new RuntimeException("no axial or stereo name found from " + name);
return isAxial;
}
-
- public static int getOldGeomDefLayerFromVolumeName(boolean isTopLayer, int l, boolean isAxial) {
+ /**
+ * Get hole or slot key name from string
+ * @param name.
+ * @return hole or not boolean
+ */
+ public static boolean isHoleFromName(String name) {
+ boolean isHole;
+ if(name.contains("hole")) isHole=true;
+ else if(name.contains("slot")) isHole=false;
+ else throw new RuntimeException("no hole or slot keys found in name " + name);
+ return isHole;
+ }
+
+
+ /**
+ * Extract old definition of Test Run sensor number.
+ * @param isTopLayer - top or bottom layer
+ * @param l - layer
+ * @param isAxial - axial or stereo sensor
+ * @return
+ */
+ public static int getOldLayerDefinition(boolean isTopLayer, int l, boolean isAxial) {
int layer=-1;
- // convert to old definition
if(isAxial) {
if(isTopLayer) {
layer = 2*l-1;
@@ -496,8 +500,8 @@
}
return layer;
}
-
-
+
+
}
Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerGeometryDefinition.java
=============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerGeometryDefinition.java (original)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerGeometryDefinition.java Fri Nov 21 16:45:51 2014
@@ -13,10 +13,7 @@
import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.Hybrid;
import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.Sensor;
import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TestRunHalfModule;
-import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TestRunHalfModuleAxial;
import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TestRunHalfModuleBundle;
-import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TestRunHalfModuleStereo;
-import org.lcsim.geometry.compact.converter.HPSTestRunTracker2014GeometryDefinition.TestRunModule;
/**
*
@@ -62,9 +59,13 @@
}
+ protected abstract HalfModuleBundle getHalfModuleBundle(BaseModule module, String halfModuleName);
protected abstract void makeModuleBundle(int layer, String half);
protected abstract TestRunHalfModule createTestRunHalfModuleAxial(String volName, BaseModule mother, AlignmentCorrection alignmentCorrection, int layer, String half);
protected abstract TestRunHalfModule createTestRunHalfModuleStereo(String volName, BaseModule mother, AlignmentCorrection alignmentCorrection, int layer, String half);
+
+
+
protected boolean doLayer(int layer) {
int a = (1<<(layer-1)) & layerBitMask;
@@ -98,7 +99,7 @@
boolean isAxial = isAxialFromName(volName);
// find layer according to old definition
- int oldLayer = getOldGeomDefLayerFromVolumeName(isTopLayer, layer, isAxial);
+ int oldLayer = getOldLayerDefinition(isTopLayer, layer, isAxial);
//if(isDebug()) System.out.printf("%s: half? %s layer %d oldlayer %d axial? %s\n",
// this.getClass().getSimpleName(), isTopLayer?"top":"bottom", layer,oldLayer,isAxial?"yes":"no");
@@ -106,18 +107,22 @@
AlignmentCorrection alignmentCorrection = getHalfModuleAlignmentCorrection(isTopLayer, oldLayer);
- // find the bundle that it will be added to
+ // find the module bundle that it will be added to
//TestRunModuleBundle bundle = (TestRunModuleBundle)getModuleBundle(mother);
//TestRunHalfModuleBundle halfModuleBundle;
- ModuleBundle bundle = getModuleBundle(mother);
+ TestRunModuleBundle bundle = (TestRunModuleBundle) getModuleBundle(mother);
+ if(bundle==null) {
+ throw new RuntimeException("Couldn't find bundle for " + volName + " from mother " + mother.getName());
+ }
+
+ // Build the half-module bundle and add the half-module to it
HalfModuleBundle halfModuleBundle;
-
-
- // Build the half-module
TestRunHalfModule halfModule;
if(isAxial) {
halfModule = createTestRunHalfModuleAxial(volName, mother, alignmentCorrection, layer, half);
halfModuleBundle = new TestRunHalfModuleBundle(halfModule);
+ System.out.printf("halfModuleBundle is null? %s\n", halfModuleBundle==null?"true":"false");
+ System.out.printf("bundle.halfModuleAxial is null? %s\n", bundle.halfModuleAxial==null?"true":"false");
bundle.halfModuleAxial = halfModuleBundle;
} else {
halfModule = createTestRunHalfModuleStereo(volName, mother, alignmentCorrection, layer, half);
@@ -186,7 +191,7 @@
}
- void makeHalfModuleComponentKapton(TestRunHalfModule mother) {
+ void makeHalfModuleComponentKapton(BaseModule mother) {
if(isDebug()) System.out.printf("%s: makeHalfModuleComponentKapton for %s \n", this.getClass().getSimpleName(), mother.getName());
@@ -201,12 +206,34 @@
lamination.setMaterial("Kapton");
+ HalfModuleBundle hm = getHalfModuleBundle((BaseModule) mother.getMother(), mother.getName());
+ hm.lamination = lamination;
+
+ }
+
+ /*
+ void makeHalfModuleComponentKapton(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;
+
+ HalfModuleLamination lamination = new HalfModuleLamination(volName,mother,component_number);
+ lamination.setMaterial("Kapton");
+
+
TestRunHalfModuleBundle hm = (TestRunHalfModuleBundle) getHalfModuleBundle((BaseModule) mother.getMother(), mother.getName());
hm.lamination = lamination;
}
-
- void makeHalfModuleComponentSensor(TestRunHalfModule mother) {
+*/
+
+ protected void makeHalfModuleComponentSensor(BaseModule mother) {
if(isDebug()) System.out.printf("%s: makeHalfModuleComponentSensor for %s \n", this.getClass().getSimpleName(), mother.getName());
@@ -219,6 +246,43 @@
Sensor sensor = new Sensor(volName, mother, null, component_number);
sensor.setMaterial("Silicon");
+ HalfModuleBundle hm = getHalfModuleBundle((BaseModule)mother.getMother(), mother.getName());
+ hm.sensor = sensor;
+
+
+ makeHalfModuleComponentActiveSensor(sensor);
+
+
+ }
+
+ private void makeHalfModuleComponentActiveSensor(Sensor mother) {
+
+ if(isDebug()) System.out.printf("%s: makeHalfModuleComponentActiveSensor for %s \n", this.getClass().getSimpleName(), mother.getName());
+
+ String volName = mother.getName() + "_active";
+
+ ActiveSensor active_sensor = new ActiveSensor(volName, mother);
+ active_sensor.setMaterial("Silicon");
+
+ HalfModuleBundle hm = getHalfModuleBundle((BaseModule) mother.getMother().getMother(), mother.getMother().getName());
+ hm.activeSensor = active_sensor;
+
+ }
+
+ /*
+ void makeHalfModuleComponentSensor(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;
+
+ //
+ Sensor sensor = new Sensor(volName, mother, null, component_number);
+ sensor.setMaterial("Silicon");
+
TestRunHalfModuleBundle hm = (TestRunHalfModuleBundle) getHalfModuleBundle((BaseModule)mother.getMother(), mother.getName());
hm.sensor = sensor;
@@ -241,6 +305,7 @@
hm.activeSensor = active_sensor;
}
+ */
/**
@@ -266,10 +331,29 @@
}
}
+ /**
+ * TODO This class is shared among geometry definitions but should really be in the test run class. Fix this.
+ * @author Per Hansson Adrian <[log in to unmask]>
+ *
+ */
+ public static class TestRunModuleBundle extends BaseModuleBundle {
+ public HalfModuleBundle halfModuleAxial = null;
+ public HalfModuleBundle halfModuleStereo = null;
+ protected SurveyVolume coldBlock = null;
+ public TestRunModuleBundle(BaseModule m) {
+ super(m);
+ }
+ public void print() {
+ if(module!=null) System.out.printf("%s: %s\n", this.getClass().getSimpleName(),module.getName());
+ if(halfModuleAxial!=null) halfModuleAxial.print();
+ if(coldBlock!=null)System.out.printf("%s: %s\n", this.getClass().getSimpleName(),coldBlock.getName());
+ if(halfModuleStereo!=null) halfModuleStereo.print();
+ }
+ }
+
+
-
-
Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerLCDDBuilder.java
=============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerLCDDBuilder.java (original)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerLCDDBuilder.java Fri Nov 21 16:45:51 2014
@@ -10,7 +10,7 @@
public abstract class HPSTrackerLCDDBuilder implements IHPSTrackerLCDDBuilder {
- public boolean _debug = false;
+ public boolean _debug = true;
protected LCDD lcdd = null;
protected LCDDSurveyVolume baseSurveyVolume;
protected List<LCDDSurveyVolume> lcddSurveyVolumes = new ArrayList<LCDDSurveyVolume>();
########################################################################
Use REPLY-ALL to reply to list
To unsubscribe from the LCDET-SVN list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCDET-SVN&A=1
|