Print

Print


Commit in lcsim/src/org/lcsim/recon/cluster/util on MAIN
CalHitMapMgr.java+24-31.4 -> 1.5
GL: Add energy threshold, and improve documentation

lcsim/src/org/lcsim/recon/cluster/util
CalHitMapMgr.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- CalHitMapMgr.java	12 Dec 2005 05:49:20 -0000	1.4
+++ CalHitMapMgr.java	27 Dec 2005 16:40:13 -0000	1.5
@@ -23,7 +23,7 @@
  * processed before the data is available to other classes.
  *
  * @author Guilherme Lima
- * @version $Id: CalHitMapMgr.java,v 1.4 2005/12/12 05:49:20 lima Exp $
+ * @version $Id: CalHitMapMgr.java,v 1.5 2005/12/27 16:40:13 lima Exp $
  * @see CalHitMapDriver
  */
 public class CalHitMapMgr {
@@ -47,6 +47,7 @@
      * @see CalHitMapDriver
      */
     public void setEvent(EventHeader event) {
+	System.out.println("Mgr: event="+event+", _evtno="+_evtno+", runno="+_runno);
       if( _event!=event || event.getEventNumber()!=_evtno
 	  || event.getRunNumber()!=_runno ) {
 	_me.reset();
@@ -81,8 +82,25 @@
     }
 
     /**
+     * Returns a hit map, with all hits above the energy threshold,
+     * contained in a given collection.
+     * @param colName Name of collection with data to be returned
+     * @param eMin Threshold to be applied to raw (not corrected) energy
+     * @return a hitmap keyed by cell ID
+     */
+    public final Map<Long,CalorimeterHit> getCollHitMap(final String colName, double eMin) {
+	Map<Long,CalorimeterHit> retColl = new HashMap<Long,CalorimeterHit>();
+	Map<Long,CalorimeterHit> fullColl = this.getCollHitMap(colName);
+	for(CalorimeterHit hit : fullColl.values()) {
+	    if(hit.getRawEnergy()>eMin) retColl.put( hit.getCellID(), hit );
+	}
+	return retColl;
+    }
+
+    /**
      * Returns a hit map, with all hits contained in a given collection.
      * @param colName name of collection with data to be returned
+     * @return a hitmap keyed by cell ID
      */
     public final Map<Long,CalorimeterHit> getCollHitMap(final String colName) {
 	Map<Long,CalorimeterHit> retColl = _collMap.get( colName );
@@ -232,6 +250,7 @@
     private void fillLayerHitMap( final String colName ) {
 // 				  Map<Integer,List<CalorimeterHit>> layerHits,
 // 				  Map<Integer,Integer> layerHitCounters)  {
+	System.out.println("filling layer hitmaps: "+colName);
  	assert _event!=null : "No event seems to be available, is CalHitMapDriver added before current driver?";
 
 	// First fill the hit map without defining densities,
@@ -242,12 +261,13 @@
 	}
 // 	catch(DataNotAvailableException e) {
 	catch(Exception e) {
-// 	    System.out.println(" Evt "+_event.getEventNumber()
-// 			       +": No data in collection "+colName);
+ 	    System.out.println("fillLayerHitmap: Evt "+_event.getEventNumber()
+ 			       +": No data in collection "+colName);
 	    // This happens quite frequently with tail catcher,
 	    // when no energy leaks into it
 	}
 	// return if no collection in event
+	System.out.println("#hits = "+hits.size());
 	if(hits==null) return;
 
 	Map<Integer,List<CalorimeterHit>> layerHits;
@@ -284,6 +304,7 @@
 		layerCounters.put( layer, tmpCounter );
 	    }
 	    ++tmpCounter;
+	    layerCounters.put( layer, tmpCounter );
 	}
     }
 
CVSspam 0.2.8