GeomConverter/src/org/lcsim/detector/converter/compact
diff -u -r1.1 -r1.2
--- HPSMuonCalorimeterConverter.java 24 Jan 2013 22:25:38 -0000 1.1
+++ HPSMuonCalorimeterConverter.java 25 Jan 2013 00:13:44 -0000 1.2
@@ -26,7 +26,7 @@
/**
* @author jeremym
- * @version $Id: HPSMuonCalorimeterConverter.java,v 1.1 2013/01/24 22:25:38 jeremy Exp $
+ * @version $Id: HPSMuonCalorimeterConverter.java,v 1.2 2013/01/25 00:13:44 jeremy Exp $
*/
public class HPSMuonCalorimeterConverter extends AbstractSubdetectorConverter
{
@@ -95,7 +95,7 @@
String shapeBaseName = name + "_layer" + layerId + "_sublayer" + slice;
- Box box = new Box(shapeBaseName + "_box", x, y, z);
+ Box box = new Box(shapeBaseName + "_box", x/2, y/2, z/2);
ITranslation3D pos = new Translation3D(px, py, pz);
IRotation3D rot = new RotationGeant(rx, ry, rz);
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
diff -u -r1.4 -r1.5
--- HPSMuonCalorimeter.java 24 Jan 2013 22:25:38 -0000 1.4
+++ HPSMuonCalorimeter.java 25 Jan 2013 00:13:44 -0000 1.5
@@ -13,89 +13,92 @@
/**
* @author jeremym
- * @version $Id: HPSMuonCalorimeter.java,v 1.4 2013/01/24 22:25:38 jeremy Exp $
+ * @version $Id: HPSMuonCalorimeter.java,v 1.5 2013/01/25 00:13:44 jeremy Exp $
*/
-public class HPSMuonCalorimeter extends LCDDSubdetector {
+public class HPSMuonCalorimeter extends LCDDSubdetector
+{
- HPSMuonCalorimeter(Element node) throws JDOMException {
+ HPSMuonCalorimeter(Element node) throws JDOMException
+ {
super(node);
}
- void addToLCDD(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
-
+ void addToLCDD(LCDD lcdd, SensitiveDetector sens) throws JDOMException
+ {
+
String name = node.getAttributeValue("name");
int id = node.getAttribute("id").getIntValue();
Volume mother = lcdd.pickMotherVolume(this);
-
- for (Object layerObject : node.getChildren("layer")) {
-
- Element layer = (Element)layerObject;
+
+ for (Object layerObject : node.getChildren("layer")) {
+
+ Element layer = (Element) layerObject;
int layerId = layer.getAttribute("id").getIntValue();
-
+
int slice = 1;
for (Object boxObject : layer.getChildren("box")) {
-
- Element element = (Element)boxObject;
-
+
+ Element element = (Element) boxObject;
+
double x, y, z, px, py, pz, rx, ry, rz;
x = y = z = px = py = pz = rx = ry = rz = 0.;
-
+
if (element.getAttribute("x") != null) {
x = element.getAttribute("x").getDoubleValue();
} else {
throw new RuntimeException("x is required.");
- }
+ }
if (element.getAttribute("y") != null) {
y = element.getAttribute("y").getDoubleValue();
} else {
throw new RuntimeException("y is required.");
- }
+ }
if (element.getAttribute("z") != null) {
z = element.getAttribute("z").getDoubleValue();
} else {
throw new RuntimeException("z is required.");
}
-
+
if (element.getAttribute("px") != null)
px = element.getAttribute("px").getDoubleValue();
if (element.getAttribute("py") != null)
py = element.getAttribute("py").getDoubleValue();
if (element.getAttribute("pz") != null)
pz = element.getAttribute("pz").getDoubleValue();
-
+
if (element.getAttribute("rx") != null)
rx = element.getAttribute("rx").getDoubleValue();
if (element.getAttribute("ry") != null)
ry = element.getAttribute("ry").getDoubleValue();
if (element.getAttribute("rz") != null)
rz = element.getAttribute("rz").getDoubleValue();
-
+
String materialString = element.getAttributeValue("material");
Material material = lcdd.getMaterial(materialString);
-
- String shapeBaseName = name + "_layer" + layerId + "_sublayer" + slice;
-
+
+ String shapeBaseName = name + "_layer" + layerId + "_sublayer" + slice;
+
Box box = new Box(shapeBaseName + "_box", x, y, z);
lcdd.add(box);
-
+
Position pos = new Position(shapeBaseName + "_pos", px, py, pz);
lcdd.add(pos);
-
+
Rotation rot = new Rotation(shapeBaseName + "_rot", rx, ry, rz);
lcdd.add(rot);
-
+
Volume vol = new Volume(shapeBaseName + "_vol", box, material);
-
+
boolean sensitive = false;
if (element.getAttribute("sensitive") != null)
- sensitive = element.getAttribute("sensitive").getBooleanValue();
-
+ sensitive = element.getAttribute("sensitive").getBooleanValue();
+
if (sensitive) {
vol.setSensitiveDetector(sens);
}
-
+
lcdd.add(vol);
-
+
PhysVol physVol = new PhysVol(vol, mother, pos, rot);
physVol.addPhysVolID("layer", layerId);
physVol.addPhysVolID("slice", slice);
@@ -105,14 +108,15 @@
physVol.addPhysVolID("side", -1);
}
physVol.addPhysVolID("system", id);
-
+
++slice;
- }
+ }
}
-
+
}
-
- public boolean isCalorimeter() {
+
+ public boolean isCalorimeter()
+ {
return true;
}
}
\ No newline at end of file