lcsim/src/org/lcsim/contrib/uiowa/template
diff -N HitMapConverter.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ HitMapConverter.java 25 Jan 2006 00:56:27 -0000 1.1
@@ -0,0 +1,51 @@
+package template;
+
+import java.util.*;
+
+import org.lcsim.event.EventHeader;
+import org.lcsim.util.Driver;
+import org.lcsim.event.Cluster;
+import org.lcsim.event.MCParticle;
+import org.lcsim.event.CalorimeterHit;
+import org.lcsim.event.SimCalorimeterHit;
+import org.lcsim.recon.cluster.util.BasicCluster;
+
+ /**
+ * This class takes in a HitMap (i.e. a Map<Long,CalorimeterHit>)
+ * and converts it to a form which can be accessed by the org.lcsim
+ * event browser and WIRED event display in JAS3.
+ *
+ * Currently this is done in two steps. First, the Map is flattened
+ * into a collection of CalorimeterHits. Then, each CalorimeterHit
+ * is wrapped into a single-hit Cluster.
+ *
+ * @version $Id: HitMapConverter.java,v 1.1 2006/01/25 00:56:27 mcharles Exp $
+ */
+
+public class HitMapConverter extends Driver
+{
+ public HitMapConverter() {
+ }
+
+ public void process(EventHeader event)
+ {
+ Map<Long, CalorimeterHit> inputHitMap = (Map<Long, CalorimeterHit>) (event.get(m_inputHitMapName));
+ List<Cluster> outputClusterList = new Vector<Cluster>();
+ for (CalorimeterHit hit : inputHitMap.values()) {
+ BasicCluster clus = new BasicCluster();
+ clus.addHit(hit);
+ outputClusterList.add(clus);
+ }
+ event.put(m_outputListName, outputClusterList);
+ }
+
+ public void setInputHitMap(String name) {
+ m_inputHitMapName = name;
+ }
+ public void setOutputList(String name) {
+ m_outputListName = name;
+ }
+
+ String m_inputHitMapName;
+ String m_outputListName;
+}
lcsim/src/org/lcsim/contrib/uiowa/template
diff -u -r1.2 -r1.3
--- TrivialPFA.java 17 Jan 2006 00:33:13 -0000 1.2
+++ TrivialPFA.java 25 Jan 2006 00:56:27 -0000 1.3
@@ -3,6 +3,7 @@
import org.lcsim.util.*;
import org.lcsim.event.*;
import org.lcsim.event.util.*;
+import java.util.*;
public class TrivialPFA extends Driver
{
@@ -20,6 +21,12 @@
hitmaps.setOutput("hits");
add(hitmaps);
+ // Do hit map -> hit list conversion
+ HitMapConverter converterDriver = new HitMapConverter();
+ converterDriver.setInputHitMap("hits");
+ converterDriver.setOutputList("hits (displayable)");
+ add(converterDriver);
+
// Set up the MC list
CreateFinalStateMCParticleList mcListMaker = new CreateFinalStateMCParticleList("Gen");
add(mcListMaker);
@@ -37,12 +44,12 @@
id.setInputClusterList("perfect clusters");
id.setOutputParticleList("perfect particles");
id.setMCParticleList("GenFinalStateParticles");
- add(id);
+// add(id); // Doesn't render well in Event Display
// Some debug output
add(new DebugInfoHitMap("hits"));
add(new DebugInfoHitMap("leftover hits"));
add(new DebugInfoClusterList("perfect clusters"));
- add(new DebugInfoParticleList("perfect particles"));
+// add(new DebugInfoParticleList("perfect particles"));
}
}