Print

Print


Author: mccaky
Date: Sat Dec 13 15:47:14 2014
New Revision: 1719

Log:
Updated primary trigger driver to include seed energy plots for channels around the beam hole.

Modified:
    java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/FADCPrimaryTriggerDriver.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 Dec 13 15:47:14 2014
@@ -3,9 +3,12 @@
 import hep.aida.IHistogram1D;
 import hep.aida.IHistogram2D;
 
+import java.awt.Point;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
 import java.util.Queue;
 
 import org.hps.recon.ecal.ECalUtils;
@@ -96,6 +99,9 @@
     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 Map<Point, IHistogram1D> singleChannelSeedEnergyMap = new HashMap<Point, IHistogram1D>();
+    private Point channel = new Point(0, 0);
+    
     // ==================================================================
     // ==== Hardware Diagnostic Variables ===============================
     // ==================================================================
@@ -176,6 +182,8 @@
                 double clusterEnergy = cluster.getEnergy();
                 int ix = cluster.getSeedHit().getIdentifierFieldValue("ix");
                 int iy = cluster.getSeedHit().getIdentifierFieldValue("iy");
+                channel.x = ix;
+                channel.y = iy;
                 
                 // VERBOSE :: Note that a cluster is being processed.
                 if(verbose) {
@@ -205,6 +213,12 @@
                 diagTotalEnergy[plotIndex].fill(clusterEnergy, 1);
                 diagHitCount[plotIndex].fill(hitCount < 8 ? hitCount : 7, 1);
                 
+                // Populate the single channel plot if it exists.
+                IHistogram1D singleChannelPlot = singleChannelSeedEnergyMap.get(channel);
+                if(singleChannelPlot != null) {
+                	singleChannelPlot.fill(seedEnergy, 1);
+                }
+                
                 // ==== Seed Hit Energy Cut ====================================
                 // =============================================================
                 // VERBOSE :: Print the seed energy comparison check.
@@ -427,6 +441,21 @@
         
         // If a background level has been set, pick the correct cuts.
         if(backgroundLevel != -1) { setBackgroundCuts(backgroundLevel); }
+        
+        // Create some single channel seed energy plots.
+        Point[] channels = {
+        		new Point(-11, 2), new Point(-10, 2), new Point(-9, 2), new Point(-8, 2), new Point(-7, 2),
+        		new Point(-6, 2), new Point(-5, 2), new Point(-4, 2), new Point(-3, 2), new Point(-2, 2),
+        		new Point(-1, 2), new Point(-11, 1), new Point(-1, 1),
+        		new Point(-11, -2), new Point(-10, -2), new Point(-9, -2), new Point(-8, -2), new Point(-7, -2),
+        		new Point(-6, -2), new Point(-5, -2), new Point(-4, -2), new Point(-3, -2), new Point(-2, -2),
+        		new Point(-1, -2), new Point(-11, -1), new Point(-1, -1),
+        };
+        for(Point channel : channels) {
+        	String name = String.format("Channel Plots :: Cluster Seed Energy Distribution (%d, %d)", channel.x, channel.y);
+            IHistogram1D channelSeedPlot = aida.histogram1D(name, 176, 0.0, 2.2);
+            singleChannelSeedEnergyMap.put(channel, channelSeedPlot);
+        }
         
         // Run the superclass method.
         super.startOfData();