Simulates a sliding window trigger. More...
Classes | |
struct | Config |
struct | ThresholdPlotInfo_t |
All information needed to generate plots for a specific threshold. More... | |
Public Types | |
using | microseconds = util::quantities::intervals::microseconds |
using | nanoseconds = util::quantities::intervals::nanoseconds |
using | Parameters = art::EDProducer::Table< Config > |
Public Member Functions | |
SlidingWindowTriggerSimulation (Parameters const &config) | |
virtual void | beginJob () override |
Initializes the plots. More... | |
virtual void | produce (art::Event &event) override |
Runs the simulation and saves the results into the art event. More... | |
virtual void | endJob () override |
Prints end-of-job summaries. More... | |
Private Types | |
using | TriggerInfo_t = details::TriggerInfo_t |
Type alias. More... | |
using | InputTriggerGate_t = icarus::trigger::SlidingWindowPatternAlg::InputTriggerGate_t |
Type of trigger gate extracted from the input event. More... | |
using | TriggerGates_t = icarus::trigger::SlidingWindowPatternAlg::TriggerGates_t |
List of trigger gates. More... | |
using | WindowTriggerInfo_t = icarus::trigger::SlidingWindowPatternAlg::AllTriggerInfo_t |
Data structure to communicate internally a trigger response. More... | |
using | BinnedContent_t = icarus::ns::util::FixedBins< double > |
Content for future histograms, binned. More... | |
Private Member Functions | |
void | initializePlots () |
Initializes the full set of plots (all ADC thresholds). More... | |
void | finalizePlots () |
Creates summary plots from proto-histogram data. More... | |
void | makeThresholdPlots (std::string const &threshold, icarus::trigger::PlotSandbox &plots, ThresholdPlotInfo_t const &plotInfo) |
void | makeEventPlots () |
Creates in the main sandbox all event-wide plots. More... | |
void | plotEvent (art::Event const &event, detinfo::DetectorTimings const &detTimings) |
Fills event-wide plots. More... | |
void | plotTriggerResponse (std::size_t iThr, std::string const &thrTag, WindowTriggerInfo_t const &triggerInfo, detinfo::DetectorTimings const &detTimings) |
Fills the plots for threshold index iThr with trigger information. More... | |
WindowTriggerInfo_t | produceForThreshold (art::Event &event, detinfo::DetectorTimings const &detTimings, ApplyBeamGateClass const &beamGate, std::size_t const iThr, std::string const &thrTag) |
Performs the simulation for the specified ADC threshold. More... | |
raw::Trigger | triggerInfoToTriggerData (detinfo::DetectorTimings const &detTimings, unsigned int triggerNumber, WindowTriggerInfo_t const &info) const |
Converts the trigger information into a raw::Trigger object. More... | |
void | printSummary () const |
Prints the summary of fired triggers on screen. More... | |
TH1 * | makeHistogramFromBinnedContent (icarus::trigger::PlotSandbox &plots, std::string const &name, std::string const &title, BinnedContent_t const &binnedContent) const |
Creates and returns a 1D histogram filled with binnedContent . More... | |
icarus::trigger::ApplyBeamGateClass | makeMyBeamGate (detinfo::DetectorClocksData data) const |
Shortcut to create an ApplyBeamGate with the current configuration. More... | |
icarus::trigger::ApplyBeamGateClass | makeMyBeamGate (art::Event const *event=nullptr) const |
icarus::trigger::ApplyBeamGateClass | makeMyBeamGate (art::Event const &event) const |
Private Member Functions inherited from lar::UncopiableClass | |
UncopiableClass ()=default | |
Default constructor. More... | |
~UncopiableClass ()=default | |
Default destructor. More... | |
UncopiableClass (UncopiableClass const &)=delete | |
Deleted copy and move constructors and assignments. More... | |
UncopiableClass (UncopiableClass &&)=default | |
UncopiableClass & | operator= (UncopiableClass const &)=delete |
UncopiableClass & | operator= (UncopiableClass &&)=default |
Private Member Functions inherited from lar::UnmovableClass | |
UnmovableClass ()=default | |
Default constructor. More... | |
~UnmovableClass ()=default | |
Default destructor. More... | |
UnmovableClass (UnmovableClass const &)=default | |
Default copy constructor and assignment. More... | |
UnmovableClass & | operator= (UnmovableClass const &)=default |
UnmovableClass (UnmovableClass &&)=delete | |
Deleted move constructor and assignment. More... | |
UnmovableClass & | operator= (UnmovableClass &&)=delete |
Static Private Member Functions | |
static TriggerGates_t | readTriggerGates (art::Event const &event, art::InputTag const &dataTag) |
static double | eventTimestampInSeconds (art::Timestamp const &time) |
Returns the time of the event in seconds from The Epoch. More... | |
static double | eventTimestampInSeconds (art::Event const &event) |
Private Attributes | |
std::map< std::string, art::InputTag > | fADCthresholds |
Name of ADC thresholds to read, and the input tag connected to their data. More... | |
WindowPattern const | fPattern |
Configured sliding window requirement pattern. More... | |
microseconds | fBeamGateDuration |
Duration of the gate during with global optical triggers are accepted. More... | |
microseconds | fBeamGateStart |
Start of the beam gate with respect to BeamGate() . More... | |
std::uint32_t | fBeamBits |
Bits for the beam gate being simulated. More... | |
nanoseconds | fTriggerTimeResolution |
Trigger resolution in time. More... | |
double | fEventTimeBinning |
Trigger time plot binning [s]. More... | |
std::string const | fLogCategory |
Message facility stream category for output. More... | |
art::TFileDirectory | fOutputDir |
ROOT directory where all the plots are written. More... | |
std::vector< std::string > | fOutputInstances |
Output data product instance names (same order as fADCthresholds ). More... | |
icarus::trigger::WindowTopologyManager | fWindowMapMan |
Mapping of each sliding window with location and topological information. More... | |
std::optional < icarus::trigger::SlidingWindowPatternAlg > | fPatternAlg |
Pattern algorithm. More... | |
icarus::trigger::PlotSandbox | fPlots |
All plots in one practical sandbox. More... | |
ThresholdPlotInfo_t | fEventPlotInfo |
Proto-histogram information in a convenient packet; event-wide. More... | |
std::vector< ThresholdPlotInfo_t > | fThresholdPlots |
Proto-histogram information in a not-so-practical array; per threshold. More... | |
std::vector< std::atomic < unsigned int > > | fTriggerCount |
std::atomic< unsigned int > | fTotalEvents { 0U } |
Count of opened gates. More... | |
icarus::ns::util::ThreadSafeChangeMonitor < icarus::trigger::ApplyBeamGateClass > | fGateChangeCheck |
Functor returning whether a gate has changed. More... | |
Simulates a sliding window trigger.
This module produces raw::Trigger
objects each representing the outcome of some trigger logic applied to a discriminated input ("trigger primitives").
A trigger primitive is a two-level function of time which describes when that primitive is on and when it is off. Trigger primitives are given as input to this module and their origin may vary, but the standard source in ICARUS is single trigger request (LVDS).
This module applies a sliding window pattern to the input: the pattern consists of a requirement on the main window and optional additional requirements on the neighbouring windows. This module rebases the configured pattern on each of the available windows, evaluates the requirement of the pattern in that configuration, and decides whether those requirements are met. The general trigger is considered passed if any of the rebased patterns satisfies the requirement at any time, and no special treatment is performed in case multiple windows fulfil them, except that the trigger time is driven by the earliest of the satisfied patterns.
A single trigger pattern is configured for each instance of the module, while multiple input sets (e.g. with different discrimination thresholds) can be processed on the same pattern by the same module instance. Conversely, testing a different pattern requires the instantiation of a new module.
TriggerGatesTag
(string, mandatory): name of the module instance which produced the trigger primitives to be used as input; it must not include any instance name, as the instance names will be automatically added from Thresholds
parameter. The typical trigger primitives used as input are LVDS discriminated output combined into trigger windows (e.g. from icarus::trigger::SlidingWindowTrigger
module).Thresholds
(list of names, mandatory): list of the discrimination thresholds to consider. A data product containing a digital signal is read for each one of the thresholds, and the tag of the data product is expected to be the instance name in this configuration parameter for the module label set in TriggerGatesTag
(e.g. for a threshold of "60"
, supposedly 60 ADC counts, and with TriggerGatesTag
set to "TrigSlidingWindows"
, the data product tag would be TrigSlidingWindows:60
).KeepThresholdName
(flag, optional): by default, output data products have each an instance name according to their threshold (from the Threshold
parameter), unless there is only one threshold specified. If this parameter is specified as true
, the output data product always includes the threshold instance name, even when there is only one threshold specified. If this parameter is specified as false
, if there is only one threshold the default behaviour (of not adding an instance name) is confirmed; otherwise, it is a configuration error to have this parameter set to false
.Pattern
(configuration table, mandatory): describes the sliding window pattern; the configuration format for a pattern is described under icarus::trigger::ns::fhicl::WindowPatternConfig
.BeamGateDuration
(time, mandatory): the duration of the beam gate; the time requires the unit to be explicitly specified: use "1.6 us"
for BNB, 9.5 us
for NuMI (also available as BNB_settings.spill_duration
and NuMI_settings.spill_duration
in trigger_icarus.fcl
);BeamGateStart
(time, default: 0_us
): how long after theBeamBits
(bitmask as 32-bit integral number): bits to be set in the produced raw::Trigger
objects (see also daq::TriggerDecoder
tool).LogCategory
(string, default SlidingWindowTriggerSimulation
): name of category used to stream messages from this module into message facility.An example job configuration is provided as simulate_sliding_window_trigger_icarus.fcl
.
std::vector<raw::Trigger>
(one instance per ADC threshold): list of triggers fired according to the configured trigger definition; there is one collection (and data product) per ADC threshold, and the data product has the same instance name as the input data one, unless there is only one threshold (see TriggerGatesTag
, Thresholds
and KeepThresholdName
configuration parameters); currently only at most one trigger is emitted, with time stamp matching the first time the trigger criteria are satisfied. All triggers feature the bits specified in BeamBits
configuration parameter. This section describes the trigger logic algorithm used in icarus::trigger::SlidingWindowTriggerSimulation
and its assumptions. Nevertheless, more up-to-date information can be found in SlidingWindowTrigger
module (for the combination of the LVDS signals into window-wide gates) and in icarus::trigger::SlidingWindowPatternAlg
, which applies the configured pattern logic to the input.
The module receives as input a multi-level trigger gate for each of the windows to be considered. On the first input (i.e. the first event), that input is parsed to learn the windows and their relative position from the input trigger gates. This topology will be used to apply the configured patterns. On the following events, their input is checked to confirm the compatibility of the composition of its windows with the one from that first event (both aspects are handled by an icarus::trigger::WindowTopologyManager
object).
All multi-level gates are set in coincidence with the beam gate by multiplying the multi-level and the beam gates. Because of this, trigger gates are suppressed everywhere except than during the beam gate. The beam gate opens at a time configured in DetectorClocks
service provider (detinfo::DetectorClocks::BeamGateTime()
), optionally offset (BeamGateStart
), and has a duration configured in this module (BeamGateDuration
).
The algorithm handles independently multiple trigger patterns. On each input, each configured pattern is applied based on the window topology. Each pattern describes a minimum level of the trigger gate in the window, that usually means the number of LVDS signals in coincidence at any given time ("majority"). A pattern may have requirements on the neighbouring windows in addition to the main one. The pattern is satisfied if all involved windows pass their specific requirements at the same time (coincidence between windows). Each pattern is applied in turn to each of the windows (which is the "main" window). The neighborhood described in the pattern is applied with respect to that main window. The trigger fires if one or more of the windows satisfy the pattern, and the trigger time is the one of the earliest satisfied pattern (more precisely, the earliest tick when the coincidence required by that pattern is satisfied).* All windows in the detector are considered independently, but the supported patterns may only include components in the same cryostat. Therefore, triggers are effectively on a single cryostat. An object of class icarus::trigger::SlidingWindowPatternAlg
applies this logic: see its documentation for the most up-to-date details.
Eventually, for each event there are as many different trigger responses as how many different patterns are configured (Patterns
configuration parameter), times how many ADC thresholds are provided in input, configured in Thresholds
.
This module does not build the trigger gates of the sliding windows, but rather it takes them as input (see e.g. SlidingWindowTrigger
module). Window topology (size of the windows and their relations) is stored in icarus::trigger::WindowChannelMap
objects, and its construction is delegated to icarus::trigger::WindowTopologyAlg
(under the hood of the WindowTopologyManager
class) which learns it from the actual trigger gate input rather than on explicit configuration. Pattern definitions and configuration are defined in icarus::trigger::WindowPattern
and icarus::trigger::ns::fhicl::WindowPatternConfig
respectively. Trigger simulation is delegated to icarus::trigger::SlidingWindowPatternAlg
.
Definition at line 253 of file SlidingWindowTriggerSimulation_module.cc.
|
private |
Content for future histograms, binned.
Definition at line 368 of file SlidingWindowTriggerSimulation_module.cc.
|
private |
Type of trigger gate extracted from the input event.
Definition at line 357 of file SlidingWindowTriggerSimulation_module.cc.
using icarus::trigger::SlidingWindowTriggerSimulation::microseconds = util::quantities::intervals::microseconds |
Definition at line 260 of file SlidingWindowTriggerSimulation_module.cc.
using icarus::trigger::SlidingWindowTriggerSimulation::nanoseconds = util::quantities::intervals::nanoseconds |
Definition at line 261 of file SlidingWindowTriggerSimulation_module.cc.
using icarus::trigger::SlidingWindowTriggerSimulation::Parameters = art::EDProducer::Table<Config> |
Definition at line 327 of file SlidingWindowTriggerSimulation_module.cc.
|
private |
List of trigger gates.
Definition at line 361 of file SlidingWindowTriggerSimulation_module.cc.
|
private |
Type alias.
Definition at line 353 of file SlidingWindowTriggerSimulation_module.cc.
|
private |
Data structure to communicate internally a trigger response.
Definition at line 365 of file SlidingWindowTriggerSimulation_module.cc.
|
explicit |
Definition at line 565 of file SlidingWindowTriggerSimulation_module.cc.
|
overridevirtual |
Initializes the plots.
Definition at line 657 of file SlidingWindowTriggerSimulation_module.cc.
|
overridevirtual |
Prints end-of-job summaries.
Definition at line 703 of file SlidingWindowTriggerSimulation_module.cc.
|
staticprivate |
Returns the time of the event in seconds from The Epoch.
Definition at line 1171 of file SlidingWindowTriggerSimulation_module.cc.
|
staticprivate |
Definition at line 1182 of file SlidingWindowTriggerSimulation_module.cc.
|
private |
Creates summary plots from proto-histogram data.
Definition at line 857 of file SlidingWindowTriggerSimulation_module.cc.
|
private |
Initializes the full set of plots (all ADC thresholds).
Definition at line 713 of file SlidingWindowTriggerSimulation_module.cc.
|
private |
Creates in the main sandbox all event-wide plots.
Definition at line 926 of file SlidingWindowTriggerSimulation_module.cc.
|
private |
Creates and returns a 1D histogram filled with binnedContent
.
Definition at line 1145 of file SlidingWindowTriggerSimulation_module.cc.
|
inlineprivate |
Shortcut to create an ApplyBeamGate
with the current configuration.
Definition at line 530 of file SlidingWindowTriggerSimulation_module.cc.
|
inlineprivate |
Definition at line 539 of file SlidingWindowTriggerSimulation_module.cc.
|
inlineprivate |
Definition at line 542 of file SlidingWindowTriggerSimulation_module.cc.
|
private |
Creates in plots
sandbox all plots for threshold threshold
from data in plotInfo
.
Definition at line 873 of file SlidingWindowTriggerSimulation_module.cc.
|
private |
Fills event-wide plots.
Definition at line 1007 of file SlidingWindowTriggerSimulation_module.cc.
|
private |
Fills the plots for threshold index iThr
with trigger information.
Definition at line 1020 of file SlidingWindowTriggerSimulation_module.cc.
|
private |
Prints the summary of fired triggers on screen.
Definition at line 1074 of file SlidingWindowTriggerSimulation_module.cc.
|
overridevirtual |
Runs the simulation and saves the results into the art event.
Definition at line 665 of file SlidingWindowTriggerSimulation_module.cc.
|
private |
Performs the simulation for the specified ADC threshold.
event | art event to read data from and put results into |
iThr | index of the threshold in the configuration |
thr | value of the threshold (ADC counts) |
For the given threshold, the simulation of the configured trigger is performed. The input data is read from the event (the source tag is from the module configuration), simulation is performed, auxiliary plots are drawn and a raw::Trigger
collection is stored into the event.
The stored collection contains either one or zero raw::Trigger
elements.
The simulation itself is performed by the simulate()
method.
Definition at line 954 of file SlidingWindowTriggerSimulation_module.cc.
|
staticprivate |
Reads a set of input gates from the event
InputTriggerGate_t
Definition at line 1119 of file SlidingWindowTriggerSimulation_module.cc.
|
private |
Converts the trigger information into a raw::Trigger
object.
triggerNumber | the unique number to assign to this trigger |
info | the information about the fired trigger |
raw::Trigger
object with all the information encodedThe trigger described by info
is encoded into a raw::Trigger
object. The trigger must have fired.
Definition at line 1102 of file SlidingWindowTriggerSimulation_module.cc.
|
private |
Name of ADC thresholds to read, and the input tag connected to their data.
Definition at line 382 of file SlidingWindowTriggerSimulation_module.cc.
|
private |
Bits for the beam gate being simulated.
Definition at line 393 of file SlidingWindowTriggerSimulation_module.cc.
|
private |
Duration of the gate during with global optical triggers are accepted.
Definition at line 388 of file SlidingWindowTriggerSimulation_module.cc.
|
private |
Start of the beam gate with respect to BeamGate()
.
Definition at line 391 of file SlidingWindowTriggerSimulation_module.cc.
|
private |
Proto-histogram information in a convenient packet; event-wide.
Definition at line 429 of file SlidingWindowTriggerSimulation_module.cc.
|
private |
Trigger time plot binning [s].
Definition at line 397 of file SlidingWindowTriggerSimulation_module.cc.
|
private |
Functor returning whether a gate has changed.
Definition at line 441 of file SlidingWindowTriggerSimulation_module.cc.
|
private |
Message facility stream category for output.
Definition at line 400 of file SlidingWindowTriggerSimulation_module.cc.
|
private |
ROOT directory where all the plots are written.
Definition at line 408 of file SlidingWindowTriggerSimulation_module.cc.
|
private |
Output data product instance names (same order as fADCthresholds
).
Definition at line 416 of file SlidingWindowTriggerSimulation_module.cc.
|
private |
Configured sliding window requirement pattern.
Definition at line 385 of file SlidingWindowTriggerSimulation_module.cc.
|
private |
Pattern algorithm.
Definition at line 423 of file SlidingWindowTriggerSimulation_module.cc.
|
private |
All plots in one practical sandbox.
Definition at line 426 of file SlidingWindowTriggerSimulation_module.cc.
|
private |
Proto-histogram information in a not-so-practical array; per threshold.
Count of fired triggers, per threshold.
Definition at line 432 of file SlidingWindowTriggerSimulation_module.cc.
|
private |
Count of opened gates.
Definition at line 436 of file SlidingWindowTriggerSimulation_module.cc.
|
private |
Definition at line 435 of file SlidingWindowTriggerSimulation_module.cc.
|
private |
Trigger resolution in time.
Definition at line 395 of file SlidingWindowTriggerSimulation_module.cc.
|
mutableprivate |
Mapping of each sliding window with location and topological information.
Definition at line 420 of file SlidingWindowTriggerSimulation_module.cc.