Jpp  18.5.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Member Functions | Public Attributes | Static Public Attributes | Protected Types | Protected Attributes | Private Attributes | List of all members
KM3NETDAQ::JDataWriter Class Reference

Runcontrol client to write data to disk. More...

Inheritance diagram for KM3NETDAQ::JDataWriter:
KM3NETDAQ::JDAQClient JDAQStateMachine KM3NETDAQ::JDAQClient_t JDAQCHSM

Classes

struct  JRunDB
 Map run number to trigger parameters. More...
 
struct  JValue_t
 Auxiliary data structure for I/O of trigger parameters. More...
 

Public Member Functions

 JDataWriter (const std::string &name, const std::string &server, const std::string &hostname, JLogger *logger, const int level, const std::string &path)
 Constructor. More...
 
virtual void actionInit (int length, const char *buffer) override
 
virtual void actionConfigure (int length, const char *buffer) override
 
virtual void actionReset (int length, const char *buffer) override
 
virtual void actionQuit (int length, const char *buffer) override
 
virtual void actionStart (int length, const char *buffer) override
 
virtual void actionStop (int length, const char *buffer) override
 
virtual void setSelect (JFileDescriptorMask &mask) const override
 Set the file descriptor mask for the select call. More...
 
virtual void actionSelect (const JFileDescriptorMask &mask) override
 Action method following last select call. More...
 
virtual void actionRunning () override
 This method is repeatedly called when this client machine is in state Running and the clock interval time is non-zero. More...
 
void typeout ()
 Report status of data writing. More...
 
virtual bool enter (const JArgs &args)
 Enter the state machine. More...
 
virtual bool enter () override
 Enter the state machine. More...
 
virtual bool exit () override
 Exit the state machine. More...
 
bool isRunning () const
 Check if this client is in runnig state. More...
 
void replaceEvent (const JTag &oldTag, const JTag &newTag, JDAQEvent_t &event)
 Replace tag of given event in event table. More...
 
JDAQEvent_tfindEvent (const JTag &tag, const std::string &event_name)
 Find event in event table. More...
 
void addSubscription (const JSubscription &subscription)
 Add custom subscription. More...
 
template<class T >
void addParameter (const char option, T &parameter)
 Add parameter to parser used in method enter(). More...
 
template<class T >
void addParameter (const char option, T &parameter, const T &value)
 Add parameter to parser used in method enter(). More...
 
void setSelect ()
 Set the file descriptor mask for the select call. More...
 
virtual void actionInput (int length, const char *buffer) override
 This method is called at ev_input. More...
 
virtual bool filter (const JTag &tag, int length, const char *buffer)
 Filter message. More...
 
virtual void actionTagged (const JTag &tag, int length, const char *buffer)
 This method is called when a custom tag is encountered. More...
 
void run ()
 Run as run control client following command messages via JNET::JControlHost. More...
 
void run (const int port)
 Run for ever. More...
 
void run (std::istream &in)
 Run client with commands from input stream (e.g. for debugging). More...
 
void A1 (CHSM_ns_alias::event const &)
 
void A2 (CHSM_ns_alias::event const &)
 
void A3 (CHSM_ns_alias::event const &)
 
void A4 (CHSM_ns_alias::event const &)
 
void A5 (CHSM_ns_alias::event const &)
 
void A6 (CHSM_ns_alias::event const &)
 
void A7 (CHSM_ns_alias::event const &)
 
void A8 (CHSM_ns_alias::event const &)
 
void A9 (CHSM_ns_alias::event const &)
 
void A10 (CHSM_ns_alias::event const &)
 
void A11 (CHSM_ns_alias::event const &)
 
void A12 (CHSM_ns_alias::event const &)
 
void A13 (CHSM_ns_alias::event const &)
 
void A14 (CHSM_ns_alias::event const &)
 
void EAM4root (CHSM_ns_alias::state const &, CHSM_ns_alias::event const &)
 
void XAM4root (CHSM_ns_alias::state const &, CHSM_ns_alias::event const &)
 
const std::stringgetName () const
 Get name of state machine. More...
 
const std::stringgetName () const
 Get name of state machine. More...
 
int getDetectorID () const
 Get detector identifier. More...
 
int getDetectorID () const
 Get detector identifier. More...
 
int getRunNumber () const
 Get run number. More...
 
int getRunNumber () const
 Get run number. More...
 
virtual void actionEnter ()
 Interface methods for actions corresponding to state transitions. More...
 
virtual void actionEnter ()
 Interface methods for actions corresponding to state transitions. More...
 
virtual void actionExit ()
 
virtual void actionExit ()
 
virtual void actionPause (int, const char *)
 
virtual void actionPause (int, const char *)
 
virtual void actionContinue (int, const char *)
 
virtual void actionContinue (int, const char *)
 
virtual void actionError ()
 
virtual void actionError ()
 
virtual void actionRecover (int, const char *)
 
virtual void actionRecover (int, const char *)
 
const std::stringgetHostname () const
 Get hostname. More...
 
const std::stringgetFullName () const
 Get full name of this run control client. More...
 
const JTaggetUniqueTag () const
 Get unique tag of this run control client. More...
 
long long int getClockDelay () const
 Get total delay time. More...
 
long long int getClockInterval () const
 Get interval time. More...
 
void setClockInterval (const long long int interval_us)
 Set interval time. More...
 
void resetClock ()
 Reset clock. More...
 
const std::stringgetEventInfo () const
 Get last event information. More...
 
void setEventInfo (const std::string &info)
 Set last event information. More...
 

Public Attributes

JMeta meta
 meta data More...
 
JDAQStateMachine::state_root root
 
JDAQStateMachine::state_Main Main
 
JDAQStateMachine::ev_daq_event ev_daq
 
char ev_daq_param_block [sizeof(ev_daq_event::param_block)]
 
JDAQStateMachine::ev_init_event ev_init
 
char ev_init_param_block [sizeof(ev_init_event::param_block)]
 
JDAQStateMachine::ev_configure_event ev_configure
 
char ev_configure_param_block [sizeof(ev_configure_event::param_block)]
 
JDAQStateMachine::ev_start_event ev_start
 
char ev_start_param_block [sizeof(ev_start_event::param_block)]
 
JDAQStateMachine::ev_pause_event ev_pause
 
char ev_pause_param_block [sizeof(ev_pause_event::param_block)]
 
JDAQStateMachine::ev_continue_event ev_continue
 
char ev_continue_param_block [sizeof(ev_continue_event::param_block)]
 
JDAQStateMachine::ev_stop_event ev_stop
 
char ev_stop_param_block [sizeof(ev_stop_event::param_block)]
 
JDAQStateMachine::ev_reset_event ev_reset
 
char ev_reset_param_block [sizeof(ev_reset_event::param_block)]
 
JDAQStateMachine::ev_quit_event ev_quit
 
char ev_quit_param_block [sizeof(ev_quit_event::param_block)]
 
JDAQStateMachine::ev_off_event ev_off
 
char ev_off_param_block [sizeof(ev_off_event::param_block)]
 
JDAQStateMachine::ev_check_event ev_check
 
char ev_check_param_block [sizeof(ev_check_event::param_block)]
 
JDAQStateMachine::ev_input_event ev_input
 
char ev_input_param_block [sizeof(ev_input_event::param_block)]
 
JDAQStateMachine::ev_recover_event ev_recover
 
char ev_recover_param_block [sizeof(ev_recover_event::param_block)]
 
JDAQStateMachine::ev_error_event ev_error
 
char ev_error_param_block [sizeof(ev_error_event::param_block)]
 

Static Public Attributes

static const int MAXIMUM_FILE_NUMBER = 100
 maximum file number for overwrite protection. More...
 
static const int TIMEOUT_S = 1
 time out of update [s] More...
 

Protected Types

typedef void(JDAQCHSM::* action )(int, const char *)
 Type definition of action method. More...
 
typedef void(JDAQCHSM::* action )(int, const char *)
 Type definition of action method. More...
 

Protected Attributes

JSharedPointer< JControlHostserver
 message server More...
 
JMessageLogger logger
 message logger More...
 
std::string name
 
int detector_id
 
int run_number
 
JEventTable eventTable
 event table More...
 
std::string fullname
 
JTag unique_tag
 
JTimekeeper clock
 central clock More...
 
std::string event_info
 event information More...
 

Private Attributes

JLANG::JSharedPointer
< JControlHost
datawriter
 
std::string path
 
JEEP::JTimer timer
 
Long64_t numberOfEvents
 
long long int numberOfBytes
 
JMessageScheduler logErrorRun
 
JMessageScheduler logErrorFile
 
JMessageScheduler logErrorTag
 
JMessageScheduler logErrorState
 
std::string hostname
 host name of data server More...
 
JTreeWriter_t writer
 TTree writer. More...
 
std::vector< char > buffer
 internal buffer for incoming data More...
 
JRunDB run_db
 

Detailed Description

Runcontrol client to write data to disk.

In state running, this application will write ROOT formatted data from the data filters to disk.

Definition at line 61 of file JDataWriter.cc.

Member Typedef Documentation

typedef void(JDAQCHSM::* JDAQCHSM::action)(int, const char *)
protectedinherited

Type definition of action method.

Definition at line 141 of file JDAQCHSM.chsm.

typedef void(JDAQCHSM::* JDAQCHSM::action)(int, const char *)
protectedinherited

Type definition of action method.

Definition at line 152 of file JDAQCHSM.hh.

Constructor & Destructor Documentation

KM3NETDAQ::JDataWriter::JDataWriter ( const std::string name,
const std::string server,
const std::string hostname,
JLogger logger,
const int  level,
const std::string path 
)
inline

Constructor.

Parameters
namename of client
servername of command message server
hostnamename of data server
loggerpointer to logger
leveldebug level
pathdefault path

Definition at line 75 of file JDataWriter.cc.

80  :
81  JDAQClient(name, server, logger, level),
82  datawriter(),
83  path (path),
85  {
87 
88  JControlHost::Throw(true);
89 
90  // map ControlHost tag to TTree writer.
91 
93  }
JDAQStateMachine::ev_configure_event ev_configure
std::string hostname
host name of data server
Definition: JDataWriter.cc:408
JTreeWriter_t writer
TTree writer.
Definition: JDataWriter.cc:409
std::string name
Definition: JDAQCHSM.chsm:154
void replaceEvent(const JTag &oldTag, const JTag &newTag, JDAQEvent_t &event)
Replace tag of given event in event table.
Definition: JDAQClient.hh:521
JSharedPointer< JControlHost > server
message server
Definition: JDAQClient.hh:834
Type list.
Definition: JTypeList.hh:22
static const JNET::JTag RC_DWRITER
Definition: JDAQTags.hh:65
void insert()
Insert (list of) data type(s).
JDAQClient(const std::string &name, const std::string &server, JLogger *logger, const int level)
Constructor.
Definition: JDAQClient.hh:319
static const JNET::JTag RC_CMD
Definition: JDAQTags.hh:60
JLANG::JSharedPointer< JControlHost > datawriter
Definition: JDataWriter.cc:396
static void Throw(const bool option)
Enable/disable throw option.
Definition: JThrow.hh:37

Member Function Documentation

virtual void KM3NETDAQ::JDataWriter::actionInit ( int  length,
const char *  buffer 
)
inlineoverridevirtual

Reimplemented from JDAQCHSM.

Definition at line 96 of file JDataWriter.cc.

97  {
98  using namespace std;
99  using namespace JPP;
100 
101  // start server
102 
103  try {
104 
105  datawriter.reset(new JControlHost(hostname));
106 
107  datawriter->setReceiveBufferSize(DWRITER_RECEIVE_BUFFER_SIZE);
108 
109  datawriter->MyId(getFullName());
110 
112 
113  for (JTreeWriter_t::iterator i = writer.begin(); i != writer.end(); ++i) {
114  buffer.add(JSubscriptionAll(i->first));
115  }
116 
118 
119  datawriter->Subscribe(buffer);
120  datawriter->SendMeAlways();
121 
122  JNoticeStream(logger) << "Established connection to " << hostname;
123  }
124  catch(const std::exception& exception) {
125  JErrorStream(logger) << exception.what();
126  }
127  }
std::vector< char > buffer
internal buffer for incoming data
Definition: JDataWriter.cc:410
ControlHost class.
std::string hostname
host name of data server
Definition: JDataWriter.cc:408
static const JNET::JTag IO_TRIGGER_PARAMETERS
Definition: JDAQTags.hh:84
JTreeWriter_t writer
TTree writer.
Definition: JDataWriter.cc:409
Subscription list.
JSubscriptionList & add(const JSubscription &subscription)
Add subscription.
Auxiliary class for all subscription.
Definition: JControlHost.hh:97
const std::string & getFullName() const
Get full name of this run control client.
Definition: JDAQClient.hh:120
JMessageLogger logger
message logger
Definition: JDAQClient.hh:835
JLANG::JSharedPointer< JControlHost > datawriter
Definition: JDataWriter.cc:396
static const int DWRITER_RECEIVE_BUFFER_SIZE
socket JDataWriter.cc &lt;- JDataFilter.cc
Definition: JDAQTags.hh:33
virtual void KM3NETDAQ::JDataWriter::actionConfigure ( int  length,
const char *  buffer 
)
inlineoverridevirtual

Reimplemented from JDAQCHSM.

Definition at line 130 of file JDataWriter.cc.

131  {
132  using namespace std;
133 
134  long long int update_s = 10;
135  long long int logger_s = 5;
136 
137  JProperties properties(JEquationParameters("=", ";", "", ""));
138 
139  properties["path"] = path;
140  properties["update_s"] = update_s;
141  properties["logger_s"] = logger_s;
142 
143  properties.read(string(buffer, length));
144 
145  if (update_s <= 0) { update_s = 1; }
146  if (logger_s <= 0) { logger_s = 1; }
147 
148  setClockInterval(update_s * 1000000LL);
149 
150  JDebugStream(logger) << "Path <" << path << ">";
151  JDebugStream(logger) << "Update period [s] " << update_s;
152 
157 
158  numberOfEvents = 0;
159  numberOfBytes = 0;
160  }
Message logger with time scheduler.
std::vector< char > buffer
internal buffer for incoming data
Definition: JDataWriter.cc:410
JMessageScheduler logErrorState
Definition: JDataWriter.cc:406
Utility class to parse parameter values.
Definition: JProperties.hh:497
void setClockInterval(const long long int interval_us)
Set interval time.
Definition: JDAQClient.hh:165
Simple data structure to support I/O of equations (see class JLANG::JEquation).
Time keeper.
Definition: JTimekeeper.hh:34
long long int numberOfBytes
Definition: JDataWriter.cc:401
JMessageScheduler logErrorRun
Definition: JDataWriter.cc:403
JMessageScheduler logErrorFile
Definition: JDataWriter.cc:404
JMessageScheduler logErrorTag
Definition: JDataWriter.cc:405
Level specific message streamers.
JMessageLogger logger
message logger
Definition: JDAQClient.hh:835
virtual void KM3NETDAQ::JDataWriter::actionReset ( int  length,
const char *  buffer 
)
inlineoverridevirtual

Reimplemented from JDAQCHSM.

Definition at line 163 of file JDataWriter.cc.

164  {
165  datawriter.reset();
166  }
JLANG::JSharedPointer< JControlHost > datawriter
Definition: JDataWriter.cc:396
virtual void KM3NETDAQ::JDataWriter::actionQuit ( int  length,
const char *  buffer 
)
inlineoverridevirtual

Reimplemented from JDAQCHSM.

Definition at line 169 of file JDataWriter.cc.

170  {}
virtual void KM3NETDAQ::JDataWriter::actionStart ( int  length,
const char *  buffer 
)
inlineoverridevirtual

Reimplemented from JDAQCHSM.

Definition at line 173 of file JDataWriter.cc.

174  {
175  using namespace std;
176  using namespace JPP;
177 
178  JStatusStream(logger) << "Start run " << getDetectorID() << ' ' << getRunNumber();
179 
180  if (writer.is_open()) {
181 
182  JErrorStream (logger) << "Previous file still open -> close";
183 
184  writer.close();
185  }
186 
187  ostringstream os;
188 
189  for (int i = 0; !writer.is_open() && i != MAXIMUM_FILE_NUMBER; ++i) {
190 
191  os.str("");
192 
193  os << getFullPath(path)
194  << "KM3NeT"
195  << "_" << FILL(8,'0') << getDetectorID()
196  << "_" << FILL(8,'0') << getRunNumber();
197 
198  if (i != 0) {
199  os << "_" << i;
200  }
201 
202  os << ".root";
203 
204  try {
205  writer.open(os.str().c_str());
206  }
207  catch(const std::exception& exception) {
208  JErrorStream(logger) << exception.what();
209  }
210  }
211 
212  if (writer.is_open())
213  JNoticeStream(logger) << "Output file " << os.str();
214  else
215  JErrorStream (logger) << "File not opened " << os.str();
216 
217  numberOfEvents = 0;
218  numberOfBytes = 0;
219 
221 
222  timer.reset();
223 
224  logErrorRun .reset();
225  logErrorFile .reset();
226  logErrorTag .reset();
228 
230  }
static const int MAXIMUM_FILE_NUMBER
maximum file number for overwrite protection.
Definition: JDataWriter.cc:392
void reset(const int run)
Remove all entries before given run.
Definition: JDataWriter.cc:442
JMessageScheduler logErrorState
Definition: JDataWriter.cc:406
JTreeWriter_t writer
TTree writer.
Definition: JDataWriter.cc:409
std::string getFullPath(const std::string &path)
Get full path, i.e. add JEEP::PATHNAME_SEPARATOR if necessary.
Definition: JeepToolkit.hh:168
virtual bool is_open() const override
Check is file is open.
Definition: JRootFile.hh:77
long long int numberOfBytes
Definition: JDataWriter.cc:401
void reset()
Reset timer.
Definition: JTimer.hh:76
JMessageScheduler logErrorRun
Definition: JDataWriter.cc:403
int getDetectorID() const
Get detector identifier.
Definition: JDAQCHSM.chsm:89
TFile * getFile() const
Get file.
Definition: JRootFile.hh:66
JMessageScheduler logErrorFile
Definition: JDataWriter.cc:404
JMessageScheduler logErrorTag
Definition: JDataWriter.cc:405
bool putObject(TDirectory &dir, const TObject &object)
Write object to ROOT directory.
virtual void close() override
Close file.
virtual void open(const char *file_name) override
Open file.
Auxiliary data structure for sequence of same character.
Definition: JManip.hh:328
JMeta meta
meta data
Definition: JDataWriter.cc:390
int getRunNumber() const
Get run number.
Definition: JDAQCHSM.chsm:100
JMessageLogger logger
message logger
Definition: JDAQClient.hh:835
virtual void KM3NETDAQ::JDataWriter::actionStop ( int  length,
const char *  buffer 
)
inlineoverridevirtual

Reimplemented from JDAQCHSM.

Definition at line 233 of file JDataWriter.cc.

234  {
235  typeout();
236 
237  if (timer.usec_wall > 0) {
238  JStatusStream(logger) << "I/O " << (int) (numberOfBytes / timer.usec_wall) << " MB/s";
239  }
240 
241  if (!run_db.is_written(getRunNumber())) {
242  JErrorStream(logger) << "No trigger parameters written for run " << getRunNumber();
243  }
244 
245  writer.close();
246 
247  // Release resources.
248 
250 
251  this->buffer.swap(null);
252  }
std::vector< char > buffer
internal buffer for incoming data
Definition: JDataWriter.cc:410
JTreeWriter_t writer
TTree writer.
Definition: JDataWriter.cc:409
bool is_written(const int run) const
Check if trigger parameters have been written for given run.
Definition: JDataWriter.cc:455
long long int numberOfBytes
Definition: JDataWriter.cc:401
virtual void close() override
Close file.
int getRunNumber() const
Get run number.
Definition: JDAQCHSM.chsm:100
void typeout()
Report status of data writing.
Definition: JDataWriter.cc:380
JMessageLogger logger
message logger
Definition: JDAQClient.hh:835
esac $JPP_BIN JLogger sh $LOGGER until pgrep JGetMessage</dev/null > dev null
unsigned long long usec_wall
Definition: JTimer.hh:224
virtual void KM3NETDAQ::JDataWriter::setSelect ( JFileDescriptorMask mask) const
inlineoverridevirtual

Set the file descriptor mask for the select call.

This implementation does nothing but may be redefined by the derived class.

Parameters
maskfile descriptor mask

Reimplemented from KM3NETDAQ::JDAQClient.

Definition at line 255 of file JDataWriter.cc.

256  {
257  if (datawriter.is_valid()) {
258  mask.set(*datawriter);
259  }
260  }
void set(const int file_descriptor)
Set file descriptor.
JLANG::JSharedPointer< JControlHost > datawriter
Definition: JDataWriter.cc:396
virtual void KM3NETDAQ::JDataWriter::actionSelect ( const JFileDescriptorMask mask)
inlineoverridevirtual

Action method following last select call.

This implementation does nothing but may be redefined by the derived class.

Parameters
maskfile descriptor mask

Reimplemented from KM3NETDAQ::JDAQClient.

Definition at line 263 of file JDataWriter.cc.

264  {
265  using namespace std;
266  using namespace JPP;
267 
268  if (datawriter.is_valid() && mask.has(*datawriter)) {
269 
270  try {
271 
272  JPrefix prefix;
273 
274  datawriter->WaitHead(prefix);
275 
276  timer.start();
277 
278  buffer.resize(prefix.getSize());
279 
280  datawriter->GetFullData(buffer.data(), buffer.size());
281 
282 
283  if (prefix.getTag() == IO_TRIGGER_PARAMETERS) {
284 
285  try {
286  run_db.read(buffer.data(), buffer.size());
287  }
288  catch(const std::exception& error) {
289 
290  JErrorStream(logger) << "Fatal error reading trigger parameters \"" << error.what() << "\"; trigger ev_error.";
291 
292  ev_error();
293  }
294  }
295 
296 
297  if (isRunning()) {
298 
299  // Write trigger parameters for current run if not yet done
300 
302 
303  JTreeWriter_t::iterator i = writer.find(prefix.toString());
304 
305  if (i != writer.end()) {
306 
307  TFile* out = i->second->GetCurrentFile();
308 
309  if (out != NULL && out->IsOpen()) {
310 
311  JDAQPreamble preamble;
312  Version_t version;
313  JDAQHeader header;
314 
315  JByteArrayReader in(buffer.data(), buffer.size());
316 
317  in >> preamble >> version >> header;
318 
319  in.seekg(0); // rewind
320 
321  if (header.getRunNumber() == getRunNumber()) {
322 
323  const Int_t nb = i->second->copy(in);
324 
325  if (nb < (int) buffer.size() || in.tellg() != (int) buffer.size()) {
326  JWarningStream(logger) << "Inconsistency at copy of "
327  << prefix.toString() << ' '
328  << buffer.size() << ' '
329  << in.tellg() << ' '
330  << nb;
331  }
332 
333  if (prefix.getTag() == IO_EVENT)
334  numberOfEvents += 1;
335  numberOfBytes += buffer.size();
336 
337  if (prefix.getTag() == IO_EVENT && numberOfEvents == 1) {
338  typeout();
339  }
340 
341  } else {
342  JErrorStream(logErrorRun) << "Inconsistent run number "
343  << header.getRunNumber()
344  << " != "
345  << getRunNumber();
346  }
347  } else {
348  JErrorStream(logErrorFile) << "Output file not open";
349  }
350  } else {
351  if (prefix.getTag() != IO_TRIGGER_PARAMETERS) {
352  JErrorStream(logErrorTag) << "Unknown tag <" << prefix.toString() << ">, no data written";
353  }
354  }
355  } else {
356  JWarningStream(logErrorState) << "Not in running state <" << prefix.toString() << ">, no data written";
357  }
358 
359  timer.stop();
360  }
361  catch(const std::exception& error) {
362 
363  JErrorStream(logger) << "Fatal error \"" << error.what() << "\"; trigger ev_error.";
364 
365  ev_error();
366  }
367  }
368  }
ControlHost prefix.
Definition: JPrefix.hh:31
std::vector< char > buffer
internal buffer for incoming data
Definition: JDataWriter.cc:410
JDAQStateMachine::ev_error_event ev_error
version
Definition: JEditTuneHV.sh:5
bool has(const int file_descriptor) const
Has file descriptor.
void read(const char *const data, const size_t size)
Read trigger parameters.
Definition: JDataWriter.cc:468
JMessageScheduler logErrorState
Definition: JDataWriter.cc:406
static const JNET::JTag IO_TRIGGER_PARAMETERS
Definition: JDAQTags.hh:84
JTreeWriter_t writer
TTree writer.
Definition: JDataWriter.cc:409
int getSize() const
Get size.
Definition: JPrefix.hh:62
void stop()
Stop timer.
Definition: JTimer.hh:113
long long int numberOfBytes
Definition: JDataWriter.cc:401
JMessageScheduler logErrorRun
Definition: JDataWriter.cc:403
TFile * getFile() const
Get file.
Definition: JRootFile.hh:66
JMessageScheduler logErrorFile
Definition: JDataWriter.cc:404
Byte array binary input.
Definition: JByteArrayIO.hh:25
JMessageScheduler logErrorTag
Definition: JDataWriter.cc:405
bool isRunning() const
Check if this client is in runnig state.
Definition: JDAQClient.hh:508
const JTag & getTag() const
Get tag.
Definition: JTag.hh:86
void write(const int run, TFile *file)
Write trigger parameters for given run if not yet done.
Definition: JDataWriter.cc:514
std::string toString() const
Convert tag to string.
Definition: JTag.hh:171
int getRunNumber() const
Get run number.
Definition: JDAQCHSM.chsm:100
void typeout()
Report status of data writing.
Definition: JDataWriter.cc:380
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
Definition: JCanberra.sh:48
JMessageLogger logger
message logger
Definition: JDAQClient.hh:835
static const JNET::JTag IO_EVENT
Definition: JDAQTags.hh:82
JLANG::JSharedPointer< JControlHost > datawriter
Definition: JDataWriter.cc:396
void start()
Start timer.
Definition: JTimer.hh:89
virtual void KM3NETDAQ::JDataWriter::actionRunning ( )
inlineoverridevirtual

This method is repeatedly called when this client machine is in state Running and the clock interval time is non-zero.

This implementation does nothing but may be redefined by the derived class. Care has to be taken so that the time needed to execute this method should be less than the specified clock interval time (see method setClockInterval()).

Reimplemented from KM3NETDAQ::JDAQClient.

Definition at line 371 of file JDataWriter.cc.

372  {
373  typeout();
374  }
void typeout()
Report status of data writing.
Definition: JDataWriter.cc:380
void KM3NETDAQ::JDataWriter::typeout ( )
inline

Report status of data writing.

Definition at line 380 of file JDataWriter.cc.

381  {
382  std::ostringstream message;
383 
385 
386  logger.typeout(RC_LOG, message.str());
387  logger.status(message.str());
388  }
void status(const JMessage_t &message)
long long int numberOfBytes
Definition: JDataWriter.cc:401
static const JNET::JTag RC_LOG
Definition: JDAQTags.hh:66
virtual void typeout(const std::string &tag, const std::string &message) override
Report message.
char getTokenDelimeter()
Get the token delimeter for command messages.
const std::string & getFullName() const
Get full name of this run control client.
Definition: JDAQClient.hh:120
JMessageLogger logger
message logger
Definition: JDAQClient.hh:835
virtual bool KM3NETDAQ::JDAQClient::enter ( const JArgs args)
inlinevirtualinherited

Enter the state machine.

This overloaded method enter reproduces the constructor. All necessary input is parsed from the list of arguments. In case of an error, the state machine is not entered.

Parameters
argsarray of command line arguments
Returns
true if okay; else false

Definition at line 392 of file JDAQClient.hh.

393  {
394  using namespace std;
395 
396  string server;
397  string logger;
398  int level;
399  bool use_cout;
400 
401  try {
402 
403  parser['H'] = make_field(server) = "localhost";
404  parser['M'] = make_field(logger) = "localhost";
405  parser['d'] = make_field(level) = 0;
406  parser['c'] = make_field(use_cout);
407 
408  if (parser.read(args) != 0) {
409  return false;
410  }
411  }
412  catch(const std::exception &error) {
413  cerr << error.what() << endl;
414  return false;
415  }
416 
417  try {
418 
419  JLogger* out = NULL;
420 
421  if (use_cout)
422  out = new JStreamLogger(cout);
423  else
424  out = new JControlHostLogger(logger);
425 
426  this->logger = JMessageLogger(out, getName(), level);
427 
428  this->server.reset(new JControlHost(server));
429 
430  return enter();
431  }
432  catch(const std::exception& error) {
433  cerr << error.what() << endl;
434  return false;
435  }
436  }
JParser parser
parser method enter()
Definition: JDAQClient.hh:1065
Message logging based on std::ostream.
Interface for logging messages.
Definition: JLogger.hh:22
Message logging based on ControlHost.
JSharedPointer< JControlHost > server
message server
Definition: JDAQClient.hh:834
virtual bool enter() override
Enter the state machine.
Definition: JDAQClient.hh:447
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1989
int read(const int argc, const char *const argv[])
Parse the program&#39;s command line options.
Definition: JParser.hh:1811
JMessageLogger logger
message logger
Definition: JDAQClient.hh:835
const std::string & getName() const
Get name of state machine.
Definition: JDAQCHSM.chsm:78
virtual bool KM3NETDAQ::JDAQClient::enter ( )
inlineoverridevirtualinherited

Enter the state machine.

This method activates the subscription to JNET::JControlHost messages. In case of an error, the state machine is not entered.

Returns
true if okay; else false

Reimplemented in KM3NETDAQ::JDAQDriver.

Definition at line 447 of file JDAQClient.hh.

448  {
449  using namespace std;
450  using namespace JPP;
451 
452  if (server.is_valid() && logger.is_valid()) {
453 
454  const JSubscriptionList buffer = getSubscription(eventTable) + subscription;
455 
456  try {
457 
458  server->Subscribe(buffer);
459  server->SendMeAlways();
460  server->MyId(getFullName());
461 
462  JStatusStream(logger) << "Process with nick name \"" << getFullName() << "\" version \"" << getGITVersion() << "\" subscription: " << buffer.toString();
463 
464  return CHSM::machine::enter();
465  }
466  catch(const std::exception& error) {
467  JErrorStream(logger) << error.what();
468  }
469 
470  } else {
471  cerr << "Message server or logger not properly initialised." << endl;
472  }
473 
474  return false;
475  }
JSharedPointer< JControlHost > server
message server
Definition: JDAQClient.hh:834
std::string getGITVersion(const std::string &tag)
Get GIT version for given GIT tag.
JSubscriptionList subscription
custom subscription
Definition: JDAQClient.hh:1066
JEventTable eventTable
event table
Definition: JDAQClient.hh:203
bool is_valid() const
Check validity of logger object.
const std::string & getFullName() const
Get full name of this run control client.
Definition: JDAQClient.hh:120
JSubscriptionList getSubscription(const JEventTable &event_table)
Convert event table to ControlHost subscription.
Definition: JEventTable.hh:129
JMessageLogger logger
message logger
Definition: JDAQClient.hh:835
virtual bool KM3NETDAQ::JDAQClient::exit ( )
inlineoverridevirtualinherited

Exit the state machine.

This method releases the various resources.

Returns
true if okay; else false

Definition at line 485 of file JDAQClient.hh.

486  {
487  try {
488  if (server.is_valid()) { server.reset(NULL); }
489  }
490  catch(const std::exception& error) {
491  }
492 
493  try {
494  if (logger.is_valid()) { logger.reset(NULL); }
495  }
496  catch(const std::exception& error) {
497  }
498 
499  return CHSM::machine::exit();
500  }
void reset(JLogger *__logger=NULL)
Reset logger.
exit
Definition: JPizza.sh:36
JSharedPointer< JControlHost > server
message server
Definition: JDAQClient.hh:834
bool is_valid() const
Check validity of logger object.
JMessageLogger logger
message logger
Definition: JDAQClient.hh:835
bool KM3NETDAQ::JDAQClient::isRunning ( ) const
inlineinherited

Check if this client is in runnig state.

Returns
true if running; else false

Definition at line 508 of file JDAQClient.hh.

509  {
510  return Main.RunControl.Operational.Running.active();
511  }
JDAQStateMachine::state_Main Main
JDAQStateMachine::state_Main::state_RunControl::state_Operational Operational
JDAQStateMachine::state_Main::state_RunControl RunControl
void KM3NETDAQ::JDAQClient::replaceEvent ( const JTag oldTag,
const JTag newTag,
JDAQEvent_t event 
)
inlineinherited

Replace tag of given event in event table.

Parameters
oldTagold tag
newTagnew tag
eventevent

Definition at line 521 of file JDAQClient.hh.

524  {
525  eventTable.replace(oldTag, newTag, event);
526  }
void replace(const JTag &oldTag, const JTag &newTag, JDAQEvent_t &event)
Replace entry in table.
Definition: JEventTable.hh:96
JEventTable eventTable
event table
Definition: JDAQClient.hh:203
JDAQEvent_t* KM3NETDAQ::JDAQClient::findEvent ( const JTag tag,
const std::string event_name 
)
inlineinherited

Find event in event table.

Parameters
tagtag
event_nameevent name
Returns
pointer to event or NULL

Definition at line 536 of file JDAQClient.hh.

537  {
538  JEventTable::const_iterator i = eventTable.find(tag, event_name);
539 
540  if (i != eventTable.end())
541  return i->second;
542  else
543  return NULL;
544  }
JEventTable eventTable
event table
Definition: JDAQClient.hh:203
const_iterator find(const JTag &tag, const std::string &event_name) const
Find entry.
Definition: JEventTable.hh:116
void KM3NETDAQ::JDAQClient::addSubscription ( const JSubscription subscription)
inlineinherited

Add custom subscription.

Parameters
subscriptionsubscription

Definition at line 552 of file JDAQClient.hh.

553  {
555  }
JSubscriptionList & add(const JSubscription &subscription)
Add subscription.
JSubscriptionList subscription
custom subscription
Definition: JDAQClient.hh:1066
template<class T >
void KM3NETDAQ::JDAQClient::addParameter ( const char  option,
T parameter 
)
inlineinherited

Add parameter to parser used in method enter().

Parameters
optionoption
parameterparameter

Definition at line 565 of file JDAQClient.hh.

566  {
567  parser[option] = make_field(parameter);
568  }
JParser parser
parser method enter()
Definition: JDAQClient.hh:1065
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1989
template<class T >
void KM3NETDAQ::JDAQClient::addParameter ( const char  option,
T parameter,
const T value 
)
inlineinherited

Add parameter to parser used in method enter().

Parameters
optionoption
parameterparameter
valuedefault value

Definition at line 579 of file JDAQClient.hh.

580  {
581  parser[option] = make_field(parameter) = value;
582  }
JParser parser
parser method enter()
Definition: JDAQClient.hh:1065
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1989
void KM3NETDAQ::JDAQClient::setSelect ( )
inlineinherited

Set the file descriptor mask for the select call.

Definition at line 588 of file JDAQClient.hh.

589  {
590  select.reset();
591 
593 
595  }
JSelectReader select
select call
Definition: JDAQClient.hh:1064
JSharedPointer< JControlHost > server
message server
Definition: JDAQClient.hh:834
JFileDescriptorMask & getReaderMask()
Get reader mask.
void setReaderMask(const JAbstractFile &file)
Set reader mask.
void reset()
Reset.
void setSelect()
Set the file descriptor mask for the select call.
Definition: JDAQClient.hh:588
virtual void KM3NETDAQ::JDAQClient::actionInput ( int  length,
const char *  buffer 
)
inlineoverridevirtualinherited

This method is called at ev_input.

Parameters
lengthlength of data
bufferpointer to data

Reimplemented from JDAQCHSM.

Reimplemented in KM3NETDAQ::DataQueue.

Definition at line 635 of file JDAQClient.hh.

636  {
637  using namespace std;
638 
639  JProperties properties(JEquationParameters("=", ";", "", ""), 1);
640 
641  int level = this->logger.getLevel();
642 
643  properties["debug"] = level;
644 
645  properties.read(string(buffer, length));
646 
647  this->logger.setLevel(level);
648  }
Utility class to parse parameter values.
Definition: JProperties.hh:497
Simple data structure to support I/O of equations (see class JLANG::JEquation).
JMessageLogger logger
message logger
Definition: JDAQClient.hh:835
void setLevel(const int __level)
Set debug level.
JLevel_t getLevel()
Get debug level.
virtual bool KM3NETDAQ::JDAQClient::filter ( const JTag tag,
int  length,
const char *  buffer 
)
inlinevirtualinherited

Filter message.

The filter method can be overwritten so that a specific action is made before the corresponding message is processed by the state machine. The message is ignored if true is returned, else it is normally processed.

Parameters
tagtag
lengthnumber of characters
buffermessage
Returns
skip message or not

Definition at line 662 of file JDAQClient.hh.

663  {
664  return false;
665  }
virtual void KM3NETDAQ::JDAQClient::actionTagged ( const JTag tag,
int  length,
const char *  buffer 
)
inlinevirtualinherited

This method is called when a custom tag is encountered.

Parameters
tagtag
lengthlength of data
bufferpointer to data

Reimplemented in KM3NETDAQ::JDataFilter.

Definition at line 675 of file JDAQClient.hh.

676  {
677  }
void KM3NETDAQ::JDAQClient::run ( )
inlineinherited

Run as run control client following command messages via JNET::JControlHost.

This method can be called once the state machine is entered. It returns when the state machine is exited. If the clock interval is non-zero, the method actionRunning() is repeatedly called when this client machine is in state Running. The file descriptor mask can be set to interrupt the timeout of the select call and clock method wait() in this calling sequence (see methods setSelect() and actionSelect()).

Definition at line 690 of file JDAQClient.hh.

691  {
692  using namespace std;
693  using namespace JPP;
694 
695  while (active()) {
696 
697  try {
698 
699  setSelect();
700 
701  if (select(JTimeval(TIMEOUT_S,0)) > 0) {
702 
703  if (select.hasReaderMask(*server)) {
704  update();
705  }
706 
708 
709  } else {
710 
711  continue;
712  }
713 
714 
715  if (isRunning() && clock.getInterval() != 0LL) {
716 
717  long long int numberOfCalls = 0;
718 
719  clock.reset();
720 
721  do {
722 
723  ++numberOfCalls;
724 
725  setSelect();
726 
727  if (clock.wait(select.getReaderMask())) {
728 
729  if (select.hasReaderMask(*server)) {
730  update();
731  }
732 
734 
735  } else {
736 
737  try {
738  actionRunning();
739  }
740  catch(const std::exception& error) {
741  logger.error(error.what());
742  }
743  }
744 
745  } while (isRunning());
746 
747  if (numberOfCalls != 0) {
748  JNoticeStream(logger) << "Delay per call " << clock.getDelay() / numberOfCalls / 1000 << " ms";
749  }
750  }
751  }
752  catch(const JPP::JSocketException& error) {
753  JErrorStream(logger) << "method run(): \"" << error.what() << "\" -> trigger ev_error.";
754  ev_error();
755  }
756  catch(const std::exception& error) {
757  JErrorStream(logger) << "method run(): \"" << error.what() << "\"";
758  }
759  }
760  }
long long int getDelay() const
Get total delay time.
Definition: JTimekeeper.hh:78
JDAQStateMachine::ev_error_event ev_error
JTimekeeper clock
central clock
Definition: JDAQClient.hh:207
static const int TIMEOUT_S
time out of update [s]
Definition: JDAQClient.hh:63
JSelectReader select
select call
Definition: JDAQClient.hh:1064
void reset(const long long int t0)
Reset time.
Definition: JTimekeeper.hh:100
JSharedPointer< JControlHost > server
message server
Definition: JDAQClient.hh:834
JFileDescriptorMask & getReaderMask()
Get reader mask.
void wait() const
Wait until the number of time intervals has elapsed since the last call to the reset method...
Definition: JTimekeeper.hh:145
virtual void actionRunning()
This method is repeatedly called when this client machine is in state Running and the clock interval ...
Definition: JDAQClient.hh:625
bool isRunning() const
Check if this client is in runnig state.
Definition: JDAQClient.hh:508
void update()
Update state machine.
Definition: JDAQClient.hh:842
long long int getInterval() const
Get interval time.
Definition: JTimekeeper.hh:67
virtual const char * what() const override
Get error message.
Definition: JException.hh:64
Exception for socket.
Definition: JException.hh:466
JMessageLogger logger
message logger
Definition: JDAQClient.hh:835
void error(const JMessage_t &message)
void setSelect()
Set the file descriptor mask for the select call.
Definition: JDAQClient.hh:588
virtual void actionSelect(const JFileDescriptorMask &mask)
Action method following last select call.
Definition: JDAQClient.hh:614
bool hasReaderMask(const JAbstractFile &file) const
Has reader file.
void KM3NETDAQ::JDAQClient::run ( const int  port)
inlineinherited

Run for ever.

This method can be used when the run control client is started before the run control (e.g. at boot time of the host processor). This method should be called before the state machine is entered. It launches a server which accepts a JNET::JControlHost connection from a designated application e.g. the JDAQClientStarter.cc program. The state machine is entered using the available data in the JNET::JControlHost message. After the state machine is exited, it accepts a new a JNET::JControlHost connection.

Parameters
portport number

Definition at line 775 of file JDAQClient.hh.

776  {
777  JControlHostServer local_server(port);
778 
779  for ( ; ; ) {
780 
781  JControlHost* ps = local_server.AcceptClient();
782 
783  ps->Connected();
784 
785  JNET::JPrefix prefix;
786 
787  ps->WaitHead(prefix);
788 
789  const int length = prefix.getSize();
790 
791  char* buffer = new char[length];
792 
793  ps->GetFullData(buffer, length);
794  ps->PutFullData(prefix.toString(), buffer, length);
795 
796  delete ps;
797 
798  enter(JArgs(std::string(buffer, length)));
799 
800  delete [] buffer;
801 
802  run();
803 
804  exit();
805  }
806  }
ControlHost prefix.
Definition: JPrefix.hh:31
virtual bool exit() override
Exit the state machine.
Definition: JDAQClient.hh:485
virtual bool enter() override
Enter the state machine.
Definition: JDAQClient.hh:447
void run()
Run as run control client following command messages via JNET::JControlHost.
Definition: JDAQClient.hh:690
int getSize() const
Get size.
Definition: JPrefix.hh:62
then awk string
std::string toString() const
Convert tag to string.
Definition: JTag.hh:171
void KM3NETDAQ::JDAQClient::run ( std::istream &  in)
inlineinherited

Run client with commands from input stream (e.g. for debugging).

Example input format:

<tag> <event name>[#data];
<tag> <event name>[#data];
Parameters
ininput stream

Definition at line 820 of file JDAQClient.hh.

821  {
822  using namespace std;
823 
824  string tag;
825  string buffer;
826 
827  while (in >> tag && in >> skipws && getline(in, buffer, ';')) {
828  update(tag, buffer.length(), buffer.data());
829  }
830  }
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
Definition: JString.hh:478
void update()
Update state machine.
Definition: JDAQClient.hh:842
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
Definition: JCanberra.sh:48
void JDAQStateMachine::A1 ( CHSM_ns_alias::event const &  event)
inherited

Definition at line 344 of file JDAQCHSM.cc.

344 { actionError(); }
virtual void actionError()
Definition: JDAQCHSM.chsm:124
void JDAQStateMachine::A2 ( CHSM_ns_alias::event const &  event)
inherited

Definition at line 346 of file JDAQCHSM.cc.

346 { execute(&JDAQCHSM::actionInit, event); }
virtual void actionInit(int, const char *)
Definition: JDAQCHSM.chsm:112
virtual void execute(action __action, const CHSM::event &__event)=0
The method to execute the action.
void JDAQStateMachine::A3 ( CHSM_ns_alias::event const &  event)
inherited

Definition at line 348 of file JDAQCHSM.cc.

348 { JDAQCHSM::exit(); }
exit
Definition: JPizza.sh:36
void JDAQStateMachine::A4 ( CHSM_ns_alias::event const &  event)
inherited

Definition at line 350 of file JDAQCHSM.cc.

virtual void execute(action __action, const CHSM::event &__event)=0
The method to execute the action.
virtual void actionConfigure(int, const char *)
Definition: JDAQCHSM.chsm:113
void JDAQStateMachine::A5 ( CHSM_ns_alias::event const &  event)
inherited

Definition at line 352 of file JDAQCHSM.cc.

352 { execute(&JDAQCHSM::actionReset, event); }
virtual void actionReset(int, const char *)
Definition: JDAQCHSM.chsm:118
virtual void execute(action __action, const CHSM::event &__event)=0
The method to execute the action.
void JDAQStateMachine::A6 ( CHSM_ns_alias::event const &  event)
inherited

Definition at line 354 of file JDAQCHSM.cc.

354  {
355 
356  std::istringstream is(std::string(ev_start->buffer, ev_start->length));
357 
358  is >> run_number >> detector_id;
359 
361 
362  }
JDAQStateMachine::ev_start_event ev_start
int run_number
Definition: JDAQCHSM.chsm:156
is
Definition: JDAQCHSM.chsm:167
virtual void execute(action __action, const CHSM::event &__event)=0
The method to execute the action.
then awk string
virtual void actionStart(int, const char *)
Definition: JDAQCHSM.chsm:114
int detector_id
Definition: JDAQCHSM.chsm:155
void JDAQStateMachine::A7 ( CHSM_ns_alias::event const &  event)
inherited

Definition at line 364 of file JDAQCHSM.cc.

364 { execute(&JDAQCHSM::actionQuit, event); }
virtual void actionQuit(int, const char *)
Definition: JDAQCHSM.chsm:119
virtual void execute(action __action, const CHSM::event &__event)=0
The method to execute the action.
void JDAQStateMachine::A8 ( CHSM_ns_alias::event const &  event)
inherited

Definition at line 366 of file JDAQCHSM.cc.

366 { execute(&JDAQCHSM::actionContinue, event); }
virtual void execute(action __action, const CHSM::event &__event)=0
The method to execute the action.
virtual void actionContinue(int, const char *)
Definition: JDAQCHSM.chsm:116
void JDAQStateMachine::A9 ( CHSM_ns_alias::event const &  event)
inherited

Definition at line 368 of file JDAQCHSM.cc.

368 { execute(&JDAQCHSM::actionStop, event); }
virtual void actionStop(int, const char *)
Definition: JDAQCHSM.chsm:117
virtual void execute(action __action, const CHSM::event &__event)=0
The method to execute the action.
void JDAQStateMachine::A10 ( CHSM_ns_alias::event const &  event)
inherited

Definition at line 370 of file JDAQCHSM.cc.

370 { execute(&JDAQCHSM::actionPause, event); }
virtual void actionPause(int, const char *)
Definition: JDAQCHSM.chsm:115
virtual void execute(action __action, const CHSM::event &__event)=0
The method to execute the action.
void JDAQStateMachine::A11 ( CHSM_ns_alias::event const &  event)
inherited

Definition at line 372 of file JDAQCHSM.cc.

372 { execute(&JDAQCHSM::actionRecover, event); }
virtual void actionRecover(int, const char *)
Definition: JDAQCHSM.chsm:125
virtual void execute(action __action, const CHSM::event &__event)=0
The method to execute the action.
void JDAQStateMachine::A12 ( CHSM_ns_alias::event const &  event)
inherited

Definition at line 374 of file JDAQCHSM.cc.

374 { JDAQCHSM::exit(); }
exit
Definition: JPizza.sh:36
void JDAQStateMachine::A13 ( CHSM_ns_alias::event const &  event)
inherited

Definition at line 376 of file JDAQCHSM.cc.

376 { execute(&JDAQCHSM::actionCheck, event); }
virtual void actionCheck(int, const char *)
Definition: JDAQCHSM.chsm:121
virtual void execute(action __action, const CHSM::event &__event)=0
The method to execute the action.
void JDAQStateMachine::A14 ( CHSM_ns_alias::event const &  event)
inherited

Definition at line 378 of file JDAQCHSM.cc.

378 { execute(&JDAQCHSM::actionInput, event); }
virtual void actionInput(int, const char *)
Definition: JDAQCHSM.chsm:122
virtual void execute(action __action, const CHSM::event &__event)=0
The method to execute the action.
void JDAQStateMachine::EAM4root ( CHSM_ns_alias::state const &  chsm_state_,
CHSM_ns_alias::event const &  event 
)
inherited

Definition at line 337 of file JDAQCHSM.cc.

337  {
338 #line 164 "JDAQCHSM.chsm"
339  CHSM_ns_alias::cluster const &state = (CHSM_ns_alias::cluster const&)chsm_state_; actionEnter(); }
virtual void actionEnter()
Interface methods for actions corresponding to state transitions.
Definition: JDAQCHSM.chsm:109
void JDAQStateMachine::XAM4root ( CHSM_ns_alias::state const &  chsm_state_,
CHSM_ns_alias::event const &  event 
)
inherited

Definition at line 340 of file JDAQCHSM.cc.

340  {
341 #line 165 "JDAQCHSM.chsm"
342  CHSM_ns_alias::cluster const &state = (CHSM_ns_alias::cluster const&)chsm_state_; actionExit(); }
virtual void actionExit()
Definition: JDAQCHSM.chsm:110
const std::string& JDAQCHSM::getName ( ) const
inlineinherited

Get name of state machine.

Returns
name

Definition at line 78 of file JDAQCHSM.chsm.

79  {
80  return name;
81  }
std::string name
Definition: JDAQCHSM.chsm:154
const std::string& JDAQCHSM::getName ( ) const
inlineinherited

Get name of state machine.

Returns
name

Definition at line 89 of file JDAQCHSM.hh.

90  {
91  return name;
92  }
std::string name
Definition: JDAQCHSM.chsm:154
int JDAQCHSM::getDetectorID ( ) const
inlineinherited

Get detector identifier.

Returns
detector identifier.

Definition at line 89 of file JDAQCHSM.chsm.

90  {
91  return detector_id;
92  }
int detector_id
Definition: JDAQCHSM.chsm:155
int JDAQCHSM::getDetectorID ( ) const
inlineinherited

Get detector identifier.

Returns
detector identifier.

Definition at line 100 of file JDAQCHSM.hh.

101  {
102  return detector_id;
103  }
int detector_id
Definition: JDAQCHSM.chsm:155
int JDAQCHSM::getRunNumber ( ) const
inlineinherited

Get run number.

Returns
run number

Definition at line 100 of file JDAQCHSM.chsm.

101  {
102  return run_number;
103  }
int run_number
Definition: JDAQCHSM.chsm:156
int JDAQCHSM::getRunNumber ( ) const
inlineinherited

Get run number.

Returns
run number

Definition at line 111 of file JDAQCHSM.hh.

112  {
113  return run_number;
114  }
int run_number
Definition: JDAQCHSM.chsm:156
virtual void JDAQCHSM::actionEnter ( )
inlinevirtualinherited

Interface methods for actions corresponding to state transitions.

Reimplemented in KM3NETDAQ::JDataFilter, KM3NETDAQ::DataQueue, JDAQDemoClient, AcousticDataFilter, and KM3NETDAQ::MonitorRouter.

Definition at line 109 of file JDAQCHSM.chsm.

109 {}
virtual void JDAQCHSM::actionEnter ( )
inlinevirtualinherited

Interface methods for actions corresponding to state transitions.

Reimplemented in KM3NETDAQ::JDataFilter, KM3NETDAQ::DataQueue, JDAQDemoClient, AcousticDataFilter, and KM3NETDAQ::MonitorRouter.

Definition at line 120 of file JDAQCHSM.hh.

120 {}
virtual void JDAQCHSM::actionExit ( )
inlinevirtualinherited
virtual void JDAQCHSM::actionExit ( )
inlinevirtualinherited
virtual void JDAQCHSM::actionPause ( int  ,
const char *   
)
inlinevirtualinherited
virtual void JDAQCHSM::actionPause ( int  ,
const char *   
)
inlinevirtualinherited
virtual void JDAQCHSM::actionContinue ( int  ,
const char *   
)
inlinevirtualinherited
virtual void JDAQCHSM::actionContinue ( int  ,
const char *   
)
inlinevirtualinherited
virtual void JDAQCHSM::actionError ( )
inlinevirtualinherited

Definition at line 124 of file JDAQCHSM.chsm.

124 {}
virtual void JDAQCHSM::actionError ( )
inlinevirtualinherited

Definition at line 135 of file JDAQCHSM.hh.

135 {}
virtual void JDAQCHSM::actionRecover ( int  ,
const char *   
)
inlinevirtualinherited

Definition at line 125 of file JDAQCHSM.chsm.

125 {}
virtual void JDAQCHSM::actionRecover ( int  ,
const char *   
)
inlinevirtualinherited

Definition at line 136 of file JDAQCHSM.hh.

136 {}
const std::string& KM3NETDAQ::JDAQClient_t::getHostname ( ) const
inlineinherited

Get hostname.

Returns
host name

Definition at line 109 of file JDAQClient.hh.

110  {
111  return hostname;
112  }
const std::string& KM3NETDAQ::JDAQClient_t::getFullName ( ) const
inlineinherited

Get full name of this run control client.

Returns
full name

Definition at line 120 of file JDAQClient.hh.

121  {
122  return fullname;
123  }
const JTag& KM3NETDAQ::JDAQClient_t::getUniqueTag ( ) const
inlineinherited

Get unique tag of this run control client.

Returns
unique tag

Definition at line 131 of file JDAQClient.hh.

132  {
133  return unique_tag;
134  }
long long int KM3NETDAQ::JDAQClient_t::getClockDelay ( ) const
inlineinherited

Get total delay time.

Returns
delay time [us]

Definition at line 142 of file JDAQClient.hh.

143  {
144  return clock.getDelay();
145  }
long long int getDelay() const
Get total delay time.
Definition: JTimekeeper.hh:78
JTimekeeper clock
central clock
Definition: JDAQClient.hh:207
long long int KM3NETDAQ::JDAQClient_t::getClockInterval ( ) const
inlineinherited

Get interval time.

Returns
interval time [us]

Definition at line 154 of file JDAQClient.hh.

155  {
156  return clock.getInterval();
157  }
JTimekeeper clock
central clock
Definition: JDAQClient.hh:207
long long int getInterval() const
Get interval time.
Definition: JTimekeeper.hh:67
void KM3NETDAQ::JDAQClient_t::setClockInterval ( const long long int  interval_us)
inlineinherited

Set interval time.

Parameters
interval_usinterval time [us]

Definition at line 165 of file JDAQClient.hh.

166  {
167  clock.setInterval(interval_us);
168  }
JTimekeeper clock
central clock
Definition: JDAQClient.hh:207
void setInterval(const long long int interval_us)
Set interval time.
Definition: JTimekeeper.hh:89
void KM3NETDAQ::JDAQClient_t::resetClock ( )
inlineinherited

Reset clock.

Definition at line 174 of file JDAQClient.hh.

175  {
176  clock.reset();
177  }
JTimekeeper clock
central clock
Definition: JDAQClient.hh:207
void reset(const long long int t0)
Reset time.
Definition: JTimekeeper.hh:100
const std::string& KM3NETDAQ::JDAQClient_t::getEventInfo ( ) const
inlineinherited

Get last event information.

Returns
event information

Definition at line 185 of file JDAQClient.hh.

186  {
187  return event_info;
188  }
std::string event_info
event information
Definition: JDAQClient.hh:208
void KM3NETDAQ::JDAQClient_t::setEventInfo ( const std::string info)
inlineinherited

Set last event information.

Parameters
infoevent information

Definition at line 196 of file JDAQClient.hh.

197  {
198  this->event_info = info;
199  }
std::string event_info
event information
Definition: JDAQClient.hh:208

Member Data Documentation

JMeta KM3NETDAQ::JDataWriter::meta

meta data

Definition at line 390 of file JDataWriter.cc.

const int KM3NETDAQ::JDataWriter::MAXIMUM_FILE_NUMBER = 100
static

maximum file number for overwrite protection.

Definition at line 392 of file JDataWriter.cc.

JLANG::JSharedPointer<JControlHost> KM3NETDAQ::JDataWriter::datawriter
private

Definition at line 396 of file JDataWriter.cc.

std::string KM3NETDAQ::JDataWriter::path
private

Definition at line 397 of file JDataWriter.cc.

JEEP::JTimer KM3NETDAQ::JDataWriter::timer
private

Definition at line 399 of file JDataWriter.cc.

Long64_t KM3NETDAQ::JDataWriter::numberOfEvents
private

Definition at line 400 of file JDataWriter.cc.

long long int KM3NETDAQ::JDataWriter::numberOfBytes
private

Definition at line 401 of file JDataWriter.cc.

JMessageScheduler KM3NETDAQ::JDataWriter::logErrorRun
private

Definition at line 403 of file JDataWriter.cc.

JMessageScheduler KM3NETDAQ::JDataWriter::logErrorFile
private

Definition at line 404 of file JDataWriter.cc.

JMessageScheduler KM3NETDAQ::JDataWriter::logErrorTag
private

Definition at line 405 of file JDataWriter.cc.

JMessageScheduler KM3NETDAQ::JDataWriter::logErrorState
private

Definition at line 406 of file JDataWriter.cc.

std::string KM3NETDAQ::JDataWriter::hostname
private

host name of data server

Definition at line 408 of file JDataWriter.cc.

JTreeWriter_t KM3NETDAQ::JDataWriter::writer
private

TTree writer.

Definition at line 409 of file JDataWriter.cc.

std::vector<char> KM3NETDAQ::JDataWriter::buffer
private

internal buffer for incoming data

Definition at line 410 of file JDataWriter.cc.

JRunDB KM3NETDAQ::JDataWriter::run_db
private

Definition at line 530 of file JDataWriter.cc.

JSharedPointer<JControlHost> KM3NETDAQ::JDAQClient::server
protectedinherited

message server

Definition at line 834 of file JDAQClient.hh.

JMessageLogger KM3NETDAQ::JDAQClient::logger
protectedinherited

message logger

Definition at line 835 of file JDAQClient.hh.

JDAQStateMachine::state_root JDAQStateMachine::root
inherited
JDAQStateMachine::state_Main JDAQStateMachine::Main
inherited
JDAQStateMachine::ev_daq_event JDAQStateMachine::ev_daq
inherited
char JDAQStateMachine::ev_daq_param_block[sizeof(ev_daq_event::param_block)]
inherited

Definition at line 238 of file JDAQCHSM.hh.

JDAQStateMachine::ev_init_event JDAQStateMachine::ev_init
inherited
char JDAQStateMachine::ev_init_param_block[sizeof(ev_init_event::param_block)]
inherited

Definition at line 258 of file JDAQCHSM.hh.

JDAQStateMachine::ev_configure_event JDAQStateMachine::ev_configure
inherited
char JDAQStateMachine::ev_configure_param_block[sizeof(ev_configure_event::param_block)]
inherited

Definition at line 278 of file JDAQCHSM.hh.

JDAQStateMachine::ev_start_event JDAQStateMachine::ev_start
inherited
char JDAQStateMachine::ev_start_param_block[sizeof(ev_start_event::param_block)]
inherited

Definition at line 298 of file JDAQCHSM.hh.

JDAQStateMachine::ev_pause_event JDAQStateMachine::ev_pause
inherited
char JDAQStateMachine::ev_pause_param_block[sizeof(ev_pause_event::param_block)]
inherited

Definition at line 318 of file JDAQCHSM.hh.

JDAQStateMachine::ev_continue_event JDAQStateMachine::ev_continue
inherited
char JDAQStateMachine::ev_continue_param_block[sizeof(ev_continue_event::param_block)]
inherited

Definition at line 338 of file JDAQCHSM.hh.

JDAQStateMachine::ev_stop_event JDAQStateMachine::ev_stop
inherited
char JDAQStateMachine::ev_stop_param_block[sizeof(ev_stop_event::param_block)]
inherited

Definition at line 358 of file JDAQCHSM.hh.

JDAQStateMachine::ev_reset_event JDAQStateMachine::ev_reset
inherited
char JDAQStateMachine::ev_reset_param_block[sizeof(ev_reset_event::param_block)]
inherited

Definition at line 378 of file JDAQCHSM.hh.

JDAQStateMachine::ev_quit_event JDAQStateMachine::ev_quit
inherited
char JDAQStateMachine::ev_quit_param_block[sizeof(ev_quit_event::param_block)]
inherited

Definition at line 398 of file JDAQCHSM.hh.

JDAQStateMachine::ev_off_event JDAQStateMachine::ev_off
inherited
char JDAQStateMachine::ev_off_param_block[sizeof(ev_off_event::param_block)]
inherited

Definition at line 418 of file JDAQCHSM.hh.

JDAQStateMachine::ev_check_event JDAQStateMachine::ev_check
inherited
char JDAQStateMachine::ev_check_param_block[sizeof(ev_check_event::param_block)]
inherited

Definition at line 438 of file JDAQCHSM.hh.

JDAQStateMachine::ev_input_event JDAQStateMachine::ev_input
inherited
char JDAQStateMachine::ev_input_param_block[sizeof(ev_input_event::param_block)]
inherited

Definition at line 458 of file JDAQCHSM.hh.

JDAQStateMachine::ev_recover_event JDAQStateMachine::ev_recover
inherited
char JDAQStateMachine::ev_recover_param_block[sizeof(ev_recover_event::param_block)]
inherited

Definition at line 478 of file JDAQCHSM.hh.

JDAQStateMachine::ev_error_event JDAQStateMachine::ev_error
inherited
char JDAQStateMachine::ev_error_param_block[sizeof(ev_error_event::param_block)]
inherited

Definition at line 495 of file JDAQCHSM.hh.

std::string JDAQCHSM::name
protectedinherited

Definition at line 154 of file JDAQCHSM.chsm.

int JDAQCHSM::detector_id
protectedinherited

Definition at line 155 of file JDAQCHSM.chsm.

int JDAQCHSM::run_number
protectedinherited

Definition at line 156 of file JDAQCHSM.chsm.

const int KM3NETDAQ::JDAQClient_t::TIMEOUT_S = 1
staticinherited

time out of update [s]

Definition at line 63 of file JDAQClient.hh.

JEventTable KM3NETDAQ::JDAQClient_t::eventTable
protectedinherited

event table

Definition at line 203 of file JDAQClient.hh.

std::string KM3NETDAQ::JDAQClient_t::fullname
protectedinherited

Definition at line 205 of file JDAQClient.hh.

JTag KM3NETDAQ::JDAQClient_t::unique_tag
protectedinherited

Definition at line 206 of file JDAQClient.hh.

JTimekeeper KM3NETDAQ::JDAQClient_t::clock
protectedinherited

central clock

Definition at line 207 of file JDAQClient.hh.

std::string KM3NETDAQ::JDAQClient_t::event_info
protectedinherited

event information

Definition at line 208 of file JDAQClient.hh.


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