2 added + 5 modified, total 7 files
lcsim/src/org/lcsim/recon/tracking/seedtracker
diff -N Sector.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Sector.java 18 Jan 2009 00:21:22 -0000 1.1
@@ -0,0 +1,59 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.lcsim.recon.tracking.seedtracker;
+
+/**
+ *
+ * @author partridge
+ */
+public class Sector {
+ private int _phisector;
+ private int _etasector;
+ private double _phimin;
+ private double _phimax;
+ private double _etamin;
+ private double _etamax;
+
+ public Sector(int phisector, int etasector, double phimin, double phimax,
+ double etamin, double etamax) {
+
+ // Save the information defining this sector
+ _phisector = phisector;
+ _etasector = etasector;
+ _phimin = phimin;
+ _phimax = phimax;
+ _etamin = etamin;
+ _etamax = etamax;
+ }
+
+ public int phiSector() {
+ return _phisector;
+ }
+
+ public int etaSector() {
+ return _etasector;
+ }
+
+ public double phimin() {
+ return _phimin;
+ }
+
+ public double phimax() {
+ return _phimax;
+ }
+
+ public double etamin() {
+ return _etamin;
+ }
+
+ public double etamax() {
+ return _etamax;
+ }
+
+ public String SectorID() {
+ return "phi"+_phisector+"eta"+_etasector;
+ }
+}
lcsim/src/org/lcsim/recon/tracking/seedtracker
diff -N SectorManager.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ SectorManager.java 18 Jan 2009 00:21:22 -0000 1.1
@@ -0,0 +1,42 @@
+
+package org.lcsim.recon.tracking.seedtracker;
+
+import java.util.List;
+import org.lcsim.fit.helicaltrack.HelicalTrackHit;
+
+/**
+ *
+ * @author Richard Partridge
+ */
+public class SectorManager {
+
+ private List<Sector> _sectorlist;
+ private int _nphi;
+ private double _dphi;
+ private double _deta;
+
+ public SectorManager(int nphi, double deta) {
+ _nphi = nphi;
+ if (_nphi == 0) throw new RuntimeException("Illegal Sectoring");
+
+ _dphi = 2. * Math.PI / _nphi;
+ _deta = deta;
+ }
+
+ public Sector FindSector(HelicalTrackHit hit) {
+ double phi = hit.phi();
+ double eta = eta(hit);
+ int phibin = (int) Math.floor(phi / _dphi);
+ int etabin = (int) Math.floor(eta / _deta);
+ double phimin = phibin * _dphi;
+ double phimax = phimin + _dphi;
+ double etamin = etabin * _deta;
+ double etamax = etamin + _deta;
+ return new Sector(phibin, etabin, phimin, phimax, etamin, etamax);
+ }
+
+ private double eta(HelicalTrackHit hit) {
+ double theta = Math.acos(hit.z() / hit.r());
+ return -Math.log(Math.tan(theta/2.0));
+ }
+}
lcsim/src/org/lcsim/recon/tracking/seedtracker
diff -u -r1.4 -r1.5
--- ConfirmerExtender.java 16 Jan 2009 17:22:51 -0000 1.4
+++ ConfirmerExtender.java 18 Jan 2009 00:21:22 -0000 1.5
@@ -94,79 +94,87 @@
// Loop over the confirmation/extension layers
for (SeedLayer lyr : lyrs) {
- // Get the hits on this confirmation/extension layer
- List<HelicalTrackHit> hitlist = hmanager.getTrackerHits(lyr);
- if (hitlist.size() == 0) continue;
-
// Create a list for seeds that are confirmed/extended using the current layer
List<SeedCandidate> newlist = new ArrayList<SeedCandidate>();
- // Loop over the input seeds for this layer search
- for (SeedCandidate seedin : seedlist) {
-
- SortHits comp = new SortHits(seedin.getHelix());
- Collections.sort(hitlist, comp);
+ // Get the list of sectors with hits and loop over sectors
+ List<Sector> sectorlist = hmanager.getSectorList(lyr);
+ for (Sector sector : sectorlist) {
+
+ // Loop over the input seeds for this layer search
+ for (SeedCandidate seedin : seedlist) {
+
+ // Check that this candidate is compatible with the sector
+ if (!checker.CheckSector(hmanager, seedin, lyr, sector)) continue;
+
+ // Get the hits on this confirmation/extension layer
+ List<HelicalTrackHit> hitlist = hmanager.getTrackerHits(lyr, sector);
+
+ SortHits comp = new SortHits(seedin.getHelix());
+ Collections.sort(hitlist, comp);
+
+ // Retrieve the chisq for the last fit and initialize the best fit chisq for this layer
+ double oldchisq = seedin.getHelix().chisqtot();
+ double oldcirclechisq = seedin.getHelix().chisq()[0];
+ double chisqbest = 1.e6;
- // Retrieve the chisq for the last fit and initialize the best fit chisq for this layer
- double oldchisq = seedin.getHelix().chisqtot();
- double oldcirclechisq = seedin.getHelix().chisq()[0];
- double chisqbest = 1.e6;
-
- if (diag != null) {
- diag.fireConfirmerExtenderWorkingSeedInfo(task, seedin, hitlist);
- }
+ if (diag != null) {
+ diag.fireConfirmerExtenderWorkingSeedInfo(task, seedin, hitlist);
+ }
- // Use the first seed hit for the fast check of additional hits
- HelicalTrackHit checkhit = seedin.getHits().get(0);
+ // Use the first seed hit for the fast check of additional hits
+ HelicalTrackHit checkhit = seedin.getHits().get(0);
- // 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) {
- // Check that this hit is potentially viable
- if (!checker.CheckHitPair(checkhit, hit)) continue;
+ // Check that this hit is potentially viable
+ if (!checker.CheckHitPair(checkhit, hit)) 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);
- if (!success) {
+ if (!success) {
- if (diag != null) {
- diag.fireConfirmerExtenderFitNoSuccess(task, seedin, hit, fitter, true);
+ if (diag != null) {
+ diag.fireConfirmerExtenderFitNoSuccess(task, seedin, hit, fitter, true);
+ }
+ if (fitter.getFitStatus() != FitStatus.CircleFitFailed) {
+ double circlechisq = fitter.getCircleFit().chisq();
+ if (circlechisq > oldcirclechisq + strategy.getMaxChisq()) {
+ break;
+ }
+ }
+ continue;
}
- if (fitter.getFitStatus() != FitStatus.CircleFitFailed) {
- double circlechisq = fitter.getCircleFit().chisq();
- if (circlechisq > oldcirclechisq + strategy.getMaxChisq()) {
- break;
+ 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());
}
- continue;
}
- if (success) {
- // Attach the fit to the test seed and add it to the list
- test.setHelix(fitter.getHelix());
+ // If all fit tries for this layer are potentially bad hits, include the starting seed in the list
+ if (chisqbest - oldchisq > strategy.getBadHitChisq()) {
+ newlist.add(seedin);
if (diag != null) {
- diag.fireConfirmerExtenderFitSuccess(task, seedin, hit, fitter, chisqbest, true);
+ diag.fireConfirmerExtenderAllHitsPotentiallyBad(task, seedin, hitlist, chisqbest, oldchisq);
}
- newlist.add(test);
- chisqbest = Math.min(chisqbest, fitter.getHelix().chisqtot());
+ } else {
+ n++;
}
}
-
- // If all fit tries for this layer are potentially bad hits, include the starting seed in the list
- if (chisqbest - oldchisq > strategy.getBadHitChisq()) {
- newlist.add(seedin);
- if (diag != null) {
- diag.fireConfirmerExtenderAllHitsPotentiallyBad(task, seedin, hitlist, chisqbest, oldchisq);
- }
- } else {
- n++;
- }
}
+
// Use the new list of seeds as the working listinput to the next layer search
seedlist = newlist;
if (diag != null) {
lcsim/src/org/lcsim/recon/tracking/seedtracker
diff -u -r1.1 -r1.2
--- FastCheck.java 16 Jan 2009 17:22:51 -0000 1.1
+++ FastCheck.java 18 Jan 2009 00:21:22 -0000 1.2
@@ -20,7 +20,7 @@
private double _z0Max;
private double _r1;
private double _phi1;
- private double _dphi1mx;
+ private double _dphimx1;
private double _zmin1;
private double _zmax1;
private double _s1min;
@@ -39,15 +39,15 @@
if (hit1 != _hit1cache) {
_r1 = hit1.r();
_phi1 = hit1.phi();
- _dphi1mx = Math.asin((2 * _RMin * _dMax - _dMax * _dMax - _r1 * _r1) / (2 * _r1 * (_RMin - _dMax)));
+ _dphimx1 = dphimx(_r1);
double zlen1 = 0.;
if (hit1 instanceof HelicalTrack2DHit) {
zlen1 = ((HelicalTrack2DHit) hit1).zlen();
}
_zmin1 = hit1.z() - 0.5 * zlen1;
_zmax1 = _zmin1 + zlen1;
- _s1min = _r1 - _dMax;
- _s1max = 2.0 * _RMin * Math.asin((_r1 + _dMax) / (2.0 * _RMin));
+ _s1min = smin(_r1);
+ _s1max = smax(_r1);
_hit1cache = hit1;
}
@@ -56,17 +56,14 @@
double phi2 = hit2.phi();
// Get the maximum deviation in phi from a radial track given the cuts on radius of curvature and DCA
- double dphi2mx = Math.asin((2 * _RMin * _dMax - _dMax * _dMax - r2 * r2) / (2 * r2 * (_RMin - _dMax)));
+ double dphimx2 = dphimx(r2);
// Calculate the difference in azimuthal angle between these two hits, which should always be positive
- double dphi = Math.abs(phi2 - _phi1);
- if (dphi > Math.PI) {
- dphi = 2. * Math.PI - dphi;
- }
+ double dphi = phidif(phi2, _phi1);
+ double dphimx = phidif(dphimx2, _dphimx1);
// Check that the difference in azimuthal angle is less than the difference in maximum phi deviations
- boolean phiOK = dphi <= Math.abs(dphi2mx - _dphi1mx);
- if (!phiOK) return false;
+ if (dphi > dphimx) return false;
// Get the z limits for the hit2
double zlen2 = 0.;
@@ -78,17 +75,66 @@
// Check the z0 limits using the minimum path lengths
boolean zOK;
- double s2min = r2 - _dMax;
- zOK = checkz0(_s1min, _zmin1, _zmax1, s2min, zmin2, zmax2);
+ zOK = checkz0(_s1min, _zmin1, _zmax1, smin(r2), zmin2, zmax2);
// If we failed, also try checking with the maximum path lengths
- if (!zOK) {
- double s2max = 2.0 * _RMin * Math.asin((r2 + _dMax) / (2.0 * _RMin));
- zOK = checkz0(_s1max, _zmin1, _zmax1, s2max, zmin2, zmax2);
- }
+ if (!zOK) zOK = checkz0(_s1max, _zmin1, _zmax1, smax(r2), zmin2, zmax2);
+
return zOK;
}
+ public boolean CheckSector(HitManager hmanager, SeedCandidate seed, SeedLayer layer, Sector sector) {
+
+ // Get the identifier for this sector
+ String identifier = hmanager.MakeFullIdentifier(layer, sector);
+
+ // Get limits on r, phi, and z for hits in this layer
+ double rmin = hmanager.getRMin(identifier);
+ double rmax = hmanager.getRMax(identifier);
+ double phimin = hmanager.getPhiMin(identifier);
+ double phimax = hmanager.getPhiMax(identifier);
+ double zmin = hmanager.getZMin(identifier);
+ double zmax = hmanager.getZMax(identifier);
+
+ // Calculate the maximum phi deviation from a straight-line track for this layer
+ double dphimxsec1 = dphimx(rmax);
+ double dphimxsec2 = dphimx(rmin);
+
+ // Calculate the midpoint and half the span in phi for this layer
+ double midphisec = (phimin + phimax) / 2.;
+ double dphisec = 0.5 * (phimax - phimin);
+
+ // Check each hit for compatibility with this sector
+ for (HelicalTrackHit hit : seed.getHits()) {
+
+ // Calculate the max track angle change between the hit and sector layer
+ double dphimxhit = dphimx(hit.r());
+ double dphitrk1 = phidif(dphimxsec1, dphimxhit);
+ double dphitrk2 = phidif(dphimxsec2, dphimxhit);
+ double dphitrk = Math.max(dphitrk1, dphitrk2);
+
+ // Calculate the phi dev between the hit and midpoint of the sector
+ double dphi = phidif(hit.phi(), midphisec);
+
+ // The maximum dphi is the sum of the track bend and half the sector span
+ double dphimx = dphitrk + dphisec;
+ if (dphi > dphimx) return false;
+ }
+ return true;
+ }
+
+ private double dphimx(double r) {
+ return Math.asin((2 * _RMin * _dMax - _dMax * _dMax - r * r) / (2 * r * (_RMin - _dMax)));
+ }
+
+ private double smin(double r) {
+ return r - _dMax;
+ }
+
+ private double smax(double r) {
+ return 2.0 * _RMin * Math.asin((r + _dMax) / (2.0 * _RMin));
+ }
+
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);
@@ -101,4 +147,25 @@
}
return checkz0;
}
+
+ private double phidif(double phi1, double phi2) {
+
+ // Find the magnitude of the phi difference
+ double phidif = Math.abs(rangephi(phi2) - rangephi(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
diff -u -r1.1 -r1.2
--- HitManager.java 27 Aug 2008 17:59:02 -0000 1.1
+++ HitManager.java 18 Jan 2009 00:21:22 -0000 1.2
@@ -3,23 +3,16 @@
*
* 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.recon.tracking.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.fit.helicaltrack.HelicalTrackHit;
import org.lcsim.fit.helicaltrack.HelicalTrack2DHit;
-import org.lcsim.fit.helicaltrack.HelicalTrack3DHit;
+import org.lcsim.fit.helicaltrack.HelicalTrackHit;
import org.lcsim.geometry.subdetector.BarrelEndcapFlag;
/**
@@ -28,165 +21,240 @@
* @version 1.0
*/
public class HitManager {
+
+ private SectorManager _smanager;
private HashMap<String, List<HelicalTrackHit>> _hitlist;
+ private HashMap<String, List<Sector>> _sectorlist;
+ private HashMap<String, Sector> _sector;
private HashMap<String, Double> _rmin;
private HashMap<String, Double> _rmax;
+ private HashMap<String, Double> _phimin;
+ private HashMap<String, Double> _phimax;
private HashMap<String, Double> _zmin;
private HashMap<String, Double> _zmax;
-
+ 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;
}
-
+
/**
* 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) {
+
+ // Create the hash maps
_hitlist = new HashMap<String, List<HelicalTrackHit>>();
+ _sectorlist = new HashMap<String, List<Sector>>();
+ _sector = new HashMap<String, Sector>();
_rmin = new HashMap<String, Double>();
_rmax = new HashMap<String, Double>();
+ _phimin = new HashMap<String, Double>();
+ _phimax = new HashMap<String, Double>();
_zmin = new HashMap<String, Double>();
_zmax = new HashMap<String, Double>();
+
+ // Retrieve the HelicalTrackHits and loop over the hits
List<HelicalTrackHit> hitcol = (List<HelicalTrackHit>) event.get("HelicalTrackHits");
for (HelicalTrackHit hit : hitcol) {
- String identifier = hit.getLayerIdentifier();
- if (!_hitlist.containsKey(identifier)) {
- _hitlist.put(identifier, new ArrayList<HelicalTrackHit>());
- _rmin.put(identifier,9999999.);
- _rmax.put(identifier,0.);
- _zmin.put(identifier,9999999.);
- _zmax.put(identifier,-9999999.);
+
+ // Create a sector for this hit
+ Sector sector = _smanager.FindSector(hit);
+
+ // Construct identifier strings for the hit and hit+sector
+ String hitid = hit.getLayerIdentifier();
+ String fullid = hitid + sector.SectorID();
+
+ // Create the sector list for this hit ID if it doesn't exist
+ if (!_sectorlist.containsKey(hitid))
+ _sectorlist.put(hitid, new ArrayList<Sector>());
+
+ // Save the sector
+ if (!_sector.containsKey(fullid)) {
+ _sector.put(fullid, sector);
+ _sectorlist.get(hitid).add(sector);
}
- List<HelicalTrackHit> hits = _hitlist.get(identifier);
- hits.add(hit);
-// BarrelEndcapFlag beflag = getBarrelEndcapFlag(hit);
-// if (isPixel(hit)) {
-// hits.add(hit);
-// } else {
-// double zmin = getZMin(hit);
-// double zmax = getZMax(hit);
-// hits.add(new HelicalTrack2DHit(hit, zmin, zmax));
-// }
-// _hitlist.get(identifier).add(new HelicalTrack3DHit(hit, getBarrelEndcapFlag(hit)));
- double r = hit.r();
- double z = hit.z();
- 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<HelicalTrackHit> getTrackerHits(String detname, int layer, BarrelEndcapFlag beflag) {
-// return new ArrayList<HelicalTrackHit>(_hitlist.get(Identifier(detname, layer, beflag)));
- // Get the identifier for this layer and return the appropriate hit list (if any)
- String id = MakeIdentifier(detname, layer, beflag);
- List<HelicalTrackHit> hitlist;
- if (_hitlist.containsKey(id)) {
- hitlist = _hitlist.get(id);
- }
- else {
- hitlist = new ArrayList<HelicalTrackHit>();
+
+ // Update the statistics for both the sector and full layer
+ Update(hitid, hit);
+ Update(fullid, hit);
}
- return hitlist;
}
-
+
/**
* Return the list of tracker hits associated with a specified SeedLayer
* @param seedlayer Seedlayer to look at
* @return List of TrackerHits
*/
public List<HelicalTrackHit> getTrackerHits(SeedLayer seedlayer) {
-// List<HelicalTrackHit> hits = new ArrayList<HelicalTrackHit>();
-// String identifier = Identifier(seedlayer.getDetName(),seedlayer.getLayer(),seedlayer.getBarrelEndcapFlag());
-// if (_hitlist.containsKey(identifier)) hits.addAll(_hitlist.get(identifier));
- return getTrackerHits(seedlayer.getDetName(), seedlayer.getLayer(), seedlayer.getBarrelEndcapFlag());
+ return getTrackerHits(MakeHitIdentifier(seedlayer));
+ }
+
+ public List<HelicalTrackHit> getTrackerHits(SeedLayer seedlayer, Sector sector) {
+ return getTrackerHits(MakeFullIdentifier(seedlayer, sector));
+ }
+
+ public List<HelicalTrackHit> getTrackerHits(String identifier) {
+ List<HelicalTrackHit> hitlist;
+ if (_hitlist.containsKey(identifier)) {
+ hitlist = _hitlist.get(identifier);
+ } else {
+ hitlist = new ArrayList<HelicalTrackHit>();
+ }
+ return hitlist;
+ }
+
+ public String MakeFullIdentifier(String hitid, Sector sector) {
+ return hitid+sector.SectorID();
}
-
+
+ public String MakeFullIdentifier(SeedLayer seedlayer, Sector sector) {
+ String hitid = MakeHitIdentifier(seedlayer);
+ return MakeFullIdentifier(hitid, sector);
+ }
+
+ public String MakeHitIdentifier(SeedLayer seedlayer) {
+ return MakeHitIdentifier(seedlayer.getDetName(), seedlayer.getLayer(),
+ seedlayer.getBarrelEndcapFlag());
+ }
+
+ public String MakeHitIdentifier(String detname, int layer, BarrelEndcapFlag beflag) {
+ return detname + layer + beflag;
+ }
+
+ public List<Sector> getSectorList(SeedLayer layer) {
+ String identifier = MakeHitIdentifier(layer);
+ List<Sector> sectorlist;
+ if (_sectorlist.containsKey(identifier)) {
+ sectorlist = _sectorlist.get(identifier);
+ } else {
+ sectorlist = new ArrayList<Sector>();
+ }
+ return sectorlist;
+ }
+
/**
- * Return the smallest radius hit for a particular SeedLayer
- * @param seedlayer SeedLayer to consider
+ * Return the smallest radius hit for a hit collection. The hit collection
+ * can be for either a full SeedLayer or sector, depending on the
+ * identifier used.
+ * @param identifier Identifier for the hit collection
* @return Minimum hit radius
*/
- public double getRMin(SeedLayer seedlayer) {
+ public double getRMin(String identifier) {
double rmin = 9999999.;
- String identifier = MakeIdentifier(seedlayer.getDetName(), seedlayer.getLayer(), seedlayer.getBarrelEndcapFlag());
- if (_rmin.containsKey(identifier)) rmin = Math.min(rmin, _rmin.get(identifier));
+ if (_rmin.containsKey(identifier)) {
+ rmin = Math.min(rmin, _rmin.get(identifier));
+ }
return rmin;
}
-
+
/**
- * Return the largest radius hit for a particular SeedLayer
- * @param seedlayer SeedLayer to consider
+ * Return the largest radius hit for a hit collection. The hit collection
+ * can be for either a full SeedLayer or sector, depending on the
+ * identifier used.
+ * @param identifier Identifier for the hit collection
* @return Maximum hit radius
*/
- public double getRMax(SeedLayer seedlayer) {
+ public double getRMax(String identifier) {
double rmax = 0.;
- String identifier = MakeIdentifier(seedlayer.getDetName(), seedlayer.getLayer(), seedlayer.getBarrelEndcapFlag());
- if (_rmax.containsKey(identifier)) rmax = Math.max(rmax, _rmax.get(identifier));
+ if (_rmax.containsKey(identifier)) {
+ rmax = Math.max(rmax, _rmax.get(identifier));
+ }
return rmax;
}
-
+
+ public double getPhiMin(String identifier) {
+ double phimin = 2. * Math.PI;
+ if (_phimin.containsKey(identifier)) {
+ phimin = Math.min(phimin, _phimin.get(identifier));
+ }
+ return phimin;
+ }
+
+ public double getPhiMax(String identifier) {
+ double phimax = 0.;
+ if (_phimax.containsKey(identifier)) {
+ phimax = Math.max(phimax, _phimax.get(identifier));
+ }
+ return phimax;
+ }
+
/**
* Return the minimum z coordinate for a hit in a particular SeedLayer
- * @param seedlayer SeedLayer to consider
+ * Return the minimum z coordinate for a hit collection. The hit collection
+ * can be for either a full SeedLayer or sector, depending on the
+ * identifier used.
+ * @param identifier Identifier for the hit collection
* @return Minimum z coordinate
*/
- public double getZMin(SeedLayer seedlayer) {
+ public double getZMin(String identifier) {
double zmin = 9999999.;
- String identifier = MakeIdentifier(seedlayer.getDetName(), seedlayer.getLayer(), seedlayer.getBarrelEndcapFlag());
- if (_zmin.containsKey(identifier)) zmin = Math.min(zmin, _zmin.get(identifier));
+ 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
- * @param seedlayer SeedLayer to consider
+ * Return the maximum z coordinate for a hit collection. The hit collection
+ * can be for either a full SeedLayer or sector, depending on the
+ * identifier used.
+ * @param identifier Identifier for the hit collection
* @return Maximum z coordinate
*/
- public double getZMax(SeedLayer seedlayer) {
+ public double getZMax(String identifier) {
double zmax = -9999999.;
- String identifier = MakeIdentifier(seedlayer.getDetName(), seedlayer.getLayer(), seedlayer.getBarrelEndcapFlag());
- if (_zmax.containsKey(identifier)) zmax = Math.max(zmax, _zmax.get(identifier));
+ if (_zmax.containsKey(identifier)) {
+ zmax = Math.max(zmax, _zmax.get(identifier));
+ }
return zmax;
}
-
- private String getName(TrackerHit hit) {
- if (hit instanceof BaseTrackerHitMC) {
- SimTrackerHit simhit = ((BaseTrackerHitMC) hit).getSimHits().get(0);
- return simhit.getSubdetector().getName();
- } else return new String("Unknown");
- }
-
- private int getLayer(TrackerHit hit) {
- if (hit instanceof BaseTrackerHitMC) {
- SimTrackerHit simhit = ((BaseTrackerHitMC) hit).getSimHits().get(0);
- return simhit.getLayer();
- } else return 999;
- }
-
- private BarrelEndcapFlag getBarrelEndcapFlag(TrackerHit hit) {
- if (hit instanceof BaseTrackerHitMC) {
- SimTrackerHit simhit = ((BaseTrackerHitMC) hit).getSimHits().get(0);
- return simhit.getIDDecoder().getBarrelEndcapFlag();
- } else return BarrelEndcapFlag.UNKNOWN;
- }
-
- private String MakeIdentifier(String detname, int layer, BarrelEndcapFlag beflag) {
- return detname+layer+beflag;
- }
-
- private double getZMax(TrackerHit hit) {
- return 9999.;
+
+ private void Update(String identifier, HelicalTrackHit hit) {
+
+ // If we haven't encountered this identifier, initialize the hash maps
+ if (!_hitlist.containsKey(identifier)) {
+ _hitlist.put(identifier, new ArrayList<HelicalTrackHit>());
+ _rmin.put(identifier, 9999999.);
+ _rmax.put(identifier, 0.);
+ _phimin.put(identifier, 2. * Math.PI);
+ _phimax.put(identifier, 0.);
+ _zmin.put(identifier, 9999999.);
+ _zmax.put(identifier, -9999999.);
+ }
+
+ // Add the hit to the appropriate list
+ _hitlist.get(identifier).add(hit);
+
+ // Get r, phi, zmin, and zmax for this hit
+ double r = hit.r();
+ double phi = hit.phi();
+ double zmin = hit.z();
+ double zmax = zmin;
+ if (hit instanceof HelicalTrack2DHit) {
+ HelicalTrack2DHit hit2d = (HelicalTrack2DHit) hit;
+ zmin = hit2d.zmin();
+ zmax = hit2d.zmax();
+ }
+
+ // Update the min/max values for this identifier
+ if (r < _rmin.get(identifier)) _rmin.put(identifier, r);
+ if (r > _rmax.get(identifier)) _rmax.put(identifier, r);
+ if (phi < _phimin.get(identifier)) _phimin.put(identifier, phi);
+ if (phi > _phimax.get(identifier)) _phimax.put(identifier, phi);
+ if (zmin < _zmin.get(identifier)) _zmin.put(identifier, zmin);
+ if (zmax > _zmax.get(identifier)) _zmax.put(identifier, zmax);
+ return;
}
-
-}
+}
\ No newline at end of file
lcsim/src/org/lcsim/recon/tracking/seedtracker
diff -u -r1.3 -r1.4
--- SeedTracker.java 13 Oct 2008 01:05:28 -0000 1.3
+++ SeedTracker.java 18 Jan 2009 00:21:22 -0000 1.4
@@ -68,7 +68,8 @@
*/
@Override
protected void process(EventHeader event) {
-
+
+ System.out.println("Started SeedTracker");
// Pass the event to the diagnostics package
if(_diag!=null) _diag.setEvent(event);
@@ -122,7 +123,11 @@
_strategylist = strategylist;
return;
}
-
+
+ public void setSectorParams(int nphi, double deta) {
+ _hitmanager.setSectorParams(nphi, deta);
+ }
+
public void setDiagnostics(ISeedTrackerDiagnostics d){
// Set the diagnostic package
lcsim/src/org/lcsim/recon/tracking/seedtracker
diff -u -r1.1 -r1.2
--- SortHits.java 27 Aug 2008 17:59:02 -0000 1.1
+++ SortHits.java 18 Jan 2009 00:21:22 -0000 1.2
@@ -32,10 +32,14 @@
}
public int compare(HelicalTrackHit a, HelicalTrackHit b) {
- double difa = (a.x() - _xc)*(a.x() - _xc) + (a.y() - _yc)*(a.y() - _yc) - _R2;
- double difb = (b.x() - _xc)*(b.x() - _xc) + (b.y() - _yc)*(b.y() - _yc) - _R2;
+ double xa = a.x();
+ double xb = b.x();
+ double ya = a.y();
+ double yb = b.y();
+ double difa = (xa - _xc)*(xa - _xc) + (ya - _yc)*(ya - _yc) - _R2;
+ double difb = (xb - _xc)*(xb - _xc) + (yb - _yc)*(yb - _yc) - _R2;
if (difa * difa > difb * difb) return 1;
- if (difa * difa == difb * difb) return 0;
- return -1;
+ if (difa * difa < difb * difb) return -1;
+ return 0;
}
}
\ No newline at end of file
CVSspam 0.2.8