GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
diff -u -r1.16 -r1.17
--- PolyhedraEndcapCalorimeter.java 26 Jan 2007 01:37:25 -0000 1.16
+++ PolyhedraEndcapCalorimeter.java 23 Feb 2007 09:47:23 -0000 1.17
@@ -34,19 +34,19 @@
{
private Element node;
- // Tolerance applied to subdetector dimensions to avoid overlapping trapezoid faces.
+ // Subtracted from stave envelope dimensions.
private final double STAVE_ENVELOPE_TOLERANCE=10.0;
- // Subtract from layer dimensions.
+ // Subtracted from layer envelope dimensions.
private final double LAYER_ENVELOPE_TOLERANCE=1.0;
- // Subtract from slice dimensions.
+ // Subtracted from slice dimensions.
private final double SLICE_ENVELOPE_TOLERANCE=1.0;
// Small gap placed in front of each layer.
private final double INTER_LAYER_GAP=1.0;
- // Reduction in size of slice.
+ // Small subtraction from given thickness of slice.
private final double SLICE_TOLERANCE=0.01;
public PolyhedraEndcapCalorimeter(Element node) throws JDOMException
@@ -81,19 +81,20 @@
int numsides = dimensions.getAttribute("numsides").getIntValue();
// Rotation of polyhedra into correct frame.
- double zrot = Math.PI / numsides;
- Rotation envelopeRotation = new Rotation(detName + "_rotation");
- envelopeRotation.setZ(zrot);
- define.addRotation(envelopeRotation);
+ //double zrot = Math.PI / numsides;
+ //Rotation envelopeRotation = new Rotation(detName + "_rotation");
+ //envelopeRotation.setZ(zrot);
+ //define.addRotation(envelopeRotation);
LayerStack layers = Layering.makeLayering(this.node).getLayerStack();
// Total thickness of the subdetector.
double subdetector_thickness = org.lcsim.geometry.layer.LayerFromCompactCnv.computeDetectorTotalThickness(node);
- // DEBUG
+ // Increase the thickness of the endcap to accomodate a gap between layers.
subdetector_thickness += layers.getNumberOfLayers() * INTER_LAYER_GAP;
+ // Compute the radial thickness from the user parameters.
double radial_thickness = rmax - rmin;
/*
@@ -116,7 +117,7 @@
double innerFaceLength = rmin * tan(halfInnerAngle) * 2;
double outerFaceLength = rmax * tan(halfInnerAngle) * 2;
- // Apply tolerance to dimensions.
+ // Apply tolerances to the computed dimensions.
radial_thickness -= STAVE_ENVELOPE_TOLERANCE;
innerFaceLength -= STAVE_ENVELOPE_TOLERANCE;
outerFaceLength -= STAVE_ENVELOPE_TOLERANCE;
@@ -211,8 +212,8 @@
sliceTrd.setX1(sliceInnerFaceLength);
sliceTrd.setX2(sliceOuterFaceLength);
- sliceTrd.setY1(slice_thickness-SLICE_TOLERANCE);
- sliceTrd.setY2(slice_thickness-SLICE_TOLERANCE);
+ sliceTrd.setY1(slice_thickness-SLICE_TOLERANCE); // Subtract tolerance from slice_thickness.
+ sliceTrd.setY2(slice_thickness-SLICE_TOLERANCE); // Subtract tolerance from slice_thickness.
sliceTrd.setZ(sliceRadialThickness);
solids.addSolid(sliceTrd);
@@ -234,8 +235,12 @@
slicePhysVol.addPhysVolID("slice", slice_number);
layer_volume.addPhysVol(slicePhysVol);
+ // The slice thickness is the original, NOT adjusted for tolerance,
+ // so that the center of the slice is in the right place with tolerance
+ // gaps on either side.
slice_position_y -= slice_thickness / 2;
+ // Increment the slice counter.
++slice_number;
}
@@ -257,7 +262,7 @@
++layer_number;
}
- // DEBUG
+ // DEBUG - Uncomment to build only one layer.
//break;
}
@@ -286,8 +291,6 @@
position.setX(posX);
position.setY(sectPosY);
position.setZ(zmin + subdetector_thickness/2);
-
- //System.out.println("rotY="+rotY);
Rotation rotation = new Rotation(detName + "_stave0_module" + moduleNumber + "_rotation");
rotation.setX(rotX);