java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/HPSEcalCluster.java 2014-06-26 22:10:29 UTC (rev 742)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/HPSEcalCluster.java 2014-06-26 23:00:46 UTC (rev 743)
@@ -7,6 +7,7 @@
import org.lcsim.detector.IGeometryInfo;
import org.lcsim.detector.solids.Trd;
import org.lcsim.event.CalorimeterHit;
+import org.lcsim.event.Cluster;
import org.lcsim.event.base.BaseCluster;
/**
@@ -48,6 +49,22 @@
return seedHit;
}
+ /**
+ * Find highest-energy hit in a cluster. For clusters made by GTPEcalClusterer, HPSEcalCluster.getSeedHit(cluster) should be equivalent to cluster.getSeedHit().
+ * Since this method doesn't require that the cluster be an HPSEcalCluster, it will work on clusters read from LCIO.
+ * @param cluster
+ * @return
+ */
+ public static CalorimeterHit getSeedHit(Cluster cluster) {
+ CalorimeterHit seedHit = null;
+ for (CalorimeterHit hit : cluster.getCalorimeterHits()) {
+ if (seedHit == null || hit.getRawEnergy() > seedHit.getRawEnergy()) {
+ seedHit = hit;
+ }
+ }
+ return seedHit;
+ }
+
// public double[] getPosition() {
// return getSeedHit().getPosition();
// }