Print

Print


Commit in lcsim/src/org/lcsim/contrib/seedtracker/analysis on MAIN
PurityHistograms.java+51added 1.1
Draws Purity Histograms, new class for the analysis package

lcsim/src/org/lcsim/contrib/seedtracker/analysis
PurityHistograms.java added at 1.1
diff -N PurityHistograms.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ PurityHistograms.java	12 Aug 2008 23:42:39 -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.seedtracker.analysis;
+
+import org.lcsim.contrib.seedtracker.SeedTrack;
+import org.lcsim.event.MCParticle;
+import org.lcsim.event.Track;
+import org.lcsim.util.aida.AIDA;
+
+/**
+ *
+ * @author Pelham Keahey
+ */
+public class PurityHistograms {
+    private AIDA aida = AIDA.defaultInstance();
+    private AnalysisUtils util = new AnalysisUtils();
+    /**
+     * 
+     * @param mcp MCParticle currently being "looked" at
+     * @param trk the mcp's track
+     */
+    public void drawPurityHistograms(MCParticle mcp,Track trk){
+        //used to calculate helix parameters given a MCParticle and BField
+        HelixParamCalculator calc = new HelixParamCalculator(mcp, 5);
+        if (trk instanceof SeedTrack) {
+            //create a seed track
+            SeedTrack strk = (SeedTrack) trk;
+            //get total size of the hits used to create the track
+            int hitsize = strk.getSeedCandidate().getHits().size();
+            //get strat. name (used for histograms to analyze purity by strat.)
+            String stratname = strk.getStrategy().getName();
+            //find the purity of the track
+            double purity = util.FindTrackPurity(trk);
+            //shows the fake tracks (fake track is a track with a purity less than .5)
+            if(purity<.5)aida.histogram1D("Purity/Purity<.5 only", 200, 0, 1.1).fill(purity);
+            //1D histograms
+            aida.histogram1D("Purity/Strat: "+stratname, 200,0,1.1).fill(purity);
+            aida.histogram1D("Purity/Purity", 200, 0, 1.1).fill(purity);
+            //only shows the purity when it is not perfect
+            if(purity!=1)aida.histogram1D("Purity/Purity<1 only", 200, 0, 1.1).fill(purity);
+            aida.histogram1D("Purity/Purity to hits: "+hitsize, 300, 0, 1.1).fill(purity);
+            //2D histograms
+            aida.histogram1D("Purity/Hits v Purity", 200, 0, 20,"type=efficiency").fill(hitsize,purity);
+            aida.histogram1D("Purity/Theta v Purity", 100, 10, 100, "type=efficiency").fill(180*calc.getTheta()/Math.PI,purity);
+            aida.histogram1D("Purity/Pt v Purity", 200, 0, 70,"type=efficiency").fill(calc.getMCTransverseMomentum(),purity);
+        }
+    }
+}
CVSspam 0.2.8