GeomConverter/src/org/lcsim/geometry/segmentation
diff -u -r1.7 -r1.8
--- GridXYZ.java 27 Jun 2005 22:14:19 -0000 1.7
+++ GridXYZ.java 12 Jul 2005 18:24:12 -0000 1.8
@@ -6,14 +6,17 @@
package org.lcsim.geometry.segmentation;
+import static java.lang.Math.PI;
+import static java.lang.Math.atan;
+import static java.lang.Math.atan2;
import org.jdom.DataConversionException;
import org.jdom.Element;
-import org.lcsim.geometry.CalorimeterIDDecoder;
+
/**
* @author jeremym
*/
-public class GridXYZ extends SegmentationImpl
+public class GridXYZ extends SegmentationBase
{
private double gridSizeX;
private double gridSizeY;
@@ -83,26 +86,40 @@
public double getPhi()
{
- return 0;
+ double phi = atan2(getX(), getY() );
+
+ if ( phi < 0 )
+ {
+ phi += 2 * PI;
+ }
+
+ return phi;
}
public double getTheta()
{
- return 0;
- }
+ double theta = atan(computeCylindricalRadiusFromPosition() / getZ() );
+
+ if ( theta < 0 )
+ {
+ theta += PI;
+ }
+
+ return theta;
+ }
public double getX()
{
- return 0;
+ return ((double)getValue(xIndex) + 0.5) * gridSizeX;
}
public double getY()
{
- return 0;
+ return ((double)getValue(yIndex) + 0.5) * gridSizeY;
}
public double getZ()
{
- return 0;
+ return ((double)getValue(zIndex) + 0.5) * gridSizeZ;
}
}