lcsim/src/org/lcsim/contrib/uiowa/template
diff -u -r1.1 -r1.2
--- DebugInfoClusterList.java 17 Jan 2006 00:33:12 -0000 1.1
+++ DebugInfoClusterList.java 27 Jan 2006 23:54:51 -0000 1.2
@@ -31,84 +31,18 @@
List<Cluster> inputClusterList = event.get(Cluster.class, m_inputClusterListName);
int hitSum = 0;
- Set<CalorimeterHit> usedHits = new HashSet<CalorimeterHit>();
- Set<CalorimeterHit> duplicateHits = new HashSet<CalorimeterHit>();
+ Set<Long> uniqueCellIDs = new HashSet<Long>();
for (Cluster currentCluster : inputClusterList) {
hitSum += currentCluster.getCalorimeterHits().size();
for (CalorimeterHit hit : currentCluster.getCalorimeterHits()) {
- if (usedHits.contains(hit)) {
- duplicateHits.add(hit);
- } else {
- usedHits.add(hit);
- }
+ uniqueCellIDs.add(new Long(hit.getCellID()));
}
}
System.out.println("For cluster list ["+m_inputClusterListName+"]:"
+" clusters="+inputClusterList.size()
- +" hits="+hitSum);
-
- /*
- if (duplicateHits.size()>0) {
- System.out.println("There were "+duplicateHits.size()+" duplicate hits...");
-
- Map<List<Cluster>, List<CalorimeterHit>> duplicateMap = new HashMap<List<Cluster>, List<CalorimeterHit>> ();
- Map<CalorimeterHit, List<Cluster>> duplicateReverseMap = new HashMap<CalorimeterHit, List<Cluster>> ();
- // Build the backwards map:
- for (Cluster currentCluster : inputClusterList) {
- for (CalorimeterHit hit : currentCluster.getCalorimeterHits()) {
- if (duplicateHits.contains(hit)) {
- List<Cluster> clusterList = duplicateReverseMap.get(hit);
- if (clusterList == null) {
- clusterList = new Vector<Cluster> ();
- duplicateReverseMap.put(hit, clusterList);
- }
- if (clusterList.contains(currentCluster)) { throw new AssertionError("Hit twice in cluster!"); }
- clusterList.add(currentCluster);
- }
- }
- }
- // Build the forwards map:
- for (CalorimeterHit hit : duplicateHits) {
- List<Cluster> clusterList = duplicateReverseMap.get(hit);
- if (clusterList == null) { throw new AssertionError("Hit never appears!"); }
- // Let's see if the cluster list appears already:
- boolean matchFound = false;
- for (List<Cluster> anotherClusterList : duplicateMap.keySet()) {
- boolean matchSize = (clusterList.size() == anotherClusterList.size());
- boolean matchContent = true;
- if (matchSize) {
- for (Cluster clus : clusterList) {
- matchContent = matchContent && (anotherClusterList.contains(clus));
- }
- }
- if (matchSize && matchContent) {
- // Yah, this is a match
- List<CalorimeterHit> hits = duplicateMap.get(anotherClusterList);
- hits.add(hit);
- matchFound = true;
- }
- }
- if (!matchFound) {
- // No match exists - need to create a new entry
- List<CalorimeterHit> hits = new Vector<CalorimeterHit>();
- hits.add(hit);
- duplicateMap.put(clusterList, hits);
- }
- }
-
- // Look at the forwards map
- System.out.println(duplicateMap.keySet().size()+" kinds of duplicate:");
- for (List<Cluster> clusterList : duplicateMap.keySet()) {
- List<CalorimeterHit> hits = duplicateMap.get(clusterList);
- String str = new String();
- str += " "+hits.size()+" cases of "+clusterList.size()+" clusters: ";
- for (Cluster clus : clusterList) {
- str += "[" + clus + "]";
- }
- System.out.println(str);
- }
- }
- */
+ +", hits="+hitSum
+ +", unique hits="+uniqueCellIDs.size()
+ );
}
String m_inputClusterListName;