GeomConverter/src/org/lcsim/detector
diff -u -r1.5 -r1.6
--- IPhysicalVolume.java 9 Mar 2007 22:47:38 -0000 1.5
+++ IPhysicalVolume.java 7 Apr 2007 21:40:12 -0000 1.6
@@ -47,4 +47,10 @@
* @return
*/
public Hep3Vector transformParentToLocal(Hep3Vector point);
+
+ /**
+ * True if this volume is a sensitive component;
+ * False if this volume is not a sensitive component.
+ */
+ public boolean isSensitive();
}
\ No newline at end of file
GeomConverter/src/org/lcsim/detector
diff -u -r1.7 -r1.8
--- PhysicalVolume.java 27 Mar 2007 20:40:39 -0000 1.7
+++ PhysicalVolume.java 7 Apr 2007 21:40:12 -0000 1.8
@@ -10,7 +10,8 @@
ILogicalVolume logicalVolume;
ILogicalVolume motherLogicalVolume;
int copyNum;
-
+ boolean sensitive=false;
+
public PhysicalVolume(
ITransform3D transform,
String name,
@@ -76,4 +77,14 @@
{
return getTransform().transformed(point);
}
+
+ public void setSensitive(boolean sensitive)
+ {
+ this.sensitive = sensitive;
+ }
+
+ public boolean isSensitive()
+ {
+ return this.sensitive;
+ }
}
\ No newline at end of file
GeomConverter/src/org/lcsim/detector/converter/compact
diff -u -r1.3 -r1.4
--- SiTrackerBarrelConverter.java 7 Apr 2007 03:15:45 -0000 1.3
+++ SiTrackerBarrelConverter.java 7 Apr 2007 21:40:12 -0000 1.4
@@ -14,6 +14,7 @@
import org.lcsim.detector.IDetectorElement;
import org.lcsim.detector.ILogicalVolume;
import org.lcsim.detector.IPhysicalVolume;
+import org.lcsim.detector.IPhysicalVolumePath;
import org.lcsim.detector.LogicalVolume;
import org.lcsim.detector.PhysicalVolume;
import org.lcsim.detector.Rotation3D;
@@ -43,6 +44,8 @@
{
throw new RuntimeException( x );
}
+
+ setupSensorDetectorElements(subdet);
}
private Map<String, ILogicalVolume> buildModules(Subdetector subdet)
@@ -75,8 +78,6 @@
String subdetName = subdetElement.getAttributeValue("name");
ILogicalVolume moduleLogVol = null;
- int sensor_number = 0;
-
Element moduleElement=null;
for (Iterator i = subdetElement.getChildren("module").iterator(); i.hasNext();)
{
@@ -91,9 +92,7 @@
throw new RuntimeException("module <" + module_name + " was not found");
}
- Element moduleEnvelopeElement = moduleElement.getChild("module_envelope");
-
- //String moduleLongName = subdetName + "_" + moduleElement.getAttributeValue("name");
+ Element moduleEnvelopeElement = moduleElement.getChild("module_envelope");
// Create the module box.
double moduleLength = moduleEnvelopeElement.getAttribute("length").getDoubleValue();
@@ -188,13 +187,18 @@
Transform3D componentTransform = new Transform3D(pos,rot);
- new PhysicalVolume(
+ PhysicalVolume componentPhysVol =
+ new PhysicalVolume(
componentTransform,
componentName,
componentLogVol,
moduleLogVol,
componentNumber
);
+
+ if ( sensitive ) {
+ componentPhysVol.setSensitive(true);
+ }
++componentNumber;
}
@@ -445,7 +449,56 @@
return SiTrackerBarrel.class;
}
- // FIXME: Replace with real DE.
+ private void setupSensorDetectorElements(Subdetector subdet)
+ {
+ //System.out.println("setupDetectorElements");
+ int sensorID=0;
+ for ( IDetectorElement layer : subdet.getChildren() )
+ {
+ for ( IDetectorElement module : layer.getChildren() )
+ {
+ IPhysicalVolumePath modulePath =
+ module.getGeometry().getPhysicalVolumePath();
+
+ IPhysicalVolume modulePhysVol =
+ modulePath.getLeafVolume();
+
+ for ( IPhysicalVolume pv : modulePhysVol.getLogicalVolume().getDaughters())
+ {
+ if ( pv.isSensitive() )
+ {
+ //System.out.println(pv.getName() + " is sens");
+ //System.out.println("path : " + modulePath.toString() + "/" + pv.getName());
+ String sensorPath = modulePath.toString() + "/" + pv.getName();
+ String sensorName = subdet.getName() + "_sensor" + sensorID;
+ new SensorDE(sensorName, module, sensorPath);
+ ++sensorID;
+ }
+ }
+ }
+ }
+ }
+
+ // FIXME: Replace with a real sensor DetectorElement.
+ public class SensorDE extends DetectorElement
+ {
+ int sensorID;
+
+ SensorDE(String name,
+ IDetectorElement parent,
+ String path)
+ {
+ super(name, parent, path);
+ //System.out.println(name + " : " + path);
+ }
+
+ public void setSensorID(int sensorID)
+ {
+ this.sensorID = sensorID;
+ }
+ }
+
+ // FIXME: Replace with a real module DE.
public class DummyDE extends DetectorElement
{
DummyDE(String name,
@@ -456,4 +509,4 @@
//System.out.println(name + " : " + path);
}
}
-}
+}
\ No newline at end of file