10#define TRGSignal_FLAG_
13#include "trg/trg/Clock.h"
14#include "trg/trg/Time.h"
42 const TRGClock& = Belle2_GDL::GDLSystemClock);
59 const std::string&
name(
void)
const;
68 unsigned nEdges(
void)
const;
71 unsigned width(
unsigned i = 0)
const;
77 bool active(
int clk0,
int clk1)
const;
80 bool state(
int clockPosition)
const;
84 bool riseEdge(
int clockPosition)
const;
91 void dump(
const std::string& message =
"",
92 const std::string& pre =
"")
const;
97 const std::string&
name(
const std::string& newName);
164 static std::vector<TRGTime>
orOperation(
const std::vector<TRGTime>&);
197 return _name = newName;
219 return (*
this) &= left;
246 return (*
this) |= left;
290 for (
unsigned i = 0; i <
_history.size(); i++) {
308 for (
unsigned i = 0; i <
_history.size(); i++) {
311 }
else if (
_history[i].time() == a) {
313 }
else if (
_history[i].time() > a) {
340 return (!
operator==(a));
347 for (
unsigned i = 0; i <
_history.size(); i++) {
349 const int t0 =
_history[i - 1].time();
352 if ((c1 > t0) && (c0 < t1))
354 if ((c1 < t0) && (c1 < t1))
A class to represent a digitized signal. Unit is nano second.
A class to represent a digitized signal. Unit is nano second.
const TRGSignal & set(double t0, double t1)
makes a pulse with leading edge at t0 and with trailing edge at t1.
const TRGClock * _clock
Clock.
std::vector< TRGTime > _history
Timing history.
TRGSignal & operator=(const TRGSignal &)=default
Default assignment operator.
A class to represent a signal timing in the trigger system.
TRGSignal & operator|=(const TRGSignal &)
returns OR result.
unsigned nEdges(void) const
returns # of edges.
static std::vector< TRGTime > orOperation(const std::vector< TRGTime > &)
Or operation.
TRGSignal & operator&=(const TRGSignal &)
returns AND result.
const TRGTime * operator[](unsigned i) const
returns timing of i'th edge.
TRGSignal operator&(const TRGSignal &) const
returns AND result.
const TRGClock & clock(void) const
returns clock.
bool operator!=(const TRGSignal &) const
returns true if two are the same.
TRGSignal & widen(unsigned width)
returns widen signals. Signals wider than "width" will be untouched.
bool riseEdge(int clockPosition) const
returns true if signal is active and rising edge in give clock position.
const std::string & name(void) const
returns name.
std::vector< int > stateChanges(void) const
returns a list of clock position of state change.
const TRGSignal & unset(int t0, int t1)
clear(or unset) with leading edge at clock t0 and with trailing edge at clock t1.
unsigned width(unsigned i=0) const
returns width of i'th signal (i=0,1,2,...).
unsigned nSignals(void) const
returns # of signals.
bool state(int clockPosition) const
returns true if signal is active in given clock position.
virtual ~TRGSignal()
Destructor.
bool active(void) const
returns true if there is a signal.
bool operator==(const TRGSignal &) const
returns true if two are the same.
void sort(void)
Sort operation.
TRGSignal operator|(const TRGSignal &) const
returns OR result.
void clear(void)
clears contents.
bool consistencyCheck(void) const
Self-consitency check. True is return if something wrong.
const TRGSignal & invert(void)
makes signal inverted.
void dump(const std::string &message="", const std::string &pre="") const
dumps contents.
Abstract base class for different kinds of events.