Go to the documentation of this file.
80 const std::string&
path) :
130 long long int update_s = 10;
131 long long int logger_s = 5;
135 properties[
"path"] =
path;
136 properties[
"update_s"] = update_s;
137 properties[
"logger_s"] = logger_s;
141 if (update_s <= 0) { update_s = 1; }
142 if (logger_s <= 0) { logger_s = 1; }
240 this->buffer.swap(
null);
276 istringstream in(__str__);
297 TFile* out = i->second->GetCurrentFile();
299 if (out != NULL && out->IsOpen()) {
306 in >> preamble >> header;
312 const Int_t nb = i->second->copy(in);
314 if (nb < (
int)
buffer.size() || in.tellg() != (int)
buffer.size()) {
332 << header.getRunNumber()
368 std::ostringstream message;
430 while (!this->empty() && this->begin()->first <
run) {
431 this->erase(this->begin());
443 const_iterator p = this->find(
run);
445 return p != this->end() && p->second.is_written;
459 in >>
run >> parameters;
461 in.clear(std::ios::eofbit);
463 if (in &&
run != -1) {
467 if (value.
count == 0) {
491 if (p != this->end() && p->second.count != 0 && !p->second.is_written) {
493 file->WriteTObject(&p->second.parameters);
495 p->second.is_written =
true;
512 int main(
int argc,
char* argv[])
528 JParser<> zap(
"Application for writing real-time data to disk.");
540 catch(
const exception &error) {
541 FATAL(error.what() << endl);
548 out =
new JStreamLogger(cout);
550 out =
new JControlHostLogger(
logger);
Level specific message streamers.
virtual void open(const char *file_name)
Open file.
JLANG::JSharedPointer< JControlHost > datawriter
Interface for logging messages.
bool read(std::istream &in)
Read trigger parameters.
void reset(const int run)
Remove all entries before given run.
JValue_t()
Default constructor.
static const JNET::JTag IO_EVENT
virtual void actionStart(int length, const char *buffer)
Auxiliary class for CPU timing and usage.
Auxiliary class for a type holder.
JTreeWriter_t writer
TTree writer.
Runcontrol client to write data to disk.
int getRunNumber() const
Get run number.
virtual void actionSelect(const JFileDescriptorMask &mask)
Action method following last select call.
Exception for ControlHost.
virtual void actionQuit(int length, const char *buffer)
Data structure for all trigger parameters.
virtual void typeout(const std::string &tag, const std::string &message)
Report message.
virtual void actionRunning()
This method is repeatedly called when this client machine is in state Running and the clock interval ...
unsigned long long usec_wall
virtual void actionInit(int length, const char *buffer)
JTYPELIST< JDAQTimesliceTypes_t, JDAQEvent, JDAQSummaryslice >::typelist JDAQTypes_t
Type list of DAQ data types for I/O.
static const JNET::JTag RC_DWRITER
void run()
Run as run control client following command messages via JNET::JControlHost.
const JTag & getTag() const
Get tag.
void typeout()
Report status of data writing.
bool has(const int file_descriptor) const
Has file descriptor.
Utility class to parse command line options.
bool read(const JEquation &equation)
Read equation.
JSharedPointer< JControlHost > server
message server
Auxiliary data structure for I/O of trigger parameters.
bool putObject(TDirectory *dir, const T &object)
Write object to ROOT directory.
Map run number to trigger parameters.
void status(const JMessage_t &message)
TFile * getFile() const
Get file.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
int main(int argc, char *argv[])
virtual void actionStop(int length, const char *buffer)
void replaceEvent(const JTag &oldTag, const JTag &newTag, JDAQEvent_t &event)
Replace tag of given event in event table.
bool is_written
writer status
JTriggerParameters parameters
trigger parameters
Auxiliary data structure for sequence of same character.
std::string getFullPath(const std::string &path)
Get full path, i.e.
virtual void close()
Close file.
JDataWriter(const std::string &name, const std::string &server, const std::string &hostname, JLogger *logger, const int level, const std::string &path)
Constructor.
static const int MAXIMUM_FILE_NUMBER
maximum file number for overwrite protection.
Auxiliary class for method select.
bool isRunning() const
Check if this client is in runnig state.
void set(const int file_descriptor)
Set file descriptor.
Control unit client base class.
static void Throw(const bool option)
Enable/disable throw option.
JDAQStateMachine::ev_error_event ev_error
map_type::iterator iterator
int getDetectorID() const
Get detector identifier.
static const JNET::JTag IO_TRIGGER_PARAMETERS
virtual void actionConfigure(int length, const char *buffer)
JMessageLogger logger
message logger
Simple data structure to support I/O of equations (see class JLANG::JEquation).
static const JNET::JTag RC_LOG
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
const std::string & getFullName() const
Get full name of this run control client.
static JKey_t getKey(JType< T > type)
Get key.
bool is_written(const int run) const
Check if trigger parameters have been written for given run.
Utility class to parse parameter values.
JDAQStateMachine::ev_configure_event ev_configure
Support classes and methods for experiment specific I/O.
KM3NeT DAQ data structures and auxiliaries.
JMessageScheduler logErrorState
static const JNET::JTag RC_CMD
void setClockInterval(const long long int interval_us)
Set interval time.
virtual void actionReset(int length, const char *buffer)
long long int numberOfBytes
JMessageScheduler logErrorFile
void write(const int run, TFile *file)
Write trigger parameters for given run if not yet done.
char getTokenDelimeter()
Get the token delimeter for command messages.
std::vector< char > buffer
internal buffer for incoming data
std::string toString() const
Convert tag to string.
JMessageScheduler logErrorRun
void insert()
Insert (list of) data type(s).
JSUPPORT::JAutoTreeWriter< JNET::JTag > JTreeWriter_t
Type definition of auto map.
Message logger with time scheduler.
int getSize() const
Get size.
virtual bool is_open() const
Check is file is open.
std::string getProcessName(const std::string &name, const std::string &process)
Get process name of run control client.
virtual bool enter(const JArgs &args)
Enter the state machine.
The template JSharedPointer class can be used to share a pointer to an object.
virtual void setSelect(JFileDescriptorMask &mask) const
Set the file descriptor mask for the select call.
Auxiliary class for all subscription.
JMessageScheduler logErrorTag
std::string hostname
host name of data server