lcsim/src/org/lcsim/contrib/seedtracker/analysis
diff -N EfficiencyHistograms.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ EfficiencyHistograms.java 12 Aug 2008 23:42:24 -0000 1.1
@@ -0,0 +1,95 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.lcsim.contrib.seedtracker.analysis;
+
+import hep.aida.IHistogram1D;
+import java.util.Map;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.MCParticle;
+import org.lcsim.util.aida.AIDA;
+
+/**
+ *
+ * @author Pelham Keahey
+ */
+public class EfficiencyHistograms {
+ private AIDA aida = AIDA.defaultInstance();
+ private AnalysisUtils util = new AnalysisUtils();
+ //map retrived from a util method that gives you a map of mcparticles with an integer, the integer is either
+ //0: no track found but should have been
+ //1: track found and meets cuts
+ private Map<MCParticle,Integer> effimap;
+ //used to cut down on time spent on recalcuting variables when the event hasn't even changed (variables affected by event)
+ private EventHeader currentEvent=null;
+ //histograms
+ IHistogram1D thetaeff,pteff,dcaeff,z0eff,phi0eff,tanLeff,omegaeff,eff;
+
+ public EfficiencyHistograms(){
+ //set dir and create histogram shells
+ //histograms to be displayed
+ aida.tree().mkdir("Efficiency");
+ thetaeff = aida.histogramFactory().createHistogram1D("Efficiency/Theta","", 90, 0., 180., "type=efficiency");
+ pteff = aida.histogramFactory().createHistogram1D("Efficiency/Pt","", 100, 0., 50., "type=efficiency");
+ aida.tree().mkdir("Efficiency/HelixParam");
+ dcaeff = aida.histogramFactory().createHistogram1D("Efficiency/HelixParam/DCA","", 120, -4., 4., "type=efficiency");
+ z0eff = aida.histogramFactory().createHistogram1D("Efficiency/HelixParam/z0","", 120, -4., 4., "type=efficiency");
+ phi0eff = aida.histogramFactory().createHistogram1D("Efficiency/HelixParam/phi0","", 120, 0., 360., "type=efficiency");
+ tanLeff = aida.histogramFactory().createHistogram1D("Efficiency/HelixParam/tanL","", 120, -10., 10., "type=efficiency");
+ omegaeff = aida.histogramFactory().createHistogram1D("Efficiency/HelixParam/Omega","", 120, -.02, .02, "type=efficiency");
+ eff = aida.histogramFactory().createHistogram1D("Efficiency/efficiency",200,0,3);
+ }
+
+ public void drawEfficiencyHistograms(MCParticle mcp,EventHeader event){
+ //calculator used to get helix parameters given an MCParticle and a BField
+ HelixParamCalculator calc = new HelixParamCalculator(mcp, 5);
+ //method to prevent recalculating variables based on the event, when the event is still the same
+ if(currentEvent==null || !currentEvent.equals(event)) {
+ effimap = util.FindEfficiency(event);
+ currentEvent = event;
+ }
+ //helix parameters from the calculator above (used for cuts later)
+ double theta = calc.getTheta();
+ double degreetheta = 180*theta/Math.PI;
+ double pt = calc.getMCTransverseMomentum();
+ double dca = calc.getDCA();
+ double z0 = calc.getZ0();
+ //check to see if the efficiency map has the mcparicle and get the associated integer (1 or 0)
+ if(effimap.containsKey(mcp)){
+ int wgt = effimap.get(mcp);
+ //cuts for tanL: pt,dca and z0
+ if(pt>1.1 && Math.abs(dca) < 9 && Math.abs(z0) < 9){
+ thetaeff.fill(degreetheta, wgt);
+ tanLeff.fill(calc.getSlopeSZPlane(), wgt);
+ aida.histogram1D("Efficiency/MCType/tanL/"+mcp.getType().getName(),120, -10., 10., "type=efficiency").fill(calc.getSlopeSZPlane(), wgt);
+ }
+ //Pt Cuts: Cos(theta) DCA z0
+ if (Math.cos(theta) < 0.985 && Math.abs(dca) < 9 && Math.abs(z0) < 9) {
+ pteff.fill(pt,wgt);
+ aida.histogram1D("Efficiency/MCType/Pt/"+mcp.getType().getName(), 100, 0., 50., "type=efficiency").fill(pt, wgt);
+ }
+ //Omega Cut: Pt
+ if(pt>1.1){
+ omegaeff.fill(calc.getMCOmega(), wgt);
+ aida.histogram1D("Efficiency/MCType/Omega/"+mcp.getType().getName(), 120, -.02, .02, "type=efficiency").fill(calc.getMCOmega(), wgt);
+ }
+ //Z0 Cuts: Pt DCA Cos(theta)
+ if(pt>1.1 && Math.abs(dca) < 9 && Math.cos(theta) < 0.985){
+ z0eff.fill(calc.getZ0(), wgt);
+ aida.histogram1D("Efficiency/MCType/z0/"+mcp.getType().getName(), 120, -4., 4., "type=efficiency").fill(calc.getZ0(), wgt);
+ }
+ //DCA Cuts: Pt Cos(theta) z0
+ if(pt>1.1 && Math.cos(theta) < 0.985 && Math.abs(z0) < 9){
+ dcaeff.fill(calc.getDCA(), wgt);
+ aida.histogram1D("Efficiency/MCType/DCA/"+mcp.getType().getName(), 120, -4., 4., "type=efficiency").fill(calc.getDCA(), wgt);
+ }
+ //Phi0 Cuts: Pt Cos(theta) z0 DCA
+ if(pt>1.1 && Math.cos(theta) < 0.985 && Math.abs(z0) < 9 && Math.abs(dca) < 9){
+ phi0eff.fill(180*calc.getPhi0()/Math.PI, wgt);
+ aida.histogram1D("Efficiency/MCType/phi0/"+mcp.getType().getName(), 120, 0., 360., "type=efficiency").fill(calc.getDCA(), wgt);
+ }
+ }
+ }
+}