GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
diff -u -r1.5 -r1.6
--- ForwardDetector.java 15 Jul 2005 00:09:16 -0000 1.5
+++ ForwardDetector.java 15 Jul 2005 00:47:06 -0000 1.6
@@ -36,7 +36,7 @@
super(node);
}
- /** FIXME: This method is horrible spaghetti code. Please fix it! --JM */
+ /** FIXME: This method is horrible spaghetti code. --JM */
public void addToLCDD(LCDD lcdd, SensitiveDetector sens) throws JDOMException
{
String detectorName = node.getAttributeValue("name");
@@ -45,7 +45,8 @@
Material air = lcdd.getMaterial("Air");
Solids solids = lcdd.getSolids();
Structure structure = lcdd.getStructure();
- Volume worldVolume = structure.getWorldVolume();
+ Volume motherVolume = lcdd.pickMotherVolume(this);
+
Define defines = lcdd.getDefine();
Rotation reflection = lcdd.getDefine().getRotation("reflect_rot");
@@ -184,9 +185,9 @@
Position layerSubtraction1Pos = new Position(layerBasename + "_subtraction1_pos");
double layerGlobalZ = zinner + layerDisplZ;
- System.out.println("layerGlobalZ: " + layerGlobalZ);
+// System.out.println("layerGlobalZ: " + layerGlobalZ);
double layerPosX = Math.tan(xangleHalf) * layerGlobalZ;
- System.out.println("layerPosX: " + layerPosX);
+// System.out.println("layerPosX: " + layerPosX);
layerSubtraction1Pos.setX(layerPosX);
defines.addPosition(layerSubtraction1Pos);
@@ -230,10 +231,9 @@
/** Go to mid of this slice. */
sliceDisplZ += sliceThickness / 2;
- slicePosZ += sliceThickness / 2;
-
- System.out.println("sliceDisplZ: " + sliceDisplZ );
- System.out.println("slicePosZ: " + slicePosZ );
+ slicePosZ += sliceThickness / 2;
+// System.out.println("sliceDisplZ: " + sliceDisplZ );
+// System.out.println("slicePosZ: " + slicePosZ );
/** Slice's basic tube. */
Tube sliceTube = new Tube(sliceBasename + "_tube");
@@ -252,11 +252,11 @@
Position sliceSubtraction1Pos = new Position(sliceBasename + "_subtraction1_pos");
double sliceGlobalZ = zinner + (layerDisplZ - layerThickness / 2) + sliceDisplZ;
- System.out.println("sliceGlobalZ: " + sliceGlobalZ);
+// System.out.println("sliceGlobalZ: " + sliceGlobalZ);
double slicePosX = Math.tan(xangleHalf) * sliceGlobalZ;
- System.out.println("slicePosX: " + slicePosX);
+// System.out.println("slicePosX: " + slicePosX);
sliceSubtraction1Pos.setX(slicePosX);
defines.addPosition(sliceSubtraction1Pos);
@@ -322,7 +322,7 @@
envelopePV.setZ(zpos);
envelopePV.addPhysVolID("system", id);
envelopePV.addPhysVolID("barrel", 1);
- worldVolume.addPhysVol(envelopePV);
+ motherVolume.addPhysVol(envelopePV);
/** Reflect it. */
if ( reflect )
@@ -332,7 +332,7 @@
envelopePV2.setRotation(reflection);
envelopePV2.addPhysVolID("system", id);
envelopePV2.addPhysVolID("barrel", 2);
- worldVolume.addPhysVol(envelopePV2);
+ motherVolume.addPhysVol(envelopePV2);
}
}