Print

Print


Author: [log in to unmask]
Date: Thu Mar  5 09:29:11 2015
New Revision: 2255

Log:
Updated the DAQ configuration API to fix a few bugs and also added the ability to load the DAQ settings into TriggerModule by directly passing it a trigger configuration object.

Modified:
    java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/TriggerModule.java
    java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/daqconfig/AbstractConfig.java
    java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/daqconfig/ConfigurationManager.java
    java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/daqconfig/DAQConfig.java
    java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/daqconfig/DAQConfigDriver.java
    java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/daqconfig/FADCConfig.java
    java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/daqconfig/IDAQConfig.java
    java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/daqconfig/PairTriggerConfig.java
    java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/daqconfig/SSPConfig.java

Modified: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/TriggerModule.java
 =============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/TriggerModule.java	(original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/TriggerModule.java	Thu Mar  5 09:29:11 2015
@@ -4,11 +4,13 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import org.hps.readout.ecal.daqconfig.PairTriggerConfig;
+import org.hps.readout.ecal.daqconfig.SinglesTriggerConfig;
 import org.hps.readout.ecal.triggerbank.SSPCluster;
 import org.lcsim.event.Cluster;
 
 /**
- * Class <code>SSPTriggerModule</code> handles trigger cuts. By default,
+ * Class <code>TriggerModule</code> handles trigger cuts. By default,
  * it sets all cuts such that any cluster or cluster pair will pass.
  * Cuts can be set after initialization via the <code>setCutValue</code>
  * method using a cut identifier. All valid cut identifiers are static
@@ -25,7 +27,8 @@
  * @see SSPCluster
  */
 public final class TriggerModule {
-	// ECal mid-plane, defined by photon beam position (30.52 mrad) at ECal face (z=1393 mm)
+	// The calorimeter mid-plane, defined by the photon beam position
+	// (30.52 mrad) at the calorimeter face (z = 1393 mm).
     private static final double ORIGIN_X = 1393.0 * Math.tan(0.03052);
     
     // Trigger module property names.
@@ -152,6 +155,56 @@
     	
     	// Otherwise, produce an exception.
     	else { throw new IllegalArgumentException(String.format("Cut \"%s\" does not exist.", cut)); }
+    }
+    
+    /**
+     * Loads triggers settings from the DAQ configuration for a singles
+     * trigger. Pair trigger settings will be set to accept all possible
+     * values, while singles trigger settings will
+     * @param config - The DAQ configuration settings.
+     */
+    public void loadDAQConfiguration(SinglesTriggerConfig config) {
+    	// Set the trigger values.
+    	setCutValue(CLUSTER_TOTAL_ENERGY_LOW,  config.getEnergyMinCutConfig().getLowerBound());
+    	setCutValue(CLUSTER_TOTAL_ENERGY_HIGH, config.getEnergyMaxCutConfig().getUpperBound());
+    	setCutValue(CLUSTER_HIT_COUNT_LOW,     config.getHitCountCutConfig().getLowerBound());
+    	
+    	// The remaining triggers should be set to their default values.
+    	// These settings effectively accept all possible clusters.
+    	cuts.put(PAIR_COPLANARITY_HIGH, 180.0);
+    	cuts.put(PAIR_ENERGY_DIFFERENCE_HIGH, Double.MAX_VALUE);
+    	cuts.put(PAIR_ENERGY_SLOPE_LOW, 0.0);
+    	cuts.put(PAIR_ENERGY_SUM_LOW, 0.0);
+    	cuts.put(PAIR_ENERGY_SUM_HIGH, Double.MAX_VALUE);
+    	cuts.put(PAIR_TIME_COINCIDENCE, Double.MAX_VALUE);
+    	
+    	// Set the default value of the energy slope parameter F.
+    	cuts.put(PAIR_ENERGY_SLOPE_F, 0.0055);
+    }
+    
+    /**
+     * Loads triggers settings from the DAQ configuration for a pair
+     * trigger. All trigger settings will be loaded directly from the
+     * DAQ configuration and set appropriately.
+     * @param config - The DAQ configuration settings.
+     */
+    public void loadDAQConfiguration(PairTriggerConfig config) {
+    	// Set the trigger values.
+    	setCutValue(CLUSTER_TOTAL_ENERGY_LOW,  config.getEnergyMinCutConfig().getLowerBound());
+    	setCutValue(CLUSTER_TOTAL_ENERGY_HIGH, config.getEnergyMaxCutConfig().getUpperBound());
+    	setCutValue(CLUSTER_HIT_COUNT_LOW,     config.getHitCountCutConfig().getLowerBound());
+    	
+    	// The remaining triggers should be set to their default values.
+    	// These settings effectively accept all possible clusters.
+    	cuts.put(PAIR_COPLANARITY_HIGH, config.getCoplanarityCutConfig().getUpperBound());
+    	cuts.put(PAIR_ENERGY_DIFFERENCE_HIGH, config.getEnergyDifferenceCutConfig().getUpperBound());
+    	cuts.put(PAIR_ENERGY_SLOPE_LOW, config.getEnergySlopeCutConfig().getLowerBound());
+    	cuts.put(PAIR_ENERGY_SUM_LOW, config.getEnergySumCutConfig().getLowerBound());
+    	cuts.put(PAIR_ENERGY_SUM_HIGH, config.getEnergySumCutConfig().getUpperBound());
+    	cuts.put(PAIR_TIME_COINCIDENCE, config.getTimeDifferenceCutConfig().getUpperBound() * 4.0);
+    	
+    	// Set the default value of the energy slope parameter F.
+    	cuts.put(PAIR_ENERGY_SLOPE_F, config.getEnergySlopeCutConfig().getParameterF());
     }
     
     /**

Modified: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/daqconfig/AbstractConfig.java
 =============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/daqconfig/AbstractConfig.java	(original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/daqconfig/AbstractConfig.java	Thu Mar  5 09:29:11 2015
@@ -28,6 +28,7 @@
 		
 		// Instantiate the value array.
 		values = new ArrayList<E>(count);
+		for(int i = 0; i < count; i++) { values.add(null); }
 	}
 	
 	/**

Modified: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/daqconfig/ConfigurationManager.java
 =============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/daqconfig/ConfigurationManager.java	(original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/daqconfig/ConfigurationManager.java	Thu Mar  5 09:29:11 2015
@@ -14,7 +14,7 @@
  * 
  * @author Kyle McCarty <[log in to unmask]>
  * @see DAQConfigDriver
- * @see TriggerConfig
+ * @see EvioDAQParser
  */
 public class ConfigurationManager {
 	// Store the configuration object.
@@ -82,7 +82,7 @@
 	 * associated listeners that an update has occurred.
 	 * @param parser - The updated DAQ information.
 	 */
-	static final void updateConfiguration(TriggerConfig parser) {
+	static final void updateConfiguration(EvioDAQParser parser) {
 		DAQ_CONFIG.loadConfig(parser);
 		INITIALIZED = true;
 		updateListeners();

Modified: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/daqconfig/DAQConfig.java
 =============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/daqconfig/DAQConfig.java	(original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/daqconfig/DAQConfig.java	Thu Mar  5 09:29:11 2015
@@ -1,13 +1,36 @@
 package org.hps.readout.ecal.daqconfig;
 
-
+/**
+ * Class <code>DAQConfig</code> holds all of the supported parameters
+ * from the DAQ configuration that exists in EVIO files. These values
+ * are stored in various subclasses appropriate to the parameter that
+ * are accessed through this primary interface.
+ * 
+ * @author Kyle McCarty <[log in to unmask]>
+ */
 public class DAQConfig extends IDAQConfig {
 	// Store the configuration objects.
 	private SSPConfig sspConfig = new SSPConfig();
 	private FADCConfig fadcConfig = new FADCConfig();
 	
+	/**
+	 * Gets the configuration parameters for the FADC.
+	 * @return Returns the FADC configuration.
+	 */
+	public FADCConfig getFADCConfig() {
+		return fadcConfig;
+	}
+	
+	/**
+	 * Gets the configuration parameters for the SSP.
+	 * @return Returns the SSP configuration.
+	 */
+	public SSPConfig getSSPConfig() {
+		return sspConfig;
+	}
+	
 	@Override
-	void loadConfig(TriggerConfig parser) {
+	void loadConfig(EvioDAQParser parser) {
 		// Pass the configuration parser to the system-specific objects.
 		sspConfig.loadConfig(parser);
 		fadcConfig.loadConfig(parser);

Modified: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/daqconfig/DAQConfigDriver.java
 =============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/daqconfig/DAQConfigDriver.java	(original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/daqconfig/DAQConfigDriver.java	Thu Mar  5 09:29:11 2015
@@ -10,15 +10,11 @@
 	@Override
 	public void process(EventHeader event) {
 		// Check if a trigger configuration bank exists.
-		if(event.hasCollection(TriggerConfig.class, "TriggerConfig")) {
+		if(event.hasCollection(EvioDAQParser.class, "TriggerConfig")) {
 			// Get the trigger configuration bank. There should only be
 			// one in the list.
-			List<TriggerConfig> configList = event.get(TriggerConfig.class, "TriggerConfig");
-			TriggerConfig daqConfig = configList.get(0);
-			
-			// Perform a debug print of the configuration to test that
-			// it is being read properly.
-			daqConfig.printVars();
+			List<EvioDAQParser> configList = event.get(EvioDAQParser.class, "TriggerConfig");
+			EvioDAQParser daqConfig = configList.get(0);
 			
 			// Get the DAQ configuration and update it with the new
 			// configuration object.
@@ -26,4 +22,4 @@
 		}
 	}
 	
-}
+}

Modified: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/daqconfig/FADCConfig.java
 =============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/daqconfig/FADCConfig.java	(original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/daqconfig/FADCConfig.java	Thu Mar  5 09:29:11 2015
@@ -18,6 +18,7 @@
  * <li>NSB</li>
  * <li>FADC Window Width</li>
  * <li>FADC Window Time Offset</li>
+ * <li>Max Pulses per Channel Window</li>
  * <li>Crystal Gains</li>
  * <li>Crystal Thresholds</li>
  * <li>Crystal Pedestals</li>
@@ -32,7 +33,7 @@
 	private int nsb         = -1;
 	private int windowWidth = -1;
 	private int offset      = -1;
-	private int npeak       = -1;
+	private int maxPulses       = -1;
 	
 	// Store a map of calorimeter channel number to crystal indices.
 	private Map<Point, Integer> indexChannelMap = new HashMap<Point, Integer>();
@@ -43,14 +44,14 @@
 	private int[] thresholds = new int[443];
 	
 	@Override
-	void loadConfig(TriggerConfig parser) {
+	void loadConfig(EvioDAQParser parser) {
 		// Store the basic FADC information.
 		mode = parser.fadcMODE;
 		nsa = parser.fadcNSA;
 		nsb = parser.fadcNSB;
 		windowWidth = parser.fadcWIDTH;
 		offset = parser.fadcOFFSET;
-		npeak = parser.fadcNPEAK;       // TODO: Make this obtainable.
+		maxPulses = parser.fadcNPEAK;
 		
 		// Get the channel collection from the database.
 		DatabaseConditionsManager database = DatabaseConditionsManager.getInstance();
@@ -77,7 +78,8 @@
 	/**
 	 * Gets the gain for a crystal.
 	 * @param channel - The channel object corresponding to the crystal.
-	 * @return Returns the gain as a <code>float</code>.
+	 * @return Returns the gain as a <code>float</code> in units of MeV
+	 * per ADC.
 	 */
 	public float getGain(EcalChannel channel) {
 		return getGain(channel.getChannelId());
@@ -86,7 +88,8 @@
 	/**
 	 * Gets the gain for a crystal.
 	 * @param channelID - The channel ID corresponding to the crystal.
-	 * @return Returns the gain as a <code>float</code>.
+	 * @return Returns the gain as a <code>float</code> in units of MeV
+	 * per ADC.
 	 */
 	public float getGain(int channelID) {
 		validateChannelID(channelID);
@@ -97,7 +100,8 @@
 	 * Gets the gain for a crystal.
 	 * @param ix - The x-index of the crystal.
 	 * @param iy - The y-index of the crystal.
-	 * @return Returns the gain as a <code>float</code>.
+	 * @return Returns the gain as a <code>float</code> in units of MeV
+	 * per ADC.
 	 */
 	public float getGain(int ix, int iy) {
 		return getGain(new Point(ix, iy));
@@ -107,10 +111,20 @@
 	 * Gets the gain for a crystal.
 	 * @param ixy - The a point representing the x/y-indices of the
 	 * crystal.
-	 * @return Returns the gain as a <code>float</code>.
+	 * @return Returns the gain as a <code>float</code> in units of MeV
+	 * per ADC.
 	 */
 	public float getGain(Point ixy) {
 		return getGain(indexChannelMap.get(ixy));
+	}
+	
+	/**
+	 * Gets the maximum number of pulses that the FADC will look for
+	 * in a channel's window.
+	 * @return Returns the maximum number of pulses.
+	 */
+	public int getMaxPulses() {
+		return maxPulses;
 	}
 	
 	/**
@@ -143,7 +157,8 @@
 	/**
 	 * Gets the pedestal for a crystal.
 	 * @param channel - The channel object corresponding to the crystal.
-	 * @return Returns the pedestal as a <code>float</code>.
+	 * @return Returns the pedestal as a <code>float</code> in units
+	 * of ADC.
 	 */
 	public float getPedestal(EcalChannel channel) {
 		return getPedestal(channel.getChannelId());
@@ -152,7 +167,8 @@
 	/**
 	 * Gets the pedestal for a crystal.
 	 * @param channelID - The channel ID corresponding to the crystal.
-	 * @return Returns the pedestal as a <code>float</code>.
+	 * @return Returns the pedestal as a <code>float</code> in units
+	 * of ADC.
 	 */
 	public float getPedestal(int channelID) {
 		validateChannelID(channelID);
@@ -163,7 +179,8 @@
 	 * Gets the pedestal for a crystal.
 	 * @param ix - The x-index of the crystal.
 	 * @param iy - The y-index of the crystal.
-	 * @return Returns the pedestal as a <code>float</code>.
+	 * @return Returns the pedestal as a <code>float</code> in units
+	 * of ADC.
 	 */
 	public float getPedestal(int ix, int iy) {
 		return getPedestal(new Point(ix, iy));
@@ -173,7 +190,8 @@
 	 * Gets the pedestal for a crystal.
 	 * @param ixy - The a point representing the x/y-indices of the
 	 * crystal.
-	 * @return Returns the pedestal as a <code>float</code>.
+	 * @return Returns the pedestal as a <code>float</code> in units
+	 * of ADC.
 	 */
 	public float getPedestal(Point ixy) {
 		return getPedestal(indexChannelMap.get(ixy));
@@ -182,7 +200,8 @@
 	/**
 	 * Gets the threshold for a crystal.
 	 * @param channel - The channel object corresponding to the crystal.
-	 * @return Returns the threshold as a <code>int</code>.
+	 * @return Returns the threshold as a <code>int</code> in units
+	 * of ADC.
 	 */
 	public int getThreshold(EcalChannel channel) {
 		return getThreshold(channel.getChannelId());
@@ -191,7 +210,8 @@
 	/**
 	 * Gets the threshold for a crystal.
 	 * @param channelID - The channel ID corresponding to the crystal.
-	 * @return Returns the threshold as a <code>int</code>.
+	 * @return Returns the threshold as a <code>int</code> in units
+	 * of ADC.
 	 */
 	public int getThreshold(int channelID) {
 		validateChannelID(channelID);
@@ -202,7 +222,8 @@
 	 * Gets the threshold for a crystal.
 	 * @param ix - The x-index of the crystal.
 	 * @param iy - The y-index of the crystal.
-	 * @return Returns the threshold as a <code>int</code>.
+	 * @return Returns the threshold as a <code>int</code> in units
+	 * of ADC.
 	 */
 	public int getThreshold(int ix, int iy) {
 		return getThreshold(new Point(ix, iy));
@@ -212,7 +233,8 @@
 	 * Gets the threshold for a crystal.
 	 * @param ixy - The a point representing the x/y-indices of the
 	 * crystal.
-	 * @return Returns the threshold as a <code>int</code>.
+	 * @return Returns the threshold as a <code>int</code> in units
+	 * of ADC.
 	 */
 	public int getThreshold(Point ixy) {
 		return getThreshold(indexChannelMap.get(ixy));

Modified: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/daqconfig/IDAQConfig.java
 =============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/daqconfig/IDAQConfig.java	(original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/daqconfig/IDAQConfig.java	Thu Mar  5 09:29:11 2015
@@ -14,7 +14,7 @@
 	 * Updates the stored settings based on the argument parser.
 	 * @param parser - The EVIO DAQ bank parser.
 	 */
-	abstract void loadConfig(TriggerConfig parser);
+	abstract void loadConfig(EvioDAQParser parser);
 	
 	/**
 	 * Prints a textual representation of the configuration bank to the

Modified: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/daqconfig/PairTriggerConfig.java
 =============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/daqconfig/PairTriggerConfig.java	(original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/daqconfig/PairTriggerConfig.java	Thu Mar  5 09:29:11 2015
@@ -21,7 +21,7 @@
 	 */
 	PairTriggerConfig() {
 		// Instantiate the superclass.
-		super(6);
+		super(8);
 		
 		// Define the pair cuts.
 		setValue(CUT_ENERGY_MIN,   new LBOCutConfig());

Modified: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/daqconfig/SSPConfig.java
 =============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/daqconfig/SSPConfig.java	(original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/daqconfig/SSPConfig.java	Thu Mar  5 09:29:11 2015
@@ -20,7 +20,7 @@
 	private SinglesTriggerConfig[] singlesTrigger = { new SinglesTriggerConfig(), new SinglesTriggerConfig() };
 	
 	@Override
-	void loadConfig(TriggerConfig parser) {
+	void loadConfig(EvioDAQParser parser) {
 		// Set the trigger parameters.
 		for(int triggerNum = 0; triggerNum < 2; triggerNum++) {
 			// Set whether the triggers are enabled or not.
@@ -132,8 +132,7 @@
 			
 			System.out.println("\t\tCluster Hit Count Cut");
 			System.out.printf("\t\t\tEnabled :: %b%n", pairTrigger[triggerNum].getHitCountCutConfig().isEnabled());
-			//System.out.printf("\t\t\tValue   :: %1.0f hits%n", pairTrigger[triggerNum].getHitCountCutConfig().getLowerBound());
-			System.out.printf("\t\t\tValue   :: ??? hits%n");
+			System.out.printf("\t\t\tValue   :: %1.0f hits%n", pairTrigger[triggerNum].getHitCountCutConfig().getLowerBound());
 			
 			System.out.println("\t\tPair Energy Sum Cut");
 			System.out.printf("\t\t\tEnabled :: %b%n", pairTrigger[triggerNum].getEnergySumCutConfig().isEnabled());