QDaqServer Class Reference

List of all members.


Detailed Description

the object that does the real work through the command visitors

Author:
Marco Pallavicini

sergio.didomizio@ge.infn.it


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 QErrorGetError () const

Static Public Member Functions

static QDaqServerGetInstance ()
 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

Member Function Documentation

bool QDaqServer::StartRun (  )  [private]

send start signal to readers, senders and receivers

Returns:
true on success or false if any of the involved processes fail to switch to running status

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

Returns:
true on success or false on failure
Builder, MuonReader and PulserController are killed by a single signal, while readers, senders and receivers need 2 signals to be killed: a stop signal and the actual kill signal. If all processes are killed succesfully the daq server status is set to Q_Idle_State and Clear() is called. If any of the processes fails to stop server status is set to Q_Unknown_State.

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

Parameters:
address network address of the computer on which the muon reader is to be started
Returns:
true if process has started succesfully, false in case of error. In case of error, fError is set.

References QDaqCommonDefs::QRunning_s, and StartProcess().

bool QDaqServer::StartPulserController ( const std::string &  address  )  [private]

start muon pulser controller process

Parameters:
address network address of the computer on which the pulser controller is to be started
Returns:
true if process has started succesfully, false in case of error. In case of error, fError is set.

References QDaqCommonDefs::QRunning_s, and StartProcess().

bool QDaqServer::StartReader ( int  crateId,
const std::string &  address,
int  extClock 
) [private]

start DataReader process

Parameters:
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
Returns:
true on success, false on failure
Format process name and options and call StartProcess(). If StartProcess() succeeds the new reader is added to fReaders map.

References fReaders, fSaveChannels, fSimulaHardware, QDaqCommonDefs::QReady_s, and StartProcess().

bool QDaqServer::StartSender ( int  crateId,
const std::string &  address 
) [private]

start DataSender process

Parameters:
crateId id of the reader associated to the sender to be started
addres network address of the computer hosting the sender
Returns:
true on success, false on failure
Format process name and options and call StartProcess(). If StartProcess() succeeds the new sender is added to fSenders map.

References fReceiverAddr, fSenders, fSettingsBasket, QDaqCommonDefs::QReady_s, ReceiverBasePort, and StartProcess().

bool QDaqServer::StartReceiver ( int  crateId  )  [private]

start DataReceiver process

Parameters:
crateId id of the sender associated to the receiver to be started
Returns:
true on success, false on failure
Format process name and options and call StartProcess(). If StartProcess() succeeds the new sender is added to fReceivers vector.

References fReceiverAddr, fReceivers, fReleaseReceiver, fSettingsBasket, QDaqCommonDefs::QReady_s, ReceiverBasePort, and StartProcess().

bool QDaqServer::StartBuilder (  )  [private]

start Builder process

Returns:
true on success, false on failure
Format options and call StartProcess(). If StartProcess() succeeds fBuilderIsRunning is set to true

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

Parameters:
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
Returns:
true on success, false on failure. In case of failure fError is set.

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

Parameters:
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
Returns:
true as soon as a AskStatus call matches status; false if status is not matched before timeout expires or if an error occurred in the message logger client. In this second case fError is set to the error occurred in the client

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

Parameters:
process process to be checked
timeout time to wait before giving up and returning false
Returns:
true as soon as process unregistered; false if process does not unregister before timeout expires or if an error occurred in the message logger client. In this second case fError is set to the error occurred in the client

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

Parameters:
message answer to be converted
Returns:
status code or -1 in case of failure


Member Data Documentation

current daq status

Referenced by GetState(), and SetState().

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().

base value for receiver listen port

Referenced by StartReceiver(), and StartSender().

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().

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().

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().

true if Builder is running

Referenced by Abort(), and StartBuilder().

true if PulserController is running

Referenced by Abort().

true if MuonReader is running

Referenced by Abort().

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().


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

Generated on Tue Nov 16 10:50:05 2010 for CUORE Software by  doxygen 1.5.6
INFN Genova privacy policy