GeomConverter/src/org/lcsim/geometry/segmentation
diff -u -r1.12 -r1.13
--- ProjectiveCylinder.java 27 Jun 2005 22:14:19 -0000 1.12
+++ ProjectiveCylinder.java 28 Jun 2005 23:15:03 -0000 1.13
@@ -11,57 +11,57 @@
* @author tonyj
*/
public class ProjectiveCylinder extends SegmentationImpl
-{
+{
private int thetaBins;
- private int phiBins;
+ private int phiBins;
private int thetaIndex;
- private int phiIndex;
-
+ private int phiIndex;
+
ProjectiveCylinder(Element node) throws DataConversionException
{
super(node);
thetaBins = node.getAttribute("thetaBins").getIntValue();
- phiBins = node.getAttribute("phiBins").getIntValue();
- }
-
+ phiBins = node.getAttribute("phiBins").getIntValue();
+ }
+
public CoordinateSystemType getCoordinateSystemType()
{
return CoordinateSystemType.GLOBAL;
}
-
+
public double getPhi()
{
return Math.PI*2*(getValue(phiIndex)+0.5)/phiBins;
}
-
+
public double getTheta()
{
return Math.PI*(getValue(thetaIndex)+0.5)/thetaBins;
}
-
+
public double getX()
{
return getRadius(getLayer())*Math.cos(getPhi());
}
-
+
public double getY()
{
return getRadius(getLayer())*Math.sin(getPhi());
}
-
+
public double getZ()
{
double cosTheta = Math.cos(getTheta());
return getRadius(getLayer())*cosTheta/Math.sqrt(1-cosTheta*cosTheta);
- }
-
+ }
+
public void setIDDescription(IDDescriptor id)
{
- super.setIDDescription(id);
-
+ super.setIDDescription(id);
+
phiIndex = id.indexOf("phi");
- thetaIndex = id.indexOf("theta");
+ thetaIndex = id.indexOf("theta");
}
public void setSubdetector(LayeredSubdetector det)
@@ -73,33 +73,28 @@
{
return true;
}
-
- public long[] getNeighbourIDs()
- {
- return getNeighbourIDs(1,1,1);
- }
-
+
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.getLayerCount()) continue;
encoder.setValue(layerIndex,l);
-
+
for (int j=-deltaTheta;j<=deltaTheta;j++)
{
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;
@@ -119,7 +114,7 @@
}
return result;
}
-
+
public int getThetaBins() {
return thetaBins;
}