Print

Print


Commit in GeomConverter/src/org/lcsim/geometry/segmentation on MAIN
GridXYZ.java+1-151.23 -> 1.24
NonprojectiveCylinder.java+11-261.24 -> 1.25
+12-41
2 modified files
MJC: For now, revert to older neighbour-finding code (too much of a speed hit)

GeomConverter/src/org/lcsim/geometry/segmentation
GridXYZ.java 1.23 -> 1.24
diff -u -r1.23 -r1.24
--- GridXYZ.java	17 Apr 2008 12:34:43 -0000	1.23
+++ GridXYZ.java	20 May 2008 18:19:40 -0000	1.24
@@ -155,21 +155,7 @@
 
 // 		    System.out.println("Adding neighbor: "+ilay+" "+ix+" "
 // 				       +iy+", total="+ (size+1));
-                    long candidate = encoder.setValue(yIndex, iy);
-                    // Verify that this is actually a legal value:
-                    this.setID(candidate);
-                    double candAbsZ = Math.abs(this.getZ());
-                    double candRho = Math.sqrt(this.getX()*this.getX() + this.getY()*this.getY());
-                    boolean candValid = (candAbsZ >= getZMin() && candAbsZ <= getZMax() && candRho >= getRMin() && candRho <= getRMax());
-                    if (candValid) {
-                        // OK -- neighbour is at a legal spacepoint
-                        result[size++] = candidate;
-                    } else {
-                        // Failure -- this can happen if the "neighbour" was just us wandering off the grid
-                        // Not serious -- don't add the candidate to the output, but don't panic either.
-                    }
-                    // Reset ID to previous value
-                    this.setID(id);
+                    result[size++] = encoder.setValue(yIndex, iy);
                 }
             }
         }

GeomConverter/src/org/lcsim/geometry/segmentation
NonprojectiveCylinder.java 1.24 -> 1.25
diff -u -r1.24 -r1.25
--- NonprojectiveCylinder.java	17 Apr 2008 12:40:33 -0000	1.24
+++ NonprojectiveCylinder.java	20 May 2008 18:19:40 -0000	1.25
@@ -138,7 +138,6 @@
         IDEncoder gnEncoder = new IDEncoder(descriptor);
         BaseIDDecoder gnDecoder = new BaseIDDecoder(descriptor);
         gnEncoder.setValues(values);
-        long origID = gnEncoder.getID();
         gnDecoder.setID(gnEncoder.getID());
 
         int nMax = (2*layerRange + 1)*(2*zRange + 1)*(2*phiRange + 1) - 1;
@@ -148,16 +147,7 @@
         double theta = getTheta();
         double phi = getPhi();
 
-        // Be careful with # of Z bins.
-	// The rule is that (z >= getZMin() && z <= getZMax()).
-	// Usually there are zBins = floor(getZMax() - getZMin())/getGridSize() bins.
-	// If it happens that (getZMax() - getZMin()) is an integer multiple
-	// of getGridSizeZ() then there is actually one more bin (since both
-	// getZMin() and getZMax() are legal points for a bin).
-	double zBinsDouble = (getZMax() - getZMin()) / getGridSizeZ();
-        int zBins = (int) Math.floor(zBinsDouble);
-	boolean exactMultipleOfGridSizeZ = ( zBinsDouble == Math.floor(zBinsDouble) );
-	if (exactMultipleOfGridSizeZ) { zBins++; }
+        int zBins = (int) Math.floor((getZMax() - getZMin()) / getGridSizeZ());
 
         int size = 0;
         for (int i = -layerRange; i <= layerRange; ++i)
@@ -169,23 +159,18 @@
             gnEncoder.setValue(layerIndex, ilay);
 
             double dphi = this.computeDeltaPhiForLayer(ilay);
-            int phiBins = (int) Math.round(2 * Math.PI / dphi); // Use round() not floor() since a floor() was already applied in the definition of dphi
+            int phiBins = (int) Math.floor(2 * Math.PI / dphi);
 
-	    if (i != 0) {
-                double cylR = getRadiusSensitiveMid(ilay);
-                double x = cylR * Math.cos(phi);
-                double y = cylR * Math.sin(phi);
-                double z = cylR / Math.tan(theta);
-
-                long id = this.findCellContainingXYZ(x,y,z);
-                if(id==0) continue;
-                // save indices in a new array, as values[] keeps the original ref
-                gnDecoder.setID(id);
-            } else {
-		// This is the original layer => center cell is just the original cell
-                gnDecoder.setID(origID);
-            }
+            double cylR = getRadiusSensitiveMid(ilay);
+            double x = cylR * Math.cos(phi);
+            double y = cylR * Math.sin(phi);
+            double z = cylR / Math.tan(theta);
+
+            long id = this.findCellContainingXYZ(x,y,z);
+            if(id==0) continue;
 
+            // save indices in a new array, as values[] keeps the original ref
+            gnDecoder.setID(id);
             for (int j = -zRange; j <= zRange; ++j)
             {
                 int iz = gnDecoder.getValue(zIndex) + j;
CVSspam 0.2.8