lcsim-contrib/src/main/java/org/lcsim/contrib/jeremym/hps
diff -u -r1.1 -r1.2
--- HPSEcalClusterer.java 28 Apr 2011 00:34:30 -0000 1.1
+++ HPSEcalClusterer.java 29 Apr 2011 00:07:34 -0000 1.2
@@ -24,7 +24,7 @@
* Clustering algorithm is from pages 83 and 84 of the HPS Proposal.
*
* @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: HPSEcalClusterer.java,v 1.1 2011/04/28 00:34:30 jeremy Exp $
+ * @version $Id: HPSEcalClusterer.java,v 1.2 2011/04/29 00:07:34 jeremy Exp $
*/
public class HPSEcalClusterer extends Driver
{
@@ -97,9 +97,7 @@
}
public void process(EventHeader event)
- {
- //System.out.println("HPSEcalClusterer.process");
-
+ {
List<CalorimeterHit> hits = event.get(CalorimeterHit.class, ecalCollectionName);
if (hits == null)
throw new RuntimeException("Event is missing ECal hits collection!");
@@ -113,7 +111,7 @@
for (CalorimeterHit hit : hits)
{
dec.setID(hit.getCellID());
- hitMap.put(hit.getCellID(), hit);
+ hitMap.put(hit.getCellID(), hit);
}
// Setup an encoder from the decoder.
@@ -147,11 +145,9 @@
// Loop over neighbors.
List<CalorimeterHit> neighborHits = new ArrayList<CalorimeterHit>();
+ boolean isSeed = true;
for (XYSide neighbor : neighbors)
- {
- // debug print
- //System.out.println(" " + neighbor.x() + ", " + neighbor.y() + ", " + neighbor.side());
-
+ {
buffer[dec.getFieldIndex("ix")] = neighbor.x();
buffer[dec.getFieldIndex("iy")] = neighbor.y();
buffer[dec.getFieldIndex("side")] = neighbor.side();
@@ -165,39 +161,31 @@
// Got a hit?
if (neighborHit != null)
- {
- // debug print
- /*
- dec.setID(neighborHit.getCellID());
- System.out.println(" found neighbor hit w/ x, y, side ( "
- + dec.getValue("ix") + ", "
- + dec.getValue("iy") + ", "
- + dec.getValue("side") + ")");
- */
-
+ {
// Neighbor is hotter so skip this hit.
if (neighborHit.getRawEnergy() > hit.getRawEnergy())
{
- //System.out.println("skipping hit because neighbor has more E");
- continue;
+ isSeed = false;
+ break;
}
// Add to cluster if above min E.
if (neighborHit.getRawEnergy() >= addEMin)
neighborHits.add(neighborHit);
- }
+ }
}
-
- // Make cluster.
- BasicCluster cluster = new BasicCluster();
- cluster.addHit(hit);
- for (CalorimeterHit clusHit : neighborHits)
+
+ if (isSeed)
{
- cluster.addHit(clusHit);
- }
- clusters.add(cluster);
- //System.out.println("cluster nhits = " + cluster.getCalorimeterHits().size());
- //System.out.println("cluster E = " + cluster.getEnergy());
+ // Make cluster.
+ BasicCluster cluster = new BasicCluster();
+ cluster.addHit(hit);
+ for (CalorimeterHit clusHit : neighborHits)
+ {
+ cluster.addHit(clusHit);
+ }
+ clusters.add(cluster);
+ }
}
int flag = 1 << LCIOConstants.CLBIT_HITS;