Print

Print


Commit in lcsim/src/org/lcsim/recon/tracking/seedtracker on MAIN
ConfirmerExtender.java+42-381.6 -> 1.7
FastCheck.java+74-221.3 -> 1.4
HitManager.java+13-81.3 -> 1.4
MaterialManager.java-41.3 -> 1.4
Sector.java+24-231.2 -> 1.3
SectorManager.java+84-341.2 -> 1.3
SeedTrackFinder.java+1-11.6 -> 1.7
SeedTracker.java+55-351.5 -> 1.6
+293-165
8 modified files
Several improvements to sectoring, code speed ups

lcsim/src/org/lcsim/recon/tracking/seedtracker
ConfirmerExtender.java 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- ConfirmerExtender.java	20 Jan 2009 19:19:52 -0000	1.6
+++ ConfirmerExtender.java	30 Jan 2009 15:34:42 -0000	1.7
@@ -120,12 +120,14 @@
                 double chisqbest = 1.e6;
 
                 //  Use the first seed hit for the fast check of additional hits
-                HelicalTrackHit checkhit = seedin.getHits().get(0);
+//                HelicalTrackHit checkhit = seedin.getHits().get(0);
 
 //                System.out.println("Trial seed with "+seedin.getHits().size()+" hits");
 
+                //  Create a list of hits to check for this layer / seed
+                List<HelicalTrackHit> hitlist = new ArrayList<HelicalTrackHit>();
+
                 //  Loop over the sectors with hits
-                SectorLoop:
                 for (Sector sector : sectorlist) {
 
                     //  Check that this candidate is compatible with the sector
@@ -134,59 +136,59 @@
 //                    System.out.println("Found a sector to check: "+
 //                            sector.Identifier()+" with "+sector.Hits().size()+" hits");
 
-                    //  Get the hits for this confirmation/extension sector
-                    List<HelicalTrackHit> hitlist = sector.Hits();
+                    //  Add the hits for this confirmation/extension sector to the hitlist
+                    hitlist.addAll(sector.Hits());
+                }
 
-                    SortHits comp = new SortHits(seedin.getHelix());
-                    Collections.sort(hitlist, comp);
+                SortHits comp = new SortHits(seedin.getHelix());
+                Collections.sort(hitlist, comp);
 
-                    if (diag != null) {
-                        diag.fireConfirmerExtenderWorkingSeedInfo(task, seedin, hitlist);
-                    }
+                if (diag != null) {
+                    diag.fireConfirmerExtenderWorkingSeedInfo(task, seedin, hitlist);
+                }
 
-                    //  For each hit in this confirmation/extension layer, make a test seed including the new hit
-                    for (HelicalTrackHit hit : hitlist) {
+                //  For each hit in this confirmation/extension layer, make a test seed including the new hit
+                for (HelicalTrackHit hit : hitlist) {
 
 //                        System.out.println("Checking a hit for viability");
-                        //  Check that this hit is potentially viable
-                        if (!checker.CheckHitPair(checkhit, hit)) continue;
+                    //  Check that this hit is potentially viable
+                    if (!checker.CheckHitSeed(hit, seedin)) continue;
 
-                        SeedCandidate test = new SeedCandidate(seedin);
-                        test.addHit(hit);
+                    SeedCandidate test = new SeedCandidate(seedin);
+                    test.addHit(hit);
 
-                        //  See if we have a successful fit
-                        boolean success = fitter.FitCandidate(test, strategy);
+                    //  See if we have a successful fit
+                    boolean success = fitter.FitCandidate(test, strategy);
 
 //                        System.out.println("Fit completed with status: "+success);
-                        if (success) {
+                    if (success) {
 
-                            //  Attach the fit to the test seed and add it to the list
-                            test.setHelix(fitter.getHelix());
-                            if (diag != null) {
-                                diag.fireConfirmerExtenderFitSuccess(task, seedin, hit, fitter, chisqbest, true);
-                            }
-                            newlist.add(test);
-                            chisqbest = Math.min(chisqbest, fitter.getHelix().chisqtot());
-
-                        } else {
-
-                            if (diag != null) {
-                                diag.fireConfirmerExtenderFitNoSuccess(task, seedin, hit, fitter, true);
-                            }
+                        //  Attach the fit to the test seed and add it to the list
+                        test.setHelix(fitter.getHelix());
+                        if (diag != null) {
+                            diag.fireConfirmerExtenderFitSuccess(task, seedin, hit, fitter, chisqbest, true);
+                        }
+                        newlist.add(test);
+                        chisqbest = Math.min(chisqbest, fitter.getHelix().chisqtot());
+
+                    } else {
+
+                        if (diag != null) {
+                            diag.fireConfirmerExtenderFitNoSuccess(task, seedin, hit, fitter, true);
+                        }
 //                            System.out.println("Fit Status: "+fitter.getFitStatus());
-                            if (fitter.getFitStatus() != FitStatus.CircleFitFailed) {
-                                double circlechisq = fitter.getCircleFit().chisq();
+                        if (fitter.getFitStatus() != FitStatus.CircleFitFailed) {
+                            double circlechisq = fitter.getCircleFit().chisq();
 
 //                                System.out.println("Delta chisq: "+(circlechisq-oldcirclechisq));
 
-                                if (circlechisq > oldcirclechisq + strategy.getMaxChisq()) {
-                                    continue SectorLoop;
-                                }
-                            }
+                            if (circlechisq > oldcirclechisq + strategy.getMaxChisq())
+                                break;
                         }
                     }
                 }
 
+                //  Finished checking hits to add to this seed candidate
                 //  If all fit tries for this layer are potentially bad hits, include the starting seed in the list
                 if (chisqbest - oldchisq > strategy.getBadHitChisq()) {
 //                    System.out.println("Keeping original fit with "+seedin.getHits().size()+" hits");
@@ -199,6 +201,7 @@
                 }
             }
 
+            //  Finished looping over the seeds we are trying to confirm/extend with this layer
             //  Use the new list of seeds as the working listinput to the next layer search
             seedlist = newlist;
 //            System.out.println("New list with "+seedlist.size()+" seeds");
@@ -210,7 +213,8 @@
             nleft--;
         }
 
-        //Check for seeds with sufficient numbers of confirmed/extended hits
+        //  Finished looping over all confirm/extend layers
+        //  Check for seeds with sufficient numbers of confirmed/extended hits
         for (SeedCandidate candidate : seedlist) {
             int hits = candidate.getHits().size();
 //            System.out.println("Final candidate with "+hits+" hits");

lcsim/src/org/lcsim/recon/tracking/seedtracker
FastCheck.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- FastCheck.java	20 Jan 2009 19:19:52 -0000	1.3
+++ FastCheck.java	30 Jan 2009 15:34:42 -0000	1.4
@@ -1,4 +1,3 @@
-
 package org.lcsim.recon.tracking.seedtracker;
 
 import org.lcsim.constants.Constants;
@@ -80,6 +79,15 @@
         return zOK;
     }
 
+    public boolean CheckHitSeed(HelicalTrackHit hit, SeedCandidate seed) {
+
+        //  Check the hit against each hit in the seed
+        for (HelicalTrackHit hit2: seed.getHits()) {
+            if (!CheckHitPair(hit, hit2)) return false;
+        }
+        return true;
+    }
+
     public boolean CheckSector(SeedCandidate seed, Sector sector) {
 
         //  Get limits on r, phi, and z for hits in this sector
@@ -113,25 +121,77 @@
             //  The maximum dphi is the sum of the track bend and half the sector span
             double dphimx = dphitrk + dphisec;
             if (dphi > dphimx) return false;
+
+            double smin1 = smin(rmin);
+            double smax1 = smax(rmax);
+            double r = hit.r();
+            double smin2 = smin(r);
+            double smax2 = smax(r);
+
+            //  Get the z limits for the hit
+            double zlen = 0.;
+            if (hit instanceof HelicalTrack2DHit) {
+                zlen = ((HelicalTrack2DHit) hit).zlen();
+            }
+            double zmin2 = hit.z() - 0.5 * zlen;
+            double zmax2 = zmin2 + zlen;
+
+            //  Check the z0 limits using the minimum path lengths
+            boolean zOK;
+            zOK = checkz0(smin1, zmin, zmax, smin(r), zmin2, zmax2);
+
+            //  If we failed, also try checking with the maximum path lengths
+            if (zOK) continue;
+                zOK = checkz0(smax1, zmin, zmax, smax(r), zmin2, zmax2);
+            
+            if (!zOK) return false;
         }
         return true;
     }
 
     public boolean CheckSectorPair(Sector s1, Sector s2) {
-        if (CheckPair(s1, s2)) return true;
-        return CheckPair(s2, s1);
-    }
 
-    private boolean CheckPair(Sector s1, Sector s2) {
-        double dphimx1 = dphimx(s1.rmin());
-        double dphimx2 = dphimx(s2.rmax());
-        double dphi = phidif(dphimx1, dphimx2);
+        //  Calculate the maximum change in azimuth
+        double dphi1rmin = dphimx(s1.rmin());
+        double dphi2rmin = dphimx(s2.rmin());
+        double dphi1rmax = dphimx(s1.rmax());
+        double dphi2rmax = dphimx(s2.rmax());
+        double dphi1 = phidif(dphi1rmax, dphi2rmin);
+        double dphi2 = phidif(dphi1rmin, dphi2rmax);
+
+        //  Calculate the angular difference between the midpoints of the 2 sectors
         double mid1 = (s1.phimax() + s1.phimin()) / 2.0;
-        double wid1 = s1.phimax() - mid1;
         double mid2 = (s2.phimax() + s2.phimin()) / 2.0;
-        double wid2 = s2.phimax() - mid2;
         double dmid = phidif(mid1, mid2);
-        return dmid < dphi + wid1 + wid2;
+
+        //  Calculate the half widths of the 2 sectors
+        double wid1 = s1.phimax() - mid1;
+        double wid2 = s2.phimax() - mid2;
+
+        //  Check that the sectors are compatible in the bend coordinate
+        boolean phiOK;
+        phiOK = dmid < dphi1 + wid1 + wid2;
+        if (!phiOK) phiOK = dmid < dphi2 + wid1 + wid2;
+        if (!phiOK) return false;
+
+        // Get the minimum and maximum path lengths
+        double s1min = smin(s1.rmin());
+        double s2min = smin(s2.rmin());
+        double s1max = smax(s1.rmax());
+        double s2max = smax(s2.rmax());
+
+        //  Get the minimum and maximum z's
+        double z1min = s1.zmin();
+        double z2min = s2.zmin();
+        double z1max = s1.zmax();
+        double z2max = s2.zmax();
+
+        //  Check that the sectors are compatible in the non-bend coordinate
+        boolean zOK;
+        zOK = checkz0(s1min, z1min, z1max, s2min, z2min, z2max);
+        if (!zOK) zOK = checkz0(s1max, z1min, z1max, s2max, z2min, z2max);
+
+        return zOK;
     }
 
     private double dphimx(double r) {
@@ -147,6 +207,7 @@
     }
 
     private boolean checkz0(double s1, double zmin1, double zmax1, double s2, double zmin2, double zmax2) {
+
         //  Check the minimum and maximum value for z0
         double zlim1 = (zmin1 * s2 - zmax2 * s1) / (s2 - s1);
         double zlim2 = (zmax1 * s2 - zmin2 * s1) / (s2 - s1);
@@ -156,27 +217,18 @@
         } else {
             checkz0 = (zlim2 <= _z0Max) && (zlim1 >= -_z0Max);
         }
+
         return checkz0;
     }
 
     private double phidif(double phi1, double phi2) {
 
         //  Find the magnitude of the phi difference
-        double phidif = Math.abs(rangephi(phi2) - rangephi(phi1));
+        double phidif = Math.abs(phi2 - phi1);
 
         //  Properly wrap around two pi to always give the smaller phi dif
         if (phidif > Math.PI) phidif = 2. * Math.PI - phidif;
         return phidif;
     }
 
-    private double rangephi(double phi) {
-        double rangephi = phi;
-        while (rangephi < 0.) {
-            rangephi += 2. * Math.PI;
-        }
-        while (rangephi > 2. * Math.PI) {
-            rangephi -= 2. * Math.PI;
-        }
-        return rangephi;
-    }
 }
\ No newline at end of file

lcsim/src/org/lcsim/recon/tracking/seedtracker
HitManager.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- HitManager.java	20 Jan 2009 19:19:52 -0000	1.3
+++ HitManager.java	30 Jan 2009 15:34:42 -0000	1.4
@@ -20,19 +20,12 @@
 public class HitManager {
 
     private SectorManager _smanager;
-    private int _nphinom = 4;
-    private double _detanom = 1.;
 
     /** Creates a new instance of HitManager */
     public HitManager() {
 
         // Instantiate a default sector manager with coarse sectoring
-        _smanager = new SectorManager(_nphinom, _detanom);
-    }
-
-    public void setSectorParams(int nphi, double deta) {
-        _smanager = new SectorManager(nphi, deta);
-        return;
+        _smanager = new SectorManager();
     }
 
     /**
@@ -55,6 +48,18 @@
         }
     }
 
+    public SectorManager getSectorManager() {
+        return _smanager;
+    }
+
+    public void setSectorParams(int nphi, double dz) {
+        _smanager.setSectorParams(nphi, dz);
+    }
+
+    public void setSectorParams(List<SeedStrategy> slist, double bfield, double rtrk) {
+        _smanager.setSectorParams(slist, bfield, rtrk);
+    }
+    
     public List<Sector> getSectors(SeedLayer seedlayer) {
         return _smanager.getSectors(seedlayer);
     }

lcsim/src/org/lcsim/recon/tracking/seedtracker
MaterialManager.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- MaterialManager.java	7 Jan 2009 02:41:39 -0000	1.3
+++ MaterialManager.java	30 Jan 2009 15:34:42 -0000	1.4
@@ -13,10 +13,6 @@
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
-import org.lcsim.detector.DetectorIdentifierHelper;
-import org.lcsim.detector.IDetectorElement;
-import org.lcsim.detector.identifier.IIdentifier;
-import org.lcsim.detector.identifier.IIdentifierHelper;
 import org.lcsim.detector.ILogicalVolume;
 import org.lcsim.detector.IPhysicalVolume;
 import org.lcsim.detector.IPhysicalVolumeNavigator;

lcsim/src/org/lcsim/recon/tracking/seedtracker
Sector.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- Sector.java	20 Jan 2009 19:19:53 -0000	1.2
+++ Sector.java	30 Jan 2009 15:34:42 -0000	1.3
@@ -1,8 +1,3 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
 package org.lcsim.recon.tracking.seedtracker;
 
 import java.util.ArrayList;
@@ -10,6 +5,7 @@
 
 import org.lcsim.fit.helicaltrack.HelicalTrack2DHit;
 import org.lcsim.fit.helicaltrack.HelicalTrackHit;
+import org.lcsim.geometry.subdetector.BarrelEndcapFlag;
 
 /**
  *
@@ -20,7 +16,7 @@
     private String _layerID;
     private List<HelicalTrackHit> _hitlist;
     private int _phisector;
-    private int _etasector;
+    private int _zsector;
     private double _rmin;
     private double _rmax;
     private double _phimin;
@@ -29,21 +25,21 @@
     private double _zmax;
     private double _philo;
     private double _phihi;
-    private double _etalo;
-    private double _etahi;
+    private double _zlo;
+    private double _zhi;
 
-    public Sector(String identifier, String layerID, int phisector, int etasector,
-            double philo, double phihi, double etalo, double etahi) {
+    public Sector(String identifier, String layerID, int phisector, int zsector,
+            double philo, double phihi, double zlo, double zhi) {
 
         //  Save the identifier, indices, and limits for this sector
         _identifier = identifier;
         _layerID = layerID;
         _phisector = phisector;
-        _etasector = etasector;
+        _zsector = zsector;
         _philo = philo;
         _phihi = phihi;
-        _etalo = etalo;
-        _etahi = etahi;
+        _zlo = zlo;
+        _zhi = zhi;
 
         //  Initialize the hit list
         _hitlist = new ArrayList<HelicalTrackHit>();
@@ -66,9 +62,14 @@
         double phi = hit.phi();
         if (phi < _philo || phi > _phihi) SectorError();
 
-        //  Check that eta is within limits
-        double eta = SectorManager.Eta(hit);
-        if (eta < _etalo || eta > _etahi) SectorError();
+        //  Check that z is within limits
+        double z;
+        if (hit.BarrelEndcapFlag() == BarrelEndcapFlag.BARREL) {
+            z = hit.z();
+        } else {
+            z = hit.r();
+        }
+        if (z < _zlo || z > _zhi) SectorError();
 
         //  Add the hit to the list for this sector
         _hitlist.add(hit);
@@ -89,7 +90,7 @@
         _phimin = Math.min(_phimin, phi);
         _phimax = Math.max(_phimax, phi);
         _zmin = Math.min(_zmin, zmin);
-        _zmax = Math.min(_zmax, zmax);
+        _zmax = Math.max(_zmax, zmax);
     }
 
     public String Identifier() {
@@ -132,8 +133,8 @@
         return _phisector;
     }
     
-    public int etaSector() {
-        return _etasector;
+    public int zSector() {
+        return _zsector;
     }
     
     public double philo() {
@@ -144,12 +145,12 @@
         return _phihi;
     }
     
-    public double etalo() {
-        return _etalo;
+    public double zlo() {
+        return _zlo;
     }
     
-    public double etahi() {
-        return _etahi;
+    public double zhi() {
+        return _zhi;
     }
 
     private void SectorError() {

lcsim/src/org/lcsim/recon/tracking/seedtracker
SectorManager.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- SectorManager.java	20 Jan 2009 19:19:53 -0000	1.2
+++ SectorManager.java	30 Jan 2009 15:34:42 -0000	1.3
@@ -4,7 +4,9 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import org.lcsim.constants.Constants;
 import org.lcsim.fit.helicaltrack.HelicalTrackHit;
+import org.lcsim.geometry.subdetector.BarrelEndcapFlag;
 
 /**
  *
@@ -17,17 +19,14 @@
     private Map<String, List<Sector>> _slistmap;
     private int _nphi;
     private double _dphi;
-    private double _deta;
+    private double _dz;
+    private int _nphi0 = 20;
+    private double _dz0 = 200.;
 
-    public SectorManager(int nphi, double deta) {
+    public SectorManager() {
 
-        //  Check that we have valid inputs
-        if (nphi <= 0 || deta <= 0.) throw new RuntimeException("Illegal Sectoring");
-
-        //  Save the sector indexing info
-        _nphi = nphi;
-        _dphi = 2. * Math.PI / _nphi;
-        _deta = deta;
+        //  Set the default sector parameters
+        setSectorParams(_nphi0, _dz0);
 
         //  Create the list of sectors with hits
         _sectorlist = new ArrayList<Sector>();
@@ -40,7 +39,7 @@
     }
 
     public void AddHit(HelicalTrackHit hit) {
-        
+
         //  Get the sector identifier for this hit
         String identifier = FindSectorIdentifier(hit);
 
@@ -54,7 +53,7 @@
             //  See if we need to create a new list of Sensors for this detector layer
             String lyrid = sector.LayerID();
             if (!_slistmap.containsKey(lyrid)) {
-               List<Sector> slist = new ArrayList<Sector>();
+                List<Sector> slist = new ArrayList<Sector>();
                 _slistmap.put(lyrid, slist);
             }
 
@@ -64,7 +63,7 @@
         } else {
             sector = _sectormap.get(identifier);
         }
-        
+
         //  Add the hit to the sector
         sector.addHit(hit);
     }
@@ -87,41 +86,86 @@
     public void Initialize() {
         _sectorlist.clear();
         _sectormap.clear();
+        _slistmap.clear();
+    }
+
+    public void setSectorParams(int nphi, double dz) {
+        _nphi = nphi;
+        _dphi = 2. * Math.PI / _nphi;
+        _dz = dz;
+    }
+
+    public void setSectorParams(List<SeedStrategy> slist, double bfield, double rtrk) {
+
+        //  Default to the default sectoring
+        int nphi = _nphi0;
+        double dz = _dz0;
+
+        //  See if we have defined strategies
+        if (slist != null) {
+            int nstrat = slist.size();
+            if (nstrat > 0) {
+
+                //  Find the average pTMin and MaxZ0
+                double dzsum = 0.;
+                double ptsum = 0.;
+                for (SeedStrategy strategy : slist) {
+                    ptsum += strategy.getMinPT();
+                    dzsum += strategy.getMaxZ0();
+                }
+                double ptave = ptsum / nstrat;
+                double dzave = dzsum / nstrat;
+
+                //  If there is a bfield defined, set the size of a phi
+                //  segmentation slice to half the change in angle for a
+                //  the average minimum momentum particle
+                if (bfield > 0.) {
+                    double RMin = ptave / (Constants.fieldConversion * bfield);
+                    double dphi = Math.atan(rtrk / (2. * RMin));
+                    nphi = (int) Math.floor(2. * Math.PI / dphi);
+                }
+
+                //  Set the z sectoring to match the average MaxZ0
+                dz = dzave;
+            }
+        }
+
+        //  Save the sector parameters
+        setSectorParams(nphi, dz);
+        System.out.println("nphi: " + _nphi + " dz: " + _dz);
+
+        return;
     }
 
     private Sector CreateSector(HelicalTrackHit hit) {
         String identifier = FindSectorIdentifier(hit);
         String lyrid = hit.getLayerIdentifier();
         int phibin = PhiBin(hit);
-        int etabin = EtaBin(hit);
+        int zbin = ZBin(hit);
         double phimin = PhiMin(phibin);
         double phimax = PhiMax(phibin);
-        double etamin = EtaMin(etabin);
-        double etamax = EtaMax(etabin);
-        return new Sector(identifier, lyrid, phibin, etabin, phimin, phimax, etamin, etamax);
+        double zmin = ZMin(zbin);
+        double zmax = ZMax(zbin);
+        return new Sector(identifier, lyrid, phibin, zbin, phimin, phimax, zmin, zmax);
     }
 
     private String FindSectorIdentifier(HelicalTrackHit hit) {
         String layerID = hit.getLayerIdentifier();
         int phibin = PhiBin(hit);
-        int etabin = EtaBin(hit);
-        return SectorID(layerID, phibin, etabin);
+        int zbin = ZBin(hit);
+        return SectorID(layerID, phibin, zbin);
     }
 
-    private String SectorID(String layerID, int phibin, int etabin) {
-        return layerID+"phi"+phibin+"eta"+etabin;
+    private String SectorID(String layerID, int phibin, int zbin) {
+        return layerID + "phi" + phibin + "z" + zbin;
     }
 
     private int PhiBin(HelicalTrackHit hit) {
-        double phi = hit.phi();
-        int phibin = (int) Math.floor(phi / _dphi);
-        return phibin;
+        return (int) Math.floor(hit.phi() / _dphi);
     }
 
-    private int EtaBin(HelicalTrackHit hit) {
-        double eta = Eta(hit);
-        int etabin = (int) Math.floor(eta / _deta);
-        return etabin;
+    private int ZBin(HelicalTrackHit hit) {
+        return (int) Math.floor(z(hit) / _dz);
     }
 
     private double PhiMin(int phibin) {
@@ -132,16 +176,22 @@
         return (phibin + 1) * _dphi;
     }
 
-    private double EtaMin(int etabin) {
-        return etabin * _deta;
+    private double ZMin(int zbin) {
+        return zbin * _dz;
     }
 
-    private double EtaMax(int etabin) {
-        return (etabin + 1) * _deta;
+    private double ZMax(int zbin) {
+        return (zbin + 1) * _dz;
     }
 
-    public static double Eta(HelicalTrackHit hit) {
-        double theta = Math.acos(hit.z() / hit.r());
-        return -Math.log(Math.tan(theta/2.0));
+    public static double z(HelicalTrackHit hit) {
+        double z;
+        if (hit.BarrelEndcapFlag() == BarrelEndcapFlag.BARREL) {
+            z = hit.z();
+        } else {
+            //  If this is an endcap disk, use the r coordinate rather than z
+            z = hit.r();
+        }
+        return z;
     }
 }
\ No newline at end of file

lcsim/src/org/lcsim/recon/tracking/seedtracker
SeedTrackFinder.java 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- SeedTrackFinder.java	20 Jan 2009 19:19:53 -0000	1.6
+++ SeedTrackFinder.java	30 Jan 2009 15:34:42 -0000	1.7
@@ -63,7 +63,7 @@
         //  Find the valid sector combinations
         SeedSectoring ss = new SeedSectoring(_hitmanager, strategy, bfield, seedlayerlist);
         List<List<Sector>> sslist = ss.SeedSectors();
-//        System.out.println("Number of SeedSectors: "+sslist.size());
+        System.out.println("Number of SeedSectors: "+sslist.size());
 
         //  Initialize counters
         int nfit = 0;

lcsim/src/org/lcsim/recon/tracking/seedtracker
SeedTracker.java 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- SeedTracker.java	20 Jan 2009 19:19:53 -0000	1.5
+++ SeedTracker.java	30 Jan 2009 15:34:42 -0000	1.6
@@ -4,7 +4,6 @@
  * Created on August 16, 2005, 8:54 AM
  *
  */
-
 package org.lcsim.recon.tracking.seedtracker;
 
 import hep.physics.vec.BasicHep3Vector;
@@ -17,7 +16,6 @@
 import org.lcsim.recon.tracking.seedtracker.diagnostic.ISeedTrackerDiagnostics;
 import org.lcsim.util.Driver;
 
-
 /**
  * Tracking algorithm based on forming track seeds from all 3-hit combinations,
  * confirming this tentantive helix by requiring additional hits, and extending
@@ -28,6 +26,7 @@
  * @version 1.0
  */
 public class SeedTracker extends Driver {
+
     private List<SeedStrategy> _strategylist;
     private ISeedTrackerDiagnostics _diag = null;
     private MaterialManager _materialmanager;
@@ -35,33 +34,38 @@
     private HelixFitter _helixfitter;
     private SeedTrackFinder _finder;
     private MakeTracks _maketracks;
-    private Hep3Vector _IP = new BasicHep3Vector(0.,0.,0.);
-    private double _bfield;
-    
+    private Hep3Vector _IP = new BasicHep3Vector(0., 0., 0.);
+    private double _bfield = 0.;
+    private double _rtrk = 1000.;
+    private boolean _autosectoring = true;
+
     /** Creates a new instance of SeedTracker */
     public SeedTracker() {
         this(new DefaultStrategy().getStrategyList());
     }
-    
+
     public SeedTracker(List<SeedStrategy> strategylist) {
         _strategylist = strategylist;
-        
+
         //  Instantiate the material manager
         _materialmanager = new MaterialManager();
-        
+
         //  Instantiate the hit manager
         _hitmanager = new HitManager();
-        
+
+        //  Initialize the detector sectoring
+        _hitmanager.getSectorManager().setSectorParams(_strategylist, _bfield, _rtrk);
+
         //  Instantiate the helix finder
         _helixfitter = new HelixFitter(_materialmanager);
-        
+
         //  Instantiate the Seed Finder
         _finder = new SeedTrackFinder(_hitmanager, _helixfitter);
-        
+
         //  Instantiate the Track Maker
         _maketracks = new MakeTracks();
     }
-    
+
     /**
      * Invoke the track finding algorithm
      * @param event EventHeader for this event
@@ -70,46 +74,54 @@
     protected void process(EventHeader event) {
 
         //  Pass the event to the diagnostics package
-        if(_diag!=null) _diag.setEvent(event);
-        
+        if (_diag != null) _diag.setEvent(event);
+
         //  Sort the hits for this event
         _hitmanager.OrganizeHits(event);
-        
+
         //  Clear the list of track seeds accumulated in the track finder
         _finder.clearTrackSeedList();
-        
+
         //  Loop over strategies and perform track finding
         for (SeedStrategy strategy : _strategylist) {
-            
+
             //  Set the strategy for the diagnostics
-            if(_diag!=null) _diag.fireStrategyChanged(strategy);
+            if (_diag != null) _diag.fireStrategyChanged(strategy);
 
             //  Perform track finding under this strategy
             _finder.FindTracks(strategy, _bfield);
         }
-        
+
         //  Get the list of final list of SeedCandidates
         List<SeedCandidate> trackseeds = _finder.getTrackSeeds();
-        if(_diag!=null) _diag.fireFinalDiagnostics(trackseeds);
-        
+        if (_diag != null) _diag.fireFinalDiagnostics(trackseeds);
+
         //  Make tracks from the final list of track seeds
         _maketracks.Process(event, trackseeds, _bfield);
-        
+
         return;
     }
-    
+
     @Override
-    protected void detectorChanged(Detector detector){
-        
+    protected void detectorChanged(Detector detector) {
+
         //  Only build the model when the detector is changed
         _materialmanager.BuildModel(detector);
-        
+
         //  Find the bfield and pass it to the helix fitter and diagnostic package
         _bfield = detector.getFieldMap().getField(_IP).z();
-        if (_diag!=null) _diag.setBField(_bfield);
+        if (_diag != null) _diag.setBField(_bfield);
         _helixfitter.setBField(_bfield);
+
+        //  Get the tracking radius
+        _rtrk = _materialmanager.getRMax();
+
+        //  Set the sectoring parameters
+        if (_autosectoring) {
+            _hitmanager.setSectorParams(_strategylist, _bfield, _rtrk);
+        }
     }
-    
+
     /**
      * Specifiy the strategies to be used by the SeedTracker algorithm.  Invoking this
      * method will override the default strategies defined by the DefaultStrategy
@@ -117,25 +129,33 @@
      * @param strategylist List of strategies to be used
      */
     public void putStrategyList(List<SeedStrategy> strategylist) {
-        
+
         //  Save the strategy list
         _strategylist = strategylist;
+
+        //  Set the sectoring parameters
+        if (_autosectoring) {
+            _hitmanager.setSectorParams(strategylist, _bfield, _rtrk);
+        }
+
         return;
     }
 
-    public void setSectorParams(int nphi, double deta) {
-        _hitmanager.setSectorParams(nphi, deta);
+    public void setSectorParams(int nphi, double dz) {
+        _hitmanager.setSectorParams(nphi, dz);
+        _autosectoring = false;
+        return;
     }
 
-    public void setDiagnostics(ISeedTrackerDiagnostics d){
-        
+    public void setDiagnostics(ISeedTrackerDiagnostics d) {
+
         //  Set the diagnostic package
         _diag = d;
         _helixfitter.setDiagnostics(_diag);
         _finder.setDiagnostic(_diag);
-        
+
         //  Pass the hit manager, material manager, and bfield to the diagnostic package
-        if (_diag!=null) {
+        if (_diag != null) {
             _diag.setMaterialManager(_materialmanager);
             _diag.setHitManager(_hitmanager);
             _diag.setBField(_bfield);
CVSspam 0.2.8