LISTSERV mailing list manager LISTSERV 16.5

Help for HPS-SVN Archives


HPS-SVN Archives

HPS-SVN Archives


HPS-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

HPS-SVN Home

HPS-SVN Home

HPS-SVN  February 2015

HPS-SVN February 2015

Subject:

r2069 - in /java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal: FADCPrimaryTriggerDriver.java SinglesTriggerDriver.java TriggerModule.java

From:

[log in to unmask]

Reply-To:

Notification of commits to the hps svn repository <[log in to unmask]>

Date:

Sat, 7 Feb 2015 08:26:37 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (1191 lines)

Author: [log in to unmask]
Date: Sat Feb  7 00:26:27 2015
New Revision: 2069

Log:
Added new class TriggerModule to replace SSPTriggerLogic. TriggerModule fulfills the same purpose, but has slightly different functionality. It can be instantiated, allowing it to have specific trigger cuts set. This allows it to perform trigger tests without having cuts explicitly supplied keeping code cleaner. It also makes it easier to maintain multiple active triggers, since each simply requires that a new TriggerModule instance be instantiated. TriggerModule retains SSPTriggerLogic's ability to calculate trigger cut values in a static fashion. TriggerModule also has the ability to apply trigger cuts to SSPCluster objects. Currently, the energy slope, coplanarity, and seed energy cuts are not supported for SSPCluster objects. Seed energy will never be supported since the SSP bank does not report a seed energy. Coplanarity and energy slope support will be added pending the ability to caculate the crystal x and y position from an x- and y-index. Also updated FADCPrimaryTrig
 gerDriver and SinglesTriggerDriver to use the new TriggerModule and removed all references to SSPTriggerLogic.

Added:
    java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/TriggerModule.java
Modified:
    java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/FADCPrimaryTriggerDriver.java
    java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/SinglesTriggerDriver.java

Modified: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/FADCPrimaryTriggerDriver.java
 =============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/FADCPrimaryTriggerDriver.java	(original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/FADCPrimaryTriggerDriver.java	Sat Feb  7 00:26:27 2015
@@ -27,32 +27,19 @@
  */
 public class FADCPrimaryTriggerDriver extends TriggerDriver {
     // ==================================================================
-    // ==== Trigger Cut Default Parameters ==============================
-    // ==================================================================
-    private int minHitCount = 1;                                  // Minimum required cluster hit count threshold. (Hits)            
-    private double seedEnergyHigh = Double.MAX_VALUE;             // Maximum allowed cluster seed energy. (GeV)
-    private double seedEnergyLow = Double.MIN_VALUE;              // Minimum required cluster seed energy. (GeV)
-    private double clusterEnergyHigh = 1.5 * ECalUtils.GeV;       // Maximum allowed cluster total energy. (GeV)
-    private double clusterEnergyLow = .1 * ECalUtils.GeV;         // Minimum required cluster total energy. (GeV)
-    private double energySumHigh = 1.9 * ECalUtils.GeV;           // Maximum allowed pair energy sum. (GeV)
-    private double energySumLow = 0.0 * ECalUtils.GeV;            // Minimum required pair energy sum. (GeV)
-    private double energyDifferenceHigh = 2.2 * ECalUtils.GeV;    // Maximum allowed pair energy difference. (GeV)
-    private double energySlopeLow = 1.1;                          // Minimum required pair energy slope value.
-    private double coplanarityHigh = 35;                          // Maximum allowed pair coplanarity deviation. (Degrees)
-    
-    // ==================================================================
     // ==== Trigger General Default Parameters ==========================
     // ==================================================================
     private String clusterCollectionName = "EcalClusters";        // Name for the LCIO cluster collection.
     private int pairCoincidence = 2;                              // Maximum allowed time difference between clusters. (4 ns clock-cycles)
-    private double energySlopeParamF = 0.005500;                  // A parameter value used for the energy slope calculation.
     private int backgroundLevel = -1;                             // Automatically sets the cuts to achieve a predetermined background rate.
+    private TriggerModule triggerModule = new TriggerModule(1.0, 0.050,
+    		6.600, 0.010, 6.600, 0.000, 13.200, 6.600, 0.0, 360, 0.0055);
     
     // ==================================================================
     // ==== Driver Internal Variables ===================================
     // ==================================================================
-    private Queue<List<Cluster>> topClusterQueue = null;    // Store clusters on the top half of the calorimeter.
-    private Queue<List<Cluster>> botClusterQueue = null;    // Store clusters on the bottom half of the calorimeter.
+    private Queue<List<Cluster>> topClusterQueue = null;           // Store clusters on the top half of the calorimeter.
+    private Queue<List<Cluster>> botClusterQueue = null;           // Store clusters on the bottom half of the calorimeter.
     private int allClusters = 0;                                   // Track the number of clusters processed.
     private int allPairs = 0;                                      // Track the number of cluster pairs processed.
     private int clusterTotalEnergyCount = 0;                       // Track the clusters which pass the total energy cut.
@@ -68,42 +55,42 @@
     // ==== Trigger Distribution Plots ==================================
     // ==================================================================
     private AIDA aida = AIDA.defaultInstance();
-    IHistogram1D clusterSeedEnergy = aida.histogram1D("Trigger Plots :: Cluster Seed Energy Distribution", 176, 0.0, 2.2);
-    IHistogram1D clusterSeedEnergy100 = aida.histogram1D("Trigger Plots :: Cluster Seed Energy Distribution (Over 100 MeV)", 176, 0.0, 2.2);
-    IHistogram1D clusterSeedEnergySingle = aida.histogram1D("Trigger Plots :: Cluster Seed Energy Distribution (Passed Single Cuts)", 176, 0.0, 2.2);
-    IHistogram1D clusterSeedEnergyAll = aida.histogram1D("Trigger Plots :: Cluster Seed Energy Distribution (Passed All Cuts)", 176, 0.0, 2.2);
-    IHistogram1D clusterHitCount = aida.histogram1D("Trigger Plots :: Cluster Hit Count Distribution", 9, 1, 10);
-    IHistogram1D clusterHitCount100 = aida.histogram1D("Trigger Plots :: Cluster Hit Count Distribution (Over 100 MeV)", 9, 1, 10);
-    IHistogram1D clusterHitCountSingle = aida.histogram1D("Trigger Plots :: Cluster Hit Count Distribution (Passed Single Cuts)", 9, 1, 10);
-    IHistogram1D clusterHitCountAll = aida.histogram1D("Trigger Plots :: Cluster Hit Count Distribution (Passed All Cuts)", 9, 1, 10);
-    IHistogram1D clusterTotalEnergy = aida.histogram1D("Trigger Plots :: Cluster Total Energy Distribution", 176, 0.0, 2.2);
-    IHistogram1D clusterTotalEnergy100 = aida.histogram1D("Trigger Plots :: Cluster Total Energy Distribution (Over 100 MeV)", 176, 0.0, 2.2);
-    IHistogram1D clusterTotalEnergySingle = aida.histogram1D("Trigger Plots :: Cluster Total Energy Distribution (Passed Single Cuts)", 176, 0.0, 2.2);
-    IHistogram1D clusterTotalEnergyAll = aida.histogram1D("Trigger Plots :: Cluster Total Energy Distribution (Passed All Cuts)", 176, 0.0, 2.2);
-    
-    IHistogram1D pairEnergySum = aida.histogram1D("Trigger Plots :: Pair Energy Sum Distribution", 176, 0.0, 4.4);
-    IHistogram1D pairEnergySumAll = aida.histogram1D("Trigger Plots :: Pair Energy Sum Distribution (Passed All Cuts)", 176, 0.0, 4.4);    
-    IHistogram1D pairEnergyDifference = aida.histogram1D("Trigger Plots :: Pair Energy Difference Distribution", 176, 0.0, 2.2);
-    IHistogram1D pairEnergyDifferenceAll = aida.histogram1D("Trigger Plots :: Pair Energy Difference Distribution (Passed All Cuts)", 176, 0.0, 2.2);
-    IHistogram1D pairCoplanarity = aida.histogram1D("Trigger Plots :: Pair Coplanarity Distribution", 360, 0.0, 180.0);
-    IHistogram1D pairCoplanarityAll = aida.histogram1D("Trigger Plots :: Pair Coplanarity Distribution (Passed All Cuts)", 360, 0.0, 180.0);
-    IHistogram1D pairEnergySlope = aida.histogram1D("Trigger Plots :: Pair Energy Slope Distribution", 400, 0.0, 4.0);
-    IHistogram1D pairEnergySlopeAll = aida.histogram1D("Trigger Plots :: Pair Energy Slope Distribution (Passed All Cuts)", 400, 0.0, 4.0);
-    
-    IHistogram2D clusterDistribution = aida.histogram2D("Trigger Plots :: Cluster Seed Distribution", 46, -23, 23, 11, -5.5, 5.5);
-    IHistogram2D clusterDistribution100 = aida.histogram2D("Trigger Plots :: Cluster Seed Distribution (Over 100 MeV)", 46, -23, 23, 11, -5.5, 5.5);
-    IHistogram2D clusterDistributionSingle = aida.histogram2D("Trigger Plots :: Cluster Seed Distribution (Passed Single Cuts)", 46, -23, 23, 11, -5.5, 5.5);
-    IHistogram2D clusterDistributionAll = aida.histogram2D("Trigger Plots :: Cluster Seed Distribution (Passed All Cuts)", 46, -23, 23, 11, -5.5, 5.5);
+    private IHistogram1D clusterSeedEnergy = aida.histogram1D("Trigger Plots :: Cluster Seed Energy Distribution", 176, 0.0, 2.2);
+    private IHistogram1D clusterSeedEnergy100 = aida.histogram1D("Trigger Plots :: Cluster Seed Energy Distribution (Over 100 MeV)", 176, 0.0, 2.2);
+    private IHistogram1D clusterSeedEnergySingle = aida.histogram1D("Trigger Plots :: Cluster Seed Energy Distribution (Passed Single Cuts)", 176, 0.0, 2.2);
+    private IHistogram1D clusterSeedEnergyAll = aida.histogram1D("Trigger Plots :: Cluster Seed Energy Distribution (Passed All Cuts)", 176, 0.0, 2.2);
+    private IHistogram1D clusterHitCount = aida.histogram1D("Trigger Plots :: Cluster Hit Count Distribution", 9, 1, 10);
+    private IHistogram1D clusterHitCount100 = aida.histogram1D("Trigger Plots :: Cluster Hit Count Distribution (Over 100 MeV)", 9, 1, 10);
+    private IHistogram1D clusterHitCountSingle = aida.histogram1D("Trigger Plots :: Cluster Hit Count Distribution (Passed Single Cuts)", 9, 1, 10);
+    private IHistogram1D clusterHitCountAll = aida.histogram1D("Trigger Plots :: Cluster Hit Count Distribution (Passed All Cuts)", 9, 1, 10);
+    private IHistogram1D clusterTotalEnergy = aida.histogram1D("Trigger Plots :: Cluster Total Energy Distribution", 176, 0.0, 2.2);
+    private IHistogram1D clusterTotalEnergy100 = aida.histogram1D("Trigger Plots :: Cluster Total Energy Distribution (Over 100 MeV)", 176, 0.0, 2.2);
+    private IHistogram1D clusterTotalEnergySingle = aida.histogram1D("Trigger Plots :: Cluster Total Energy Distribution (Passed Single Cuts)", 176, 0.0, 2.2);
+    private IHistogram1D clusterTotalEnergyAll = aida.histogram1D("Trigger Plots :: Cluster Total Energy Distribution (Passed All Cuts)", 176, 0.0, 2.2);
+    
+    private IHistogram1D pairEnergySum = aida.histogram1D("Trigger Plots :: Pair Energy Sum Distribution", 176, 0.0, 4.4);
+    private IHistogram1D pairEnergySumAll = aida.histogram1D("Trigger Plots :: Pair Energy Sum Distribution (Passed All Cuts)", 176, 0.0, 4.4);    
+    private IHistogram1D pairEnergyDifference = aida.histogram1D("Trigger Plots :: Pair Energy Difference Distribution", 176, 0.0, 2.2);
+    private IHistogram1D pairEnergyDifferenceAll = aida.histogram1D("Trigger Plots :: Pair Energy Difference Distribution (Passed All Cuts)", 176, 0.0, 2.2);
+    private IHistogram1D pairCoplanarity = aida.histogram1D("Trigger Plots :: Pair Coplanarity Distribution", 360, 0.0, 180.0);
+    private IHistogram1D pairCoplanarityAll = aida.histogram1D("Trigger Plots :: Pair Coplanarity Distribution (Passed All Cuts)", 360, 0.0, 180.0);
+    private IHistogram1D pairEnergySlope = aida.histogram1D("Trigger Plots :: Pair Energy Slope Distribution", 400, 0.0, 4.0);
+    private IHistogram1D pairEnergySlopeAll = aida.histogram1D("Trigger Plots :: Pair Energy Slope Distribution (Passed All Cuts)", 400, 0.0, 4.0);
+    
+    private IHistogram2D clusterDistribution = aida.histogram2D("Trigger Plots :: Cluster Seed Distribution", 46, -23, 23, 11, -5.5, 5.5);
+    private IHistogram2D clusterDistribution100 = aida.histogram2D("Trigger Plots :: Cluster Seed Distribution (Over 100 MeV)", 46, -23, 23, 11, -5.5, 5.5);
+    private IHistogram2D clusterDistributionSingle = aida.histogram2D("Trigger Plots :: Cluster Seed Distribution (Passed Single Cuts)", 46, -23, 23, 11, -5.5, 5.5);
+    private IHistogram2D clusterDistributionAll = aida.histogram2D("Trigger Plots :: Cluster Seed Distribution (Passed All Cuts)", 46, -23, 23, 11, -5.5, 5.5);
     
     // ==================================================================
     // ==== Hardware Diagnostic Variables ===============================
     // ==================================================================
-    IHistogram2D diagClusters = aida.histogram2D("Diagnostic Plots :: Cluster Seed Distribution", 46, -23, 23, 11, -5.5, 5.5);
-    IHistogram1D[] diagHitCount = {
+    private IHistogram2D diagClusters = aida.histogram2D("Diagnostic Plots :: Cluster Seed Distribution", 46, -23, 23, 11, -5.5, 5.5);
+    private IHistogram1D[] diagHitCount = {
                 aida.histogram1D("Diagnostic Plots :: Cluster Hit Count Distribution (Top)", 8, 0, 8),
                 aida.histogram1D("Diagnostic Plots :: Cluster Hit Count Distribution (Bottom)", 8, 0, 8)
             };
-    IHistogram1D[] diagTotalEnergy = {
+    private IHistogram1D[] diagTotalEnergy = {
                 aida.histogram1D("Diagnostic Plots :: Cluster Total Energy Distribution (Top)", 1024, 0.0, 8.192),
                 aida.histogram1D("Diagnostic Plots :: Cluster Total Energy Distribution (Bottom)", 1024, 0.0, 8.192)
             };
@@ -131,17 +118,17 @@
         System.out.printf("\tTrigger Count :: %d%n", numTriggers);
         
         // Print the trigger cuts.
-        System.out.printf("%nCut Values:%n");
-        System.out.printf("\tSeed Energy Low        :: %.2f%n", seedEnergyLow);
-        System.out.printf("\tSeed Energy High       :: %.2f%n", seedEnergyHigh);
-        System.out.printf("\tCluster Energy Low     :: %.2f%n", clusterEnergyLow);
-        System.out.printf("\tCluster Energy High    :: %.2f%n", clusterEnergyHigh);
-        System.out.printf("\tCluster Hit Count      :: %d%n", minHitCount);
-        System.out.printf("\tPair Energy Sum Low    :: %.2f%n", energySumLow);
-        System.out.printf("\tPair Energy Sum High   :: %.2f%n", energySumHigh);
-        System.out.printf("\tPair Energy Difference :: %.2f%n", energyDifferenceHigh);
-        System.out.printf("\tPair Energy Slope      :: %.2f%n", energySlopeLow);
-        System.out.printf("\tPair Coplanarity       :: %.2f%n", coplanarityHigh);
+        System.out.printf("%nTrigger Module Cut Values:%n");
+        System.out.printf("\tSeed Energy Low        :: %.3f%n", triggerModule.getCutValue(TriggerModule.CLUSTER_SEED_ENERGY_LOW));
+        System.out.printf("\tSeed Energy High       :: %.3f%n", triggerModule.getCutValue(TriggerModule.CLUSTER_SEED_ENERGY_HIGH));
+        System.out.printf("\tCluster Energy Low     :: %.3f%n", triggerModule.getCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW));
+        System.out.printf("\tCluster Energy High    :: %.3f%n", triggerModule.getCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH));
+        System.out.printf("\tCluster Hit Count      :: %.0f%n", triggerModule.getCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW));
+        System.out.printf("\tPair Energy Sum Low    :: %.3f%n", triggerModule.getCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW));
+        System.out.printf("\tPair Energy Sum High   :: %.3f%n", triggerModule.getCutValue(TriggerModule.PAIR_ENERGY_SUM_HIGH));
+        System.out.printf("\tPair Energy Difference :: %.3f%n", triggerModule.getCutValue(TriggerModule.PAIR_ENERGY_DIFFERENCE_HIGH));
+        System.out.printf("\tPair Energy Slope      :: %.1f%n", triggerModule.getCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW));
+        System.out.printf("\tPair Coplanarity       :: %.1f%n", triggerModule.getCutValue(TriggerModule.PAIR_COPLANARITY_HIGH));
         
         // Run the superclass method.
         super.endOfData();
@@ -209,12 +196,13 @@
                 // VERBOSE :: Print the seed energy comparison check.
                 if(verbose) {
                     System.out.printf("\tSeed Energy Cut    :: %.3f < %.3f < %.3f --> %b%n",
-                    		seedEnergyLow, seedEnergy, seedEnergyHigh,
-                    		SSPTriggerLogic.clusterSeedEnergyCut(cluster, seedEnergyLow, seedEnergyHigh));
+                    		triggerModule.getCutValue(TriggerModule.CLUSTER_SEED_ENERGY_LOW), seedEnergy,
+                    		triggerModule.getCutValue(TriggerModule.CLUSTER_SEED_ENERGY_HIGH),
+                    		triggerModule.clusterSeedEnergyCut(cluster));
                 }
                 
                 // If the cluster fails the cut, skip to the next cluster.
-                if(!SSPTriggerLogic.clusterSeedEnergyCut(cluster, seedEnergyLow, seedEnergyHigh)) {
+                if(!triggerModule.clusterSeedEnergyCut(cluster)) {
                 	continue clusterLoop;
                 }
                 
@@ -225,12 +213,13 @@
                 // =============================================================
                 // VERBOSE :: Print the hit count comparison check.
                 if(verbose) {
-                    System.out.printf("\tHit Count Cut      :: %d >= %d --> %b%n",
-                    		hitCount, minHitCount, SSPTriggerLogic.clusterHitCountCut(cluster, minHitCount));
+                    System.out.printf("\tHit Count Cut      :: %.0f >= %d --> %b%n",
+                    		hitCount, triggerModule.getCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW),
+                    		triggerModule.clusterHitCountCut(cluster));
                 }
                 
                 // If the cluster fails the cut, skip to the next cluster.
-                if(!SSPTriggerLogic.clusterHitCountCut(cluster, minHitCount)) {
+                if(!triggerModule.clusterHitCountCut(cluster)) {
                 	continue clusterLoop;
                 }
                 
@@ -242,12 +231,13 @@
                 // VERBOSE :: Print the cluster energy comparison check.
                 if(verbose) {
                     System.out.printf("\tCluster Energy Cut :: %.3f < %.3f < %.3f --> %b%n",
-                    		clusterEnergyLow, clusterEnergy, clusterEnergyHigh,
-                    		SSPTriggerLogic.clusterTotalEnergyCut(cluster, clusterEnergyLow, clusterEnergyHigh));
+                    		triggerModule.getCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW), clusterEnergy,
+                    		triggerModule.getCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH),
+                    		triggerModule.clusterTotalEnergyCut(cluster));
                 }
                 
                 // If the cluster fails the cut, skip to the next cluster.
-                if(!SSPTriggerLogic.clusterTotalEnergyCut(cluster, clusterEnergyLow, clusterEnergyHigh)) {
+                if(!triggerModule.clusterTotalEnergyCut(cluster)) {
                 	continue clusterLoop;
                 }
                 
@@ -297,7 +287,7 @@
      * @param clusterEnergyHigh - The parameter value.
      */
     public void setClusterEnergyHigh(double clusterEnergyHigh) {
-        this.clusterEnergyHigh = clusterEnergyHigh * ECalUtils.GeV;
+        triggerModule.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH, clusterEnergyHigh * ECalUtils.GeV);
     }
     
     /**
@@ -307,7 +297,7 @@
      * @param clusterEnergyLow - The parameter value.
      */
     public void setClusterEnergyLow(double clusterEnergyLow) {
-        this.clusterEnergyLow = clusterEnergyLow * ECalUtils.GeV;
+        triggerModule.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW, clusterEnergyLow * ECalUtils.GeV);
     }
     
     /**
@@ -317,7 +307,7 @@
      * @param maxCoplanarityAngle - The parameter value.
      */
     public void setCoplanarityHigh(double coplanarityHigh) {
-        this.coplanarityHigh = coplanarityHigh;
+        triggerModule.setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH, coplanarityHigh);
     }
     
     /**
@@ -327,7 +317,7 @@
      * @param energyDifferenceHigh - The parameter value.
      */
     public void setEnergyDifferenceHigh(double energyDifferenceHigh) {
-        this.energyDifferenceHigh = energyDifferenceHigh * ECalUtils.GeV;
+        triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_DIFFERENCE_HIGH, energyDifferenceHigh * ECalUtils.GeV);
     }
     
     /**
@@ -336,7 +326,7 @@
      * @param energySlopeLow - The parameter value.
      */
     public void setEnergySlopeLow(double energySlopeLow) {
-        this.energySlopeLow = energySlopeLow;
+        triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW, energySlopeLow);
     }
     
     /**
@@ -346,7 +336,7 @@
      * @param energySumHigh - The parameter value.
      */
     public void setEnergySumHigh(double energySumHigh) {
-        this.energySumHigh = energySumHigh * ECalUtils.GeV;
+        triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SUM_HIGH, energySumHigh * ECalUtils.GeV);
     }
     
     /**
@@ -356,7 +346,7 @@
      * @param energySumHigh - The parameter value.
      */
     public void setEnergySumLow(double energySumLow) {
-        this.energySumLow = energySumLow * ECalUtils.GeV;
+        triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW, energySumLow * ECalUtils.GeV);
     }
     
     /**
@@ -365,7 +355,7 @@
      * @param minHitCount - The parameter value.
      */
     public void setMinHitCount(int minHitCount) {
-        this.minHitCount = minHitCount;
+        triggerModule.setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW, minHitCount);
     }
     
     /**
@@ -385,7 +375,7 @@
      * @param seedEnergyHigh - The parameter value.
      */
     public void setSeedEnergyHigh(double seedEnergyHigh) {
-        this.seedEnergyHigh = seedEnergyHigh * ECalUtils.GeV;
+        triggerModule.setCutValue(TriggerModule.CLUSTER_SEED_ENERGY_HIGH, seedEnergyHigh * ECalUtils.GeV);
     }
     
     /**
@@ -395,7 +385,7 @@
      * @param seedEnergyLow - The parameter value.
      */
     public void setSeedEnergyLow(double seedEnergyLow) {
-        this.seedEnergyLow = seedEnergyLow * ECalUtils.GeV;
+        triggerModule.setCutValue(TriggerModule.CLUSTER_SEED_ENERGY_LOW, seedEnergyLow * ECalUtils.GeV);
     }
     
     /**
@@ -404,7 +394,7 @@
      * @param f - The new energy slope parameter.
      */
     public void setEnergySlopeParamF(double f) {
-    	energySlopeParamF = f;
+        triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_F, f);
     }
     
     /**
@@ -516,63 +506,63 @@
         
         // Some cut values are almost always the same thing. Set those
         // here and only overwrite if necessary.
-    	seedEnergyLow        = 0.125;
-    	seedEnergyHigh       = 1.300;
-        clusterEnergyLow     = 0.200;
-        clusterEnergyHigh    = 1.700;
-        energySumLow         = 0.500;
-        energySumHigh        = 2.000;
-        energyDifferenceHigh = 1.200;
-        coplanarityHigh      = 30;
-        minHitCount          = 2;
+    	triggerModule.setCutValue(TriggerModule.CLUSTER_SEED_ENERGY_LOW,     0.125);
+    	triggerModule.setCutValue(TriggerModule.CLUSTER_SEED_ENERGY_HIGH,    1.300);
+    	triggerModule.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW,    0.200);
+    	triggerModule.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH,   1.700);
+    	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW,         0.500);
+    	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SUM_HIGH,        2.000);
+    	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_DIFFERENCE_HIGH, 1.200);
+    	triggerModule.setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH,       30);
+    	triggerModule.setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW,       2);
         
         // Set the variable values.
         if(backgroundLevel == 1) {
-            energySumLow         = 1.000;
-            energySlopeLow       = 1.2;
-            coplanarityHigh      = 20;
+        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW,         1.000);
+        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       1.2);
+        	triggerModule.setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH,       20);
         } else if(backgroundLevel == 2) {
-            energySlopeLow       = 1.0;
-            coplanarityHigh      = 20;
+        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       1.0);
+        	triggerModule.setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH,       20);
         } else if(backgroundLevel == 3) {
-            energySlopeLow       = 1.0;
+        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       1.0);
         } else if(backgroundLevel == 4) {
-            energySlopeLow       = 0.8;
+        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       0.8);
         } else if(backgroundLevel == 5) {
-            energySlopeLow       = 0.8;
+        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       0.8);
         } else if(backgroundLevel == 6) {
-            energySlopeLow       = 0.6;
+        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       0.6);
         } else if(backgroundLevel == 7) {
-            energySlopeLow       = 0.6;
+        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       0.6);
         } else if(backgroundLevel == 8) {
-            clusterEnergyHigh    = 1.500;
-            energySlopeLow       = 0.4;
+        	triggerModule.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH,   1.500);
+        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       0.4);
         } else if(backgroundLevel == 9) {
-            energySlopeLow       = 0.4;
+        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       0.4);
         } else if(backgroundLevel == 10) {
-            energySlopeLow       = 0.4;
+        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       0.4);
         } else if(backgroundLevel == 0) {
-            seedEnergyLow        = 0.100;
-            seedEnergyHigh       = 6.600;
-            clusterEnergyLow     = 0.100;
-            clusterEnergyHigh    = 1.500;
-            energySumLow         = 0.000;
-            energySumHigh        = 1.900;
-            energyDifferenceHigh = 2.200;
-            energySlopeLow       = 1.10;
-            coplanarityHigh      = 35;
-            minHitCount          = 1;
+        	triggerModule.setCutValue(TriggerModule.CLUSTER_SEED_ENERGY_LOW,     0.100);
+        	triggerModule.setCutValue(TriggerModule.CLUSTER_SEED_ENERGY_HIGH,    6.600);
+        	triggerModule.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW,    0.100);
+        	triggerModule.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH,   1.500);
+        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW,         0.000);
+        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SUM_HIGH,        1.900);
+        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_DIFFERENCE_HIGH, 2.200);
+        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       1.1);
+        	triggerModule.setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH,       35);
+        	triggerModule.setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW,       1);
         } else if(backgroundLevel == -1) {
-            seedEnergyLow        = 0.050;
-            seedEnergyHigh       = 6.600;
-            clusterEnergyLow     = 0.010;
-            clusterEnergyHigh    = 6.600;
-            energySumLow         = 0.000;
-            energySumHigh        = 13.200;
-            energyDifferenceHigh = 6.600;
-            energySlopeLow       = 0.00;
-            coplanarityHigh      = 360;
-            minHitCount          = 1;
+        	triggerModule.setCutValue(TriggerModule.CLUSTER_SEED_ENERGY_LOW,     0.050);
+        	triggerModule.setCutValue(TriggerModule.CLUSTER_SEED_ENERGY_HIGH,    6.600);
+        	triggerModule.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW,    0.010);
+        	triggerModule.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH,   6.600);
+        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW,         0.000);
+        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SUM_HIGH,        13.200);
+        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_DIFFERENCE_HIGH, 6.600);
+        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       0.0);
+        	triggerModule.setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH,       360);
+        	triggerModule.setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW,       1);
         }
     }
     
@@ -594,10 +584,10 @@
             allPairs++;
             
             // Get the plot values for the pair cuts.
-            double energySum = SSPTriggerLogic.getValueEnergySum(clusterPair);
-            double energyDifference = SSPTriggerLogic.getValueEnergyDifference(clusterPair);
-            double energySlope = SSPTriggerLogic.getValueEnergySlope(clusterPair, energySlopeParamF);
-            double coplanarity = SSPTriggerLogic.getValueCoplanarity(clusterPair);
+            double energySum = TriggerModule.getValueEnergySum(clusterPair);
+            double energyDifference = TriggerModule.getValueEnergyDifference(clusterPair);
+            double energySlope = TriggerModule.getValueEnergySlope(clusterPair, triggerModule.getCutValue(TriggerModule.PAIR_ENERGY_SLOPE_F));
+            double coplanarity = TriggerModule.getValueCoplanarity(clusterPair);
             
             // Fill the general plots.
             pairEnergySum.fill(energySum, 1);
@@ -608,10 +598,9 @@
             // ==== Pair Energy Sum Cut ====================================
             // =============================================================
             // If the cluster fails the cut, skip to the next pair.
-            if(!SSPTriggerLogic.pairEnergySumCut(clusterPair, energySumLow, energySumHigh)) {
+            if(!triggerModule.pairEnergySumCut(clusterPair)) {
             	continue pairLoop;
             }
-            //if(!pairEnergySumCut(clusterPair)) { continue pairLoop; }
             
             // Otherwise, note that it passed the cut.
             pairEnergySumCount++;
@@ -619,7 +608,7 @@
             // ==== Pair Energy Difference Cut =============================
             // =============================================================
             // If the cluster fails the cut, skip to the next pair.
-            if(!SSPTriggerLogic.pairEnergyDifferenceCut(clusterPair, energyDifferenceHigh)) {
+            if(!triggerModule.pairEnergyDifferenceCut(clusterPair)) {
             	continue pairLoop;
             }
             
@@ -629,10 +618,9 @@
             // ==== Pair Energy Slope Cut ==================================
             // =============================================================
             // If the cluster fails the cut, skip to the next pair.
-            if(!SSPTriggerLogic.pairEnergySlopeCut(clusterPair, energySlopeLow, energySlopeParamF)) {
+            if(!triggerModule.pairEnergySlopeCut(clusterPair)) {
             	continue pairLoop;
             }
-            //if(!pairEnergySlopeCut(clusterPair)) { continue pairLoop; }
             
             // Otherwise, note that it passed the cut.
             pairEnergySlopeCount++;
@@ -640,10 +628,9 @@
             // ==== Pair Coplanarity Cut ===================================
             // =============================================================
             // If the cluster fails the cut, skip to the next pair.
-            if(!SSPTriggerLogic.pairCoplanarityCut(clusterPair, coplanarityHigh)) {
+            if(!triggerModule.pairCoplanarityCut(clusterPair)) {
             	continue pairLoop;
             }
-            //if(!pairCoplanarityCut(clusterPair)) { continue pairLoop; }
             
             // Otherwise, note that it passed the cut.
             pairCoplanarityCount++;

Modified: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/SinglesTriggerDriver.java
 =============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/SinglesTriggerDriver.java	(original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/SinglesTriggerDriver.java	Sat Feb  7 00:26:27 2015
@@ -21,11 +21,8 @@
  */
 public class SinglesTriggerDriver extends TriggerDriver {
     // Cut Values
-    private int hitCountLow = 2;
-    private double seedEnergyLow = 0.125;
-    private double seedEnergyHigh = 6.6;
-    private double clusterEnergyLow = 0.200;
-    private double clusterEnergyHigh = 6.6;
+    private TriggerModule triggerModule = new TriggerModule(2.0, 0.125,
+    		6.600, 0.200, 6.600, 0.000, 13.200, 6.600, 0.0, 360, 0.0055);
     
     // LCIO Collection Names
     private String clusterCollectionName = "EcalClusters";
@@ -81,17 +78,17 @@
             triggerLoop:
             for(Cluster cluster : clusterList) {
                 // Perform the hit count cut.
-                if(!SSPTriggerLogic.clusterHitCountCut(cluster, hitCountLow)) {
+                if(!triggerModule.clusterHitCountCut(cluster)) {
                     continue triggerLoop;
                 }
                 
                 // Perform the seed hit cut.
-                if(!SSPTriggerLogic.clusterSeedEnergyCut(cluster, seedEnergyLow, seedEnergyHigh)) {
+                if(!triggerModule.clusterSeedEnergyCut(cluster)) {
                     continue triggerLoop;
                 }
                 
                 // Perform the cluster energy cut.
-                if(!SSPTriggerLogic.clusterTotalEnergyCut(cluster, clusterEnergyLow, clusterEnergyHigh)) {
+                if(!triggerModule.clusterTotalEnergyCut(cluster)) {
                     continue triggerLoop;
                 }
                 
@@ -119,7 +116,7 @@
      * @param hitCountThreshold - The value of the threshold.
      */
     public void setHitCountThreshold(int hitCountThreshold) {
-        hitCountLow = hitCountThreshold;
+    	triggerModule.setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW, hitCountThreshold);
     }
     
     /**
@@ -128,7 +125,7 @@
      * @param seedEnergyLow - The value of the threshold.
      */
     public void setSeedEnergyLowThreshold(double seedEnergyLow) {
-        this.seedEnergyLow = seedEnergyLow;
+    	triggerModule.setCutValue(TriggerModule.CLUSTER_SEED_ENERGY_LOW, seedEnergyLow);
     }
     
     /**
@@ -137,7 +134,7 @@
      * @param seedEnergyHigh - The value of the threshold.
      */
     public void setSeedEnergyHighThreshold(double seedEnergyHigh) {
-        this.seedEnergyHigh = seedEnergyHigh;
+    	triggerModule.setCutValue(TriggerModule.CLUSTER_SEED_ENERGY_HIGH, seedEnergyHigh);
     }
     
     /**
@@ -146,7 +143,7 @@
      * @param clusterEnergyLow - The value of the threshold.
      */
     public void setClusterEnergyLowThreshold(double clusterEnergyLow) {
-        this.clusterEnergyLow = clusterEnergyLow;
+    	triggerModule.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW, clusterEnergyLow);
     }
     
     /**
@@ -155,7 +152,7 @@
      * @param clusterEnergyHigh - The value of the threshold.
      */
     public void setClusterEnergyHighThreshold(double clusterEnergyHigh) {
-        this.clusterEnergyHigh = clusterEnergyHigh;
+    	triggerModule.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH, clusterEnergyHigh);
     }
     
     /**

Added: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/TriggerModule.java
 =============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/TriggerModule.java	(added)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/TriggerModule.java	Sat Feb  7 00:26:27 2015
@@ -0,0 +1,626 @@
+package org.hps.readout.ecal;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.hps.readout.ecal.triggerbank.SSPCluster;
+import org.lcsim.event.Cluster;
+
+/**
+ * Class <code>SSPTriggerModule</code> handles trigger cuts. By default,
+ * it sets all cuts such that any cluster or cluster pair will pass.
+ * Cuts can be set after initialization via the <code>setCutValue</code>
+ * method using a cut identifier. All valid cut identifiers are static
+ * class variables for easy reference.<br/>
+ * <br/>
+ * All cut value calculations are static methods, and can thusly be
+ * called without initializing an instance of the module.<br/>
+ * <br/>
+ * Both <code>Cluster</code> objects and <code>SSPCluster</code> objects
+ * are supported.
+ * 
+ * @author Kyle McCarty <[log in to unmask]>
+ * @see Cluster
+ * @see SSPCluster
+ */
+public final class TriggerModule {
+	// ECal mid-plane, defined by photon beam position (30.52 mrad) at ECal face (z=1393 mm)
+    private static final double ORIGIN_X = 1393.0 * Math.tan(0.03052);
+    
+    // Trigger module property names.
+    /** The value of the parameter "F" in the energy slope equation
+     * <code>E_low GeV + R_min mm * F GeV/mm</code>. */
+    public static final String PAIR_ENERGY_SLOPE_F = "pairEnergySlopeF";
+    /** The lower bound for the pair energy sum cut. The sum of the
+     * energies of two clusters must exceed this value to pass the cut. */
+    public static final String PAIR_ENERGY_SUM_LOW = "pairEnergySumLow";
+    /** The upper bound for the pair energy sum cut. The sum of the
+     * energies of two clusters must be below this value to pass the cut. */
+    public static final String PAIR_ENERGY_SUM_HIGH = "pairEnergySumHigh";
+    /** The threshold for the cluster hit count cut. Clusters must have
+     * this many hits or more to pass the cut. */
+    public static final String CLUSTER_HIT_COUNT_LOW = "clusterHitCountLow";
+    /** The threshold for the energy slope cut. The value of the energy
+     * slope equation must exceed this value to pass the cut. */
+    public static final String PAIR_ENERGY_SLOPE_LOW = "pairEnergySlopeLow";
+    /** The bound for the coplanarity cut. The coplanarity angle for
+     * the cluster pair must be below this value to pass the cut. */
+    public static final String PAIR_COPLANARITY_HIGH = "pairCoplanarityHigh";
+    /** The lower bound for the cluster seed energy cut. The seed energy
+     * of a cluster must exceed this value to pass the cut. */
+    public static final String CLUSTER_SEED_ENERGY_LOW = "clusterSeedEnergyLow";
+    /** The upper bound for the cluster seed energy cut. The seed energy
+     * of a cluster must be below this value to pass the cut. */
+    public static final String CLUSTER_SEED_ENERGY_HIGH = "clusterSeedEnergyHigh";
+    /** The lower bound for the cluster total energy cut. The energy
+     * of a cluster must exceed this value to pass the cut. */
+    public static final String CLUSTER_TOTAL_ENERGY_LOW = "clusterTotalEnergyLow";
+    /** The upper bound for the cluster total energy cut. The energy
+     * of a cluster must be below this value to pass the cut. */
+    public static final String CLUSTER_TOTAL_ENERGY_HIGH = "clusterTotalEnergyHigh";
+    /** The bound for the pair energy difference cut. The absolute value
+     * of the difference between the energies of the cluster pair must
+     * be below this value to pass the cut. */
+    public static final String PAIR_ENERGY_DIFFERENCE_HIGH = "pairEnergyDifferenceHigh";
+    
+    // Trigger cut settings map.
+    private final Map<String, Double> cuts = new HashMap<String, Double>(11);
+    
+    /**
+     * Creates an <code>SSPTriggerModule</code> that accepts all single
+     * cluster and cluster pair events.
+     */
+    public TriggerModule() {
+    	// Set the cluster singles cuts to accept all values by default.
+    	cuts.put(CLUSTER_HIT_COUNT_LOW, 0.0);
+    	cuts.put(CLUSTER_SEED_ENERGY_LOW, 0.0);
+    	cuts.put(CLUSTER_SEED_ENERGY_HIGH, Double.MAX_VALUE);
+    	cuts.put(CLUSTER_TOTAL_ENERGY_LOW, 0.0);
+    	cuts.put(CLUSTER_TOTAL_ENERGY_HIGH, Double.MAX_VALUE);
+    	
+    	// Set the cluster pair cuts to accept all values by default.
+    	cuts.put(PAIR_COPLANARITY_HIGH, 180.0);
+    	cuts.put(PAIR_ENERGY_DIFFERENCE_HIGH, Double.MAX_VALUE);
+    	cuts.put(PAIR_ENERGY_SLOPE_LOW, 0.0);
+    	cuts.put(PAIR_ENERGY_SUM_LOW, 0.0);
+    	cuts.put(PAIR_ENERGY_SUM_HIGH, Double.MAX_VALUE);
+    	
+    	// Set the default value of the energy slope parameter F.
+    	cuts.put(PAIR_ENERGY_SLOPE_F, 0.0055);
+    }
+    
+    /**
+     * Creates an <code>SSPTriggerModule</code> that uses the default
+     * cut values specified by the argument array. The array should be
+     * of size 11. Values are applied in the order:
+     * <ul>
+     * <li>Cluster Hit Count Lower Bound</li>
+     * <li>Cluster Seed Energy Lower Bound</li>
+     * <li>Cluster Seed Energy Upper Bound</li>
+     * <li>Cluster Seed Total Lower Bound</li>
+     * <li>Cluster Seed Total Upper Bound</li>
+     * <li>Pair Energy Sum Lower Bound</li>
+     * <li>Pair Energy Sum Upper Bound</li>
+     * <li>Pair Energy Difference Upper Bound</li>
+     * <li>Pair Energy Slope Lower Bound</li>
+     * <li>Pair Coplanarity Upper Bound</li>
+     * <li>Pair Energy Slope Parameter F</li>
+     * </ul>
+     */
+    public TriggerModule(double... cutValues) {
+    	// Set the cuts to the default values.
+    	this();
+    	
+    	// Define the cuts in the order that they correspond to the
+    	// value arguments.
+    	String[] cutID = { CLUSTER_HIT_COUNT_LOW, CLUSTER_SEED_ENERGY_LOW, CLUSTER_SEED_ENERGY_HIGH,
+    			CLUSTER_TOTAL_ENERGY_LOW, CLUSTER_TOTAL_ENERGY_HIGH, PAIR_ENERGY_SUM_LOW, PAIR_ENERGY_SUM_HIGH,
+    			PAIR_ENERGY_DIFFERENCE_HIGH, PAIR_ENERGY_SLOPE_LOW, PAIR_COPLANARITY_HIGH, PAIR_ENERGY_SLOPE_F };
+    	
+    	// Iterate over the value arguments and assign them to the
+    	// appropriate cut.
+    	for(int i = 0; i < cutValues.length; i++) {
+    		// If more values were given then cuts exist, break from
+    		// the loop.
+    		if(i == 11) { break; }
+    		
+    		// Set the current cut to its corresponding value.
+    		cuts.put(cutID[i], cutValues[i]);
+    	}
+    }
+    
+    /**
+     * Gets the value of the requested cut, if it exists.
+     * @param cut - The identifier of the cut.
+     * @return Returns the cut value as a <code>double</code>.
+     * @throws IllegalArgumentException Occurs if the cut does not exist.
+     */
+    public double getCutValue(String cut) throws IllegalArgumentException {
+    	// Try to get the indicated cut.
+    	Double value = cuts.get(cut);
+    	
+    	// If the cut is valid, return it.
+    	if(value != null) { return value.doubleValue(); }
+    	
+    	// Otherwise, produce an exception.
+    	else { throw new IllegalArgumentException(String.format("Cut \"%s\" does not exist.", cut)); }
+    }
+    
+    /**
+     * Sets the value of the indicated cut to a new value.
+     * @param cut - The identifier of the cut to which the new value
+     * should be assigned.
+     * @param value - The new cut value.
+     * @throws IllegalArgumentException Occurs if the cut does not exist.
+     */
+    public void setCutValue(String cut, double value) throws IllegalArgumentException {
+    	// Make sure that the cut exists. If it does, change it to the
+    	// new cut value.
+    	if(cuts.containsKey(cut)) {
+    		cuts.put(cut, value);
+    	}
+    	
+    	// Otherwise, throw an exception.
+    	else { throw new IllegalArgumentException(String.format("Cut \"%s\" does not exist.", cut)); }
+    }
+    
+    /**
+     * Checks whether the argument cluster possesses the minimum
+     * allowed hits.
+     * @param cluster - The cluster to check.
+     * @return Returns <code>true</code> if the cluster passes the cut
+     * and <code>false</code> if the cluster does not.
+     */
+    public boolean clusterHitCountCut(Cluster cluster) {
+        return clusterHitCountCut(getValueClusterHitCount(cluster));
+    }
+    
+    /**
+     * Checks whether the argument cluster possesses the minimum
+     * allowed hits.
+     * @param cluster - The cluster to check.
+     * @return Returns <code>true</code> if the cluster passes the cut
+     * and <code>false</code> if the cluster does not.
+     */
+    public boolean clusterHitCountCut(SSPCluster cluster) {
+        return clusterHitCountCut(getValueClusterHitCount(cluster));
+    }
+    
+    /**
+     * Checks whether the argument cluster seed hit falls within the
+     * allowed seed hit energy range.
+     * @param cluster - The cluster to check.
+     * @return Returns <code>true</code> if the cluster passes the cut
+     * and <code>false</code> if the cluster does not.
+     */
+    public boolean clusterSeedEnergyCut(Cluster cluster) {
+    	return clusterSeedEnergyCut(getValueClusterSeedEnergy(cluster));
+    }
+    
+    /**
+     * Checks whether the argument cluster falls within the allowed
+     * cluster total energy range.
+     * @param cluster - The cluster to check.
+     * @return Returns <code>true</code> if the cluster passes the cut
+     * and <code>false</code> if the cluster does not.
+     */
+    public boolean clusterTotalEnergyCut(Cluster cluster) {
+    	return clusterTotalEnergyCut(getValueClusterTotalEnergy(cluster));
+    }
+    
+    /**
+     * Checks whether the argument cluster falls within the allowed
+     * cluster total energy range.
+     * @param cluster - The cluster to check.
+     * @return Returns <code>true</code> if the cluster passes the cut
+     * and <code>false</code> if the cluster does not.
+     */
+    public boolean clusterTotalEnergyCut(SSPCluster cluster) {
+    	return clusterTotalEnergyCut(getValueClusterTotalEnergy(cluster));
+    }
+    
+    /**
+     * Calculates the distance between the origin and a cluster.
+     * @param cluster - The cluster pair from which the value should
+     * be calculated.
+     * @return Returns displacement of the cluster.
+     */
+    public static double getClusterDistance(Cluster cluster) {
+    	// Get the variables from the cluster.
+    	double x = getClusterX(cluster);
+    	double y = getClusterY(cluster);
+    	
+    	// Perform the calculation.
+    	return getClusterDistance(x, y);
+    }
+    
+    /**
+     * Gets the value used for the cluster total energy cut.
+     * @param cluster - The cluster from which the value should be
+     * derived.
+     * @return Returns the energy of the entire cluster in GeV.
+     */
+    public static double getValueClusterTotalEnergy(Cluster cluster) {
+        return cluster.getEnergy();
+    }
+    
+    /**
+     * Gets the value used for the cluster total energy cut.
+     * @param cluster - The cluster from which the value should be
+     * derived.
+     * @return Returns the energy of the entire cluster in GeV.
+     */
+    public static double getValueClusterTotalEnergy(SSPCluster cluster) {
+        return cluster.getEnergy();
+    }
+    
+    /**
+     * Gets the value used for the cluster hit count cut.
+     * @param cluster - The cluster from which the value should be
+     * derived.
+     * @return Returns the number of hits in the cluster.
+     */
+    public static int getValueClusterHitCount(Cluster cluster) {
+        return cluster.getCalorimeterHits().size();
+    }
+    
+    /**
+     * Gets the value used for the cluster hit count cut.
+     * @param cluster - The cluster from which the value should be
+     * derived.
+     * @return Returns the number of hits in the cluster.
+     */
+    public static int getValueClusterHitCount(SSPCluster cluster) {
+        return cluster.getHitCount();
+    }
+    
+    /**
+     * Gets the value used for the seed hit energy cut.
+     * @param cluster - The cluster from which the value should be
+     * derived.
+     * @return Returns the cluster seed energy in GeV.
+     */
+    public static double getValueClusterSeedEnergy(Cluster cluster) {
+        return cluster.getCalorimeterHits().get(0).getCorrectedEnergy();
+    }
+    
+    /**
+     * Calculates the value used by the coplanarity cut.
+     * @param clusterPair - The cluster pair from which the value should
+     * be calculated.
+     * @return Returns the cut value.
+     */
+    public static double getValueCoplanarity(Cluster[] clusterPair) {
+    	// Get the variables used by the calculation.
+    	double x[] = { getClusterX(clusterPair[0]), getClusterX(clusterPair[1]) };
+    	double y[] = { getClusterY(clusterPair[0]), getClusterY(clusterPair[1]) };
+    	
+    	// Return the calculated value.
+    	return getValueCoplanarity(x, y);
+    }
+    
+    /**
+     * Calculates the value used by the energy difference cut.
+     * @param clusterPair - The cluster pair from which the value should
+     * be calculated.
+     * @return Returns the difference between the cluster energies.
+     */
+    public static double getValueEnergyDifference(Cluster[] clusterPair) {
+    	// Get the variables used by the calculation.
+    	double[] energy = { clusterPair[0].getEnergy(), clusterPair[1].getEnergy() };
+    	
+    	// Perform the calculation.
+        return getValueEnergyDifference(energy);
+    }
+    
+    /**
+     * Calculates the value used by the energy difference cut.
+     * @param clusterPair - The cluster pair from which the value should
+     * be calculated.
+     * @return Returns the difference between the cluster energies.
+     */
+    public static double getValueEnergyDifference(SSPCluster[] clusterPair) {
+    	// Get the variables used by the calculation.
+    	double[] energy = { clusterPair[0].getEnergy(), clusterPair[1].getEnergy() };
+    	
+    	// Perform the calculation.
+        return getValueEnergyDifference(energy);
+    }
+    
+    /**
+     * Calculates the value used by the energy slope cut.
+     * @param clusterPair - The cluster pair from which the value should
+     * be calculated.
+     * @param energySlopeParamF - The value of the variable F in the
+     * energy slope equation E_low + R_min * F.
+     * @return Returns the energy slope value.
+     */
+    public static double getValueEnergySlope(Cluster[] clusterPair, double energySlopeParamF) {
+    	// Get the variables used by the calculation.
+    	double[] energy = { clusterPair[0].getEnergy(), clusterPair[1].getEnergy() };
+    	double x[] = { getClusterX(clusterPair[0]), getClusterX(clusterPair[1]) };
+    	double y[] = { getClusterY(clusterPair[0]), getClusterY(clusterPair[1]) };
+    	
+    	// Perform the calculation.
+    	return getValueEnergySlope(energy, x, y, energySlopeParamF);
+    }
+    
+    /**
+     * Calculates the value used by the energy sum cut.
+     * @param clusterPair - The cluster pair from which the value should
+     * be calculated.
+     * @return Returns the sum of the cluster energies.
+     */
+    public static double getValueEnergySum(Cluster[] clusterPair) {
+    	// Get the variables used by the calculation.
+    	double[] energy = { clusterPair[0].getEnergy(), clusterPair[1].getEnergy() };
+    	
+    	// Perform the calculation.
+    	return getValueEnergySum(energy);
+    }
+    
+    /**
+     * Calculates the value used by the energy sum cut.
+     * @param clusterPair - The cluster pair from which the value should
+     * be calculated.
+     * @return Returns the sum of the cluster energies.
+     */
+    public static double getValueEnergySum(SSPCluster[] clusterPair) {
+    	// Get the variables used by the calculation.
+    	double[] energy = { clusterPair[0].getEnergy(), clusterPair[1].getEnergy() };
+    	
+    	// Perform the calculation.
+    	return getValueEnergySum(energy);
+    }
+    
+    /**
+     * Checks if a cluster pair is coplanar to the beam within a given
+     * angle.
+     * @param clusterPair - The cluster pair to check.
+     * @return Returns <code>true</code> if the cluster pair passes
+     * the cut and <code>false</code> if it does not.
+     */
+    public boolean pairCoplanarityCut(Cluster[] clusterPair) {
+        return pairCoplanarityCut(getValueCoplanarity(clusterPair));
+    }
+    
+    /**
+     * Checks if the energy difference between the clusters making up
+     * a cluster pair is below an energy difference threshold.
+     * @param clusterPair - The cluster pair to check.
+     * @return Returns <code>true</code> if the cluster pair passes
+     * the cut and <code>false</code> if it does not.
+     */
+    public boolean pairEnergyDifferenceCut(Cluster[] clusterPair) {
+        return pairEnergyDifferenceCut(getValueEnergyDifference(clusterPair));
+    }
+    
+    /**
+     * Checks if the energy difference between the clusters making up
+     * a cluster pair is below an energy difference threshold.
+     * @param clusterPair - The cluster pair to check.
+     * @return Returns <code>true</code> if the cluster pair passes
+     * the cut and <code>false</code> if it does not.
+     */
+    public boolean pairEnergyDifferenceCut(SSPCluster[] clusterPair) {
+        return pairEnergyDifferenceCut(getValueEnergyDifference(clusterPair));
+    }
+    
+    /**
+     * Requires that the distance from the beam of the lowest energy
+     * cluster in a cluster pair satisfies the following:<br/>
+     * <code>E_low + R_min * F < [ Threshold ]</code>
+     * @param clusterPair - The cluster pair to check.
+     * @return Returns <code>true</code> if the cluster pair passes
+     * the cut and <code>false</code> if it does not.
+     */
+    public boolean pairEnergySlopeCut(Cluster[] clusterPair) {
+        return pairEnergySlopeCut(getValueEnergySlope(clusterPair, cuts.get(PAIR_ENERGY_SLOPE_F)));
+    }
+    
+    /**
+     * Checks if the sum of the energies of clusters making up a cluster
+     * pair is below an energy sum threshold.
+     * @param clusterPair - The cluster pair to check.
+     * @return Returns <code>true</code> if the cluster pair passes
+     * the cut and <code>false</code> if it does not.
+     */
+    public boolean pairEnergySumCut(Cluster[] clusterPair) {
+    	return pairEnergySumCut(getValueEnergySum(clusterPair));
+    }
+    
+    /**
+     * Checks if the sum of the energies of clusters making up a cluster
+     * pair is below an energy sum threshold.
+     * @param clusterPair - The cluster pair to check.
+     * @return Returns <code>true</code> if the cluster pair passes
+     * the cut and <code>false</code> if it does not.
+     */
+    public boolean pairEnergySumCut(SSPCluster[] clusterPair) {
+    	return pairEnergySumCut(getValueEnergySum(clusterPair));
+    }
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+
+    
+    /**
+     * Checks whether the argument hit count meets the minimum required
+     * hit count.
+     * @param hitCount - The number of hits in the cluster.
+     * @return Returns <code>true</code> if the count passes the cut
+     * and <code>false</code> if the cluster does not.
+     */
+    private boolean clusterHitCountCut(int hitCount) {
+        return (hitCount >= cuts.get(CLUSTER_HIT_COUNT_LOW));
+    }
+    
+    /**
+     * Checks whether the argument energy seed hit falls within the
+     * allowed seed hit energy range.
+     * @param seedEnergy - The energy of the cluster seed.
+     * @return Returns <code>true</code> if the energy passes the cut
+     * and <code>false</code> if the cluster does not.
+     */
+    private boolean clusterSeedEnergyCut(double seedEnergy) {
+        return (seedEnergy < cuts.get(CLUSTER_SEED_ENERGY_HIGH)) && (seedEnergy > cuts.get(CLUSTER_SEED_ENERGY_LOW));
+    }
+    
+    /**
+     * Checks whether the argument energy falls within the allowed
+     * cluster total energy range.
+     * @param clusterEnergy - The energy of the entire cluster.
+     * @return Returns <code>true</code> if the energy passes the cut
+     * and <code>false</code> if the cluster does not.
+     */
+    private boolean clusterTotalEnergyCut(double clusterEnergy) {
+        return (clusterEnergy < cuts.get(CLUSTER_TOTAL_ENERGY_HIGH)) && (clusterEnergy > cuts.get(CLUSTER_TOTAL_ENERGY_LOW));
+    }
+    
+    /**
+     * Calculates the distance between the origin and a cluster.
+     * @param x - The cluster's x-position.
+     * @param y - The cluster's y-position.
+     * @return Returns displacement of the cluster.
+     */
+    private static double getClusterDistance(double x, double y) {
+        return Math.hypot(x - ORIGIN_X, y);
+    }
+    
+    /**
+     * Gets the x-position of a cluster.
+     * @param cluster - The cluster of which to get the x-position.
+     * @return Returns the cluster x-position.
+     */
+    private static double getClusterX(Cluster cluster) {
+    	return cluster.getCalorimeterHits().get(0).getPosition()[0];
+    }
+    
+    /**
+     * Gets the y-position of a cluster.
+     * @param cluster - The cluster of which to get the y-position.
+     * @return Returns the cluster y-position.
+     */
+    private static double getClusterY(Cluster cluster) {
+    	return cluster.getCalorimeterHits().get(0).getPosition()[1];
+    }
+    
+    /**
+     * Calculates the value used by the coplanarity cut.
+     * @param x - A two-dimensional array consisting of the first and
+     * second clusters' x-positions.
+     * @param y - A two-dimensional array consisting of the first and
+     * second clusters' y-positions.
+     * @return Returns the cluster pair's coplanarity.
+     */
+    private static double getValueCoplanarity(double[] x, double y[]) {
+        // Get the cluster angles.
+        double[] clusterAngle = new double[2];
+        for(int i = 0; i < 2; i++) {
+            clusterAngle[i] = (Math.toDegrees(Math.atan2(y[i], x[i] - ORIGIN_X)) + 180.0) % 180.0;
+        }
+        
+        // Calculate the coplanarity cut value.
+        return Math.abs(clusterAngle[1] - clusterAngle[0]);
+    }
+    
+    /**
+     * Calculates the value used by the energy difference cut.
+     * @param energy - A two-dimensional array consisting of the first
+     * and second clusters' energies.
+     * @return Returns the difference of the cluster energies.
+     */
+    private static double getValueEnergyDifference(double[] energy) {
+        return Math.abs(energy[0] - energy[1]);
+    }
+    
+    /**
+     * Calculates the value used by the energy slope cut.
+     * @param clusterPair - The cluster pair from which the value should
+     * be calculated.
+     * @param energySlopeParamF - The value of the variable F in the
+     * energy slope equation E_low + R_min * F.
+     * @return Returns the cut value.
+     */
+    private static double getValueEnergySlope(double energy[], double x[], double y[], double energySlopeParamF) {
+    	// Determine which cluster is the lower-energy cluster.
+    	int lei = energy[0] < energy[1] ? 0 : 1;
+    	
+        // E + R*F
+        // Get the low energy cluster energy.
+        double slopeParamE = energy[lei];
+        
+        // Get the low energy cluster radial distance.
+        double slopeParamR = getClusterDistance(x[lei], y[lei]);
+        
+        // Calculate the energy slope.
+        return slopeParamE + slopeParamR * energySlopeParamF;
+    }
+    
+    /**
+     * Calculates the value used by the energy sum cut.
+     * @param energy - A two-dimensional array consisting of the first
+     * and second clusters' energies.
+     * @return Returns the sum of the cluster energies.
+     */
+    private static double getValueEnergySum(double[] energy) {
+        return energy[0] + energy[1];
+    }
+    
+    /**
+     * Checks if a coplanarity angle is within threshold.
+     * @param coplanarityAngle - The cluster coplanarity angle.
+     * @return Returns <code>true</code> if the angle passes
+     * the cut and <code>false</code> if it does not.
+     */
+    private boolean pairCoplanarityCut(double coplanarityAngle) {
+        return (coplanarityAngle < cuts.get(PAIR_COPLANARITY_HIGH));
+    }
+    
+    /**
+     * Checks if the energy difference between the clusters making up
+     * a cluster pair is below an energy difference threshold.
+     * @param energyDifference - The absolute value of the difference
+     * of the energies of the cluster pair.
+     * @return Returns <code>true</code> if the energy difference passes
+     * the cut and <code>false</code> if it does not.
+     */
+    private boolean pairEnergyDifferenceCut(double energyDifference) {
+        return (energyDifference < cuts.get(PAIR_ENERGY_DIFFERENCE_HIGH));
+    }
+    
+    /**
+     * Checks that the energy slope value is above threshold.
+     * @param energySlope - The energy slope value.
+     * @return Returns <code>true</code> if the energy slope passes
+     * the cut and <code>false</code> if it does not.
+     */
+    private boolean pairEnergySlopeCut(double energySlope) {
+        return (energySlope > cuts.get(PAIR_ENERGY_SLOPE_LOW));
+    }
+    
+    /**
+     * Checks if the sum of the energies of clusters making up a cluster
+     * pair is within an energy sum threshold.
+     * @param energySum - The sum of the cluster energies.
+     * @return Returns <code>true</code> if the energy sum passes
+     * the cut and <code>false</code> if it does not.
+     */
+    private boolean pairEnergySumCut(double energySum) {
+        return (energySum < cuts.get(PAIR_ENERGY_SUM_HIGH)) && (energySum > cuts.get(PAIR_ENERGY_SUM_LOW));
+    }
+}

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2017
August 2017
July 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use