Commit in lcd/hep/lcd/recon/cluster/MST on MAIN
DummyDecisionMaker.java+4-21.1 -> 1.2
MSTCluster.java+24-71.1 -> 1.2
MSTClusterList.java+201.2 -> 1.3
MSTHit.java+17-61.2 -> 1.3
+65-15
4 modified files
Bug fixes and additions to MSTHit, MSTCluster, and MSTClusterList

lcd/hep/lcd/recon/cluster/MST
DummyDecisionMaker.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- DummyDecisionMaker.java	4 Aug 2005 22:58:27 -0000	1.1
+++ DummyDecisionMaker.java	16 Aug 2005 00:05:39 -0000	1.2
@@ -28,7 +28,8 @@
      */
     public boolean valid(MSTCluster cluster){
 	if ( cluster.getNHits()<=0 ) return false;
-	return true;}
+	return true;
+    }
 
     /**
        Check if a pair of clusters forms a valid pair, i.e. neither is empty.
@@ -36,6 +37,7 @@
     public boolean valid(MSTCluster aCluster, MSTCluster bCluster){
 	if ( aCluster.getNHits()<=0 ) return false;
 	if ( bCluster.getNHits()<=0 ) return false;
-	return true;}
+	return true;
+    }
 
 }

lcd/hep/lcd/recon/cluster/MST
MSTCluster.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- MSTCluster.java	4 Aug 2005 22:58:28 -0000	1.1
+++ MSTCluster.java	16 Aug 2005 00:05:40 -0000	1.2
@@ -38,7 +38,7 @@
     */
     public MSTCluster(CalorimeterHit hit, LCDEvent event){
 	super(event.getCalorimeterCell());
-	thisEvent = event;;
+	thisEvent = event;
 	thisCell = event.getCalorimeterCell();
 	addHit(hit);
     }
@@ -54,6 +54,17 @@
 	addCluster(cluster);
     }
 
+    /**
+       Make sure that each hit added to the cluster is an MSTHit
+    */
+    public void addHit(CalorimeterHit hit){
+	if (hit instanceof MSTHit){
+	    super.addHit(hit);
+	}else{
+	    super.addHit(new MSTHit(hit,thisEvent));
+	}
+    }
+
     private int clusterNo = 0;
     /**
        Return the cluster index.
@@ -69,14 +80,11 @@
        Given an input cluster, add its hits.
     */
     public void addCluster(AbstractCluster cluster){
+	clusterList.add(cluster);
 	Enumeration e = cluster.getHits();
 	while ( e.hasMoreElements() ){
-	    Object obj = e.nextElement();
-	    if (obj instanceof MSTHit){
-		addHit((MSTHit) obj);
-	    } else {
-		addHit(new MSTHit((CalorimeterHit)obj, thisEvent));
-	    }
+	    CalorimeterHit hit = (CalorimeterHit) e.nextElement();
+	    addHit(hit);
 	    lCalculated = false;
 	}
     }
@@ -246,12 +254,21 @@
 	}
     }
 
+    public LCDEvent getEvent(){
+	return thisEvent;
+    }
+
+    public MSTClusterList getContainedClusters(){
+	return new MSTClusterList(clusterList);
+    }
+
     private double purity = -1.; 
     private boolean lCalculated = false; 
     private MCParticle alphaParticle; 
     private LCDEvent thisEvent;
     private CalorimeterCell thisCell;
     private double[] energyLayer = new double[100];
+    private Vector clusterList = new Vector();
 
 }
 

lcd/hep/lcd/recon/cluster/MST
MSTClusterList.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- MSTClusterList.java	4 Aug 2005 22:58:28 -0000	1.2
+++ MSTClusterList.java	16 Aug 2005 00:05:40 -0000	1.3
@@ -103,6 +103,7 @@
 	    Object obj = (Object) iter.nextElement();
 	    if (obj instanceof CalorimeterHit){
 		MSTCluster mstc = new MSTCluster((CalorimeterHit)obj, event);
+		this.vList.add(mstc);
 	    } else {
 		throw new AssertionError("MSTClusterList.fillVector(CalorimeterHits,LCDEvent): The CalorimeterHits object contains elements of un-recognized type '"+obj.getClass().getName()+"'");
 	    }
@@ -177,6 +178,17 @@
     }
 
     /**
+       Add all elements of another MSTClusterList
+       @param list MSTClusterList to be added
+    */
+    public void addList(MSTClusterList list){
+	Enumeration iter = list.getClusters();
+	while (iter.hasMoreElements()){
+	    addCluster((MSTCluster)iter.nextElement());
+	}
+    }
+
+    /**
        Add a cluster to the list.
        @param addMe Cluster to add
     */
@@ -194,5 +206,13 @@
 	return removedOK;
     }
 
+    /**
+       Add the subclusters of a given MSTCluster
+       @param cluster MSTCluster, whose subclusters should be added
+    */
+    public void addSubclusters(MSTCluster cluster){
+	addList(cluster.getContainedClusters());
+    }
+
     private Vector vList;
 };

lcd/hep/lcd/recon/cluster/MST
MSTHit.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- MSTHit.java	4 Aug 2005 22:58:28 -0000	1.2
+++ MSTHit.java	16 Aug 2005 00:05:40 -0000	1.3
@@ -47,7 +47,9 @@
 	thisCell = event.getCalorimeterCell();
 	thisCell.setTowerID(towerID);
 	coordinates = thisCell.getPosition(); 
-	layer = thisCell.getLayer(); 
+	layer = thisCell.getLayer();
+        phi = thisCell.getPhi();
+        theta = thisCell.getTheta(); 
 	radius = calculateRadius(); 
 	
 	tableTowerID = new Hashtable();
@@ -69,14 +71,14 @@
 	    event.put("Hashtable TowerID,CalorimeterHits",tableTowerID);
 	}
 	int[] neighbours = thisCell.getNeighbouringCells();
-	densityNumber = 1;
-	densityEnergy = energy;
+	densityNumber = 1./neighbours.length;
+	densityEnergy = energy/neighbours.length;
 	for (int i=0; i<neighbours.length; i++){
 	    Integer n = new Integer(neighbours[i]);
 	    if (tableTowerID.containsKey(n)){
 		CalorimeterHit h = (CalorimeterHit)tableTowerID.get(n);
-		densityNumber++;
-		densityEnergy+=h.getEnergy();
+		densityNumber+=1./neighbours.length;
+		densityEnergy+=h.getEnergy()/neighbours.length;
 	    }
 	}
     }
@@ -137,6 +139,14 @@
 	return ((int) layer); 
     }
 
+    public double getTheta(){
+	return theta;
+    }
+
+    public double getPhi(){
+	return phi;
+    }
+
     /**
        Get radius in r-phi, calculated from the tower ID of CalorimeterHit (cached information)
      */
@@ -170,7 +180,8 @@
     private MCParticle[] particles; 
     private int towerID; 
 
-    private int layer; 
+    private int layer;
+    private double theta, phi; 
     private double radius; 
     private double[] coordinates = new double[3]; 
 
CVSspam 0.2.8