GeomConverter/src/org/lcsim/detector/converter/compact
diff -u -r1.25 -r1.26
--- DiskTrackerConverter.java 9 Feb 2011 01:28:15 -0000 1.25
+++ DiskTrackerConverter.java 10 Feb 2011 00:27:46 -0000 1.26
@@ -2,6 +2,7 @@
import org.lcsim.detector.DetectorElement;
import org.lcsim.detector.DetectorIdentifierHelper;
+import org.lcsim.detector.IDetectorElement;
import org.lcsim.detector.ILogicalVolume;
import org.lcsim.detector.IPhysicalVolume;
import org.lcsim.detector.IRotation3D;
@@ -49,17 +50,17 @@
// Some DiskTracker subdetectors are used for support material
// so need to make sure Readout is not null before using it.
- int systemNumber = 0;
+ int systemNumber = 0;
DetectorIdentifierHelper helper = null;
if (subdet.getReadout() != null)
{
systemNumber = tracker.getSystemID();
helper = (DetectorIdentifierHelper)tracker.getDetectorElement().getIdentifierHelper();
}
-
+
// Get the Subdetector name.
String subdetName = tracker.getName();
-
+
// Create the two endcap containers.
DetectorElement endcapPos = new DetectorElement(subdetName + "_positive", tracker.getDetectorElement());
DetectorElement endcapNeg = null;
@@ -72,41 +73,41 @@
IRotation3D reflect = new RotationPassiveXYZ(0, Math.PI, 0);
// Loop over the layers.
- //int sensorNum = 0;
+ // int sensorNum = 0;
Layering layering = tracker.getLayering();
for (int i = 0; i < layering.getNumberOfLayers(); i++ )
- {
+ {
// Layer parameters.
Layer layer = layering.getLayer(i);
double layerInnerRadius = tracker.getInnerR()[i];
double layerOuterRadius = tracker.getOuterR()[i];
double layerInnerZ = tracker.getInnerZ()[i];
-
+
// Layer names.
String layerName = subdetName + "_layer" + i;
String posLayerName = layerName + "_pos";
String negLayerName = layerName + "_neg";
// Create layer solid and LogicalVolume.
- Tube layerTube =
- new Tube(layerName, layerInnerRadius, layerOuterRadius, layer.getThickness() / 2);
+ Tube layerTube = new Tube(layerName, layerInnerRadius, layerOuterRadius, layer.getThickness() / 2);
LogicalVolume layerLV =
new LogicalVolume(layerName + "_volume", layerTube, detector.getDetectorElement().getGeometry()
.getLogicalVolume().getMaterial());
-
+
// Positive and negative PhysicalVolumes.
IPhysicalVolume posLayerPV =
- new PhysicalVolume(
- new Transform3D(new Translation3D(0, 0, layerInnerZ + layer.getThickness() / 2)),
- posLayerName, layerLV, mother, i);
- IPhysicalVolume negLayerPV = null;
+ new PhysicalVolume(
+ new Transform3D(new Translation3D(0, 0, layerInnerZ + layer.getThickness() / 2)),
+ posLayerName, layerLV, mother, i);
+ IPhysicalVolume negLayerPV = null;
if (tracker.getReflect())
{
- negLayerPV = new PhysicalVolume(new Transform3D(new Translation3D(0., 0., -layerInnerZ - layer.getThickness() / 2),
- reflect), negLayerName, layerLV, mother, i);
-
+ negLayerPV =
+ new PhysicalVolume(new Transform3D(new Translation3D(0., 0., -layerInnerZ
+ - layer.getThickness() / 2), reflect), negLayerName, layerLV, mother, i);
+
}
-
+
// Create the layer paths.
String posLayerPath = "/";
String negLayerPath = "/";
@@ -114,15 +115,16 @@
{
posLayerPath += detector.getTrackingVolume().getName() + "/";
negLayerPath += detector.getTrackingVolume().getName() + "/";
- }
+ }
posLayerPath += posLayerPV.getName();
negLayerPath += negLayerPV.getName();
-
+
// Create the layer DetectorElements.
- new DetectorElement(posLayerPV.getName(), endcapPos, posLayerPath);
+ IDetectorElement posLayerDE = new DetectorElement(posLayerPV.getName(), endcapPos, posLayerPath);
+ IDetectorElement negLayerDE = null;
if (negLayerPV != null)
{
- new DetectorElement(negLayerPV.getName(), endcapPos, negLayerPath);
+ negLayerDE = new DetectorElement(negLayerPV.getName(), endcapNeg, negLayerPath);
}
// Loop over the slices.
@@ -136,48 +138,47 @@
String sliceName = layerName + "_slice" + j;
// Create the solid and LogicalVolume.
- Tube sliceTube =
- new Tube(sliceName + "_tube", layerInnerRadius, layerOuterRadius,
- sliceThickness / 2);
+ Tube sliceTube = new Tube(sliceName + "_tube", layerInnerRadius, layerOuterRadius, sliceThickness / 2);
LogicalVolume sliceLV = new LogicalVolume(sliceName + "_volume", sliceTube, sliceMaterial);
-
+
// Increment to correct slice Z for this placement.
sliceZ += sliceThickness / 2;
- // Create the positive slice PhysicalVolume. Only one placement is necessary because
+ // Create the positive slice PhysicalVolume. Only one placement is necessary because
// the negative and positive layers use the same LogicalVolume.
PhysicalVolume slicePV =
- new PhysicalVolume(new Transform3D(new Translation3D(0, 0, sliceZ)), sliceName, sliceLV, layerLV, j);
+ new PhysicalVolume(new Transform3D(new Translation3D(0, 0, sliceZ)), sliceName, sliceLV,
+ layerLV, j);
// Increment slice Z for next placement.
sliceZ += sliceThickness / 2;
// Create Identifiers if this is a sensor.
- IIdentifier posId = null;
- IIdentifier negId = null;
+ IIdentifier slicePosId = null;
+ IIdentifier sliceNegId = null;
if (slice.isSensitive())
{
slicePV.setSensitive(true);
- posId = makeIdentifier(helper, systemNumber, helper.getEndcapPositiveValue(), i, j);
- negId = makeIdentifier(helper, systemNumber, helper.getEndcapNegativeValue(), i, j);
- }
-
- // Create the DetectorElement paths for the slices.
- String posPath = posLayerPath + "/" + sliceName;
- String negPath = negLayerPath + "/" + sliceName;
-
- // Make DetectorElements.
- new DetectorElement(sliceName + "_pos", endcapPos, posPath, posId);
- if (tracker.getReflect())
- {
- new DetectorElement(sliceName + "_neg", endcapNeg, negPath, negId);
+ slicePosId = makeIdentifier(helper, systemNumber, helper.getEndcapPositiveValue(), i, j);
+ sliceNegId = makeIdentifier(helper, systemNumber, helper.getEndcapNegativeValue(), i, j);
+
+ // Create the DetectorElement paths for the slices.
+ String posPath = posLayerPath + "/" + sliceName;
+ String negPath = negLayerPath + "/" + sliceName;
+
+ // Make DetectorElements.
+ new DetectorElement(sliceName + "_pos", posLayerDE, posPath, slicePosId);
+ if (tracker.getReflect())
+ {
+ new DetectorElement(sliceName + "_neg", negLayerDE, negPath, sliceNegId);
+ }
}
// Increment sensor number if slice was sensitive.
- //if (slice.isSensitive())
- //{
- // ++sensorNum;
- //}
+ // if (slice.isSensitive())
+ // {
+ // ++sensorNum;
+ // }
}
}
}