lcsim/src/org/lcsim/recon/tracking/seedtracker
diff -u -r1.19 -r1.20
--- SeedTracker.java 7 Jul 2011 20:54:37 -0000 1.19
+++ SeedTracker.java 21 Apr 2013 23:37:07 -0000 1.20
@@ -9,10 +9,7 @@
import hep.physics.vec.BasicHep3Vector;
import hep.physics.vec.Hep3Vector;
-import java.util.ArrayList;
-import java.util.List;
-
-import java.util.Set;
+import java.util.*;
import org.lcsim.detector.ITransform3D;
import org.lcsim.event.EventHeader;
import org.lcsim.event.MCParticle;
@@ -48,7 +45,9 @@
protected AIDA aida = AIDA.defaultInstance();
protected boolean _timing = false;
protected String _inputCol = "HelicalTrackHits";
-
+ private int _iterativeConfirmedFits = 0;
+ private boolean debug = false;
+
/** Creates a new instance of SeedTracker */
public SeedTracker() {
this(new DefaultStrategy().getStrategyList());
@@ -89,7 +88,7 @@
// Get the hit collection from the event
List<HelicalTrackHit> hitcol = event.get(HelicalTrackHit.class, _inputCol);
-
+
// Sort the hits for this event
_hitmanager.OrganizeHits(hitcol);
@@ -120,6 +119,34 @@
// Get the list of final list of SeedCandidates
List<SeedCandidate> trackseeds = _finder.getTrackSeeds();
+
+
+ if(_iterativeConfirmedFits>0) {
+ // Iteratively re-fit tracks to take into account helix and hit position correlations
+ if(debug) System.out.printf("%s: Iteratively improve %d seeds\n",this.getClass().getSimpleName(),trackseeds.size());
+ List<SeedCandidate> seedsToRemove = new ArrayList<>();
+ for(SeedCandidate seed : trackseeds) {
+ SeedStrategy strategy = seed.getSeedStrategy();
+ if(debug) System.out.printf("%s: Iteratively (%d times) improve seed:\n%s",this.getClass().getSimpleName(),_iterativeConfirmedFits,seed.toString());
+ boolean success = false;
+ for(int iterFit=0;iterFit<_iterativeConfirmedFits;++iterFit) {
+ success = _helixfitter.FitCandidate(seed, strategy);
+ }
+ if(!success) {
+ if(debug) System.out.printf("%s: done iterating, this seed will NOT be added to event:\n%s\n",this.getClass().getSimpleName(),seed.toString());
+ seedsToRemove.add(seed);
+ } else {
+ if(debug) System.out.printf("%s: done iterating, this seed will be added to event:\n%s\n",this.getClass().getSimpleName(),seed.toString());
+ }
+ }
+ if(debug) System.out.printf("%s: done iterating, removing %d seeds\n",this.getClass().getSimpleName(),seedsToRemove.size());
+ for(SeedCandidate badseed : seedsToRemove) {
+ trackseeds.remove(badseed);
+ }
+ }
+
+ if(debug) System.out.printf("%s: %d track seeds, add these to the event\n",this.getClass().getSimpleName(),trackseeds.size());
+
// Make tracks from the final list of track seeds
_maketracks.Process(event, trackseeds, _bfield);
@@ -248,4 +275,12 @@
_finder._trackCheck = trackCheck;
_maketracks._trackCheck = trackCheck;
}
+ /**
+ * Set the maximum number of iterative fits on a confirmed/extended candidate.
+ *
+ * @param maxfits maximum number of fits
+ */
+ public void setIterativeConfirmed(int maxfits) {
+ this._iterativeConfirmedFits = maxfits;
+ }
}