lcsim-cal-calib/src/org/lcsim/cal/calib
diff -N CollectionManager.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ CollectionManager.java 27 May 2008 18:08:34 -0000 1.1
@@ -0,0 +1,46 @@
+/*
+ * CollectionManager.java
+ *
+ * Created on May 22, 2008, 6:46 PM
+ *
+ * $Id: CollectionManager.java,v 1.1 2008/05/27 18:08:34 ngraf Exp $
+ */
+
+package org.lcsim.cal.calib;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.lcsim.event.CalorimeterHit;
+
+/**
+ *
+ * @author Norman Graf
+ */
+public class CollectionManager
+{
+ private Map<String, List<CalorimeterHit>> _listMap = new HashMap<String, List<CalorimeterHit>>();
+
+ private static CollectionManager _theCollectionManager;
+ /** Creates a new instance of CollectionManager */
+ protected CollectionManager()
+ {
+ }
+
+ public static CollectionManager defaultInstance()
+ {
+ if(_theCollectionManager == null) _theCollectionManager = new CollectionManager();
+ return _theCollectionManager;
+ }
+
+ public void addList(String name, List<CalorimeterHit> hits)
+ {
+ _listMap.put(name, hits);
+ }
+
+ public List<CalorimeterHit> getList( String name)
+ {
+ return _listMap.get(name);
+ }
+
+}
lcsim-cal-calib/src/org/lcsim/cal/calib
diff -N ProcessHitsDriver.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ProcessHitsDriver.java 27 May 2008 18:08:34 -0000 1.1
@@ -0,0 +1,115 @@
+/*
+ * ProcessHitsDriver.java
+ *
+ * Created on May 22, 2008, 12:10 PM
+ *
+ * $Id: ProcessHitsDriver.java,v 1.1 2008/05/27 18:08:34 ngraf Exp $
+ */
+
+package org.lcsim.cal.calib;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.lcsim.conditions.ConditionsManager;
+import org.lcsim.conditions.ConditionsManager.ConditionsSetNotFoundException;
+import org.lcsim.conditions.ConditionsSet;
+import org.lcsim.event.CalorimeterHit;
+import org.lcsim.event.EventHeader;
+import org.lcsim.util.Driver;
+
+/**
+ *
+ * @author Norman Graf
+ */
+public class ProcessHitsDriver extends Driver
+{
+ private ConditionsSet _cond;
+ private boolean _initialized;
+
+ private CollectionManager _collectionmanager = CollectionManager.defaultInstance();
+
+ /** Creates a new instance of ProcessHitsDriver */
+ public ProcessHitsDriver()
+ {
+ }
+
+ protected void process(EventHeader event)
+ {
+ super.process(event);
+ if(!_initialized)
+ {
+ ConditionsManager mgr = ConditionsManager.defaultInstance();
+ try
+ {
+ _cond = mgr.getConditions("CalorimeterCalibration");
+ }
+ catch(ConditionsSetNotFoundException e)
+ {
+ System.out.println("ConditionSet CalorimeterCalibration not found for detector "+mgr.getDetector());
+ System.out.println("Please check that this properties file exists for this detector ");
+ }
+ _initialized = true;
+ }
+
+ // The SimCalorimeterHit collections to process...
+ String collectionNames = _cond.getString("BaseHitCollectionNames");
+
+ String[] collNames = collectionNames.split(",\\s");
+
+ // cut on late times
+ double timeCut = _cond.getDouble("timeCut");
+
+ // cut on small energy depositions
+ double ECalMipCut = _cond.getDouble("ECalMip_Cut");
+ double HCalMipCut = _cond.getDouble("HCalMip_Cut");
+
+ // use same values for barrel and endcap
+ double[] mipCut = new double[collNames.length];
+ for(int i=0; i<mipCut.length; ++i)
+ {
+ if(collNames[i].contains("Ecal"))
+ {
+ mipCut[i] = ECalMipCut;
+ }
+ else if (collNames[i].contains("Hcal"))
+ {
+ mipCut[i] = HCalMipCut;
+ }
+ }
+// double[] mipCut = {ECalMipCut, ECalMipCut, HCalMipCut, HCalMipCut};
+
+ // ECalLayering
+ double[] ecalLayering = _cond.getDoubleArray("ECalLayering");
+
+ // HCalLayering
+ double[] hcalLayering = _cond.getDoubleArray("HCalLayering");
+
+ // get all of the calorimeter hits...
+// List<CalorimeterHit> allHits = new ArrayList<CalorimeterHit>();
+ // and the list after cuts.
+ List<CalorimeterHit> hitsToCluster = new ArrayList<CalorimeterHit>();
+ int i = 0;
+
+ for(String name : collNames)
+ {
+ List<CalorimeterHit> hits = event.get(CalorimeterHit.class, name);
+ // let's look at the hits and see if we need to cut on energy or time...
+ for(CalorimeterHit hit: hits)
+ {
+ if(hit.getTime()<timeCut)
+ {
+ if(hit.getRawEnergy()>mipCut[i])
+ {
+ hitsToCluster.add(hit);
+ }
+ }
+ }
+// allHits.addAll(hits);
+ ++i;
+ }
+ // add the processed hits back to the event
+ String outputCollectionName = _cond.getString("ProcessedHitsCollectionName");
+
+ _collectionmanager.addList(outputCollectionName, hitsToCluster);
+ }
+}
\ No newline at end of file