lcsim/src/org/lcsim/recon/cluster/nn
diff -u -r1.4 -r1.5
--- NearestNeighborClusterDriver.java 19 Oct 2005 12:23:00 -0000 1.4
+++ NearestNeighborClusterDriver.java 14 Jan 2006 00:37:26 -0000 1.5
@@ -12,6 +12,8 @@
import org.lcsim.geometry.CalorimeterIDDecoder;
import org.lcsim.recon.cluster.util.*;
import org.lcsim.util.Driver;
+import org.lcsim.event.Cluster;
+import org.lcsim.util.lcio.LCIOConstants;
/**
* A simple driver which applies a nearest neighbor clustering algorithm
@@ -25,7 +27,7 @@
{
// the minimum number of cells to qualify as a cluster
private int _minNcells;
-
+
// the neighborhood in u to search
private int _dU;
// the neighborhood in v to search
@@ -42,7 +44,7 @@
private boolean _doall;
// list of collections to cluster
private String[] _collNames;
-
+
/**
* Creates a new instance of NearestNeighborClusterDriver with a domain of (1,1,1)
* and no threshold.
@@ -52,7 +54,7 @@
{
this(1, 1, 1, ncells, 0);
}
-
+
/**
* Creates a new instance of NearestNeighborClusterDriver
* @param dU The extent in the U coordinate which defines a neighborhood.
@@ -74,7 +76,7 @@
_doall = true;
_clusterer = new NearestNeighborClusterer(_dU,_dV,_dLayer,_minNcells,_thresh);
}
-
+
/**
* Creates a new NearestNeighborClusterDriver with no energy threshold applied.
* @param dU The extent in the U coordinate which defines a neighborhood.
@@ -82,12 +84,12 @@
* @param dLayer The extent in the layer which defines a neighborhood.
* @param ncells The minimum number of cells required to constitute a cluster.
*/
-
+
public NearestNeighborClusterDriver(int dU, int dV, int dLayer, int ncells)
{
this(dU, dV, dLayer, ncells, 0);
}
-
+
/**
* Process an event. Extract calorimeter cells from collections contained in the
* event, cluster the cells using a nearest-neighbor algorithm, and add these
@@ -98,7 +100,7 @@
protected void process(EventHeader event)
{
//First look for clusters in individual collections
-
+
List<List<CalorimeterHit>> collections = event.get(CalorimeterHit.class);
for (List<CalorimeterHit> collection: collections)
{
@@ -123,9 +125,11 @@
{
CalorimeterIDDecoder decoder = (CalorimeterIDDecoder) event.getMetaData(collection).getIDDecoder();
List<BasicCluster> clusters = _clusterer.findClusters(collection,decoder);
-
- if (clusters.size() > 0)
- event.put(name+_nameExt,clusters);
+
+ if (clusters.size() > 0) {
+ int flag = 1 << LCIOConstants.CLBIT_HITS;
+ event.put(name+_nameExt,clusters,Cluster.class,(1<<31));
+ }
}
}
}
@@ -150,10 +154,10 @@
_collNames = names;
_doall = false;
}
-
+
public String toString()
{
return "NearestNeighborClusterDriver with clusterer "+_clusterer;
}
-
+
}