Print

Print


Commit in lcsim/src/org/lcsim/recon/pfa/identifier on MAIN
SimpleChargedParticleMaker.java+33-31.3 -> 1.4
Add in a code hook for debug plots; prepare to make some kind of E/P cut.

lcsim/src/org/lcsim/recon/pfa/identifier
SimpleChargedParticleMaker.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- SimpleChargedParticleMaker.java	12 Jul 2006 17:37:31 -0000	1.3
+++ SimpleChargedParticleMaker.java	18 Jul 2006 00:44:02 -0000	1.4
@@ -24,7 +24,7 @@
  *
  * Currently, PID is done by cheating.
  *
- * @version $Id: SimpleChargedParticleMaker.java,v 1.3 2006/07/12 17:37:31 mcharles Exp $
+ * @version $Id: SimpleChargedParticleMaker.java,v 1.4 2006/07/18 00:44:02 mcharles Exp $
  */
 
 public class SimpleChargedParticleMaker extends Driver
@@ -62,6 +62,7 @@
 	// For each track, we'll try to extrapolate it to the ECAL surface.
 	// If we do, we store the appropriate value of alpha (distance to swim)
 	Map<Track, Double> successfullyExtrapolatedTracks = new HashMap<Track,Double>();
+	List<Track> unsuccessfullyExtrapolatedTracks = new Vector<Track>();
 
 	for (Track tr : inputTrackList) {
 	    // Make a swimmer:
@@ -96,6 +97,8 @@
 		} else {
 		    throw new AssertionError("alpha is not NaN, but not a valid barrel or endcap intercept");
 		}
+	    } else {
+		unsuccessfullyExtrapolatedTracks.add(tr);
 	    }
 	}
 
@@ -187,6 +190,14 @@
 	// Write out
 	event.put(m_outputTrackListName, outputTrackList);
 	event.put(m_outputParticleListName, outputParticleList);
+
+	// Here is a hook for debug/plots
+	checkEvent(successfullyExtrapolatedTracks, unsuccessfullyExtrapolatedTracks, outputTrackList, outputParticleList, inputClusterList, inputMIPList, swimmer);
+    }
+
+    protected void checkEvent(Map<Track,Double> successfullyExtrapolatedTracks, List<Track> unsuccessfullyExtrapolatedTracks, List<Track> outputTrackList, List<ReconstructedParticle> outputParticleList, List<Cluster> inputClusterList, List<Cluster> inputMIPList, HelixSwimmer swimmer) 
+    {
+	// nothing by default
     }
 
     protected double swimToBarrel(HelixSwimmer swimmer) {
@@ -296,8 +307,27 @@
 	    boolean goodSeparation = (separation < 30.0);
 	    boolean foundMatch = goodSubDet && goodFirstLayer && goodSeparation;
 	    if (foundMatch) {
-		// OK, made a good match
-		return nearbyCluster;
+		// Geometrically, it looks good.
+		// Is it sensible in terms of energy?
+		
+		// // FIXME: Farm the calibration out to an external class properly
+		// double estimatedClusterEnergy = SimpleNeutralParticleMaker.estimateClusterEnergy(clus);
+		// // We don't expect an exact match due to resolution, energy lost
+		// // to fragments etc., but a good portion of the energy should be
+		// // in the cluster
+		// double[] trackMomentum = tr.getMomentum();
+		// double trackMomentumMag = Math.sqrt(trackMomentum[0]*trackMomentum[0] + trackMomentum[1]*trackMomentum[1] + trackMomentum[2]*trackMomentum[2]);
+		// boolean fractionEnergyOK = estimatedClusterEnergy > 0.5*trackMomentumMag;
+		// boolean absoluteEnergyOK = (trackMomentumMag - estimatedClusterEnergy < 0.2); // deliberately one-sided
+		// boolean energyOK = fractionEnergyOK || absoluteEnergyOK;
+		boolean energyOK = true; // For now, always pass
+
+		if (energyOK) {
+		    // Matches OK
+		    return nearbyCluster;
+		} else {
+		    // This cluster isn't a good match -- ignore it.
+		}
 	    }
 	}
 	// No match
CVSspam 0.2.8