Author: [log in to unmask]
Date: Fri Jan 30 17:08:20 2015
New Revision: 2018
Log:
Purged all tabs from SSPData and related classes. Spaces are no supreme.
Modified:
java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/triggerbank/SSPCluster.java
java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/triggerbank/SSPCosmicTrigger.java
java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/triggerbank/SSPData.java
java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/triggerbank/SSPPairTrigger.java
java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/triggerbank/SSPSinglesTrigger.java
java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/triggerbank/SSPTrigger.java
java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/triggerbank/SSPTriggerFactory.java
Modified: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/triggerbank/SSPCluster.java
=============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/triggerbank/SSPCluster.java (original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/triggerbank/SSPCluster.java Fri Jan 30 17:08:20 2015
@@ -12,77 +12,77 @@
* @author Kyle McCarty <[log in to unmask]>
*/
public final class SSPCluster {
- // Cluster definition variables.
- private final int ix;
- private final int iy;
- private final int n;
- private final int t;
- private final double e;
-
- // Output potential errors or messages.
- private static Logger logger = LogUtil.create(SSPCluster.class, new BasicFormatter(SSPCluster.class.getSimpleName()));
-
- /**
- * Creates a new <code>SSPCluster</code> object.
- * @param ix - The x-index of the cluster.
- * @param iy - The y-index of the cluster.
- * @param energy - The cluster energy in MeV.
- * @param hits - The cluster hit count.
- * @param time - The time at which the cluster occurred in ns.
- */
- public SSPCluster(int ix, int iy, int energy, int hits, int time) {
- // Make sure that the input values are valid.
- if(ix == 0 || ix < -23 || ix > 23) {
- logger.warning(String.format("Received out-of-bounds ix value of %d.", ix));
- } if(iy == 0 || iy < -5 || iy > 5) {
- logger.warning(String.format("Received out-of-bounds iy value of %d.", iy));
- } if(energy < 0) {
- logger.warning("Received negative energy for cluster.");
- } if(hits <= 0) {
- logger.warning("Received cluster with zero or fewer hits.");
- } if(time < 0) {
- logger.warning("Received cluster with negative time.");
- }
-
- // Define the cluster parameters.
- this.ix = ix;
- this.iy = iy;
- this.e = energy / 1000.0;
- this.t = time;
- this.n = hits;
-
- // Indicate that the cluster was made.
- logger.fine(String.format("Constructed cluster at (%3d, %3d) at time %3d ns with energy %4d MeV and %d hits.",
- ix, iy, time, energy, hits));
- }
-
- /**
- * Gets the x-index of the cluster.
- * @return Returns the cluster x-index as an <code>int</code>.
- */
- public int getXIndex() { return ix; }
-
- /**
- * Gets the y-index of the cluster.
- * @return Returns the cluster y-index as an <code>int</code>.
- */
- public int getYIndex() { return iy; }
-
- /**
- * Gets the number of hits in the cluster.
- * @return Returns the cluster hit count as an <code>int</code>.
- */
- public int getHitCount() { return n; }
-
- /**
- * Gets the cluster time in nanoseconds.
- * @return Returns the cluster time as an <code>int</code>.
- */
- public int getTime() { return t; }
-
- /**
- * Gets the energy of the cluster in GeV.
- * @return Returns the cluster energy as a <code>double</code>.
- */
- public double getEnergy() { return e; }
+ // Cluster definition variables.
+ private final int ix;
+ private final int iy;
+ private final int n;
+ private final int t;
+ private final double e;
+
+ // Output potential errors or messages.
+ private static Logger logger = LogUtil.create(SSPCluster.class, new BasicFormatter(SSPCluster.class.getSimpleName()));
+
+ /**
+ * Creates a new <code>SSPCluster</code> object.
+ * @param ix - The x-index of the cluster.
+ * @param iy - The y-index of the cluster.
+ * @param energy - The cluster energy in MeV.
+ * @param hits - The cluster hit count.
+ * @param time - The time at which the cluster occurred in ns.
+ */
+ public SSPCluster(int ix, int iy, int energy, int hits, int time) {
+ // Make sure that the input values are valid.
+ if(ix == 0 || ix < -23 || ix > 23) {
+ logger.warning(String.format("Received out-of-bounds ix value of %d.", ix));
+ } if(iy == 0 || iy < -5 || iy > 5) {
+ logger.warning(String.format("Received out-of-bounds iy value of %d.", iy));
+ } if(energy < 0) {
+ logger.warning("Received negative energy for cluster.");
+ } if(hits <= 0) {
+ logger.warning("Received cluster with zero or fewer hits.");
+ } if(time < 0) {
+ logger.warning("Received cluster with negative time.");
+ }
+
+ // Define the cluster parameters.
+ this.ix = ix;
+ this.iy = iy;
+ this.e = energy / 1000.0;
+ this.t = time;
+ this.n = hits;
+
+ // Indicate that the cluster was made.
+ logger.fine(String.format("Constructed cluster at (%3d, %3d) at time %3d ns with energy %4d MeV and %d hits.",
+ ix, iy, time, energy, hits));
+ }
+
+ /**
+ * Gets the x-index of the cluster.
+ * @return Returns the cluster x-index as an <code>int</code>.
+ */
+ public int getXIndex() { return ix; }
+
+ /**
+ * Gets the y-index of the cluster.
+ * @return Returns the cluster y-index as an <code>int</code>.
+ */
+ public int getYIndex() { return iy; }
+
+ /**
+ * Gets the number of hits in the cluster.
+ * @return Returns the cluster hit count as an <code>int</code>.
+ */
+ public int getHitCount() { return n; }
+
+ /**
+ * Gets the cluster time in nanoseconds.
+ * @return Returns the cluster time as an <code>int</code>.
+ */
+ public int getTime() { return t; }
+
+ /**
+ * Gets the energy of the cluster in GeV.
+ * @return Returns the cluster energy as a <code>double</code>.
+ */
+ public double getEnergy() { return e; }
}
Modified: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/triggerbank/SSPCosmicTrigger.java
=============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/triggerbank/SSPCosmicTrigger.java (original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/triggerbank/SSPCosmicTrigger.java Fri Jan 30 17:08:20 2015
@@ -1,5 +1,4 @@
package org.hps.readout.ecal.triggerbank;
-
/**
* Class <code>SSPCosmicTrigger</code> represents an SSP trigger for
@@ -8,32 +7,32 @@
* @author Kyle McCarty <[log in to unmask]>
*/
public class SSPCosmicTrigger extends SSPTrigger {
- /**
- * Instantiates a new <code>SSPCosmicTrigger</code>.
- * @param isTop - Indicates whether this trigger was caused by the
- * top crate in the SSP or not.
- * @param time - The time at which the trigger occurred.
- */
- public SSPCosmicTrigger(boolean isTop, int time) {
- // Instantiate the superclass object.
- super(isTop ? SSPData.TRIG_TYPE_COSMIC_TOP : SSPData.TRIG_TYPE_COSMIC_BOT, time, 0);
- }
-
- /**
- * Indicates whether the trigger was reported by the bottom SSP
- * crate or not.
- * @return Returns <code>true</code> if the trigger was reported
- * by the bottom crate and <code>false</code> if it was reported
- * by the top crate.
- */
- public boolean isBottom() { return type == SSPData.TRIG_TYPE_COSMIC_BOT; }
-
- /**
- * Indicates whether the trigger was reported by the top SSP
- * crate or not.
- * @return Returns <code>true</code> if the trigger was reported
- * by the top crate and <code>false</code> if it was reported by
- * the bottom crate.
- */
- public boolean isTop() { return type == SSPData.TRIG_TYPE_COSMIC_TOP; }
-}
+ /**
+ * Instantiates a new <code>SSPCosmicTrigger</code>.
+ * @param isTop - Indicates whether this trigger was caused by the
+ * top crate in the SSP or not.
+ * @param time - The time at which the trigger occurred.
+ */
+ public SSPCosmicTrigger(boolean isTop, int time) {
+ // Instantiate the superclass object.
+ super(isTop ? SSPData.TRIG_TYPE_COSMIC_TOP : SSPData.TRIG_TYPE_COSMIC_BOT, time, 0);
+ }
+
+ /**
+ * Indicates whether the trigger was reported by the bottom SSP
+ * crate or not.
+ * @return Returns <code>true</code> if the trigger was reported
+ * by the bottom crate and <code>false</code> if it was reported
+ * by the top crate.
+ */
+ public boolean isBottom() { return type == SSPData.TRIG_TYPE_COSMIC_BOT; }
+
+ /**
+ * Indicates whether the trigger was reported by the top SSP
+ * crate or not.
+ * @return Returns <code>true</code> if the trigger was reported
+ * by the top crate and <code>false</code> if it was reported by
+ * the bottom crate.
+ */
+ public boolean isTop() { return type == SSPData.TRIG_TYPE_COSMIC_TOP; }
+}
Modified: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/triggerbank/SSPData.java
=============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/triggerbank/SSPData.java (original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/triggerbank/SSPData.java Fri Jan 30 17:08:20 2015
@@ -15,7 +15,7 @@
* @author Kyle McCarty <[log in to unmask]>
*/
public class SSPData extends AbstractIntData {
- // The EVIO header tag for SSP trigger banks.
+ // The EVIO header tag for SSP trigger banks.
public static final int BANK_TAG = 0xe10c;
// EVIO 5-bit word identifiers for cluster parameters.
@@ -72,38 +72,38 @@
@Override
protected final void decodeData() {
// Parse over the integer EVIO words and handle each type. Block
- // headers and block trailers can be ignored because these are
- // disentangled in the secondary CODA readout list.
+ // headers and block trailers can be ignored because these are
+ // disentangled in the secondary CODA readout list.
for (int ii = 0; ii < bank.length; ii++) {
// Process the event number.
if (((bank[ii] >> 27) & (0x1f)) == TRIG_HEADER) {
- eventNumber = bank[ii] & 0x7FFFFFF;
+ eventNumber = bank[ii] & 0x7FFFFFF;
}
// Process the trigger time.
else if (((bank[ii] >> 27) & (0x1f)) == TRIG_TIME) {
- triggerTime = (bank[ii + 1] << 24) | (bank[ii] & 0xffffff);
+ triggerTime = (bank[ii + 1] << 24) | (bank[ii] & 0xffffff);
}
// Process SSP trigger data.
else if (((bank[ii] >> 27) & (0x1f)) == TRIG_TYPE) {
- // Parse the trigger information. Note that type is
- // the trigger identification bits and ranges from
- // zero to seven.
- int type = (bank[ii] >> 23) & 0xf;
- int data = (bank[ii] >> 16) & 0x7f;
- int time = (bank[ii]) & 0x3ff;
+ // Parse the trigger information. Note that type is
+ // the trigger identification bits and ranges from
+ // zero to seven.
+ int type = (bank[ii] >> 23) & 0xf;
+ int data = (bank[ii] >> 16) & 0x7f;
+ int time = (bank[ii]) & 0x3ff;
// Create an SSPTrigger and add it to the list.
- SSPTrigger trigger = SSPTriggerFactory.makeTrigger(type, time * 4, data);
- triggerList.add(trigger);
+ SSPTrigger trigger = SSPTriggerFactory.makeTrigger(type, time * 4, data);
+ triggerList.add(trigger);
}
// Process SSP clusters.
else if (((bank[ii] >> 27) & (0x1f)) == CLUSTER_TYPE) {
// Get the number of hits in the cluster and add it
- // to the cluster hits list.
- int hits = (bank[ii] >> 23) & 0xf;
+ // to the cluster hits list.
+ int hits = (bank[ii] >> 23) & 0xf;
// Get the cluster energy (which is in MeV) and add it
// to the cluster energy list.
@@ -115,12 +115,12 @@
// If the first bit of the index is 1, then it is a
// negative number and needs to be converted using
// two's complement to get the proper value.
- if(((iy >> 3) & 0x1) == 0x1) {
- // Perform the two's complement. ('^' is the bit
- // wise inversion operator).
- iy = iy ^ (0xf);
- iy += 1;
- iy *=-1;
+ if(((iy >> 3) & 0x1) == 0x1) {
+ // Perform the two's complement. ('^' is the bit
+ // wise inversion operator).
+ iy = iy ^ (0xf);
+ iy += 1;
+ iy *=-1;
}
// Get the x-index of the cluster.
@@ -130,17 +130,17 @@
// negative number and needs to be converted using
// two's complement to get the proper value.
if(((ix >> 5) & 0x1) == 0x1) {
- // Perform the two's complement. ('^' is the bit
- // wise inversion operator).
- ix = ix ^ (0x3f);
- ix += 1;
- ix *=-1;
-
- // Values are encoded from -22 to 23; since LCSIM
- // defines them from -23 to -1 and 1 to 23, negative
- // values need to be shifted down by an additional
- // step to be accurate.
- ix -= 1;
+ // Perform the two's complement. ('^' is the bit
+ // wise inversion operator).
+ ix = ix ^ (0x3f);
+ ix += 1;
+ ix *=-1;
+
+ // Values are encoded from -22 to 23; since LCSIM
+ // defines them from -23 to -1 and 1 to 23, negative
+ // values need to be shifted down by an additional
+ // step to be accurate.
+ ix -= 1;
}
// Get the cluster time. Time is 4 ns clock-cycles.
@@ -148,8 +148,8 @@
// Create an SSPCluster from the parsed information
// and add it to the cluster list.
- SSPCluster cluster = new SSPCluster(ix, iy, energy, hits, time * 4);
- clusterList.add(cluster);
+ SSPCluster cluster = new SSPCluster(ix, iy, energy, hits, time * 4);
+ clusterList.add(cluster);
}
}
}
@@ -160,7 +160,7 @@
* of <code>SSPCluster</code> objects.
*/
public List<SSPCluster> getClusters() {
- return clusterList;
+ return clusterList;
}
/**
@@ -170,7 +170,7 @@
* subclass they are, as appropriate to their type code.
*/
public List<SSPTrigger> getTriggers() {
- return triggerList;
+ return triggerList;
}
/**
@@ -185,77 +185,88 @@
*/
public int getEventNumber() { return eventNumber; }
- /*
- * Returns the trigger time, relative to the SSP window, of the
- * FIRST Cluster singles trigger (0/1) (any crate). Returns in ns.
- */
// TODO: Get information from Andrea on what this is for. It seems
// to be something specialized. Maybe it should be placed in
// the analysis driver in which it is used?
+ /**
+ * Gets the first singles trigger that occurred in either crate.
+ * If no singles triggered occurred, a value of <code>1025 * 4 =
+ * 4100</code> will be returned.
+ * @return Returns the time in nanoseconds of the earliest singles
+ * trigger that occurred, or <code>4100</code> if no singles trigger
+ * has occurred.
+ */
@Deprecated
public int getOrTrig() {
- int TopTime = this.getTopTrig();
- int BotTime = this.getBotTrig();
-
- if (TopTime <= BotTime) {
- return TopTime;
- } else {
- return BotTime;
- }
- }
-
- /*
- * Returns the trigger time, relative to the SSP window, of the
- * FIRST Cluster singles trigger (0/1) from TOP crate. Returns in ns.
- */
+ // Get the earliest time for both the top and bottom triggers.
+ int topTime = getTopTrig();
+ int bottomTime = getBotTrig();
+
+ // Return whichever crate had the earliest trigger.
+ if (topTime <= bottomTime) { return topTime; }
+ else { return bottomTime; }
+ }
+
// TODO: Get information from Andrea on what this is for. It seems
// to be something specialized. Maybe it should be placed in
// the analysis driver in which it is used?
+ /**
+ * Gets the first singles trigger that occurred in the top crate.
+ * If no singles triggered occurred, a value of <code>1025 * 4 =
+ * 4100</code> will be returned.
+ * @return Returns the time in nanoseconds of the earliest singles
+ * trigger that occurred, or <code>4100</code> if no singles trigger
+ * has occurred.
+ */
@Deprecated
public int getTopTrig() {
- // Store the smallest found time. The time is a 10 bit value,
- // so it must always be less than 1024. Multiply by 4 to convert
- // from clock-cycles to nanoseconds.
+ // Store the smallest found time. The time is a 10 bit value,
+ // so it must always be less than 1024. Multiply by 4 to convert
+ // from clock-cycles to nanoseconds.
int topTime = 1025 * 4;
// Iterate over all triggers.
for(SSPTrigger trigger : triggerList) {
- // Select only singles triggers from the top crate.
- if(trigger instanceof SSPSinglesTrigger && ((SSPSinglesTrigger) trigger).isTop()) {
- // Store the smallest trigger time found.
- if(trigger.getTime() < topTime) {
- topTime = trigger.getTime();
- }
- }
+ // Select only singles triggers from the top crate.
+ if(trigger instanceof SSPSinglesTrigger && ((SSPSinglesTrigger) trigger).isTop()) {
+ // Store the smallest trigger time found.
+ if(trigger.getTime() < topTime) {
+ topTime = trigger.getTime();
+ }
+ }
}
// Return the smallest found time.
return topTime;
}
- /*
- * Returns the trigger time, relative to the SSP window, of the
- * FIRST Cluster singles trigger (0/1) from BOT crate. Returns in ns.
- */
// TODO: Get information from Andrea on what this is for. It seems
// to be something specialized. Maybe it should be placed in
// the analysis driver in which it is used?
+ /**
+ * Gets the first singles trigger that occurred in the bottom crate.
+ * If no singles triggered occurred, a value of <code>1025 * 4 =
+ * 4100</code> will be returned.
+ * @return Returns the time in nanoseconds of the earliest singles
+ * trigger that occurred, or <code>4100</code> if no singles trigger
+ * has occurred.
+ */
@Deprecated
public int getBotTrig() {
- // Store the smallest found time. The time is a 10 bit value,
- // so it must always be less than 1024. Multiply by 4 to convert
- // from clock-cycles to nanoseconds.
+ // Store the smallest found time. The time is a 10 bit value,
+ // so it must always be less than 1024. Multiply by 4 to convert
+ // from clock-cycles to nanoseconds.
int bottomTime = 1025 * 4;
// Iterate over all triggers.
for(SSPTrigger trigger : triggerList) {
- // Select only singles triggers from the bottom crate.
- if(trigger instanceof SSPSinglesTrigger && ((SSPSinglesTrigger) trigger).isBottom()) {
- // Store the smallest trigger time found.
- if(trigger.getTime() < bottomTime) {
- bottomTime = trigger.getTime();
- }
- }
+ // Select only singles triggers from the bottom crate.
+ if(trigger instanceof SSPSinglesTrigger && ((SSPSinglesTrigger) trigger).isBottom()) {
+ // Store the smallest trigger time found.
+ if(trigger.getTime() < bottomTime) {
+ bottomTime = trigger.getTime();
+ }
+ }
}
// Return the smallest found time.
@@ -266,6 +277,6 @@
// is also not used anywhere.
@Deprecated
public int getAndTrig() {
- return 0;
- }
-}
+ return 0;
+ }
+}
Modified: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/triggerbank/SSPPairTrigger.java
=============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/triggerbank/SSPPairTrigger.java (original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/triggerbank/SSPPairTrigger.java Fri Jan 30 17:08:20 2015
@@ -8,54 +8,54 @@
* @author Kyle McCarty <[log in to unmask]>
*/
public class SSPPairTrigger extends SSPTrigger {
- /**
- * Instantiates a new <code>SSPPairTrigger</code>.
- * @param isFirstTrigger - Indicates whether the first or second
- * trigger produced this trigger.
- * @param time - The time at which the trigger occurred.
- * @param data - The trigger data associated with the trigger.
- */
- public SSPPairTrigger(boolean isFirstTrigger, int time, int data) {
- super(isFirstTrigger ? SSPData.TRIG_TYPE_PAIR0 : SSPData.TRIG_TYPE_PAIR1, time, data);
- }
-
- /**
- * Indicates whether the trigger passed the pair energy sum cut
- * or not.
- * @return Returns <code>true</code> if the cut passed and
- * <code>false</code> otherwise.
- */
- public boolean passCutEnergySum() {
- return (data & 1) == 1;
- }
-
- /**
- * Indicates whether the trigger passed the pair energy difference
- * cut or not.
- * @return Returns <code>true</code> if the cut passed and
- * <code>false</code> otherwise.
- */
- public boolean passCutEnergyDifference() {
- return ((data & 2) >> 1) == 1;
- }
-
- /**
- * Indicates whether the trigger passed the pair energy slope cut
- * or not.
- * @return Returns <code>true</code> if the cut passed and
- * <code>false</code> otherwise.
- */
- public boolean passCutEnergySlope() {
- return ((data & 4) >> 2) == 1;
- }
-
- /**
- * Indicates whether the trigger passed the pair coplanarity cut
- * or not.
- * @return Returns <code>true</code> if the cut passed and
- * <code>false</code> otherwise.
- */
- public boolean passCutCoplanarity() {
- return ((data & 8) >> 3) == 1;
- }
-}
+ /**
+ * Instantiates a new <code>SSPPairTrigger</code>.
+ * @param isFirstTrigger - Indicates whether the first or second
+ * trigger produced this trigger.
+ * @param time - The time at which the trigger occurred.
+ * @param data - The trigger data associated with the trigger.
+ */
+ public SSPPairTrigger(boolean isFirstTrigger, int time, int data) {
+ super(isFirstTrigger ? SSPData.TRIG_TYPE_PAIR0 : SSPData.TRIG_TYPE_PAIR1, time, data);
+ }
+
+ /**
+ * Indicates whether the trigger passed the pair energy sum cut
+ * or not.
+ * @return Returns <code>true</code> if the cut passed and
+ * <code>false</code> otherwise.
+ */
+ public boolean passCutEnergySum() {
+ return (data & 1) == 1;
+ }
+
+ /**
+ * Indicates whether the trigger passed the pair energy difference
+ * cut or not.
+ * @return Returns <code>true</code> if the cut passed and
+ * <code>false</code> otherwise.
+ */
+ public boolean passCutEnergyDifference() {
+ return ((data & 2) >> 1) == 1;
+ }
+
+ /**
+ * Indicates whether the trigger passed the pair energy slope cut
+ * or not.
+ * @return Returns <code>true</code> if the cut passed and
+ * <code>false</code> otherwise.
+ */
+ public boolean passCutEnergySlope() {
+ return ((data & 4) >> 2) == 1;
+ }
+
+ /**
+ * Indicates whether the trigger passed the pair coplanarity cut
+ * or not.
+ * @return Returns <code>true</code> if the cut passed and
+ * <code>false</code> otherwise.
+ */
+ public boolean passCutCoplanarity() {
+ return ((data & 8) >> 3) == 1;
+ }
+}
Modified: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/triggerbank/SSPSinglesTrigger.java
=============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/triggerbank/SSPSinglesTrigger.java (original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/triggerbank/SSPSinglesTrigger.java Fri Jan 30 17:08:20 2015
@@ -8,72 +8,72 @@
* @author Kyle McCarty <[log in to unmask]>
*/
public class SSPSinglesTrigger extends SSPTrigger {
- /**
- * Instantiates a new <code>SSPSinglesTrigger</code> object.
- * @param isTrigger0 - Indicates whether this is the first or second
- * of the singles triggers.
- * @param isTop - Indicates whether this trigger was thrown by the
- * top or the bottom SSP crate.
- * @param time - Indicates at what time the trigger occurred in ns.
- * @param data - The raw trigger data associated with this trigger.
- */
- public SSPSinglesTrigger(boolean isTrigger0, boolean isTop, int time, int data) {
- // Initialize the superclass object.
- super(isTop ?
- (isTrigger0 ? SSPData.TRIG_TYPE_SINGLES0_TOP : SSPData.TRIG_TYPE_SINGLES1_TOP) :
- (isTrigger0 ? SSPData.TRIG_TYPE_SINGLES0_BOT : SSPData.TRIG_TYPE_SINGLES1_BOT),
- time, data);
- }
-
- /**
- * Indicates whether the trigger was reported by the bottom SSP
- * crate or not.
- * @return Returns <code>true</code> if the trigger was reported
- * by the bottom crate and <code>false</code> if it was reported
- * by the top crate.
- */
- public boolean isBottom() {
- return (type == SSPData.TRIG_TYPE_SINGLES0_BOT || type == SSPData.TRIG_TYPE_SINGLES1_BOT);
- }
-
- /**
- * Indicates whether the trigger was reported by the top SSP
- * crate or not.
- * @return Returns <code>true</code> if the trigger was reported
- * by the top crate and <code>false</code> if it was reported by
- * the bottom crate.
- */
- public boolean isTop() {
- return (type == SSPData.TRIG_TYPE_SINGLES0_TOP || type == SSPData.TRIG_TYPE_SINGLES1_TOP);
- }
-
- /**
- * Indicates whether the trigger passed the cluster total energy
- * lower bound cut or not.
- * @return Returns <code>true</code> if the cut passed and
- * <code>false</code> otherwise.
- */
- public boolean passCutEnergyMin() {
- return (data & 1) == 1;
- }
-
- /**
- * Indicates whether the trigger passed the cluster total energy
- * upper bound cut or not.
- * @return Returns <code>true</code> if the cut passed and
- * <code>false</code> otherwise.
- */
- public boolean passCutEnergyMax() {
- return ((data & 2) >> 1) == 1;
- }
-
- /**
- * Indicates whether the trigger passed the cluster hit count cut
- * or not.
- * @return Returns <code>true</code> if the cut passed and
- * <code>false</code> otherwise.
- */
- public boolean passCutHitCount() {
- return ((data & 4) >> 2) == 1;
- }
+ /**
+ * Instantiates a new <code>SSPSinglesTrigger</code> object.
+ * @param isTrigger0 - Indicates whether this is the first or second
+ * of the singles triggers.
+ * @param isTop - Indicates whether this trigger was thrown by the
+ * top or the bottom SSP crate.
+ * @param time - Indicates at what time the trigger occurred in ns.
+ * @param data - The raw trigger data associated with this trigger.
+ */
+ public SSPSinglesTrigger(boolean isTrigger0, boolean isTop, int time, int data) {
+ // Initialize the superclass object.
+ super(isTop ?
+ (isTrigger0 ? SSPData.TRIG_TYPE_SINGLES0_TOP : SSPData.TRIG_TYPE_SINGLES1_TOP) :
+ (isTrigger0 ? SSPData.TRIG_TYPE_SINGLES0_BOT : SSPData.TRIG_TYPE_SINGLES1_BOT),
+ time, data);
+ }
+
+ /**
+ * Indicates whether the trigger was reported by the bottom SSP
+ * crate or not.
+ * @return Returns <code>true</code> if the trigger was reported
+ * by the bottom crate and <code>false</code> if it was reported
+ * by the top crate.
+ */
+ public boolean isBottom() {
+ return (type == SSPData.TRIG_TYPE_SINGLES0_BOT || type == SSPData.TRIG_TYPE_SINGLES1_BOT);
+ }
+
+ /**
+ * Indicates whether the trigger was reported by the top SSP
+ * crate or not.
+ * @return Returns <code>true</code> if the trigger was reported
+ * by the top crate and <code>false</code> if it was reported by
+ * the bottom crate.
+ */
+ public boolean isTop() {
+ return (type == SSPData.TRIG_TYPE_SINGLES0_TOP || type == SSPData.TRIG_TYPE_SINGLES1_TOP);
+ }
+
+ /**
+ * Indicates whether the trigger passed the cluster total energy
+ * lower bound cut or not.
+ * @return Returns <code>true</code> if the cut passed and
+ * <code>false</code> otherwise.
+ */
+ public boolean passCutEnergyMin() {
+ return (data & 1) == 1;
+ }
+
+ /**
+ * Indicates whether the trigger passed the cluster total energy
+ * upper bound cut or not.
+ * @return Returns <code>true</code> if the cut passed and
+ * <code>false</code> otherwise.
+ */
+ public boolean passCutEnergyMax() {
+ return ((data & 2) >> 1) == 1;
+ }
+
+ /**
+ * Indicates whether the trigger passed the cluster hit count cut
+ * or not.
+ * @return Returns <code>true</code> if the cut passed and
+ * <code>false</code> otherwise.
+ */
+ public boolean passCutHitCount() {
+ return ((data & 4) >> 2) == 1;
+ }
}
Modified: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/triggerbank/SSPTrigger.java
=============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/triggerbank/SSPTrigger.java (original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/triggerbank/SSPTrigger.java Fri Jan 30 17:08:20 2015
@@ -13,52 +13,52 @@
* @author Kyle McCarty <[log in to unmask]>
*/
public class SSPTrigger {
- // Trigger data.
- protected final int type;
- protected final int time;
- protected final int data;
-
- // Logger to output status messages.
- protected static Logger logger = LogUtil.create(SSPTrigger.class, new BasicFormatter(SSPTrigger.class.getSimpleName()));
-
- /**
- * Instantiates a new <code>SSPTrigger</code> with the indicated
- * trigger data.
- * @param type - The type of trigger.
- * @param time - The time at which the trigger occurred in ns.
- * @param data - The trigger bit data.
- */
- public SSPTrigger(int type, int time, int data) {
- // Log any issues with processing the trigger.
- if(!SSPTriggerFactory.isKnownTriggerType(type)) {
- logger.warning(String.format("Trigger type %d is not recognized.", type));
- }
-
- // Store the trigger data.
- this.type = type;
- this.time = time;
- this.data = data;
-
- // Note that a trigger was made.
- logger.fine(String.format("Constructed trigger of type %d occurred at time %3d with data %d.",
- type, time, data));
- }
-
- /**
- * Gets the raw, unparsed trigger data bank for this trigger.
- * @return Returns the trigger data bank as an <code>int</code>.
- */
- public int getData() { return data; }
-
- /**
- * Gets the type code for the trigger.
- * @return Returns the trigger type as an <code>int</code>.
- */
- public int getType() { return type; }
-
- /**
- * Gets the time at which the trigger occurred.
- * @return Returns the trigger time as an <code>int</code>.
- */
- public int getTime() { return time; }
-}
+ // Trigger data.
+ protected final int type;
+ protected final int time;
+ protected final int data;
+
+ // Logger to output status messages.
+ protected static Logger logger = LogUtil.create(SSPTrigger.class, new BasicFormatter(SSPTrigger.class.getSimpleName()));
+
+ /**
+ * Instantiates a new <code>SSPTrigger</code> with the indicated
+ * trigger data.
+ * @param type - The type of trigger.
+ * @param time - The time at which the trigger occurred in ns.
+ * @param data - The trigger bit data.
+ */
+ public SSPTrigger(int type, int time, int data) {
+ // Log any issues with processing the trigger.
+ if(!SSPTriggerFactory.isKnownTriggerType(type)) {
+ logger.warning(String.format("Trigger type %d is not recognized.", type));
+ }
+
+ // Store the trigger data.
+ this.type = type;
+ this.time = time;
+ this.data = data;
+
+ // Note that a trigger was made.
+ logger.fine(String.format("Constructed trigger of type %d occurred at time %3d with data %d.",
+ type, time, data));
+ }
+
+ /**
+ * Gets the raw, unparsed trigger data bank for this trigger.
+ * @return Returns the trigger data bank as an <code>int</code>.
+ */
+ public int getData() { return data; }
+
+ /**
+ * Gets the type code for the trigger.
+ * @return Returns the trigger type as an <code>int</code>.
+ */
+ public int getType() { return type; }
+
+ /**
+ * Gets the time at which the trigger occurred.
+ * @return Returns the trigger time as an <code>int</code>.
+ */
+ public int getTime() { return time; }
+}
Modified: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/triggerbank/SSPTriggerFactory.java
=============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/triggerbank/SSPTriggerFactory.java (original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/triggerbank/SSPTriggerFactory.java Fri Jan 30 17:08:20 2015
@@ -10,187 +10,187 @@
* @author Kyle McCarty <[log in to unmask]>
*/
public class SSPTriggerFactory {
- /**
- * Creates an <code>SSPTrigger</code> object representing the given
- * trigger information. If the trigger type is unknown, this creates
- * a <code>SSPTrigger</code> object. Otherwise, an object for the
- * appropriate type of trigger is generated which will provide trigger
- * data parsing options.
- * @param type - The type of trigger.
- * @param time - The time at which the trigger occurred in ns.
- * @param data - The trigger data.
- * @return Returns an <code>SSPTrigger</code> object. This may be
- * a subclass appropriate to the trigger type.
- */
- public static final SSPTrigger makeTrigger(int type, int time, int data) {
- // Check for cosmic triggers.
- if(isCosmicTrigger(type)) {
- return new SSPCosmicTrigger(isTopTrigger(type), time);
- }
-
- // Check for singles triggers.
- else if(isSinglesTrigger(type)) {
- return new SSPSinglesTrigger(isFirstTrigger(type), isTopTrigger(type), time, data);
- }
-
- // Check for pair triggers.
- else if(isPairTrigger(type)) {
- return new SSPPairTrigger(isFirstTrigger(type), time, data);
- }
-
- // Otherwise, this is an unknown trigger type.
- else {
- return new SSPTrigger(type, time, data);
- }
- }
-
- /**
- * Indicates whether the trigger type is a cosmic trigger.
- * @param type - The trigger type.
- * @return Returns <code>true</code> if the trigger is a cosmic
- * trigger and <code>false</code> otherwise.
- */
- public static final boolean isCosmicTrigger(int type) {
- return (type == SSPData.TRIG_TYPE_COSMIC_BOT) || (type == SSPData.TRIG_TYPE_COSMIC_TOP);
- }
-
- /**
- * Indicates whether the trigger type is a singles trigger.
- * @param type - The trigger type.
- * @return Returns <code>true</code> if the trigger is a singles
- * trigger and <code>false</code> otherwise.
- */
- public static final boolean isSinglesTrigger(int type) {
- return (type == SSPData.TRIG_TYPE_SINGLES0_BOT) || (type == SSPData.TRIG_TYPE_SINGLES0_TOP) ||
- (type == SSPData.TRIG_TYPE_SINGLES1_BOT) || (type == SSPData.TRIG_TYPE_SINGLES1_TOP);
- }
-
- /**
- * Indicates whether the trigger type is a pair trigger.
- * @param type - The trigger type.
- * @return Returns <code>true</code> if the trigger is a pair
- * trigger and <code>false</code> otherwise.
- */
- public static final boolean isPairTrigger(int type) {
- return (type == SSPData.TRIG_TYPE_PAIR0) || (type == SSPData.TRIG_TYPE_PAIR1);
- }
-
- /**
- * Indicates whether this is the first trigger of a set of two
- * triggers of the same type. This always returns <code>true</code>
- * for cosmic triggers, since there is only one. It always returns
- * <code>false</code> for unknown trigger types.
- * @param type - The trigger type.
- * @return Returns <code>true</code> if this is the first trigger
- * in a set of two and <code>false</code> otherwise.
- */
- public static final boolean isFirstTrigger(int type) {
- // There is only one cosmic trigger, so all cosmic triggers
- // are the first trigger.
- if(isCosmicTrigger(type)) { return true; }
-
- // Otherwise, singles trigger 0 (either top or bottom) and
- // pair trigger 0 are first triggers.
- else if((type == SSPData.TRIG_TYPE_SINGLES0_BOT) || (type == SSPData.TRIG_TYPE_SINGLES0_TOP) ||
- (type == SSPData.TRIG_TYPE_PAIR0)) {
- return true;
- }
-
- // Anything else is not a first trigger.
- else {
- return false;
- }
- }
-
- /**
- * Indicates whether this is the second trigger of a set of two
- * triggers of the same type. This always returns <code>false</code>
- * for cosmic triggers, since there is only one. It also always
- * returns <code>false</code> for unknown trigger types.
- * @param type - The trigger type.
- * @return Returns <code>true</code> if this is the second trigger
- * in a set of two and <code>false</code> otherwise.
- */
- public static final boolean isSecondTrigger(int type) {
- // There is only one cosmic trigger, so no cosmic triggers
- // are the second trigger.
- if(isCosmicTrigger(type)) { return false; }
-
- // Otherwise, singles trigger 1 (either top or bottom) and
- // pair trigger 1 are second triggers.
- else if((type == SSPData.TRIG_TYPE_SINGLES1_BOT) || (type == SSPData.TRIG_TYPE_SINGLES1_TOP) ||
- (type == SSPData.TRIG_TYPE_PAIR1)) {
- return true;
- }
-
- // Anything else is not a second trigger.
- else { return false; }
- }
-
- /**
- * Indicates whether this trigger originated in the top SPP crate.
- * This always returns <code>true</code> for pair triggers, as they
- * require both crates, and always returns false for unknown trigger
- * types.
- * @param type - The trigger type.
- * @return Returns <code>true</code> if this trigger originated
- * in the top crate and <code>false</code> otherwise.
- */
- public static final boolean isTopTrigger(int type) {
- // Pair triggers require both crates, so this is always true
- // for all triggers of that type.
- if(isPairTrigger(type)) { return true; }
-
- // For singles and cosmic triggers, check the type.
- else if((type == SSPData.TRIG_TYPE_COSMIC_TOP) || (type == SSPData.TRIG_TYPE_SINGLES0_TOP) ||
- (type == SSPData.TRIG_TYPE_SINGLES1_TOP)) {
- return true;
- }
-
- // Otherwise, this is not a (known) top trigger.
- else { return false; }
- }
-
- /**
- * Indicates whether this trigger originated in the bottom SPP crate.
- * This always returns <code>true</code> for pair triggers, as they
- * require both crates, and always returns false for unknown trigger
- * types.
- * @param type - The trigger type.
- * @return Returns <code>true</code> if this trigger originated
- * in the bottom crate and <code>false</code> otherwise.
- */
- public static final boolean isBottomTrigger(int type) {
- // Pair triggers require both crates, so this is always true
- // for all triggers of that type.
- if(isPairTrigger(type)) { return true; }
-
- // For singles and cosmic triggers, check the type.
- else if((type == SSPData.TRIG_TYPE_COSMIC_BOT) || (type == SSPData.TRIG_TYPE_SINGLES0_BOT) ||
- (type == SSPData.TRIG_TYPE_SINGLES1_BOT)) {
- return true;
- }
-
- // Otherwise, this is not a (known) bottom trigger.
- else { return false; }
- }
-
- /**
- * Checks whether the trigger type is from a recognized trigger.
- * @param type - The type code.
- * @return Returns <code>true</code> if the trigger type is of a
- * recognized type and returns <code>false</code> if it is not.
- */
- public static final boolean isKnownTriggerType(int type) {
- // Check against all known trigger types.
- if(type == SSPData.TRIG_TYPE_COSMIC_BOT || type == SSPData.TRIG_TYPE_COSMIC_TOP ||
- type == SSPData.TRIG_TYPE_PAIR0 || type == SSPData.TRIG_TYPE_PAIR1 ||
- type == SSPData.TRIG_TYPE_SINGLES0_BOT || type == SSPData.TRIG_TYPE_SINGLES0_TOP ||
- type == SSPData.TRIG_TYPE_SINGLES1_BOT || type == SSPData.TRIG_TYPE_SINGLES1_TOP) {
- return true;
- }
-
- // If it does not match, it is unknown,
- else { return false; }
- }
+ /**
+ * Creates an <code>SSPTrigger</code> object representing the given
+ * trigger information. If the trigger type is unknown, this creates
+ * a <code>SSPTrigger</code> object. Otherwise, an object for the
+ * appropriate type of trigger is generated which will provide trigger
+ * data parsing options.
+ * @param type - The type of trigger.
+ * @param time - The time at which the trigger occurred in ns.
+ * @param data - The trigger data.
+ * @return Returns an <code>SSPTrigger</code> object. This may be
+ * a subclass appropriate to the trigger type.
+ */
+ public static final SSPTrigger makeTrigger(int type, int time, int data) {
+ // Check for cosmic triggers.
+ if(isCosmicTrigger(type)) {
+ return new SSPCosmicTrigger(isTopTrigger(type), time);
+ }
+
+ // Check for singles triggers.
+ else if(isSinglesTrigger(type)) {
+ return new SSPSinglesTrigger(isFirstTrigger(type), isTopTrigger(type), time, data);
+ }
+
+ // Check for pair triggers.
+ else if(isPairTrigger(type)) {
+ return new SSPPairTrigger(isFirstTrigger(type), time, data);
+ }
+
+ // Otherwise, this is an unknown trigger type.
+ else {
+ return new SSPTrigger(type, time, data);
+ }
+ }
+
+ /**
+ * Indicates whether the trigger type is a cosmic trigger.
+ * @param type - The trigger type.
+ * @return Returns <code>true</code> if the trigger is a cosmic
+ * trigger and <code>false</code> otherwise.
+ */
+ public static final boolean isCosmicTrigger(int type) {
+ return (type == SSPData.TRIG_TYPE_COSMIC_BOT) || (type == SSPData.TRIG_TYPE_COSMIC_TOP);
+ }
+
+ /**
+ * Indicates whether the trigger type is a singles trigger.
+ * @param type - The trigger type.
+ * @return Returns <code>true</code> if the trigger is a singles
+ * trigger and <code>false</code> otherwise.
+ */
+ public static final boolean isSinglesTrigger(int type) {
+ return (type == SSPData.TRIG_TYPE_SINGLES0_BOT) || (type == SSPData.TRIG_TYPE_SINGLES0_TOP) ||
+ (type == SSPData.TRIG_TYPE_SINGLES1_BOT) || (type == SSPData.TRIG_TYPE_SINGLES1_TOP);
+ }
+
+ /**
+ * Indicates whether the trigger type is a pair trigger.
+ * @param type - The trigger type.
+ * @return Returns <code>true</code> if the trigger is a pair
+ * trigger and <code>false</code> otherwise.
+ */
+ public static final boolean isPairTrigger(int type) {
+ return (type == SSPData.TRIG_TYPE_PAIR0) || (type == SSPData.TRIG_TYPE_PAIR1);
+ }
+
+ /**
+ * Indicates whether this is the first trigger of a set of two
+ * triggers of the same type. This always returns <code>true</code>
+ * for cosmic triggers, since there is only one. It always returns
+ * <code>false</code> for unknown trigger types.
+ * @param type - The trigger type.
+ * @return Returns <code>true</code> if this is the first trigger
+ * in a set of two and <code>false</code> otherwise.
+ */
+ public static final boolean isFirstTrigger(int type) {
+ // There is only one cosmic trigger, so all cosmic triggers
+ // are the first trigger.
+ if(isCosmicTrigger(type)) { return true; }
+
+ // Otherwise, singles trigger 0 (either top or bottom) and
+ // pair trigger 0 are first triggers.
+ else if((type == SSPData.TRIG_TYPE_SINGLES0_BOT) || (type == SSPData.TRIG_TYPE_SINGLES0_TOP) ||
+ (type == SSPData.TRIG_TYPE_PAIR0)) {
+ return true;
+ }
+
+ // Anything else is not a first trigger.
+ else {
+ return false;
+ }
+ }
+
+ /**
+ * Indicates whether this is the second trigger of a set of two
+ * triggers of the same type. This always returns <code>false</code>
+ * for cosmic triggers, since there is only one. It also always
+ * returns <code>false</code> for unknown trigger types.
+ * @param type - The trigger type.
+ * @return Returns <code>true</code> if this is the second trigger
+ * in a set of two and <code>false</code> otherwise.
+ */
+ public static final boolean isSecondTrigger(int type) {
+ // There is only one cosmic trigger, so no cosmic triggers
+ // are the second trigger.
+ if(isCosmicTrigger(type)) { return false; }
+
+ // Otherwise, singles trigger 1 (either top or bottom) and
+ // pair trigger 1 are second triggers.
+ else if((type == SSPData.TRIG_TYPE_SINGLES1_BOT) || (type == SSPData.TRIG_TYPE_SINGLES1_TOP) ||
+ (type == SSPData.TRIG_TYPE_PAIR1)) {
+ return true;
+ }
+
+ // Anything else is not a second trigger.
+ else { return false; }
+ }
+
+ /**
+ * Indicates whether this trigger originated in the top SPP crate.
+ * This always returns <code>true</code> for pair triggers, as they
+ * require both crates, and always returns false for unknown trigger
+ * types.
+ * @param type - The trigger type.
+ * @return Returns <code>true</code> if this trigger originated
+ * in the top crate and <code>false</code> otherwise.
+ */
+ public static final boolean isTopTrigger(int type) {
+ // Pair triggers require both crates, so this is always true
+ // for all triggers of that type.
+ if(isPairTrigger(type)) { return true; }
+
+ // For singles and cosmic triggers, check the type.
+ else if((type == SSPData.TRIG_TYPE_COSMIC_TOP) || (type == SSPData.TRIG_TYPE_SINGLES0_TOP) ||
+ (type == SSPData.TRIG_TYPE_SINGLES1_TOP)) {
+ return true;
+ }
+
+ // Otherwise, this is not a (known) top trigger.
+ else { return false; }
+ }
+
+ /**
+ * Indicates whether this trigger originated in the bottom SPP crate.
+ * This always returns <code>true</code> for pair triggers, as they
+ * require both crates, and always returns false for unknown trigger
+ * types.
+ * @param type - The trigger type.
+ * @return Returns <code>true</code> if this trigger originated
+ * in the bottom crate and <code>false</code> otherwise.
+ */
+ public static final boolean isBottomTrigger(int type) {
+ // Pair triggers require both crates, so this is always true
+ // for all triggers of that type.
+ if(isPairTrigger(type)) { return true; }
+
+ // For singles and cosmic triggers, check the type.
+ else if((type == SSPData.TRIG_TYPE_COSMIC_BOT) || (type == SSPData.TRIG_TYPE_SINGLES0_BOT) ||
+ (type == SSPData.TRIG_TYPE_SINGLES1_BOT)) {
+ return true;
+ }
+
+ // Otherwise, this is not a (known) bottom trigger.
+ else { return false; }
+ }
+
+ /**
+ * Checks whether the trigger type is from a recognized trigger.
+ * @param type - The type code.
+ * @return Returns <code>true</code> if the trigger type is of a
+ * recognized type and returns <code>false</code> if it is not.
+ */
+ public static final boolean isKnownTriggerType(int type) {
+ // Check against all known trigger types.
+ if(type == SSPData.TRIG_TYPE_COSMIC_BOT || type == SSPData.TRIG_TYPE_COSMIC_TOP ||
+ type == SSPData.TRIG_TYPE_PAIR0 || type == SSPData.TRIG_TYPE_PAIR1 ||
+ type == SSPData.TRIG_TYPE_SINGLES0_BOT || type == SSPData.TRIG_TYPE_SINGLES0_TOP ||
+ type == SSPData.TRIG_TYPE_SINGLES1_BOT || type == SSPData.TRIG_TYPE_SINGLES1_TOP) {
+ return true;
+ }
+
+ // If it does not match, it is unknown,
+ else { return false; }
+ }
}
|