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  October 2016

HPS-SVN October 2016

Subject:

r4529 - in /java/trunk/users/src/main/java/org/hps/users/kmccarty: SimpleTriggerPlotsDriver.java TriggerProcessAnalysisDriver.java plots/AddPlots.java

From:

[log in to unmask]

Reply-To:

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

Date:

Wed, 26 Oct 2016 14:39:11 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (198 lines)

Author: [log in to unmask]
Date: Wed Oct 26 07:39:01 2016
New Revision: 4529

Log:
Removed old driver that relied on old trigger diagnostics.

Removed:
    java/trunk/users/src/main/java/org/hps/users/kmccarty/TriggerProcessAnalysisDriver.java
Modified:
    java/trunk/users/src/main/java/org/hps/users/kmccarty/SimpleTriggerPlotsDriver.java
    java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/AddPlots.java

Modified: java/trunk/users/src/main/java/org/hps/users/kmccarty/SimpleTriggerPlotsDriver.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/kmccarty/SimpleTriggerPlotsDriver.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/kmccarty/SimpleTriggerPlotsDriver.java	Wed Oct 26 07:39:01 2016
@@ -46,11 +46,14 @@
 public class SimpleTriggerPlotsDriver extends Driver {
 	private int nsa = Integer.MIN_VALUE;
 	private int nsb = Integer.MIN_VALUE;
-	private int events = 0;
+	private boolean useDAQConfig = false;
 	private int windowWidth = Integer.MIN_VALUE;
-	private boolean useDAQConfig = false;
+	private String clusterCollectionName = null;
+	private boolean requireLeftRightPair = false;
 	private double energySlopeParam = Double.NaN;
-	private String clusterCollectionName = null;
+	private double pairFEEThreshold = Double.NaN;
+	private double pairTimeThreshold = Double.NaN;
+	private boolean requireFiducialClusters = false;
 	
 	// Define cluster type and cut type reference variables.
 	private static final int CLUSTER_TOTAL_ENERGY  = 0;
@@ -93,25 +96,6 @@
 	// Define plotting objects.
 	private AIDA aida = AIDA.defaultInstance();
 	private static final String BASE_FOLDER_NAME = "Simple Trigger Cut Plots/";
-	
-	/**
-	 * Runs at the end of the run. Calculates the total event time
-	 * processed and scales all trigger cut plots by this value to
-	 * convert their y-axis scale to units of Hertz.
-	 */
-	@Override
-	public void endOfData() {
-		// Determine the total amount of time that was processed. This
-		// is calculated by multiplying the number of events by the size
-		// of the readout window that is not pulse-clipped.
-		double scalingFactor = 1.0 / (events * (windowWidth - nsa - nsb));
-		
-		// Scale each trigger plot by the amount of time it represents
-		// to convert the y-axis scale to units of Hertz.
-		for(int triggerCut = CLUSTER_TOTAL_ENERGY; triggerCut <= PAIR_TIME_COINCIDENCE; triggerCut++) {
-			aida.histogram1D(getTriggerPlotName(triggerCut)).scale(scalingFactor);
-		}
-	}
 	
 	/**
 	 * Runs at the beginning of the run. Instantiates all trigger cut
@@ -204,7 +188,17 @@
         // clipping region.
         List<Cluster> goodClusters = new ArrayList<Cluster>();
         for(Cluster cluster : clusters) {
-        	if(isVerifiable(cluster, nsa, nsb, windowWidth)) { goodClusters.add(cluster); }
+        	// First, check if the cluster is outside the pulse-clipping
+        	// region.
+        	if(isVerifiable(cluster, nsa, nsb, windowWidth)) {
+        		// Next, check that it is fiducial if the fiducial
+        		// requirement is active. If so, add the cluster to
+        		// the list of good clusters. Otherwise, just add the
+        		// the list immediately.
+        		if(!requireFiducialClusters || (requireFiducialClusters && TriggerModule.inFiducialRegion(cluster))) {
+        			goodClusters.add(cluster);
+        		}
+        	}
         }
         
         // Populate the cluster singles plots.
@@ -218,18 +212,47 @@
         List<Cluster[]> pairs = TriggerModule.getTopBottomPairs(clusters, Cluster.class);
         
         // Populate the cluster pair plots.
+        pairPlotsLoop:
         for(Cluster[] pair : pairs) {
+        	// If a left-right cluster pair is required, check that the
+        	// condition is met.
+        	if(requireLeftRightPair) {
+        		boolean hasLeft = (TriggerModule.getClusterXIndex(pair[0]) < 0|| TriggerModule.getClusterXIndex(pair[1]) < 0);
+        		boolean hasRight = (TriggerModule.getClusterXIndex(pair[0]) > 0|| TriggerModule.getClusterXIndex(pair[1]) > 0);
+        		if(!hasLeft || !hasRight) { continue pairPlotsLoop; }
+        	}
+        	
+        	// If FEE clusters are to be excluded, check if any are present.
+        	if(!Double.isNaN(pairFEEThreshold)) {
+        		for(Cluster cluster : pair) {
+        			// The FEE cut only applies to left clusters.
+        			if(TriggerModule.getClusterXIndex(cluster) < 0) {
+        				// The pair is invalid if the cluster has more
+        				// energy than the threshold.
+        				if(TriggerModule.getValueClusterTotalEnergy(cluster) > pairFEEThreshold) {
+        					continue pairPlotsLoop;
+        				}
+        			}
+        		}
+        	}
+        	
+        	// If the time coincidence threshold is active, check that
+        	// the pair meets the requirement.
+        	if(!Double.isNaN(pairTimeThreshold)) {
+        		if(TriggerModule.getValueTimeCoincidence(pair) > pairTimeThreshold) {
+        			continue pairPlotsLoop;
+        		}
+        	}
+        	
+        	// Populate the plots.
         	aida.histogram1D(getTriggerPlotName(PAIR_ENERGY_SUM)).fill(TriggerModule.getValueEnergySum(pair));
         	aida.histogram1D(getTriggerPlotName(PAIR_ENERGY_DIFF)).fill(TriggerModule.getValueEnergyDifference(pair));
         	aida.histogram1D(getTriggerPlotName(PAIR_ENERGY_SLOPE)).fill(TriggerModule.getValueEnergySlope(pair, energySlopeParam));
         	aida.histogram1D(getTriggerPlotName(PAIR_COPLANARITY)).fill(TriggerModule.getValueCoplanarity(pair));
         	aida.histogram1D(getTriggerPlotName(PAIR_TIME_COINCIDENCE)).fill(TriggerModule.getValueTimeCoincidence(pair));
         }
-        
-        // Increment the number of processed events.
-        events++;
 	}
-    
+	
     /**
      * Checks whether all of the hits in a cluster are within the safe
      * region of the FADC output window.
@@ -331,6 +354,44 @@
     	energySlopeParam = value;
     }
     
+    public void setRequireFiducialClusters(boolean state) {
+    	requireFiducialClusters = state;
+    }
+    
+    /**
+     * Sets whether plotted pairs should carry the additional requirement
+     * of having one cluster on the left side of the calorimeter and
+     * one cluster on the right. This is disabled by default.
+     * @param state - <code>true</code> requires one cluster on each
+     * and <code>false</code> does not.
+     */
+    public void setRequireLeftRightPair(boolean state) {
+    	requireLeftRightPair = state;
+    }
+    
+    /**
+     * Defines a threshold for FEE electrons for plotted pair values.
+     * Pairs with a left-side cluster exceeding this value will not be
+     * included in the plots. This can be disabled by setting the value
+     * to <code>Double.NaN</code>. This is the default behavior.
+     * @param value - The threshold above which left-side clusters are
+     * excluded.
+     */
+    public void setPairFEEThreshold(double value) {
+    	pairFEEThreshold = value;
+    }
+    
+    /**
+     * Defines a time-coincidence threshold in which cluster pairs must
+     * fall in order to be plotted. This can be disabled by setting the
+     * value to <code>Double.NaN</code>. This is the default behavior.
+     * @param value - The absolute difference in time clusters must fall
+     * within in order to be plotted in pair plots.
+     */
+    public void setPairTimeThreshold(double value) {
+    	pairTimeThreshold = value;
+    }
+    
     public void setClusterSeedEnergyXMax(double value)   { xMax[CLUSTER_SEED_ENERGY]   = value; }
     public void setClusterTotalEnergyXMax(double value)  { xMax[CLUSTER_TOTAL_ENERGY]  = value; }
     public void setClusterHitCountXMax(double value)     { xMax[CLUSTER_HIT_COUNT]     = value; }

Modified: java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/AddPlots.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/AddPlots.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/AddPlots.java	Wed Oct 26 07:39:01 2016
@@ -182,7 +182,13 @@
             // and add each bin entry to the compiled plot.
             for(int i = 0; i < histogramNames1D.size(); i++) {
                 // Get the histogram object.
-                IHistogram1D histogram = (IHistogram1D) fileTree.find(histogramNames1D.get(i));
+            	IHistogram1D histogram = null;
+                try { histogram = (IHistogram1D) fileTree.find(histogramNames1D.get(i)); }
+                catch(Exception e) {
+                	e.printStackTrace();
+                	System.err.println("Could not find required plot in file " + file.getName());
+                	System.exit(1);
+                }
                 
                 // Iterate over the bins.
                 for(int x = 0; x < xBins1D.get(i); x++) {

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