Public Member Functions | |
virtual | ~QDaqServer () |
dtor | |
const QDaqCommonDefs::QDaqState | GetState () const |
get current daq state | |
int | GetCurrentRun () const |
get current run number | |
bool | SetTriggerFlag (const unsigned int crateId, const bool flag) |
bool | StartProcesses (int settingsBasket, int run, int shifterSet, const std::string &comments) |
bool | Pause () |
bool | Resume () |
bool | Stop (int shifterSet, const std::string &comments) |
void | ResetError () |
bool | HasError () const |
const QError & | GetError () const |
Static Public Member Functions | |
static QDaqServer & | GetInstance () |
singleton getter | |
Private Member Functions | |
QDaqServer () | |
private constructor | |
bool | StartRun () |
send start signal to readers, senders and receivers | |
bool | Abort () |
kill all non server processes that are known to be running | |
void | SetState (const QDaqCommonDefs::QDaqState &s) |
set daq state | |
bool | StartMuonReader (const std::string &address) |
start muon reader process | |
bool | StartPulserController (const std::string &address) |
start muon pulser controller process | |
bool | StartReader (int crateId, const std::string &address, int extClock) |
start DataReader process | |
bool | StartSender (int crateId, const std::string &address) |
start DataSender process | |
bool | StartReceiver (int crateId) |
start DataReceiver process | |
bool | StartBuilder () |
start Builder process | |
bool | StartProcess (const std::string &process, const std::string &address, const std::string &options, QDaqCommonDefs::ProcessStatus_t status) |
start a process on a certain host | |
bool | KillProcess (const std::string &process, const std::string &host, const std::string &signal) |
bool | KillProcess (const std::string &process, const std::string &host, const std::string &signal, const std::string &killOpts) |
QDaqCommonDefs::ProcessStatus_t | AskStatus (const std::string &process) |
bool | CheckStatus (const std::string &process, QDaqCommonDefs::ProcessStatus_t status, float timeout) |
check real process status again supplied status code | |
bool | Unregistered (const std::string &process, float timeout) |
wait for a process to unregister from message logger server | |
QDaqCommonDefs::ProcessStatus_t | GetStatusCode (const std::string &message) |
convert message server answer to corresponding status code | |
void | Clear () |
const char * | GetDateString () const |
Private Attributes | |
QDaqCommonDefs::QDaqState | fDaqState |
int | fSettingsBasket |
int | fRun |
std::string | fDaqUser |
std::string | fPathBin |
std::string | fPathLog |
std::string | fReceiverAddr |
std::string | fPulserAddr |
std::string | fLoggerAddr |
std::string | fLoggerPort |
std::string | fDianaCfg |
std::string | fEnvFile |
int | ReceiverBasePort |
bool | fUseMuonReader |
bool | fUsePulser |
bool | fUseBuilder |
bool | fReleaseReceiver |
bool | fSaveChannels |
int | fSimulaHardware |
const float | fTimeOut |
bool | fBuilderIsRunning |
bool | fPulserControllerIsRunning |
bool | fMuonReaderIsRunning |
QError | fError |
std::map< std::string, std::string > | fReaders |
std::map< std::string, std::string > | fSenders |
std::vector< std::string > | fReceivers |
bool QDaqServer::StartRun | ( | ) | [private] |
send start signal to readers, senders and receivers
References CheckStatus(), fError, fReaders, fReceiverAddr, fReceivers, fSenders, fTimeOut, QApolloMessenger::GetInstance(), QDaqCommonDefs::QRunning_s, QApolloMessenger::Send(), and QError::Set().
bool QDaqServer::Abort | ( | ) | [private] |
kill all non server processes that are known to be running
References fBuilderIsRunning, fError, fMuonReaderIsRunning, fPathBin, fPulserAddr, fPulserControllerIsRunning, fReaders, fReceiverAddr, fReceivers, fSenders, fTimeOut, fUseBuilder, fUseMuonReader, fUsePulser, QDaqCommonDefs::Q_Idle_State, QDaqCommonDefs::Q_Unknown_State, QError::Set(), SetState(), and Unregistered().
bool QDaqServer::StartMuonReader | ( | const std::string & | address | ) | [private] |
start muon reader process
address | network address of the computer on which the muon reader is to be started |
References QDaqCommonDefs::QRunning_s, and StartProcess().
bool QDaqServer::StartPulserController | ( | const std::string & | address | ) | [private] |
start muon pulser controller process
address | network address of the computer on which the pulser controller is to be started |
References QDaqCommonDefs::QRunning_s, and StartProcess().
bool QDaqServer::StartReader | ( | int | crateId, | |
const std::string & | address, | |||
int | extClock | |||
) | [private] |
start DataReader process
crateId | id of the crate connected to the reader to be started | |
addres | network address of the computer hosting the reader | |
extClock | whether or not to use external clock for data acquisition |
References fReaders, fSaveChannels, fSimulaHardware, QDaqCommonDefs::QReady_s, and StartProcess().
bool QDaqServer::StartSender | ( | int | crateId, | |
const std::string & | address | |||
) | [private] |
start DataSender process
crateId | id of the reader associated to the sender to be started | |
addres | network address of the computer hosting the sender |
References fReceiverAddr, fSenders, fSettingsBasket, QDaqCommonDefs::QReady_s, ReceiverBasePort, and StartProcess().
bool QDaqServer::StartReceiver | ( | int | crateId | ) | [private] |
start DataReceiver process
crateId | id of the sender associated to the receiver to be started |
References fReceiverAddr, fReceivers, fReleaseReceiver, fSettingsBasket, QDaqCommonDefs::QReady_s, ReceiverBasePort, and StartProcess().
bool QDaqServer::StartBuilder | ( | ) | [private] |
start Builder process
References fBuilderIsRunning, fDianaCfg, fReceiverAddr, QDaqCommonDefs::QUnknown_s, and StartProcess().
bool QDaqServer::StartProcess | ( | const std::string & | process, | |
const std::string & | address, | |||
const std::string & | options, | |||
QDaqCommonDefs::ProcessStatus_t | status | |||
) | [private] |
start a process on a certain host
process | name of the process to be started | |
address | network address of the host where the process will be started | |
options | string containing command line options that will be passed to the process | |
status | expected status that the newly started process will have |
References CheckStatus(), fDaqUser, fEnvFile, fError, fPathBin, fPathLog, fTimeOut, QApolloMessenger::GetInstance(), QDaqCommonDefs::QUnknown_s, QApolloMessenger::Send(), and QError::Set().
Referenced by StartBuilder(), StartMuonReader(), StartPulserController(), StartReader(), StartReceiver(), and StartSender().
bool QDaqServer::CheckStatus | ( | const std::string & | process, | |
QDaqCommonDefs::ProcessStatus_t | status, | |||
float | timeout | |||
) | [private] |
check real process status again supplied status code
process | process for which status is checked | |
status | status code against which real process status is compared | |
timeout | time to wait before giving up and returning false |
References fError, QBaseClient::GetError(), QMsgClient::GetStatus(), QMsgClient::IsRegistered(), and QDaqCommonDefs::ProcessStatusEnumToString().
Referenced by StartProcess(), and StartRun().
bool QDaqServer::Unregistered | ( | const std::string & | process, | |
float | timeout | |||
) | [private] |
wait for a process to unregister from message logger server
process | process to be checked | |
timeout | time to wait before giving up and returning false |
References fError, QBaseClient::GetError(), and QMsgClient::IsRegistered().
Referenced by Abort().
QDaqCommonDefs::ProcessStatus_t QDaqServer::GetStatusCode | ( | const std::string & | message | ) | [private] |
convert message server answer to corresponding status code
message | answer to be converted |
current daq status
Referenced by GetState(), and SetState().
int QDaqServer::fSettingsBasket [private] |
settings basket identifier
Referenced by StartReceiver(), and StartSender().
int QDaqServer::fRun [private] |
run number
Referenced by GetCurrentRun().
std::string QDaqServer::fDaqUser [private] |
username for ssh connections
Referenced by StartProcess().
std::string QDaqServer::fPathBin [private] |
path to binaries
Referenced by Abort(), and StartProcess().
std::string QDaqServer::fPathLog [private] |
path to log files
Referenced by StartProcess().
std::string QDaqServer::fReceiverAddr [private] |
DataReceiver host name
Referenced by Abort(), StartBuilder(), StartReceiver(), StartRun(), and StartSender().
std::string QDaqServer::fPulserAddr [private] |
PulserController host name
Referenced by Abort().
std::string QDaqServer::fLoggerAddr [private] |
message server address
std::string QDaqServer::fLoggerPort [private] |
message server port
std::string QDaqServer::fDianaCfg [private] |
Builder config file name
Referenced by StartBuilder().
std::string QDaqServer::fEnvFile [private] |
file containing environment variables
Referenced by StartProcess().
int QDaqServer::ReceiverBasePort [private] |
base value for receiver listen port
Referenced by StartReceiver(), and StartSender().
bool QDaqServer::fUseMuonReader [private] |
whether or not muon reader is in use
Referenced by Abort().
bool QDaqServer::fUsePulser [private] |
whether or not pulser controller is in use
Referenced by Abort().
bool QDaqServer::fUseBuilder [private] |
whether or not event builder is in use
Referenced by Abort().
bool QDaqServer::fReleaseReceiver [private] |
whether or not to release data in receiver
Referenced by StartReceiver().
bool QDaqServer::fSaveChannels [private] |
whether or not to save continuous data stream
Referenced by StartReader().
int QDaqServer::fSimulaHardware [private] |
whether or not to simulate hardware for DAQ
Referenced by StartReader().
const float QDaqServer::fTimeOut [private] |
timeout for CheckStatus() method
Referenced by Abort(), StartProcess(), and StartRun().
bool QDaqServer::fBuilderIsRunning [private] |
true if Builder is running
Referenced by Abort(), and StartBuilder().
bool QDaqServer::fPulserControllerIsRunning [private] |
true if PulserController is running
Referenced by Abort().
bool QDaqServer::fMuonReaderIsRunning [private] |
true if MuonReader is running
Referenced by Abort().
QError QDaqServer::fError [private] |
stores error informations in case of failure
Referenced by Abort(), CheckStatus(), StartProcess(), StartRun(), and Unregistered().
std::map<std::string,std::string> QDaqServer::fReaders [private] |
map of running reader processes and corresponding network host
Referenced by Abort(), StartReader(), and StartRun().
std::map<std::string,std::string> QDaqServer::fSenders [private] |
map of running sender processes and corresponding network host
Referenced by Abort(), StartRun(), and StartSender().
std::vector<std::string> QDaqServer::fReceivers [private] |
vector of running receiver processes
Referenced by Abort(), StartReceiver(), and StartRun().