GeomConverter/src/org/lcsim/geometry/segmentation
diff -u -r1.12 -r1.13
--- GridXYZ.java 18 Jul 2005 18:00:05 -0000 1.12
+++ GridXYZ.java 20 Jul 2005 22:03:13 -0000 1.13
@@ -35,6 +35,21 @@
private double[] _localPos = { 0, 0, 0};
private double[] _globalPos = { 0, 0, 0};
+ public double getGridSizeX()
+ {
+ return gridSizeX;
+ }
+
+ public double getGridSizeY()
+ {
+ return gridSizeY;
+ }
+
+ public double getGridSizeZ()
+ {
+ return gridSizeZ;
+ }
+
/** Creates a new instance of GridXYZ */
public GridXYZ(Element node) throws DataConversionException
{
GeomConverter/src/org/lcsim/geometry/segmentation
diff -u -r1.14 -r1.15
--- ProjectiveZPlane.java 18 Jul 2005 18:00:05 -0000 1.14
+++ ProjectiveZPlane.java 20 Jul 2005 22:03:13 -0000 1.15
@@ -6,110 +6,119 @@
import org.jdom.Element;
import org.lcsim.geometry.util.IDDescriptor;
-/**
+/**
* @author tonyj
*/
public class ProjectiveZPlane extends SegmentationBase
-{
- private int thetaBins;
- private int phiBins;
-
- private int thetaIndex;
- 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();
- }
-
- public double getPhi()
- {
- double phi = (Math.PI*2) * ((getValue(phiIndex)+0.5)/phiBins);
- return phi;
- }
-
- public double getTheta()
- {
- return (Math.PI) * ((getValue(thetaIndex)+0.5)/thetaBins);
- }
-
- public double getX()
- {
- return getSphericalRadius() * Math.cos(getPhi());
- }
-
- public double getY()
- {
- return getSphericalRadius() * Math.sin(getPhi());
- }
-
- public double getZ()
- {
- /* getRadius() is misnamed here. Actually returning distance to layer center along Z. */
- return -Math.signum(getTheta()-PI/2) * getDistanceToSensitive(getLayer() );
- }
-
- private double getSphericalRadius()
- {
+{
+ private int thetaBins;
+ private int phiBins;
+
+ private int thetaIndex;
+ 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();
+ }
+
+ public int getThetaBins()
+ {
+ return thetaBins;
+ }
+ public int getPhiBins()
+ {
+ return phiBins;
+ }
+
+ public double getPhi()
+ {
+ double phi = (Math.PI*2) * ((getValue(phiIndex)+0.5)/phiBins);
+ return phi;
+ }
+
+ public double getTheta()
+ {
+ return (Math.PI) * ((getValue(thetaIndex)+0.5)/thetaBins);
+ }
+
+ public double getX()
+ {
+ return getSphericalRadius() * Math.cos(getPhi());
+ }
+
+ public double getY()
+ {
+ return getSphericalRadius() * Math.sin(getPhi());
+ }
+
+ public double getZ()
+ {
+ /* getRadius() is misnamed here. Actually returning distance to layer center along Z. */
+ return -Math.signum(getTheta()-PI/2) * getDistanceToSensitive(getLayer() );
+ }
+
+ private double getSphericalRadius()
+ {
return getZ() * tan(getTheta() );
- }
-
- public void setIDDescription(IDDescriptor id)
- {
- super.setIDDescription(id);
-
- phiIndex = id.indexOf("phi");
- thetaIndex = id.indexOf("theta");
- }
-
- public long[] getNeighbourIDs(int deltaLayer, int deltaTheta, int deltaPhi)
- {
- encoder.setValues(values);
-
- int nMax = (2*deltaLayer + 1)*(2*deltaTheta + 1)*(2*deltaPhi + 1) - 1;
- int size = 0;
- long[] result = new long[nMax];
- for (int i=-deltaLayer;i<=deltaLayer;i++)
- {
- int l = values[layerIndex] + i;
-
- if (l<0 || l>=detector.getLayering().getLayerCount()) continue;
- encoder.setValue(layerIndex,l);
-
- for (int j=-deltaTheta;j<=deltaTheta;j++)
- {
- int t = values[thetaIndex] + j;
+ }
+
+ public void setIDDescription(IDDescriptor id)
+ {
+ super.setIDDescription(id);
+
+ phiIndex = id.indexOf("phi");
+ thetaIndex = id.indexOf("theta");
+ }
+
+ public long[] getNeighbourIDs(int deltaLayer, int deltaTheta, int deltaPhi)
+ {
+ encoder.setValues(values);
+
+ int nMax = (2*deltaLayer + 1)*(2*deltaTheta + 1)*(2*deltaPhi + 1) - 1;
+ int size = 0;
+ long[] result = new long[nMax];
+ for (int i=-deltaLayer;i<=deltaLayer;i++)
+ {
+ int l = values[layerIndex] + i;
- if (t<0 || t>=thetaBins) continue;
- encoder.setValue(thetaIndex,t);
+ if (l<0 || l>=detector.getLayering().getLayerCount()) continue;
+ encoder.setValue(layerIndex,l);
- for (int k=-deltaPhi;k<=deltaPhi;k++)
+ for (int j=-deltaTheta;j<=deltaTheta;j++)
{
- if (i==0 && j==0 && k==0) continue;
-
- int p = values[phiIndex] + k;
- if (p<0 || p>=phiBins) continue;
-
- result[size++] = encoder.setValue(phiIndex,p);
+ int t = values[thetaIndex] + j;
+
+ if (t<0 || t>=thetaBins) continue;
+ encoder.setValue(thetaIndex,t);
+
+ for (int k=-deltaPhi;k<=deltaPhi;k++)
+ {
+ if (i==0 && j==0 && k==0) continue;
+
+ int p = values[phiIndex] + k;
+ if (p<0 || p>=phiBins) continue;
+
+ result[size++] = encoder.setValue(phiIndex,p);
+ }
}
- }
- }
- if (size < result.length)
- {
- long[] temp = new long[size];
- System.arraycopy(result,0,temp,0,size);
- result = temp;
- }
- return result;
- }
-
- public boolean supportsNeighbours()
- {
+ }
+ if (size < result.length)
+ {
+ long[] temp = new long[size];
+ System.arraycopy(result,0,temp,0,size);
+ result = temp;
+ }
+ return result;
+ }
+
+ public boolean supportsNeighbours()
+ {
return true;
- }
+ }
}
\ No newline at end of file