lcsim/src/org/lcsim/contrib/uiowa
diff -u -r1.1 -r1.2
--- CheckEoverP.java 9 May 2007 00:25:25 -0000 1.1
+++ CheckEoverP.java 16 May 2007 17:51:42 -0000 1.2
@@ -16,7 +16,6 @@
public boolean valid(Track tr, Cluster clus) {
// Check energy and uncertainty from calorimeter:
double estimatedClusterEnergy = m_calib.getEnergy(clus);
- double estimatedClusterEnergyUncertainty = 0.7 * Math.sqrt(estimatedClusterEnergy); // 70%/sqrt(E) for hadrons
// Check energy from track
double[] trackMomentum = tr.getMomentum();
@@ -28,15 +27,23 @@
double energyReleaseIfProton = trackMomentumMag;
double energyReleaseIfAntiproton = trackMomentumMag + massProton + massProton;
+ double estimatedClusterEnergyUncertainty = 0.7 * Math.sqrt(energyReleaseIfPion); // 70%/sqrt(E) for hadrons
+
// Compare them
boolean energyDiffOK_pion = Math.abs((energyReleaseIfPion - estimatedClusterEnergy)/estimatedClusterEnergyUncertainty) < m_allowedVariation;
boolean energyDiffOK_proton = Math.abs((energyReleaseIfProton - estimatedClusterEnergy)/estimatedClusterEnergyUncertainty) < m_allowedVariation;
boolean energyDiffOK_antiproton = Math.abs((energyReleaseIfAntiproton - estimatedClusterEnergy)/estimatedClusterEnergyUncertainty) < m_allowedVariation;
boolean energyDiffOK = energyDiffOK_pion || energyDiffOK_proton || energyDiffOK_antiproton;
+ if (m_debug) {
+ System.out.println("DEBUG: "+this.getClass().getName()+" checked E/p, found E="+estimatedClusterEnergy+" +- "+estimatedClusterEnergyUncertainty+", p="+trackMomentumMag+" and so valid="+energyDiffOK);
+ }
+
return energyDiffOK;
}
protected double m_allowedVariation;
protected ClusterEnergyCalculator m_calib = null;
+ protected boolean m_debug = false;
+ public void setDebug(boolean debug) { m_debug = debug; }
}