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:

r2475 - /java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/GTPOnlineClusterDriver.java

From:

[log in to unmask]

Reply-To:

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

Date:

Tue, 17 Mar 2015 22:14:53 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (128 lines)

Author: [log in to unmask]
Date: Tue Mar 17 15:14:49 2015
New Revision: 2475

Log:
Added an option for the GTP clusterer to read from the DAQ configuration to acquire its settings. This is disabled by default. Activating this setting means that the GTP clusterer will not produce clusters until the DAQ configuration is initialized.

Modified:
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/GTPOnlineClusterDriver.java

Modified: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/GTPOnlineClusterDriver.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/GTPOnlineClusterDriver.java	(original)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/GTPOnlineClusterDriver.java	Tue Mar 17 15:14:49 2015
@@ -1,4 +1,11 @@
 package org.hps.recon.ecal.cluster;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import org.hps.recon.ecal.daqconfig.ConfigurationManager;
+import org.hps.recon.ecal.daqconfig.GTPConfig;
+import org.lcsim.event.EventHeader;
 
 /**
  * Class <code>GTPOnlineClusterDriver</code> allows parameters for the
@@ -7,16 +14,49 @@
  * @author Kyle McCarty <[log in to unmask]>
  */
 public class GTPOnlineClusterDriver extends ClusterDriver {
-    // Store the clustering algorithm.
     private final GTPOnlineClusterer gtp;
+    private boolean useDAQConfig = false;
     
     /**
      * Instantiates a new clustering algorithm using the readout
      * variant of the GTP clustering algorithm.
      */
     public GTPOnlineClusterDriver() {
+    	// Instantiate the clusterer.
         clusterer = ClustererFactory.create("GTPOnlineClusterer");
         gtp = (GTPOnlineClusterer) clusterer;
+        
+        // Track the DAQ configuration status.
+        ConfigurationManager.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				// If DAQ configuration settings should be used, then
+				// update the clusterer.
+				if(useDAQConfig) {
+					// Get the GTP settings.
+					GTPConfig config = ConfigurationManager.getInstance().getGTPConfig();
+					
+					// Send the DAQ configuration settings to the clusterer.
+					gtp.setSeedLowThreshold(config.getSeedEnergyCutConfig().getLowerBound());
+					gtp.setWindowAfter(config.getTimeWindowAfter());
+					gtp.setWindowBefore(config.getTimeWindowBefore());
+					
+					// Print the updated settings.
+					logSettings();
+				}
+			}
+        });
+    }
+    
+    @Override
+    public void process(EventHeader event) {
+    	// Only process an event if either the DAQ configuration is not
+    	// in use or if it has been initialized.
+    	if((useDAQConfig && ConfigurationManager.isInitialized()) || !useDAQConfig) {
+    		super.process(event);
+    	} else {
+    		System.out.println("GTP Clusterer :: Skipping event; DAQ configuration is not initialized.");
+    	}
     }
     
     /**
@@ -25,19 +65,7 @@
     @Override
     public void startOfData() {
     	// VERBOSE :: Output the driver settings.
-    	if(gtp.isVerbose()) {
-			// Print the cluster driver header.
-			System.out.println();
-			System.out.println();
-			System.out.println("======================================================================");
-			System.out.println("=== GTP Readout Clusterer Settings ===================================");
-			System.out.println("======================================================================");
-			
-			// Output the driver settings.
-			System.out.printf("Seed Energy Threshold :: %.3f GeV%n", gtp.getSeedLowThreshold());
-			System.out.printf("Time Window (Before)  :: %.0f ns%n", gtp.getWindowBefore());
-			System.out.printf("Time Window (After)   :: %.0f ns%n", gtp.getWindowAfter());
-    	}
+    	if(gtp.isVerbose()) { logSettings(); }
     }
     
     /**
@@ -80,4 +108,28 @@
     public void setVerbose(boolean verbose) {
         gtp.setVerbose(verbose);
     }
+    
+    /**
+     * Sets whether GTP settings should be drawn from the EvIO data
+     * DAQ configuration or read from the steering file.
+     * @param state - <code>true</code> means that DAQ configuration
+     * will be used and <code>false</code> that it will not.
+     */
+    public void setUseDAQConfig(boolean state) {
+    	useDAQConfig = state;
+    }
+    
+    private void logSettings() {
+		// Print the cluster driver header.
+		System.out.println();
+		System.out.println();
+		System.out.println("======================================================================");
+		System.out.println("=== GTP Readout Clusterer Settings ===================================");
+		System.out.println("======================================================================");
+		
+		// Output the driver settings.
+		System.out.printf("Seed Energy Threshold :: %.3f GeV%n", gtp.getSeedLowThreshold());
+		System.out.printf("Time Window (Before)  :: %.0f ns%n", gtp.getWindowBefore());
+		System.out.printf("Time Window (After)   :: %.0f ns%n", gtp.getWindowAfter());
+    }
 }

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