21 struct OpDetWaveformComp {
37 {
return less(a, b); }
41 {
return less(*a, *b); }
60 associateChannels(extractChannels(moreWaveforms));
65 auto const middle = fWaveforms.insert
66 (fWaveforms.end(), moreWaveforms.begin(), moreWaveforms.end());
68 (fWaveforms.begin(), middle, fWaveforms.end(), ::OpDetWaveformComp());
72 = std::unique(fWaveforms.begin(), fWaveforms.end());
73 fWaveforms.erase(actualEnd, fWaveforms.end());
84 merged.reserve(a.size() + b.size());
86 a.begin(), a.end(), b.begin(), b.end(), std::back_inserter(merged),
92 = std::unique(merged.begin(), merged.end());
93 merged.erase(actualEnd, merged.end());
104 mergeWaveformsFromGate(other);
114 mergeWaveformsFromGate(other);
124 mergeWaveformsFromGate(other);
134 mergeWaveformsFromGate(other);
142 {
auto combination { a }; combination.
Min(b);
return combination; }
148 {
auto combination { a }; combination.
Max(b);
return combination; }
154 {
auto combination { a }; combination.
Sum(b);
return combination; }
160 {
auto combination { a }; combination.
Mul(b);
return combination; }
164 template <
typename Op>
174 (std::forward<Op>(op), a, b, aDelay, bDelay),
191 bool icarus::trigger::OpticalTriggerGate::operator!=
204 auto const& insertionPoint = std::lower_bound
206 if ((insertionPoint !=
fWaveforms.end()) && (*insertionPoint == &waveform))
219 channels.reserve(waveforms.size());
221 waveforms.begin(), waveforms.end(), std::back_inserter(channels),
237 std::ostream& icarus::trigger::operator<<
240 out << gate.gateLevels();
static GateData_t::ChannelList_t waveformChannels(Waveforms_t const &waveforms)
Returns the list of all unique channels (sorted) from the waveforms.
decltype(auto) channels() const
Returns the channels associated to the gate data.
std::vector< raw::OpDetWaveform const * > waveforms() const
ChannelList_t & normalizeChannels()
Removes duplicate channel IDs and sorts the remaining ones.
OpticalTriggerGate & Max(OpticalTriggerGate const &other)
Combines with a gate, keeping the maximum opening among the two.
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.
std::vector< ChannelID_t > ChannelList_t
Type of list of associated channels.
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.
bool add(raw::OpDetWaveform const &waveform)
Adds another waveform to the gate (unless it has already been added).
OpticalTriggerGate & Sum(OpticalTriggerGate const &other)
Combines with a gate, keeping the sum of openings of the two.
GateData_t & gateLevels()
Access to the underlying gate level data (mutable).
void registerWaveforms(Waveforms_t const &moreWaveforms)
Registers the waveforms from the specified list.
This_t & addChannel(ChannelID_t const channel)
Associates the specified channel to this readout gate.
static Waveforms_t mergeWaveforms(Waveforms_t const &a, Waveforms_t const &b)
Registers the waveforms from the other gate into this one.
A trigger gate data object for optical detector electronics.
OpticalTriggerGate & Min(OpticalTriggerGate const &other)
Combines with a gate, keeping the minimum opening among the two.
util::quantities::tick::value_t TriggerGateTicks_t
Tick interval.
static GateData_t::ChannelList_t extractChannels(Waveforms_t const &waveforms)
Returns the list of all channels from the waveforms (duplicate allowed).
OpticalTriggerGate & Mul(OpticalTriggerGate const &other)
Combines with a gate, keeping the product of openings of the two.
std::vector< raw::OpDetWaveform const * > Waveforms_t
Internal list of registered waveforms.
Logical multi-level gate associated to one or more waveforms.
std::vector< raw::OpDetWaveform const * > fWaveforms
List of waveforms involved in this channel.
friend std::ostream & operator(std::ostream &, triggergatedata_t const &)