Print

Print


Commit in lcsim/src/org/lcsim/contrib/seedtracker on MAIN
HitManager.java+168added 1.1
SeedCandidate.java+97added 1.1
DefaultStrategy.java+11-91.1 -> 1.2
SeedLayer.java+53-811.1 -> 1.2
SeedStrategy.java+155-851.1 -> 1.2
SeedTracker.java+264-2421.2 -> 1.3
+748-417
2 added + 4 modified, total 6 files
Fairly major code restructuring - further code development in progress, so this is
 a snapshot that at least builds

lcsim/src/org/lcsim/contrib/seedtracker
HitManager.java added at 1.1
diff -N HitManager.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ HitManager.java	10 Aug 2007 15:50:26 -0000	1.1
@@ -0,0 +1,168 @@
+/*
+ * HitManager.java
+ *
+ * Created on August 4, 2007, 4:03 PM
+ *
+ * To change this template, choose Tools | Template Manager
+ * and open the template in the editor.
+ */
+
+package org.lcsim.contrib.seedtracker;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.lcsim.event.base.BaseTrackerHitMC;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.SimTrackerHit;
+import org.lcsim.event.TrackerHit;
+import org.lcsim.geometry.subdetector.BarrelEndcapFlag;
+
+/**
+ * Organize tracker hits into lists of hits sorted by detector name, layer number, and barrel-endcap flag
+ * @author Richard Partridge
+ * @version 1.0
+ */
+public class HitManager {
+    HashMap<String, List<TrackerHit>> _hitlist;
+    HashMap<String, Double> _rmin;
+    HashMap<String, Double> _rmax;
+    HashMap<String, Double> _zmin;
+    HashMap<String, Double> _zmax;
+    
+    /** Creates a new instance of HitManager */
+    public HitManager() {
+    }
+    
+    /**
+     * Sort the hits into distinct lists where each list has a unique detector name, layer number, and barrel endcap flag.
+     * Also calculate the minimum and maximum hit radius and z coordinate for each list.
+     * @param event EventHeader for the event to be organized
+     */
+    public void OrganizeHits(EventHeader event) {
+        _hitlist = new HashMap<String, List<TrackerHit>>();
+        _rmin = new HashMap<String, Double>();
+        _rmax = new HashMap<String, Double>();
+        _zmin = new HashMap<String, Double>();
+        _zmax = new HashMap<String, Double>();
+        List<List<TrackerHit>> hitcollections = event.get(TrackerHit.class);
+        for (List<TrackerHit> hitcol : hitcollections) {
+            for (TrackerHit hit : hitcol) {
+                String identifier = LyrIdentifier(hit);
+                if (!_hitlist.containsKey(identifier)) {
+                    _hitlist.put(identifier, new ArrayList<TrackerHit>());
+                }
+                _hitlist.get(identifier).add(hit);
+                double r = Math.sqrt(Math.pow(hit.getPosition()[0],2)+Math.pow(hit.getPosition()[1],2));
+                double z = hit.getPosition()[2];
+                if (r < _rmin.get(identifier)) _rmin.put(identifier,r);
+                if (r > _rmax.get(identifier)) _rmax.put(identifier,r);
+                if (z < _zmin.get(identifier)) _zmin.put(identifier,z);
+                if (z > _zmax.get(identifier)) _zmax.put(identifier,z);
+            }
+        }
+    }
+    
+    /**
+     * Return a list of TrackerHits for a particular detector name, layer number, and barrel-endcap flag
+     * @param detname Name of the detector as referenced by the getName method of the subDetector class
+     * @param layer Layer number
+     * @param beflag Barrel-endcap flag
+     * @return List of matching TrackerHits
+     */
+    public List<TrackerHit> getTrackerHits(String detname, int layer, BarrelEndcapFlag beflag) {
+        return new ArrayList<TrackerHit>(_hitlist.get(Identifier(detname, layer, beflag)));
+    }
+    
+    /**
+     * Return the list of tracker hits associated with a specified SeedLayer and list of BarrelEndcapFlags
+     * @param seedlayer Seedlayer to look at
+     * @param beflaglist List of BarrelEndcapFlags to include
+     * @return List of TrackerHits
+     */
+    public List<TrackerHit> getTrackerHits(SeedLayer seedlayer, List<BarrelEndcapFlag> beflaglist) {
+        List<TrackerHit> hits = new ArrayList<TrackerHit>();
+        for (BarrelEndcapFlag beflag : beflaglist) {
+            String identifier = Identifier(seedlayer.getDetName(),seedlayer.getLayer(),beflag);
+            if (_hitlist.containsKey(identifier)) hits.addAll(_hitlist.get(identifier));
+        }
+        return hits;
+    }
+    
+    private String LyrIdentifier(TrackerHit hit) {
+        if (hit instanceof BaseTrackerHitMC) {
+            BaseTrackerHitMC newhit = (BaseTrackerHitMC) hit;
+            SimTrackerHit simhit = newhit.getSimHits().get(0);
+            String detname = simhit.getSubdetector().getName();
+            int layer = simhit.getLayer();
+            BarrelEndcapFlag beflag = simhit.getIDDecoder().getBarrelEndcapFlag();
+            return Identifier(detname, layer, beflag);
+        } else return new String("Unknown");
+    }
+    
+    private String Identifier(String detname, int layer, BarrelEndcapFlag beflag) {
+        return new String(detname+layer+beflag.toString());
+    }
+    
+    /**
+     * Return the smallest radius hit for a particular SeedLayer and list of BarrelEndcapFlags
+     * @param seedlayer SeedLayer to consider
+     * @param beflaglist List of BarrelEndcapFlags to consider
+     * @return Minimum hit radius
+     */
+    public double getRMin(SeedLayer seedlayer, List<BarrelEndcapFlag> beflaglist) {
+        double rmin = 9999999.;
+        for (BarrelEndcapFlag beflag : beflaglist) {
+            String identifier = Identifier(seedlayer.getDetName(),seedlayer.getLayer(),beflag);
+            if (_rmin.containsKey(identifier)) rmin = Math.min(rmin,_rmin.get(identifier));
+        }
+       return rmin;
+    }
+    
+    /**
+     * Return the largest radius hit for a particular SeedLayer and list of BarrelEndcapFlags
+     * @param seedlayer SeedLayer to consider
+     * @param beflaglist List of BarrelEndcapFlags to consider
+     * @return Maximum hit radius
+     */
+    public double getRMax(SeedLayer seedlayer, List<BarrelEndcapFlag> beflaglist) {
+        double rmax = 0.;
+        for (BarrelEndcapFlag beflag : beflaglist) {
+            String identifier = Identifier(seedlayer.getDetName(),seedlayer.getLayer(),beflag);
+            if (_rmax.containsKey(identifier)) rmax = Math.max(rmax,_rmax.get(identifier));
+        }
+       return rmax;
+    }
+    
+    /**
+     * Return the minimum z coordinate for a hit in a particular SeedLayer and list of BarrelEndcapFlags
+     * @param seedlayer SeedLayer to consider
+     * @param beflaglist List of BarrelEndcapFlags to consider
+     * @return Minimum z coordinate
+     */
+    public double getZMin(SeedLayer seedlayer, List<BarrelEndcapFlag> beflaglist) {
+        double zmin = 9999999.;
+        for (BarrelEndcapFlag beflag : beflaglist) {
+            String identifier = Identifier(seedlayer.getDetName(),seedlayer.getLayer(),beflag);
+            if (_zmin.containsKey(identifier)) zmin = Math.min(zmin,_zmin.get(identifier));
+        }
+       return zmin;
+    }
+    
+    /**
+     * Return the maximum z coordinate for a hit in a particular SeedLayer and list of BarrelEndcapFlags
+     * @param seedlayer SeedLayer to consider
+     * @param beflaglist List of BarrelEndcapFlags to consider
+     * @return Maximum z coordinate
+     */
+    public double getZMax(SeedLayer seedlayer, List<BarrelEndcapFlag> beflaglist) {
+        double zmax = 0.;
+        for (BarrelEndcapFlag beflag : beflaglist) {
+            String identifier = Identifier(seedlayer.getDetName(),seedlayer.getLayer(),beflag);
+            if (_zmax.containsKey(identifier)) zmax = Math.max(zmax,_zmax.get(identifier));
+        }
+       return zmax;
+    }
+    
+}

lcsim/src/org/lcsim/contrib/seedtracker
SeedCandidate.java added at 1.1
diff -N SeedCandidate.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ SeedCandidate.java	10 Aug 2007 15:50:26 -0000	1.1
@@ -0,0 +1,97 @@
+/*
+ * SeedCandidate.java
+ *
+ * Created on August 3, 2007, 11:05 AM
+ *
+ * To change this template, choose Tools | Template Manager
+ * and open the template in the editor.
+ */
+
+package org.lcsim.contrib.seedtracker;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.lcsim.event.TrackerHit;
+import org.lcsim.fit.helicaltrack.HelicalTrackFit;
+
+/**
+ * Candidate seed containing a list of hits that make up the SeedCandidate and the associated helix parameters
+ * @author Richard Partridge
+ * @version 1.0
+ */
+public class SeedCandidate {
+    
+    private List<TrackerHit> _trackerhits = new ArrayList<TrackerHit>();
+    private HelicalTrackFit _helix;
+    
+    /**
+     * Create a new SeedCandidate from a list of hits
+     * @param trackerhits List of tracker hits for the SeedCandidate
+     */
+    public SeedCandidate(List<TrackerHit> trackerhits) {
+        _trackerhits.addAll(trackerhits);
+    }
+    
+    /**
+     * Create a new SeedCandidate from a list of hits and a helix
+     * @param trackerhits List of TrackerHits for the SeedCandidate
+     * @param helix HelicalTrackFit associated with the SeedCandidate
+     */
+    public SeedCandidate(List<TrackerHit> trackerhits, HelicalTrackFit helix) {
+        this(trackerhits);
+        _helix = helix;
+    }
+    
+    /**
+     * Creates a clone of an existing instance of SeedCandidate
+     * @param seed Existing SeedCandidate to be cloned
+     */
+    public SeedCandidate(SeedCandidate seed) {
+        this(seed.getTrackerHits(), seed.getHelix());
+    }
+    
+    /**
+     * Assign a list of TrackerHits to the SeedCandidate
+     * @param trackerhits List of TrackerHits for the SeedCandidate
+     */
+    public void setTrackerHits(List<TrackerHit> trackerhits) {
+        _trackerhits.clear();
+        _trackerhits.addAll(trackerhits);
+        return;
+    }
+    
+    /**
+     * Assign helix parameters to the SeedCandidate
+     * @param helix HelicalTrackFit associated with the SeedCandidate
+     */
+    public void setHelix(HelicalTrackFit helix) {
+        _helix = helix;
+        return;
+    }
+    
+    /**
+     * Add a hit to the SeedCandidate
+     * @param hit TrackerHit to be added to the SeedCandidate
+     */
+    public void addHit(TrackerHit hit) {
+        _trackerhits.add(hit);
+        return;
+    }
+    
+    /**
+     * Return the list of TrackerHits for the SeedCandidate
+     * @return List of TrackerHits for the SeedCandidate
+     */
+    public List<TrackerHit> getTrackerHits() {
+        return _trackerhits;
+    }
+    
+    /**
+     * Return the HelicalTrackFit associated with the SeedCandidate
+     * @return HelicalTrackFit associated with the SeedCandidate
+     */
+    public HelicalTrackFit getHelix() {
+        return _helix;
+    }
+}

lcsim/src/org/lcsim/contrib/seedtracker
DefaultStrategy.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- DefaultStrategy.java	7 Aug 2006 17:46:30 -0000	1.1
+++ DefaultStrategy.java	10 Aug 2007 15:50:26 -0000	1.2
@@ -10,6 +10,8 @@
 import java.util.List;
 import java.util.ArrayList;
 
+import org.lcsim.contrib.seedtracker.SeedLayer.SeedType;
+
 /**
  *
  * @author Richard Partridge
@@ -25,18 +27,18 @@
         StrategyList = new ArrayList();
         
         List<SeedLayer> TD012Layers = new ArrayList();
-        TD012Layers.add(new SeedLayer("TrackerEndcap", 0, SeedLayer.SeedType.SeedInner));
-        TD012Layers.add(new SeedLayer("TrackerEndcap", 1, SeedLayer.SeedType.SeedMiddle));
-        TD012Layers.add(new SeedLayer("TrackerEndcap", 2, SeedLayer.SeedType.SeedOuter));
+        TD012Layers.add(new SeedLayer("TrackerEndcap", 0, SeedType.Seed));
+        TD012Layers.add(new SeedLayer("TrackerEndcap", 1, SeedType.Seed));
+        TD012Layers.add(new SeedLayer("TrackerEndcap", 2, SeedType.Seed));
 //        StrategyList.add(new SeedStrategy("TD012",TD012Layers));
         
         List<SeedLayer> VB012Layers = new ArrayList();
-        VB012Layers.add(new SeedLayer("VertexBarrel", 2, SeedLayer.SeedType.SeedInner));
-        VB012Layers.add(new SeedLayer("VertexBarrel", 3, SeedLayer.SeedType.SeedMiddle));
-        VB012Layers.add(new SeedLayer("VertexBarrel", 4, SeedLayer.SeedType.SeedOuter));
-        VB012Layers.add(new SeedLayer("TrackerBarrel", 0, SeedLayer.SeedType.Confirm3D));
-//        VB012Layers.add(new SeedLayer("VertexBarrel", 0, SeedLayer.SeedType.Confirm3D));
-//        VB012Layers.add(new SeedLayer("VertexBarrel", 1, SeedLayer.SeedType.Confirm3D));
+        VB012Layers.add(new SeedLayer("VertexBarrel", 2, SeedType.Seed));
+        VB012Layers.add(new SeedLayer("VertexBarrel", 3, SeedType.Seed));
+        VB012Layers.add(new SeedLayer("VertexBarrel", 4, SeedType.Seed));
+        VB012Layers.add(new SeedLayer("TrackerBarrel", 0, SeedType.Confirm));
+//        VB012Layers.add(new SeedLayer("VertexBarrel", 0, SeedType.Confirm));
+//        VB012Layers.add(new SeedLayer("VertexBarrel", 1, SeedType.Confirm));
         StrategyList.add(new SeedStrategy("VB012",VB012Layers));
         
     }

lcsim/src/org/lcsim/contrib/seedtracker
SeedLayer.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- SeedLayer.java	7 Aug 2006 17:46:31 -0000	1.1
+++ SeedLayer.java	10 Aug 2007 15:50:26 -0000	1.2
@@ -7,94 +7,66 @@
 
 package org.lcsim.contrib.seedtracker;
 
-//import org.lcsim.event.SimTrackerHit;
-import org.lcsim.event.base.BaseTrackerHitMC;
-import java.util.List;
-import java.util.ArrayList;
-import org.lcsim.geometry.subdetector.DiskTracker;
-import org.lcsim.geometry.subdetector.MultiLayerTracker;
-
 /**
- *
+ * Encapsulates information about a tracker layer needed for the SeedTracker algorithm
  * @author Richard Partridge
  * @version 1.0
  */
-public class SeedLayer
-{
-    public enum SeedType {SeedInner, SeedMiddle, SeedOuter, Confirm2D, Confirm3D, Search2D, Search3D}
-    
-    protected String DetName;
-    protected int Layer;
-    protected SeedType Type;
-    protected List<BaseTrackerHitMC> HitList;
-    protected double RMax = 0;
-    protected double RMin = 99999;
-    protected double ZMax = 99999;
-    protected boolean IsEndcap = false;
+public class SeedLayer {
+    /**
+     * Enumeration of possible layer types
+     */
+    public enum SeedType {
+        /**
+         * Seed layer
+         */
+        Seed, 
+        /**
+         * Confirmation layer
+         */
+        Confirm, 
+        /**
+         * Track extension layer
+         */
+        Extend}
 
-    /** Creates a new instance of SeedLayer */
-    public SeedLayer(String DetName, int Layer, SeedType Type)
-    {
-        this.DetName = DetName;
-        this.Layer = Layer;
-        this.Type = Type;
-        HitList = new ArrayList<BaseTrackerHitMC>();
-    }
-    public String getDetName()
-    {
-        return DetName;
-    }
-    public int getLayer()
-    {
-        return Layer;
-    }
-    public SeedType getType()
-    {
-        return Type;
-    }
-    public List<BaseTrackerHitMC> getHitList()
-    {
-        return HitList;
-    }
-    public void putDetName(String DetName)
-    {
-        this.DetName = DetName;
-        return;
-    }
-    public void putLayer(int Layer)
-    {
-        this.Layer = Layer;
-        return;
+    private String _DetName;
+    private int _Layer;
+    private SeedType _Type;
+    
+    /**
+     * Creates a new instance of SeedLayer
+     * @param DetName Decector name
+     * @param Layer Layer number
+     * @param Type Layer type
+     */
+    public SeedLayer(String DetName, int Layer, SeedType Type) {
+        _DetName = DetName;
+        _Layer = Layer;
+        _Type = Type;
     }
-    public void putType(SeedType Type)
-    {
-        this.Type = Type;
-        return;
+    
+    /**
+     * Return the detector name
+     * @return Detector name
+     */
+    public String getDetName() {
+        return _DetName;
     }
-    public void addHit(BaseTrackerHitMC Hit)
-    {
-        if (HitList.isEmpty()) {
-            IsEndcap = Hit.getSimHits().get(0).getSubdetector().isEndcap();
-            if (IsEndcap) {
-                DiskTracker dtrkr = (DiskTracker) Hit.getSimHits().get(0).getSubdetector();
-                RMin = dtrkr.getInnerR()[Layer];
-                RMax = dtrkr.getOuterR()[Layer];
-                ZMax = dtrkr.getInnerZ()[Layer];
-            }
-            else {
-                MultiLayerTracker ctrkr = (MultiLayerTracker) Hit.getSimHits().get(0).getSubdetector();
-                RMin = 0.;
-                RMax = ctrkr.getInnerR()[Layer];
-                ZMax = ctrkr.getOuterZ()[Layer];
-            }
-            System.out.println(DetName+" Layer "+Layer+" RMIN "+RMin+" RMAX "+RMax+" ZMax "+ZMax);
-        }
-        HitList.add(Hit);
-        return;
+    
+    /**
+     * Return the layer number
+     * @return Layer number
+     */
+    public int getLayer() {
+        return _Layer;
     }
-    public void clearHitList()
-    {
-        HitList.clear();
-        return;
+    
+    /**
+     * Retrun the layer type
+     * @return Layer type
+     */
+    public SeedType getType() {
+        return _Type;
     }
 }

lcsim/src/org/lcsim/contrib/seedtracker
SeedStrategy.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- SeedStrategy.java	7 Aug 2006 17:46:31 -0000	1.1
+++ SeedStrategy.java	10 Aug 2007 15:50:26 -0000	1.2
@@ -7,143 +7,213 @@
 
 package org.lcsim.contrib.seedtracker;
 
-import java.util.*;
-import org.lcsim.contrib.seedtracker.SeedLayer;
+import java.util.List;
+import java.util.ArrayList;
+
+import org.lcsim.contrib.seedtracker.SeedLayer.SeedType;
 
 /**
- *
+ * Encapsulate the parameters and layers used for this track finding strategy
  * @author Richard Partridge
  * @version 1.0
  */
 public class SeedStrategy {
-    private String Name;
-    private List<SeedLayer> LayerList;
-    private double MinPT = 0.5;
-    private double MaxDCA = 10.0;
-    private double MaxZ0 = 10.0;
-    private double MaxChisq = 100.;
-    private int MinConfirm = 1;
-    private int MinHits = 4;
+    private String _Name;
+    private List<SeedLayer> _LayerList = new ArrayList<SeedLayer>();
+    private double _MinPT = 0.5;
+    private double _MaxDCA = 10.0;
+    private double _MaxZ0 = 10.0;
+    private double _MaxChisq = 100.;
+    private int _MinConfirm = 1;
+    private int _MinHits = 4;
     
-    /** Creates a new instance of SeedStrategy */
+    /**
+     * Fully qualified constructor
+     * @param Name Name assigned to this strategy
+     * @param LayerList SeedLayers for this strategy
+     * @param MinPT Minimum pT for this strategy
+     * @param MaxDCA Maximum DCA for this strategy
+     * @param MaxZ0 Maximum z0 for this strategy
+     * @param MaxChisq Maximum chi^2 for this strategy
+     * @param MinConfirm Minimum confirmation hits for this strategy
+     * @param MinHits Minimum total number of hits for this strategy
+     */
     public SeedStrategy(String Name, List<SeedLayer> LayerList, double MinPT,
             double MaxDCA, double MaxZ0, double MaxChisq, int MinConfirm, int MinHits) {
-        this.Name = Name;
-        this.LayerList = LayerList;
-        this.MinPT = MinPT;
-        this.MaxDCA = MaxDCA;
-        this.MaxZ0 = MaxZ0;
-        this.MaxChisq = MaxChisq;
-        this.MinConfirm = MinConfirm;
-        this.MinHits = MinHits;
-    }
-    public SeedStrategy(String Name, double MinPT, double MaxDCA,double MaxZ0,
-            double MaxChisq, int MinConfirm, int MinHits) {
-        this.Name = Name;
-        this.LayerList = new ArrayList<SeedLayer>();
-        this.MinPT = MinPT;
-        this.MaxDCA = MaxDCA;
-        this.MaxZ0 = MaxZ0;
-        this.MaxChisq = MaxChisq;
-        this.MinConfirm = MinConfirm;
-        this.MinHits = MinHits;
-    }
-    public SeedStrategy(String Name) {
-        this.Name = Name;
-        this.LayerList = new ArrayList<SeedLayer>();
+        this(Name, LayerList);
+        _Name = Name;
+        _MinPT = MinPT;
+        _MaxDCA = MaxDCA;
+        _MaxZ0 = MaxZ0;
+        _MaxChisq = MaxChisq;
+        _MinConfirm = MinConfirm;
+        _MinHits = MinHits;
     }
+    
+    /**
+     * Constructor for a strategy with the default parameter settings
+     * @param Name Name assigned to this strategy
+     * @param LayerList List of SeedLayers for this strategy
+     */
     public SeedStrategy(String Name, List<SeedLayer> LayerList) {
-        this.Name = Name;
-        this.LayerList = LayerList;
+        this(Name);
+        _LayerList.addAll(LayerList);
+    }
+    
+    /**
+     * Bare-bones constructor - layers must be added and any changes to default parameters must be made
+     * @param Name Name assigned to this strategy
+     */
+     public SeedStrategy(String Name) {
+        _Name = Name;
     }
+    
+    /**
+     * Return name assigned to this strategy
+     * @return Strategy name
+     */
     public String getName() {
-        return Name;
+        return _Name;
     }
+    
+    /**
+     * Return list of SeedLayers used by this strategy
+     * @return List of SeedLayers used by this strategy
+     */
     public List<SeedLayer> getLayerList() {
-        return LayerList;
+        return _LayerList;
     }
+    
+    /**
+     * Return minimum pT for this strategy
+     * @return Minimum pT for this strategy
+     */
     public double getMinPT() {
-        return MinPT;
+        return _MinPT;
     }
+    
+    /**
+     * Return maximum Distance of Closest Approach (DCA) in the x-y plane for this strategy
+     * @return Maximum DCA for this strategy
+     */
     public double getMaxDCA() {
-        return MaxDCA;
+        return _MaxDCA;
     }
+    
+    /**
+     * Return maximum s-z intercept z0 for this strategy
+     * @return Maximum z0 for this strategy
+     */
     public double getMaxZ0() {
-        return MaxZ0;
+        return _MaxZ0;
     }
+    
+    /**
+     * Return maximum chi^2 for this strategy
+     * @return Maximum chi^2 for this strategy
+     */
     public double getMaxChisq() {
-        return MaxChisq;
+        return _MaxChisq;
     }
+    
+    /**
+     * Return minimum number of confirmation hits for this strategy
+     * @return Minimum number of confirmation hits for this strategy
+     */
     public int getMinConfirm() {
-        return MinConfirm;
+        return _MinConfirm;
     }
+    
+    /**
+     * Return minimum number of total hits for this strategy
+     * @return Minimum number of total hits for this strategy
+     */
     public int getMinHits() {
-        return MinHits;
-    }
-    public void putName(String Name) {
-        this.Name=Name;
-        return;
+        return _MinHits;
     }
+    
+    /**
+     * Specify Seedlayers to be used for this strategy
+     * @param LayerList List of SeedLayers used by this strategy
+     */
     public void putLayerList(List<SeedLayer> LayerList) {
-        this.LayerList = LayerList;
+        _LayerList.addAll(LayerList);
         return;
     }
+    
+    /**
+     * Set the minimum pT for this strategy
+     * @param MinPT Minimum pT of this strategy
+     */
     public void putMinPT(double MinPT) {
-        this.MinPT = MinPT;
+        _MinPT = MinPT;
         return;
     }
+    
+    /**
+     * Set the maximum Distance of Closest Approach (DCA) in the x-y plane for this strategy
+     * @param MaxDCA Maximum DCA for this strategy
+     */
     public void putMaxDCA(double MaxDCA) {
-        this.MaxDCA = MaxDCA;
+        _MaxDCA = MaxDCA;
         return;
     }
+    
+    /**
+     * Set the maximum s-z intercept z0 for this strategy
+     * @param MaxZ0 Maximum z0 for this strategy
+     */
     public void putMaxZ0(double MaxZ0) {
-        this.MaxZ0 = MaxZ0;
+        _MaxZ0 = MaxZ0;
         return;
     }
+    
+    /**
+     * Set the maximum chi^2 for this strategy
+     * @param MaxChisq Maximum chi^2 for this strategy
+     */
     public void putMaxChisq(double MaxChisq) {
-        this.MaxChisq = MaxChisq;
+        _MaxChisq = MaxChisq;
         return;
     }
+    
+    /**
+     * Set the minimum number of confirmation hits for this strategy
+     * @param MinConfirm Minimum number of confirmation hits for this strategy
+     */
     public void putMinConfirm(int MinConfirm) {
-        this.MinConfirm = MinConfirm;
+        _MinConfirm = MinConfirm;
         return;
     }
+    
+    /**
+     * Set the minimum number of total hits for this strategy
+     * @param MinHits Minimum number of total hits for this strategy
+     */
     public void putMinHits(int MinHits) {
-        this.MinHits = MinHits;
+        _MinHits = MinHits;
         return;
     }
+    
+    /**
+     * Add a SeedLayer for this strategy
+     * @param Layer SeedLayer to be added to this strategy
+     */
     public void addLayer(SeedLayer Layer) {
-        LayerList.add(Layer);
+        _LayerList.add(Layer);
         return;
     }
-    public SeedLayer getSeedInner() {
-        SeedLayer Inner = new SeedLayer("Dummy",0,SeedLayer.SeedType.SeedInner);
-        for (SeedLayer layer : LayerList) {
-            if (layer.getType() == SeedLayer.SeedType.SeedInner) Inner = layer;
-        }
-        return Inner;
-    }
     
-     public SeedLayer getSeedMiddle() {
-        SeedLayer Middle = new SeedLayer("Dummy",0,SeedLayer.SeedType.SeedMiddle);
-        for (SeedLayer layer : LayerList) {
-            if (layer.getType() == SeedLayer.SeedType.SeedMiddle) Middle = layer;
-        }
-        return Middle;
-     }
-     
-     public SeedLayer getSeedOuter() {
-        SeedLayer Outer = new SeedLayer("Dummy",0,SeedLayer.SeedType.SeedOuter);
-        for (SeedLayer layer : LayerList) {
-            if (layer.getType() == SeedLayer.SeedType.SeedOuter) Outer = layer;
+    /**
+     * Return the list of SeedLayers of a given SeedType for this strategy
+     * @param type SeedType of the layers to be returned
+     * @return SeedLayers of the specified type for this strategy
+     */
+     public List<SeedLayer> getLayers(SeedType type) {
+        List<SeedLayer> layers = new ArrayList();
+        for (SeedLayer layer : _LayerList) {
+            if (layer.getType() == type) layers.add(layer);
         }
-        return Outer;
+        return layers;
     }
-    public List<SeedLayer> getConfirmLayers() {
-        List<SeedLayer> confirmlayers = new ArrayList();
-        for (SeedLayer layer : LayerList) {
-            if (layer.getType() == SeedLayer.SeedType.Confirm3D) confirmlayers.add(layer);
-        }
-        return confirmlayers;
-    } 
-}
+}
\ No newline at end of file

lcsim/src/org/lcsim/contrib/seedtracker
SeedTracker.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- SeedTracker.java	30 Jun 2007 00:26:57 -0000	1.2
+++ SeedTracker.java	10 Aug 2007 15:50:26 -0000	1.3
@@ -8,19 +8,24 @@
 package org.lcsim.contrib.seedtracker;
 
 import java.util.ArrayList;
+import java.util.List;
 import java.util.ListIterator;
+
+import org.lcsim.contrib.seedtracker.SeedLayer.SeedType;
+import org.lcsim.event.EventHeader;
 import org.lcsim.event.MCParticle;
-import org.lcsim.event.SimTrackerHit;
+//import org.lcsim.event.SimTrackerHit;
 import org.lcsim.event.Track;
 import org.lcsim.event.TrackerHit;
 import org.lcsim.event.base.BaseTrack;
-import org.lcsim.event.base.BaseTrackerHitMC;
+//import org.lcsim.event.base.BaseTrackerHitMC;
 import org.lcsim.fit.helicaltrack.HelicalTrackFit;
-import org.lcsim.geometry.Detector;
-import org.lcsim.geometry.subdetector.MultiLayerTracker;
+import org.lcsim.fit.helicaltrack.HelicalTrackFitter;
+import org.lcsim.geometry.subdetector.BarrelEndcapFlag;
 import org.lcsim.util.Driver;
-import org.lcsim.event.EventHeader;
-import java.util.List;
+
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Vector;
 
 /**
  * Tracking algorithm based on forming track seeds from all 3-hit combinations
@@ -30,276 +35,293 @@
  * @version 1.0
  */
 public class SeedTracker extends Driver {
-    private DefaultStrategy DS = new DefaultStrategy();
-    private List<SeedStrategy> StrategyList = DS.getStrategyList();
-    private HelicalTrackFitter hf = new HelicalTrackFitter();
-    private HelicalTrackFit helix;
-    private double[] IP = {0.,0.,0.};
-    private double BField;
+    private DefaultStrategy _DS = new DefaultStrategy();
+    private List<SeedStrategy> _strategylist;
+    private HelicalTrackFitter _hf = new HelicalTrackFitter();
+    private Hep3Vector _IP = new BasicHep3Vector(0.,0.,0.);
+    private double _BField;
+    private HitManager _HM = new HitManager();
+    private List<List<BarrelEndcapFlag>> _beflagcol;
     
     /** Creates a new instance of SeedTracker */
     public SeedTracker() {
+        _strategylist = _DS.getStrategyList();
+        _beflagcol = getDefaultBEFlagLists();
     }
     
     protected void process(EventHeader event) {
         
-        // Find the magnetic field
-        Detector detector = event.getDetector();
-        BField = detector.getFieldMap().getField(IP)[2];
-        
-        // Associate hits with layers (ignore layers that aren't included in a strategy
-        AssociateHits(event);
-        
-        // Create a list of tracks
-        List<BaseTrack> tracklist = new ArrayList();
-        
-        // Loop over all strategies
-        for (SeedStrategy strategy : StrategyList) {
-            // Find the 3 hits seeds for this strategy
-            List<List<BaseTrackerHitMC>> seedlist = FindSeeds(strategy);
-            // Loop over the seeds
-            for (List<BaseTrackerHitMC> hitlist : seedlist) {
-                // See if we can create a helix that satisfies the cuts for this strategy
-                boolean status = FindHelix(strategy, hitlist);
-                if (!status) continue;
-                List<List<BaseTrackerHitMC>> confirmlist = FindConfirms(strategy, hitlist);
-                int maxhits = 3 + strategy.getConfirmLayers().size();
-                int minhits = 3 + strategy.getMinConfirm();
-                // First try to find one or more tracks using all the confirm hits
-                // If this fails, work our way down to the minimum number
-                for (int nhit = maxhits; nhit >= minhits; nhit--) {
-                    boolean foundtrack = false;
-                    for (List<BaseTrackerHitMC> candidate : confirmlist) {
-                        if (candidate.size() == nhit) {
-                            if (!isDuplicate(candidate, tracklist)) {
-                                boolean status2 = FindHelix(strategy, candidate);
-                                if (status2) {
-                                    // Create a new track
-                                    BaseTrack track = new BaseTrack();
-                                    track.setReferencePoint(IP);
-                                    track.setRefPointIsDCA(false);
-                                    track.setTrackParameters(helix.parameters(), BField);
-                                    track.setChisq(helix.chisq()[0]+helix.chisq()[1]);
-                                    track.setNDF(helix.ndf()[0]+helix.ndf()[1]);
-                                    track.setCovarianceMatrix(helix.covariance());
-                                    track.setTrackType(0);
-                                    List<TrackerHit> castcand = new ArrayList();
-                                    for (BaseTrackerHitMC hit : candidate) {
-                                        castcand.add((TrackerHit) hit);
-                                    }
-                                    track.addHits(castcand);
-                                    tracklist.add(track);
-                                    foundtrack = true;
-                                }
-                            }
+        //  Find the magnetic field
+        _BField = event.getDetector().getFieldMap().getField(_IP).z();
+        //  Tell the hit manager to sort the hits for this event
+        _HM.OrganizeHits(event);
+        //  Create the list of final track seeds
+        List<SeedCandidate> trackseeds = new ArrayList<SeedCandidate>();
+        //  Loop over all strategies
+        for (SeedStrategy strategy : _strategylist) {
+            //  Loop over the BarrelEndcapFlag combinations to consider
+            for (List<BarrelEndcapFlag> beflaglist : _beflagcol) {
+                //  Find the 3 hits seeds for this strategy
+                List<SeedCandidate> seedlist = FindSeeds(strategy, beflaglist);
+                //  Loop over the seeds
+                for (SeedCandidate seed : seedlist) {
+                    //  Try to add confirming hits to the seed
+                    List<SeedCandidate> confirmedseeds = FindConfirmedSeeds(strategy, beflaglist, seed);
+                    //  Loop over the confirmed seeds
+                    for (SeedCandidate conseed : confirmedseeds) {
+                        //  Try to extend seeds to additional layers
+                        List<SeedCandidate> extendedseeds = FindExtendedSeeds(strategy, beflaglist, conseed);
+                        //  Loop over the extended seeds
+                        for (SeedCandidate extseed : extendedseeds) {
+                            //  Purge any duplicate extended seeds
+                            PurgeDuplicateSeeds(trackseeds,extseed);
                         }
                     }
-                    if (foundtrack) break;
                 }
             }
         }
-        event.put("Tracks", tracklist, Track.class, 0);
+        //  Make tracks from the final list of track seeds
+        MakeTracks(trackseeds);
+        return;
     }
-    
-    private void AssociateHits(EventHeader event) {
-        List<BaseTrackerHitMC>  hitcol = event.get(BaseTrackerHitMC.class,"BaseTrackerHitMC");
         
-        for (SeedStrategy strategy : StrategyList) {
-            for (SeedLayer slyr : strategy.getLayerList()) {
-                slyr.clearHitList();
-                for (BaseTrackerHitMC hit : hitcol) {
-                    for (SimTrackerHit simhit : hit.getSimHits()) {
-                        if (simhit.getLayer() == slyr.Layer) {
-                            if (simhit.getSubdetector().getName().equals(slyr.getDetName())) {
-                                slyr.addHit(hit);
-                            }
-                        }
+        private List<SeedCandidate> FindSeeds(SeedStrategy strategy, List<BarrelEndcapFlag> beflaglist) {
+            List<SeedCandidate> candidates = new ArrayList<SeedCandidate>();
+            //  Get the SeedLayers for this strategy
+            List<SeedLayer> seedlayerlist = strategy.getLayers(SeedType.Seed);
+            if (seedlayerlist.size() != 3) return candidates;
+            //  Get the hits for the seed layers
+            List<List<TrackerHit>> seedhits = new ArrayList<List<TrackerHit>>();
+            for (SeedLayer seedlyr : seedlayerlist) {
+                seedhits.add(_HM.getTrackerHits(seedlyr, beflaglist));
+            }
+            //  Order the seed layers from fewest hits to most hits
+            for (int i=0; i<2; i++) {
+                for (int j=i+1; j<3; j++) {
+                    if (seedhits.get(i).size() > seedhits.get(j).size()) {
+                        List<TrackerHit> temp = seedhits.get(i);
+                        seedhits.set(i,seedhits.get(j));
+                        seedhits.set(j,temp);
                     }
                 }
             }
-        }
-        return;
-    }
-    public List<SeedStrategy> getStrategyList() {
-        return StrategyList;
-    }
-    
-    public void putStrategyList(List<SeedStrategy> StrategyList) {
-        this.StrategyList = StrategyList;
-        return;
-    }
-    
-    private List<List<BaseTrackerHitMC>> FindSeeds(SeedStrategy strategy) {
-        
-        SeedLayer inner = strategy.getSeedInner();
-        SeedLayer middle = strategy.getSeedMiddle();
-        SeedLayer outer = strategy.getSeedOuter();
-        
-        double RMin = strategy.getMinPT() / (0.0003 * BField);
-        double dMax = strategy.getMaxDCA();
-       
-        // Todo: add code to limit seeds to those that satisfy cuts
-        List<List<BaseTrackerHitMC>> seedlist = new ArrayList();
-        
-        for (BaseTrackerHitMC si : inner.getHitList()) {
-            double[] pos1 = si.getPosition();
-            double r1 = Math.sqrt(pos1[0]*pos1[0] + pos1[1]*pos1[1]);
-            double phi1 = Math.atan2(pos1[1],pos1[0]);
-            double dphi1 = Math.asin((2*RMin*dMax - dMax*dMax-r1*r1)/(2*r1*(RMin-dMax)));
-            for (BaseTrackerHitMC sm : middle.getHitList()) {
-                double[] pos2 = sm.getPosition();
-                double r2 = Math.sqrt(pos2[0]*pos2[0] + pos2[1]*pos2[1]);
-                double phi2 = Math.atan2(pos2[1],pos2[0]);
-                double dphi2 = Math.asin((2*RMin*dMax - dMax*dMax-r2*r2)/(2*r2*(RMin-dMax)));
-                if (Math.abs(phi2-phi1) > Math.abs(dphi2-dphi1)) continue;
-                
-                for (BaseTrackerHitMC so : outer.getHitList()) {
-                    double[] pos3 = so.getPosition();
-                    double r3 = Math.sqrt(pos3[0]*pos3[0] + pos3[1]*pos3[1]);
-                    double phi3 = Math.atan2(pos3[1],pos3[0]);
-                    double dphi3 = Math.asin((2*RMin*dMax - dMax*dMax-r3*r3)/(2*r3*(RMin-dMax)));
-                    if (Math.abs(phi3-phi2) > Math.abs(dphi3-dphi2)) continue;
+            double RMin = strategy.getMinPT() / (0.0003 * _BField);
+            double dMax = strategy.getMaxDCA();
+            
+            // Todo: add code to limit seeds to those that satisfy cuts
+            
+            for (TrackerHit s1 : seedhits.get(0)) {
+                double[] pos1 = s1.getPosition();
+                double r1 = Math.sqrt(pos1[0]*pos1[0] + pos1[1]*pos1[1]);
+                double phi1 = Math.atan2(pos1[1],pos1[0]);
+                double dphi1 = Math.asin((2*RMin*dMax - dMax*dMax-r1*r1)/(2*r1*(RMin-dMax)));
+                for (TrackerHit s2 : seedhits.get(1)) {
+                    double[] pos2 = s2.getPosition();
+                    double r2 = Math.sqrt(pos2[0]*pos2[0] + pos2[1]*pos2[1]);
+                    double phi2 = Math.atan2(pos2[1],pos2[0]);
+                    double dphi2 = Math.asin((2*RMin*dMax - dMax*dMax-r2*r2)/(2*r2*(RMin-dMax)));
+                    if (Math.abs(phi2-phi1) > Math.abs(dphi2-dphi1)) continue;
                     
-                    List<BaseTrackerHitMC> hitlist = new ArrayList();
-                    hitlist.add(si);
-                    hitlist.add(sm);
-                    hitlist.add(so);
-                    seedlist.add(hitlist);
+                    for (TrackerHit s3 : seedhits.get(2)) {
+                        double[] pos3 = s3.getPosition();
+                        double r3 = Math.sqrt(pos3[0]*pos3[0] + pos3[1]*pos3[1]);
+                        double phi3 = Math.atan2(pos3[1],pos3[0]);
+                        double dphi3 = Math.asin((2*RMin*dMax - dMax*dMax-r3*r3)/(2*r3*(RMin-dMax)));
+                        if (Math.abs(phi3-phi2) > Math.abs(dphi3-dphi2)) continue;
+                        List<TrackerHit> hitlist = new ArrayList<TrackerHit>();
+                        hitlist.add(s1);
+                        hitlist.add(s2);
+                        hitlist.add(s3);
+                        boolean status = _hf.fit(hitlist);
+                        if (!status) continue;
+                        HelicalTrackFit helix = _hf.getFit();
+                        if (!HelixCuts(strategy, helix)) continue;
+                        candidates.add(new SeedCandidate(hitlist, helix));
+                    }
                 }
             }
+            System.out.println(" Number of seeds: "+candidates.size());
+            
+            return candidates;
         }
-        System.out.println(" Number of seeds: "+seedlist.size());
-        
-        return seedlist;
-    }
-    
-    private boolean FindHelix(SeedStrategy strategy, List<BaseTrackerHitMC> hitlist) {
-        boolean status = false;
-        int np = hitlist.size();
-        double[] xx = new double[np];
-        double[] yy = new double[np];
-        double[] zz = new double[np];
-        double[] drphi = new double[np];
-        double[] dz = new double[np];
         
-        for (int i=0; i<np; i++) {
-            BaseTrackerHitMC hit = hitlist.get(i);
-            double[] position = hit.getPosition();
-            xx[i] = position[0];
-            yy[i] = position[1];
-            zz[i] = position[2];
-            double[] covmat = hit.getCovMatrix();
-            drphi[i] = rphi_error(position, covmat);
-            dz[i] = Math.sqrt(covmat[5]);
-        }
-        boolean goodfit = hf.fit(xx, yy, zz, drphi, dz, np);
-        if (goodfit) {
-            helix = hf.getFit();
+        private boolean HelixCuts(SeedStrategy strategy, HelicalTrackFit helix) {
             double[] params = helix.parameters();
-            double pT = 0.0003 * BField / Math.abs(params[2]);
-            if (helix.chisq()[0]+helix.chisq()[1] < strategy.getMaxChisq()) {
-                if (pT > strategy.getMinPT()) {
-                    double d0 = params[0];
-                    if (d0 < strategy.getMaxDCA()) {
-                        double z0 = params[3];
-                        if (z0 < strategy.getMaxZ0()) {
-                            System.out.println(" d0 "+params[0]);
-                            System.out.println(" phi0 "+params[1]);
-                            System.out.println(" curvatures "+params[2]);
-                            System.out.println(" z0 "+params[3]);
-                            System.out.println(" slope "+params[4]);
-                            System.out.println(" pT "+pT);
-                            status = true;
-                        }
-                    }
-                }
-            }
+            if (helix.chisq()[0]+helix.chisq()[1] < strategy.getMaxChisq()) return false;
+            double pT = 0.0003 * _BField / Math.abs(params[2]);
+            if (pT > strategy.getMinPT()) return false;
+            if (params[0] < strategy.getMaxDCA()) return false;
+            if (params[3] < strategy.getMaxZ0()) return false;
+            System.out.println(" d0 "+params[0]);
+            System.out.println(" phi0 "+params[1]);
+            System.out.println(" curvatures "+params[2]);
+            System.out.println(" z0 "+params[3]);
+            System.out.println(" slope "+params[4]);
+            System.out.println(" pT "+pT);
+            return true;
         }
-        return status;
-    }
-    
-    private List<List<BaseTrackerHitMC>> FindConfirms(SeedStrategy strategy, List<BaseTrackerHitMC> seedhits) {
-        // Create a list of possible confirmation hits for each confirmation layer
-        List<List<BaseTrackerHitMC>> confirmbylayer = new ArrayList();
-        // Loop over the various layers
-        for (SeedLayer layer : strategy.getConfirmLayers()) {
-            // Get the list of potential confirmation hits for this layer
-            // Todo - select only hits near tracks
-            List<BaseTrackerHitMC> confirmhits = layer.getHitList();
-            // If we have some confirmation hits in this layer, add the list of hits for this layer
-            if (confirmhits.size()>0) confirmbylayer.add(confirmhits);
-        }
-        // Initialize a list of track candidates that include confirmation hits
-        List<List<BaseTrackerHitMC>> candlist = new ArrayList();
-        // check that there are sufficient layers with confirmation hits
-        if (confirmbylayer.size() >= strategy.getMinConfirm()) {
-            // Start with our seed hits as a candidate
-            candlist.add(seedhits);
-            // Loop over all the confirming layers
-            for (List<BaseTrackerHitMC> confirmhits : confirmbylayer) {
-                // Create a list of new candidates that have hits added from this layer
-                List<List<BaseTrackerHitMC>> newcandlist = new ArrayList();
-                // Loop over all existing candidates
-                for (List<BaseTrackerHitMC> oldcand : candlist) {
-                    // Loop over all the hits in this confirming layer
-                    for (BaseTrackerHitMC hit : confirmhits) {
-                        // Create a new track candidate that adds this hit
-                        List<BaseTrackerHitMC> newcand = new ArrayList();
-                        boolean status = newcand.addAll(oldcand);
-                        newcand.add(hit);
-                        newcandlist.add(newcand);
-                    }
-                }
-                boolean status = candlist.addAll(newcandlist);
-            }
-        }
-        // Remove candidates that have too few confirmation hits
+        
+        private List<SeedCandidate> FindConfirmedSeeds(SeedStrategy strategy, List<BarrelEndcapFlag> beflaglist, SeedCandidate seed) {
+            List<SeedCandidate> confirmedseeds = new ArrayList<SeedCandidate>();
+            //  For now, confirm our original seed
+            confirmedseeds.add(seed);
+//        private List<List<TrackerHit>> FindConfirms(SeedStrategy strategy, List<BarrelEndcapFlag> beflaglist, SeedCandidate seed) {
+//            // Create a list of possible confirmation hits for each confirmation layer
+//            List<List<TrackerHit>> confirmbylayer = new ArrayList();
+//            // Loop over the various layers
+//            for (SeedLayer layer : strategy.getLayers(SeedType.Confirm)) {
+//                // Get the list of potential confirmation hits for this layer
+//                // Todo - select only hits near tracks
+//                List<TrackerHit> confirmhits = _HM.getTrackerHits(layer, beflaglist);
+//                // If we have some confirmation hits in this layer, add the list of hits for this layer
+//                if (confirmhits.size()>0) confirmbylayer.add(confirmhits);
+//            }
+            // Initialize a list of track candidates that include confirmation hits
+//            List<List<TrackerHit>> candlist = new ArrayList();
+            // check that there are sufficient layers with confirmation hits
+//            if (confirmbylayer.size() >= strategy.getMinConfirm()) {
+                // Start with our seed hits as a candidate
+//                candlist.add(seed.getTrackerHits());
+                // Loop over all the confirming layers
+//                for (List<TrackerHit> confirmhits : confirmbylayer) {
+                    // Create a list of new candidates that have hits added from this layer
+//                    List<List<TrackerHit>> newcandlist = new ArrayList();
+                    // Loop over all existing candidates
+//                    for (List<TrackerHit> oldcand : candlist) {
+                        // Loop over all the hits in this confirming layer
+//                        for (TrackerHit hit : confirmhits) {
+                            // Create a new track candidate that adds this hit
+//                            List<TrackerHit> newcand = new ArrayList();
+//                            boolean status = newcand.addAll(oldcand);
+//                            newcand.add(hit);
+//                            newcandlist.add(newcand);
+//                        }
+//                    }
+//                    boolean status = candlist.addAll(newcandlist);
+//                }
+//            }
+            // Remove candidates that have too few confirmation hits
 //        ListIterator<List<BaseTrackerHitMC>> itr = candlist.listIterator();
 //        while (itr.hasNext()) {
 //            List<BaseTrackerHitMC> hitlist = itr.next();
 //            if (hitlist.size() < strategy.getMinConfirm()+3) candlist.remove(hitlist);
 //        }
-        
-        return candlist;
-    }
-    
-    private boolean isDuplicate(List<BaseTrackerHitMC> hitlist, List<BaseTrack> tracklist) {
-        boolean isDuplicate = false;
-        for (BaseTrack track : tracklist) {
-            List<TrackerHit> hitlist2 = track.getTrackerHits();
-            boolean matchall = true;
-            if (hitlist.size() <= hitlist2.size()) {
-                for ( BaseTrackerHitMC hit1 : hitlist) {
-                    boolean match = false;
-                    for (TrackerHit hit2 : hitlist2) {
-                        if (hit1 == (BaseTrackerHitMC) hit2) {
-                            match = true;
+//            
+//            return candlist;
+//        }
+//                    int maxhits = 3 + strategy.getLayers(SeedType.Confirm).size();
+//                    int minhits = 3 + strategy.getMinConfirm();
+        // First try to find one or more tracks using all the confirm hits
+        // If this fails, work our way down to the minimum number
+//                    for (int nhit = maxhits; nhit >= minhits; nhit--) {
+//                        boolean foundtrack = false;
+//                        for (List<TrackerHit> candidate : confirmlist) {
+//                            if (candidate.size() == nhit) {
+//                                if (!isDuplicate(candidate, tracklist)) {
+//                                    boolean status2 = FindHelix(strategy, candidate);
+            return confirmedseeds;
+        }
+
+         private List<SeedCandidate> FindExtendedSeeds(SeedStrategy strategy, List<BarrelEndcapFlag> beflaglist, SeedCandidate seed) {
+            List<SeedCandidate> extendedseeds = new ArrayList<SeedCandidate>();
+            //  For now, just pass along the input seed
+            extendedseeds.add(seed);
+            return extendedseeds;
+        }
+
+         private void PurgeDuplicateSeeds(List<SeedCandidate> trackseeds, SeedCandidate extseed) {
+             //  Ignore duplicates for now
+             return;
+         }
+       
+         private void MakeTracks(List<SeedCandidate> trackseeds) {
+        // Create a list of tracks
+        List<Track> tracklist = new ArrayList<Track>();
+//                                        BaseTrack track = new BaseTrack();
+//                                        track.setReferencePoint(_IP.v());
+//                                        track.setRefPointIsDCA(false);
+//                                        HelicalTrackFit helix = seed.getHelix();
+//                                        track.setTrackParameters(helix.parameters(), _BField);
+//                                        track.setChisq(helix.chisq()[0]+helix.chisq()[1]);
+//                                        track.setNDF(helix.ndf()[0]+helix.ndf()[1]);
+//                                        track.setCovarianceMatrix(helix.covariance());
+//                                        track.setTrackType(0);
+//                                        List<TrackerHit> castcand = new ArrayList();
+//                                        for (TrackerHit hit : candidate) {
+//                                            castcand.add((TrackerHit) hit);
+//                                        }
+//                                        track.addHits(castcand);
+//                                        tracklist.add(track);
+//                                        foundtrack = true;
+             return;
+         }
+         
+        private boolean isDuplicate(List<TrackerHit> hitlist, List<Track> tracklist) {
+            boolean isDuplicate = false;
+            for (Track track : tracklist) {
+                List<TrackerHit> hitlist2 = track.getTrackerHits();
+                boolean matchall = true;
+                if (hitlist.size() <= hitlist2.size()) {
+                    for (TrackerHit hit1 : hitlist) {
+                        boolean match = false;
+                        for (TrackerHit hit2 : hitlist2) {
+                            if (hit1 == hit2) {
+                                match = true;
+                                break;
+                            }
+                        }
+                        if (!match) {
+                            matchall = false;
                             break;
                         }
                     }
-                    if (!match) {
-                        matchall = false;
+                    if (matchall) {
+                        isDuplicate = true;
                         break;
                     }
                 }
-                if (matchall) {
-                    isDuplicate = true;
-                    break;
-                }
             }
+            return isDuplicate;
         }
-        return isDuplicate;
-    }
-    
-    private double rphi_error(double[] position, double[] covmat) {
-        // Todo: include MS errors in weight
-        double x = position[0];
-        double y = position[1];
-        double r2 = x * x + y * y;
-        double varxx = covmat[0];
-        double varxy = covmat[1];
-        double varyy = covmat[2];
-        return Math.sqrt((y * y * varxx + x * x * varyy - 2 * x * y * varxy) / r2);
-    }
-    
-}
\ No newline at end of file
+        
+        private double rphi_error(double[] position, double[] covmat) {
+            // Todo: include MS errors in weight
+            double x = position[0];
+            double y = position[1];
+            double r2 = x * x + y * y;
+            double varxx = covmat[0];
+            double varxy = covmat[1];
+            double varyy = covmat[2];
+            return Math.sqrt((y * y * varxx + x * x * varyy - 2 * x * y * varxy) / r2);
+        }
+        
+        private List<List<BarrelEndcapFlag>> getDefaultBEFlagLists() {
+           
+        // Create the default lists of BarrelEndcapFlags to consider
+        List<BarrelEndcapFlag> north = new ArrayList<BarrelEndcapFlag>();
+        north.add(BarrelEndcapFlag.BARREL);
+        north.add(BarrelEndcapFlag.ENDCAP_NORTH);
+        List<BarrelEndcapFlag> south = new ArrayList<BarrelEndcapFlag>();
+        south.add(BarrelEndcapFlag.BARREL);
+        south.add(BarrelEndcapFlag.ENDCAP_SOUTH);
+        List<List<BarrelEndcapFlag>> beflagcol = new ArrayList<List<BarrelEndcapFlag>>();
+        beflagcol.add(north);
+        beflagcol.add(south);
+        return beflagcol;
+        }
+        
+        public List<List<BarrelEndcapFlag>> getBEFlagLists() {
+            return _beflagcol;
+        }
+        
+        public void putBEFlagLists(List<List<BarrelEndcapFlag>> beflagcol) {
+            _beflagcol = beflagcol;
+            return;
+        }
+        
+        public void putStrategyList(List<SeedStrategy> strategylist) {
+            _strategylist = strategylist;
+            return;
+        }
+        
+    }
\ No newline at end of file
CVSspam 0.2.8