lcsim/src/org/lcsim/contrib/uiowa/structural
diff -u -r1.1 -r1.2
--- Remapper.java 1 Oct 2005 01:37:26 -0000 1.1
+++ Remapper.java 1 Oct 2005 02:06:13 -0000 1.2
@@ -33,12 +33,45 @@
public void process(EventHeader event) {
if (m_clusterSubListNames.size() != m_subMapNames.size()) { throw new AssertionError("Validity check failed"); }
Map<Cluster, List<Cluster> > mapClustersToTracks = new HashMap<Cluster, List<Cluster> > ();
+ List<Cluster> bigClusters = event.get(Cluster.class, m_clusterListName);
for (int i=0; i<m_clusterSubListNames.size(); i++) {
String clusterSubListName = m_clusterSubListNames.get(i);
String subMapName = m_subMapNames.get(i);
- List<Cluster> clusters = event.get(Cluster.class, clusterSubListName);
+ List<Cluster> subClusters = event.get(Cluster.class, clusterSubListName);
List<MapClusterToListOfClusters> dummyList = event.get(MapClusterToListOfClusters.class, subMapName);
- // [...]
+ MapClusterToListOfClusters map = dummyList.iterator().next();
+ // OK. We have a list of clusters, which feed into the merged clusters.
+ // For each sub-cluster with associated MIPs, find the big cluster it went into
+ for (Cluster subCluster : subClusters) {
+ List<Cluster> tracksMatchedToThisSubCluster = map.get(subCluster);
+ if (tracksMatchedToThisSubCluster != null && tracksMatchedToThisSubCluster.size()>0) {
+ Cluster bigClusterItWentInto = null;
+ for (Cluster bigCluster : bigClusters) {
+ List<Cluster> clustersInsideThisBigCluster = bigCluster.getClusters();
+ if (clustersInsideThisBigCluster.contains(subCluster)) {
+ // A match!
+ if (bigClusterItWentInto != null) {
+ // Er -- there was already a match
+ throw new AssertionError("Mapping is not 1:1");
+ } else {
+ bigClusterItWentInto = bigCluster;
+ }
+ }
+ }
+ if (bigClusterItWentInto != null) {
+ // Mapped OK
+ List<Cluster> tracksMappedToThisBigCluster = mapClustersToTracks.get(bigClusterItWentInto);
+ if (tracksMappedToThisBigCluster == null) {
+ tracksMappedToThisBigCluster = new Vector<Cluster>();
+ mapClustersToTracks.put(bigClusterItWentInto, tracksMappedToThisBigCluster);
+ }
+ tracksMappedToThisBigCluster.addAll(tracksMatchedToThisSubCluster);
+ } else {
+ // Not found
+ System.out.println("DEBUG: Didn't find subcluster "+subCluster+" inside any of the big clusters.");
+ }
+ }
+ }
}
// Dummy...
List<Map<Cluster, List<Cluster>>> dummyList = new Vector<Map<Cluster, List<Cluster> > > ();