CFEL - ASG Software Suite
2.5.0
CASS
|
XFEL Input for receiving data. More...
#include <xfel_online_input.h>
Public Member Functions | |
void | runthis () |
starts the thread More... | |
void | load () |
do not load anything 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, bool quitwhendone=false, 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 | |
XFELOnlineInput (RingBuffer< CASSEvent > &buffer, Ratemeter &ratemeter, Ratemeter &loadmeter, bool quitwhendone, QObject *parent=0) | |
constructor More... | |
Private Attributes | |
bool | _quitWhenDone |
flag to tell the thread to quit when its done with all files More... | |
uint64_t | _counter |
the counter for all events More... | |
uint64_t | _scounter |
the counter for all events 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... | |
XFEL Input for receiving data.
This class is a thread that connects to a XFEL Server and retrieves the data from it.
XFELOnlineInput/{ServerAddress}
The name or ip address of the machine that the server is running on. Default is "tcp://localhost:1234"
XFELOnlineInput/{NbrPulsesInTrain}
The number of pulses within the train. Default is 64
XFELOnlineInput/{Source}
The data source within the transferred kb_data. Default is SPB_DET_AGIPD1M-1/DET/detector-1
XFELOnlineInput/{CASSID}
The id of the image data within the cassevent. Default is 30.
XFELOnlineInput/{PathToImage}
path to the image data within the transferred data. Default is "image.data"
Definition at line 43 of file xfel_online_input.h.
|
private |
constructor
creates the thread. Connects to the tcp server and then retrieves the data streams. The data within the stream will be deserialized with the help of deserialization functions, where the user has to choose which one is appropriate via the .ini file parameters. The thread runs as long as noone calls the end() member of the base class. In case a timeout occurs when waiting for a new event, it will just continue and wait for the next timeout. In case that a timeout occurred when waiting for the data of an event it throws an runtime 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 |
quitwhendone | flag to tell whether to quit the input when done |
parent | the parent of this object |
Definition at line 37 of file xfel_online_input.cpp.
|
inlinevirtual |
retrieve the number of processed events
Reimplemented from cass::InputBase.
Definition at line 77 of file xfel_online_input.h.
References _counter.
|
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 |
quitwhendone | flag to tell whether to quit the input when done |
parent | the parent of this object |
Definition at line 26 of file xfel_online_input.cpp.
|
inlinevirtual |
|
virtual |
starts the thread
Starts the thread and the loop that waits for data. When an timout occured it will just restart the loop until the quit flag is set.
info specific to the xfel data server
how many pulses are within the transferred data
info about the source of the data of interest
info where the image data is within the transferred data
the id that the data should have within the cass-event
create a karabo client that allows to connect to online karabo
write the data structure that is sent by the server to the log
connect to the xfel client
write the data structure that is sent by the server to the log
write the data structure that is sent by the server to the log
run until the thread is told to quit
here we can safely pause the execution
now retrive new data from the socket
get the shape of the detector (encodes the pulses in the train and the and the shape itself)
should be in the shape of nPulses,nModules,512,128 but is most likely in the shape of nModules,128,512,nPulses so one needs to transpose the axis.
get the detector data
check if the data is consistent
go through all pulses in the train
skip some known bad pulses
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.
get reference to all devices of the CASSEvent and an iterator
retrieve the pixel detector part of the cassevent
retrieve the right detector from the cassevent and reset it
copy the data of the pulse from the xfel input to the cassevent
ensure that all values in the frame are numbers
retrieve the machine detector part of the cassevent
tell the ringbuffer that we're done with the event
Implements cass::InputBase.
Definition at line 50 of file xfel_online_input.cpp.
References _counter, cass::InputBase::_ringbuffer, lmf::PausableThread::_status, cass::Log::add(), cass::MachineData::Device::BeamlineData(), QSettings::beginGroup(), data, cass::pixeldetector::Device::dets(), cass::CASSEvent::devices(), QSettings::endGroup(), cass::Log::ERROR, cass::pixeldetector::Detector::frame(), cass::InputBase::getNextFillable(), cass::CASSEvent::id(), cass::Log::INFO, cass::CASSEvent::MachineData, cass::InputBase::newEventAdded(), lmf::PausableThread::pausePoint(), cass::CASSEvent::PixelDetectors, lmf::PausableThread::running, lmf::PausableThread::shouldQuit(), size, cass::toString(), and QSettings::value().
|
inlinevirtual |
retrieve the number of skipped processed events
Reimplemented from cass::InputBase.
Definition at line 83 of file xfel_online_input.h.
References _scounter.
|
private |
the counter for all events
Definition at line 112 of file xfel_online_input.h.
Referenced by eventcounter(), and runthis().
|
private |
flag to tell the thread to quit when its done with all files
Definition at line 109 of file xfel_online_input.h.
|
private |
the counter for all events
Definition at line 115 of file xfel_online_input.h.
Referenced by skippedeventcounter().