Helper data structure to store transient trigger result. More...
#include <TriggerInfo_t.h>
Classes | |
struct | OpeningInfo_t |
Public Types | |
using | optical_tick = detinfo::timescales::optical_tick |
Type alias. More... | |
using | Opening_t = icarus::trigger::OpticalTriggerGateData_t::GateData_t::OpeningCount_t |
Type of gate opening level. More... | |
using | LocationID_t = std::size_t |
Type for ID of trigger location. More... | |
Public Member Functions | |
TriggerInfo_t ()=default | |
TriggerInfo_t (OpeningInfo_t info) | |
Query whether the trigger fired. | |
bool | fired () const |
Returns whether the trigger fired. More... | |
operator bool () const | |
Returns whether there is trigger information. More... | |
bool | operator! () const |
Returns whether there is no trigger information. More... | |
Modify trigger information | |
void | replace (OpeningInfo_t info) |
Sets info as the new main() trigger. More... | |
bool | addAndReplaceIfEarlier (TriggerInfo_t const &other) |
If other has fired, and at an earlier tick, set a new main() . More... | |
bool | addAndReplaceIfEarlier (OpeningInfo_t const &info) |
If info is earlier than main() , it is set as new main() . More... | |
void | add (OpeningInfo_t info) |
void | sortOpenings () |
Sorts all openings by time. More... | |
Access to trigger information | |
If the trigger did not fire, the result and behaviour of these methods are undefined. | |
OpeningInfo_t const & | info () const |
Returns the information of the main trigger (undefined if !fired() ). More... | |
optical_tick | atTick () const |
Returns the time of the trigger (undefined if !fired() ). More... | |
Opening_t | level () const |
Returns the opening level of the trigger (undefined if !fired() ). More... | |
LocationID_t | location () const |
Returns the ID of the location of the trigger (undefined if !fired() ). More... | |
bool | hasLocation () const |
Returns if the location of the trigger is set (undefined if !fired() ). More... | |
OpeningInfo_t const & | main () const |
Returns the full data (undefined if !fired() ). More... | |
std::vector< OpeningInfo_t > const & | all () const |
std::size_t | nTriggers () const |
Returns the number of registered triggers. More... | |
Private Attributes | |
OpeningInfo_t | fMain |
Main trigger (also found in fAll ), if any. More... | |
std::vector< OpeningInfo_t > | fAll |
Helper data structure to store transient trigger result.
This record maintains a list of all openings (add()
), and has a special one (main()
) which represents the "global" trigger.
Note that unless no opening is add()
'ed, there is always a main()
trigger.
Each trigger is described by the information in a OpeningInfo_t
record. The records can be registered with add()
; replace()
changes the main()
trigger information unconditionally, while addAndReplaceIfEarlier()
replaces main()
only if the argument proposes a trigger earlier than the current main()
.
Definition at line 50 of file TriggerInfo_t.h.
using icarus::trigger::details::TriggerInfo_t::LocationID_t = std::size_t |
Type for ID of trigger location.
Definition at line 58 of file TriggerInfo_t.h.
using icarus::trigger::details::TriggerInfo_t::Opening_t = icarus::trigger::OpticalTriggerGateData_t::GateData_t::OpeningCount_t |
Type of gate opening level.
Definition at line 56 of file TriggerInfo_t.h.
Type alias.
Definition at line 52 of file TriggerInfo_t.h.
|
default |
|
inline |
Definition at line 98 of file TriggerInfo_t.h.
|
inline |
Adds an opening to all
list (main
is not affected). Not sorted. If no trigger is marked as main()
, this becomes it.
Definition at line 153 of file TriggerInfo_t.h.
|
inline |
If other
has fired, and at an earlier tick, set a new main()
.
other | another set of triggers |
main()
information from other
was copiedIf other
has fired()
earlier than this one (or if this one hasn't fired at all), the main trigger of other
is adopted. In any case all openings from other
are add()
'ed to this one.
Definition at line 384 of file TriggerInfo_t.h.
|
inline |
If info
is earlier than main()
, it is set as new main()
.
info | the opening information candidate as new main() |
main()
was updated.If info
is earlier tick than main()
(or if there is no main()
yet, i.e. it has not fired()
), info
becomes the new main()
. In all cases info
is added (add()
).
Definition at line 403 of file TriggerInfo_t.h.
|
inline |
Returns all the registered opening in the current order (not resorted).
sortOpenings()
Definition at line 192 of file TriggerInfo_t.h.
|
inline |
Returns the time of the trigger (undefined if !fired()
).
Definition at line 176 of file TriggerInfo_t.h.
|
inline |
Returns whether the trigger fired.
Definition at line 108 of file TriggerInfo_t.h.
|
inline |
Returns if the location of the trigger is set (undefined if !fired()
).
Definition at line 185 of file TriggerInfo_t.h.
|
inline |
Returns the information of the main trigger (undefined if !fired()
).
Definition at line 173 of file TriggerInfo_t.h.
|
inline |
Returns the opening level of the trigger (undefined if !fired()
).
Definition at line 179 of file TriggerInfo_t.h.
|
inline |
Returns the ID of the location of the trigger (undefined if !fired()
).
Definition at line 182 of file TriggerInfo_t.h.
|
inline |
Returns the full data (undefined if !fired()
).
Definition at line 188 of file TriggerInfo_t.h.
|
inline |
Returns the number of registered triggers.
Definition at line 195 of file TriggerInfo_t.h.
|
inline |
Returns whether there is trigger information.
Definition at line 111 of file TriggerInfo_t.h.
|
inline |
Returns whether there is no trigger information.
Definition at line 114 of file TriggerInfo_t.h.
|
inline |
Sets info
as the new main()
trigger.
Definition at line 125 of file TriggerInfo_t.h.
|
inline |
Sorts all
openings by time.
Definition at line 157 of file TriggerInfo_t.h.
|
private |
Definition at line 206 of file TriggerInfo_t.h.
|
private |
Main trigger (also found in fAll
), if any.
Information about all global trigger candidates.
Definition at line 203 of file TriggerInfo_t.h.