CFEL - ASG Software Suite
2.5.0
CASS
|
Online Input to be used at SACLA. More...
#include <sacla_online_input.h>
Public Member Functions | |
void | runthis () |
starts the thread More... | |
void | load () |
do not load anything after it is started More... | |
uint64_t | eventcounter () |
retrieve the number of processed events More... | |
uint64_t | skippedeventcounter () |
retrieve the number of skipped processed events More... | |
![]() | |
virtual | ~InputBase () |
destructor More... | |
virtual double | progress () |
retrieve the fraction of how much of the input has been processed More... | |
void | newEventAdded (const size_t eventsize) |
increment the numer of events received in the ratemeter More... | |
RingBuffer< CASSEvent > & | ringbuffer () |
retrieve a reference to the the ringbuffer More... | |
rbItem_t | getNextFillable (unsigned timeout=500) |
retrieve an iterator to the next fillable event More... | |
![]() | |
PausableThread (control_t control=_run, QObject *parent=0) | |
constructor More... | |
virtual | ~PausableThread () |
destructor More... | |
void | run () |
run the thread More... | |
void | pause (bool block=false) |
pause the thread More... | |
void | waitUntilPaused () |
waits until thread is paused More... | |
void | resume () |
resume the thread More... | |
status_t | status () const |
return the current status of the thread More... | |
bool | shouldQuit () const |
query whether this thread is told to quit More... | |
void | rethrowException () const |
rethrow the thrown exception More... | |
exception_t | exceptionThrown () const |
![]() | |
QThread (QObject *parent=0) | |
currentThread () | |
HANDLE QThread::currentThreadId() | |
exec () | |
exit (int returnCode=0) | |
finished () | |
idealThreadCount () | |
isFinished () | |
isRunning () | |
msleep (unsigned long msecs) | |
priority () | |
quit () | |
run () | |
setPriority (Priority priority) | |
setStackSize (uint stackSize) | |
setTerminationEnabled (bool enabled=true) | |
sleep (unsigned long secs) | |
stackSize () | |
start (Priority priority=InheritPriority) | |
started () | |
terminate () | |
terminated () | |
usleep (unsigned long usecs) | |
wait (unsigned long time=ULONG_MAX) | |
yieldCurrentThread () | |
Static Public Member Functions | |
static void | instance (RingBuffer< CASSEvent > &buffer, Ratemeter &ratemeter, Ratemeter &loadmeter, QObject *parent=0) |
create an instance of this More... | |
![]() | |
static shared_pointer | instance () |
get the signelton instance More... | |
static shared_pointer::element_type & | reference () |
get reference to the singelton instance More... | |
Private Member Functions | |
SACLAOnlineInput (RingBuffer< CASSEvent > &buffer, Ratemeter &ratemeter, Ratemeter &loadmeter, QObject *parent=0) | |
constructor More... | |
Private Attributes | |
uint64_t | _evtCounter |
a counter for the events so far More... | |
uint64_t | _skippedEvtCounter |
a counter for the skipped events so far More... | |
Additional Inherited Members | |
![]() | |
typedef std::tr1::shared_ptr< InputBase > | shared_pointer |
shared pointer of this type More... | |
typedef RingBuffer< CASSEvent >::iter_type | rbItem_t |
define an item in the ringbuffer More... | |
![]() | |
enum | status_t { running, paused, notstarted } |
enum describing the internal status of the thread More... | |
enum | control_t { _run, _quit, _pause } |
enum describing the control status of the thread More... | |
enum | exception_t { NO_EXCEPTION, INVALID_ARGUMENT_EXCEPTION, RUNTIME_ERROR_EXCEPTION, OUT_OF_RANGE_EXCEPTION, LOGIC_ERROR_EXCEPTION, STANDART_EXCEPTION, UNKNOWN_EXCEPTION } |
enum describing which exception was thrown More... | |
![]() | |
virtual void | end () |
tell the thread to quit More... | |
![]() | |
QMutex | lock |
a mutex so that external program can lock access to this More... | |
![]() | |
InputBase (RingBuffer< CASSEvent > &ringbuffer, Ratemeter &ratemeter, Ratemeter &loadmeter, QObject *parent=0) | |
protected constructor since it should be a singelton More... | |
![]() | |
void | pausePoint () |
point where the thread will be paused More... | |
![]() | |
RingBuffer< CASSEvent > & | _ringbuffer |
reference to the ringbuffer More... | |
Ratemeter & | _ratemeter |
ratemeter to measure the rate More... | |
Ratemeter & | _loadmeter |
meter to measure the data load More... | |
![]() | |
QMutex | _pauseMutex |
mutex to wait on until thread is paused More... | |
QWaitCondition | _pauseCondition |
wait condition to wait on until thread is resumed More... | |
QWaitCondition | _waitUntilPausedCondition |
wait condition to wait unitl thread is paused More... | |
status_t | _status |
the internal status of the thread More... | |
control_t | _control |
the internal control status of the thread More... | |
size_t | _pausecount |
a counter how many threads have pause this thread More... | |
exception_t | _exception_thrown |
flag to show that general exception was thrown More... | |
std::invalid_argument | _invarg_excep |
the invalid arguemnt exception thrown More... | |
std::runtime_error | _runt_excep |
the invalid arguemnt exception thrown More... | |
std::out_of_range | _outrange_excep |
the invalid arguemnt exception thrown More... | |
std::logic_error | _logic_excep |
the invalid arguemnt exception thrown More... | |
![]() | |
static shared_pointer | _instance |
singelton instance More... | |
Online Input to be used at SACLA.
Makes use of the "OnlineUserAPI" to retrieve the detector data online. All data that is stored in the database is retrieved using the SACLADataAccessUserAPI.
SACLAOnlineInput/{MaxGuessedEvents}
The number of consecutive events that should be guessed. Once this number of events has been reached. The latest tag number will be retrieved for the next event. Default is 60.
SACLAOnlineInput/{BeamlineNumber}
The Beamline at which the experiment is running. Default is 3
SACLAOnlineInput/OctalPixelDetectors/{size}
The number of octal pixeldetectors that one wants to retrieve. Ensure that each parameter has a unique id in the list.
SACLAOnlineInput/OctalPixelDetectors/%index%/{CASSID}
The id of the detector that CASS will use internally. Default is "-1" which will cause to skip this index.
SACLAOnlineInput/OctalPixelDetectors/%index%/{NextTagNumberAdvancedBy}
It is needed to guess the next tag number therefore one has to tell how much the tag number advanced from one shot to the next. The tag number is increased with 60 Hz. Therefore at 30 Hz this number should be 2. Default is 2.
SACLAOnlineInput/OctalPixelDetectors/%index%/Tiles/{size}
The number of tiles contained within the octal pixeldetectors Ensure that each parameter has a unique id in the list.
SACLAOnlineInput/OctalPixelDetectors/%index%/Tiles/%index%/{TileName}
Name of the tile in the SACLA DAQ. Default is "Invalid".
SACLAOnlineInput/OctalPixelDetectors/%index%/Tiles/%index%{NbrCalibrationRows}
Number of additional rows that are not part of the image but used for calibrating the image. Default is 6.
SACLAOnlineInput/OctalPixelDetectors/%index%/Tiles/%index%{NormalizeTo}
Using this option one can control whether the pixel values of this tile will be normalized to the gain value of which other tile. The pixel values of this tile will be modified using: Default is 0 in which case the tile will not be normalized.
SACLAOnlineInput/DatabaseValues/{size}
The number of values one wants to retrieve from the database. Be sure that for each detector there is a unique id in the list below. At least one pixel detector is needed in order to be able to retrieve data using the SACLADataAccessUserAPI, since the runnumber is needed to retrieve the needed hightag number.
SACLAOnlineInput/DatabaseValues/%index%/{ValueName}
The name of the database value to retrieve. Default is "Invalid" which will cause to skip that index.
SACLAOnlineInput/DatabaseValues/%index%/{CASSName}
The name that the value should have within the CASSEvent. Default is "Invalid" in which case the name of the value will be chosen.
Definition at line 76 of file sacla_online_input.h.
|
private |
constructor
creates the thread.
buffer | the ringbuffer, that we take events out and fill it with the incomming information |
ratemeter | reference to the ratemeter to measure the rate of the input |
loadmeter | reference to the ratemeter to measure the load of the input |
parent | the parent of this object |
Definition at line 484 of file sacla_online_input.cpp.
References cass::Log::add(), and cass::Log::VERBOSEINFO.
|
inlinevirtual |
retrieve the number of processed events
Reimplemented from cass::InputBase.
Definition at line 108 of file sacla_online_input.h.
References _evtCounter.
|
static |
create an instance of this
this initializes the _instance member of the base class. Check here if it is already initialized, if so throw logic error.
buffer | the ringbuffer, that we take events out and fill it with the incomming information |
ratemeter | reference to the ratemeter to measure the rate of the input |
loadmeter | reference to the ratemeter to measure the load of the input |
parent | the parent of this object |
Definition at line 474 of file sacla_online_input.cpp.
|
inlinevirtual |
do not load anything after it is started
Implements cass::InputBase.
Definition at line 102 of file sacla_online_input.h.
|
virtual |
starts the thread
this is the main while loop collecting the requested data and making it available using the ringbuffer.
load settings from the ini file
load requested octal detectors
skip if the detector cass id has not been set
load the infos for the detector
setup the individual tiles of the detector
quit if not at least one octal detector has been defined
generate a counter to enable the user to reset to the latest event after so and so many events
load the beamline number of the beamline we're running on (needed to retieve database values)
load the requested database values
skip if the value name has not been set and not at least one octal detector exitst
add the machine value
if the cass name is set then overwrite it withing the machinevalue
run until the thread is told to quit
here we can safely pause the execution
retrieve a new element from the ringbuffer, continue with next iteration in case the retrieved element is the iterator to the last element of the buffer.
generate and set variable to keep the size of the retrieved data
use try...catch to get notified when the requested tag data is not available anymore
get the part where the detector will be store in from the event
get the latest tag from the first defined octal detector
only do something when the tag has advanced
set the event id
copy octal detector data to cassevent and add the size in bytes copied to the total size retrieved
get refrence to the machine device of the CASSEvent
retrieve requested machinedata, copy it to the CASSEvent and add the size in bytes to the total size retrieved
remember the latest tag, but reset it every user given event, to ensure that always gets the latest data.
if the data for the tag wasn't available, reset the last tag and the datasize
let the ratemeter know that we're done with this event with size datasize and return the element to the ringbuffer, telling it whether it contains valuable information (datasize is non zero)
Implements cass::InputBase.
Definition at line 495 of file sacla_online_input.cpp.
References _evtCounter, cass::InputBase::_ringbuffer, _skippedEvtCounter, cass::Log::add(), QSettings::beginGroup(), QSettings::beginReadArray(), cass::OctalDetector::CASSID, cass::Log::DEBUG0, cass::CASSEvent::devices(), QSettings::endArray(), QSettings::endGroup(), cass::Log::ERROR, cass::DetectorTile::gain, cass::InputBase::getNextFillable(), cass::CASSEvent::id(), cass::Log::INFO, cass::DetectorTile::name, cass::InputBase::newEventAdded(), cass::DetectorTile::normalizeID, lmf::PausableThread::pausePoint(), cass::CASSEvent::PixelDetectors, cass::DetectorTile::relativeGain, QSettings::setArrayIndex(), lmf::PausableThread::shouldQuit(), size, cass::toString(), QSettings::value(), cass::Log::WARNING, cass::DetectorTile::xsize, and cass::DetectorTile::ysize.
|
inlinevirtual |
retrieve the number of skipped processed events
Reimplemented from cass::InputBase.
Definition at line 114 of file sacla_online_input.h.
References _skippedEvtCounter.
|
private |
a counter for the events so far
Definition at line 132 of file sacla_online_input.h.
Referenced by eventcounter(), and runthis().
|
private |
a counter for the skipped events so far
Definition at line 135 of file sacla_online_input.h.
Referenced by runthis(), and skippedeventcounter().