CFEL - ASG Software Suite  2.5.0
CASS
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
cass::SACLAOfflineInput Class Reference

SACLA Offline Input for cass. More...

#include <sacla_offline_input.h>

+ Inheritance diagram for cass::SACLAOfflineInput:
+ Collaboration diagram for cass::SACLAOfflineInput:

Public Member Functions

void runthis ()
 function with the main loop More...
 
void load ()
 load the parameters used for the input More...
 
double progress ()
 retrieve the progress state More...
 
uint64_t eventcounter ()
 retrieve the number of processed events More...
 
uint64_t skippedeventcounter ()
 retrieve the number of skipped processed events More...
 
- Public Member Functions inherited from cass::InputBase
virtual ~InputBase ()
 destructor 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...
 
- Public Member Functions inherited from lmf::PausableThread
 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
 
- Public Member Functions inherited from QThread
 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 (std::string runlistname, RingBuffer< CASSEvent > &, Ratemeter &ratemeter, Ratemeter &loadmeter, bool quitwhendone, QObject *parent=0)
 create instance of this More...
 
- Static Public Member Functions inherited from cass::InputBase
static shared_pointer instance ()
 get the signelton instance More...
 
static shared_pointer::element_type & reference ()
 get reference to the singelton instance More...
 

Private Types

typedef std::vector< std::tr1::shared_ptr< TagListProcessor > > proc_t
 define the processors container More...
 

Private Member Functions

 SACLAOfflineInput (std::string runlistname, RingBuffer< CASSEvent > &, Ratemeter &ratemeter, Ratemeter &loadmeter, bool quitwhendone, QObject *parent=0)
 constructor More...
 

Private Attributes

int _chunks
 number of chuncks that the list should be split into More...
 
bool _quitWhenDone
 flag to tell the thread to quit when its done with all files More...
 
std::string _runlistname
 name of the file containing all files that we need to process More...
 
proc_t _procs
 the processor container More...
 

Additional Inherited Members

- Public Types inherited from cass::InputBase
typedef std::tr1::shared_ptr< InputBaseshared_pointer
 shared pointer of this type More...
 
typedef RingBuffer< CASSEvent >::iter_type rbItem_t
 define an item in the ringbuffer More...
 
- Public Types inherited from lmf::PausableThread
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...
 
- Public Slots inherited from lmf::PausableThread
virtual void end ()
 tell the thread to quit More...
 
- Public Attributes inherited from cass::InputBase
QMutex lock
 a mutex so that external program can lock access to this More...
 
- Protected Member Functions inherited from cass::InputBase
 InputBase (RingBuffer< CASSEvent > &ringbuffer, Ratemeter &ratemeter, Ratemeter &loadmeter, QObject *parent=0)
 protected constructor since it should be a singelton More...
 
- Protected Member Functions inherited from lmf::PausableThread
void pausePoint ()
 point where the thread will be paused More...
 
- Protected Attributes inherited from cass::InputBase
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...
 
- Protected Attributes inherited from lmf::PausableThread
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 Protected Attributes inherited from cass::InputBase
static shared_pointer _instance
 singelton instance More...
 

Detailed Description

SACLA Offline Input for cass.

This class will be used in offline modus. I will take an string that contains a filename. In the file that the filename points to has to be a list with beamline number and runnumbers to analyse. These need to be given as a comma separated list. If only these two numbers are provided the list of tags will be retrieved for the given run. Optionally one can also provide a list of tags to be analysed for that given run / beamline number combination. This has to be provided as comma separated list immediatly following the beamline / runnumber combination. The filename name must be passed to the program with the -i parameter.

For each run in the list it will retrieve the tagnumbers and extract the data associated with the tag number using the cass::SACLAConverter

User definable Parameters:
SACLAOfflineInput/{NbrThreads}
Will tell CASS in how many chunks the tag list will be splitted. Each chunk will be processed individually by a separate thread. Default is 1.
Author
Lutz Foucar

Definition at line 46 of file sacla_offline_input.h.

Member Typedef Documentation

typedef std::vector<std::tr1::shared_ptr<TagListProcessor> > cass::SACLAOfflineInput::proc_t
private

define the processors container

Definition at line 121 of file sacla_offline_input.h.

Constructor & Destructor Documentation

SACLAOfflineInput::SACLAOfflineInput ( std::string  runlistname,
RingBuffer< CASSEvent > &  ringbuffer,
Ratemeter ratemeter,
Ratemeter loadmeter,
bool  quitwhendone,
QObject parent = 0 
)
private

constructor

Parameters
runlistnamename of the file containing all runs that should be processed
ringbufferreference to the ringbuffer containing the CASSEvents
ratemeterreference to the ratemeter to measure the rate of the input
loadmeterreference to the ratemeter to measure the load of the input
quitwhendoneflag that tells this class that it should quit the Program when its done reading all events
parentThe parent QT Object of this class

Definition at line 278 of file sacla_offline_input.cpp.

References cass::Log::add(), load(), and cass::Log::VERBOSEINFO.

Member Function Documentation

uint64_t SACLAOfflineInput::eventcounter ( )
virtual

retrieve the number of processed events

Returns
number of processed events

Reimplemented from cass::InputBase.

Definition at line 458 of file sacla_offline_input.cpp.

References _procs.

Referenced by runthis().

void SACLAOfflineInput::instance ( std::string  runlistname,
RingBuffer< CASSEvent > &  ringbuffer,
Ratemeter ratemeter,
Ratemeter loadmeter,
bool  quitwhendone,
QObject parent = 0 
)
static

create instance of this

Parameters
runlistnamename of the file containing all runs that should be processed
ringbufferreference to the ringbuffer containing the CASSEvents
ratemeterreference to the ratemeter to measure the rate of the input
loadmeterreference to the ratemeter to measure the load of the input
quitwhendoneflag that tells this class that it should quit the Program when its done reading all events
parentThe parent QT Object of this class

Definition at line 267 of file sacla_offline_input.cpp.

void SACLAOfflineInput::load ( )
virtual

load the parameters used for the input

Implements cass::InputBase.

Definition at line 291 of file sacla_offline_input.cpp.

References _chunks, QSettings::beginGroup(), and QSettings::value().

Referenced by SACLAOfflineInput().

double SACLAOfflineInput::progress ( )
virtual

retrieve the progress state

Returns
the processing progress

Reimplemented from cass::InputBase.

Definition at line 450 of file sacla_offline_input.cpp.

References _procs.

void SACLAOfflineInput::runthis ( )
virtual

function with the main loop

get a list of all runs to process

add an eventcounter

iterate through the list of runs

split the runname into the run and beamline combination

check if the runstatus is set to 'run ended' and thus the data is available to read

the rest of the line could be a separated list of tags, add them to the id list

if the user did not provide a tag list, get the tag list from the API If there was an error, then continue with the next run in the runlist

otherwise check if the provided tags are part of the provided run

split the taglist into the user requested amount of chunks and process the splittet tag list in separate threads

generate a processor for the chunk

start the processor

put the processor in the processor container

if there are tags in the list remaining, add the into the last processor

start the processor

put the processor in the processor container

wait until all threads are finished and sum up the total events

in case the input should not quit when everything has been processed, wait until the input thread is told to quit

Implements cass::InputBase.

Definition at line 298 of file sacla_offline_input.cpp.

References _chunks, _procs, _quitWhenDone, _runlistname, lmf::PausableThread::_status, cass::Log::add(), cass::Log::ERROR, eventcounter(), cass::getCompleteTagList(), cass::Log::INFO, lmf::PausableThread::running, lmf::PausableThread::shouldQuit(), QThread::sleep(), cass::toString(), value, and cass::Log::VERBOSEINFO.

uint64_t SACLAOfflineInput::skippedeventcounter ( )
virtual

retrieve the number of skipped processed events

Returns
number of processed events

Reimplemented from cass::InputBase.

Definition at line 466 of file sacla_offline_input.cpp.

References _procs.

Member Data Documentation

int cass::SACLAOfflineInput::_chunks
private

number of chuncks that the list should be split into

Definition at line 112 of file sacla_offline_input.h.

Referenced by load(), and runthis().

proc_t cass::SACLAOfflineInput::_procs
private

the processor container

Definition at line 124 of file sacla_offline_input.h.

Referenced by eventcounter(), progress(), runthis(), and skippedeventcounter().

bool cass::SACLAOfflineInput::_quitWhenDone
private

flag to tell the thread to quit when its done with all files

Definition at line 115 of file sacla_offline_input.h.

Referenced by runthis().

std::string cass::SACLAOfflineInput::_runlistname
private

name of the file containing all files that we need to process

Definition at line 118 of file sacla_offline_input.h.

Referenced by runthis().


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