Print

Print


Author: [log in to unmask]
Date: Thu Apr  9 09:12:30 2015
New Revision: 2666

Log:
Update some diagnostic plots for the trigger diagnostics.

Modified:
    java/trunk/analysis/src/main/java/org/hps/analysis/trigger/TriggerDiagnosticDriver.java
    java/trunk/analysis/src/main/java/org/hps/analysis/trigger/event/TriggerPlotsModule.java

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/trigger/TriggerDiagnosticDriver.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/trigger/TriggerDiagnosticDriver.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/trigger/TriggerDiagnosticDriver.java	Thu Apr  9 09:12:30 2015
@@ -105,7 +105,7 @@
     private boolean printSinglesTriggerInternalFail = true;
     private boolean printPairTriggerEfficiencyFail = true;
     private boolean printPairTriggerInternalFail = true;
-    private int     statPrintInterval = 100000;
+    private int     statPrintInterval = Integer.MAX_VALUE;
 
     // Cut index arrays for trigger verification.
 	private static final int ENERGY_MIN   = TriggerDiagnosticUtil.SINGLES_ENERGY_MIN;
@@ -260,6 +260,10 @@
 						pairCutsEnabled[i][3 + COPLANARITY] = pairs[i].getCoplanarityCutConfig().isEnabled();
 					}
 					
+					// Update the trigger plots values.
+					globalTriggerPlots.setEnergySlopeParamF(0, daq.getSSPConfig().getPair1Config().getEnergySlopeCutConfig().getParameterF());
+					globalTriggerPlots.setEnergySlopeParamF(1, daq.getSSPConfig().getPair2Config().getEnergySlopeCutConfig().getParameterF());
+					
 					// Print a DAQ configuration settings header.
 					System.out.println();
 					System.out.println();
@@ -418,9 +422,6 @@
 		// ==========================================================
 		// ==== Obtain SSP and TI Banks =============================
 		// ==========================================================
-		
-		// Output the event number and information.
-		OutputLogger.printf("Event Number %d (%d)%n", globalStats.getEventCount(), event.getEventNumber());
 		
 		// Get the SSP clusters.
 		if(event.hasCollection(GenericObject.class, bankCollectionName)) {
@@ -485,6 +486,9 @@
 			System.err.println("TriggerDiagnosticDriver :: SEVERE WARNING :: TI bank or SSP bank missing from event!");
 			return;
 		}
+		
+		// Output the event number and information.
+		OutputLogger.printf("Event Number %d (%d)%n", sspBank.getEventNumber(), event.getEventNumber());
 		
 		
 		
@@ -1622,11 +1626,17 @@
 		// Run the SSP clusters through the singles trigger to determine
 		// whether they pass it or not.
 		for(SSPCluster cluster : sspClusters) {
+			// Add the cluster to the "NO_CUTS" plots for each singles
+			// TI bit that is active.
+			if(tiBank.isSingle0Trigger()) { globalTriggerPlots.sawCluster(0, cluster); }
+			if(tiBank.isSingle1Trigger()) { globalTriggerPlots.sawCluster(1, cluster); }
+			
 			triggerLoop:
 			for(int triggerNum = 0; triggerNum < 2; triggerNum++) {
-				// For a cluster to have formed it is assumed to have passed
-				// the cluster seed energy cuts. This can not be verified
-				// since the SSP bank does not report individual hit. 
+				// For a cluster to have formed it is assumed to have
+				// passed the cluster seed energy cuts. This can not
+				// be verified since the SSP bank does not report
+				// individual hit. 
 				boolean passSeedLow = true;
 				boolean passSeedHigh = true;
 				
@@ -1654,6 +1664,12 @@
 					continue triggerLoop;
 				}
 				
+				// If all the trigger cuts passed, plot this trigger
+				// in the "triggered" plots.
+				if(trigger.getTriggerState()) {
+					globalTriggerPlots.passedTrigger(trigger);
+				}
+				
 				// If all the necessary checks passed, store the new
 				// trigger for verification.
 				sspSinglesTriggers.get(triggerNum).add(trigger);
@@ -1663,6 +1679,11 @@
 		// Run the reconstructed clusters through the singles trigger
 		// to determine whether they pass it or not.
 		for(Cluster cluster : reconClusters) {
+			// Add the cluster to the "NO_CUTS" plots for each singles
+			// TI bit that is active.
+			if(tiBank.isSingle0Trigger()) { globalTriggerPlots.sawCluster(0, cluster); }
+			if(tiBank.isSingle1Trigger()) { globalTriggerPlots.sawCluster(1, cluster); }
+			
 			// Simulate each of the cluster singles triggers.
 			triggerLoop:
 			for(int triggerNum = 0; triggerNum < 2; triggerNum++) {
@@ -1694,6 +1715,12 @@
 					continue triggerLoop;
 				} if(singlesCutsEnabled[triggerNum][HIT_COUNT] && !trigger.getStateHitCount()) {
 					continue triggerLoop;
+				}
+				
+				// If all the trigger cuts passed, plot this trigger
+				// in the "triggered" plots.
+				if(trigger.getTriggerState()) {
+					globalTriggerPlots.passedTrigger(trigger);
 				}
 				
 				// Store the trigger.
@@ -1759,6 +1786,12 @@
 				// destroyed.
 				if(!pairsTrigger[triggerIndex].pairTimeCoincidenceCut(reconPair)) {
 					continue pairTriggerLoop;
+				}
+				
+				// Add the cluster to the "NO_CUTS" plots for each
+				// singles TI bit that is active.
+				if((triggerIndex == 0 && tiBank.isPair0Trigger()) || (triggerIndex == 1 && tiBank.isPair1Trigger())) {
+					globalTriggerPlots.sawPair(triggerIndex, reconPair);
 				}
 				
 				// For a cluster to have formed it is assumed to have passed
@@ -1814,6 +1847,12 @@
 					continue pairTriggerLoop;
 				}
 				
+				// If all the trigger cuts passed, plot this trigger
+				// in the "triggered" plots.
+				if(trigger.getTriggerState()) {
+					globalTriggerPlots.passedTrigger(trigger);
+				}
+				
 				// Add the trigger to the list.
 				reconPairsTriggers.get(triggerIndex).add(trigger);
 			}
@@ -1827,6 +1866,12 @@
 				// destroyed.
 				if(!pairsTrigger[triggerIndex].pairTimeCoincidenceCut(sspPair)) {
 					continue pairTriggerLoop;
+				}
+				
+				// Add the cluster to the "NO_CUTS" plots for each
+				// singles TI bit that is active.
+				if((triggerIndex == 0 && tiBank.isPair0Trigger()) || (triggerIndex == 1 && tiBank.isPair1Trigger())) {
+					globalTriggerPlots.sawPair(triggerIndex, sspPair);
 				}
 				
 				// For a cluster to have formed it is assumed to have passed
@@ -1880,6 +1925,12 @@
 					continue pairTriggerLoop;
 				} if(pairCutsEnabled[triggerIndex][3 + COPLANARITY] && !trigger.getStateCoplanarity()) {
 					continue pairTriggerLoop;
+				}
+				
+				// If all the trigger cuts passed, plot this trigger
+				// in the "triggered" plots.
+				if(trigger.getTriggerState()) {
+					globalTriggerPlots.passedTrigger(trigger);
 				}
 				
 				// Add the trigger to the list.

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/trigger/event/TriggerPlotsModule.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/trigger/event/TriggerPlotsModule.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/trigger/event/TriggerPlotsModule.java	Thu Apr  9 09:12:30 2015
@@ -16,27 +16,31 @@
  */
 public class TriggerPlotsModule {
 	// Reference variables.
-	private static final int RECON   = 0;
-	private static final int SSP     = 1;
-	private static final int ALL     = 0;
-	private static final int MATCHED = 1;
-	private static final int FAILED  = 2;
+	private static final int RECON     = 0;
+	private static final int SSP       = 1;
+	private static final int ALL       = 0;
+	private static final int MATCHED   = 1;
+	private static final int FAILED    = 2;
+	private static final int TRIGGERED = 3;
+	private static final int NO_CUTS   = 4;
 	
 	// Class variables.
 	private final double[] energySlopeParamF;
 	
 	// Plots.
 	private AIDA aida = AIDA.defaultInstance();
-	private IHistogram1D[][][] singlesClusterEnergyPlot = new IHistogram1D[2][2][3];
-	private IHistogram1D[][][] singlesHitCountPlot = new IHistogram1D[2][2][3];
-	
-	private IHistogram1D[][][] pairClusterEnergyPlot = new IHistogram1D[2][2][3];
-	private IHistogram1D[][][] pairHitCountPlot = new IHistogram1D[2][2][3];
-	private IHistogram1D[][][] pairTimePlot = new IHistogram1D[2][2][3];
-	private IHistogram1D[][][] pairSumPlot = new IHistogram1D[2][2][3];
-	private IHistogram1D[][][] pairDiffPlot = new IHistogram1D[2][2][3];
-	private IHistogram1D[][][] pairSlopePlot = new IHistogram1D[2][2][3];
-	private IHistogram1D[][][] pairCoplanarityPlot = new IHistogram1D[2][2][3];
+	private IHistogram1D[][][] singlesClusterEnergyPlot = new IHistogram1D[2][2][5];
+	private IHistogram1D[][][] singlesHitCountPlot = new IHistogram1D[2][2][5];
+	private IHistogram1D[][][] singlesTriggerTimePlot = new IHistogram1D[2][2][5];
+	
+	private IHistogram1D[][][] pairClusterEnergyPlot = new IHistogram1D[2][2][5];
+	private IHistogram1D[][][] pairHitCountPlot = new IHistogram1D[2][2][5];
+	private IHistogram1D[][][] pairTimePlot = new IHistogram1D[2][2][5];
+	private IHistogram1D[][][] pairSumPlot = new IHistogram1D[2][2][5];
+	private IHistogram1D[][][] pairDiffPlot = new IHistogram1D[2][2][5];
+	private IHistogram1D[][][] pairSlopePlot = new IHistogram1D[2][2][5];
+	private IHistogram1D[][][] pairCoplanarityPlot = new IHistogram1D[2][2][5];
+	private IHistogram1D[][][] pairTriggerTimePlot = new IHistogram1D[2][2][5];
 	
 	/**
 	 * Instantiates a new <code>TriggerPlotsModule</code> that will use
@@ -56,7 +60,7 @@
 		
 		// Define type string values.
 		String[] sourceType = { "Recon", "SSP" };
-		String[] resultType = { "All", "Matched", "Failed" };
+		String[] resultType = { "All", "Matched", "Failed", "Triggered", "No Cuts" };
 		
 		// Instantiate the trigger result plots for each trigger.
 		for(int triggerNum = 0; triggerNum < 2; triggerNum++) {
@@ -69,12 +73,14 @@
 			for(int source = 0; source < 2; source++) {
 				// Instantiate the trigger result plots for each type
 				// of trigger match result.
-				for(int result = 0; result < 3; result++) {
+				for(int result = 0; result < 5; result++) {
 					// Instantiate the singles trigger plots.
-					singlesClusterEnergyPlot[triggerNum][source][result] = aida.histogram1D(String.format("%s/%s Singles Hit Count (%s)",
+					singlesClusterEnergyPlot[triggerNum][source][result] = aida.histogram1D(String.format("%s/%s Singles Cluster Energy (%s)",
+							singlesDir, sourceType[source], resultType[result]), 300, 0.0, 3.0);
+					singlesHitCountPlot[triggerNum][source][result] = aida.histogram1D(String.format("%s/%s Singles Hit Count (%s)",
 							singlesDir, sourceType[source], resultType[result]), 9, 0.5, 9.5);
-					singlesHitCountPlot[triggerNum][source][result] = aida.histogram1D(String.format("%s/%s Singles Cluster Energy (%s)",
-							singlesDir, sourceType[source], resultType[result]), 300, 0.0, 3.0);
+					singlesTriggerTimePlot[triggerNum][source][result] = aida.histogram1D(String.format("%s/%s Singles Trigger Time (%s)",
+							singlesDir, sourceType[source], resultType[result]), 100, 0, 400);
 					
 					// Instantiate the pair trigger plots.
 					pairHitCountPlot[triggerNum][source][result] = aida.histogram1D(String.format("%s/%s Pair Hit Count (%s)",
@@ -91,12 +97,57 @@
 							pairDir, sourceType[source], resultType[result]), 300, 0.0, 3.0);
 					pairCoplanarityPlot[triggerNum][source][result] = aida.histogram1D(String.format("%s/%s Pair Coplanarity (%s)",
 							pairDir, sourceType[source], resultType[result]), 180, 0, 180);
+					pairTriggerTimePlot[triggerNum][source][result] = aida.histogram1D(String.format("%s/%s Pair Trigger Time (%s)",
+							pairDir, sourceType[source], resultType[result]), 100, 0, 400);
 				}
 			}
 		}
 	}
 	
 	/**
+	 * Populates the "failed" plots of the appropriate type with the
+	 * cut results from the argument trigger.
+	 * @param trigger - The trigger from which to populate the plots.
+	 */
+	public void failedTrigger(Trigger<?> trigger) {
+		processTrigger(trigger, FAILED);
+	}
+	
+	/**
+	 * Populates the "matched" plots of the appropriate type with the
+	 * cut results from the argument trigger.
+	 * @param trigger - The trigger from which to populate the plots.
+	 */
+	public void matchedTrigger(Trigger<?> trigger) {
+		processTrigger(trigger, MATCHED);
+	}
+	
+	/**
+	 * Populates the "triggered" plots of the appropriate type with the
+	 * cut results from the argument trigger.
+	 * @param trigger - The trigger from which to populate the plots.
+	 */
+	public void passedTrigger(Trigger<?> trigger) {
+		processTrigger(trigger, TRIGGERED);
+	}
+	
+	public void sawCluster(int triggerNum, Cluster cluster) {
+		processSingles(triggerNum, NO_CUTS, cluster);
+	}
+	
+	public void sawCluster(int triggerNum, SSPCluster cluster) {
+		processSingles(triggerNum, NO_CUTS, cluster);
+	}
+	
+	public void sawPair(int triggerNum, Cluster[] pair) {
+		processPair(triggerNum, NO_CUTS, pair);
+	}
+	
+	public void sawPair(int triggerNum, SSPCluster[] pair) {
+		processPair(triggerNum, NO_CUTS, pair);
+	}
+	
+	/**
 	 * Populates the "all" plots of the appropriate type with the cut
 	 * results from the argument trigger.
 	 * @param trigger - The trigger from which to populate the plots.
@@ -106,23 +157,12 @@
 	}
 	
 	/**
-	 * Populates the "matched" plots of the appropriate type with the
-	 * cut results from the argument trigger.
-	 * @param trigger - The trigger from which to populate the plots.
-	 */
-	public void matchedTrigger(Trigger<?> trigger) {
-		processTrigger(trigger, MATCHED);
-	}
-	
-	/**
-	 * Populates the "failed" plots of the appropriate type with the
-	 * cut results from the argument trigger.
-	 * @param trigger - The trigger from which to populate the plots.
-	 */
-	public void failedTrigger(Trigger<?> trigger) {
-		processTrigger(trigger, FAILED);
-	}
-	
+	 * Sets the energy slope conversion factor to be used to calculate
+	 * the energy slope value for plots.
+	 * @param triggerNum - The trigger for which the conversion factor
+	 * should be used.
+	 * @param value - The conversion factor in units of GeV/mm.
+	 */
 	public void setEnergySlopeParamF(int triggerNum, double value) {
 		// Make sure that the trigger number is valid.
 		if(triggerNum < 0 || triggerNum > 1) {
@@ -177,6 +217,7 @@
 		// Fill the cluster singles plots.
 		singlesHitCountPlot[triggerNum][RECON][plotType].fill(TriggerModule.getValueClusterHitCount(cluster));
 		singlesClusterEnergyPlot[triggerNum][RECON][plotType].fill(TriggerModule.getValueClusterTotalEnergy(cluster));
+		singlesTriggerTimePlot[triggerNum][RECON][plotType].fill(cluster.getCalorimeterHits().get(0).getTime());
 	}
 	
 	/**
@@ -191,6 +232,7 @@
 		// Fill the cluster singles plots.
 		singlesHitCountPlot[triggerNum][SSP][plotType].fill(TriggerModule.getValueClusterHitCount(cluster));
 		singlesClusterEnergyPlot[triggerNum][SSP][plotType].fill(TriggerModule.getValueClusterTotalEnergy(cluster));
+		singlesTriggerTimePlot[triggerNum][SSP][plotType].fill(cluster.getTime());
 	}
 	
 	/**
@@ -207,6 +249,8 @@
 		pairHitCountPlot[triggerNum][RECON][plotType].fill(TriggerModule.getValueClusterHitCount(pair[1]));
 		pairClusterEnergyPlot[triggerNum][RECON][plotType].fill(TriggerModule.getValueClusterTotalEnergy(pair[0]));
 		pairClusterEnergyPlot[triggerNum][RECON][plotType].fill(TriggerModule.getValueClusterTotalEnergy(pair[1]));
+		pairTriggerTimePlot[triggerNum][RECON][plotType].fill(pair[0].getCalorimeterHits().get(0).getTime());
+		pairTriggerTimePlot[triggerNum][RECON][plotType].fill(pair[1].getCalorimeterHits().get(0).getTime());
 		
 		// Fill the cluster pair plots.
 		pairTimePlot[triggerNum][RECON][plotType].fill(TriggerModule.getValueTimeCoincidence(pair));
@@ -230,6 +274,8 @@
 		pairHitCountPlot[triggerNum][SSP][plotType].fill(TriggerModule.getValueClusterHitCount(pair[1]));
 		pairClusterEnergyPlot[triggerNum][SSP][plotType].fill(TriggerModule.getValueClusterTotalEnergy(pair[0]));
 		pairClusterEnergyPlot[triggerNum][SSP][plotType].fill(TriggerModule.getValueClusterTotalEnergy(pair[1]));
+		pairTriggerTimePlot[triggerNum][SSP][plotType].fill(pair[0].getTime());
+		pairTriggerTimePlot[triggerNum][SSP][plotType].fill(pair[1].getTime());
 		
 		// Fill the cluster pair plots.
 		pairTimePlot[triggerNum][SSP][plotType].fill(TriggerModule.getValueTimeCoincidence(pair));