All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Static Private Member Functions | Private Attributes | List of all members
icarus::trigger::OpticalTriggerGate Class Reference

Logical multi-level gate associated to one or more waveforms. More...

#include <OpticalTriggerGate.h>

Inheritance diagram for icarus::trigger::OpticalTriggerGate:
icarus::trigger::ReadoutTriggerGate< Tick, TickInterval, ChannelIDType > icarus::trigger::TriggerGateData< Tick, TickInterval > icarus::trigger::ReadoutTriggerGateTag icarus::trigger::MultiChannelOpticalTriggerGate icarus::trigger::SingleChannelOpticalTriggerGate

Public Types

using GateData_t = OpticalTriggerGateData_t
 Type for gate data access. More...
 
using ChannelID_t = GateData_t::ChannelID_t
 Type of channel identifier. More...
 
- Public Types inherited from icarus::trigger::ReadoutTriggerGate< Tick, TickInterval, ChannelIDType >
using ClockTick_t = Tick
 Tick point. More...
 
using ClockTicks_t = TickInterval
 Tick interval. More...
 
using ChannelID_t = ChannelIDType
 Type of stored channel ID. More...
 
using GateData_t = Base_t
 Type for gate data access. More...
 
using ChannelList_t = std::vector< ChannelID_t >
 Type of list of associated channels. More...
 
- Public Types inherited from icarus::trigger::TriggerGateData< Tick, TickInterval >
using triggergatedata_t = TriggerGateData< Tick, TickInterval >
 This type. More...
 
using ClockTick_t = Tick
 Type of a point in time, measured in ticks. More...
 
using ClockTicks_t = TickInterval
 Type of a time interval, measured in ticks. More...
 
using OpeningCount_t = unsigned int
 Type of count of number of open channels. More...
 
using OpeningDiff_t = std::make_signed_t< OpeningCount_t >
 Type representing a variation of open channels. More...
 

Public Member Functions

 OpticalTriggerGate ()=default
 Constructor: a closed gate with no associated waveform (add() them). More...
 
 OpticalTriggerGate (OpticalTriggerGate const &)=default
 
 OpticalTriggerGate (OpticalTriggerGate &&)=default
 
OpticalTriggerGateoperator= (OpticalTriggerGate const &)=default
 
OpticalTriggerGateoperator= (OpticalTriggerGate &&)=default
 
 OpticalTriggerGate (raw::OpDetWaveform const &waveform)
 Constructor: a closed gate for the channel in waveform. More...
 
 fWaveforms ({&waveform})
 
 OpticalTriggerGate (ChannelID_t channel)
 Constructor: a closed gate for the specified channel. More...
 
bool add (raw::OpDetWaveform const &waveform)
 Adds another waveform to the gate (unless it has already been added). More...
 
bool operator== (OpticalTriggerGate const &) const
 
bool operator!= (OpticalTriggerGate const &) const
 
template<typename Op >
icarus::trigger::OpticalTriggerGate SymmetricCombination (Op &&op, OpticalTriggerGate const &a, OpticalTriggerGate const &b, TriggerGateTicks_t aDelay, TriggerGateTicks_t bDelay)
 
OpticalTriggerGateoperator= (GateData_t const &data)
 Copies/steals all the levels and channels from the specified data. More...
 
OpticalTriggerGateoperator= (GateData_t &&data)
 
Query
GateData_tgateLevels ()
 Access to the underlying gate level data (mutable). More...
 
GateData_t const & gateLevels () const
 Access to the underlying gate level data (immutable). More...
 
std::vector
< raw::OpDetWaveform const * > 
waveforms () const
 
- Public Member Functions inherited from icarus::trigger::ReadoutTriggerGate< Tick, TickInterval, ChannelIDType >
 ReadoutTriggerGate ()=default
 
 ReadoutTriggerGate (ReadoutTriggerGate const &)=default
 
 ReadoutTriggerGate (ReadoutTriggerGate &&)=default
 
ReadoutTriggerGateoperator= (ReadoutTriggerGate const &)=default
 
ReadoutTriggerGateoperator= (ReadoutTriggerGate &&)=default
 
 ReadoutTriggerGate (std::initializer_list< ChannelID_t > channels)
 Constructor: a closed gate associated to the specified channels. More...
 
bool hasChannels () const
 Returns whether there is any channel id associated to the gate data. More...
 
bool hasChannel () const
 Returns whether exactly one channel id associated to the gate data. More...
 
std::size_t nChannels () const
 Returns the number of associated channels. More...
 
decltype(auto) channels () const
 Returns the channels associated to the gate data. More...
 
ChannelID_t channel () const
 Returns the channel associated to the gate data. More...
 
This_taddChannel (ChannelID_t const channel)
 Associates the specified channel to this readout gate. More...
 
This_taddChannels (std::initializer_list< ChannelID_t > channels)
 Associates the specified channels to this readout gate. More...
 
bool operator== (ReadoutTriggerGate const &) const
 
bool operator!= (ReadoutTriggerGate const &) const
 
ReadoutTriggerGateoperator= (GateData_t const &data)
 Copies/steals all the levels from the specified data. More...
 
ReadoutTriggerGateoperator= (GateData_t &&data)
 
GateData_t const & gateLevels () const
 Access to the underlying gate level data. More...
 
GateData_tgateLevels ()
 Access to the underlying gate level data (mutable). More...
 
ReadoutTriggerGateMin (ReadoutTriggerGate const &other)
 Combines with a gate, keeping the minimum opening among the two. More...
 
ReadoutTriggerGateMax (ReadoutTriggerGate const &other)
 Combines with a gate, keeping the maximum opening among the two. More...
 
ReadoutTriggerGateSum (ReadoutTriggerGate const &other)
 Combines with a gate, keeping the sum of openings of the two. More...
 
ReadoutTriggerGateMul (ReadoutTriggerGate const &other)
 Combines with a gate, keeping the product of openings of the two. More...
 
- Public Member Functions inherited from icarus::trigger::TriggerGateData< Tick, TickInterval >
 TriggerGateData ()
 Constructor: a closed gate for the channel in waveform. More...
 
bool operator== (TriggerGateData const &) const
 
bool operator!= (TriggerGateData const &) const
 
ClockTick_t lastTick () const
 Returns the number of ticks this gate covers. More...
 
OpeningCount_t openingCount (ClockTick_t tick) const
 Returns the opening count of the gate at the specified tick. More...
 
bool alwaysClosed () const
 Returns whether this gate never opened. More...
 
bool isOpen (ClockTick_t tick) const
 Returns whether the gate is open at all at the specified tick. More...
 
ClockTick_t findOpen (OpeningCount_t minOpening=1U, ClockTick_t start=MinTick, ClockTick_t end=MaxTick) const
 Returns the tick at which the gate opened. More...
 
ClockTick_t findClose (OpeningCount_t minOpening=1U, ClockTick_t start=MinTick, ClockTick_t end=MaxTick) const
 Returns the tick at which the gate closed. More...
 
ClockTick_t findMaxOpen (ClockTick_t start=MinTick, ClockTick_t end=MaxTick) const
 Returns the tick at which the gate has the maximum opening. More...
 
std::pair< OpeningCount_t,
OpeningCount_t
openingRange (ClockTick_t start, ClockTick_t end) const
 Returns the range of trigger opening values in the specified range. More...
 
void setOpeningAt (ClockTick_t tick, OpeningCount_t openingCount)
 Changes the opening to match openingCount at the specified time. More...
 
void openAt (ClockTick_t tick, OpeningDiff_t count)
 Open this gate at the specified time (increase the opening by count). More...
 
void openAt (ClockTick_t tick)
 Open this gate at the specified time (increase the opening by 1). More...
 
void openBetween (ClockTick_t start, ClockTick_t end, OpeningDiff_t count=1)
 Open this gate at specified start tick, and close it at end tick. More...
 
void openFor (ClockTick_t tick, ClockTicks_t length, OpeningDiff_t count=1)
 Open this gate at the specified time, and close it length ticks later. More...
 
void closeAt (ClockTick_t tick, OpeningDiff_t count)
 Close this gate at the specified time (decrease the opening by count). More...
 
void closeAt (ClockTick_t tick)
 Close this gate at the specified time. More...
 
void closeAllAt (ClockTick_t tick)
 Completely close this gate at the specified time. More...
 
void clear ()
 Sets the gate levels in the state at construction. More...
 
triggergatedata_tMin (triggergatedata_t const &other)
 Combines with a gate, keeping the minimum opening among the two. More...
 
triggergatedata_tMax (triggergatedata_t const &other)
 Combines with a gate, keeping the maximum opening among the two. More...
 
triggergatedata_tSum (triggergatedata_t const &other)
 Combines with a gate, keeping the sum of openings of the two. More...
 
triggergatedata_tMul (triggergatedata_t const &other)
 Combines with a gate, keeping the product of openings of the two. More...
 

Protected Types

using Waveforms_t = std::vector< raw::OpDetWaveform const * >
 Internal list of registered waveforms. More...
 
- Protected Types inherited from icarus::trigger::ReadoutTriggerGate< Tick, TickInterval, ChannelIDType >
using GateEvolution_t = typename Base_t::GateEvolution_t
 
- Protected Types inherited from icarus::trigger::TriggerGateData< Tick, TickInterval >
using EventType = details::TriggerGateEventType
 
using Status = details::TriggerGateStatus< ClockTick_t, OpeningCount_t >
 
using GateEvolution_t = std::vector< Status >
 Type to describe the time evolution of the gate. More...
 

Protected Member Functions

 OpticalTriggerGate (GateEvolution_t &&gateLevel, Waveforms_t &&waveforms)
 Protected constructor: set the data directly. More...
 
void registerWaveforms (Waveforms_t const &moreWaveforms)
 Registers the waveforms from the specified list. More...
 
void mergeWaveformsFromGate (OpticalTriggerGate const &other)
 Registers the waveforms from the other gate into this one. More...
 
- Protected Member Functions inherited from icarus::trigger::ReadoutTriggerGate< Tick, TickInterval, ChannelIDType >
 ReadoutTriggerGate (GateEvolution_t &&gateLevel, ChannelList_t &&channels)
 Protected constructor: set the data directly. More...
 
template<typename BIter , typename EIter >
 ReadoutTriggerGate (GateEvolution_t &&gateLevel, BIter b, EIter e)
 Protected constructor: set the data directly. More...
 
ChannelList_tnormalizeChannels ()
 Removes duplicate channel IDs and sorts the remaining ones. More...
 
void associateChannelsFromGate (ReadoutTriggerGate const &other)
 Associates this data with the channels from the other gate. More...
 
void associateChannels (std::initializer_list< ChannelID_t > const &moreChannels)
 Associates this data with the channels from the specified list. More...
 
void associateChannels (ChannelList_t const &moreChannels)
 
- Protected Member Functions inherited from icarus::trigger::TriggerGateData< Tick, TickInterval >
 TriggerGateData (GateEvolution_t &&gateLevel)
 Protected constructor: set the data directly. More...
 

Static Protected Member Functions

static Waveforms_t mergeWaveforms (Waveforms_t const &a, Waveforms_t const &b)
 Registers the waveforms from the other gate into this one. More...
 
- Static Protected Member Functions inherited from icarus::trigger::ReadoutTriggerGate< Tick, TickInterval, ChannelIDType >
template<typename BIter , typename EIter >
static ChannelList_tmergeSortedChannelsInto (ChannelList_t &channels, BIter b, EIter e)
 
static ChannelList_tnormalizeSortedChannels (ChannelList_t &channels)
 Removes duplicate channel IDs. More...
 
template<typename BIter , typename EIter >
static ChannelList_tmergeChannelsInto (ChannelList_t &channels, BIter b, EIter e)
 Adds channels from iterators b to e into channels (returned). More...
 
static ChannelList_t mergeChannels (ChannelList_t const &a, ChannelList_t const &b)
 Returns a merged list of channels from a and b. More...
 
static ChannelList_tnormalizeChannels (ChannelList_t &channels)
 Removes duplicate channel IDs and sorts the remaining ones. More...
 
static ChannelList_t normalizeChannels (ChannelList_t &&channels)
 

Static Private Member Functions

static GateData_t::ChannelList_t extractChannels (Waveforms_t const &waveforms)
 Returns the list of all channels from the waveforms (duplicate allowed). More...
 
static GateData_t::ChannelList_t waveformChannels (Waveforms_t const &waveforms)
 Returns the list of all unique channels (sorted) from the waveforms. More...
 

Private Attributes

std::vector
< raw::OpDetWaveform const * > 
fWaveforms
 List of waveforms involved in this channel. More...
 

Combination operations

OpticalTriggerGateMin (OpticalTriggerGate const &other)
 Combines with a gate, keeping the minimum opening among the two. More...
 
OpticalTriggerGateMax (OpticalTriggerGate const &other)
 Combines with a gate, keeping the maximum opening among the two. More...
 
OpticalTriggerGateSum (OpticalTriggerGate const &other)
 Combines with a gate, keeping the sum of openings of the two. More...
 
OpticalTriggerGateMul (OpticalTriggerGate const &other)
 Combines with a gate, keeping the product of openings of the two. More...
 
static OpticalTriggerGate Min (OpticalTriggerGate const &a, OpticalTriggerGate const &b)
 Returns a gate with the minimum opening between the specified two. More...
 
static OpticalTriggerGate Max (OpticalTriggerGate const &a, OpticalTriggerGate const &b)
 Returns a gate with the maximum opening between the specified two. More...
 
static OpticalTriggerGate Sum (OpticalTriggerGate const &a, OpticalTriggerGate const &b)
 Returns a gate with opening sum of the specified two. More...
 
static OpticalTriggerGate Mul (OpticalTriggerGate const &a, OpticalTriggerGate const &b)
 Returns a gate with opening product of the specified two. More...
 
template<typename Op >
static OpticalTriggerGate SymmetricCombination (Op &&op, OpticalTriggerGate const &a, OpticalTriggerGate const &b, TriggerGateTicks_t aDelay=TriggerGateTicks_t{0}, TriggerGateTicks_t bDelay=TriggerGateTicks_t{0})
 Returns a gate combination of the openings of two other gates. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from icarus::trigger::ReadoutTriggerGate< Tick, TickInterval, ChannelIDType >
static ReadoutTriggerGate Min (ReadoutTriggerGate const &a, ReadoutTriggerGate const &b)
 Returns a gate with the minimum opening between the specified two. More...
 
static ReadoutTriggerGate Max (ReadoutTriggerGate const &a, ReadoutTriggerGate const &b)
 Returns a gate with the maximum opening between the specified two. More...
 
static ReadoutTriggerGate Sum (ReadoutTriggerGate const &a, ReadoutTriggerGate const &b)
 Returns a gate with opening sum of the specified two. More...
 
static ReadoutTriggerGate Mul (ReadoutTriggerGate const &a, ReadoutTriggerGate const &b)
 Returns a gate with opening product of the specified two. More...
 
template<typename Op >
static ReadoutTriggerGate SymmetricCombination (Op &&op, ReadoutTriggerGate const &a, ReadoutTriggerGate const &b, ClockTicks_t aDelay=ClockTicks_t{0}, ClockTicks_t bDelay=ClockTicks_t{0})
 Returns a gate combination of the openings of two other gates. More...
 
- Static Public Member Functions inherited from icarus::trigger::TriggerGateData< Tick, TickInterval >
static triggergatedata_t Min (triggergatedata_t const &a, triggergatedata_t const &b)
 Returns a gate with the minimum opening between the specified two. More...
 
static triggergatedata_t Max (triggergatedata_t const &a, triggergatedata_t const &b)
 Returns a gate with the maximum opening between the specified two. More...
 
static triggergatedata_t Sum (triggergatedata_t const &a, triggergatedata_t const &b)
 Returns a gate with opening sum of the specified two. More...
 
static triggergatedata_t Mul (triggergatedata_t const &a, triggergatedata_t const &b)
 Returns a gate with opening product of the specified two. More...
 
template<typename Op >
static triggergatedata_t SymmetricCombination (Op &&op, triggergatedata_t const &a, triggergatedata_t const &b, ClockTicks_t aDelay=ClockTicks_t{}, ClockTicks_t bDelay=ClockTicks_t{})
 Returns a gate combination of the openings of two other gates. More...
 
- Static Public Attributes inherited from icarus::trigger::TriggerGateData< Tick, TickInterval >
static constexpr ClockTick_t MinTick = std::numeric_limits<ClockTick_t>::min()
 An unbearably small tick number. More...
 
static constexpr ClockTick_t MaxTick = std::numeric_limits<ClockTick_t>::max()
 An unbearably large tick number. More...
 

Detailed Description

Logical multi-level gate associated to one or more waveforms.

This object is a trigger gate associated with one or more optical waveforms.

Note
This object should be parametrized with optical ticks (detinfo::timescales::optical_tick). But currently the quantities (util::quantity derived objects) are not well suited to be serialized by ROOT, because
  1. they are defined in lardataalg rather than lardataobj
  2. writing all their serialization is daunting (see how ROOT dealt with GenVector vectors for an example of how to do it) So we chicken out here and use simple data types instead.

Definition at line 64 of file OpticalTriggerGate.h.

Member Typedef Documentation

Type of channel identifier.

Definition at line 72 of file OpticalTriggerGate.h.

Type for gate data access.

Definition at line 70 of file OpticalTriggerGate.h.

Internal list of registered waveforms.

Definition at line 238 of file OpticalTriggerGate.h.

Constructor & Destructor Documentation

icarus::trigger::OpticalTriggerGate::OpticalTriggerGate ( )
default

Constructor: a closed gate with no associated waveform (add() them).

icarus::trigger::OpticalTriggerGate::OpticalTriggerGate ( OpticalTriggerGate const &  )
default
icarus::trigger::OpticalTriggerGate::OpticalTriggerGate ( OpticalTriggerGate &&  )
default
icarus::trigger::OpticalTriggerGate::OpticalTriggerGate ( raw::OpDetWaveform const &  waveform)
inline

Constructor: a closed gate for the channel in waveform.

Definition at line 83 of file OpticalTriggerGate.h.

84  : GateData_t({ waveform.ChannelNumber() })
OpticalTriggerGateData_t GateData_t
Type for gate data access.
icarus::trigger::OpticalTriggerGate::OpticalTriggerGate ( ChannelID_t  channel)
inline

Constructor: a closed gate for the specified channel.

Definition at line 89 of file OpticalTriggerGate.h.

89 : GateData_t{ channel } {}
ChannelID_t channel() const
Returns the channel associated to the gate data.
OpticalTriggerGateData_t GateData_t
Type for gate data access.
icarus::trigger::OpticalTriggerGate::OpticalTriggerGate ( GateEvolution_t &&  gateLevel,
Waveforms_t &&  waveforms 
)
inlineprotected

Protected constructor: set the data directly.

Definition at line 241 of file OpticalTriggerGate.h.

242  : ReadoutTriggerGate(std::move(gateLevel), waveformChannels(waveforms))
243  , fWaveforms(std::move(waveforms))
244  {}
static GateData_t::ChannelList_t waveformChannels(Waveforms_t const &waveforms)
Returns the list of all unique channels (sorted) from the waveforms.
std::vector< raw::OpDetWaveform const * > waveforms() const
std::vector< raw::OpDetWaveform const * > fWaveforms
List of waveforms involved in this channel.

Member Function Documentation

bool icarus::trigger::OpticalTriggerGate::add ( raw::OpDetWaveform const &  waveform)

Adds another waveform to the gate (unless it has already been added).

Definition at line 201 of file OpticalTriggerGate.cxx.

202 {
203  // insertion keeps the list ordered and the elements unique
204  auto const& insertionPoint = std::lower_bound
205  (fWaveforms.begin(), fWaveforms.end(), &waveform, ::OpDetWaveformComp());
206  if ((insertionPoint != fWaveforms.end()) && (*insertionPoint == &waveform))
207  return false;
208  fWaveforms.insert(insertionPoint, &waveform);
209  addChannel(waveform.ChannelNumber());
210  return true;
211 } // icarus::trigger::OpticalTriggerGate::add()
This_t & addChannel(ChannelID_t const channel)
Associates the specified channel to this readout gate.
std::vector< raw::OpDetWaveform const * > fWaveforms
List of waveforms involved in this channel.
auto icarus::trigger::OpticalTriggerGate::extractChannels ( Waveforms_t const &  waveforms)
staticprivate

Returns the list of all channels from the waveforms (duplicate allowed).

Definition at line 216 of file OpticalTriggerGate.cxx.

217 {
219  channels.reserve(waveforms.size());
221  waveforms.begin(), waveforms.end(), std::back_inserter(channels),
223  );
224  return channels;
225 } // icarus::trigger::OpticalTriggerGate::extractChannels()
decltype(auto) channels() const
Returns the channels associated to the gate data.
std::vector< raw::OpDetWaveform const * > waveforms() const
static constexpr Sample_t transform(Sample_t sample)
std::vector< ChannelID_t > ChannelList_t
Type of list of associated channels.
icarus::trigger::OpticalTriggerGate::fWaveforms ( {&waveform}  )
inline

Definition at line 85 of file OpticalTriggerGate.h.

85  { &waveform })
86  {}
GateData_t& icarus::trigger::OpticalTriggerGate::gateLevels ( )
inline

Access to the underlying gate level data (mutable).

Definition at line 109 of file OpticalTriggerGate.h.

109 { return *this; }
GateData_t const& icarus::trigger::OpticalTriggerGate::gateLevels ( ) const
inline

Access to the underlying gate level data (immutable).

Definition at line 112 of file OpticalTriggerGate.h.

112 { return *this; }
icarus::trigger::OpticalTriggerGate & icarus::trigger::OpticalTriggerGate::Max ( OpticalTriggerGate const &  other)

Combines with a gate, keeping the maximum opening among the two.

Parameters
othergate to combine to
Returns
this object
See Also
Min(), Sum()

Multi-level equivalent of an or logical operation.

Definition at line 111 of file OpticalTriggerGate.cxx.

112 {
113  GateData_t::Max(other);
114  mergeWaveformsFromGate(other);
115  return *this;
116 } // icarus::trigger::OpticalTriggerGate::Max()
ReadoutTriggerGate & Max(ReadoutTriggerGate const &other)
Combines with a gate, keeping the maximum opening among the two.
void mergeWaveformsFromGate(OpticalTriggerGate const &other)
Registers the waveforms from the other gate into this one.
icarus::trigger::OpticalTriggerGate icarus::trigger::OpticalTriggerGate::Max ( OpticalTriggerGate const &  a,
OpticalTriggerGate const &  b 
)
static

Returns a gate with the maximum opening between the specified two.

Parameters
afirst gate
bsecond gate
Returns
gate with at every tick the maximum opening among a and b
See Also
Min(), Sum()

Multi-level equivalent of an or logical operation.

Definition at line 147 of file OpticalTriggerGate.cxx.

148 { auto combination { a }; combination.Max(b); return combination; }
process_name gaushit a
auto icarus::trigger::OpticalTriggerGate::mergeWaveforms ( Waveforms_t const &  a,
Waveforms_t const &  b 
)
staticprotected

Registers the waveforms from the other gate into this one.

Definition at line 81 of file OpticalTriggerGate.cxx.

82 {
83  Waveforms_t merged;
84  merged.reserve(a.size() + b.size());
85  std::merge(
86  a.begin(), a.end(), b.begin(), b.end(), std::back_inserter(merged),
87  ::OpDetWaveformComp()
88  );
89 
90  // finally remove any duplicate (there should be non, should it?)
91  auto const actualEnd
92  = std::unique(merged.begin(), merged.end()); // pointer comparison
93  merged.erase(actualEnd, merged.end());
94 
95  return merged;
96 } // icarus::trigger::OpticalTriggerGate::mergeWaveforms()
process_name gaushit a
std::vector< raw::OpDetWaveform const * > Waveforms_t
Internal list of registered waveforms.
void icarus::trigger::OpticalTriggerGate::mergeWaveformsFromGate ( OpticalTriggerGate const &  other)
inlineprotected

Registers the waveforms from the other gate into this one.

Definition at line 251 of file OpticalTriggerGate.h.

252  { registerWaveforms(other.waveforms()); }
void registerWaveforms(Waveforms_t const &moreWaveforms)
Registers the waveforms from the specified list.
icarus::trigger::OpticalTriggerGate & icarus::trigger::OpticalTriggerGate::Min ( OpticalTriggerGate const &  other)

Combines with a gate, keeping the minimum opening among the two.

Parameters
othergate to combine to
Returns
this object
See Also
Max()

Multi-level equivalent of an and logical operation.

Definition at line 101 of file OpticalTriggerGate.cxx.

102 {
103  GateData_t::Min(other);
104  mergeWaveformsFromGate(other);
105  return *this;
106 } // icarus::trigger::OpticalTriggerGate::Min()
ReadoutTriggerGate & Min(ReadoutTriggerGate const &other)
Combines with a gate, keeping the minimum opening among the two.
void mergeWaveformsFromGate(OpticalTriggerGate const &other)
Registers the waveforms from the other gate into this one.
icarus::trigger::OpticalTriggerGate icarus::trigger::OpticalTriggerGate::Min ( OpticalTriggerGate const &  a,
OpticalTriggerGate const &  b 
)
static

Returns a gate with the minimum opening between the specified two.

Parameters
afirst gate
bsecond gate
Returns
gate with at every tick the minimum opening among a and b
See Also
Max()

Multi-level equivalent of an and logical operation.

Definition at line 141 of file OpticalTriggerGate.cxx.

142 { auto combination { a }; combination.Min(b); return combination; }
process_name gaushit a
icarus::trigger::OpticalTriggerGate & icarus::trigger::OpticalTriggerGate::Mul ( OpticalTriggerGate const &  other)

Combines with a gate, keeping the product of openings of the two.

Parameters
othergate to combine to
Returns
this object
See Also
Min(), Max(), Sum()

Definition at line 131 of file OpticalTriggerGate.cxx.

132 {
133  GateData_t::Mul(other);
134  mergeWaveformsFromGate(other);
135  return *this;
136 } // icarus::trigger::OpticalTriggerGate::Mul()
ReadoutTriggerGate & Mul(ReadoutTriggerGate const &other)
Combines with a gate, keeping the product of openings of the two.
void mergeWaveformsFromGate(OpticalTriggerGate const &other)
Registers the waveforms from the other gate into this one.
icarus::trigger::OpticalTriggerGate icarus::trigger::OpticalTriggerGate::Mul ( OpticalTriggerGate const &  a,
OpticalTriggerGate const &  b 
)
static

Returns a gate with opening product of the specified two.

Parameters
afirst gate
bsecond gate
Returns
gate with at every tick the product of openings of a and b
See Also
Max()

Definition at line 159 of file OpticalTriggerGate.cxx.

160 { auto combination { a }; combination.Mul(b); return combination; }
process_name gaushit a
bool icarus::trigger::OpticalTriggerGate::operator!= ( OpticalTriggerGate const &  other) const

Definition at line 192 of file OpticalTriggerGate.cxx.

193 {
194  return
195  (gateLevels() != other.gateLevels()) || (waveforms() != other.waveforms());
196 } // icarus::trigger::OpticalTriggerGate::operator==()
std::vector< raw::OpDetWaveform const * > waveforms() const
GateData_t const & gateLevels() const
Access to the underlying gate level data.
GateData_t & gateLevels()
Access to the underlying gate level data (mutable).

Copies/steals all the levels and channels from the specified data.

Definition at line 97 of file OpticalTriggerGate.h.

98  { GateData_t::operator=(data); return *this; }
ReadoutTriggerGate & operator=(ReadoutTriggerGate const &)=default

Definition at line 99 of file OpticalTriggerGate.h.

100  { GateData_t::operator=(std::move(data)); return *this; }
ReadoutTriggerGate & operator=(ReadoutTriggerGate const &)=default

Definition at line 183 of file OpticalTriggerGate.cxx.

184 {
185  return
186  (gateLevels() == other.gateLevels()) && (waveforms() == other.waveforms());
187 } // icarus::trigger::OpticalTriggerGate::operator==()
std::vector< raw::OpDetWaveform const * > waveforms() const
GateData_t const & gateLevels() const
Access to the underlying gate level data.
GateData_t & gateLevels()
Access to the underlying gate level data (mutable).
void icarus::trigger::OpticalTriggerGate::registerWaveforms ( Waveforms_t const &  moreWaveforms)
protected

Registers the waveforms from the specified list.

Definition at line 55 of file OpticalTriggerGate.cxx.

56 {
57  //
58  // add channels
59  //
60  associateChannels(extractChannels(moreWaveforms));
61 
62  //
63  // merge the two lists, then sort them
64  //
65  auto const middle = fWaveforms.insert
66  (fWaveforms.end(), moreWaveforms.begin(), moreWaveforms.end());
67  std::inplace_merge
68  (fWaveforms.begin(), middle, fWaveforms.end(), ::OpDetWaveformComp());
69 
70  // finally remove any duplicate (there should be none, should it?)
71  auto const actualEnd
72  = std::unique(fWaveforms.begin(), fWaveforms.end()); // pointer comparison
73  fWaveforms.erase(actualEnd, fWaveforms.end());
74 
75 
76 } // OpticalTriggerGate::registerWaveforms()
void associateChannels(std::initializer_list< ChannelID_t > const &moreChannels)
Associates this data with the channels from the specified list.
static GateData_t::ChannelList_t extractChannels(Waveforms_t const &waveforms)
Returns the list of all channels from the waveforms (duplicate allowed).
std::vector< raw::OpDetWaveform const * > fWaveforms
List of waveforms involved in this channel.
icarus::trigger::OpticalTriggerGate & icarus::trigger::OpticalTriggerGate::Sum ( OpticalTriggerGate const &  other)

Combines with a gate, keeping the sum of openings of the two.

Parameters
othergate to combine to
Returns
this object
See Also
Min(), Max()

Definition at line 121 of file OpticalTriggerGate.cxx.

122 {
123  GateData_t::Sum(other);
124  mergeWaveformsFromGate(other);
125  return *this;
126 } // icarus::trigger::OpticalTriggerGate::Sum()
ReadoutTriggerGate & Sum(ReadoutTriggerGate const &other)
Combines with a gate, keeping the sum of openings of the two.
void mergeWaveformsFromGate(OpticalTriggerGate const &other)
Registers the waveforms from the other gate into this one.
icarus::trigger::OpticalTriggerGate icarus::trigger::OpticalTriggerGate::Sum ( OpticalTriggerGate const &  a,
OpticalTriggerGate const &  b 
)
static

Returns a gate with opening sum of the specified two.

Parameters
afirst gate
bsecond gate
Returns
gate with at every tick the total opening of a and b
See Also
Max()

Definition at line 153 of file OpticalTriggerGate.cxx.

154 { auto combination { a }; combination.Sum(b); return combination; }
process_name gaushit a
template<typename Op >
icarus::trigger::OpticalTriggerGate icarus::trigger::OpticalTriggerGate::SymmetricCombination ( Op &&  op,
OpticalTriggerGate const &  a,
OpticalTriggerGate const &  b,
TriggerGateTicks_t  aDelay,
TriggerGateTicks_t  bDelay 
)

Definition at line 166 of file OpticalTriggerGate.cxx.

171 {
172  return {
174  (std::forward<Op>(op), a, b, aDelay, bDelay),
175  OpticalTriggerGate::mergeWaveforms(a.waveforms(), b.waveforms())
176  };
177 
178 } // icarus::trigger::OpticalTriggerGate::SymmetricCombination()
static ReadoutTriggerGate SymmetricCombination(Op &&op, ReadoutTriggerGate const &a, ReadoutTriggerGate const &b, ClockTicks_t aDelay=ClockTicks_t{0}, ClockTicks_t bDelay=ClockTicks_t{0})
Returns a gate combination of the openings of two other gates.
process_name gaushit a
static Waveforms_t mergeWaveforms(Waveforms_t const &a, Waveforms_t const &b)
Registers the waveforms from the other gate into this one.
template<typename Op >
static OpticalTriggerGate icarus::trigger::OpticalTriggerGate::SymmetricCombination ( Op &&  op,
OpticalTriggerGate const &  a,
OpticalTriggerGate const &  b,
TriggerGateTicks_t  aDelay = TriggerGateTicks_t{0},
TriggerGateTicks_t  bDelay = TriggerGateTicks_t{0} 
)
static

Returns a gate combination of the openings of two other gates.

Template Parameters
Opbinary operation: OpeningCount_t (x2) to OpeningCount_t
Parameters
opsymmetric binary combination operation
afirst gate
bsecond gate
Returns
gate with opening combination of a and b

For this algorithm to work, the operation needs to be symmetric, i.e. op(c1, c2) == op(c2, c1) for every valid combinations of counts c1 and c2.

auto icarus::trigger::OpticalTriggerGate::waveformChannels ( Waveforms_t const &  waveforms)
staticprivate

Returns the list of all unique channels (sorted) from the waveforms.

Definition at line 230 of file OpticalTriggerGate.cxx.

231 {
233 } // icarus::trigger::OpticalTriggerGate::waveformChannels()
std::vector< raw::OpDetWaveform const * > waveforms() const
ChannelList_t & normalizeChannels()
Removes duplicate channel IDs and sorts the remaining ones.
static GateData_t::ChannelList_t extractChannels(Waveforms_t const &waveforms)
Returns the list of all channels from the waveforms (duplicate allowed).
std::vector<raw::OpDetWaveform const*> icarus::trigger::OpticalTriggerGate::waveforms ( ) const
inline

Returns a list of pointers to the waveforms associated to the gate, sorted.

Definition at line 116 of file OpticalTriggerGate.h.

117  { return fWaveforms; }
std::vector< raw::OpDetWaveform const * > fWaveforms
List of waveforms involved in this channel.

Member Data Documentation

std::vector<raw::OpDetWaveform const*> icarus::trigger::OpticalTriggerGate::fWaveforms
private

List of waveforms involved in this channel.

Definition at line 261 of file OpticalTriggerGate.h.


The documentation for this class was generated from the following files: