CFEL - ASG Software Suite  2.5.0
CASS
Namespaces | Functions
cass.cpp File Reference

file contains the main cass program More...

#include <iostream>
#include <signal.h>
#include <QtCore/QStringList>
#include <QtCore/QCoreApplication>
#include "cass.h"
#include "cass_version.h"
#include "log.h"
#include "input_base.h"
#include "ratemeter.h"
#include "rate_plotter.h"
#include "ringbuffer.hpp"
#include "tcpserver.h"
#include "processor_manager.h"
#include "worker.h"
#include "cass_settings.h"
#include "cl_parser.hpp"
#include "tcp_input.h"
+ Include dependency graph for cass.cpp:

Go to the source code of this file.

Namespaces

 cass
 

Functions

void cass::endInputThread (int)
 end the input thread More...
 
void cass::setSignalHandler ()
 set up the own handler to react on the sigquit (crtl+ \) signal More...
 
int main (int argc, char **argv)
 The main program. More...
 

Detailed Description

file contains the main cass program

Author
Lutz Foucar

Definition in file cass.cpp.

Function Documentation

int main ( int  argc,
char **  argv 
)

The main program.

CASS Commandline Parameters

  • -i filename containing filesnames of xtcfiles to process (offline)
  • -m enable multifile input (offline)
  • -q quit after finished with all files (offline)
  • hdf5 enable the hdf5 file input module (offline)
  • -t enable the tcp input (online)
  • -p partition tag for accessing the shared memory (online)
  • -c client id for shared memory access (online)
  • –noSoap disables the soap server
  • -s TCP port of the soap server (offline / online)
  • -r suppress the rate output
  • -o output filename passed to the Processor (offline / online)
  • -f optional complete path to the cass.ini to use (offline / online)
  • –sacla Enable sacla input (offline / online)
  • -h show this help
  • –version display the version of cass
Author
Lutz Foucar

construct Qt application object to hold the run loop

register used types as Qt meta type

set up details for QSettings and Co.

create a qsettings object from which one can retrieve the default cass.ini. After parsing one can then set the CASSSettings default object to the user requested .ini file or the keep the default .ini file to use

set up parameters to be retrieved from the command line and parse them with the help of the command line parser object

show help and exit if requested

show version and exit if requested

set the user requested .ini file name

since the settings for the log are now loaded one can now add things to the log

create a ratemeter objects for input and worker and the plotter to plot the rates that are calculated.

create workers and requested inputs which need a ringbuffer for passing the the events from one to the other. Once created connect their terminated and finished signals such that they notify each other about that they are done processing the events. Also create the processor singleton used by the worker to process the events.

connect a own signal handler that acts on when sigquit is sent by linux it will call the end member of the input.

set up the TCP/SOAP server

set up the optional http server

start worker and server threads, then start input and wait until input is done

periodically check if the Workers are still running, while the input is still running. If not all workers are still running quit the input at this point and wait until it is quitted. Then rethrow the reason why the worker have quitted running.

Note
wait will return false if the input is still running

when the input was shut down gratiously, wait until the ringbuffer is empty (thus all events have been processed by the workers)

now stop the worker threads

rethrow the exceptions if any where thrown inside the Input threads

Todo:
find out how to stop the other threads

Definition at line 117 of file cass.cpp.

References cass::CommandlineArgumentParser::add(), QCoreApplication::arguments(), QSettings::fileName(), cass::RingBufferSize, QSettings::setDefaultFormat(), cass::setSignalHandler(), QThread::start(), httpServer::start(), QSettings::sync(), and cass::CommandlineArgumentParser::usage().