 |
Belle II Software
release-05-02-19
|
17 #include "trg/trg/Clock.h"
18 #include "trg/trg/Time.h"
19 #include "trg/trg/Signal.h"
20 #include "trg/trg/Utilities.h"
24 namespace Belle2_GDL {
36 TRGClock::TRGClock(
const string& name,
44 _frequency(frequency),
45 _cycle(1000 / frequency),
50 _min(numeric_limits<int>::min() / 16),
51 _max(numeric_limits<int>::max() / 16),
55 if (
this != & Belle2_GDL::GDLSystemClock) {
67 unsigned multiplicationFactor,
68 unsigned divisionFactor)
71 _multi(multiplicationFactor),
73 _offset(source._offset),
74 _frequency(source._frequency *
75 double(multiplicationFactor) /
76 double(divisionFactor)),
77 _cycle(source._cycle /
78 double(multiplicationFactor) *
79 double(divisionFactor)),
80 _min(source._min * int(multiplicationFactor) / int(divisionFactor)),
81 _max(source._max * int(multiplicationFactor) / int(divisionFactor)),
94 const string& pre)
const
99 cout << pre <<
" multiplication factor=" <<
_multi << endl;
100 cout << pre <<
" division factor =" <<
_div << endl;
105 cout << pre <<
" offset :" <<
_offset << endl
107 << pre <<
" cycle(ns):" <<
_cycle << endl
108 << pre <<
" min pos :" <<
_min << endl
109 << pre <<
" max pos :" <<
_max << endl
110 << pre <<
" min(ns) :" <<
minTiming() << endl
111 << pre <<
" max(ns) :" <<
maxTiming() << endl;
113 cout << pre <<
" numeric limit of int (min,max="
114 << numeric_limits<int>::min() <<
","
115 << numeric_limits<int>::max() <<
")" << endl;
123 cout <<
"TRGClock::unit(" <<
_name
124 <<
") !!! out of time window : min=" <<
minTiming()
125 <<
",max=" <<
maxTiming() <<
",given value=" << t << endl;
163 const double pos0 = double(
int(pos));
164 const double dif = pos - pos0;
181 for (
int i = 0; i < 5; i++) {
186 const int maxN = 400;
187 for (
int j = 0; j < maxN; j++) {
188 if (((j - cicle / 2) % cicle) == 0)
189 s.set(j, j + cicle / 2);
194 (* _clockCounter) += s;
A class to represent a digitized signal. Unit is nano second.
const TRGClock * _source
Clock source.
int _min
Clock min. count.
const TRGSignalVector & clockCounter(void) const
returns the clock counter.
const std::string & name(void) const
returns name.
const double _cycle
Clock cycle in nano second.
void dump(const std::string &message="", const std::string &pre="") const
dumps contents.
TRGTime minTRGTime(bool edge) const
returns min. TRGtime with clock.
const unsigned _div
Division factor.
Abstract base class for different kinds of events.
double minTiming(void) const
returns min. timing.
double overShoot(double timing) const
returns over shoot.
const double _frequency
Frequency in MHz.
TRGTime maxTRGTime(bool edge) const
returns max. TRGtime with clock.
int _max
Clock max. count.
double maxTiming(void) const
returns max. timing.
int position(double timing) const
returns clock position.
virtual ~TRGClock()
Destructor.
TRGClock(const std::string &name, double offset, double frequency)
Constructor. "offset" is in unit of ns. "frequency" is in unit of MHz.
const std::string _name
Name.
static std::string itostring(int i)
converts int to string. (Use boost::lexical_cast)
TRGSignalVector * _clockCounter
Clock counter.
double absoluteTime(int clockPosition) const
returns absolute time of clock position
const unsigned _multi
Multiplication factor.
double phase(double timing) const
returns phase of given timing in degree (0 to 360).
A class to represent a signal timing in the trigger system.
const double _offset
Clock offset in nano second.
A class to represent a digitized signal. Unit is nano second.
A class to represent a bundle of digitized signals.