Print

Print


Author: [log in to unmask]
Date: Fri Mar 27 19:26:18 2015
New Revision: 2612

Log:
add singlesTrigger option to trigger driver, and use it; put trigger drivers in tightest-first order

Modified:
    java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/FADCPrimaryTriggerDriver.java
    java/trunk/steering-files/src/main/resources/org/hps/steering/readout/EngineeringRun2014PrescaledTriggers.lcsim

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	Fri Mar 27 19:26:18 2015
@@ -51,6 +51,8 @@
     private int pairEnergySlopeCount = 0;                          // Track the pairs which pass the energy slope cut.
     private int pairCoplanarityCount = 0;                          // Track the pairs which pass the coplanarity cut.
     private boolean verbose = false;                               // Stores whether debug text should be output.
+    private boolean singlesTrigger = false;                        // If true, ignore all pair cuts and trigger on single clusters.
+    private List<Cluster> goodClusterList;                         // Store the clusters from the current event that passed single-cluster cuts.
     
     // ==================================================================
     // ==== Trigger Distribution Plots ==================================
@@ -109,15 +111,17 @@
         System.out.printf("\t\tPassed Hit Count Cut         :: %d%n", clusterHitCountCount);
         System.out.printf("\t\tPassed Total Energy Cut      :: %d%n", clusterTotalEnergyCount);
         System.out.printf("%n");
-        System.out.printf("\tCluster Pair Cuts%n");
-        System.out.printf("\t\tTotal Pairs Processed        :: %d%n", allPairs);
-        System.out.printf("\t\tPassed Energy Sum Cut        :: %d%n", pairEnergySumCount);
-        System.out.printf("\t\tPassed Energy Difference Cut :: %d%n", pairEnergyDifferenceCount);
-        System.out.printf("\t\tPassed Energy Slope Cut      :: %d%n", pairEnergySlopeCount);
-        System.out.printf("\t\tPassed Coplanarity Cut       :: %d%n", pairCoplanarityCount);
+        if (!singlesTrigger) {
+            System.out.printf("\tCluster Pair Cuts%n");
+            System.out.printf("\t\tTotal Pairs Processed        :: %d%n", allPairs);
+            System.out.printf("\t\tPassed Energy Sum Cut        :: %d%n", pairEnergySumCount);
+            System.out.printf("\t\tPassed Energy Difference Cut :: %d%n", pairEnergyDifferenceCount);
+            System.out.printf("\t\tPassed Energy Slope Cut      :: %d%n", pairEnergySlopeCount);
+            System.out.printf("\t\tPassed Coplanarity Cut       :: %d%n", pairCoplanarityCount);
+        }
         System.out.printf("%n");
         System.out.printf("\tTrigger Count :: %d%n", numTriggers);
-        
+
         // Print the trigger cuts.
         System.out.printf("%nTrigger Module Cut Values:%n");
         System.out.printf("\tSeed Energy Low        :: %.3f%n", triggerModule.getCutValue(TriggerModule.CLUSTER_SEED_ENERGY_LOW));
@@ -125,11 +129,16 @@
         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));
+        
+        if (singlesTrigger) {
+            System.out.println("\tSingles trigger (no pairs required)");
+        } else {
+            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();
@@ -148,7 +157,7 @@
             
             // Create a list to hold clusters which pass the single
             // cluster cuts.
-            List<Cluster> goodClusterList = new ArrayList<Cluster>(clusterList.size());
+            goodClusterList = new ArrayList<Cluster>(clusterList.size());
             
             // Sort through the cluster list and add clusters that pass
             // the single cluster cuts to the good list.
@@ -279,6 +288,17 @@
      */
     public void setClusterCollectionName(String clusterCollectionName) {
         this.clusterCollectionName = clusterCollectionName;
+    }
+
+    /**
+     * Run as a singles trigger. No requirement for a coincidence between a pair
+     * of clusters. The trigger fires if any clusters pass the single-cluster
+     * cuts.
+     *
+     * @param singlesTrigger False by default.
+     */
+    public void setSinglesTrigger(boolean singlesTrigger) {
+        this.singlesTrigger = singlesTrigger;
     }
     
     /**
@@ -581,6 +601,12 @@
      * passes all of the cluster cuts and <code>false</code> otherwise.
      */
     private boolean testTrigger() {
+
+        // If running a singles trigger, trigger if a cluster passed the single-cluster cuts.
+        if (singlesTrigger) {
+            return !goodClusterList.isEmpty();
+        } // The rest of this method (pair trigger cuts) is not run.
+        
         // Get the list of cluster pairs.
         List<Cluster[]> clusterPairs = getClusterPairsTopBot();
         

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/readout/EngineeringRun2014PrescaledTriggers.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/readout/EngineeringRun2014PrescaledTriggers.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/readout/EngineeringRun2014PrescaledTriggers.lcsim	Fri Mar 27 19:26:18 2015
@@ -14,10 +14,10 @@
         <driver name="EcalConverter"/>
         <driver name="EcalClustererGTP"/>
         <driver name="EcalClusterer"/>
+        <driver name="PairTrigger1"/>
         <driver name="PairTrigger0"/>
-        <driver name="PairTrigger1"/>
+        <driver name="SinglesTrigger1"/>
         <driver name="SinglesTrigger0"/>
-        <driver name="SinglesTrigger1"/>
         <driver name="TestRunReconToLcio"/>
         <driver name="AidaSaveDriver"/>
         <driver name="ClockDriver"/>        
@@ -75,6 +75,7 @@
         </driver>
         <driver name="SinglesTrigger0" type="org.hps.readout.ecal.FADCPrimaryTriggerDriver">
             <clusterCollectionName>EcalClusters</clusterCollectionName>
+            <singlesTrigger>true</singlesTrigger>        
             <deadTime>32</deadTime>
             <minHitCount>4</minHitCount>
             <seedEnergyLow>0.1</seedEnergyLow>
@@ -82,11 +83,12 @@
             <clusterEnergyHigh>2.5</clusterEnergyHigh>
             <prescale>256</prescale>
             <outputFileName>${outputFile}.triggers.singles0</outputFileName>
-            <lcioFile>${outputFile}.singles0.slcio</lcioFile>            
+            <lcioFile>${outputFile}.singles0.slcio</lcioFile>    
             <!--<verbose>true</verbose>-->
         </driver>	      
         <driver name="SinglesTrigger1" type="org.hps.readout.ecal.FADCPrimaryTriggerDriver">
             <clusterCollectionName>EcalClusters</clusterCollectionName>
+            <singlesTrigger>true</singlesTrigger>        
             <deadTime>32</deadTime>
             <minHitCount>4</minHitCount>
             <seedEnergyLow>0.1</seedEnergyLow>