This class attaches to an existing shared memory containing the data being acquired for the selected channel and fills an histogram containing the last bunch of seconds of the waveform.
Public Member Functions | |
QSmartScopeChannel () | |
ctor | |
virtual | ~QSmartScopeChannel () |
dtor | |
bool | SetChannel (unsigned int channel) |
set logical channel to be read | |
const unsigned int | GetChannel () const |
get current channel | |
const std::vector< unsigned int > & | GetDisplayRates () const |
get allowed display rates for current channel | |
bool | GetHistogram (TH1F &histo, unsigned int upperEdge, double &delay) |
get histogram | |
unsigned int | GetLatestIndex () const |
get latest valid index in unit of update periods wrt time zero. | |
unsigned int | SetDisplayRate (unsigned int rate) |
set sampling rate to be used in histogram display | |
void | SetWindow (unsigned int winLength) |
set duration for dsplayed histogram in ms | |
void | SetUpdatePeriod (unsigned int period) |
set update period in ms | |
Private Member Functions | |
void | EvalDisplayRates () |
evaluate acceptable display rates for current channel | |
void | SetSampleZero () |
set zero offset for update cycles counter | |
double | GetData (unsigned int nCycle) |
get data from shared memory | |
Private Attributes | |
unsigned int | fChannel |
unsigned int | fStepSize |
unsigned int | fRealRate |
unsigned int | fDisplayRate |
unsigned int | fLastCycle |
unsigned long long | fSampleZero |
QCrateReceiverBuffer * | fBuffer |
std::vector< unsigned int > | fDisplayRates |
std::deque< long > | fData |
Static Private Attributes | |
static long long | gTimeZero = -2 |
static unsigned int | gUpdatePeriod = 0 |
static unsigned int | gWinLength = 0 |
static unsigned int | gInstances = 0 |
bool QSmartScopeChannel::SetChannel | ( | unsigned int | channel | ) |
set logical channel to be read
References EvalDisplayRates(), fBuffer, fChannel, fData, QError::GetCode(), QCrateReceiverBuffer::GetSamplingRate(), SetDisplayRate(), and SetSampleZero().
Referenced by QGSDisplayManager::Update().
bool QSmartScopeChannel::GetHistogram | ( | TH1F & | histo, | |
unsigned int | upperEdge, | |||
double & | delay | |||
) |
get histogram
histo | reference to histogram to be filled | |
upperEdge | histogram upper edge in units of update cycles since the beginning of the display | |
delay | accumulated delay wrt real time daq |
References fChannel, fData, GetData(), gUpdatePeriod, and gWinLength.
Referenced by QGSDisplayManager::Update().
unsigned int QSmartScopeChannel::GetLatestIndex | ( | ) | const |
get latest valid index in unit of update periods wrt time zero.
References fBuffer, fSampleZero, QCrateReceiverBuffer::GetWritten(), and gUpdatePeriod.
Referenced by QGSDisplayManager::Update().
unsigned int QSmartScopeChannel::SetDisplayRate | ( | unsigned int | rate | ) |
set sampling rate to be used in histogram display
References fDisplayRates.
Referenced by SetChannel().
double QSmartScopeChannel::GetData | ( | unsigned int | nCycle | ) | [private] |
get data from shared memory
nCycle | histogram upper bound in units of update cycles since the beginning of displayed data |
References fBuffer, fData, fLastCycle, fSampleZero, QCrateReceiverBuffer::GetSample(), QCrateReceiverBuffer::GetWritten(), gUpdatePeriod, and gWinLength.
Referenced by GetHistogram().
unsigned int QSmartScopeChannel::fChannel [private] |
current logical channel
Referenced by GetChannel(), GetHistogram(), and SetChannel().
unsigned int QSmartScopeChannel::fLastCycle [private] |
index associated to last bunch of read data
Referenced by GetData().
unsigned long long QSmartScopeChannel::fSampleZero [private] |
Sample index used as a reference in the evaluation of the number of update cycles already performed.
Referenced by GetData(), GetLatestIndex(), and SetSampleZero().
long long QSmartScopeChannel::gTimeZero = -2 [static, private] |
Reference time from measurement start in ns from which the number of already performed update cycles is evaluated (must be the same for all channels).
Referenced by SetSampleZero(), and ~QSmartScopeChannel().
unsigned int QSmartScopeChannel::gUpdatePeriod = 0 [static, private] |
update period in ms (must be the same for all smart channels)
Referenced by GetData(), GetHistogram(), GetLatestIndex(), and SetUpdatePeriod().
unsigned int QSmartScopeChannel::gWinLength = 0 [static, private] |
window length in ms (must be the same for all smart channels)
Referenced by GetData(), GetHistogram(), and SetWindow().
unsigned int QSmartScopeChannel::gInstances = 0 [static, private] |
number of existing instances of this class
Referenced by QSmartScopeChannel(), and ~QSmartScopeChannel().
QCrateReceiverBuffer* QSmartScopeChannel::fBuffer [private] |
ptr to data buffer
Referenced by GetData(), GetLatestIndex(), SetChannel(), SetSampleZero(), and ~QSmartScopeChannel().
std::vector<unsigned int> QSmartScopeChannel::fDisplayRates [private] |
available sampling rates that can be used when displaying histogram
Referenced by EvalDisplayRates(), GetDisplayRates(), QSmartScopeChannel(), and SetDisplayRate().
std::deque<long> QSmartScopeChannel::fData [private] |
vector containing data used to fill histogram
Referenced by GetData(), GetHistogram(), QSmartScopeChannel(), and SetChannel().