Commit in lcsim/src/org/lcsim/contrib/CosminDeaconu on MAIN
EfficiencyPlotter/FindableTrackCut.java+56added 1.1
                 /SimpleEfficiencyCut.java+35added 1.1
                 /ComplexEfficiencyParameter.java+14added 1.1
                 /EfficiencyParameter.java+28added 1.1
                 /EfficiencyCutOperator.java+14added 1.1
                 /ParameterPlot.java+51added 1.1
                 /EfficiencyPlotEntry.java+67added 1.1
                 /EfficiencyCut.java+16added 1.1
                 /EfficiencyPlotManager.java+97added 1.1
                 /EfficiencyPlotPresets.java+82added 1.1
                 /EfficiencyPlot.java+99added 1.1
TrackingAnalysis/HelicalTrackHitReconstructionDriver.java+98added 1.1
                /ReconstructedAnalysisDriver.java+87added 1.1
+744
13 added files
CD - Some analysis code I've been working on....

lcsim/src/org/lcsim/contrib/CosminDeaconu/EfficiencyPlotter
FindableTrackCut.java added at 1.1
diff -N FindableTrackCut.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ FindableTrackCut.java	15 Nov 2008 02:54:25 -0000	1.1
@@ -0,0 +1,56 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.lcsim.contrib.CosminDeaconu.EfficiencyPlotter;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import org.lcsim.contrib.Partridge.TrackingTest.FindableTrack;
+import org.lcsim.contrib.Partridge.TrackingTest.FindableTrack.Ignore;
+import org.lcsim.event.EventHeader;
+import org.lcsim.recon.tracking.seedtracker.SeedStrategy;
+
+/**
+ * A cut based on Rich's FindableTrack class
+ * @author cozzy
+ */
+public class FindableTrackCut implements EfficiencyCut{
+
+    
+    private static EventHeader currentEvent = null; 
+    private static FindableTrack findable = null; 
+    
+    private List<SeedStrategy> slist;
+    private List<Ignore> ilist; 
+    
+    
+    public FindableTrackCut(List<SeedStrategy> strategy) {
+       slist = strategy; 
+       ilist = Collections.EMPTY_LIST; 
+    }
+    
+    public FindableTrackCut(List<SeedStrategy> strategy, Ignore ignore) {
+        ilist = new ArrayList<Ignore>();
+        ilist.add(ignore);
+        slist = strategy; 
+    }
+    
+    public FindableTrackCut(List<SeedStrategy> strategy, List<Ignore> ignores) {
+        ilist = ignores; 
+        slist = strategy;
+    }
+    
+    public boolean passes(EfficiencyPlotEntry entry){
+        
+        if (entry.getEvent()!=currentEvent) {
+            currentEvent = entry.getEvent(); 
+            findable = new FindableTrack(currentEvent);
+        }
+        
+        return findable.isFindable(entry.getMCParticle(), slist, ilist);
+    }
+    
+}

lcsim/src/org/lcsim/contrib/CosminDeaconu/EfficiencyPlotter
SimpleEfficiencyCut.java added at 1.1
diff -N SimpleEfficiencyCut.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ SimpleEfficiencyCut.java	15 Nov 2008 02:54:25 -0000	1.1
@@ -0,0 +1,35 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.lcsim.contrib.CosminDeaconu.EfficiencyPlotter;
+
+/**
+ *
+ * @author cozzy
+ */
+    public class SimpleEfficiencyCut implements EfficiencyCut{
+        
+        private EfficiencyCutOperator op;
+        private EfficiencyParameter param; 
+        private double val;
+        
+        public SimpleEfficiencyCut(EfficiencyCutOperator cutOperator, EfficiencyParameter cutParameter, double cutValue) {
+            op = cutOperator; 
+            param = cutParameter; 
+            val = cutValue; 
+        }
+        
+        public boolean passes(EfficiencyPlotEntry e){
+            
+            double eValue = e.getParameter(param); 
+            switch (op){
+                case EQUALS: return Math.abs(eValue-val) < EfficiencyPlotManager.THRESHOLD; 
+                case NOTEQUALS: return Math.abs(eValue-val) > EfficiencyPlotManager.THRESHOLD; 
+                case MAXIMUM: return eValue < val; 
+                case MINIMUM: return eValue > val; 
+                default: throw new UnsupportedOperationException(); 
+            }
+        }
+    }

lcsim/src/org/lcsim/contrib/CosminDeaconu/EfficiencyPlotter
ComplexEfficiencyParameter.java added at 1.1
diff -N ComplexEfficiencyParameter.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ComplexEfficiencyParameter.java	15 Nov 2008 02:54:25 -0000	1.1
@@ -0,0 +1,14 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.lcsim.contrib.CosminDeaconu.EfficiencyPlotter;
+
+/**
+ *
+ * @author cozzy
+ */
+public interface ComplexEfficiencyParameter {
+    public double getValue(EfficiencyPlotEntry entry); 
+}

lcsim/src/org/lcsim/contrib/CosminDeaconu/EfficiencyPlotter
EfficiencyParameter.java added at 1.1
diff -N EfficiencyParameter.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ EfficiencyParameter.java	15 Nov 2008 02:54:25 -0000	1.1
@@ -0,0 +1,28 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.lcsim.contrib.CosminDeaconu.EfficiencyPlotter;
+
+/**
+ *
+ * @author cozzy
+ */
+public enum EfficiencyParameter {
+  THETA, 
+  THETA_DEGREES, 
+  COS_THETA, 
+  DCA, 
+  ZO, 
+  PT, 
+  P, 
+  E, 
+  PARTICLE_ID, 
+  CHARGE, 
+  OMEGA, 
+  MASS, 
+  PRODUCTION_TIME, 
+  GENERATOR_STATUS,
+  RADIUS;
+}

lcsim/src/org/lcsim/contrib/CosminDeaconu/EfficiencyPlotter
EfficiencyCutOperator.java added at 1.1
diff -N EfficiencyCutOperator.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ EfficiencyCutOperator.java	15 Nov 2008 02:54:25 -0000	1.1
@@ -0,0 +1,14 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.lcsim.contrib.CosminDeaconu.EfficiencyPlotter;
+
+/**
+ *
+ * @author cozzy
+ */
+public enum EfficiencyCutOperator {
+        MINIMUM, MAXIMUM, EQUALS, NOTEQUALS; 
+}

lcsim/src/org/lcsim/contrib/CosminDeaconu/EfficiencyPlotter
ParameterPlot.java added at 1.1
diff -N ParameterPlot.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ParameterPlot.java	15 Nov 2008 02:54:25 -0000	1.1
@@ -0,0 +1,51 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.lcsim.contrib.CosminDeaconu.EfficiencyPlotter;
+
+import java.util.Arrays;
+import java.util.Collection;
+import org.lcsim.util.aida.AIDA;
+
+/**
+ *
+ * @author cozzy
+ */
+public class ParameterPlot extends EfficiencyPlot{
+
+    public ParameterPlot(EfficiencyParameter variable, String name, int bins, double min, double max) {
+        super(variable, name, bins, min, max); 
+    }
+    public ParameterPlot(EfficiencyParameter variable, String name, int bins, double min, double max, EfficiencyCut[] cuts) {
+        super(variable, name, bins, min, max, Arrays.asList(cuts));
+    }
+    public ParameterPlot(EfficiencyParameter variable, String name, int bins, double min, double max, Collection<EfficiencyCut> cuts) {
+        super(variable, name, bins, min, max, cuts); 
+    }
+    
+    @Override
+    public void setupHistogram(AIDA instance) {
+        int idx = name.lastIndexOf("/");
+        if (idx > 0)
+            instance.tree().mkdirs(name.substring(0, idx));
+        hist = instance.histogramFactory().createHistogram1D(name,"",bins,min,max); 
+        ready = true; 
+    }
+    
+    @Override 
+    public void addEntry(EfficiencyPlotEntry e) {
+        
+        if(!ready) {
+            throw new RuntimeException("Parameter Plot uninitialized. Must be initialized by calling setupHistogram() before you can call addEntry().");
+        }
+        
+        for (EfficiencyCut c : getCuts()) {
+            if(!c.passes(e)) return; 
+        }
+       
+        getHistogram().fill(e.getParameter(getVariable())); 
+        
+    } 
+}

lcsim/src/org/lcsim/contrib/CosminDeaconu/EfficiencyPlotter
EfficiencyPlotEntry.java added at 1.1
diff -N EfficiencyPlotEntry.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ EfficiencyPlotEntry.java	15 Nov 2008 02:54:25 -0000	1.1
@@ -0,0 +1,67 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.lcsim.contrib.CosminDeaconu.EfficiencyPlotter;
+
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.MCParticle;
+import org.lcsim.fit.helicaltrack.HelixParamCalculator;
+
+/**
+ *
+ * @author cozzy
+ */
+public class EfficiencyPlotEntry {
+        
+        private MCParticle mcp; 
+        private boolean found;
+        private HelixParamCalculator calc; 
+        private EventHeader event; 
+        
+        //Cached calculations for stuff not in calc
+        private double cth; 
+
+        public EfficiencyPlotEntry(MCParticle mcp, boolean found, EventHeader event) {
+            this.mcp = mcp; 
+            this.found = found;
+            calc = new HelixParamCalculator(mcp, EfficiencyPlotManager.B_FIELD);
+            cth = Math.cos(calc.getTheta()); 
+            this.event = event;
+        }    
+        
+        public MCParticle getMCParticle(){
+            return mcp; 
+        }
+        
+        public EventHeader getEvent(){
+            return event; 
+        }
+        
+        public double getWeight(){
+            return found ? 1.0 : 0.0; 
+        }
+        
+        public double getParameter(EfficiencyParameter param) {
+            
+            switch(param) {   
+                case THETA: return calc.getTheta();
+                case THETA_DEGREES: return 180./Math.PI * calc.getTheta(); 
+                case COS_THETA: return cth; 
+                case DCA: return calc.getDCA(); 
+                case E: return mcp.getEnergy(); 
+                case OMEGA: return calc.getMCOmega(); 
+                case P: return calc.getMCMomentum(); 
+                case PT: return calc.getMCTransverseMomentum(); 
+                case PARTICLE_ID: return mcp.getPDGID(); 
+                case ZO: return calc.getZ0(); 
+                case MASS: return mcp.getMass(); 
+                case PRODUCTION_TIME: return mcp.getProductionTime();   
+                case GENERATOR_STATUS: return mcp.getGeneratorStatus();
+                case RADIUS: return mcp.getOrigin().magnitude(); 
+                case CHARGE: return mcp.getCharge(); 
+                default: throw new UnsupportedOperationException(); 
+            }
+        }
+    }
\ No newline at end of file

lcsim/src/org/lcsim/contrib/CosminDeaconu/EfficiencyPlotter
EfficiencyCut.java added at 1.1
diff -N EfficiencyCut.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ EfficiencyCut.java	15 Nov 2008 02:54:25 -0000	1.1
@@ -0,0 +1,16 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.lcsim.contrib.CosminDeaconu.EfficiencyPlotter;
+
+/**
+ * A cut is used to selectively ignore certain potential plot entries. For 
+ * example, if one is trying to plot efficiency vs. angle, it might be useful to 
+ * cut out low momentum tracks that may confound your plot. 
+ * @author cozzy
+ */
+public interface EfficiencyCut {
+    public boolean passes(EfficiencyPlotEntry e); 
+}

lcsim/src/org/lcsim/contrib/CosminDeaconu/EfficiencyPlotter
EfficiencyPlotManager.java added at 1.1
diff -N EfficiencyPlotManager.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ EfficiencyPlotManager.java	15 Nov 2008 02:54:25 -0000	1.1
@@ -0,0 +1,97 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.lcsim.contrib.CosminDeaconu.EfficiencyPlotter;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import org.lcsim.contrib.CosminDeaconu.*;
+import java.util.List;
+import org.lcsim.util.aida.AIDA;
+
+/**
+ * EfficiencyPlotManager aims to provide a convenient way to generate efficiency plots
+ * with various parameters and cuts. 
+ * 
+ * 
+ * @author cozzy
+ */
+public class EfficiencyPlotManager {
+    
+    public static double B_FIELD = 5.; 
+    public static double THRESHOLD = 0.0001;  
+    
+    private List<EfficiencyPlot> plots = new ArrayList<EfficiencyPlot>(); 
+    private List<EfficiencyPlotEntry> entries = new ArrayList<EfficiencyPlotEntry>(); 
+    private Collection<EfficiencyCut> defaultCuts = Collections.EMPTY_LIST;
+    private AIDA instance; 
+    private boolean remember = false;
+
+    public EfficiencyPlotManager(AIDA instance){
+        this.instance = instance; 
+    }
+    
+    public EfficiencyPlotManager(AIDA instance, boolean rememberEntries) {
+        this.instance = instance; 
+        remember = rememberEntries;
+    }
+    
+    public static void setBField(double newBField){
+        B_FIELD = newBField;
+    }
+    
+    public static void setCalculationThreshold(double newThreshold){
+        THRESHOLD = newThreshold; 
+    }
+    
+    public void clearPlots() {
+        plots.clear(); 
+    }
+    
+    public void clearEntries() {
+        entries.clear(); 
+    }
+    
+    public void clearDefaultCuts(){
+        defaultCuts = Collections.EMPTY_LIST; 
+    }
+    
+    public void addPlot(EfficiencyPlot p) {
+        p.setupHistogram(instance);
+        plots.add(p);
+        
+        //if we remembere entries and some have already been added to the manager, add them to this plot
+        if (remember) {
+            for (EfficiencyPlotEntry entry : entries) {
+                if (!passesDefaultCuts(entry)) continue; 
+                p.addEntry(entry); 
+            }
+        }
+    }
+    
+    public void setDefaultCuts(Collection<EfficiencyCut> cuts){
+        defaultCuts = cuts; 
+    }
+    
+    public void addEntry(EfficiencyPlotEntry e) {
+        if (remember) entries.add(e); 
+        if(!passesDefaultCuts(e)) return; 
+        for (EfficiencyPlot p: plots) {
+           p.addEntry(e);
+        }
+    }  
+    
+    private boolean passesDefaultCuts(EfficiencyPlotEntry e){
+        for (EfficiencyCut c : defaultCuts) {
+            if (!c.passes(e)) return false; 
+        }
+        
+        return true; 
+    }
+    
+}
+
+    

lcsim/src/org/lcsim/contrib/CosminDeaconu/EfficiencyPlotter
EfficiencyPlotPresets.java added at 1.1
diff -N EfficiencyPlotPresets.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ EfficiencyPlotPresets.java	15 Nov 2008 02:54:25 -0000	1.1
@@ -0,0 +1,82 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.lcsim.contrib.CosminDeaconu.EfficiencyPlotter;
+
+import hep.physics.particle.Particle;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import org.lcsim.contrib.Partridge.TrackingTest.FindableTrack.Ignore;
+import org.lcsim.recon.tracking.seedtracker.SeedStrategy;
+
+/**
+ * Some potentially useful plots... 
+ *
+ * @author cozzy
+ */
+public class EfficiencyPlotPresets {
+    
+   
+       private static List<EfficiencyCut> commonCuts = Arrays.asList(new EfficiencyCut[] {    
+            new SimpleEfficiencyCut(EfficiencyCutOperator.NOTEQUALS, EfficiencyParameter.CHARGE, 0.0), 
+            new SimpleEfficiencyCut(EfficiencyCutOperator.EQUALS, EfficiencyParameter.GENERATOR_STATUS, Particle.FINAL_STATE),
+            new SimpleEfficiencyCut(EfficiencyCutOperator.MAXIMUM, EfficiencyParameter.RADIUS, 10.0)
+        });
+    
+        private static List<EfficiencyCut> totalCuts = new ArrayList<EfficiencyCut>();         
+        private static List<EfficiencyCut> thetaCuts = new ArrayList<EfficiencyCut>(); 
+        private static List<EfficiencyCut> ptCuts = new ArrayList<EfficiencyCut>(); 
+        private static boolean ready = false; 
+        
+        
+        
+        private static void setup() {
+             thetaCuts.add(new SimpleEfficiencyCut(EfficiencyCutOperator.MINIMUM, EfficiencyParameter.PT, 1.1));
+             thetaCuts.addAll(commonCuts);
+             ptCuts.add(new SimpleEfficiencyCut(EfficiencyCutOperator.MAXIMUM, EfficiencyParameter.COS_THETA, 0.985));         
+             ptCuts.addAll(commonCuts);
+             totalCuts.addAll(thetaCuts); 
+             totalCuts.addAll(ptCuts);     
+        }
+        
+        
+        public static EfficiencyPlot getEfficiencyVsThetaPlotUsingFindable(List<SeedStrategy> strategy){
+            
+            return new EfficiencyPlot(EfficiencyParameter.THETA_DEGREES, "Findable: Eff vs. Theta", 180, 0, 180, 
+                    new FindableTrackCut(strategy));
+        }
+        
+        public static EfficiencyPlot getEfficiencyVsPTPlotUsingFindable(List<SeedStrategy> strategy) {
+            return new EfficiencyPlot(EfficiencyParameter.PT, "Findable: Eff vs. Pt", 100, 0, 50, 
+                    new FindableTrackCut(strategy, Ignore.NoPTCut));
+        }
+        
+
+        public static EfficiencyPlot getEfficiencyVsThetaPlot(){
+            if(!ready) setup(); 
+            return new EfficiencyPlot(EfficiencyParameter.THETA_DEGREES, "EPM: Eff vs. Theta", 180, 0, 180, thetaCuts);    
+        }
+        
+        public static ParameterPlot getMCThetaplot() {
+            if(!ready) setup(); 
+            return new ParameterPlot(EfficiencyParameter.THETA_DEGREES, "EPM: MC Theta", 180, 0, 180, thetaCuts);    
+        }
+        
+        public static EfficiencyPlot getEfficiencyVsPTPlot(){
+            if(!ready) setup(); 
+            return new EfficiencyPlot(EfficiencyParameter.PT, "EPM: Eff vs. PT", 100, 0, 50, ptCuts);
+        }
+       
+        public static ParameterPlot getMCPTPlot() {
+            if(!ready) setup(); 
+            return new ParameterPlot(EfficiencyParameter.PT, "EPM:  PT", 100, 0, 50, ptCuts);
+        }
+        
+        public static EfficiencyPlot getEfficiencyPlot(){ 
+            if(!ready) setup(); 
+            return new EfficiencyPlot(null, "EPM: Efficiency",10, 0, 1.2, totalCuts);
+        }        
+}

lcsim/src/org/lcsim/contrib/CosminDeaconu/EfficiencyPlotter
EfficiencyPlot.java added at 1.1
diff -N EfficiencyPlot.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ EfficiencyPlot.java	15 Nov 2008 02:54:25 -0000	1.1
@@ -0,0 +1,99 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.lcsim.contrib.CosminDeaconu.EfficiencyPlotter;
+
+import hep.aida.IHistogram1D;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import org.lcsim.util.aida.AIDA;
+
+/**
+ *
+ * @author cozzy
+ */
+public class EfficiencyPlot {
+    
+    protected EfficiencyParameter var; 
+    protected Collection<EfficiencyCut> cuts; 
+    protected String name; 
+    protected int bins; 
+    protected double min; 
+    protected double max; 
+    protected IHistogram1D hist; 
+    protected boolean ready = false; 
+    
+    public EfficiencyPlot(EfficiencyParameter variable, String name, int bins, double min, double max) {
+        this(variable, name, bins, min, max, new ArrayList<EfficiencyCut>());
+    }
+
+    
+    public EfficiencyPlot(EfficiencyParameter variable, String name, int bins, double min, double max, EfficiencyCut cut) {
+        this(variable, name, bins, min, max, new EfficiencyCut[]{cut});
+    }
+    
+    public EfficiencyPlot(EfficiencyParameter variable, String name, int bins, double min, double max, EfficiencyCut[] cuts) {
+        this(variable, name, bins, min, max, Arrays.asList(cuts));
+    }
+    public EfficiencyPlot(EfficiencyParameter variable, String name, int bins, double min, double max, Collection<EfficiencyCut> cuts) {
+        this.var = variable;
+        this.name = name; 
+        this.bins = bins;
+        this.min = min;
+        this.max = max;
+        this.cuts = cuts; 
+    }
+    
+    public Collection<EfficiencyCut> getCuts(){
+        return cuts; 
+    }
+    
+    public EfficiencyParameter getVariable(){
+        return var; 
+    }
+    
+    public void setupHistogram(AIDA instance) {
+        if (ready) return; 
+        int idx = name.lastIndexOf("/");
+        if (idx > 0)
+            instance.tree().mkdirs(name.substring(0, idx));
+        
+        if (var!=null) {
+            hist = instance.histogramFactory().createHistogram1D(name,"",bins,min,max,"type=efficiency"); 
+            hist.setTitle("EFFICIENCY vs. "+var.toString());
+        } else {
+            hist = instance.histogramFactory().createHistogram1D(name,bins,min,max); 
+            hist.setTitle("EFFICIENCY");
+        }
+        
+        
+        ready = true;
+        
+    }
+    
+    public IHistogram1D getHistogram(){
+        if(!ready) {
+            throw new RuntimeException("Efficiency Plot uninitialized. Must be initialized by calling setupHistogram() before you can call getHistogram().");
+        }
+        return hist; 
+    }
+    
+    
+    public void addEntry(EfficiencyPlotEntry e) {
+        
+        if(!ready) {
+            throw new RuntimeException("Efficiency Plot uninitialized. Must be initialized by calling setupHistogram() before you can call addEntry().");
+        }
+        
+        for (EfficiencyCut c : cuts) {
+            if(!c.passes(e)) return; 
+        }
+        
+        if (getVariable()==null) getHistogram().fill(e.getWeight()); 
+        else getHistogram().fill(e.getParameter(getVariable()), e.getWeight()); 
+        
+    } 
+}

lcsim/src/org/lcsim/contrib/CosminDeaconu/TrackingAnalysis
HelicalTrackHitReconstructionDriver.java added at 1.1
diff -N HelicalTrackHitReconstructionDriver.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ HelicalTrackHitReconstructionDriver.java	15 Nov 2008 02:54:25 -0000	1.1
@@ -0,0 +1,98 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.lcsim.contrib.CosminDeaconu.TrackingAnalysis;
+
+import org.lcsim.fit.helicaltrack.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.Track;
+import org.lcsim.event.TrackerHit;
+import org.lcsim.recon.tracking.seedtracker.ReconTracking.SiD02ReconHybridHitMaker;
+import org.lcsim.recon.tracking.seedtracker.SeedCandidate;
+import org.lcsim.util.Driver;
+
+/**
+ *
+ * @author cozzy
+ */
+public class HelicalTrackHitReconstructionDriver extends Driver{
+
+    
+    private String remadeHitsName = "ReconstructedHelicalTrackHits";
+    private String outputSeedCandidatesName = "ReconstructedSeedCandidates"; 
+    private String hitCollectionName = "HelicalTrackHits"; 
+   
+    
+    
+    public HelicalTrackHitReconstructionDriver(){
+        this(false); 
+    }
+    public HelicalTrackHitReconstructionDriver(boolean fullccd){
+        SiD02ReconHybridHitMaker hhm = new SiD02ReconHybridHitMaker(fullccd, remadeHitsName);
+        add(hhm); 
+    }
+    
+    private Comparator hitcmp = new Comparator() {
+
+        public int compare(Object o1, Object o2) {
+            TrackerHit h1 = (TrackerHit) o1;
+            TrackerHit h2 = (TrackerHit) o2;  
+            
+            double x1 = h1.getPosition()[0];
+            double y1 = h1.getPosition()[1];
+            double z1 = h1.getPosition()[2];
+            double x2 = h2.getPosition()[0];
+            double y2 = h2.getPosition()[1];
+            double z2 = h2.getPosition()[2];
+            
+            if (x1!=x2){
+                return Double.compare(x1, x2); 
+            } else if (y1!=y2){
+                return Double.compare(y1,y2); 
+            }
+            else return Double.compare(z1,z2); 
+            
+        }
+    };
+    
+    protected void process(EventHeader event) {
+
+       super.process(event); 
+       
+       List<TrackerHit> inputHits = event.get(TrackerHit.class, hitCollectionName); 
+       List<HelicalTrackHit> outputHits = event.get(HelicalTrackHit.class, remadeHitsName); 
+       List<SeedCandidate> seedCandidates = new ArrayList<SeedCandidate>();
+       Collections.sort(inputHits, hitcmp);
+       Collections.sort(outputHits, hitcmp); 
+       
+       Map<TrackerHit, HelicalTrackHit> hitmap = new HashMap<TrackerHit,HelicalTrackHit>(); 
+       
+       for (int i =0; i < inputHits.size(); i++) {
+           hitmap.put(inputHits.get(i), outputHits.get(i));
+       }
+       
+       
+       for (Track t : event.getTracks()){
+           List<HelicalTrackHit> hits = new ArrayList<HelicalTrackHit>(); 
+           for (TrackerHit h : t.getTrackerHits()){
+               hits.add(hitmap.get(h)); 
+           }
+           seedCandidates.add(new SeedCandidate(hits, null)); 
+           
+       }
+       
+       event.put(outputSeedCandidatesName, seedCandidates, SeedCandidate.class, 0); 
+    }
+    
+    
+    
+    
+}

lcsim/src/org/lcsim/contrib/CosminDeaconu/TrackingAnalysis
ReconstructedAnalysisDriver.java added at 1.1
diff -N ReconstructedAnalysisDriver.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ReconstructedAnalysisDriver.java	15 Nov 2008 02:54:25 -0000	1.1
@@ -0,0 +1,87 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.lcsim.contrib.CosminDeaconu.TrackingAnalysis;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.lcsim.contrib.CosminDeaconu.EfficiencyPlotter.EfficiencyPlotEntry;
+import org.lcsim.contrib.CosminDeaconu.EfficiencyPlotter.EfficiencyPlotManager;
+import org.lcsim.contrib.CosminDeaconu.EfficiencyPlotter.EfficiencyPlotPresets;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.MCParticle;
+import org.lcsim.fit.helicaltrack.HelicalTrackHit;
+import org.lcsim.contrib.CosminDeaconu.TrackingAnalysis.HelicalTrackHitReconstructionDriver;
+import org.lcsim.recon.tracking.seedtracker.SeedCandidate;
+import org.lcsim.recon.tracking.seedtracker.SeedStrategy;
+import org.lcsim.recon.tracking.seedtracker.StrategyXMLUtils;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+/**
+ *
+ * @author cozzy
+ */
+public class ReconstructedAnalysisDriver extends Driver{
+
+    private EfficiencyPlotManager epm;
+    
+    
+    
+    public ReconstructedAnalysisDriver(){
+       add(new HelicalTrackHitReconstructionDriver()); 
+       
+       epm = new EfficiencyPlotManager(AIDA.defaultInstance()); 
+        
+       
+       //  Get the list of strategies being used
+        String sfile = "autogen_ttbar_sid02_vs.xml";
+        List<SeedStrategy> slist = StrategyXMLUtils.getStrategyListFromResource(
+                StrategyXMLUtils.getDefaultStrategiesPrefix() + sfile);
+       
+       epm.addPlot(EfficiencyPlotPresets.getEfficiencyVsPTPlotUsingFindable(slist));
+       epm.addPlot(EfficiencyPlotPresets.getEfficiencyVsThetaPlotUsingFindable(slist));
+        
+       epm.addPlot(EfficiencyPlotPresets.getEfficiencyPlot());
+       epm.addPlot(EfficiencyPlotPresets.getEfficiencyVsPTPlot());
+       epm.addPlot(EfficiencyPlotPresets.getEfficiencyVsThetaPlot());
+       epm.addPlot(EfficiencyPlotPresets.getMCPTPlot());
+       epm.addPlot(EfficiencyPlotPresets.getMCThetaplot());
+    }
+    
+    protected void process(EventHeader event) {
+        super.process(event);
+        
+        List<SeedCandidate> candidates = event.get(SeedCandidate.class, "ReconstructedSeedCandidates"); 
+        Set<MCParticle> found = new HashSet<MCParticle>(); 
+        for (SeedCandidate c : candidates) {
+            Map<MCParticle,Integer> mcmap = new HashMap<MCParticle,Integer>();
+            for (HelicalTrackHit h : c.getHits()){
+                for (MCParticle p : h.getMCParticles()){
+                    Integer i = mcmap.get(p); 
+                    if (i==null) mcmap.put(p,1); 
+                    else mcmap.put(p,i+1); 
+                }
+            }
+            int nmax = 0; 
+            MCParticle max = null; 
+            for (MCParticle p : mcmap.keySet()){
+                int n = mcmap.get(p).intValue(); 
+                if (n > nmax) {
+                    nmax = n; 
+                    max = p;
+                }
+            }
+            found.add(max);
+        }        
+        
+        for (MCParticle mcp : event.getMCParticles()){
+            epm.addEntry(new EfficiencyPlotEntry(mcp, found.contains(mcp), event));
+        } 
+    }
+}
CVSspam 0.2.8