Print

Print


Commit in lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/itc on MAIN
algorithms/AcceptThreadedRosary_Basic.java+5-31.1 -> 1.2
          /ComputeTrajectory_Basic.java+1-71.2 -> 1.3
          /ReverseThreadingDirection_Basic.java+1-41.2 -> 1.3
          /SearchForBead_Basic.java+37-41.1 -> 1.2
          /SearchForDots_NN.java+1-81.2 -> 1.3
          /Step_Basic.java+3-91.2 -> 1.3
drivers/MipStubFinder.java+3-31.2 -> 1.3
+51-38
7 modified files
Move all heprep converters to a separate package
Add new types of cuts to IDefinition
Miscellaneous enhancements to ITC algorithm

lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/itc/algorithms
AcceptThreadedRosary_Basic.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- AcceptThreadedRosary_Basic.java	29 Mar 2009 23:44:23 -0000	1.1
+++ AcceptThreadedRosary_Basic.java	10 Jun 2009 17:53:50 -0000	1.2
@@ -10,7 +10,7 @@
  * See methods javadoc for details on algorithms and implementations.
  *
  * @author D. Onoprienko
- * @version $Id: AcceptThreadedRosary_Basic.java,v 1.1 2009/03/29 23:44:23 onoprien Exp $
+ * @version $Id: AcceptThreadedRosary_Basic.java,v 1.2 2009/06/10 17:53:50 onoprien Exp $
  */
 public class AcceptThreadedRosary_Basic implements RosaryClusterer.AcceptThreadedRosary {
 
@@ -19,12 +19,14 @@
   /**
    * Applies cuts to freshly threaded Rosaries, returning <tt>true</tt> is the Rosary should be kept.
    * <p>
-   * Algorithm: keep Rosaries with more than one Dot.
+   * Algorithm: Requires at least one Dot or Bead for a tracked Rosary, at least 3 Dots
+   * for an untracked Rosary.
    *
    * @param rosary   Rosary being threaded.
    */
   public boolean acceptThreadedRosary(Rosary rosary) {
-    return rosary.getNodeCount(DOT) > 1;
+    return (rosary.isTracked() && rosary.getNodeCount(DOT, BEAD) > 0)  ||
+           (rosary.getNodeCount(DOT) > 2);
   }
 
 }

lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/itc/algorithms
ComputeTrajectory_Basic.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- ComputeTrajectory_Basic.java	6 Apr 2009 19:49:26 -0000	1.2
+++ ComputeTrajectory_Basic.java	10 Jun 2009 17:53:50 -0000	1.3
@@ -8,22 +8,16 @@
 import org.lcsim.contrib.onoprien.util.swim.Line;
 import org.lcsim.contrib.onoprien.util.swim.Trajectory;
 
-import org.lcsim.contrib.onoprien.crux.geom.CalLayer;
-import org.lcsim.contrib.onoprien.crux.itc.Bead;
-import org.lcsim.contrib.onoprien.crux.itc.Crack;
 import org.lcsim.contrib.onoprien.crux.itc.Dot;
-import org.lcsim.contrib.onoprien.crux.itc.LayerData;
 import org.lcsim.contrib.onoprien.crux.itc.Node;
 import org.lcsim.contrib.onoprien.crux.itc.Rosary;
 import org.lcsim.contrib.onoprien.crux.itc.RosaryClusterer;
 
-import static org.lcsim.contrib.onoprien.crux.itc.Node.Type.*;
-
 /**
  *
  *
  * @author D. Onoprienko
- * @version $Id: ComputeTrajectory_Basic.java,v 1.2 2009/04/06 19:49:26 onoprien Exp $
+ * @version $Id: ComputeTrajectory_Basic.java,v 1.3 2009/06/10 17:53:50 onoprien Exp $
  */
 public class ComputeTrajectory_Basic implements RosaryClusterer.ComputeTrajectory {
 

lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/itc/algorithms
ReverseThreadingDirection_Basic.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- ReverseThreadingDirection_Basic.java	6 Apr 2009 19:49:26 -0000	1.2
+++ ReverseThreadingDirection_Basic.java	10 Jun 2009 17:53:50 -0000	1.3
@@ -9,7 +9,7 @@
  * See methods javadoc for details on algorithms and implementations.
  *
  * @author D. Onoprienko
- * @version $Id: ReverseThreadingDirection_Basic.java,v 1.2 2009/04/06 19:49:26 onoprien Exp $
+ * @version $Id: ReverseThreadingDirection_Basic.java,v 1.3 2009/06/10 17:53:50 onoprien Exp $
  */
 public class ReverseThreadingDirection_Basic implements RosaryClusterer.ReverseThreadingDirection {
 
@@ -30,8 +30,6 @@
    */
   public boolean reverseThreadingDirection(Rosary rosary) {
 
-    //System.out.println("Called reverseThreadingDirection for Rosary "+ rosary);
-
     Rosary.ThreadDirection thDir = rosary.getThreadingDirection();
     if (thDir == Rosary.ThreadDirection.FORWARD) {
       if (rosary.isTracked()) {
@@ -39,7 +37,6 @@
       } else {
         rosary.setThreadingDirection(Rosary.ThreadDirection.BACK);
         rosary.reverseDirection();
-        System.out.println("reverseThreadingDirection returns true");
         return true;
       }
     } else if (thDir == Rosary.ThreadDirection.BACK) {

lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/itc/algorithms
SearchForBead_Basic.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- SearchForBead_Basic.java	29 Mar 2009 23:44:23 -0000	1.1
+++ SearchForBead_Basic.java	10 Jun 2009 17:53:50 -0000	1.2
@@ -1,7 +1,10 @@
 package org.lcsim.contrib.onoprien.crux.itc.algorithms;
 
-import hep.physics.vec.Hep3Vector;
+import java.util.*;
 
+import hep.physics.vec.Hep3Vector;
+import hep.physics.vec.VecOp;
+import org.lcsim.event.CalorimeterHit;
 import org.lcsim.contrib.onoprien.util.swim.Trajectory;
 
 import org.lcsim.contrib.onoprien.crux.itc.Bead;
@@ -15,7 +18,7 @@
  * See methods javadoc for details on algorithms and implementations.
  *
  * @author D. Onoprienko
- * @version $Id: SearchForBead_Basic.java,v 1.1 2009/03/29 23:44:23 onoprien Exp $
+ * @version $Id: SearchForBead_Basic.java,v 1.2 2009/06/10 17:53:50 onoprien Exp $
  */
 public class SearchForBead_Basic implements RosaryClusterer.SearchForBead {
 
@@ -24,7 +27,10 @@
   /**
    * Returns Bead that should be attached to the given rosary in the given layer (<tt>null</tt> if none).
    * <p>
-   * Algorithm: attach Bead if it contains the cell where trajectory crosses the layer.
+   * Algorithm: Return the Bead that contains the cell where trajectory crosses the layer.
+   * If there is no such Bead, return the Bead that contains one of that cell's neighbors
+   * but does not contain any non-neighbors. If there is more than one such bead, return
+   * the one closest to the point where the trajectory crosses the layer.
    *
    * @param rosary       Rosary being threaded.
    * @param trajectory   Rosary's trajectory, with its origin in the current layer (the layer where Bead is being searched for).
@@ -33,7 +39,34 @@
   public Bead searchForBead(Rosary rosary, Trajectory trajectory, LayerData layerData) {
     if (layerData.beads.isEmpty()) return null;
     Hep3Vector pos = trajectory.getPosition();
-    return layerData.beadMap.get(layerData.decoder.findCellContainingXYZ(pos));
+    long centerCell = layerData.decoder.findCellContainingXYZ(pos);
+    Bead bead = layerData.beadMap.get(centerCell);
+    if (bead == null) {
+      layerData.decoder.setID(centerCell);
+      long[] neighbors = layerData.decoder.getNeighbourIDs(0, 1, 1);
+      for (long id : neighbors) {
+        Bead b = layerData.beadMap.get(id);
+        if (b != null) {
+          List<CalorimeterHit> hits = b.getHits();
+          boolean hasNonNeighbors = false;
+          for (CalorimeterHit hit : hits) {
+            if (! Arrays.asList(neighbors).contains(hit.getCellID())) {
+              hasNonNeighbors = true;
+              break;
+            }
+          }
+          if (hasNonNeighbors) continue;
+          if (bead == null) {
+            bead = b;
+          } else if (bead != b) {
+            if (VecOp.sub(pos, b.getPosition()).magnitudeSquared() < VecOp.sub(pos, bead.getPosition()).magnitudeSquared()) {
+              bead = b;
+            }
+          }
+        }
+       }
+    }
+    return bead;
   }
 
 }

lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/itc/algorithms
SearchForDots_NN.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- SearchForDots_NN.java	6 Apr 2009 19:49:26 -0000	1.2
+++ SearchForDots_NN.java	10 Jun 2009 17:53:50 -0000	1.3
@@ -17,7 +17,7 @@
  * See methods javadoc for details on algorithms and implementations.
  *
  * @author D. Onoprienko
- * @version $Id: SearchForDots_NN.java,v 1.2 2009/04/06 19:49:26 onoprien Exp $
+ * @version $Id: SearchForDots_NN.java,v 1.3 2009/06/10 17:53:50 onoprien Exp $
  */
 public class SearchForDots_NN implements RosaryClusterer.SearchForDots {
 
@@ -50,21 +50,14 @@
   public List<Dot> searchForDots(Rosary rosary, Trajectory trajectory, LayerData layerData) {
     Hep3Vector pos = trajectory.getPosition();
     long cell = layerData.decoder.findCellContainingXYZ(pos);
-    System.out.println("projection "+ cell +" phi "+ Math.atan2(pos.y(), pos.x()) +" theta "+ Math.atan2(Math.hypot(pos.y(), pos.x()), pos.z()));
     Dot dot = layerData.dotMap.get(cell);
     ArrayList<Dot> out;
     if (dot != null) {
       out = new ArrayList<Dot>(1);
       out.add(dot);
     } else {
-      System.out.println("Dots ");
-      for (Dot d : layerData.dots) System.out.print(" "+ d.getHits().get(0).getCellID());
-      System.out.println("");
       layerData.decoder.setID(cell);
       long[] neighbors = layerData.decoder.getNeighbourIDs(0, 1, 1);
-      System.out.println("Neighbors ");
-      for (long c : neighbors) System.out.print(" "+ c);
-      System.out.println("");
       HashSet<Dot> dotSet = new HashSet<Dot>();
       for (long cellID : neighbors) {
         dot = layerData.dotMap.get(cellID);

lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/itc/algorithms
Step_Basic.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- Step_Basic.java	6 Apr 2009 19:49:26 -0000	1.2
+++ Step_Basic.java	10 Jun 2009 17:53:50 -0000	1.3
@@ -21,7 +21,7 @@
  * See methods javadoc for details on algorithms and implementations.
  *
  * @author D. Onoprienko
- * @version $Id: Step_Basic.java,v 1.2 2009/04/06 19:49:26 onoprien Exp $
+ * @version $Id: Step_Basic.java,v 1.3 2009/06/10 17:53:50 onoprien Exp $
  */
 public class Step_Basic implements RosaryClusterer.Step {
 
@@ -68,8 +68,6 @@
    */
   public boolean step(Rosary rosary, Queue<Rosary> seeds) {
 
-    System.out.println("Step: last node "+ rosary.getHeadNode());
-
     Trajectory trajectory = _clusterer.getComputeTrajectory().computeTrajectory(rosary);
     CalLayer currentLayer = rosary.getHeadNode().getLayer();
     CalLayer layer;
@@ -78,15 +76,14 @@
     } else {
       layer = _geom.propagateToNextLayer(currentLayer, trajectory);
     }
-    _clusterer.display.get(rosary).add(trajectory.getPosition());
+    //_clusterer.display.get(rosary).add(trajectory.getPosition());
     if (layer == null) {
       return _clusterer.getReverseThreadingDirection().reverseThreadingDirection(rosary);
     }
 
-    _clusterer.slicer.fillTrajectory(trajectory.getPosition(), layer, true);
+    //_clusterer.slicer.fillTrajectory(trajectory.getPosition(), layer, true);
 
     List<Dot> dots = _clusterer.getSearchForDots().searchForDots(rosary, trajectory, _clusterer.getLayerDB().get(layer));
-    System.out.println("Found "+ dots.size() +" Dots");
     int nDots = dots.size();
     if (nDots > 0) {
       rosary.addNode(dots.get(0));
@@ -98,7 +95,6 @@
     } else {
       Bead bead = _clusterer.getSearchForBead().searchForBead(rosary, trajectory, _clusterer.getLayerDB().get(layer));
       if (bead != null) {
-        System.out.println("Found a Bead");
         rosary.addNode(bead);
       } else {
         if (rosary.getNodeCount(DOT) == 1 && !rosary.isTracked()) {
@@ -112,11 +108,9 @@
               seeds.add(branch);
             }
           } else {
-            System.out.println("Adding Crack");
             rosary.addNode(new Crack(layer));
           }
         } else {
-          System.out.println("Adding Crack");
           rosary.addNode(new Crack(layer));
         }
       }

lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/itc/drivers
MipStubFinder.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- MipStubFinder.java	6 Apr 2009 19:49:26 -0000	1.2
+++ MipStubFinder.java	10 Jun 2009 17:53:50 -0000	1.3
@@ -11,7 +11,7 @@
  *
  *
  * @author D. Onoprienko
- * @version $Id: MipStubFinder.java,v 1.2 2009/04/06 19:49:26 onoprien Exp $
+ * @version $Id: MipStubFinder.java,v 1.3 2009/06/10 17:53:50 onoprien Exp $
  */
 public class MipStubFinder extends RosaryClusterer {
 
@@ -23,7 +23,7 @@
 
   public MipStubFinder() {
 
-    set("LOG_LEVEL", Level.FINEST);
+    //set("LOG_LEVEL", Level.FINEST);
 
     FindDotsAndBeads_Basic findDotsAndBeads = new FindDotsAndBeads_Basic(this);
     findDotsAndBeads.set("CLUSTERER", new NearestNeighborClusterer(1, 1, 0, 0, 0.));
@@ -31,7 +31,7 @@
     setFindDotsAndBeads(findDotsAndBeads);
 
     ChooseSeedLayers_FirstN chooseSeedLayers = new ChooseSeedLayers_FirstN(this);
-    chooseSeedLayers.set("N", 2);
+    chooseSeedLayers.set("N", 3);
     setChooseSeedLayers(chooseSeedLayers);
 
     setSeedFromTrack(new SeedFromTrack_Basic());
CVSspam 0.2.8