GeomConverter/src/org/lcsim/geometry/segmentation
diff -u -r1.9 -r1.10
--- ProjectiveZPlane.java 12 Jul 2005 18:23:30 -0000 1.9
+++ ProjectiveZPlane.java 13 Jul 2005 07:10:43 -0000 1.10
@@ -1,5 +1,7 @@
package org.lcsim.geometry.segmentation;
+import static java.lang.Math.PI;
+import static java.lang.Math.tan;
import org.jdom.DataConversionException;
import org.jdom.Element;
import org.lcsim.geometry.CalorimeterIDDecoder;
@@ -18,46 +20,70 @@
private int phiBins;
private int thetaIndex;
- private int phiIndex;
+ private int phiIndex;
+
+ private double thetaDim = 0;
+ private double phiDim = 0;
ProjectiveZPlane(Element node) throws DataConversionException
{
super(node);
thetaBins = node.getAttribute("thetaBins").getIntValue();
phiBins = node.getAttribute("phiBins").getIntValue();
+
+ //thetaDim = (PI) / thetaBins;
+ //phiDim = (PI*2) / phiBins;
}
- public CoordinateSystemType getCoordinateSystemType()
- {
- return CoordinateSystemType.GLOBAL;
- }
+ //public CoordinateSystemType getCoordinateSystemType()
+ //{
+ // return CoordinateSystemType.GLOBAL;
+ //}
public double getPhi()
{
- return Math.PI*2*(values[phiIndex]+0.5)/phiBins;
+ double phi = (Math.PI*2) * ((getValue(phiIndex)+0.5)/phiBins);
+ if ( phi < PI )
+ {
+ phi += PI;
+ }
+ return phi;
+ //double (getValue(phiIndex) + 0.5) * phiDim;
}
public double getTheta()
{
- return Math.PI*(values[thetaIndex]+0.5)/thetaBins;
+ return (Math.PI) * ((getValue(thetaIndex)+0.5)/thetaBins);
+ //double (getValue(thetaIndex) + 0.5) * thetaDim;
}
public double getX()
{
- return getRadius(getLayer())*Math.cos(getPhi());
+ //return getRadius(getLayer())*Math.cos(getPhi());
+ return getSphericalRadius() * Math.cos(getPhi());
}
public double getY()
{
- return getRadius(getLayer())*Math.sin(getPhi());
+ //return getRadius(getLayer())*Math.sin(getPhi());
+ return getSphericalRadius() * Math.sin(getPhi());
}
-
+
public double getZ()
- {
- double cosTheta = Math.cos(getTheta());
- return getRadius(getLayer())*cosTheta/Math.sqrt(1-cosTheta*cosTheta);
+ {
+ //double cosTheta = Math.cos(getTheta());
+ //return getRadius(getLayer())*cosTheta/Math.sqrt(1-cosTheta*cosTheta);
+ /* getRadius() is misnamed here. Actually returning distance to layer center along Z. */
+ double zdet = getRadius(getLayer() );
+
+ return zdet;
}
+ private double getSphericalRadius()
+ {
+ return getZ() * tan(getTheta() );
+ }
+
public void setIDDescription(IDDescriptor id)
{
super.setIDDescription(id);