QSmartScopeChannel Class Reference
[Apollo]

List of all members.


Detailed Description

interface between online scope gui classes and shared memory containing data

Author:
Sergio Di Domizio
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.
In order to ensure that no big delay exist between displayed data and real time data acquisition, this class implements a mechanism to inform the calling code about accumulated delay.

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
QCrateReceiverBufferfBuffer
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

Member Function Documentation

bool QSmartScopeChannel::SetChannel ( unsigned int  channel  ) 

set logical channel to be read

Returns:
true unless attaching to shared memory for the requested channel fails

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

Parameters:
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
Returns:
true unless any of channel, window length or update period are not initialized

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.

Returns:
last valid index
This value is needed from time to time to re-sync smart scope to real time data taking

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

Returns:
the applied display rate
Sampling rates available for display can be obtained by calling the GetDisplayRates() member function. This function returns the requested value or the closest one if the requested value is not available.

References fDisplayRates.

Referenced by SetChannel().

double QSmartScopeChannel::GetData ( unsigned int  nCycle  )  [private]

get data from shared memory

Parameters:
nCycle histogram upper bound in units of update cycles since the beginning of displayed data
Returns:
accumulated delay wrt real time data acquisition, in seconds
Notice that delay cannot be less than QVSC_MIN_DELAY, which is currently se to 1.2s

References fBuffer, fData, fLastCycle, fSampleZero, QCrateReceiverBuffer::GetSample(), QCrateReceiverBuffer::GetWritten(), gUpdatePeriod, and gWinLength.

Referenced by GetHistogram().


Member Data Documentation

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().

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().


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

Generated on Tue Nov 16 10:50:08 2010 for CUORE Software by  doxygen 1.5.6