lcsim/src/org/lcsim/recon/tracking/seedtracker
diff -u -r1.16 -r1.17
--- SeedTrackFinder.java 19 Jan 2011 20:44:04 -0000 1.16
+++ SeedTrackFinder.java 28 Feb 2011 19:52:02 -0000 1.17
@@ -14,6 +14,7 @@
import org.lcsim.event.MCParticle;
import org.lcsim.fit.helicaltrack.HelicalTrackHit;
import org.lcsim.recon.tracking.seedtracker.diagnostic.ISeedTrackerDiagnostics;
+import org.lcsim.util.aida.AIDA;
/**
*
@@ -61,6 +62,9 @@
public boolean FindTracks(SeedStrategy strategy, double bfield) {
+ System.out.println("Track finder started with strategy "+strategy.getName());
+ AIDA aida = AIDA.defaultInstance();
+
// Instantiate the fast hit checker
FastCheck checker = new FastCheck(strategy, bfield, _diag);
@@ -68,42 +72,44 @@
SeedSectoring ss = new SeedSectoring(_hitmanager, strategy, bfield);
List<List<Sector>> sslist = ss.SeedSectors();
- // Loop over the first seed layer
- for (List<Sector> slist : sslist)
- for (HelicalTrackHit hit1 : slist.get(0).Hits())
+ // Loop over the valid sector combinations
+ for (List<Sector> slist : sslist) {
+
+ // Loop over the first seed layer
+ for (HelicalTrackHit hit1 : slist.get(0).Hits()) {
+
// Loop over the second seed layer and check that we have a hit pair consistent with our strategy
for (HelicalTrackHit hit2 : slist.get(1).Hits()) {
- SeedCandidate tempseed = new SeedCandidate(strategy, bfield);
- tempseed.addHit(hit1);
- tempseed.addHit(hit2);
- if ((_trackCheck != null) && (!_trackCheck.checkSeed(tempseed)))
- continue;
-
+ // Call _trackCheck if set
+ if (_trackCheck != null) {
+ SeedCandidate tempseed = new SeedCandidate(strategy, bfield);
+ tempseed.addHit(hit1);
+ tempseed.addHit(hit2);
+ if (!_trackCheck.checkSeed(tempseed)) continue;
+ }
// Check if the pair of hits is consistent with the current strategy
if (!checker.TwoPointCircleCheck(hit1, hit2, null)) {
-
- if (_diag != null) {
- if (tempseed.isTrueSeed())
- _diag.fireCheckHitPairFailed(hit1, hit2);
- }
+ if (_diag != null) _diag.fireCheckHitPairFailed(hit1, hit2);
continue;
}
// Loop over the third seed layer and check that we have a hit triplet consistent with our strategy
for (HelicalTrackHit hit3 : slist.get(2).Hits()) {
- SeedCandidate tempseed2 = new SeedCandidate(strategy, bfield);
- tempseed2.addHit(hit1);
- tempseed2.addHit(hit3);
- if ((_trackCheck != null) && (!_trackCheck.checkSeed(tempseed2)))
- continue;
- SeedCandidate tempseed3 = new SeedCandidate(strategy, bfield);
- tempseed3.addHit(hit2);
- tempseed3.addHit(hit3);
- if ((_trackCheck != null) && (!_trackCheck.checkSeed(tempseed3)))
- continue;
+ // Call _trackCheck if set
+ if (_trackCheck != null) {
+ SeedCandidate tempseed2 = new SeedCandidate(strategy, bfield);
+ tempseed2.addHit(hit1);
+ tempseed2.addHit(hit3);
+ if (!_trackCheck.checkSeed(tempseed2)) continue;
+
+ SeedCandidate tempseed3 = new SeedCandidate(strategy, bfield);
+ tempseed3.addHit(hit2);
+ tempseed3.addHit(hit3);
+ if (!_trackCheck.checkSeed(tempseed3)) continue;
+ }
// Form a seed candidate from the seed hits
SeedCandidate seed = new SeedCandidate(strategy, bfield);
@@ -120,12 +126,9 @@
}
continue;
}
- if (seed.isTrueSeed() && _diag != null)
- System.out.println("Found a true 3-hit seed");
// Form a seed candidate from the seed hits
-
// If it's a true seed, add the MC Particle to those that were seeded
if (_diag != null)
if (seed.isTrueSeed())
@@ -133,28 +136,20 @@
// See if we can fit a helix to this seed candidate
boolean success = _helixfitter.FitCandidate(seed, strategy);
- if (!success) {
- if (seed.isTrueSeed() && _diag != null)
- System.out.println("_helixfitter: Rejected a true seed. " + hit1.getLayerIdentifier() + " " + hit2.getLayerIdentifier() + " " + hit3.getLayerIdentifier());
- continue;
- }
- if (seed.isTrueSeed() && _diag != null)
- System.out.println("True 3-hit passed helix-fit");
+ if (!success) continue;
+
// Save the helix fit
seed.setHelix(_helixfitter.getHelix());
// Check the seed - hook for plugging in external constraint
- if ((_trackCheck != null) && (!_trackCheck.checkSeed(seed)))
- continue;
+ if (_trackCheck != null) {
+ if (!_trackCheck.checkSeed(seed)) continue;
+ }
// See if we can confirm this seed candidate
success = _confirmer.Confirm(seed, strategy, bfield);
- if (!success) {
- if (seed.isTrueSeed() && _diag != null)
- System.out.println("True 3-hit seed failed confirm");
- continue;
- }
+ if (!success) continue;
// Confirmed a seed - if it's a true seed, add the MC Particle to those that were confirmed
if (_diag != null)
@@ -163,12 +158,15 @@
// Try to extend each confirmed seed candidates to make a track candidate
List<SeedCandidate> confirmedlist = _confirmer.getResult();
- for (SeedCandidate confirmedseed : confirmedlist)
+ for (SeedCandidate confirmedseed : confirmedlist) {
// See if we can extend this seed candidate
_confirmer.Extend(confirmedseed, strategy, bfield, _trackseeds);
+ }
}
}
+ }
+ }
// Done with track finding for this strategy
if (_diag != null)
@@ -177,20 +175,48 @@
return _trackseeds.size() > 0;
}
+ /**
+ * Return the list of track candidates.
+ *
+ * @return track candidates
+ */
public List<SeedCandidate> getTrackSeeds() {
return _trackseeds;
}
+ /**
+ * Clear the list of track candidates accumulated from previous calls to
+ * SeedTrackFinder (typically done before starting a new event).
+ */
public void clearTrackSeedList() {
_trackseeds.clear();
_seededmcp.clear();
_confirmedmcp.clear();
}
+ /**
+ * Set the maximum number of fits for a given seed in a confirm or extend step.
+ *
+ * @param maxfits maximum number of fits
+ */
+ public void setMaxFit(int maxfits) {
+ _confirmer.setMaxFit(maxfits);
+ }
+
+ /**
+ * Return the list of MCParticles that formed valid 3-hit seeds.
+ *
+ * @return list of seeded MCParticles
+ */
public Set<MCParticle> getSeededMCParticles() {
return _seededmcp;
}
+ /**
+ * Return the list of confirmed MCParticles.
+ *
+ * @return confirmed MCParticles
+ */
public Set<MCParticle> getConfirmedMCParticles() {
return _confirmedmcp;
}