GeomConverter/src/org/lcsim/detector/converter/compact
diff -u -r1.4 -r1.5
--- HPSTrackerConverter.java 8 Feb 2012 22:11:54 -0000 1.4
+++ HPSTrackerConverter.java 16 Feb 2012 23:06:12 -0000 1.5
@@ -16,6 +16,7 @@
import org.lcsim.detector.DetectorIdentifierHelper;
import org.lcsim.detector.DetectorIdentifierHelper.SystemMap;
import org.lcsim.detector.IDetectorElement;
+
import org.lcsim.detector.IPhysicalVolume;
import org.lcsim.detector.IPhysicalVolumePath;
import org.lcsim.detector.IRotation3D;
@@ -188,7 +189,8 @@
double rphi0 = phi0;
if (flipSA)
rphi0 = -rphi0;
- RotationGeant rotr = new RotationGeant(0, 0, rphi0);
+ //RotationGeant rotr = new RotationGeant(0, 0, rphi0);
+ RotationGeant rotr = new RotationGeant(0, 0, Math.PI/2);
String path2 = "/" + detector.getTrackingVolume().getName() + "/" + moduleBaseName + "_reflected";
new PhysicalVolume(new Transform3D(pr, rotr), moduleBaseName + "_reflected", moduleVolume, detector.getTrackingVolume().getLogicalVolume(), k);
new SiTrackerModule(moduleBaseName + "_reflected", layerNeg, path2, moduleNumber);
@@ -214,8 +216,10 @@
{
double thickness = params.getThickness();
double x, y;
- x = params.getDimension(0);
- y = params.getDimension(1);
+ //x = params.getDimension(0);
+ //y = params.getDimension(1);
+ y = params.getDimension(0); // Y is long dimension along world's X axis.
+ x = params.getDimension(1); // X is short dimension along world Y axis.
Box box = new Box(params.getName() + "Box", x / 2, y / 2, thickness / 2);
LogicalVolume volume = new LogicalVolume(params.getName() + "Volume", box, vacuum);
@@ -227,8 +231,10 @@
private void makeModuleComponents(LogicalVolume moduleVolume, ModuleParameters moduleParameters)
{
- double moduleX = moduleParameters.getDimension(0);
- double moduleY = moduleParameters.getDimension(1);
+ //double moduleX = moduleParameters.getDimension(0);
+ //double moduleY = moduleParameters.getDimension(1);
+ double moduleY = moduleParameters.getDimension(0);
+ double moduleX = moduleParameters.getDimension(1);
Box box = (Box)moduleVolume.getSolid();
double moduleZ = box.getZHalfLength() * 2;
double posZ = -moduleZ / 2;
@@ -261,12 +267,12 @@
zrot = Math.PI;
}
String sensorName = componentName + "Sensor" + sensorNumber;
- double sensorX = component.getDimensionX();
- if (sensorX > moduleX)
- throw new RuntimeException("Sensor X dimension " + sensorX + " is too big for module.");
- double sensorY = component.getDimensionY();
- if (sensorY > moduleY)
- throw new RuntimeException("Sensor Y dimension " + sensorY + " is too big for module.");
+ double sensorX = component.getDimensionY(); // Flipped so X is actually Y.
+ //if (sensorX > moduleX)
+ // throw new RuntimeException("Sensor X dimension " + sensorX + " is too big for module.");
+ double sensorY = component.getDimensionX(); // Flipped so Y is actually X.
+ //if (sensorY > moduleY)
+ // throw new RuntimeException("Sensor Y dimension " + sensorY + " is too big for module.");
Box sensorBox = new Box(sensorName + "Box", sensorX / 2, sensorY / 2, componentThickness / 2);
LogicalVolume sensorVol = new LogicalVolume(sensorName, sensorBox, material);
Translation3D sensorPosition = new Translation3D(0, 0, 0);
@@ -338,7 +344,7 @@
SiSensor sensor = new SiSensor(sensorId, sensorName, module, sensorPath, id);
// Configure parameters of strips, etc.
- configSensor(sensor);
+ //configSensor(sensor);
// Increment sensor numbering.
++sensorId;
@@ -363,6 +369,7 @@
// TODO: Move this method to a Driver class.
private void configSensor(SiSensor sensor)
{
+ //
Box sensorSolid = (Box) sensor.getGeometry().getLogicalVolume().getSolid();
Polygon3D pside = sensorSolid.getFacesNormalTo(new BasicHep3Vector(0, 0, 1)).get(0);
@@ -381,6 +388,7 @@
// Free calculation of readout electrodes, sense electrodes determined thereon.
SiStrips readoutElectrodes = new SiStrips(ChargeCarrier.HOLE, readoutStripPitch, sensor, electrodesTransform);
SiStrips senseElectrodes = new SiStrips(ChargeCarrier.HOLE, senseStripPitch, (readoutElectrodes.getNCells()*2-1), sensor, electrodesTransform);
+ //
// Readout electrode parameters.
readoutElectrodes.setCapacitanceIntercept(readoutCapacitanceIntercept);
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
diff -u -r1.4 -r1.5
--- HPSTracker.java 18 Jan 2012 00:26:15 -0000 1.4
+++ HPSTracker.java 16 Feb 2012 23:06:12 -0000 1.5
@@ -70,18 +70,22 @@
moduleParameters.put(moduleName, new ModuleParameters(module));
modules.put(moduleName, makeModule(moduleParameters.get(moduleName), sd, lcdd));
}
-
+
+ // layer
for (Iterator i = node.getChildren("layer").iterator(); i.hasNext();)
{
+ // Modules are numbered from 0 starting in each layer.
+ int moduleNumber = 0;
Element layerElement = (Element) i.next();
int layerId = layerElement.getAttribute("id").getIntValue();
int ringCount = 0;
- int moduleNumber = 0;
+ // quadrant (???)
for (Iterator j = layerElement.getChildren("quadrant").iterator(); j.hasNext();)
{
Element ringElement = (Element) j.next();
+
double zLayer = ringElement.getAttribute("z").getDoubleValue();
double dz = ringElement.getAttribute("dz").getDoubleValue();
double xStart = ringElement.getAttribute("xStart").getDoubleValue();
@@ -91,6 +95,7 @@
int ny = ringElement.getAttribute("ny").getIntValue();
double yStep = ringElement.getAttribute("yStep").getDoubleValue();
double phi0 = 0;
+
if (ringElement.getAttribute("phi0") != null)
{
phi0 = ringElement.getAttribute("phi0").getDoubleValue();
@@ -108,9 +113,11 @@
z = zLayer;
x = xStart;
+ // nx
for (int k = 0; k < nx; k++ )
{
y = yStart;
+ // ny
for (int kk = 0; kk < ny; kk++ )
{
String moduleBaseName = subdetName + "_layer" + layerId + "_module" + moduleNumber;
@@ -120,34 +127,37 @@
p.setX(x);
p.setY(y);
p.setZ(z + dz);
+ System.out.println("module @ " + x + " " + y + " " + z);
Rotation rot = new Rotation(moduleBaseName + "_rotation");
rot.setX(0);
rot.setY(0);
- rot.setZ(phi0);
+ //rot.setZ(phi0);
+ rot.setZ(Math.PI / 2); // Y side along world's X axis.
lcdd.add(p);
lcdd.add(rot);
PhysVol pv = new PhysVol(moduleVolume, lcdd.getTrackingVolume(), p, rot);
pv.addPhysVolID("system", sysId);
-
pv.addPhysVolID("barrel", 0);
pv.addPhysVolID("layer", layerId);
pv.addPhysVolID("module", moduleNumber);
- ++moduleNumber;
+ ++moduleNumber;
if (reflect)
{
Position pr = new Position(moduleBaseName + "_reflect_position");
pr.setX(x);
pr.setY(-y);
pr.setZ(z + dz);
+ System.out.println("module @ " + x + " " + -y + " " + z + dz);
Rotation rotr = new Rotation(moduleBaseName + "_reflect_rotation");
- double rphi0 = phi0;
- if (flipSA)
- rphi0 = -rphi0;
+ //double rphi0 = phi0;
+ //if (flipSA)
+ // rphi0 = -rphi0;
rotr.setX(0);
rotr.setY(0);
- rotr.setZ(rphi0);
+ //rotr.setZ(rphi0);
+ rotr.setZ(Math.PI/2);
lcdd.add(pr);
lcdd.add(rotr);
@@ -157,11 +167,10 @@
pvr.addPhysVolID("barrel", 0);
pvr.addPhysVolID("layer", layerId);
pvr.addPhysVolID("module", moduleNumber);
-
+ ++moduleNumber;
}
dz = -dz;
- y += yStep;
- ++moduleNumber;
+ y += yStep;
}
x += xStep;
}
@@ -173,8 +182,11 @@
{
double thickness = params.getThickness();
double x, y;
- x = params.getDimension(0);
- y = params.getDimension(1);
+ //x = params.getDimension(0);
+ //y = params.getDimension(1);
+ y = params.getDimension(0); // Y is in X plane in world coordinates.
+ x = params.getDimension(1); // X is in Y plane in world coordinates.
+ System.out.println("making module with x = " + x + " and y = " + y);
Box box = new Box(params.getName() + "Box", x, y, thickness);
lcdd.add(box);
@@ -223,6 +235,7 @@
String componentName = moduleName + "_component" + componentNumber;
+ System.out.println("making " + componentName + " with x = " + moduleX + " and y = " + moduleY);
Box componentBox = new Box(componentName + "Box", moduleX, moduleY, thickness);
lcdd.add(componentBox);
@@ -247,13 +260,18 @@
String sensorName = componentName + "Sensor" + sensor;
- double sensorX = component.getDimensionX();
+ // Flipped these around!!!
+ double sensorX = component.getDimensionY();
+ double sensorY = component.getDimensionX();
+ /*
+
if (sensorX > moduleX)
throw new RuntimeException("Sensor X dimension " + sensorX + " is too big for module.");
- double sensorY = component.getDimensionY();
+
if (sensorY > moduleY)
throw new RuntimeException("Sensor Y dimension " + sensorY + " is too big for module.");
+ */
Box sensorBox = new Box(sensorName + "Box", sensorX, sensorY, thickness);
lcdd.add(sensorBox);