137 properties[
"path"] =
path;
141 properties.
read(
string(buffer, length));
249 this->buffer.swap(null);
286 catch(
const exception& error) {
305 TFile* out = i->second->GetCurrentFile();
307 if (out != NULL && out->IsOpen()) {
315 in >> preamble >> version >> header;
321 const Int_t nb = i->second->copy(
in);
323 if (nb < (
int)
buffer.size() ||
in.tellg() != (int)
buffer.size()) {
341 << header.getRunNumber()
377 std::ostringstream message;
439 while (!this->empty() && this->begin()->
first < run) {
440 this->erase(this->begin());
452 const_iterator p = this->find(run);
454 return p != this->end() && p->second.is_written;
463 void read(
const char*
const data,
const size_t size)
469 const string buffer(data, size);
471 istringstream
in(buffer);
479 THROW(
JIOException,
"Error reading run number for trigger parameters " <<
run << endl << in.rdbuf());
484 in.clear(std::ios::eofbit);
492 if (value.count == 0) {
515 if (p != this->end() && p->second.count != 0 && !p->second.is_written) {
517 file->WriteTObject(&p->second.parameters);
519 p->second.is_written =
true;
536 int main(
int argc,
char* argv[])
540 using namespace KM3NETDAQ;
552 JParser<> zap(
"Application for writing real-time data to disk.");
554 zap[
'H'] =
make_field(
server,
"host name of server for command messages") =
"localhost";
555 zap[
'M'] =
make_field(
logger,
"host name of server for logger messages") =
"localhost";
556 zap[
'D'] =
make_field(
hostname,
"host name of server for incoming data from data filter") =
"localhost";
557 zap[
'u'] =
make_field(client_name,
"client name") =
"%";
558 zap[
'c'] =
make_field(use_cout,
"print to terminal");
559 zap[
'p'] =
make_field(
path,
"directory for permanent archival of data") =
"";
565 catch(
const exception &error) {
566 FATAL(error.what() << endl);
JDataWriter(const std::string &name, const std::string &server, const std::string &hostname, JLogger *logger, const int level, const std::string &path)
Constructor.
Message logger with time scheduler.
Utility class to parse command line options.
virtual void actionStop(int length, const char *buffer) override
Runcontrol client to write data to disk.
bool read(const JEquation &equation)
Read equation.
std::vector< char > buffer
internal buffer for incoming data
void status(const JMessage_t &message)
int main(int argc, char *argv[])
static const int MAXIMUM_FILE_NUMBER
maximum file number for overwrite protection.
ROOT TTree parameter settings of various packages.
virtual void actionQuit(int length, const char *buffer) override
JDAQStateMachine::ev_configure_event ev_configure
JDAQStateMachine::ev_error_event ev_error
then usage $script[< detector identifier >< run range >]< QA/QCfile > nExample script to produce data quality plots nWhen a detector identifier and run range are data are downloaded from the database nand subsequently stored in the given QA QC file
std::string getProcessName(const std::string &name, const std::string &process)
Get process name of run control client.
Message logging based on std::ostream.
bool has(const int file_descriptor) const
Has file descriptor.
void set(const int file_descriptor)
Set file descriptor.
void read(const char *const data, const size_t size)
Read trigger parameters.
void reset(const int run)
Remove all entries before given run.
JMessageScheduler logErrorState
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Interface for logging messages.
Message logging based on ControlHost.
Utility class to parse parameter values.
void setClockInterval(const long long int interval_us)
Set interval time.
Auxiliary data structure for I/O of trigger parameters.
std::string hostname
host name of data server
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Simple data structure to support I/O of equations (see class JLANG::JEquation).
static const JNET::JTag IO_TRIGGER_PARAMETERS
JTreeWriter_t writer
TTree writer.
void replaceEvent(const JTag &oldTag, const JTag &newTag, JDAQEvent_t &event)
Replace tag of given event in event table.
JSharedPointer< JControlHost > server
message server
Auxiliary class for a type holder.
void run()
Run as run control client following command messages via JNET::JControlHost.
std::string getFullPath(const std::string &path)
Get full path, i.e. add JEEP::PATHNAME_SEPARATOR if necessary.
bool is_written(const int run) const
Check if trigger parameters have been written for given run.
virtual void setSelect(JFileDescriptorMask &mask) const override
Set the file descriptor mask for the select call.
int getSize() const
Get size.
virtual void actionSelect(const JFileDescriptorMask &mask) override
Action method following last select call.
Utility class to parse parameter values.
virtual bool is_open() const override
Check is file is open.
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
virtual void actionConfigure(int length, const char *buffer) override
long long int numberOfBytes
virtual void actionRunning() override
This method is repeatedly called when this client machine is in state Running and the clock interval ...
Map run number to trigger parameters.
JMessageScheduler logErrorRun
int getDetectorID() const
Get detector identifier.
static JKey_t getKey(JType< T > type)
Get key.
TFile * getFile() const
Get file.
Scheduling of actions via fixed latency intervals.
virtual void actionInit(int length, const char *buffer) override
I/O formatting auxiliaries.
The template JSharedPointer class can be used to share a pointer to an object.
static const JNET::JTag RC_LOG
JMessageScheduler logErrorFile
JSUPPORT::JAutoTreeWriter< JNET::JTag > JTreeWriter_t
Type definition of auto map.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
JValue_t()
Default constructor.
Auxiliary class for method select.
Auxiliary class for CPU timing and usage.
JMessageScheduler logErrorTag
virtual void typeout(const std::string &tag, const std::string &message) override
Report message.
JSubscriptionList & add(const JSubscription &subscription)
Add subscription.
map_type::iterator iterator
Level specific message streamers.
Exception for ControlHost.
JTriggerParameters parameters
trigger parameters
bool putObject(TDirectory &dir, const TObject &object)
Write object to ROOT directory.
char getTokenDelimeter()
Get the token delimeter for command messages.
bool isRunning() const
Check if this client is in runnig state.
virtual void close() override
Close file.
Auxiliary class for all subscription.
virtual void open(const char *file_name) override
Open file.
const JTag & getTag() const
Get tag.
Auxiliary data structure for sequence of same character.
static const JNET::JTag RC_DWRITER
virtual void actionStart(int length, const char *buffer) override
void write(const int run, TFile *file)
Write trigger parameters for given run if not yet done.
std::string toString() const
Convert tag to string.
int getRunNumber() const
Get run number.
void insert()
Insert (list of) data type(s).
void typeout()
Report status of data writing.
const std::string & getFullName() const
Get full name of this run control client.
Control unit client base class.
Utility class to parse command line options.
virtual bool enter(const JArgs &args)
Enter the state machine.
JMessageLogger logger
message logger
static const JNET::JTag RC_CMD
static const JNET::JTag IO_EVENT
virtual void actionReset(int length, const char *buffer) override
KM3NeT DAQ constants, bit handling, etc.
bool is_written
writer status
static JNullStream null
Null I/O stream.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
JLANG::JSharedPointer< JControlHost > datawriter
static void Throw(const bool option)
Enable/disable throw option.
unsigned long long usec_wall
static const int DWRITER_RECEIVE_BUFFER_SIZE
socket JDataWriter.cc <- JDataFilter.cc