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  March 2015

HPS-SVN March 2015

Subject:

r2501 - in /java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal: daqconfig/DAQConfig.java triggerbank/TriggerModule.java

From:

[log in to unmask]

Reply-To:

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

Date:

Mon, 23 Mar 2015 15:56:10 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (105 lines)

Author: [log in to unmask]
Date: Mon Mar 23 08:56:04 2015
New Revision: 2501

Log:
Updated DAQ configuration to print clustering settings correctly and added the ability to parse trigger cuts from a string to the TriggerModule.

Modified:
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/daqconfig/DAQConfig.java
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/triggerbank/TriggerModule.java

Modified: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/daqconfig/DAQConfig.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/daqconfig/DAQConfig.java	(original)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/daqconfig/DAQConfig.java	Mon Mar 23 08:56:04 2015
@@ -51,6 +51,8 @@
         // Print the system-specific objects.
         fadcConfig.printConfig();
         System.out.println();
+        gtpConfig.printConfig();
+        System.out.println();
         sspConfig.printConfig();
     }
     

Modified: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/triggerbank/TriggerModule.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/triggerbank/TriggerModule.java	(original)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/triggerbank/TriggerModule.java	Mon Mar 23 08:56:04 2015
@@ -2,6 +2,7 @@
 
 import java.util.HashMap;
 import java.util.Map;
+import java.util.StringTokenizer;
 
 import org.hps.recon.ecal.daqconfig.PairTriggerConfig;
 import org.hps.recon.ecal.daqconfig.SinglesTriggerConfig;
@@ -220,6 +221,66 @@
     	// Otherwise, throw an exception.
     	else { throw new IllegalArgumentException(String.format("Cut \"%s\" does not exist.", cut)); }
     }
+    
+	/**
+	 * Sets the cluster singles cuts to the values parsed from an
+	 * argument string.
+	 * @param isSingles - Indicates whether the parser should expect
+	 * 10 cut values (for pairs) or 3 (for singles).
+	 * @param cutValues - A string representing the cuts values. This
+	 * must be formatted in the style of "Emin Emax Nmin ...".
+	 */
+	public void setCutValues(boolean isSingles, String cutValues) {
+		// Make sure that the string is not null.
+		if(cutValues == null) {
+			throw new NullPointerException(String.format("Cut arguments for trigger are null!"));
+		}
+		
+		// Tokenize the argument string.
+		StringTokenizer tokens = new StringTokenizer(cutValues);
+		
+		// Store the cut values. Entry format is:
+		// clusterEnergyMin clusterEnergyMax hitCountMin
+		// clusterEnergyMin clusterEnergyMax hitCountMin pairSumMin pairSumMax pairDiffMax pairSlopeMin pairSlopeF pairCoplanarityMax pairTimeCoincidence
+		double cuts[];
+		if(isSingles) { cuts = new double[] { 0.0, 8.191, 0 }; }
+		else { cuts = new double[] { 0.0, 8.191, 0, 0, 8.191, 8.191, 0, 0.0055, 180, Double.MAX_VALUE }; }
+		String[] cutNames = { "clusterEnergyMin", "clusterEnergyMax", "hitCountMin",
+				"pairSumMin", "pairSumMax", "pairDiffMax", "pairSlopeMin", "pairSlopeF",
+				"pairCoplanarityMax", "pairTimeCoincidence" };
+		
+		// Iterate over the number of cuts and extract that many values
+		// from the cut value string.
+		for(int cutNum = 0; cutNum < cuts.length; cutNum++) {
+			// If there are no more tokens left, the argument string
+			// is missing some values. Throw an exception!
+			if(tokens.hasMoreTokens()) {
+				// Get the next token from the string.
+				String arg = tokens.nextToken();
+				
+				// Try to parse the token as a double. All cut values
+				// should be rendered as doubles (or integers, which
+				// can be parsed as doubles). If it is not, the string
+				// is improperly formatted.
+				try { cuts[cutNum] = Double.parseDouble(arg); }
+				catch(NumberFormatException e) {
+					throw new NumberFormatException(String.format("Argument for \"%s\" improperly formatted: %s", cutNames[cutNum], arg));
+				}
+			}
+		}
+		
+		// Store the cuts in the trigger.
+		setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW,    cuts[0]);
+		setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH,   cuts[1]);
+		setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW,       cuts[2]);
+		setCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW,         cuts[3]);
+		setCutValue(TriggerModule.PAIR_ENERGY_SUM_HIGH,        cuts[4]);
+		setCutValue(TriggerModule.PAIR_ENERGY_DIFFERENCE_HIGH, cuts[5]);
+		setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       cuts[6]);
+		setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_F,         cuts[7]);
+		setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH,       cuts[8]);
+		setCutValue(TriggerModule.PAIR_TIME_COINCIDENCE,       cuts[9]);
+	}
     
     /**
      * Checks whether the argument cluster possesses the minimum

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