lcsim/src/org/lcsim/recon/cluster/structural
diff -N CheatLikelihoodLinkDriver.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ CheatLikelihoodLinkDriver.java 21 Mar 2007 00:51:09 -0000 1.1
@@ -0,0 +1,60 @@
+package org.lcsim.recon.cluster.structural;
+
+import java.util.List;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Vector;
+import java.util.Map;
+import java.util.HashMap;
+
+import org.lcsim.event.Cluster;
+import org.lcsim.recon.cluster.util.BasicCluster;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.CalorimeterHit;
+import org.lcsim.recon.cluster.structural.likelihood.*;
+import org.lcsim.util.hitmap.HitMap;
+
+/**
+ * Examine the components of large-scale clusters and
+ * determine whether they are actually linked using
+ * truth information.
+ *
+ * @author Mat Charles <[log in to unmask]>
+ * @version $Id: CheatLikelihoodLinkDriver.java,v 1.1 2007/03/21 00:51:09 mcharles Exp $
+ */
+
+public class CheatLikelihoodLinkDriver extends LikelihoodLinkDriver
+{
+ /**
+ * Constructor.
+ *
+ * @param eval The LikelihoodEvaluator which contains the likelihood PDFs
+ * @param cutTrackToTrack To make a track-track link, the likelihood must be greater than this (e.g. 0.5)
+ * @param cutTrackToClump To make a track-clump link, the likelihood must be greater than this (e.g. 0.5)
+ * @param cutClumpToClump To make a clump-clump link, the likelihood must be greater than this (e.g. 0.5)
+ * @param listOfBigClustersThe The List<Cluster> of large-scale clusters to grab from each event
+ * @param listOfTrackSegments The List<Cluster> of track segments to grab from each event
+ * @param listOfClumps The List<Cluster> of clumps to grab from each event
+ * @param outputListOfSkeletons The List<Cluster> of linked clusters to write to the event when finished
+ * @param outputHitMap The HitMap of unused hits to write to the event when finished
+ */
+ public CheatLikelihoodLinkDriver(String listOfBigClusters, String listOfTrackSegments, String listOfClumps, String outputListOfSkeletons, String outputHitMap) {
+ super(null, 0.0, 0.0, 0.0, listOfBigClusters, listOfTrackSegments, listOfClumps, outputListOfSkeletons, outputHitMap);
+ }
+
+ protected void compareTrackSegmentToTrackSegment(Cluster clus1, Cluster clus2) {
+ if (checkAssociationComponentToComponent(clus1, clus2)) {
+ m_vlinksTrackToTrack.add(new Link(clus1, clus2));
+ }
+ }
+ protected void compareTrackSegmentToClump(Cluster clus1, Cluster clus2) {
+ if (checkAssociationComponentToComponent(clus1, clus2)) {
+ m_vlinksTrackToClump.add(new Link(clus1, clus2));
+ }
+ }
+ protected void compareClumpToClump(Cluster clus1, Cluster clus2) {
+ if (checkAssociationComponentToComponent(clus1, clus2)) {
+ m_vlinksClumpToClump.add(new Link(clus1, clus2));
+ }
+ }
+}
lcsim/src/org/lcsim/recon/cluster/structural
diff -N LikelihoodLinkPlotDriver.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ LikelihoodLinkPlotDriver.java 21 Mar 2007 00:51:09 -0000 1.1
@@ -0,0 +1,106 @@
+package org.lcsim.recon.cluster.structural;
+
+import org.lcsim.recon.cluster.structural.likelihood.*;
+import org.lcsim.event.Cluster;
+import hep.aida.ITree;
+import hep.aida.IAnalysisFactory;
+import hep.aida.IHistogramFactory;
+import hep.aida.IHistogram1D;
+import java.io.IOException;
+
+
+/**
+ * An wrapper extending LikelihoodLinkDriver.
+ * All of the processing is done by the parent, but in addition
+ * this class makes some plots evaluating the performance.
+ *
+ * @author Mat Charles <[log in to unmask]>
+ * @version $Id: LikelihoodLinkPlotDriver.java,v 1.1 2007/03/21 00:51:09 mcharles Exp $
+ */
+
+public class LikelihoodLinkPlotDriver extends LikelihoodLinkDriver
+{
+ ITree m_tree = null;
+ IHistogramFactory m_histoFactory = null;
+ IHistogram1D m_hTrackTrackSignal = null;
+ IHistogram1D m_hTrackTrackBckgnd = null;
+ IHistogram1D m_hTrackClumpSignal = null;
+ IHistogram1D m_hTrackClumpBckgnd = null;
+ IHistogram1D m_hClumpClumpSignal = null;
+ IHistogram1D m_hClumpClumpBckgnd = null;
+
+ public LikelihoodLinkPlotDriver(LikelihoodEvaluator eval,
+ double cutTrackToTrack,
+ double cutTrackToClump,
+ double cutClumpToClump,
+ String listOfBigClusters,
+ String listOfTrackSegments,
+ String listOfClumps,
+ String outputListOfSkeletons,
+ String outputHitMap)
+ {
+ super(eval, cutTrackToTrack, cutTrackToClump, cutClumpToClump, listOfBigClusters, listOfTrackSegments, listOfClumps, outputListOfSkeletons, outputHitMap);
+ }
+
+ public void initPlots(String filename) {
+ IAnalysisFactory af = IAnalysisFactory.create();
+ try {
+ m_tree = af.createTreeFactory().create(filename,"xml",false,true);
+ m_histoFactory = af.createHistogramFactory(m_tree);
+ int nbins = 20;
+ m_hTrackTrackSignal = m_histoFactory.createHistogram1D("hTrackTrackSignal", nbins, 0.0, 1.0);
+ m_hTrackTrackBckgnd = m_histoFactory.createHistogram1D("hTrackTrackBckgnd", nbins, 0.0, 1.0);
+ m_hTrackClumpSignal = m_histoFactory.createHistogram1D("hTrackClumpSignal", nbins, 0.0, 1.0);
+ m_hTrackClumpBckgnd = m_histoFactory.createHistogram1D("hTrackClumpBckgnd", nbins, 0.0, 1.0);
+ m_hClumpClumpSignal = m_histoFactory.createHistogram1D("hClumpClumpSignal", nbins, 0.0, 1.0);
+ m_hClumpClumpBckgnd = m_histoFactory.createHistogram1D("hClumpClumpBckgnd", nbins, 0.0, 1.0);
+ } catch(IOException ioe1) {
+ ioe1.printStackTrace();
+ }
+ }
+
+ public void suspend() {
+ finalizePlots();
+ super.suspend();
+ }
+
+ public void finalizePlots() {
+ System.out.println(this.getClass().getName()+": finalizing output file");
+ try {
+ m_tree.commit();
+ } catch(IOException ioe1) {
+ ioe1.printStackTrace();
+ }
+ }
+
+ public void compareTrackSegmentToTrackSegment(Cluster clus1, Cluster clus2)
+ {
+ double likelihood = m_eval.getLinkLikelihoodTrackToTrack(clus1, clus2);
+ if (checkAssociationComponentToComponent(clus1, clus2)) {
+ m_hTrackTrackSignal.fill(likelihood);
+ } else {
+ m_hTrackTrackBckgnd.fill(likelihood);
+ }
+ super.compareTrackSegmentToTrackSegment(clus1, clus2);
+ }
+ public void compareTrackSegmentToClump(Cluster clus1, Cluster clus2)
+ {
+ double likelihood = m_eval.getLinkLikelihoodTrackToClump(clus1, clus2);
+ if (checkAssociationComponentToComponent(clus1, clus2)) {
+ m_hTrackClumpSignal.fill(likelihood);
+ } else {
+ m_hTrackClumpBckgnd.fill(likelihood);
+ }
+ super.compareTrackSegmentToClump(clus1, clus2);
+ }
+ public void compareClumpToClump(Cluster clus1, Cluster clus2)
+ {
+ double likelihood = m_eval.getLinkLikelihoodClumpToClump(clus1, clus2);
+ if (checkAssociationComponentToComponent(clus1, clus2)) {
+ m_hClumpClumpSignal.fill(likelihood);
+ } else {
+ m_hClumpClumpBckgnd.fill(likelihood);
+ }
+ super.compareClumpToClump(clus1, clus2);
+ }
+}