Commit in projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd on MAIN | |||
HPSTestRunTracker2014.java | +4 | -4 | 3203 -> 3204 |
HPSTestRunTracker2014Builder.java | +43 | -12 | 3203 -> 3204 |
HPSTestRunTracker2014LCDDBuilder.java | +101 | -107 | 3203 -> 3204 |
+148 | -123 |
Renamed some base classes to make things more transparent. Restructured some stuff. Work in progress.
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014.java 2014-07-24 23:04:27 UTC (rev 3203) +++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014.java 2014-07-25 01:03:12 UTC (rev 3204) @@ -22,7 +22,7 @@
import org.lcsim.detector.RotationGeant; import org.lcsim.detector.Transform3D; import org.lcsim.detector.Translation3D;
-import org.lcsim.geometry.compact.converter.lcdd.HPSTestRunTracker2014LCDDBuilder.BaseGeom;
+import org.lcsim.geometry.compact.converter.lcdd.HPSTestRunTracker2014LCDDBuilder.LCDDBaseGeom;
import org.lcsim.geometry.compact.converter.lcdd.HPSTestRunTracker2014LCDDBuilder.GhostBaseGeom; import org.lcsim.geometry.compact.converter.lcdd.util.Box; import org.lcsim.geometry.compact.converter.lcdd.util.LCDD;
@@ -128,7 +128,7 @@
}
- private void addToLCDD(BaseGeom lcddObj, LCDD lcdd) {
+ private void addToLCDD(LCDDBaseGeom lcddObj, LCDD lcdd) {
if(_debug) System.out.printf("%s: adding %s to LCDD\n", getClass().getSimpleName(),lcddObj.getName());
@@ -144,7 +144,7 @@
// add daughters if(_debug) System.out.printf("%s: add %d daughters to %s\n", getClass().getSimpleName(),lcddObj.getDaughters().size(),lcddObj.getName());
- for(BaseGeom daughter : lcddObj.getDaughters()) {
+ for(LCDDBaseGeom daughter : lcddObj.getDaughters()) {
addToLCDD(daughter,lcdd); }
@@ -162,7 +162,7 @@
LCDD lcdd = builder.getLCDD();
- BaseGeom lcddObj = builder.getBaseLCDD();
+ LCDDBaseGeom lcddObj = builder.getBaseLCDD();
addToLCDD(lcddObj,lcdd);
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014Builder.java 2014-07-24 23:04:27 UTC (rev 3203) +++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014Builder.java 2014-07-25 01:03:12 UTC (rev 3204) @@ -19,15 +19,17 @@
private boolean debug = true; //Geometry members
- protected HPSTestRunTracker2014GeomDef.TrackingBase tracking; - protected HPSTestRunTracker2014GeomDef.Base base; - protected HPSTestRunTracker2014GeomDef.BasePlate basePlate; - protected HPSTestRunTracker2014GeomDef.CSupport cSupport; - protected HPSTestRunTracker2014GeomDef.SupportBottom supportBottom; - protected HPSTestRunTracker2014GeomDef.SupportPlateBottom supportPlateBottom; - protected HPSTestRunTracker2014GeomDef.SupportTop supportTop; - protected HPSTestRunTracker2014GeomDef.SupportPlateTop supportPlateTop; - protected List<HPSTestRunTracker2014GeomDef.TestRunModule> modules;
+ protected List<HPSTestRunTracker2014GeomDef.BaseGeom> trackerItems = new ArrayList<HPSTestRunTracker2014GeomDef.BaseGeom>(); + //TODO I should delete these as they are part of the list..need to fix getters at the same time... + private HPSTestRunTracker2014GeomDef.TrackingBase tracking; + private HPSTestRunTracker2014GeomDef.Base base; + private HPSTestRunTracker2014GeomDef.BasePlate basePlate; + private HPSTestRunTracker2014GeomDef.CSupport cSupport; + private HPSTestRunTracker2014GeomDef.SupportBottom supportBottom; + private HPSTestRunTracker2014GeomDef.SupportPlateBottom supportPlateBottom; + private HPSTestRunTracker2014GeomDef.SupportTop supportTop; + private HPSTestRunTracker2014GeomDef.SupportPlateTop supportPlateTop; + private List<HPSTestRunTracker2014GeomDef.TestRunModule> modules;
@@ -39,22 +41,51 @@
if(isDebug()) System.out.printf("%s: constructing the geometry objects\n", this.getClass().getSimpleName());
+ // keep the order correct. + // each item has knowledge of its mother but not its daughters
tracking = new HPSTestRunTracker2014GeomDef.TrackingBase("trackingVolume",null);
+ trackerItems.add(tracking);
base = new HPSTestRunTracker2014GeomDef.Base("base",tracking);
+ trackerItems.add(base);
basePlate = new HPSTestRunTracker2014GeomDef.BasePlate("baseplate",base, "Aluminum");
+ trackerItems.add(basePlate);
cSupport = new HPSTestRunTracker2014GeomDef.CSupport("c_support", base);
+ trackerItems.add(cSupport);
supportBottom = new HPSTestRunTracker2014GeomDef.SupportBottom("support_bottom", base, cSupport);
+ trackerItems.add(supportBottom);
supportPlateBottom = new HPSTestRunTracker2014GeomDef.SupportPlateBottom("support_plate_bottom", supportBottom, "Aluminum");
+ trackerItems.add(supportPlateBottom);
supportTop = new HPSTestRunTracker2014GeomDef.SupportTop("support_top", base, cSupport);
+ trackerItems.add(supportTop);
supportPlateTop= new HPSTestRunTracker2014GeomDef.SupportPlateTop("support_plate_top", supportTop, "Aluminum");
+ trackerItems.add(supportPlateTop);
modules = new ArrayList<HPSTestRunTracker2014GeomDef.TestRunModule>();
-
+ + +
if(isDebug()) System.out.printf("%s: DONE constructing the geometry objects\n", this.getClass().getSimpleName()); }
- protected HPSTestRunTracker2014GeomDef.TrackingBase getTracking() { - return tracking;
+ + + protected <T> T getItem(Class<T> c) { + if(isDebug()) System.out.printf("%s: get Item %s\n", this.getClass().getSimpleName(),c.getName()); + + for(HPSTestRunTracker2014GeomDef.BaseGeom item : trackerItems) { + if(isDebug()) System.out.printf("%s: item %s\n", getClass().getSimpleName(),item.getClass().getName()); + if(c.isInstance(item)) { + return (T)item; + } + } + throw new RuntimeException("Coulnd't find instance of " + c.getSimpleName() + " among the " + trackerItems.size() + " tracker items!");
}
+ + //protected HPSTestRunTracker2014GeomDef.BaseGeom getTracking() { + // HPSTestRunTracker2014GeomDef.BaseGeom t = getItem(HPSTestRunTracker2014GeomDef.TrackingBase.class); + // return t; + //} + + //TODO replace all calls to the below with the generic getItem() function above
protected HPSTestRunTracker2014GeomDef.Base getBase() { return base; }
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014LCDDBuilder.java 2014-07-24 23:04:27 UTC (rev 3203) +++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014LCDDBuilder.java 2014-07-25 01:03:12 UTC (rev 3204) @@ -27,14 +27,95 @@
public class HPSTestRunTracker2014LCDDBuilder extends HPSTestRunTracker2014Builder {
+ + protected LCDD lcdd; + protected LCDDBaseGeom trackingLCDD; + protected LCDDBaseGeom baseLCDD; + protected LCDDBaseGeom basePlateLCDD; + protected LCDDBaseGeom cSupportLCDD; + protected LCDDBaseGeom supportBottomLCDD; + protected LCDDBaseGeom supportPlateBottomLCDD; + protected LCDDBaseGeom supportTopLCDD; + protected LCDDBaseGeom supportPlateTopLCDD; + protected List<LCDDBaseGeom> modulesLCDD; +
/**
+ * Default constructor + */ + public HPSTestRunTracker2014LCDDBuilder(boolean debugFlag) { + super(debugFlag); + } + + + protected void build(Volume worldVolume) { + // go through the list of volumes to build + if(isDebug()) System.out.printf("%s: build the LCDD geometry objects\n", getClass().getSimpleName()); + trackingLCDD = new GhostBaseGeom(getItem(HPSTestRunTracker2014GeomDef.TrackingBase.class), worldVolume); + baseLCDD = new LCDDBaseGeom(getItem(HPSTestRunTracker2014GeomDef.Base.class), lcdd, trackingLCDD); + basePlateLCDD = new LCDDBaseGeom(getItem(HPSTestRunTracker2014GeomDef.BasePlate.class), lcdd, baseLCDD); + cSupportLCDD = new GhostBaseGeom(getItem(HPSTestRunTracker2014GeomDef.CSupport.class), baseLCDD); + supportBottomLCDD = new LCDDBaseGeom(getItem(HPSTestRunTracker2014GeomDef.SupportBottom.class), lcdd, baseLCDD); + supportPlateBottomLCDD = new LCDDBaseGeom(getItem(HPSTestRunTracker2014GeomDef.SupportPlateBottom.class), lcdd, supportBottomLCDD); + supportTopLCDD = new LCDDBaseGeom(getItem(HPSTestRunTracker2014GeomDef.SupportTop.class), lcdd, baseLCDD); + supportPlateTopLCDD = new LCDDBaseGeom(getItem(HPSTestRunTracker2014GeomDef.SupportPlateTop.class), lcdd, supportTopLCDD); + if(isDebug()) System.out.printf("%s: DONE building the LCDD geometry objects\n", getClass().getSimpleName()); + + modulesLCDD = new ArrayList<LCDDBaseGeom>(); + + //set lcdd vis + basePlateLCDD.setVisName("BasePlateVis"); + supportBottomLCDD.setVisName("SupportVolumeVis"); + supportTopLCDD.setVisName("SupportVolumeVis"); + supportPlateBottomLCDD.setVisName("SupportPlateVis"); + supportBottomLCDD.setVisName("SupportVolumeVis"); + + } + + protected void setLCDD(LCDD lcdd) { + this.lcdd = lcdd; + } + protected LCDD getLCDD() { + return lcdd; + } + + protected LCDDBaseGeom getTrackingLCDD() { + return trackingLCDD; + } + protected LCDDBaseGeom getBaseLCDD() { + return baseLCDD; + } + protected LCDDBaseGeom getBasePlateLCDD() { + return basePlateLCDD; + } + protected LCDDBaseGeom getcSupportLCDD() { + return cSupportLCDD; + } + protected LCDDBaseGeom getSupportBottomLCDD() { + return supportBottomLCDD; + } + protected LCDDBaseGeom getSupportPlateBottomLCDD() { + return supportPlateBottomLCDD; + } + protected LCDDBaseGeom getSupportTopLCDD() { + return supportTopLCDD; + } + protected LCDDBaseGeom getSupportPlateTopLCDD() { + return supportPlateTopLCDD; + } + protected List<LCDDBaseGeom> getModulesLCDD() { + return modulesLCDD; + } + + + /**
*
- * Base geometry class for holding LCDD geometry object definitions where no volume is built but used as reference.
+ * Base geometry class for holding LCDD geometry object definitions + * where no volume is built but it can be used as reference in building the geometry.
* * @author Per Hansson Adrian <[log in to unmask]> * */
- protected static class GhostBaseGeom extends BaseGeom {
+ protected static class GhostBaseGeom extends LCDDBaseGeom {
/** * Initialize this object with a known volume and no mother. Typically the world volume would use this.
@@ -55,7 +136,7 @@
* @param base - object used to get geometry definitions * @param mother - mother LCDD object */
- public GhostBaseGeom(HPSTestRunTracker2014GeomDef.BaseGeom base, BaseGeom mother) {
+ public GhostBaseGeom(HPSTestRunTracker2014GeomDef.BaseGeom base, LCDDBaseGeom mother) {
super(); if(isDebug()) System.out.printf("%s: constructing LCDD ghost object %s with mother %s\n", this.getClass().getSimpleName(),base.getName(),mother==null?"null":mother.getName()); setName(base.getName());
@@ -66,13 +147,16 @@
}
- - -
- protected static class BaseGeomVis {
+ /** + * + * LCDD geometry visualization information + * + * @author Per Hansson Adrian <[log in to unmask]> + */ + protected static class LCDDBaseGeomVis {
protected String visName = "";
- public BaseGeomVis() {}
+ public LCDDBaseGeomVis() {}
protected String getVisName() { return visName; }
@@ -85,17 +169,14 @@
- -
-
/** * Base geometry class for holding LCDD geometry object definitions. * * @author Per Hansson Adrian <[log in to unmask]> */
- protected static class BaseGeom extends BaseGeomVis {
+ protected static class LCDDBaseGeom extends LCDDBaseGeomVis {
private boolean debug = true; private String name; private Box box= null;
@@ -104,12 +185,12 @@
private Rotation rot = null; private PhysVol physVolume = null; private LCDD lcdd = null;
- private BaseGeom mother = null; - public List<BaseGeom> daughters = new ArrayList<BaseGeom>();
+ private LCDDBaseGeom mother = null; + public List<LCDDBaseGeom> daughters = new ArrayList<LCDDBaseGeom>();
/** * Default constructor */
- public BaseGeom() {
+ public LCDDBaseGeom() {
} /**
@@ -118,7 +199,7 @@
* @param lcdd - lcdd file * @param mother - reference to mother LCDD definition */
- public BaseGeom(HPSTestRunTracker2014GeomDef.BaseGeom base, LCDD lcdd, BaseGeom mother) {
+ public LCDDBaseGeom(HPSTestRunTracker2014GeomDef.BaseGeom base, LCDD lcdd, LCDDBaseGeom mother) {
if(isDebug()) System.out.printf("%s: constructing LCDD object %s with mother %s\n", this.getClass().getSimpleName(),base.getName(),mother==null?"null":mother.getName()); this.lcdd = lcdd; setName(base.getName());
@@ -203,10 +284,10 @@
protected void setRot(Rotation rot) { this.rot = rot; }
- protected BaseGeom getMother() {
+ protected LCDDBaseGeom getMother() {
return mother; }
- protected void setMother(BaseGeom mother) {
+ protected void setMother(LCDDBaseGeom mother) {
this.mother = mother; } protected PhysVol getPhysVolume() {
@@ -219,102 +300,15 @@
return debug; }
- protected List<BaseGeom> getDaughters() {
+ protected List<LCDDBaseGeom> getDaughters() {
return daughters; }
- protected void addDaughter(BaseGeom o) {
+ protected void addDaughter(LCDDBaseGeom o) {
getDaughters().add(o); } }
-
- - - - - - - - protected LCDD lcdd; - protected BaseGeom trackingLCDD; - protected BaseGeom baseLCDD; - protected BaseGeom basePlateLCDD; - protected BaseGeom cSupportLCDD; - protected BaseGeom supportBottomLCDD; - protected BaseGeom supportPlateBottomLCDD; - protected BaseGeom supportTopLCDD; - protected BaseGeom supportPlateTopLCDD; - protected List<BaseGeom> modulesLCDD; - - /** - * Default constructor - */ - public HPSTestRunTracker2014LCDDBuilder(boolean debugFlag) { - super(debugFlag); - } - - - protected void build(Volume worldVolume) { - // go through the list of volumes to build - if(isDebug()) System.out.printf("%s: build the LCDD geometry objects\n", getClass().getSimpleName()); - trackingLCDD = new GhostBaseGeom(getTracking(), worldVolume); - baseLCDD = new BaseGeom(getBase(), lcdd, trackingLCDD); - basePlateLCDD = new BaseGeom(getBasePlate(), lcdd, baseLCDD); - cSupportLCDD = new GhostBaseGeom(getcSupport(), baseLCDD); - supportBottomLCDD = new BaseGeom(getSupportBottom(), lcdd, baseLCDD); - supportPlateBottomLCDD = new BaseGeom(getSupportPlateBottom(), lcdd, supportBottomLCDD); - supportTopLCDD = new BaseGeom(getSupportTop(), lcdd, baseLCDD); - supportPlateTopLCDD = new BaseGeom(getSupportPlateTop(), lcdd, supportTopLCDD); - if(isDebug()) System.out.printf("%s: DONE building the LCDD geometry objects\n", getClass().getSimpleName());
- modulesLCDD = new ArrayList<BaseGeom>(); - - //set lcdd vis - basePlateLCDD.setVisName("BasePlateVis"); - supportBottomLCDD.setVisName("SupportVolumeVis"); - supportTopLCDD.setVisName("SupportVolumeVis"); - supportPlateBottomLCDD.setVisName("SupportPlateVis"); - supportBottomLCDD.setVisName("SupportVolumeVis"); - - } - - protected void setLCDD(LCDD lcdd) { - this.lcdd = lcdd; - } - protected LCDD getLCDD() { - return lcdd; - } - - protected BaseGeom getTrackingLCDD() { - return trackingLCDD; - } - protected BaseGeom getBaseLCDD() { - return baseLCDD; - } - protected BaseGeom getBasePlateLCDD() { - return basePlateLCDD; - } - protected BaseGeom getcSupportLCDD() { - return cSupportLCDD; - } - protected BaseGeom getSupportBottomLCDD() { - return supportBottomLCDD; - } - protected BaseGeom getSupportPlateBottomLCDD() { - return supportPlateBottomLCDD; - } - protected BaseGeom getSupportTopLCDD() { - return supportTopLCDD; - } - protected BaseGeom getSupportPlateTopLCDD() { - return supportPlateTopLCDD; - } - protected List<BaseGeom> getModulesLCDD() { - return modulesLCDD; - } - - -
}
\ No newline at end of file
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