CFEL - ASG Software Suite
2.5.0
CASS
|
Multi File Input for cass. More...
#include <multifile_input.h>
Public Member Functions | |
~MultiFileInput () | |
destructor More... | |
void | runthis () |
function with the main loop More... | |
void | load () |
load the parameters used for the multifile input More... | |
![]() | |
virtual | ~InputBase () |
destructor More... | |
virtual double | progress () |
retrieve the fraction of how much of the input has been processed More... | |
virtual uint64_t | eventcounter () |
retrieve the number of events that have been input so far More... | |
virtual uint64_t | skippedeventcounter () |
retrieve the number of skipped events that have been input so far 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 (const std::string &filelistname, RingBuffer< CASSEvent > &ringbuffer, Ratemeter &ratemeter, Ratemeter &loadmeter, bool quitwhendone, 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 | |
MultiFileInput (const std::string &filelistname, RingBuffer< CASSEvent > &ringbuffer, Ratemeter &ratemeter, Ratemeter &loadmeter, bool quitwhendone, QObject *parent=0) | |
constructor More... | |
void | readEventData (event2positionreaders_t::iterator &eventIt) |
read the information from the different files into the cassevent More... | |
Private Attributes | |
bool | _quitWhenDone |
flag to tell the thread to quit when its done with all files More... | |
std::string | _filelistname |
the name of the file that contains the list of file to process More... | |
bool | _rewind |
flag that tells the input to rewind to the beginning of the eventlist More... | |
std::string | _new |
string to identify whether one want to use the new container More... | |
size_t | _nbrDifferentSources |
the number of different sources 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... | |
Multi File Input for cass.
This class will be used in offline modus. It will take an string that points to a file containing a list with filenames. The filename name must be passed to the program with the -i parameter.
Purpose of this class is that one can read multiple files and associate the data of the different files using the event id. Therefore this class contains a map that allows to map an event id to a set of filestreams where the data associated with this event id can be found in the different files.
Depending on the file extension of the file name it will call an instance to the right file parser. Once all files have been parsed an the event map has been build up it will iterate through the event map and read the data in the different files. The data is then converted to a CASSEvent and put into the RingBuffer
MultiFileInput/{NbrDifferentSources}
Tells the program how many different sources it should expect. If for one eventId there are less sources recognized than this number a warning will be issued and the event is skipped. Default is 2.
MultiFileInput/{UseNewContainer}
set to true if you want to use the new container for pixeldetector data that can make use of the new analysis chain. Default is false.
MultiFileInput/{Rewind}
Tells the program to start over running over all files when true. Default is false.
Definition at line 55 of file multifile_input.h.
MultiFileInput::~MultiFileInput | ( | ) |
destructor
Definition at line 58 of file multifile_input.cpp.
|
private |
constructor
filelistname | name of the file containing all files that should be processed |
ringbuffer | reference to the ringbuffer containing the CASSEvents |
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 that tells this class that it should quit the Program when its done reading all events |
parent | The parent QT Object of this class |
Definition at line 45 of file multifile_input.cpp.
References load().
|
static |
create an instance of this
filelistname | name of the file containing all files that should be processed |
ringbuffer | reference to the ringbuffer containing the CASSEvents |
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 that tells this class that it should quit the Program when its done reading all events |
parent | The parent QT Object of this class |
Definition at line 34 of file multifile_input.cpp.
|
virtual |
load the parameters used for the multifile input
Implements cass::InputBase.
Definition at line 61 of file multifile_input.cpp.
References _nbrDifferentSources, _new, _rewind, QSettings::beginGroup(), and QSettings::value().
Referenced by MultiFileInput().
|
private |
read the information from the different files into the cassevent
eventIt | iterator to the map containing all events |
Definition at line 70 of file multifile_input.cpp.
References cass::InputBase::_ringbuffer, cass::InputBase::getNextFillable(), cass::FilePointer::getStream(), cass::InputBase::newEventAdded(), cass::CBF::read(), and lmf::PausableThread::shouldQuit().
Referenced by runthis().
|
virtual |
function with the main loop
create the resource and a lock for it that contains the pointers to the places in the files where one finds the data that corresponds to a given eventID. And create a container for all the file parser that we create in the next step. Create helpers to split the extension from the filename and to tokenize the list of filenames.
open the file containing the files to process, convert the contents to a vector of filenames. Iterate through the vector of filenames and for each filename create a file parser that will parse this file. Then put the fileparser in the container. Also create a reader for the file and put it in the pair that contains the filepointer and the reader for it. Then read the header information into the file reader. Rewind the file to the beginning and
wait until all files are parsed
Then iterate through the eventlist, read the contents of each file and put it into the cassvent. For each entry in the eventlist, check whether all requested infos are present. If the data for this eventid is complete, retrieve a CASSEvent from the ringbuffer and use the file readers to retrieve the data from the file and convert them into the CASSEvent.
check whether the event contains information from all files
Implements cass::InputBase.
Definition at line 91 of file multifile_input.cpp.
References lmf::PausableThread::_control, _filelistname, cass::FilePointer::_filestream, _nbrDifferentSources, _new, cass::FilePointer::_pos, lmf::PausableThread::_quit, _quitWhenDone, _rewind, lmf::PausableThread::_status, cass::Log::add(), cass::Log::ERROR, QFileInfo::exists(), QString::fromStdString(), cass::Log::INFO, info, cass::FileReader::instance(), cass::FileParser::instance(), cass::InputBase::lock, lmf::PausableThread::pausePoint(), readEventData(), lmf::PausableThread::running, lmf::PausableThread::shouldQuit(), QThread::sleep(), QFileInfo::suffix(), cass::toString(), and cass::Log::WARNING.
|
private |
the name of the file that contains the list of file to process
Definition at line 114 of file multifile_input.h.
Referenced by runthis().
|
private |
the number of different sources
Definition at line 123 of file multifile_input.h.
|
private |
string to identify whether one want to use the new container
Definition at line 120 of file multifile_input.h.
|
private |
flag to tell the thread to quit when its done with all files
Definition at line 111 of file multifile_input.h.
Referenced by runthis().
|
private |
flag that tells the input to rewind to the beginning of the eventlist
Definition at line 117 of file multifile_input.h.