GeomConverter/src/org/lcsim/detector/converter/compact
diff -u -r1.6 -r1.7
--- HPSTrackerConverter.java 16 Feb 2012 23:23:01 -0000 1.6
+++ HPSTrackerConverter.java 19 Mar 2012 21:06:00 -0000 1.7
@@ -75,11 +75,7 @@
reflect = node.getAttribute("reflect").getBooleanValue();
}
- boolean flipSA = false;
- if (node.getAttribute("flipSA") != null)
- {
- flipSA = node.getAttribute("flipSA").getBooleanValue();
- }
+
IDetectorElement subdetDetElem = subdet.getDetectorElement();
DetectorIdentifierHelper helper = (DetectorIdentifierHelper) subdetDetElem.getIdentifierHelper();
@@ -153,10 +149,15 @@
int ny = ringElement.getAttribute("ny").getIntValue();
double yStep = ringElement.getAttribute("yStep").getDoubleValue();
- double phi0 = 0;
- if (ringElement.getAttribute("phi0") != null)
+ double top_phi0 = 0;
+ if (ringElement.getAttribute("top_phi0") != null)
+ {
+ top_phi0 = ringElement.getAttribute("top_phi0").getDoubleValue();
+ }
+ double bot_phi0 = 0;
+ if (ringElement.getAttribute("bot_phi0") != null)
{
- phi0 = ringElement.getAttribute("phi0").getDoubleValue();
+ bot_phi0 = ringElement.getAttribute("bot_phi0").getDoubleValue();
}
String module = ringElement.getAttributeValue("module");
LogicalVolume moduleVolume = modules.get(module);
@@ -164,7 +165,12 @@
{
throw new RuntimeException("Module " + module + " was not found.");
}
-
+ double theta = 0;
+ if (ringElement.getAttribute("theta") != null)
+ {
+ theta = ringElement.getAttribute("theta").getDoubleValue();
+ }
+
ModuleParameters modPars = moduleParameters.get(module);
double x, y, z;
@@ -178,20 +184,17 @@
{
String moduleBaseName = subdetName + "_layer" + layerId + "_module" + moduleNumber;
Translation3D p = new Translation3D(x, y, z + dz);
- RotationGeant rot = new RotationGeant(0, 0, Math.PI / 2 + phi0);
+ RotationGeant rot = new RotationGeant(0, theta,-(Math.PI / 2 + top_phi0));
new PhysicalVolume(new Transform3D(p, rot), moduleBaseName, moduleVolume, detector.getTrackingVolume().getLogicalVolume(), 0);
String path = "/" + detector.getTrackingVolume().getName() + "/" + moduleBaseName;
new SiTrackerModule(moduleBaseName, layerPos, path, moduleNumber);
++moduleNumber;
if (reflect)
{
- Translation3D pr = new Translation3D(x, -y, z + dz);
- double rphi0 = phi0;
- if (flipSA)
- rphi0 = -rphi0;
- //RotationGeant rotr = new RotationGeant(0, 0, rphi0);
- RotationGeant rotr = new RotationGeant(0, 0, Math.PI/2 + rphi0); // Correct???
- String path2 = "/" + detector.getTrackingVolume().getName() + "/" + moduleBaseName + "_reflected";
+ Translation3D pr = new Translation3D(x, -y, z + dz);
+ //first x, then y, then z...
+ RotationGeant rotr = new RotationGeant(0, theta, Math.PI/2 - bot_phi0); // Correct???
+ 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);
}