Simulates a sliding window trigger at specified gate times. 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 | |
TriggerSimulationOnGates (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... | |
using | BeamGates_t = std::vector< sim::BeamGateInfo > |
Type of list of gates to simulate trigger into. 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, std::vector< icarus::trigger::ApplyBeamGateClass > const &gates) |
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... | |
std::vector< WindowTriggerInfo_t > | produceForThreshold (art::Event &event, detinfo::DetectorTimings const &detTimings, std::vector< ApplyBeamGateClass > const &beamGates, std::size_t const iThr, std::string const &thrTag, unsigned int firstTriggerNumber) |
Performs the simulation for the specified ADC threshold. More... | |
raw::Trigger | triggerInfoToTriggerData (detinfo::DetectorTimings const &detTimings, ApplyBeamGateClass const &beamGate, 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::DetectorTimings const &detTimings, sim::BeamGateInfo const &gate) const |
Shortcut to create an ApplyBeamGate with the specified gate . More... | |
std::vector < icarus::trigger::ApplyBeamGateClass > | makeMyBeamGates (detinfo::DetectorTimings const &detTimings, BeamGates_t const &gates) const |
Shortcut to create ApplyBeamGate from a list of gates. More... | |
std::vector < icarus::trigger::ApplyBeamGateClass > | makeMyBeamGates (art::Event const *event, BeamGates_t const &gates) const |
std::vector < icarus::trigger::ApplyBeamGateClass > | makeMyBeamGates (art::Event const &event, BeamGates_t const &gates) 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 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... | |
art::InputTag const | fBeamGateTag |
Data product of beam gates to simulate. 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 > | fTotalGates { 0U } |
Count of opened gates. More... | |
Simulates a sliding window trigger at specified gate times.
This module produces raw::Trigger
objects each representing the outcome of some trigger logic applied to discriminated optical detector input ("trigger primitives"). The logic is applied to each event at multiple times, according to a list of time intervals read from each event.
The main purpose of this module is to simulate the trigger logic at times of special interest, typically the times some track is believed to have crossed the detector.
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
.BeamGates
(input tag, mandatory): the data product with the beam gatesBeamBits
(bitmask as 32-bit integral number): bits to be set in the produced raw::Trigger
objects (see also daq::TriggerDecoder
tool).LogCategory
(string, default TriggerSimulationOnGates
): 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
.
TriggerGatesTag
+ Thresholds
: input gate collections.BeamGates
(std::vector<sim::BeamGateInfo>
): the beam gate intervals to run the simulation on; one trigger result is produced and saved for each of the gates in this data product. The gates are interpreted following LArSoft convention for the simulation, with the times in nanoseconds and in simulation time reference.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); one trigger object is produced for each of the beam gates found in the input data product specified by the BeamGates
parameter. Each trigger object has the 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::TriggerSimulationOnGates
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 (see below). The reference time for the beam gates is the time configured in DetectorClocks
service provider (detinfo::DetectorClocks::BeamGateTime()
).
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
.
A single instance of this module can perform the simulation on several beam gates. The values of these beam gates are picked from the data product specified in BeamGates
, event by event. The specified beam gate times are on beam gate time scale, i.e. their reference time 0
is the time of the beam gate as known by detinfo::DetectorClocks::BeamGateTime()
. In case the same beam gate is desired for all events, such data product can be produced by icarus::trigger::WriteBeamGateInfo
module. The trigger data product collection produced by this module has the same number of entries as the beam gates in the data product, and they match one-to-one.
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 287 of file TriggerSimulationOnGates_module.cc.
|
private |
Type of list of gates to simulate trigger into.
Definition at line 407 of file TriggerSimulationOnGates_module.cc.
|
private |
Content for future histograms, binned.
Definition at line 396 of file TriggerSimulationOnGates_module.cc.
|
private |
Type of trigger gate extracted from the input event.
Definition at line 385 of file TriggerSimulationOnGates_module.cc.
using icarus::trigger::TriggerSimulationOnGates::microseconds = util::quantities::intervals::microseconds |
Definition at line 294 of file TriggerSimulationOnGates_module.cc.
using icarus::trigger::TriggerSimulationOnGates::nanoseconds = util::quantities::intervals::nanoseconds |
Definition at line 295 of file TriggerSimulationOnGates_module.cc.
using icarus::trigger::TriggerSimulationOnGates::Parameters = art::EDProducer::Table<Config> |
Definition at line 355 of file TriggerSimulationOnGates_module.cc.
|
private |
List of trigger gates.
Definition at line 389 of file TriggerSimulationOnGates_module.cc.
Type alias.
Definition at line 381 of file TriggerSimulationOnGates_module.cc.
|
private |
Data structure to communicate internally a trigger response.
Definition at line 393 of file TriggerSimulationOnGates_module.cc.
|
explicit |
Definition at line 604 of file TriggerSimulationOnGates_module.cc.
|
overridevirtual |
Initializes the plots.
Definition at line 694 of file TriggerSimulationOnGates_module.cc.
|
overridevirtual |
Prints end-of-job summaries.
Definition at line 767 of file TriggerSimulationOnGates_module.cc.
|
staticprivate |
Returns the time of the event in seconds from The Epoch.
Definition at line 1249 of file TriggerSimulationOnGates_module.cc.
|
staticprivate |
Definition at line 1260 of file TriggerSimulationOnGates_module.cc.
|
private |
Creates summary plots from proto-histogram data.
Definition at line 923 of file TriggerSimulationOnGates_module.cc.
|
private |
Initializes the full set of plots (all ADC thresholds).
Definition at line 777 of file TriggerSimulationOnGates_module.cc.
|
private |
Creates in the main sandbox all event-wide plots.
Definition at line 1000 of file TriggerSimulationOnGates_module.cc.
|
private |
Creates and returns a 1D histogram filled with binnedContent
.
Definition at line 1223 of file TriggerSimulationOnGates_module.cc.
|
inlineprivate |
Shortcut to create an ApplyBeamGate
with the specified gate
.
Definition at line 559 of file TriggerSimulationOnGates_module.cc.
|
inlineprivate |
Shortcut to create ApplyBeamGate
from a list of gates.
Definition at line 574 of file TriggerSimulationOnGates_module.cc.
|
inlineprivate |
Definition at line 582 of file TriggerSimulationOnGates_module.cc.
|
inlineprivate |
Definition at line 585 of file TriggerSimulationOnGates_module.cc.
|
private |
Creates in plots
sandbox all plots for threshold threshold
from data in plotInfo
.
Definition at line 943 of file TriggerSimulationOnGates_module.cc.
|
private |
Fills event-wide plots.
Definition at line 1094 of file TriggerSimulationOnGates_module.cc.
|
private |
Fills the plots for threshold index iThr
with trigger information.
Definition at line 1116 of file TriggerSimulationOnGates_module.cc.
|
private |
Prints the summary of fired triggers on screen.
Definition at line 1174 of file TriggerSimulationOnGates_module.cc.
|
overridevirtual |
Runs the simulation and saves the results into the art event.
Definition at line 702 of file TriggerSimulationOnGates_module.cc.
|
private |
Performs the simulation for the specified ADC threshold.
event | art event to read data from and put results into |
detTimings | detector clocks service provider proxy |
beamGates | list of all beam gates to evaluate |
iThr | index of the threshold in the configuration |
thr | value of the threshold (ADC counts) |
firstTriggerNumber | the next unassigned trigger number |
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 1032 of file TriggerSimulationOnGates_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 1201 of file TriggerSimulationOnGates_module.cc.
|
private |
Name of ADC thresholds to read, and the input tag connected to their data.
Definition at line 413 of file TriggerSimulationOnGates_module.cc.
|
private |
Bits for the beam gate being simulated.
Definition at line 420 of file TriggerSimulationOnGates_module.cc.
|
private |
Data product of beam gates to simulate.
Definition at line 418 of file TriggerSimulationOnGates_module.cc.
|
private |
Proto-histogram information in a convenient packet; event-wide.
Definition at line 456 of file TriggerSimulationOnGates_module.cc.
|
private |
Trigger time plot binning [s].
Definition at line 424 of file TriggerSimulationOnGates_module.cc.
|
private |
Message facility stream category for output.
Definition at line 427 of file TriggerSimulationOnGates_module.cc.
|
private |
ROOT directory where all the plots are written.
Definition at line 435 of file TriggerSimulationOnGates_module.cc.
|
private |
Output data product instance names (same order as fADCthresholds
).
Definition at line 443 of file TriggerSimulationOnGates_module.cc.
|
private |
Configured sliding window requirement pattern.
Definition at line 416 of file TriggerSimulationOnGates_module.cc.
|
private |
Pattern algorithm.
Definition at line 450 of file TriggerSimulationOnGates_module.cc.
|
private |
All plots in one practical sandbox.
Definition at line 453 of file TriggerSimulationOnGates_module.cc.
|
private |
Proto-histogram information in a not-so-practical array; per threshold.
Count of fired triggers, per threshold.
Definition at line 459 of file TriggerSimulationOnGates_module.cc.
|
private |
Count of opened gates.
Definition at line 463 of file TriggerSimulationOnGates_module.cc.
|
private |
Definition at line 462 of file TriggerSimulationOnGates_module.cc.
|
private |
Trigger resolution in time.
Definition at line 422 of file TriggerSimulationOnGates_module.cc.
|
mutableprivate |
Mapping of each sliding window with location and topological information.
Definition at line 447 of file TriggerSimulationOnGates_module.cc.