4 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-04 06:28:17 UTC (rev 3310)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/converter/compact/HPSTestRunTracker2014Converter.java 2014-09-04 23:17:17 UTC (rev 3311)
@@ -10,6 +10,7 @@
import org.lcsim.detector.ILogicalVolume;
import org.lcsim.detector.IPhysicalVolume;
import org.lcsim.detector.DetectorIdentifierHelper.SystemMap;
+import org.lcsim.detector.PhysicalVolume;
import org.lcsim.detector.PhysicalVolumeStore;
import org.lcsim.detector.converter.compact.HPSTestRunTracker2014JavaBuilder.GhostJavaBaseGeom;
import org.lcsim.detector.converter.compact.HPSTestRunTracker2014JavaBuilder.JavaBaseGeometry;
@@ -138,6 +139,7 @@
// build the physical volume
geometryObject.buildPhysVolume();
+ PhysicalVolume physVol = (PhysicalVolume) geometryObject.getPhysVolume();
// create detector element
if(HPSTestRunTracker2014Builder.isHalfModule(geometryObject.getName())) {
@@ -213,6 +215,10 @@
if(_debug) System.out.printf("%s: this is where I would create a detector element for the sensor %s if needed\n", getClass().getSimpleName(),geometryObject.getName());
+ // set the physical volume to be sensitive
+ // TODO this should go into the geometry definition?!
+ physVol.setSensitive(true);
+
} else if(HPSTestRunTracker2014Builder.isActiveSensor(geometryObject.getName())) {
// Setup the active sensor element
@@ -226,7 +232,7 @@
// Find active Sensor physical volume.
// Keep name consistent with old converter
- IPhysicalVolume sensorPhysVol = geometryObject.getPhysVolume();
+ PhysicalVolume sensorPhysVol = physVol;
if(sensorPhysVol==null) throw new RuntimeException("cannot find physVol for " + geometryObject.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-04 06:28:17 UTC (rev 3310)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014.java 2014-09-04 23:17:17 UTC (rev 3311)
@@ -113,6 +113,7 @@
if(_debug) System.out.printf("%s: setup and build the LCDD geometry\n", getClass().getSimpleName());
builder.setLCDD(lcdd);
+ builder.setSensitiveDetector(sens);
builder.build(trackingVolume);
if(_debug) System.out.printf("%s: DONE setup and build the LCDD geometry\n", getClass().getSimpleName());
@@ -159,13 +160,14 @@
// Get a reference to the LCDD
LCDD lcdd = builder.getLCDD();
+ SensitiveDetector sd = builder.getSensitiveDetector();
// Reference to the top level object in the builder class
// In this case it is the base volume holding the entire tracker
LCDDBaseGeometry lcddObj = builder.getBaseLCDD();
// Add the base volume and all its daughters to the LCDD
- addToLCDD(lcddObj,lcdd);
+ addToLCDD(lcddObj,lcdd,sd);
if(_debug) System.out.printf("%s: buildLCDD DONE\n", getClass().getSimpleName());
@@ -178,7 +180,7 @@
* @param lcddObj to add
* @param lcdd file
*/
- private void addToLCDD(LCDDBaseGeometry lcddObj, LCDD lcdd) {
+ private void addToLCDD(LCDDBaseGeometry lcddObj, LCDD lcdd, SensitiveDetector sd) {
if(_debug) System.out.printf("%s: adding %s to LCDD\n", getClass().getSimpleName(),lcddObj.getName());
@@ -198,7 +200,7 @@
// the java converter
// TODO move this to the builder for each volume
try {
- setPhysicalVolumeProperties(lcddObj);
+ setPhysicalVolumeProperties(lcddObj, sd);
} catch (DataConversionException e) {
e.printStackTrace();
}
@@ -206,7 +208,7 @@
// add daughters
if(_debug) System.out.printf("%s: add %d daughters to %s\n", getClass().getSimpleName(),lcddObj.getDaughters().size(),lcddObj.getName());
for(LCDDBaseGeometry daughter : lcddObj.getDaughters()) {
- addToLCDD(daughter,lcdd);
+ addToLCDD(daughter,lcdd, sd);
}
// finally add volume
@@ -222,7 +224,7 @@
* Set properties of the physical volume.
* @param geometryObject
*/
- private void setPhysicalVolumeProperties(LCDDBaseGeometry geometryObject) throws DataConversionException {
+ private void setPhysicalVolumeProperties(LCDDBaseGeometry geometryObject, SensitiveDetector sd) throws DataConversionException {
if(_debug) System.out.printf("%s: setPhysVolumeProperties for name %s\n", getClass().getSimpleName(),geometryObject.getName());
@@ -251,6 +253,7 @@
//TODO this is always 0 in old geometry? Is the id0 really needed?
else if(name.endsWith("sensor_active")) {
geometryObject.getPhysVolume().addPhysVolID("sensor", 0);
+ geometryObject.getVolume().setSensitiveDetector(sd);
}
//TODO are the component id's really needed?
else if(name.endsWith("sensor")) {
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-04 06:28:17 UTC (rev 3310)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014LCDDBuilder.java 2014-09-04 23:17:17 UTC (rev 3311)
@@ -24,6 +24,7 @@
import org.lcsim.geometry.compact.converter.lcdd.util.PhysVol;
import org.lcsim.geometry.compact.converter.lcdd.util.Position;
import org.lcsim.geometry.compact.converter.lcdd.util.Rotation;
+import org.lcsim.geometry.compact.converter.lcdd.util.SensitiveDetector;
import org.lcsim.geometry.compact.converter.lcdd.util.Volume;
/**
@@ -40,6 +41,7 @@
protected LCDD lcdd;
protected LCDDBaseGeometry baseTrackerGeometry;
protected List<LCDDBaseGeometry> lcdd_objects;
+ private SensitiveDetector sensitiveDetector;
/**
* Default constructor
@@ -459,6 +461,17 @@
}
+
+
+ public void setSensitiveDetector(SensitiveDetector sens) {
+ this.sensitiveDetector = sens;
+
+ }
+
+ public SensitiveDetector getSensitiveDetector() {
+ return this.sensitiveDetector;
+ }
+
projects/lcsim/trunk/detector-framework/src/test/java/org/lcsim/geometry/subdetector
--- projects/lcsim/trunk/detector-framework/src/test/java/org/lcsim/geometry/subdetector/HPSTestRunTracker2014Test.java 2014-09-04 06:28:17 UTC (rev 3310)
+++ projects/lcsim/trunk/detector-framework/src/test/java/org/lcsim/geometry/subdetector/HPSTestRunTracker2014Test.java 2014-09-04 23:17:17 UTC (rev 3311)
@@ -5,6 +5,7 @@
import org.lcsim.detector.DetectorElementStore;
import org.lcsim.detector.IDetectorElement;
import org.lcsim.detector.IDetectorElementStore;
+import org.lcsim.detector.PhysicalVolumePath;
import org.lcsim.geometry.Detector;
import org.lcsim.geometry.GeometryReader;
@@ -41,9 +42,9 @@
IDetectorElementStore store = DetectorElementStore.getInstance();
System.out.printf("%s: Printing %d DE:\n",this.getClass().getSimpleName(), store.size());
- System.out.printf("%s: %50s %40s %50s\n",this.getClass().getSimpleName(), "name", "pos","mother");
+ System.out.printf("%s: %50s %40s %50s %50s\n",this.getClass().getSimpleName(), "name", "pos", "path","mother");
for(IDetectorElement e : store) {
- System.out.printf("%s: %50s %40s %50s \n",this.getClass().getSimpleName(), e.getName(),e.hasGeometryInfo()?e.getGeometry().getPosition().toString():" - ",e.getParent()==null?" - ":e.getParent().getName());
+ System.out.printf("%s: %50s %40s %50s %50s \n",this.getClass().getSimpleName(), e.getName(),e.hasGeometryInfo()?e.getGeometry().getPosition().toString():" - ",e.hasGeometryInfo()?((PhysicalVolumePath)e.getGeometry().getPath()).toString():" - ",e.getParent()==null?" - ":e.getParent().getName());
}
}
SVNspam 0.1