lcsim/src/org/lcsim/util/hitmap
diff -u -r1.2 -r1.3
--- HitMap.java 20 Dec 2007 03:57:16 -0000 1.2
+++ HitMap.java 5 Jun 2008 17:32:03 -0000 1.3
@@ -1,5 +1,6 @@
package org.lcsim.util.hitmap;
+import java.util.Collection;
import java.util.Map;
import java.util.HashMap;
import org.lcsim.event.CalorimeterHit;
@@ -31,4 +32,14 @@
public HitMap(Map<Long,CalorimeterHit> map) {
super(map);
}
+
+ /** Constructs a hitmap from a pre-existing List<CalorimeterHit>. */
+ public HitMap(Collection<CalorimeterHit> hits) {
+ super();
+ for (CalorimeterHit hit : hits) {
+ // Put this hit in the hitmap:
+ Long cellID = hit.getCellID();
+ this.put(cellID, hit);
+ }
+ }
}