Print

Print


Commit in lcsim/src/org/lcsim/recon/cluster/density on MAIN
LoadMyCalorimeterHit.java+10-991.6 -> 1.7
GL: Removed inheritance to CalHitMapMgr

lcsim/src/org/lcsim/recon/cluster/density
LoadMyCalorimeterHit.java 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- LoadMyCalorimeterHit.java	22 Dec 2005 21:13:11 -0000	1.6
+++ LoadMyCalorimeterHit.java	27 Dec 2005 16:33:56 -0000	1.7
@@ -15,144 +15,60 @@
 import org.lcsim.recon.cluster.util.CalHitMapMgr;
 import org.lcsim.geometry.IDDecoder;
 
-public class LoadMyCalorimeterHit extends CalHitMapMgr {
+public class LoadMyCalorimeterHit {
 
     public static LoadMyCalorimeterHit getInstance() {
  	if(_me==null) {
  	    new LoadMyCalorimeterHit();
-	    System.out.println("Constructing a LoadMyCalorimeterHit object at "+_me);
+	    System.out.println("LoadMyCalorimeterHit object at "+_me);
  	}
 	assert _me != null : "Problem constructing LoadMyCalorimeterHit.";
  	return _me;
     }
 
     private LoadMyCalorimeterHit() {
-	super();
 	if(_me==null) _me=this;
-// 	_collMap = new HashMap<String,Map<Long,CalorimeterHit>>();
 	_densityMap = new HashMap<Long,Double>();
-// 	_subdet2collMap = new HashMap<Subdetector,Map<Long,CalorimeterHit>>();
         _runPar = RunControlParameters.getInstance();
     }
 
     public void setEvent(EventHeader event) {
-	super.setEvent(event);
 	if( event != _event ) {
 	    this.reset();
-// 	    _segmMap = event.getDetector().getReadouts();
-// 	    _event = event;
 	}
     }
 
-    public void reset(){
+    public void reset() {
       // clear hit maps for each subdetector collection
       System.out.println("LoadMyCalorimeter.reset() called");
-//       _subdet2collMap.clear();
       _densityMap.clear();
-//       _segmMap = null;
     }
 
+    // assign densities to every hit in *new* hitmap,
+    // thus density=0 for hits failing energy cut
+    public void setDensities(String colName, Map<Long,CalorimeterHit> hitmap) {
 
-//     /**
-//      * 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,CalorimeterHit> getCollHitMap(final String colName) {
-// 	Map<Long,CalorimeterHit> retColl = _collMap.get( colName );
-// 	if(retColl==null) {
-// 	  // if it does not exist, create it now
-// 	  retColl = new HashMap<Long,CalorimeterHit>();
-// 	  _collMap.put(colName, retColl);
-// 	}
-// 	assert retColl!=null :
-// 	    "getCollHitMap: Could not create a new hitmap collection";
-
-// 	if( retColl.size()==0 ) fillHitMap( colName, retColl );
-// 	return retColl;
-//     }
-
-//     /**
-//      * Returns a CellID decoder
-//      * @param colName name of collection with data to be returned
-//      */
-//     public final SegmentationBase getSegmentation(final String colName) {
-// 	return (SegmentationBase)_segmMap.get(colName).getSegmentation();
-//     }
-
-
-    public void fillHitMap(final String colName,
-			   Map<Long,CalorimeterHit> hitmap )
-    {
-	System.out.println("Using Loader to fill hitmaps");
       if( colName.contains("Ecal") ) {
-	_weight = _runPar.getEMweight();
-	_mip = _runPar.getEMmip();
 	_thresh = _runPar.getEMthresh();
 	_nLyr = _runPar.getLyrNeighEM();
 	_nZ = _runPar.getZNeighEM();
 	_nPhi = _runPar.getPhiNeighEM();
       }
       else if( colName.contains("Hcal") ) {
-	_weight = _runPar.getHDweight();
-	_mip = _runPar.getHDmip();
 	_thresh = _runPar.getHDthresh();
 	_nLyr = _runPar.getLyrNeighHD();
 	_nZ = _runPar.getZNeighHD();
 	_nPhi = _runPar.getPhiNeighHD();
       }
-      else if( colName.contains("Muon") ) {
-	  super.fillHitMap(colName, hitmap);
-      }
-      else {
-	  assert false : "loadMyCalHit.fillHitMap(): colName="+colName;
-      }
 
-      // Get hit collection, if it exist
-      List<CalorimeterHit> tmpHits = null;
-      try {
-	tmpHits = _event.get(CalorimeterHit.class, colName);
-      }
-      catch(Exception e) {
-	// This happens quite frequently, no data from this component
-	System.out.println(" Evt "+_event.getEventNumber()
-			   +": No data in collection "+colName);
-      }
-      if(tmpHits==null) return;
-
-      // Fill a hit map from this collection
-//       // fill also a subdetector -> hit collection map
-//       Subdetector det = null;
-      System.out.println("LoadMyCalHits: applying energy threshold");
-      for( CalorimeterHit ihit : tmpHits ) {
-// 	// Make sure all hits come from same subdetector
-// 	if(det==null) det=ihit.getSubdetector();
-// 	else assert det == ihit.getSubdetector()
-// 		 : "LoadCalorimeterHit: multiple subdets in a collection";
-
-	double ene = _weight*(ihit.getRawEnergy());
-	// apply energy cut
-	if(ene>_thresh*_mip){
-	  long cellid = ihit.getCellID();
-	  hitmap.put( cellid, ihit);
-	}
-// 	else {
-// 	    System.out.println("LoadMyCalhit: rejected hit="+ihit+", id="+MyTools.printID(ihit.getCellID()));
-// 	}
-      }
-//       // fill map keying hitmap by Subdetector
-//       if(det!=null) _subdet2collMap.put( det, hitmap );
-
-      // assign densities to every hit in *new* hitmap,
-      // thus density=0 for hits failing energy cut
       for( CalorimeterHit khit : hitmap.values() ) {
 	long cellid = khit.getCellID();
-
 	IDDecoder decoder = khit.getSubdetector().getIDDecoder();
 	SegmentationBase segm = (SegmentationBase)decoder;	  
-	segm.setID(cellid);
 
-	long neigh[] = segm.getNeighbourIDs(_nLyr,_nZ,_nPhi);
 	double nNeigh = 1.0;  // count hit itself + neighbors (never zero)
+	segm.setID(cellid);
+	long neigh[] = segm.getNeighbourIDs(_nLyr,_nZ,_nPhi);
 	for(int j=0; j<neigh.length; ++j) {
 	  long jid = neigh[j];
 	  CalorimeterHit lhit = hitmap.get(jid);
@@ -160,7 +76,7 @@
 	}
 
 	_densityMap.put(cellid,nNeigh);
-	AIDA.defaultInstance().cloud1D("density").fill(nNeigh);
+	if(nNeigh<50) AIDA.defaultInstance().cloud1D("density").fill(nNeigh);
       }
     }
 
@@ -185,16 +101,11 @@
 
     private static LoadMyCalorimeterHit _me = null;
     /** Current event */
-//     private EventHeader _event;
+    private EventHeader _event;
     private static RunControlParameters _runPar;
-    private double _weight;
-    private double _mip;
     private double _thresh;
     private int _nLyr;
     private int _nZ;
     private int _nPhi;
-//     private Map<String,Map<Long,CalorimeterHit>> _collMap;
-//     private Map<String,Readout> _segmMap;
-//     private Map<Subdetector,Map<Long,CalorimeterHit>> _subdet2collMap;
     private Map<Long,Double> _densityMap;
 }
CVSspam 0.2.8