public class TriggerDiagnosticDriver
extends org.lcsim.util.Driver
TriggeDiagnosticDriver
performs a comparison
between the trigger results reported by the hardware and those
simulated by the LCSim software for a single trigger. SimTriggerDriver
, in order
to function. It also requires the presence of the runtime settings
management driver, DAQConfigurationDriver
. Modifier and Type | Class and Description |
---|---|
private static class |
TriggerDiagnosticDriver.CutType
Enumerable
CutType represents a type of cut which
against which trigger efficiency may be plotted. |
private static class |
TriggerDiagnosticDriver.TriggerType
Enumerable
TriggerType represents the supported
types of trigger for the HPS experiment. |
Modifier and Type | Field and Description |
---|---|
private static int |
ALL_TRIGGERS |
private String |
bankCollectionName
The LCIO collection containing SSP clusters, TI-bits, an
hardware triggers.
|
private int[] |
bins
Stores the number of bins used by the efficiency plots for each
conventional trigger cut.
|
private double[] |
binSize
Store the size of a bin used by the efficiency plots for each
conventional trigger cut.
|
private List<Pair<Long,int[][]>> |
efficiencyPlotEntries
Stores entries for the efficiency over time plot.
|
private long |
firstStartTime
Tracks the start time of the first observed event.
|
private boolean |
hardwareSimFailure
Indicates that at least one hardware-cluster simulated trigger
failed to verify.
|
private int[] |
hardwareTriggerCount
Stores the total number of hardware triggers observed for each
source type.
|
private String |
hitCollectionName
The LCIO collection containing FADC hits.
|
private static int |
LOCAL_ALL_TRIGGERS |
private static int |
LOCAL_MATCHED_TRIGGERS |
private static int |
LOCAL_WINDOW_TRIGGERS |
private long |
localEndTime
Tracks the current time of the current event for the purpose of
identifying the end of a local sample.
|
private long |
localStartTime
Tracks the start time of the current local sample.
|
private long |
localWindowSize
Defines the length of time over which statistics are collected
in order to produce an entry into the efficiency over time plot.
|
private LocalOutputLogger |
logger
The event logger.
|
private int[][] |
matchedTriggerCount
Stores the total number of matched triggers observed for each
source type.
|
private String |
moduleHeader
Defines the basic directory structure for all plots used in the
class.
|
private int |
noiseEventThreshold
The number of hits that must be present in event in order for
it to be ignored as a "noise event."
|
private int |
nsa
The number of samples after a pulse-crossing event to integrate
during hit formation.
|
private int |
nsb
The number of samples before a pulse-crossing event to integrate
during hit formation.
|
private TriggerModule[] |
pairTrigger
Stores the pair trigger settings.
|
private boolean |
printOnHardwareSimFailure
Indicates whether the event log should output in the event that
a hardware-cluster simulated trigger fails to verify.
|
private boolean |
printOnSoftwareSimFailure
Indicates whether the event log should output in the event that
a software-cluster simulated trigger fails to verify.
|
private String |
simTriggerCollectionName
The LCIO collection containing all software-simulated triggers.
|
private int[][] |
simTriggerCount
Stores the total number of simulated triggers observed for each
source type.
|
private TriggerModule[] |
singlesTrigger
Stores the singles trigger settings.
|
private boolean |
skipNoiseEvents
Whether events with more than
noiseEventThreshold hits should be skipped. |
private boolean |
softwareSimFailure
Indicates that at least one software-cluster simulated trigger
failed to verify.
|
private static int |
SOURCE_SIM_CLUSTER |
private static int |
SOURCE_SSP_CLUSTER |
private boolean[] |
tiFlags
Indicates which TI-bits are active in the current event.
|
private TriggerDiagnosticDriver.TriggerType |
triggerType
Indicates the type of trigger that is being tested.
|
private List<TriggerDiagnosticDriver.TriggerType> |
triggerTypes
Stores a list of all trigger types that are used for plotting
efficiency plots.
|
private int |
triggerWindowEnd
Defines the (inclusive) end of the trigger window range.
|
private int |
triggerWindowStart
Defines the (inclusive) start of the trigger window range.
|
private boolean |
verbose
Indicates that all logger messages should be output.
|
private int |
windowWidth
The width of the pulse integration window used to form hits.
|
private double[] |
xMax
Stores the x-axis maximum used by the efficiency plots for each
conventional trigger cut.
|
Constructor and Description |
---|
TriggerDiagnosticDriver() |
Modifier and Type | Method and Description |
---|---|
private int |
compareSimulatedToHardware(Collection<Trigger<?>> simTriggers,
Collection<SSPNumberedTrigger> hardwareTriggers,
Class<?> clusterType)
Compares a collection of simulated triggers to a collection of
triggers reported by the hardware.
|
void |
endOfData()
Outputs the global efficiency data.
|
private static String |
generateLine(int length)
Generates a
String consisting of the indicated
number of '=' characters. |
private static Pair<TIData,SSPData> |
getBanks(org.lcsim.event.EventHeader event,
String bankCollectionName)
Gets the TI bank and the SSP bank from an LCIO collection of
bank objects.
|
private static List<org.lcsim.event.CalorimeterHit> |
getCalorimeterHits(org.lcsim.event.EventHeader event,
String hitCollectionName)
Gets the a of
CalorimeterHit objects from the
argument event from the LCIO collection hitCollectionName . |
private static double |
getPairTriggerTime(Trigger<?> trigger)
A helper method associated with
getTriggerTime that
handles pair triggers, which have either Cluster[] or SSPCluster[] objects as their
source type. |
private String |
getPlotName(String footer,
TriggerDiagnosticDriver.CutType cut,
TriggerDiagnosticDriver.TriggerType tiBit,
int sourceType) |
private String |
getPlotNameEfficiency(TriggerDiagnosticDriver.CutType cut,
TriggerDiagnosticDriver.TriggerType tiBit,
int sourceType) |
private String |
getPlotNameTotal(TriggerDiagnosticDriver.CutType cut,
TriggerDiagnosticDriver.TriggerType tiBit,
int sourceType) |
private String |
getPlotNameVerified(TriggerDiagnosticDriver.CutType cut,
TriggerDiagnosticDriver.TriggerType tiBit,
int sourceType) |
private static String |
getPlotTIName(TriggerDiagnosticDriver.TriggerType tiBit)
Returns the name of the trigger type in the argument, or "All"
if a null argument is given.
|
private static double |
getRatioError(double num,
double sigmaNum,
double den,
double sigmaDen) |
private static double |
getSinglesTriggerTime(Trigger<?> trigger)
A helper method associated with
getTriggerTime that
handles singles triggers, which have either Cluster or SSPCluster objects as their
source type. |
private static String[] |
getTriggerSourceText(Trigger<?> trigger)
Gets a textual representation of the trigger source cluster(s).
|
private static String |
getTriggerText(SSPNumberedTrigger trigger)
Gets a textual representation of the trigger.
|
private static String |
getTriggerText(Trigger<?> trigger,
boolean includeSource)
Gets a textual representation of the trigger.
|
private static double |
getTriggerTime(Trigger<?> trigger)
Gets the trigger time for an arbitrary trigger object as is
appropriate to its source object type.
|
private static boolean |
isPairTrigger(Trigger<?> trigger)
Indicates whether a generic trigger object is a pair trigger.
|
private static boolean |
isSinglesTrigger(Trigger<?> trigger)
Indicates whether a generic trigger object is a singles trigger.
|
private static int |
max(int... values)
Gets the maximum value in a set of integers.
|
private void |
plotTrigger(Trigger<?> trigger,
boolean[] activeTIBits,
boolean verified) |
void |
process(org.lcsim.event.EventHeader event)
Processes an event and performs trigger verification.
|
void |
setBankCollectionName(String collection)
Sets the name of LCIO collection containing the trigger banks.
|
void |
setClusterHitCountBinSize(double value) |
void |
setClusterHitCountXMax(double value) |
void |
setClusterSeedEnergyBinSize(double value) |
void |
setClusterSeedEnergyXMax(double value) |
void |
setClusterTotalEnergyBinSize(double value) |
void |
setClusterTotalEnergyXMax(double value) |
void |
setHitCollectionName(String collection)
Sets the name of LCIO collection containing hits.
|
void |
setLocalWindowSize(int size)
Defines the size of the local window for use in the efficiency
over time plot.
|
void |
setNoiseThreshold(int threshold)
Sets the total number of hits that must be present in an event
in order for it to be considered a noise event.
|
void |
setPairCoplanarityBinSize(double value) |
void |
setPairCoplanarityXMax(double value) |
void |
setPairEnergyDiffBinSize(double value) |
void |
setPairEnergyDiffXMax(double value) |
void |
setPairEnergySlopeBinSize(double value) |
void |
setPairEnergySlopeXMax(double value) |
void |
setPairEnergySumBinSize(double value) |
void |
setPairEnergySumXMax(double value) |
void |
setPairTimeCoincidenceBinSize(double value) |
void |
setPairTimeCoincidenceXMax(double value) |
void |
setPrintOnHardwareSimFailure(boolean state)
Indicates whether the event log should be printed when a trigger
which was simulated from a hardware-reported (SSP) cluster fails
to verify.
|
void |
setPrintOnSoftwareSimFailure(boolean state)
Indicates whether the event log should be printed when a trigger
which was simulated from a software-constructed cluster fails
to verify.
|
void |
setSkipNoiseEvents(boolean state)
Indicates whether events which exceed a certain number of total
hits, defined by
noiseEventThreshold , should be
treated as noise events and skipped. |
private boolean |
setTIFlags(TIData tiBank)
Sets the TI-bit flags for each trigger type and also indicates
whether or not at least one TI-bit was found active.
|
void |
setTriggerCollectionName(String collection)
Sets the name of LCIO collection containing simulated triggers.
|
void |
setTriggerType(String type)
Sets the which of the triggers this driver should verify.
|
void |
setTriggerWindowEnd(int value)
Sets the end of the trigger window range.
|
void |
setTriggerWindowStart(int value)
Sets the start of the trigger window range.
|
void |
setVerbose(boolean state)
Sets whether the full event verification summary should be printed
on every event or not.
|
void |
startOfData()
Connects the driver to the
ConfigurationManager to
obtain trigger settings. |
private void |
triggerVerification(SimTriggerData simTriggers,
SSPData sspBank,
TriggerDiagnosticDriver.TriggerType triggerType)
Performs trigger verification for the specified trigger.
|
private String hitCollectionName
private String bankCollectionName
private String simTriggerCollectionName
private boolean[] tiFlags
TriggerType.ordinal()
.
Values set by the method setTIFlags(TIData)
and is
called by the process(EventHeader)
method.private TriggerModule[] singlesTrigger
private TriggerModule[] pairTrigger
private String moduleHeader
startOfData
.private int[] bins
CutType
enumerable for all values for
which isSpecial()
is false. Note that this variable
is defined as a function of the variable arrays xMax
and binSize
during
startOfData()
.private double[] xMax
CutType
enumerable for all values for
which isSpecial()
is false.private double[] binSize
CutType
enumerable for all values for
which isSpecial()
is false.private List<TriggerDiagnosticDriver.TriggerType> triggerTypes
startOfData
.private static final int SOURCE_SIM_CLUSTER
private static final int SOURCE_SSP_CLUSTER
private static final int ALL_TRIGGERS
private static final int LOCAL_WINDOW_TRIGGERS
private int[][] simTriggerCount
SOURCE_SIM_CLUSTER
and SOURCE_SSP_CLUSTER
. The second
array index
defines one of several conditions. This includes triggers seen
when a certain TI bit was active, with these indices defined by TriggerType.ordinal()
, all triggers
seen in general,
defined by ALL_TRIGGERS
, and all triggers seen in
the local window, defined by LOCAL_WINDOW_TRIGGERS
.private int[] hardwareTriggerCount
SOURCE_SIM_CLUSTER
and SOURCE_SSP_CLUSTER
. The second
array index
defines one of several conditions. This includes triggers seen
when a certain TI bit was active, with these indices defined by TriggerType.ordinal()
, all triggers
seen in general,
defined by ALL_TRIGGERS
, and all triggers seen in
the local window, defined by LOCAL_WINDOW_TRIGGERS
.private int[][] matchedTriggerCount
SOURCE_SIM_CLUSTER
and SOURCE_SSP_CLUSTER
. The second
array index
defines one of several conditions. This includes triggers seen
when a certain TI bit was active, with these indices defined by TriggerType.ordinal()
, all triggers
seen in general,
defined by ALL_TRIGGERS
, and all triggers seen in
the local window, defined by LOCAL_WINDOW_TRIGGERS
.private boolean verbose
private boolean softwareSimFailure
compareSimulatedToHardware
method.private boolean hardwareSimFailure
compareSimulatedToHardware
method.private boolean printOnSoftwareSimFailure
private boolean printOnHardwareSimFailure
private LocalOutputLogger logger
private int nsb
private int nsa
private int windowWidth
private int noiseEventThreshold
private TriggerDiagnosticDriver.TriggerType triggerType
private boolean skipNoiseEvents
noiseEventThreshold
hits should be skipped.private int triggerWindowEnd
private int triggerWindowStart
private long localWindowSize
private long localEndTime
private long localStartTime
private long firstStartTime
private static final int LOCAL_ALL_TRIGGERS
private static final int LOCAL_MATCHED_TRIGGERS
private List<Pair<Long,int[][]>> efficiencyPlotEntries
SOURCE_SIM_CLUSTER
and
SOURCE_SSP_CLUSTER
.
The second array index defines to observed and matched triggers,
and corresponds to the indices defined by the variables LOCAL_ALL_TRIGGERS
and
LOCAL_MATCHED_TRIGGERS
.public void endOfData()
endOfData
in class org.lcsim.util.Driver
public void process(org.lcsim.event.EventHeader event)
ConfigurationManager
has been
initialized. Handles testing for noise events and extracting
basic event data for analysis, and also ensuring that everything
necessary is present. Event trigger data is actually processed
separately by the method triggerVerification
. Method
also handles logger output.process
in class org.lcsim.util.Driver
event
- - The data object containing all event data.public void startOfData()
ConfigurationManager
to
obtain trigger settings.startOfData
in class org.lcsim.util.Driver
private int compareSimulatedToHardware(Collection<Trigger<?>> simTriggers, Collection<SSPNumberedTrigger> hardwareTriggers, Class<?> clusterType)
simTriggers
- - A collection containing Trigger
objects. The source objects for the
Trigger
objects
may be either Cluster
or SSPCluster
, as
well as a size two array of either of the above.hardwareTriggers
- - A collection of SSP hardware triggers.
These must be of type SSPNumberedTrigger
.clusterType
- - Specifies which of the four valid object
types is used as the source of the Trigger
objects
defined in the simTriggers
argument.private static final String generateLine(int length)
String
consisting of the indicated
number of '=' characters.length
- - The number of characters that should be present
in the String
.String
of '=' characters.private static Pair<TIData,SSPData> getBanks(org.lcsim.event.EventHeader event, String bankCollectionName)
event
- - The event containing the LCIO collections.bankCollectionName
- - The name of bank collection.Pair
object where the first element
is the TI bank object and the second is the SSP bank object.private static final List<org.lcsim.event.CalorimeterHit> getCalorimeterHits(org.lcsim.event.EventHeader event, String hitCollectionName)
CalorimeterHit
objects from the
argument event from the LCIO collection hitCollectionName
.event
- - The event object.hitCollectionName
- - The name of the hit collection.CalorimeterHit
objects, or returns null
if no
collection was found.private static final double getPairTriggerTime(Trigger<?> trigger) throws IllegalArgumentException
getTriggerTime
that
handles pair triggers, which have either Cluster[]
or SSPCluster[]
objects as their
source type. This
method should not be called directly.trigger
- - The trigger object for which to obtain the
trigger time.double
.IllegalArgumentException
- Occurs if the trigger source
object type is anything other than Cluster[]
or SSPCluster[]
.private final String getPlotName(String footer, TriggerDiagnosticDriver.CutType cut, TriggerDiagnosticDriver.TriggerType tiBit, int sourceType)
private final String getPlotNameEfficiency(TriggerDiagnosticDriver.CutType cut, TriggerDiagnosticDriver.TriggerType tiBit, int sourceType)
private final String getPlotNameTotal(TriggerDiagnosticDriver.CutType cut, TriggerDiagnosticDriver.TriggerType tiBit, int sourceType)
private final String getPlotNameVerified(TriggerDiagnosticDriver.CutType cut, TriggerDiagnosticDriver.TriggerType tiBit, int sourceType)
private static final String getPlotTIName(TriggerDiagnosticDriver.TriggerType tiBit)
tiBit
- - The trigger type.private static final double getRatioError(double num, double sigmaNum, double den, double sigmaDen)
private static final double getSinglesTriggerTime(Trigger<?> trigger) throws IllegalArgumentException
getTriggerTime
that
handles singles triggers, which have either Cluster
or SSPCluster
objects as their
source type. This
method should not be called directly.trigger
- - The trigger object for which to obtain the
trigger time.double
.IllegalArgumentException
- Occurs if the trigger source
object type is anything other than Cluster
or SSPCluster
.private static final String[] getTriggerSourceText(Trigger<?> trigger) throws IllegalArgumentException
trigger
- - The trigger for which to obtain the textual
representation.String
array containing a textual
representation of the trigger's source cluster(s). Each entry in
the array represents an individual cluster.IllegalArgumentException
- Occurs if the trigger source
object type is anything other than Cluster
, SSPCluster
, or an array of either of these
two
object types.private static final String getTriggerText(Trigger<?> trigger, boolean includeSource) throws IllegalArgumentException
trigger
- - The trigger for which to obtain the textual
representation.includeSource
- - Indicates whether a textual representation
of the source objects for the trigger should be included. These
will be present on a new line, one for each cluster.String
object representing the
trigger. If includeSource
is set to true, this will
be more than one line.IllegalArgumentException
- Occurs if the trigger source
object type is anything other than Cluster
, SSPCluster
, or an array of either of these
two
object types.private static final String getTriggerText(SSPNumberedTrigger trigger)
trigger
- - The trigger for which to obtain the textual
representation.String
object representing the
trigger.IllegalArgumentException
- Occurs if the trigger subclass
is not either an SSPSinglesTrigger
object or an SSPPairTrigger
object.private static final double getTriggerTime(Trigger<?> trigger) throws IllegalArgumentException
trigger
- - The trigger object for which to obtain the
trigger time.double
.IllegalArgumentException
- Occurs if the trigger source
object type is anything other than Cluster
, SSPCluster
, or a size-two array of either
of the
previous two object types.private static final boolean isPairTrigger(Trigger<?> trigger)
trigger
- - The trigger to check.true
in the case that the source
object is a Cluster[]
, or SSPCluster[]
.
Otherwise, returns false
.private static final boolean isSinglesTrigger(Trigger<?> trigger)
trigger
- - The trigger to check.true
in the case that the source
object is a Cluster
or SSPCluster
.
Otherwise, returns false
.private static final int max(int... values) throws IllegalArgumentException
values
- - The values from which to find the maximum.IllegalArgumentException
- Occurs if no arguments are given.private void plotTrigger(Trigger<?> trigger, boolean[] activeTIBits, boolean verified)
private boolean setTIFlags(TIData tiBank)
tiBank
- - The TI bank from which to set the flags.true
if at least one TI-bit was
found active, and false
if no bits were active.private void triggerVerification(SimTriggerData simTriggers, SSPData sspBank, TriggerDiagnosticDriver.TriggerType triggerType)
simTriggers
- - A data object containing all simulated
triggers for all trigger types.sspBank
- - The data bank containing all of the triggers
reported by the hardware.triggerType
- - The trigger which is to be verified.public void setBankCollectionName(String collection)
collection
- - The collection name.public void setHitCollectionName(String collection)
collection
- - The collection name.public void setLocalWindowSize(int size)
size
- - The duration of local efficiency measurements.public void setNoiseThreshold(int threshold)
skipNoiseEvents
is set to true
.threshold
- - The noise hit threshold.public void setPrintOnHardwareSimFailure(boolean state)
state
- - true
indicates that the event log
should be printed, and false
that it should not.public void setPrintOnSoftwareSimFailure(boolean state)
state
- - true
indicates that the event log
should be printed, and false
that it should not.public void setSkipNoiseEvents(boolean state)
noiseEventThreshold
, should be
treated as noise events and skipped.state
- - true
causes noise events to be skipped
and false
does not.public void setTriggerCollectionName(String collection)
collection
- - The collection name.public void setTriggerType(String type) throws IllegalArgumentException
type
- - The String
indicating which trigger
should be verified.IllegalArgumentException
- Occurs if any type name is
besides those specified above is used.public void setTriggerWindowEnd(int value)
value
- - The end of the trigger window range. This value
is inclusive.public void setTriggerWindowStart(int value)
value
- - The start of the trigger window range. This value
is inclusive.public void setVerbose(boolean state)
state
- - true
prints the event summary and false
does not.public void setClusterSeedEnergyXMax(double value)
public void setClusterTotalEnergyXMax(double value)
public void setClusterHitCountXMax(double value)
public void setPairEnergySumXMax(double value)
public void setPairEnergyDiffXMax(double value)
public void setPairEnergySlopeXMax(double value)
public void setPairCoplanarityXMax(double value)
public void setPairTimeCoincidenceXMax(double value)
public void setClusterSeedEnergyBinSize(double value)
public void setClusterTotalEnergyBinSize(double value)
public void setClusterHitCountBinSize(double value)
public void setPairEnergySumBinSize(double value)
public void setPairEnergyDiffBinSize(double value)
public void setPairEnergySlopeBinSize(double value)
public void setPairCoplanarityBinSize(double value)
public void setPairTimeCoincidenceBinSize(double value)
Copyright © 2019. All rights reserved.