5 modified files
GeomConverter/src/org/lcsim/geometry/compact/converter/pandora
diff -u -r1.2 -r1.3
--- Main.java 18 Dec 2009 22:07:44 -0000 1.2
+++ Main.java 18 Dec 2009 22:24:56 -0000 1.3
@@ -182,24 +182,21 @@
{
List<Double> cellSizes = new ArrayList<Double>();
BaseIDDecoder dec = (BaseIDDecoder)subdetector.getReadout().getIDDecoder();
- for (int i=0; i<dec.getFieldCount(); i++)
+ if (dec instanceof AbstractCartesianGrid)
{
- if (dec instanceof AbstractCartesianGrid)
+ AbstractCartesianGrid cgrid = (AbstractCartesianGrid)dec;
+ if (cgrid.getCellSizeX() != 0)
{
- AbstractCartesianGrid cgrid = (AbstractCartesianGrid)dec;
- if (cgrid.getCellSizeX() != 0)
- {
- cellSizes.add(cgrid.getCellSizeX());
- }
- if (cgrid.getCellSizeY() != 0)
- {
- cellSizes.add(cgrid.getCellSizeY());
- }
- if (cgrid.getCellSizeZ() != 0)
- {
- cellSizes.add(cgrid.getCellSizeZ());
- }
+ cellSizes.add(cgrid.getCellSizeX());
}
+ if (cgrid.getCellSizeY() != 0)
+ {
+ cellSizes.add(cgrid.getCellSizeY());
+ }
+ if (cgrid.getCellSizeZ() != 0)
+ {
+ cellSizes.add(cgrid.getCellSizeZ());
+ }
}
if (cellSizes.size() != 2)
throw new RuntimeException("Only 2 cell dimensions are allowed.");
GeomConverter/src/org/lcsim/geometry/segmentation
diff -u -r1.5 -r1.6
--- AbstractCartesianGrid.java 20 Nov 2009 18:03:43 -0000 1.5
+++ AbstractCartesianGrid.java 18 Dec 2009 22:24:56 -0000 1.6
@@ -26,12 +26,14 @@
*
* @author jeremym
*/
+// TODO: Add getCellSizeX, Y, Z methods
public abstract class AbstractCartesianGrid extends SegmentationBase
{
double[] localPosition = {0, 0, 0};
double[] globalPosition = {0, 0, 0};
boolean needsCompute = true;
List<Integer> geomFields;
+ double cellSizeX, cellSizeY, cellSizeZ;
/**
* Sub-types will set their grid values from the XML element.
@@ -314,4 +316,19 @@
}
return result;
}
+
+ public double getCellSizeX()
+ {
+ return cellSizeX;
+ }
+
+ public double getCellSizeY()
+ {
+ return cellSizeY;
+ }
+
+ public double getCellSizeZ()
+ {
+ return cellSizeZ;
+ }
}
\ No newline at end of file
GeomConverter/src/org/lcsim/geometry/segmentation
diff -u -r1.7 -r1.8
--- CartesianGridXY.java 2 Nov 2009 19:35:14 -0000 1.7
+++ CartesianGridXY.java 18 Dec 2009 22:24:56 -0000 1.8
@@ -24,9 +24,6 @@
*/
public class CartesianGridXY extends AbstractCartesianGrid
{
- private double gridSizeX = 0;
- private double gridSizeY = 0;
-
private int xIndex = -1;
private int yIndex = -1;
@@ -36,7 +33,7 @@
if (node.getAttribute("gridSizeX") != null)
{
- gridSizeX = node.getAttribute("gridSizeX").getDoubleValue();
+ cellSizeX = node.getAttribute("gridSizeX").getDoubleValue();
}
else
{
@@ -45,7 +42,7 @@
if (node.getAttribute("gridSizeY") != null)
{
- gridSizeY = node.getAttribute("gridSizeY").getDoubleValue();
+ cellSizeY = node.getAttribute("gridSizeY").getDoubleValue();
}
else
{
@@ -53,6 +50,16 @@
}
}
+ public double getCellSizeX()
+ {
+ return cellSizeX;
+ }
+
+ public double getCellSizeY()
+ {
+ return cellSizeY;
+ }
+
public long[] getNeighbourIDs(int layerRange, int xRange, int yRange)
{
return getNeighbourIDs(layerRange, xRange, yRange, xIndex, yIndex);
@@ -66,12 +73,12 @@
public int getXBin(double x)
{
- return getBin(x, gridSizeX);
+ return getBin(x, cellSizeX);
}
public int getYBin(double y)
{
- return getBin(y, gridSizeY);
+ return getBin(y, cellSizeY);
}
public boolean boundsCheck(long rawId)
@@ -87,8 +94,8 @@
return false;
}
IDetectorElement de = deSrch.get(0);
- double xPos = computeCoordinate(xVal, gridSizeX);
- double yPos = computeCoordinate(yVal, gridSizeY);
+ double xPos = computeCoordinate(xVal, cellSizeX);
+ double yPos = computeCoordinate(yVal, cellSizeY);
if (de.getGeometry().getLogicalVolume().getSolid() instanceof Box)
{
Box sensorBox = (Box)de.getGeometry().getLogicalVolume().getSolid();
@@ -133,12 +140,12 @@
private void computeLocalX()
{
- localPosition[0] = (((double) getValue(xIndex)) + 0.5) * gridSizeX;
+ localPosition[0] = (((double) getValue(xIndex)) + 0.5) * cellSizeX;
}
private void computeLocalY()
{
- localPosition[1] = (((double) getValue(yIndex)) + 0.5) * gridSizeY;
+ localPosition[1] = (((double) getValue(yIndex)) + 0.5) * cellSizeY;
}
protected void computeLocalPosition()
GeomConverter/src/org/lcsim/geometry/segmentation
diff -u -r1.4 -r1.5
--- CartesianGridXZ.java 8 Oct 2009 18:52:22 -0000 1.4
+++ CartesianGridXZ.java 18 Dec 2009 22:24:56 -0000 1.5
@@ -24,9 +24,6 @@
*/
public class CartesianGridXZ extends AbstractCartesianGrid
{
- private double gridSizeX = 0;
- private double gridSizeZ = 0;
-
private int xIndex = -1;
private int zIndex = -1;
@@ -34,22 +31,22 @@
{
super(node);
- if (node.getAttribute("gridSizeX") != null)
+ if (node.getAttribute("cellSizeX") != null)
{
- gridSizeX = node.getAttribute("gridSizeX").getDoubleValue();
+ cellSizeX = node.getAttribute("cellSizeX").getDoubleValue();
}
else
{
- throw new RuntimeException("Missing gridSizeX parameter.");
+ throw new RuntimeException("Missing cellSizeX parameter.");
}
- if (node.getAttribute("gridSizeZ") != null)
+ if (node.getAttribute("cellSizeZ") != null)
{
- gridSizeZ = node.getAttribute("gridSizeZ").getDoubleValue();
+ cellSizeZ = node.getAttribute("cellSizeZ").getDoubleValue();
}
else
{
- throw new RuntimeException("Missing gridSizeZ parameter.");
+ throw new RuntimeException("Missing cellSizeZ parameter.");
}
}
@@ -66,12 +63,12 @@
public int getXBin(double x)
{
- return getBin(x, gridSizeX);
+ return getBin(x, cellSizeX);
}
public int getZBin(double z)
{
- return getBin(z, gridSizeZ);
+ return getBin(z, cellSizeZ);
}
public boolean boundsCheck(long rawId)
@@ -87,8 +84,8 @@
return false;
}
IDetectorElement de = deSrch.get(0);
- double xPos = computeCoordinate(xVal, gridSizeX);
- double zPos = computeCoordinate(zVal, gridSizeZ);
+ double xPos = computeCoordinate(xVal, cellSizeX);
+ double zPos = computeCoordinate(zVal, cellSizeZ);
if (de.getGeometry().getLogicalVolume().getSolid() instanceof Trd)
{
Trd sensorTrd = (Trd)de.getGeometry().getLogicalVolume().getSolid();
@@ -133,12 +130,12 @@
private void computeLocalX()
{
- localPosition[0] = (((double) getValue(xIndex)) + 0.5) * gridSizeX;
+ localPosition[0] = (((double) getValue(xIndex)) + 0.5) * cellSizeX;
}
private void computeLocalZ()
{
- localPosition[2] = (((double) getValue(zIndex)) + 0.5) * gridSizeZ;
+ localPosition[2] = (((double) getValue(zIndex)) + 0.5) * cellSizeZ;
}
protected void computeLocalPosition()
GeomConverter/src/org/lcsim/geometry/segmentation
diff -u -r1.1 -r1.2
--- GlobalGridXY.java 2 Nov 2009 19:35:14 -0000 1.1
+++ GlobalGridXY.java 18 Dec 2009 22:24:56 -0000 1.2
@@ -22,9 +22,6 @@
*/
public class GlobalGridXY extends AbstractCartesianGrid
{
- private double gridSizeX = 0;
- private double gridSizeY = 0;
-
private int xIndex = -1;
private int yIndex = -1;
@@ -34,7 +31,7 @@
if (node.getAttribute("gridSizeX") != null)
{
- gridSizeX = node.getAttribute("gridSizeX").getDoubleValue();
+ cellSizeX = node.getAttribute("gridSizeX").getDoubleValue();
}
else
{
@@ -43,7 +40,7 @@
if (node.getAttribute("gridSizeY") != null)
{
- gridSizeY = node.getAttribute("gridSizeY").getDoubleValue();
+ cellSizeY = node.getAttribute("gridSizeY").getDoubleValue();
}
else
{
@@ -93,22 +90,22 @@
public int getXBin(double x)
{
- return getBin(x, gridSizeX);
+ return getBin(x, cellSizeX);
}
public int getYBin(double y)
{
- return getBin(y, gridSizeY);
+ return getBin(y, cellSizeY);
}
private void computeGlobalX()
{
- globalPosition[0] = (((double) getValue(xIndex)) + 0.5) * gridSizeX;
+ globalPosition[0] = (((double) getValue(xIndex)) + 0.5) * cellSizeX;
}
private void computeGlobalY()
{
- globalPosition[1] = (((double) getValue(yIndex)) + 0.5) * gridSizeY;
+ globalPosition[1] = (((double) getValue(yIndex)) + 0.5) * cellSizeY;
}
private void computeGlobalZ()
CVSspam 0.2.8