Print

Print


Commit in lcsim/src/org/lcsim/recon/cluster/nn on MAIN
NearestNeighborClusterDriver.java+41-51.2 -> 1.3
Add a little more flexibility, keep the default the same

lcsim/src/org/lcsim/recon/cluster/nn
NearestNeighborClusterDriver.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- NearestNeighborClusterDriver.java	18 Jul 2005 19:18:27 -0000	1.2
+++ NearestNeighborClusterDriver.java	18 Oct 2005 18:53:53 -0000	1.3
@@ -34,6 +34,12 @@
    private double _thresh;
    // Create clusters class
    private NearestNeighborClusterer _clusterer;
+   // extension of collection name for writing clusters to event
+   private String _nameExt;
+   // flag to cluster all collections
+   private boolean _doall;
+   // list of collections to cluster
+   private String[] _collNames;
    
    /**
     * Creates a new instance of NearestNeighborClusterDriver with a domain of (1,1,1)
@@ -62,6 +68,8 @@
       _dLayer = dLayer;
       _minNcells = ncells;
       _thresh = threshold;
+      _nameExt = "NNClusters";
+      _doall = true;
       _clusterer = new NearestNeighborClusterer(_dU,_dV,_dLayer,_minNcells,_thresh);
    }
    
@@ -92,14 +100,42 @@
       List<List<CalorimeterHit>> collections = event.get(CalorimeterHit.class);
       for (List<CalorimeterHit> collection: collections)
       {
-         CalorimeterIDDecoder decoder = (CalorimeterIDDecoder) event.getMetaData(collection).getIDDecoder();
-         List<BasicCluster> clusters = _clusterer.findClusters(collection,decoder);
-         
          String name = event.getMetaData(collection).getName();
-         if (clusters.size() > 0)
-             event.put(name+"NNClusters",clusters);
+         boolean doit = false;
+         if(_doall)
+         {
+             doit = true;
+         }
+         else
+         {
+             for(int i=0;i<_collNames.length;i++)
+             {
+                 if(name.compareTo(_collNames[i]) == 0)
+                 {
+                     doit = true;
+                     break;
+                 }
+             }
+         }
+         if(doit)
+         {
+            CalorimeterIDDecoder decoder = (CalorimeterIDDecoder) event.getMetaData(collection).getIDDecoder();
+            List<BasicCluster> clusters = _clusterer.findClusters(collection,decoder);
+         
+            if (clusters.size() > 0)
+                event.put(name+_nameExt,clusters);
+         }
       }
    }
+   public void setNameExt(String ext)
+   {
+       _nameExt = ext;
+   }
+   public void setCollectionNames(String[] names)
+   {
+       _collNames = names;
+       _doall = false;
+   }
    
    public String toString()
    {
CVSspam 0.2.8