Print

Print


Commit in lcsim/src/org/lcsim/recon/vertexing/zvtop4 on MAIN
ZvTop.java+18-271.13 -> 1.14
ZvVertex.java+18-21.1 -> 1.2
+36-29
2 modified files
Vertex is now displayed where it is actually found. Still displayed with a too large radius.

lcsim/src/org/lcsim/recon/vertexing/zvtop4
ZvTop.java 1.13 -> 1.14
diff -u -r1.13 -r1.14
--- ZvTop.java	10 Aug 2005 00:13:11 -0000	1.13
+++ ZvTop.java	10 Aug 2005 07:30:32 -0000	1.14
@@ -84,10 +84,13 @@
     private Map<ZvMaximum, Set<ZvMaximum>> isResolvedFromMap;
     private Map<ZvMaximum, Set<ZvMaximum>> unresolvedMaximaMap;
     
-    // the vertex candidate list can be implemented as a List, because
-    // the members are assigned from a __sorted__ Set. The List guarantees
-    // proper behavior upon iteration
-    private List<Set<ZvMaximum>> _vertexCandidateList;
+    // List of vertex candidates.
+    // The two-track maxima are transformed to the nearest location of a maximum in the overlap function.
+    // The highest of those maxima is taken as the location of the vertex and all tracks belonging to ZvMaxima that are unresolved from this highest maximum are added to the vertex.
+    // At this stage tracks can be assigned to more than one vertex.
+    // The fitVertices function takes care of assigning tracks uniquely to a vertex.
+    // TODO need to distinguish between pruning and fitting
+    private List<ZvVertex> _vertexCandidateList;
     
     /**
      * @author jstrube
@@ -137,7 +140,7 @@
         isResolvedFromMap = new HashMap<ZvMaximum, Set<ZvMaximum>>();
         unresolvedMaximaMap = new HashMap<ZvMaximum, Set<ZvMaximum>>();
         trackList = new ArrayList<ZvTrack>();
-        _vertexCandidateList = new ArrayList<Set<ZvMaximum>>();
+        _vertexCandidateList = new ArrayList<ZvVertex>();
         vtxFitter = f;
         return;
     }
@@ -169,7 +172,7 @@
         findGlobalMaxima();
         clusterCandidates();
         System.err.println("done findVertices\n");
-        return makeVertices();
+        return fitVertices();
     }
       
     /**
@@ -381,7 +384,6 @@
      */
     private void clusterCandidates() {
         System.err.println("entering clusterCandidates");
-        // TODO is this enough, or do I need deep copy ?
         SortedSet<ZvMaximum> isAvailable = new TreeSet<ZvMaximum>(maximumMatrix.getMaxima());
         // each cluster consists of several ZvMaxima
         // add the maximum and the set of unresolved maxima to the list of candidates
@@ -390,7 +392,8 @@
             ZvMaximum highestRemaining = isAvailable.first();
             Set<ZvMaximum> unresolvedSet = unresolvedMaximaMap.get(highestRemaining);            
             unresolvedSet.add(highestRemaining);
-            _vertexCandidateList.add(unresolvedSet);
+            ZvVertex vtx = new ZvVertex(highestRemaining.getLocation(), unresolvedSet);
+            _vertexCandidateList.add(vtx);
             isAvailable.removeAll(unresolvedSet);
         }
         System.err.println("done clusterCandidates");
@@ -405,35 +408,23 @@
      * always assigned to the vertex with the highest value of V(r), if possible
      * @return A List of Vertices
      */
-    private List<ZvVertex> makeVertices() {
+    private List<ZvVertex> fitVertices() {
         List<ZvVertex> l = new ArrayList<ZvVertex>();
         Set<ZvTrack> unavailableTracks = new HashSet<ZvTrack>();
         System.err.printf("found %d Candidates\n", _vertexCandidateList.size());
-        for (Set<ZvMaximum> iCand : _vertexCandidateList) {
-            for (ZvMaximum iMax : iCand) {
-                System.err.printf(iMax.getLocation().toString());
-            }
+        for (ZvVertex iCand : _vertexCandidateList) {
+            System.err.printf(iCand.toString());
         }
         // The Maxima are clustered according to the resolution function
         // A Cluster is a Set of ZvMaxima
         // Add all tracks from a cluster to the vertex
         // The vertex decides based on the chiSquared value
         // which of those tracks it wants to keep
-        for (Set<ZvMaximum> i : _vertexCandidateList) {
-            ZvVertex iVtx = new ZvVertex(chiSquareCut);
-            Set<ZvTrack> iVtxTracks = new HashSet<ZvTrack>();
-            for (ZvMaximum iMax : i) {
-                ZvTrack t_i = iMax.getTrack_i();
-                ZvTrack t_j = iMax.getTrack_j();
-                if (! unavailableTracks.contains(t_i)) {
-                    iVtxTracks.add(t_i);
-                }
-                if (! unavailableTracks.contains(t_j)) {
-                    iVtxTracks.add(t_j);
-                }
+        for (ZvVertex iVtx : _vertexCandidateList) {
+            iVtx.setChi2(chiSquareCut);
+            for (ZvTrack t : unavailableTracks) {
+                iVtx.removeTrack(t);
             }
-            iVtx.setVtxTracks(iVtxTracks);
-            // iVtx.setPosition()
             ZvFitStatus status = vtxFitter.doFit(iVtx);
             // TODO fit the vertex, make sure the tracks in the vertex
             // are below the chi2 cut, so that at any time only good tracks are in the

lcsim/src/org/lcsim/recon/vertexing/zvtop4
ZvVertex.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- ZvVertex.java	19 Apr 2005 22:22:56 -0000	1.1
+++ ZvVertex.java	10 Aug 2005 07:30:32 -0000	1.2
@@ -3,9 +3,9 @@
 import hep.physics.vec.BasicHep3Vector;
 import hep.physics.vec.Hep3Vector;
 
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
@@ -24,7 +24,9 @@
 /**
  * ZvTop vertex representation.
  * This class contains a list of tracks, the chi<sup>2</sup> of each of which
- * is below the cut-off maxChi2
+ * is below the cut-off maxChi2.
+ * NOTE: An unfitted vertex can share tracks with another vertex !
+ * TODO pruning <-> fitting
  * @author J. Strube
  * 
  */
@@ -59,6 +61,16 @@
         setErrorMatrix(vertexErrorMatrix);
         setVtxTracks(vertexTracks);
     }
+    
+    public ZvVertex(SpacePoint vertexPosition, Collection<ZvMaximum> unresolvedMaximaSet) {
+        super(vertexPosition);
+        Set<ZvTrack> tracks = new HashSet<ZvTrack>();
+        for (ZvMaximum max : unresolvedMaximaSet) {
+            tracks.add(max.getTrack_i());
+            tracks.add(max.getTrack_j());
+        }
+        setVtxTracks(tracks);
+    }
 
     /**
      * copy constructor
@@ -403,6 +415,10 @@
         trackChi2Map.put(track, value);
     }
     
+    void removeTrack(ZvTrack t) {
+        trackChi2Map.remove(t);
+    }
+    
     /**
      * make a deep copy
      */
CVSspam 0.2.8