Commit in lcsim/src/org/lcsim/contrib/uiowa on MAIN
LocalHelixExtrapolationTrackClusterMatcher.java+13-31.4 -> 1.5
MJC: Enable local-helix track matcher to handle BaseTrackMC

lcsim/src/org/lcsim/contrib/uiowa
LocalHelixExtrapolationTrackClusterMatcher.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- LocalHelixExtrapolationTrackClusterMatcher.java	13 Oct 2007 01:38:54 -0000	1.4
+++ LocalHelixExtrapolationTrackClusterMatcher.java	19 Nov 2007 21:02:57 -0000	1.5
@@ -21,10 +21,12 @@
 import org.lcsim.recon.pfa.identifier.TrackClusterMatcher;
 import org.lcsim.event.SimTrackerHit;
 import org.lcsim.mc.fast.tracking.ReconTrack;
+import org.lcsim.event.base.*;
 
 /**
  * Attempt to match a Track to a Cluster. The Track is extrapolated to the inner surface
- * of the ECAL with a helix derived from nearby tracker hits.
+ * of the ECAL with a helix derived from nearby tracker hits. We use truth information
+ * to find the tracker hits, so we need to look up truth information for the Track.
  *
  * Certain cuts are hard-coded, but additional cuts can be specified via a
  * DecisionMakerPair<Track,Cluster>.
@@ -149,6 +151,7 @@
 	// Find hits. For now these are SimTrackerHits because
 	// of the inability to get hold of TrackerHits.
 	Collection<SimTrackerHit> trackerHits = findHits(tr);
+
 	if (trackerHits.size() < 3) { 
 	    // Need at least 3 hits to make a helix.
 	    return null;
@@ -169,6 +172,7 @@
 		hit2 = hit;
 	    }
 	}
+
 	// First look at the xy (circle) projection
 	double x0 = hit0.getPoint()[0];
 	double x1 = hit1.getPoint()[0];
@@ -385,7 +389,13 @@
 
     protected Collection<SimTrackerHit> findHits(Track tr) {
 	// Find truth particle of track:
-	org.lcsim.mc.fast.tracking.ReconTrack reconTr = (org.lcsim.mc.fast.tracking.ReconTrack) (tr);
+	MCParticle truth = null;
+	if (tr instanceof org.lcsim.mc.fast.tracking.ReconTrack) {
+	    org.lcsim.mc.fast.tracking.ReconTrack reconTr = (org.lcsim.mc.fast.tracking.ReconTrack) (tr);
+	    truth = (MCParticle)(reconTr.getMCParticle());
+	} else if (tr instanceof BaseTrackMC) {
+	    truth = ((BaseTrackMC)(tr)).getMCParticle();
+	}
 	// Look up all hits in event:
 	List<SimTrackerHit> trackerHits = new Vector<SimTrackerHit>();
 	trackerHits.addAll(m_event.get(org.lcsim.event.SimTrackerHit.class, "TkrBarrHits"));
@@ -393,7 +403,7 @@
 	// Find hits that match track:
 	List<SimTrackerHit> hitsMatched = new Vector<org.lcsim.event.SimTrackerHit>();
 	for (SimTrackerHit hit : trackerHits) {
-	    if (hit.getMCParticle() == reconTr.getMCParticle()) {
+	    if (hit.getMCParticle() == truth) {
 		hitsMatched.add(hit);
 	    }
 	}
CVSspam 0.2.8