Commit in lcsim/src/org/lcsim/recon/cluster/directedtree on MAIN
DTreeAnalysis.java+1-21.4 -> 1.5
DirectedTreeClusterer.java+128-1331.4 -> 1.5
HitWeightingClusterPropertyCalculator.java+6-21.1 -> 1.2
LoadMyCalorimeterHit.java+2-11.4 -> 1.5
RunControlParameters.java+167-351.4 -> 1.5
ClusterBuilder.java+8-11.3 -> 1.4
+312-174
6 modified files

New capabilities:

- more algorithm parameters can be set via top driver

- multiple distinct DTree clustering algorithms can be run in parallel

lcsim/src/org/lcsim/recon/cluster/directedtree
DTreeAnalysis.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- DTreeAnalysis.java	15 Mar 2006 12:27:40 -0000	1.4
+++ DTreeAnalysis.java	21 Jun 2006 18:03:31 -0000	1.5
@@ -29,7 +29,7 @@
 
     // constructor
     public DTreeAnalysis() {
-        _runPar = RunControlParameters.getInstance();
+        _runPar = new RunControlParameters();
 	_emEcut = _runPar.getEMmip() * _runPar.getEMthresh() / _runPar.getEMweight();
 	_hdEcut = _runPar.getHDmip() * _runPar.getHDthresh() / _runPar.getHDweight();
 	_format.setMinimumFractionDigits(12);
@@ -539,7 +539,6 @@
     private ITuple emmcClusFolder,emmcCellFolder;
     private ITuple hdmcClusFolder,hdmcCellFolder;
     private ITuple _tupleTrkMatch;
-    private ClusterBuilder clusBuilder = new ClusterBuilder();
     private int layerIndex, uIndex, vIndex;
     private double _emEcut, _hdEcut;
 

lcsim/src/org/lcsim/recon/cluster/directedtree
DirectedTreeClusterer.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- DirectedTreeClusterer.java	15 Mar 2006 12:27:43 -0000	1.4
+++ DirectedTreeClusterer.java	21 Jun 2006 18:03:31 -0000	1.5
@@ -12,7 +12,10 @@
 import org.lcsim.event.CalorimeterHit;
 import org.lcsim.event.MCParticle;
 import org.lcsim.geometry.compact.Readout;
-import org.lcsim.geometry.segmentation.SegmentationBase;
+// import org.lcsim.geometry.segmentation.SegmentationBase;
+import org.lcsim.geometry.IDDecoder;
+import org.lcsim.geometry.subdetector.CylindricalCalorimeter;
+import org.lcsim.geometry.subdetector.CalorimeterType;
 import org.lcsim.digisim.CellSelector;
 import org.lcsim.recon.cluster.util.CalHitMapMgr;
 import org.lcsim.recon.cluster.util.BasicCluster;
@@ -25,7 +28,13 @@
     private int _debug = 0;
 
     public DirectedTreeClusterer() {
-        _rcp = RunControlParameters.getInstance();
+        _rcp = new RunControlParameters();
+	_loader = LoadMyCalorimeterHit.getInstance();
+	_clusBuilder= new ClusterBuilder(_rcp);
+    }
+
+    public void setSteeringFile(String filename) {
+ 	_rcp.setSteeringFile(filename);
     }
 
     public void process(EventHeader event) {
@@ -35,78 +44,46 @@
 	  System.out.println("Start DirectedTreeClusterer, event #"+_evtnum);
 	}
 
-	// load readout map (decoders)
-        _roMap = event.getDetector().getReadouts();
-
 	if( underUserControl() ) {
 	    // Assumes that collection is a hitmap.  Failure otherwise.
 	    Map<Long,CalorimeterHit> hitmap = new HashMap<Long,CalorimeterHit>( (Map<Long,CalorimeterHit>)event.get(_inputHitMapName) );
 
-	    processCollection(event, _inputHitMapName, hitmap);
-	}
-
-        else {  // originally, input collections were lists rather than maps
-	    // from lists...
-	    String embName = "EcalBarrDigiHits";
-	    String emeName = "EcalEndcapDigiHits";
-	    String hdbName = "HcalBarrDigiHits";
-	    String hdeName = "HcalEndcapDigiHits";
-	    // ... get hitmaps
-	    embhitmap = _expert.getCollHitMap(embName);
-	    emehitmap = _expert.getCollHitMap(emeName);
-	    hdbhitmap = _expert.getCollHitMap(hdbName);
-	    hdehitmap = _expert.getCollHitMap(hdeName);
-
-	    // define densities
-	    _loader.setDensities(embName, embhitmap);
-	    _loader.setDensities(emeName, emehitmap);
-	    _loader.setDensities(hdbName, hdbhitmap);
-	    _loader.setDensities(hdeName, hdehitmap);
-
-	    if(_debug>0) {
-		System.out.println("DTree: #hits: EMB="+embhitmap.size()
-				   +", EMEC="+emehitmap.size()
-				   +", HB="+hdbhitmap.size()
-				   +", HEC="+hdehitmap.size());
-	    }
-
-	    if(_rcp.ClusterSeparately()) {
-		_calType = "EM";
-		processCollection(event, embName, embhitmap);
-		processCollection(event, emeName, emehitmap);
-
-		_calType = "HD";
-		processCollection(event, hdbName, hdbhitmap);
-		processCollection(event, hdeName, hdehitmap);
-	    }
-	    else {
-		assert false : "Sorry, single-pass DTree clustering unavailable for now.";
-//             Vector calhit = new Vector();
-//             calhit.addAll(embhit.values());
-//             calhit.addAll(emehit.values());
-//             calhit.addAll(hdbhit.values());
-//             calhit.addAll(hdehit.values());
-
-//             cahitmap = new HashMap();
-//             cahitmap.putAll(embhitmap);
-//             cahitmap.putAll(emehitmap);
-//             cahitmap.putAll(hdbhitmap);
-//             cahitmap.putAll(hdehitmap);
+	    // define densities (should use user-provided hitmaps instead??)
+	    _loader.setDefaultDensities();
+	    // do the clustering
+	    List<BasicCluster> result = processHitmap( hitmap );
+	    // store results
+	    event.put( _outputClusterListName, result, Cluster.class, _flags);
+
+	    if( !_outputHitMapName.equals("") ) {
+		// get list of useds successfully clustered
+		Collection<CalorimeterHit> usedHits = new HashSet<CalorimeterHit>();
+		for(Cluster clus : result) {
+		    usedHits.addAll(clus.getCalorimeterHits());
+		}
 
-//             Vector[] calTrees = makeTree(calhit,cahitmap);
+		// get list of unclustered hits
+		Map<Long,CalorimeterHit> unusedHits = new HashMap<Long,CalorimeterHit>(hitmap);
+		for(CalorimeterHit hit : usedHits) {
+		    unusedHits.remove( hit.getCellID() );
+		}
 
-//             ClusterBuilder clus = new ClusterBuilder();
-//             List caClusters = clus.makeClusters(calTrees,_rcp);
+		// append hitmap of unused hits to the event
+		event.put( _outputHitMapName, unusedHits );
 	    }
 	}
 
+        else {
+	    processOriginal(event);
+	}
     }
 
-    public List<List<CalorimeterHit>>
-	makeTree(Map<Long,CalorimeterHit> cahitmap, SegmentationBase segBase) {
+    /** This is the main clustering routine
+     */
+    public List<List<CalorimeterHit>> makeTree(Map<Long,CalorimeterHit> cahitmap) {
 
 	if(_debug>0) {
-	  System.out.println("makeTree: cahitmap size="+cahitmap.size());
+	    System.out.println("DTreeClusterer.makeTree(): #hits="+cahitmap.size());
 	}
         _ParentMap = new HashMap<Long,Long>();
         List<CalorimeterHit> RootVec = new ArrayList<CalorimeterHit>();
@@ -119,29 +96,41 @@
             long cellid = ihit.getCellID();
             double idens = _loader.getDensity( cellid );
 
-	    SegmentationBase segm = segBase;
-	    if(underUserControl()) segm = (SegmentationBase)ihit.getIDDecoder();
+// 	    SegmentationBase segm = segBase;
+	    IDDecoder segm = ihit.getIDDecoder();
 	    segm.setID(cellid);
      	    if(_debug>1) {
-	    double mcpE = ((org.lcsim.event.SimCalorimeterHit)ihit).getMCParticle(0).getEnergy();
+		double mcpE = ((org.lcsim.event.SimCalorimeterHit)ihit).getMCParticle(0).getEnergy();
 		System.out.println("DTree: hit ID="+MyTools.printID(cellid)
 				   +", dens="+idens
 				   +", rawE="+ihit.getRawEnergy()
 				   +", mcpE="+mcpE);
  	    }
 
-	    assert !underUserControl() : "*** DTree: need to set calType properly before proceeding";
-// 	    int sysno = segm.getSystem();
-// 	    if(sysno==) _calType = "EM";
-// 	    if(sysno==) _calType = "HD";
-// 	    System.out.println("Sysno="+sysno);
 
-            double maxdensDiff = -999999.;
+	    // Identify calorimeter type for component-specific config
+	    CylindricalCalorimeter cal = (CylindricalCalorimeter)ihit.getSubdetector();
+	    CalorimeterType type = cal.getCalorimeterType();
+	    if( type.isEcal() ) _calType = "EM";
+	    if( type.isHcal() ) _calType = "HD";
+	    if( !type.isEcal() && !type.isHcal() ) {
+		// isXcal() is not implemented... use system number for now
+		int sysno = cal.getSystemID();
+		if(sysno==2 || sysno==6) _calType = "EM";
+		else if(sysno==3 || sysno==7) _calType = "HD";
+		else {
+		    assert false : "*** DirectedTreeClusterer: Unexpected sysno="+sysno;
+		}
+	    }
+// 	    System.out.println("calType="+_calType+", isEcal="+type.isEcal()+", isHcal="+type.isHcal());
+
+	    double maxdensDiff = -999999.;
 	    double parDensity = -1;
 	    long maxdensID = -999999;
             List<Long> nVec = new ArrayList<Long>();
 	    // changed from !=0
-            if(idens>=0.0) {
+
+            if(idens>=_rcp.getMinimumDensity() && idens<=_rcp.getMaximumDensity()) {
 	       double[] ipos = ihit.getPosition();
 	       if(_calType=="EM"){
 		 int nLyrOrig = _rcp.getLyrNeighEM();
@@ -285,10 +274,12 @@
                     }
                 }
 	    }
-            else{
-                RootVec.add(ihit);
- 		if(_debug>1) System.out.println("Zero density root");
-            }
+	    else{
+		if(_rcp.getMinimumDensity()==1 && _rcp.getMaximumDensity()==100000) {  // default values
+		    RootVec.add(ihit);
+		    if(_debug>1) System.out.println("Zero density root");
+		}
+	    }
         }
 
         List<CalorimeterHit> startingPoints = new ArrayList<CalorimeterHit>();
@@ -387,69 +378,57 @@
 	return region;
     }
 
-    private void processCollection(EventHeader event, String colName,
-				   Map<Long,CalorimeterHit> hitmap) {
+    /** Original behaviour was to process a pre-defined list of
+     * collections, each collection being a List<CalorimeterHits>
+     */
+    private void processOriginal(EventHeader event)
+    {
+	if(_rcp.ClusterSeparately()) {
+	    for(String colName : _origNames) {
+		// get a hitmap
+		Map<Long,CalorimeterHit> hitmap = _expert.getCollHitMap(colName);
+		// define densities
+		_loader.setDensities(colName, hitmap);
+		// do the clustering
+		List<BasicCluster> result = processHitmap( hitmap );
+		// store the results
+		String newName = new String(colName+"DTreeClusters");
+		event.put( newName, result, Cluster.class, _flags );
+	    }
+	}
+	else {
+	    // one-pass clustering: a single hitmap is needed
+	    Map<Long,CalorimeterHit> hitmap = new HashMap<Long,CalorimeterHit>();
+	    for(String colName : _origNames) {
+		Map<Long,CalorimeterHit> tmpmap = _expert.getCollHitMap(colName);
+		hitmap.putAll( tmpmap );
+		// define densities
+		_loader.setDensities(colName, hitmap);
+	    }
+
+	    // do the clustering
+	    List<BasicCluster> result = processHitmap( hitmap );
+	    // store the results
+	    String newName = new String("SinglePassDTreeClusters");
+	    event.put( newName, result, Cluster.class, _flags );
+	}
+    }
 
-      if(_debug>0) {
-	  System.out.println("*** procColl: colName="+colName
-			     +", # hits="+hitmap.size());
-      }
-
-      String roName = colName.replace("Digi","");
-      SegmentationBase segm
-	  = (SegmentationBase)_roMap.get(roName).getSegmentation();
-      List<List<CalorimeterHit>> trees = makeTree(hitmap, segm);
-//       if(colName.contains("Ecal")) {
-// 	  Iterator<List<CalorimeterHit>> it = trees.iterator();
-// 	  while(it.hasNext()) {
-// 	      List<CalorimeterHit> clus = it.next();
-// 	      int size = clus.size();
-// 	      if(size>10&&size<20) {
-// 		  System.out.println("Event: "+event.getEventNumber()+", cluster size="+size+" -- List of hits:");
-// 		Iterator<CalorimeterHit> it2 = clus.iterator();
-// 		while(it2.hasNext()) {
-// 		  CalorimeterHit hit = it2.next();
-// 		  System.out.println("hit: "+MyTools.printID(hit.getCellID()));
-// 		}
-// 	      }
-// 	  }
-//       }
+    // Not doing much for now, but makeTree will be moved out to a standalone class at some point
+    private List<BasicCluster> processHitmap( Map<Long,CalorimeterHit> hitmap )
+    {
+      List<List<CalorimeterHit>> trees = makeTree(hitmap);
 
       List<BasicCluster> recoClusColl = new ArrayList<BasicCluster>();
       if(trees.size()>0)
 	  recoClusColl = _clusBuilder.makeClusters( trees );
 
-      // Append clusters to the event
-      if( underUserControl() ) {
-	  event.put( _outputClusterListName, recoClusColl, Cluster.class, _flags);
-      }
-      else if (recoClusColl.size() > 0) {
-	  String newName = new String(colName+"DTreeClusters");
-	  event.put( newName, recoClusColl, Cluster.class, _flags );
-      }
-
-//       int nhits = hitmap.size();
-//       AIDA aida = AIDA.defaultInstance();
-//       aida.cloud1D(colName+"-Nhits").fill( nhits );
-//       aida.cloud1D(colName+"-NmcHits").fill(mchits);
-//       aida.cloud1D(colName+"-diffHitsColl-mc").fill(nhits-mchits);
-//       aida.cloud1D(colName+"-numCheatClusters").fill(nclusCheat);
+      return recoClusColl;
     }
 
     /** set name of collection of hits to be clustered */
     public void setInputHitMap(String name) {
 	_inputHitMapName = name;
-	if(_inputHitMapName.contains("Ecal")) _calType = "EM";
-	if(_inputHitMapName.contains("EM")) _calType = "EM";
-	if(_inputHitMapName.contains("Hcal")) _calType = "HD";
-	if(_inputHitMapName.contains("HAD")) _calType = "HD";
-	if(_inputHitMapName.contains("HD")) _calType = "HD";
-	this.setUserControl();
-    }
-
-    /** set name of output hit map with left-over hits */
-    public void setOutputHitMap(String name) {
-	_outputHitMapName = name;
 	this.setUserControl();
     }
 
@@ -459,9 +438,13 @@
 	this.setUserControl();
     }
 
+    /** set name of output hit map with left-over hits */
+    public void setOutputHitMap(String name) {
+	_outputHitMapName = name;
+    }
+
     private void setUserControl() {
-	if( !_outputHitMapName.equals("") &&
-	    !_outputClusterListName.equals("") &&
+	if( !_inputHitMapName.equals("") &&
 	    !_outputClusterListName.equals("") ) {
 	    _userControl = true;
 	}
@@ -471,11 +454,20 @@
 	return _userControl;
     }
 
+    public void setDebugLevel(int deb) {
+	_debug = deb;
+    }
+
+    /** Set minimum number of hits required for clusters to be saved
+     */
+    public void setMinimumClusterSize(int minsize) {
+	_clusBuilder.setMinimumSize(minsize);
+    }
+
     // *** FIELDS ***
 
-    private static Map<String,Readout> _roMap;
-    private static RunControlParameters _rcp;
-    private LoadMyCalorimeterHit _loader = LoadMyCalorimeterHit.getInstance();
+    private RunControlParameters _rcp;
+    private LoadMyCalorimeterHit _loader;
     private CalHitMapMgr _expert = CalHitMapMgr.getInstance();
     private Map<Long,Long> _ParentMap;
     private Map<Long,CalorimeterHit> embhitmap,emehitmap,hdbhitmap,hdehitmap;
@@ -485,7 +477,7 @@
     private int _nPhi;
     private int _evtnum;
 
-    private ClusterBuilder _clusBuilder = new ClusterBuilder();
+    private ClusterBuilder _clusBuilder;
     private int _flags = 1<<31; // store hits in clusters
 
     // collection names for user steering
@@ -493,4 +485,7 @@
     private String _outputHitMapName = "";
     private String _outputClusterListName = "";
     private boolean _userControl = false;
+
+    private String[] _origNames = {"EcalBarrDigiHits", "EcalEndcapDigiHits",
+				   "HcalBarrDigiHits", "HcalEndcapDigiHits"};
 }

lcsim/src/org/lcsim/recon/cluster/directedtree
HitWeightingClusterPropertyCalculator.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- HitWeightingClusterPropertyCalculator.java	8 Jan 2006 14:28:22 -0000	1.1
+++ HitWeightingClusterPropertyCalculator.java	21 Jun 2006 18:03:31 -0000	1.2
@@ -32,7 +32,7 @@
  */
 public class HitWeightingClusterPropertyCalculator extends DefaultClusterPropertyCalculator
 {
-    RunControlParameters _runPar = RunControlParameters.getInstance();
+    RunControlParameters _runPar = null;
     LoadMyCalorimeterHit _loader = LoadMyCalorimeterHit.getInstance();
 
     public void calculateProperties(List<CalorimeterHit> hits)
@@ -42,7 +42,7 @@
       double cluX = 0.0; double cluY = 0.0; double cluZ = 0.0;
       int cluSize = hits.size();
       if(cluSize==0) System.out.println("Damn 2");
-      assert cluSize > 0 : "ClusterBuilder: zero-hits cluster found.";
+      assert cluSize > 0 : "HitWeightingCPC: zero-hits cluster found.";
 
       for( CalorimeterHit hit : hits ){
 	  double ene = hit.getRawEnergy();
@@ -81,4 +81,8 @@
       position[1] = cluY;
       position[2] = cluZ;
     }
+
+    public void setRCP(RunControlParameters rcp) {
+	_runPar = rcp;
+    }
 }

lcsim/src/org/lcsim/recon/cluster/directedtree
LoadMyCalorimeterHit.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- LoadMyCalorimeterHit.java	15 Mar 2006 12:27:46 -0000	1.4
+++ LoadMyCalorimeterHit.java	21 Jun 2006 18:03:32 -0000	1.5
@@ -28,7 +28,8 @@
     private LoadMyCalorimeterHit() {
 	if(_me==null) _me=this;
 	_densityMap = new HashMap<Long,Double>();
-        _runPar = RunControlParameters.getInstance();
+	// Use *default* RCP parameters (no steering files, for consistency)
+        _runPar = new RunControlParameters();
     }
 
     public void setEvent(EventHeader event) {

lcsim/src/org/lcsim/recon/cluster/directedtree
RunControlParameters.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- RunControlParameters.java	22 May 2006 18:52:47 -0000	1.4
+++ RunControlParameters.java	21 Jun 2006 18:03:32 -0000	1.5
@@ -2,16 +2,17 @@
 
 public class RunControlParameters {
 
-    static RunControlParameters getInstance() {
-        if(_me==null) {
-            _me = new RunControlParameters();
-        }
-        return _me;
+    // default constructor
+    RunControlParameters() {
+	this.defaultValues();
     }
 
-    private RunControlParameters() {
-        if(_me==null) _me=this;
+    void setSteeringFile(String f) {
+	System.out.println("Updating parameters from steering file: "+f+".");
+	this.updateFromSteeringFile( f );
+    }
 
+    void defaultValues() {
 	_minHits= 0;
 
 	// sidaug05_tcmt (and SDNPHOct04 certification)
@@ -28,12 +29,18 @@
 
         _EMthresh = 0.25; // was 0.25
         _HDthresh = 0.25; // was 0.25
+
+	// density neighborhood
         _lyrNeighEM = 8; // was 8 ???
         _zNeighEM = 4; // was 4 ???
         _phiNeighEM = 4; // was 4 ???
         _lyrNeighHD = 8; // was 8 ???
         _zNeighHD = 4; // was 4 ???
         _phiNeighHD = 4; // was 4 ???
+
+	_minimumDensity = 1;
+	_maximumDensity = 100000;
+
 	_lyrContractionEM = new int[3];
 	_lyrContractionEM[0] = 0;
 	_lyrContractionEM[1] = -7;
@@ -76,142 +83,267 @@
 	_emSigma[2] = 1.5;
     }
 
+    private void updateFromSteeringFile(String file) {
+	// Pull window parameters from steering file
+        if(file != null) {
+	    try {
+		ConfigReader reader = new ConfigReader(file);
+
+		String temp;
+
+		// ECAL Neighborhood Window
+		temp  = reader.getTokenWithPattern(2,"lyrNeighEM");
+		_lyrNeighEM = Integer.parseInt(temp);
+
+		temp  = reader.getTokenWithPattern(2,"zNeighEM");
+		_zNeighEM = Integer.parseInt(temp);
+
+		temp  = reader.getTokenWithPattern(2,"phiNeighEM");
+		_phiNeighEM = Integer.parseInt(temp);
+
+		// layer contraction EM
+		_lyrContractionEM = new int[3];
+		temp = reader.getTokenWithPattern(2,"lyrContractionEM[0]");
+		_lyrContractionEM[0] = Integer.parseInt(temp);
+
+		temp = reader.getTokenWithPattern(2,"lyrContractionEM[1]");
+		_lyrContractionEM[1] = Integer.parseInt(temp);
+
+		temp = reader.getTokenWithPattern(2,"lyrContractionEM[2]");
+		_lyrContractionEM[2] = Integer.parseInt(temp);
+
+		// z contraction EM
+		_zContractionEM = new int[3];
+		temp = reader.getTokenWithPattern(2,"zContractionEM[0]");
+		_zContractionEM[0] = Integer.parseInt(temp);
+
+		temp = reader.getTokenWithPattern(2,"zContractionEM[1]");
+		_zContractionEM[1] = Integer.parseInt(temp);
+
+		temp = reader.getTokenWithPattern(2,"zContractionEM[2]");
+		_zContractionEM[2] = Integer.parseInt(temp);
+
+		// phi contraction EM
+		_phiContractionEM = new int[3];
+		temp = reader.getTokenWithPattern(2,"phiContractionEM[0]");
+		_phiContractionEM[0] = Integer.parseInt(temp);
+
+		temp = reader.getTokenWithPattern(2,"phiContractionEM[1]");
+		_phiContractionEM[1] = Integer.parseInt(temp);
+
+		temp = reader.getTokenWithPattern(2,"phiContractionEM[2]");
+		_phiContractionEM[2] = Integer.parseInt(temp);
+
+		// HCAL Neighborhood Window
+		temp  = reader.getTokenWithPattern(2,"lyrNeighHD");
+		_lyrNeighHD = Integer.parseInt(temp);
+
+		temp  = reader.getTokenWithPattern(2,"zNeighHD");
+		_zNeighHD = Integer.parseInt(temp);
+
+		temp  = reader.getTokenWithPattern(2,"phiNeighHD");
+		_phiNeighHD = Integer.parseInt(temp);
+
+		// layer contraction HD
+		_lyrContractionHD = new int[3];
+		temp = reader.getTokenWithPattern(2,"lyrContractionHD[0]");
+		_lyrContractionHD[0] = Integer.parseInt(temp);
+
+		temp = reader.getTokenWithPattern(2,"lyrContractionHD[1]");
+		_lyrContractionHD[1] = Integer.parseInt(temp);
+
+		temp = reader.getTokenWithPattern(2,"lyrContractionHD[2]");
+		_lyrContractionHD[2] = Integer.parseInt(temp);
+
+		// z contraction HD
+		_zContractionHD = new int[3];
+		temp = reader.getTokenWithPattern(2,"zContractionHD[0]");
+		_zContractionHD[0] = Integer.parseInt(temp);
+
+		temp = reader.getTokenWithPattern(2,"zContractionHD[1]");
+		_zContractionHD[1] = Integer.parseInt(temp);
+
+		temp = reader.getTokenWithPattern(2,"zContractionHD[2]");
+		_zContractionHD[2] = Integer.parseInt(temp);
+
+		// phi contraction HD
+		_phiContractionHD = new int[3];
+		temp = reader.getTokenWithPattern(2,"phiContractionHD[0]");
+		_phiContractionHD[0] = Integer.parseInt(temp);
+
+		temp = reader.getTokenWithPattern(2,"phiContractionHD[1]");
+		_phiContractionHD[1] = Integer.parseInt(temp);
+
+		temp = reader.getTokenWithPattern(2,"phiContractionHD[2]");
+		_phiContractionHD[2] = Integer.parseInt(temp);
+
+		temp = reader.getTokenWithPattern(2,"minimumDensity");
+		_minimumDensity = Integer.parseInt(temp);
+
+		temp = reader.getTokenWithPattern(2,"maximumDensity");
+		_maximumDensity = Integer.parseInt(temp);
+
+		reader.close();
+	    }
+	    catch (Exception x) {
+                System.out.println("Error reading steering file: "+x);
+                System.exit(1);
+	    }
+
+        } // if != null
+        else {
+                System.out.println("Error reading steering file.");
+        }
+	// End pull window parameters from steering file
+    }
+
+    private int _minHits;
+    public int getMinimumSize(){
+	return this._minHits;
+    }
+
+    private double _EMsampWt;
     public double getEMweight(){
         return this._EMsampWt;
     }
 
+    private double _EMmip;
     public double getEMmip(){
         return this._EMmip;
     }
 
+    private double _EMthresh;
     public double getEMthresh(){
         return this._EMthresh;
     }
 
+    private double _HDsampWt;
     public double getHDweight(){
         return this._HDsampWt;
     }
 
+    private double _HDmip;
     public double getHDmip(){
         return this._HDmip;
     }
 
+    private double _HDthresh;
     public double getHDthresh(){
         return this._HDthresh;
     }
 
+    private int _lyrNeighEM;
     public int getLyrNeighEM(){
         return this._lyrNeighEM;
     }
 
+    private int _zNeighEM;
     public int getZNeighEM(){
         return this._zNeighEM;
     }
 
+    private int _phiNeighEM;
     public int getPhiNeighEM(){
         return this._phiNeighEM;
     }
 
+    private int _lyrNeighHD;
     public int getLyrNeighHD(){
         return this._lyrNeighHD;
     }
 
+    private int _zNeighHD;
     public int getZNeighHD(){
         return this._zNeighHD;
     }
 
+    private int _phiNeighHD;
     public int getPhiNeighHD(){
         return this._phiNeighHD;
     }
 
+    private String _distanceType;
     public String getDistanceType(){
         return this._distanceType;
     }
 
+    private String _centroidWeightType;
     public String getCentroidWeightType(){
         return this._centroidWeightType;
     }
 
+    private boolean _clusterSeparately;
     public boolean ClusterSeparately(){
         return this._clusterSeparately;
     }
 
+    private double[][] _ModeValleyFactors;
     public double[][] getInfluenceFactors(){
         return this._ModeValleyFactors;
     }
 
+    private double _convergenceParameter;
     public double getConvergenceParameter(){
         return this._convergenceParameter;
     }
 
+    private boolean _prune;
     public boolean Prune(){
 	return this._prune;
     }
 
+    private double _pruningDist;
     public double getPruningDist(){
 	return this._pruningDist;
     }
 
+    private int _maxMaskSize;
     public int getMaxMaskSize(){
 	return this._maxMaskSize;
     }
 
+    private double[] _emSigma;
     public double[] getEMGaussWidths(){
 	return this._emSigma;
     }
 
+    private int[] _lyrContractionEM;
     public int[] getLyrContracEM(){
 	return this._lyrContractionEM;
     }
 
+    private int[] _zContractionEM;
     public int[] getZContracEM(){
 	return this._zContractionEM;
     }
 
+    private int[] _phiContractionEM;
     public int[] getPhiContracEM(){
 	return this._phiContractionEM;
     }
 
+    private int[] _lyrContractionHD;
     public int[] getLyrContracHD(){
 	return this._lyrContractionHD;
     }
 
+    private int[] _zContractionHD;
     public int[] getZContracHD(){
 	return this._zContractionHD;
     }
 
+    private int[] _phiContractionHD;
     public int[] getPhiContracHD(){
 	return this._phiContractionHD;
     }
 
-    public int getMinimumSize(){
-	return this._minHits;
+    private int _minimumDensity;
+    public int getMinimumDensity(){
+	return this._minimumDensity;
     }
 
-    // *****  FIELDS  *****
-
-    private static RunControlParameters _me=null;
-
-    private double _EMsampWt;
-    private double _HDsampWt;
-    private double _EMmip;
-    private double _HDmip;
-    private double _EMthresh;
-    private double _HDthresh;
-    private double _convergenceParameter;
-    private double _pruningDist;
-    private int _lyrNeighEM,_lyrNeighHD;
-    private int _zNeighEM,_zNeighHD;
-    private int _phiNeighEM,_phiNeighHD;
-    private int _maxMaskSize;
-    private String _distanceType;
-    private String _centroidWeightType;
-    private boolean _clusterSeparately;
-    private boolean _prune;
-    private double[][] _ModeValleyFactors;
-    private double[] _emSigma;
-    private int[] _lyrContractionEM,_lyrContractionHD;
-    private int[] _zContractionEM,_zContractionHD;
-    private int[] _phiContractionEM,_phiContractionHD;
-    private int _minHits;
+    private int _maximumDensity;
+    public int getMaximumDensity(){
+	return this._maximumDensity;
+    }
 }

lcsim/src/org/lcsim/recon/cluster/directedtree
ClusterBuilder.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ClusterBuilder.java	22 May 2006 18:52:47 -0000	1.3
+++ ClusterBuilder.java	21 Jun 2006 18:03:32 -0000	1.4
@@ -7,9 +7,16 @@
 
 public class ClusterBuilder {
 
-    int _minClusterSize = RunControlParameters.getInstance().getMinimumSize();
+    int _minClusterSize;
+    RunControlParameters _rcp = null;
     HitWeightingClusterPropertyCalculator _hitWeightingCPC = new HitWeightingClusterPropertyCalculator();
 
+    public ClusterBuilder(RunControlParameters rcp) {
+	_rcp = rcp;
+	_minClusterSize = _rcp.getMinimumSize();
+	_hitWeightingCPC.setRCP( rcp );
+    }
+
     public void setMinimumSize(int newMinimum) {
 	_minClusterSize = newMinimum;
     }
CVSspam 0.2.8