Print

Print


Commit in lcsim/src/org/lcsim/digisim on MAIN
CalHitMapDriver.java-551.3 removed
CalHitMapMgr.java-1531.6 removed
-208
2 removed files
GL: Moved to recon.cluster.util

lcsim/src/org/lcsim/digisim
CalHitMapDriver.java removed after 1.3
diff -N CalHitMapDriver.java
--- CalHitMapDriver.java	18 Jul 2005 19:18:25 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,55 +0,0 @@
-package org.lcsim.digisim;
-
-import org.lcsim.util.Driver;
-import org.lcsim.event.EventHeader;
-
-/**
- * A helper driver to build calorimeter hit maps.
- * This class uses CalHitMapMgr for filling and delivering the hit maps,
- * so this class is basically a Driver for the org.lcsim framework.
- *
- * @author Guilherme Lima
- * @version $Id: CalHitMapDriver.java,v 1.3 2005/07/18 19:18:25 tonyj Exp $
- * @see CalHitMapMgr
- */
-public class CalHitMapDriver extends Driver {
-
-    /** constructor */
-    public CalHitMapDriver() {
-//    _description=" A singleton providing fast data access to cal hits via maps:\n no need to fill those maps yourself.";
-
-      _mgr = CalHitMapMgr.getInstance();
-      assert _mgr!=null : "";
-    }
-
-    /** Called at the begin of job before anything is read.
-     * Used to initialize the driver, e.g. book histograms.
-     */
-    public void init() {
-	assert CalHitMapMgr.getInstance() != null
-	    : "Error: No CalHitMapMgr instance available.";
-    }
-
-//     /** Called for every run.
-//      */
-//     public void processRunHeader( LCRunHeader run ) {};
-
-    /** Called for every event - the working horse.
-     */
-    protected void process( EventHeader evt ) {
-      _mgr.setEvent(evt);
-    }
-
-    /** Called after data processing for clean up.
-     */
-    public void end() { }
-
-    //*** FIELDS ***
-
-    /** Run number */
-    private int _nRun;
-    /** Event number */
-    private int _nEvt;
-    /** Reference to the singleton class CalHitMapMgr */
-    private CalHitMapMgr _mgr;
-}

lcsim/src/org/lcsim/digisim
CalHitMapMgr.java removed after 1.6
diff -N CalHitMapMgr.java
--- CalHitMapMgr.java	20 Jul 2005 21:04:13 -0000	1.6
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,153 +0,0 @@
-package org.lcsim.digisim;
-
-import java.util.List;
-import java.util.Map;
-import java.util.HashMap;
-
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.SimCalorimeterHit;
-import org.lcsim.geometry.Detector;
-import org.lcsim.geometry.compact.Subdetector;
-import org.lcsim.geometry.compact.Readout;
-
-/**
- * Arranges calorimeter hits in maps keyed by cellID.  Hits can then
- * be randomly accessed from the cellID.  Once filled, the maps can be
- * accessed from *any* class, using
- *
- *   Map<Long,SimCalorimeterHit> hitmap
- *     = CalHitMapMgr.getInstance().getCollHitMap("colName");
- *
- * @author Guilherme Lima
- * @version $Id: CalHitMapMgr.java,v 1.6 2005/07/20 21:04:13 lima Exp $
- */
-public class CalHitMapMgr {
-
-    /**
-     * Return the instance of CalHitMapMgr (to be used instead of
-     * constructor)
-     */
-    public static CalHitMapMgr getInstance() {
-	if( _me == null ) _me = new CalHitMapMgr();
-	assert _me != null : "Problem constructing CalHitMapMgr.";
-	return _me;
-    }
-
-    /**
-     * Sets current event and fill subdetectors map.  This should be
-     * always called first, before any hit map can be requested.  A
-     * driver exists for this purpose, called CalHitMapDriver.
-     * @see CalHitMapDriver
-     */
-    public void setEvent(EventHeader event) {
-      if( _event!=event || event.getEventNumber()!=_evtno
-	  || event.getRunNumber()!=_runno ) {
-	_me.reset();
-	_me._event = event;
-	_me._runno = event.getRunNumber();
-	_me._evtno = event.getEventNumber();
-
-	// fill subdetectors map
-	Detector det = _event.getDetector();
-	for( Subdetector idet : det.getSubdetectors().values() ) {
-	  Readout ro = idet.getReadout();
-	  if( ro != null ) _subdets.put( ro.getName(), idet );
-	}
-      }
-    }
-
-    public EventHeader getEvent() {
-	return _event;
-    }
-
-    public Detector getDetector() {
-	return _event.getDetector();
-    }
-
-    public Subdetector getSubdetector(String readout) {
-	return _subdets.get(readout);
-    }
-
-    /**
-     * Returns a hit map, with all hits contained in a given collection.
-     * @param colName name of collection with data to be returned
-     */
-    public final Map<Long,SimCalorimeterHit> getCollHitMap(final String colName) {
-	Map<Long,SimCalorimeterHit> retColl = _collMap.get( colName );
-	if(retColl==null) {
-	    // if it does not exist, create it now
-	    retColl = new HashMap<Long,SimCalorimeterHit>();
-	    _collMap.put(colName, retColl);
-	}
-	assert retColl!=null : "retColl is empty for colName="+colName;
-	if( retColl.size()==0 ) fillHitMap( colName, retColl );
-	return retColl;
-    }
-
-    /** Private constructor */
-    protected CalHitMapMgr() {
-	_collMap = new HashMap< String, Map<Long,SimCalorimeterHit> >();
-    }
-
-    /** Clear hit maps */
-    private void reset() {
-	// Loop over all existing hit collections
-	for( String key : _collMap.keySet() ) {
-	    // clear hit maps for each subdetector collection
-	    Map<Long,SimCalorimeterHit> subDetHitMap = _collMap.get(key);
-	    subDetHitMap.clear();
-	}
-	_collMap.clear();
-	_subdets.clear();
-    }
-
-    /**
-     * Fills hit maps using data from current event.
-     * @param colName name of hit collection to extract the hits from
-     * @param hitmap output map containing
-     * @see CalHitMapMgr.setEvent
-     */
-    private void fillHitMap( final String colName,
-			     Map<Long,SimCalorimeterHit> hitmap )  {
-
- 	assert _event!=null : "No event seems to be available.";
-
-	// First fill the hit map without defining densities,
-	// as the map may be used for calculating densities
-	List<SimCalorimeterHit> hits = null;
-	try {
-	    hits = _event.get( SimCalorimeterHit.class, colName );
-	}
-// 	catch(DataNotAvailableException e) {
-	catch(Exception e) {
-// 	    System.out.println(" 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
-	if(hits==null) return;
-
-	for( int i = 0; i<hits.size(); ++i ) {
-	    SimCalorimeterHit ihit = hits.get(i);
-	    long cellid = ihit.getCellID();
-
-	    // fill hit map
-	    hitmap.put( cellid, ihit );
-	}
-    }
-
-    //=== FIELDS ===
-    /** Singleton instance */
-    private static CalHitMapMgr _me = new CalHitMapMgr();
-    /** Current event */
-    private EventHeader _event;
-    /** Run number */
-    private int _runno;
-    /** Event number */
-    private int _evtno;
-    /** Map of hit maps, keyed by collection name where hits come from */
-    private Map< String, Map<Long, SimCalorimeterHit> > _collMap;
-    /** Map of subdetectors keyed by collection names */
-    private Map<String,Subdetector> _subdets = new HashMap<String,Subdetector>();
-}
CVSspam 0.2.8