Commit in lcsim/src/org/lcsim/contrib/uiowa/template on MAIN
ListMerger.java+30added 1.1
NonTrivialPFA.java+85-161.1 -> 1.2
+115-16
1 added + 1 modified, total 2 files
Added a bit more flesh

lcsim/src/org/lcsim/contrib/uiowa/template
ListMerger.java added at 1.1
diff -N ListMerger.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ListMerger.java	26 Jan 2006 01:28:00 -0000	1.1
@@ -0,0 +1,30 @@
+package template;
+
+import java.util.*; 
+import org.lcsim.util.*;
+import org.lcsim.event.*;
+
+public class ListMerger<T> extends Driver
+{
+    public ListMerger() {
+    }
+
+    public void addInputList(String name) {
+      m_inputNames.add(name);
+    }
+    public void setOutputList(String name) {
+      m_outputName = name;
+    }
+
+    public void process(EventHeader event) {
+      List<T> outputList = new Vector<T>();
+      for (String inputName : m_inputNames) {
+        List<T> currentList = (List<T>) (event.get(inputName));
+        outputList.addAll(currentList);
+      }
+      event.put(m_outputName, outputList);
+    }
+
+    List<String> m_inputNames = new Vector<String>();
+    String m_outputName;
+}

lcsim/src/org/lcsim/contrib/uiowa/template
NonTrivialPFA.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- NonTrivialPFA.java	17 Jan 2006 00:33:13 -0000	1.1
+++ NonTrivialPFA.java	26 Jan 2006 01:28:00 -0000	1.2
@@ -7,8 +7,9 @@
 import org.lcsim.recon.cluster.mst.*;
 import org.lcsim.recon.cluster.mipfinder.*;
 import org.lcsim.recon.cluster.clumpfinder.*;
+import org.lcsim.recon.cluster.util.ClusterSizeDecision;
 
-//import structural.*;
+import structural.likelihood.*;
 
 public class NonTrivialPFA extends Driver
 {
@@ -34,10 +35,16 @@
 	add (new org.lcsim.mc.fast.tracking.MCFastTracking());
 
 	// Find track segments in ECAL and HCAL
-	TrackClusterDriver ecalMIP = new TrackClusterDriver("input hit map ecal", "ecalMIP", "hit map ecal without mips");
-	TrackClusterDriver hcalMIP = new TrackClusterDriver("input hit map hcal", "hcalMIP", "hit map hcal without mips");
+	TrackClusterDriver ecalMIP = new TrackClusterDriver("input hit map ecal", "mips ecal", "hit map ecal without mips");
+	TrackClusterDriver hcalMIP = new TrackClusterDriver("input hit map hcal", "mips hcal", "hit map hcal without mips");
 	add(ecalMIP);
 	add(hcalMIP);
+        // Merge the two lists:
+        ListMerger<Cluster> mergeMIPs = new ListMerger<Cluster>();
+        mergeMIPs.addInputList("mips ecal");
+        mergeMIPs.addInputList("mips hcal");
+        mergeMIPs.setOutputList("mips");
+	add(mergeMIPs);
 
 	// Step 5b: Find clumps in ECAL and HCAL
 	// Clumps are defined as contiguous sets of
@@ -48,7 +55,11 @@
 	ClumpFinder findClumpsHCAL = new ClumpFinder("hit map hcal without mips", "clumps hcal", "hit map hcal without mips or clumps");
         add(findClumpsECAL);
         add(findClumpsHCAL);
-
+        ListMerger<Cluster> mergeClumps = new ListMerger<Cluster>();
+	mergeClumps.addInputList("clumps ecal");
+        mergeClumps.addInputList("clumps hcal");
+        mergeClumps.setOutputList("clumps");
+	add(mergeClumps);
 
 	// Step 3: Find large-scale clusters with the MST
 	// Output: List<Cluster>
@@ -56,8 +67,8 @@
 	NewMSTDriver mstHcal = new NewMSTDriver("hcal hit map after mst", "mst clusters hcal");
 	mstEcal.addInputHitMap("hit map ecal without mips or clumps");
 	mstHcal.addInputHitMap("hit map hcal without mips or clumps");
-	mstEcal.addInputClusterList("ecalMIP");
-	mstHcal.addInputClusterList("hcalMIP");
+	mstEcal.addInputClusterList("mips ecal");
+	mstHcal.addInputClusterList("mips hcal");
 	mstEcal.addInputClusterList("clumps ecal");
 	mstHcal.addInputClusterList("clumps hcal");
 	mstEcal.setThreshold(30.0);
@@ -80,14 +91,52 @@
 	mstDriverLink.setPairDecision(new BothCalorimetersDecision());
         add(mstDriverLink);
 
-	// if (writeLikelihood) {
-	//   Step 6a: Make likelihood PDFs
-	// } else {
-	//   Step 6b: Structural algorithm
-	//   Step 6c: Extrapolate tracks to ECAL surface
-	//   Step 6d: Handle fragments
-	//   Step 6e: Plots
-	// }
+	boolean writeLikelihood = false;
+	structural.ClusterAssociator assoc = new structural.ClusterEnergyAssociator();
+	if (writeLikelihood) {
+	  //   Step 6a: Make likelihood PDFs
+	  LikelihoodEvaluator eval = new LikelihoodEvaluator();
+	  eval.addLikelihoodQuantityTrackToTrack(new TrackToTrackDOCA(), 50, 0.0, 100.0, false, true);
+	  eval.addLikelihoodQuantityTrackToTrack(new TrackToTrackPOCAInCalorimeter(), 2, -0.5, 1.5, false, false);
+	  eval.addLikelihoodQuantityTrackToTrack(new TrackToTrackSmallestDistanceToPOCA(), 25, 0.0, 250.0, false, true);
+	  eval.addLikelihoodQuantityTrackToClump(new TrackToClumpDOCA(), 50, 0.0, 300.0, false, true);
+	  eval.addLikelihoodQuantityTrackToClump(new ClusterToClusterMinDistance(), 25, 0.0, 250.0, false, true);
+	  eval.addLikelihoodQuantityClumpToClump(new ClumpToClumpDOCA(), 20, 0.0, 200.0, false, true);
+	  eval.addLikelihoodQuantityClumpToClump(new ClusterToClusterMinDistance(), 20, 0.0, 200.0, false, true);
+	  // Handle things that have per-event info:
+	  makeEventInfoList(eval); 
+	  structural.LikelihoodFindingStructuralDriver likelihoodWriter = new structural.LikelihoodFindingStructuralDriver(eval, assoc, "mst clusters linked", "mips", "clumps");
+	  likelihoodWriter.setIgnoreClusterDecision(new ClusterSizeDecision(10));
+	  add(likelihoodWriter);
+	  Driver checkpoint = new LikelihoodEvaluatorCheckpointDriver(eval, 10);
+	  add(checkpoint);
+	} else {
+	  // Step 6a: Structural algorithm
+	  // Inputs from event:
+	  //   * Big (MST) clusters
+	  //   * Track segment clusters
+	  //   * Clump clusters
+	  // Output to event:
+	  //   * List of skeleton clusters
+	  //   * Hitmap containing clustered hits that aren't in skeletons
+	  LikelihoodEvaluator eval = LikelihoodEvaluator.readFromFile("likelihood.bin");
+	  structural.LikelihoodLinkPlotterDriver likelihoodPlotter = new structural.LikelihoodLinkPlotterDriver(eval, 0.5, 0.6, 0.8, assoc, "mst clusters linked", "mips", "clumps", "skeletons", "structural unused hits");
+	  likelihoodPlotter.setIgnoreClusterDecision(new ClusterSizeDecision(10));
+	  likelihoodPlotter.initPlots("likelihoodPerformance.aida");
+	  add(likelihoodPlotter);
+	  // Some likelihood quantities need per-event info:
+	  makeEventInfoList(eval);
+	  // Step 6b: Halo
+	  // Inputs from event:
+	  //   * Skeleton clusters
+	  //   * Hitmap containing clustered hits that aren't in skeletons
+	  // Outputs:
+	  //   * Fleshed-out skeletons (with halo added)
+	  //   * Modified hitmap with any remaining clustered hits
+	  // Step 6c: Extrapolate tracks to ECAL surface
+	  // Step 6d: Handle fragments
+	  // Step 6e: Plots
+	}
 
 	add(new DebugInfoHitMap("input hit map ecal"));
 	add(new DebugInfoHitMap("input hit map hcal"));
@@ -98,14 +147,34 @@
 	add(new DebugInfoHitMap("ecal hit map after mst"));
 	add(new DebugInfoHitMap("hcal hit map after mst"));
 
-	add(new DebugInfoClusterList("ecalMIP"));
-	add(new DebugInfoClusterList("hcalMIP"));
+	add(new DebugInfoClusterList("mips ecal"));
+	add(new DebugInfoClusterList("mips hcal"));
+	add(new DebugInfoClusterList("mips"));
 	add(new DebugInfoClusterList("clumps ecal"));
 	add(new DebugInfoClusterList("clumps hcal"));
+	add(new DebugInfoClusterList("clumps"));
 	add(new DebugInfoClusterList("mst clusters ecal"));
 	add(new DebugInfoClusterList("mst clusters hcal"));
 	add(new DebugInfoClusterList("mst clusters linked"));
 
 	add(new DebugInfoTrackList(EventHeader.TRACKS));
     }
+
+    protected void makeEventInfoList(LikelihoodEvaluator eval) 
+    {
+        // Handle things that have per-event info:
+        m_perEventQuantities = new Vector<StructuralLikelihoodQuantityWithEventInfo>();
+        List<StructuralLikelihoodQuantity> quantities = eval.getLikelihoodQuantities();
+        for (StructuralLikelihoodQuantity quant : quantities) {
+            if (quant instanceof StructuralLikelihoodQuantityWithEventInfo) {
+                StructuralLikelihoodQuantityWithEventInfo quantTmp = (StructuralLikelihoodQuantityWithEventInfo) (quant);
+                m_perEventQuantities.add(quantTmp);
+            }
+        }
+    }
+
+    // Special treatment for likelihood quantities that need per-event info
+    // (e.g. geometry)
+    List<StructuralLikelihoodQuantityWithEventInfo> m_perEventQuantities = null;
+
 }
CVSspam 0.2.8