Assembles and returns trigger gates from serialized data. More...
#include <TriggerDataUtils.h>
Public Types | |
using | OpDetWaveformMeta_t = OpDetInfo |
Type of associated information. More... | |
using | TriggerGates_t = icarus::trigger::TrackedOpticalTriggerGate< OpDetWaveformMeta_t > |
Type of data objects returned. More... | |
Public Member Functions | |
TriggerGateReader (art::InputTag dataTag) | |
Constructor: configure to read the data with the specified tag. More... | |
template<typename ConsumesCollector > | |
void | declareConsumes (ConsumesCollector &collector) const |
Declares to the collector the data products that are going to be read. More... | |
art::InputTag const & | inputTag () const |
Returns the input tag the data is read from. More... | |
template<typename Event > | |
std::vector < icarus::trigger::TrackedOpticalTriggerGate < OpDetInfo > > | read (Event const &event) const |
template<typename Event > | |
std::vector< TriggerGates_t > | read (Event const &event) const |
Reads the configured data product from the specified event . More... | |
template<typename Event > | |
std::vector< TriggerGates_t > | operator() (Event const &event) const |
Private Attributes | |
art::InputTag | fDataTag |
Data tag of the data products being read. More... | |
Assembles and returns trigger gates from serialized data.
OpDetInfo | type of object associated to the gates |
Event | type of object to read the needed information from |
event | object to read all the needed information from |
dataTag | tag of the data to read from the event |
cet::exception | wrapping any cet::exception thrown internally (typically a data product not found) |
This class manages reading from a data source trigger gates (vector of icarus::trigger::OpticalTriggerGateData_t
elements) and their associations to a tracking information (OpDetInfo
: sbn::OpDetWaveformMeta
by default, but it may also be e.g. raw::OpDetWaveform
).
All this information is merged into the "tracking" trigger gates, which wrap _ a copy_ of the trigger gates and a reference to the tracked information (by simple C pointer).
This class is a framework interface to FillTriggerGates()
; interaction with the data source and the framework is driven by the Event
object in the read()
method, which is expected to expose an interface similar to _art_'s
art::Event<tt>, and in particular: *Event::getProduct<T>(art::InputTag)to read and return directly a reference to the persistent, framework-owned data products of type
T`.
In addition, this class provides a shortcut to declare the consumed data products, again in a art-like interface. A full usage example in a module includes:
a reader data member in the module class reading the data:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} icarus::trigger::TriggerGateReader<> const fGateReader; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
construction in the module constructor initializer list from a configured input tag representing the data to be read:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} , fGateReader{ config().TriggerGateTag() } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
event
is known: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} std::vector<icarus::trigger::TrackedOpticalTriggerGate<sbn::OpDetWaveformMeta>> gates = fGateReader(event); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~In a context where the consume declaration is not relevant/desired, the first three steps can be omitted and the reading can happen with a temporary TriggerGateReader
object; or the shortcut function icarus::trigger::ReadTriggerGates()
can be used instead:
is equivalent to the last step above. Note that it is still possible to use temporaries also for the consume declaration: for example, a program using icarus::trigger::ReadTriggerGates()
may in the proper place (e.g. a module constructor) call explicitly the consume declaration:
is equivalent to the three steps above. The only advantage of the approach in multiple steps of the first example is that consistency of declaration and use is guaranteed by construction.
Definition at line 298 of file TriggerDataUtils.h.
using icarus::trigger::TriggerGateReader< OpDetInfo >::OpDetWaveformMeta_t = OpDetInfo |
Type of associated information.
Definition at line 459 of file TriggerDataUtils.h.
using icarus::trigger::TriggerGateReader< OpDetInfo >::TriggerGates_t = icarus::trigger::TrackedOpticalTriggerGate<OpDetWaveformMeta_t> |
Type of data objects returned.
Definition at line 463 of file TriggerDataUtils.h.
|
inline |
Constructor: configure to read the data with the specified tag.
Definition at line 467 of file TriggerDataUtils.h.
void icarus::trigger::TriggerGateReader< OpDetInfo >::declareConsumes | ( | ConsumesCollector & | collector | ) | const |
Declares to the collector
the data products that are going to be read.
Definition at line 610 of file TriggerDataUtils.h.
|
inline |
Returns the input tag the data is read from.
Definition at line 474 of file TriggerDataUtils.h.
|
inline |
Definition at line 481 of file TriggerDataUtils.h.
std::vector<TriggerGates_t> icarus::trigger::TriggerGateReader< OpDetInfo >::read | ( | Event const & | event | ) | const |
Reads the configured data product from the specified event
.
std::vector<icarus::trigger::TrackedOpticalTriggerGate<OpDetInfo> > icarus::trigger::TriggerGateReader< OpDetInfo >::read | ( | Event const & | event | ) | const |
Definition at line 626 of file TriggerDataUtils.h.
|
private |
Data tag of the data products being read.
Definition at line 455 of file TriggerDataUtils.h.