Author: [log in to unmask]
Date: Tue Aug 4 19:00:29 2015
New Revision: 3337
Log:
fix mismatch between pairs and singles trigger delays
Modified:
java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/SinglesTriggerDriver.java
java/trunk/steering-files/src/main/resources/org/hps/steering/readout/EngineeringRun2015TrigPairs1.lcsim
java/trunk/steering-files/src/main/resources/org/hps/steering/readout/EngineeringRun2015TrigSingles1.lcsim
java/trunk/tracking/src/main/java/org/hps/readout/svt/SimpleSvtReadout.java
Modified: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/SinglesTriggerDriver.java
=============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/SinglesTriggerDriver.java (original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/SinglesTriggerDriver.java Tue Aug 4 19:00:29 2015
@@ -2,31 +2,32 @@
import hep.aida.IHistogram1D;
import hep.aida.IHistogram2D;
-
+import java.util.ArrayList;
+import java.util.LinkedList;
import java.util.List;
-
+import java.util.Queue;
import org.hps.recon.ecal.triggerbank.TriggerModule;
import org.lcsim.event.Cluster;
import org.lcsim.event.EventHeader;
import org.lcsim.util.aida.AIDA;
/**
- * Class <code>SinglesTriggerDriver</code> represents a basic single
- * cluster trigger. It triggers off of seed energy (upper and lower
- * bounds), cluster total energy (upper and lower bounds), and the
- * cluster hit count (lower bound only). All parameters may be set
- * through a steering file.
- *
+ * Class <code>SinglesTriggerDriver</code> represents a basic single cluster
+ * trigger. It triggers off of seed energy (upper and lower bounds), cluster
+ * total energy (upper and lower bounds), and the cluster hit count (lower bound
+ * only). All parameters may be set through a steering file.
+ *
* @author Kyle McCarty <[log in to unmask]>
* @see TriggerDriver
*/
public class SinglesTriggerDriver extends TriggerDriver {
+
// Cut Values
private TriggerModule triggerModule = new TriggerModule();
-
+
// LCIO Collection Names
private String clusterCollectionName = "EcalClusters";
-
+
// AIDA Plots
private AIDA aida = AIDA.defaultInstance();
private IHistogram1D clusterSeedEnergy = aida.histogram1D("Trigger Plots :: Cluster Seed Energy Distribution", 176, 0.0, 2.2);
@@ -37,21 +38,44 @@
private IHistogram1D clusterTotalEnergySingle = aida.histogram1D("Trigger Plots :: Cluster Total Energy Distribution (Passed Single Cuts)", 176, 0.0, 2.2);
private IHistogram2D clusterDistribution = aida.histogram2D("Trigger Plots :: Cluster Seed Distribution", 46, -23, 23, 11, -5.5, 5.5);
private IHistogram2D clusterDistributionSingle = aida.histogram2D("Trigger Plots :: Cluster Seed Distribution (Passed Single Cuts)", 46, -23, 23, 11, -5.5, 5.5);
-
+
+ private final Queue<List<Cluster>> clusterDelayQueue; //the length of this queue sets the trigger delay. Defaults to length 1 (zero delay).
+
+ public SinglesTriggerDriver() {
+ clusterDelayQueue = new LinkedList<List<Cluster>>();
+ clusterDelayQueue.add(new ArrayList<Cluster>());
+ }
+
+ /**
+ * Sets the trigger delay (units of 4-ns FADC clocks). Default of 0.
+ *
+ * @param delay
+ */
+ public void setDelay(int delay) {
+ clusterDelayQueue.clear();
+ for (int i = 0; i <= delay; i++) {
+ clusterDelayQueue.add(new ArrayList<Cluster>());
+ }
+ }
+
@Override
public void process(EventHeader event) {
// Make sure that there are clusters in the event.
- if(event.hasCollection(Cluster.class, clusterCollectionName)) {
+ if (event.hasCollection(Cluster.class, clusterCollectionName)) {
// Get the list of clusters.
List<Cluster> clusterList = event.get(Cluster.class, clusterCollectionName);
-
+
+ // Add the new cluster collection to the queue.
+ clusterDelayQueue.add(clusterList);
+ clusterDelayQueue.remove();
+
// Iterate over the clusters.
- for(Cluster cluster : clusterList) {
+ for (Cluster cluster : clusterList) {
// Get the x and y indices.
int ix = cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("ix");
int iy = cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("iy");
ix = ix > 0 ? ix - 1 : ix;
-
+
// Populate the uncut plots.
clusterSeedEnergy.fill(cluster.getCalorimeterHits().get(0).getCorrectedEnergy(), 1);
clusterTotalEnergy.fill(cluster.getEnergy(), 1);
@@ -63,49 +87,50 @@
// Perform the superclass event processing.
super.process(event);
}
-
- /**
- * Performs cluster singles cuts. These include seed energy, cluster
- * energy, and minimum hit count.
+
+ /**
+ * Performs cluster singles cuts. These include seed energy, cluster energy,
+ * and minimum hit count.
+ *
* @return Returns <code>true</code> if the event passes the trigger
* conditions and <code>false</code> otherwise.
*/
@Override
protected boolean triggerDecision(EventHeader event) {
- // Track whether triggering cluster was seen.
- boolean passTrigger = false;
-
+ // Track whether triggering cluster was seen.
+ boolean passTrigger = false;
+
// Check that there is a cluster object collection.
- if(event.hasCollection(Cluster.class, clusterCollectionName)) {
- // Get the list of hits.
- List<Cluster> clusterList = event.get(Cluster.class, clusterCollectionName);
-
+ if (event.hasCollection(Cluster.class, clusterCollectionName)) {
+ // Get the list of clusters.
+ List<Cluster> clusterList = clusterDelayQueue.peek();
+
// Iterate over the hits and perform the cuts.
triggerLoop:
- for(Cluster cluster : clusterList) {
+ for (Cluster cluster : clusterList) {
// Perform the hit count cut.
- if(!triggerModule.clusterHitCountCut(cluster)) {
+ if (!triggerModule.clusterHitCountCut(cluster)) {
continue triggerLoop;
}
-
+
// Perform the seed hit cut.
- if(!triggerModule.clusterSeedEnergyCut(cluster)) {
+ if (!triggerModule.clusterSeedEnergyCut(cluster)) {
continue triggerLoop;
}
-
+
// Perform the cluster energy cut.
- if(!triggerModule.clusterTotalEnergyCut(cluster)) {
+ if (!triggerModule.clusterTotalEnergyCut(cluster)) {
continue triggerLoop;
}
-
+
// A trigger was seen. Note it.
passTrigger = true;
-
+
// Get the x and y indices.
int ix = cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("ix");
int iy = cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("iy");
ix = ix > 0 ? ix - 1 : ix;
-
+
// Populate the cut plots.
clusterSeedEnergySingle.fill(cluster.getCalorimeterHits().get(0).getCorrectedEnergy(), 1);
clusterTotalEnergySingle.fill(cluster.getEnergy(), 1);
@@ -113,70 +138,77 @@
clusterDistributionSingle.fill(ix, iy, 1);
}
}
-
+
// Return whether a triggering cluster was seen.
return passTrigger;
}
-
- /**
- * Sets the minimum hit count threshold for the trigger. This value
- * is inclusive.
+
+ /**
+ * Sets the minimum hit count threshold for the trigger. This value is
+ * inclusive.
+ *
* @param hitCountThreshold - The value of the threshold.
*/
public void setHitCountThreshold(int hitCountThreshold) {
- triggerModule.setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW, hitCountThreshold);
- }
-
- /**
- * Sets the lower bound for the seed energy threshold on the trigger.
+ triggerModule.setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW, hitCountThreshold);
+ }
+
+ /**
+ * Sets the lower bound for the seed energy threshold on the trigger. This
+ * value is inclusive.
+ *
+ * @param seedEnergyLow - The value of the threshold.
+ */
+ public void setSeedEnergyLowThreshold(double seedEnergyLow) {
+ triggerModule.setCutValue(TriggerModule.CLUSTER_SEED_ENERGY_LOW, seedEnergyLow);
+ }
+
+ /**
+ * Sets the upper bound for the seed energy threshold on the trigger. This
+ * value is inclusive.
+ *
+ * @param seedEnergyHigh - The value of the threshold.
+ */
+ public void setSeedEnergyHighThreshold(double seedEnergyHigh) {
+ triggerModule.setCutValue(TriggerModule.CLUSTER_SEED_ENERGY_HIGH, seedEnergyHigh);
+ }
+
+ /**
+ * Sets the lower bound for the cluster energy threshold on the trigger.
* This value is inclusive.
- * @param seedEnergyLow - The value of the threshold.
- */
- public void setSeedEnergyLowThreshold(double seedEnergyLow) {
- triggerModule.setCutValue(TriggerModule.CLUSTER_SEED_ENERGY_LOW, seedEnergyLow);
- }
-
- /**
- * Sets the upper bound for the seed energy threshold on the trigger.
+ *
+ * @param clusterEnergyLow - The value of the threshold.
+ */
+ public void setClusterEnergyLowThreshold(double clusterEnergyLow) {
+ triggerModule.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW, clusterEnergyLow);
+ }
+
+ /**
+ * Sets the upper bound for the cluster energy threshold on the trigger.
* This value is inclusive.
- * @param seedEnergyHigh - The value of the threshold.
- */
- public void setSeedEnergyHighThreshold(double seedEnergyHigh) {
- triggerModule.setCutValue(TriggerModule.CLUSTER_SEED_ENERGY_HIGH, seedEnergyHigh);
- }
-
- /**
- * Sets the lower bound for the cluster energy threshold on the
- * trigger. This value is inclusive.
- * @param clusterEnergyLow - The value of the threshold.
- */
- public void setClusterEnergyLowThreshold(double clusterEnergyLow) {
- triggerModule.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW, clusterEnergyLow);
- }
-
- /**
- * Sets the upper bound for the cluster energy threshold on the
- * trigger. This value is inclusive.
+ *
* @param clusterEnergyHigh - The value of the threshold.
*/
public void setClusterEnergyHighThreshold(double clusterEnergyHigh) {
- triggerModule.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH, clusterEnergyHigh);
- }
-
+ triggerModule.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH, clusterEnergyHigh);
+ }
+
/**
* Sets the name of the LCIO collection from which clusters are drawn.
+ *
* @param clusterCollectionName - The name of the LCIO collection.
*/
public void setClusterCollectionName(String clusterCollectionName) {
this.clusterCollectionName = clusterCollectionName;
}
-
- /**
- * Sets all cut values for the trigger using a string argument with
- * the format "Emin Emax Nmin".
+
+ /**
+ * Sets all cut values for the trigger using a string argument with the
+ * format "Emin Emax Nmin".
+ *
* @param cuts - The cut string.
*/
public void setCuts(String cuts) {
- triggerModule.setCutValues(true, cuts);
- }
-}
+ triggerModule.setCutValues(true, cuts);
+ }
+}
Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/readout/EngineeringRun2015TrigPairs1.lcsim
=============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/readout/EngineeringRun2015TrigPairs1.lcsim (original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/readout/EngineeringRun2015TrigPairs1.lcsim Tue Aug 4 19:00:29 2015
@@ -43,7 +43,7 @@
<readoutThreshold>12</readoutThreshold>
<triggerThreshold>12</triggerThreshold>
<readoutWindow>50</readoutWindow>
- <readoutLatency>74</readoutLatency>
+ <readoutLatency>77</readoutLatency>
<mode>1</mode>
</driver>
<driver name="EcalConverter" type="org.hps.recon.ecal.EcalRawConverterDriver">
Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/readout/EngineeringRun2015TrigSingles1.lcsim
=============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/readout/EngineeringRun2015TrigSingles1.lcsim (original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/readout/EngineeringRun2015TrigSingles1.lcsim Tue Aug 4 19:00:29 2015
@@ -43,7 +43,7 @@
<readoutThreshold>12</readoutThreshold>
<triggerThreshold>12</triggerThreshold>
<readoutWindow>50</readoutWindow>
- <readoutLatency>74</readoutLatency>
+ <readoutLatency>77</readoutLatency>
<mode>1</mode>
</driver>
<driver name="EcalConverter" type="org.hps.recon.ecal.EcalRawConverterDriver">
@@ -78,6 +78,7 @@
<clusterEnergyLowThreshold>0.400</clusterEnergyLowThreshold>
<clusterEnergyHighThreshold>1.100</clusterEnergyHighThreshold>
<prescale>1</prescale>
+ <delay>3</delay>
<outputFileName>${outputFile}.triggers.singles1</outputFileName>
<!--<verbose>true</verbose>-->
</driver>
Modified: java/trunk/tracking/src/main/java/org/hps/readout/svt/SimpleSvtReadout.java
=============================================================================
--- java/trunk/tracking/src/main/java/org/hps/readout/svt/SimpleSvtReadout.java (original)
+++ java/trunk/tracking/src/main/java/org/hps/readout/svt/SimpleSvtReadout.java Tue Aug 4 19:00:29 2015
@@ -162,8 +162,8 @@
if (useTimingConditions) {
SvtTimingConstants timingConstants = DatabaseConditionsManager.getInstance().getCachedConditions(SvtTimingConstants.SvtTimingConstantsCollection.class, "svt_timing_constants").getCachedData().get(0);
- readoutOffset = 4 * timingConstants.getOffsetPhase();
- readoutLatency = 236.0 + timingConstants.getOffsetTime();
+ readoutOffset = 4 * (timingConstants.getOffsetPhase() + 3);
+ readoutLatency = 248.0 + timingConstants.getOffsetTime();
}
}
|