Jpp test-rotations-old-533-g2bdbdb559
the software that should make you happy
Loading...
Searching...
No Matches
KM3NETDAQ::JDataFilter Class Reference

Main class for real-time filtering of data. More...

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

Classes

struct  JCircularBuffer_t
 Circular buffer. More...
 

Public Types

typedef JSocketInputChannel< JDAQAbstractPreambleJSocketInputChannel_t
 
typedef std::vector< JSocketInputChannel_tJChannelList_t
 
typedef double hit_type
 
typedef JSuperFrame1D< hit_typeJSuperFrame1D_t
 
typedef JSuperFrame2D< hit_typeJSuperFrame2D_t
 
typedef JTimeslice< hit_typeJTimeslice_t
 
typedef JBuildL1< hit_typeJBuildL1_t
 
typedef JBuildL2< hit_typeJBuildL2_t
 

Public Member Functions

 JDataFilter (const std::string &name, const std::string &server, const std::string &hostname, JLogger *logger, const int level, const int port, const int backlog, const std::string &path, const std::string &archive)
 Constructor.
 
virtual void actionEnter () override
 Interface methods for actions corresponding to state transitions.
 
virtual void actionExit () override
 
virtual void actionInit (int length, const char *buffer) override
 
virtual void actionConfigure (int length, const char *buffer) override
 
virtual void actionStart (int length, const char *buffer) override
 
virtual void actionPause (int length, const char *buffer) override
 
virtual void actionContinue (int length, const char *buffer) override
 
virtual void actionStop (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 setSelect (JFileDescriptorMask &mask) const override
 Set the file descriptor mask for the select call.
 
virtual void actionSelect (const JFileDescriptorMask &mask) override
 Action method following last select call.
 
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.
 
void updateFrameQueue (const JSocketInputChannel_t &channel)
 Update queue with data frames.
 
void processTimeSlice (const JDAQTimesliceL0 &timeslice)
 Process time slice.
 
void typeout ()
 Report status to message logger.
 
virtual void actionTagged (const JTag &tag, int length, const char *buffer) override
 Tagged action to handle alerts.
 
virtual bool enter (const JArgs &args)
 Enter the state machine.
 
virtual bool enter () override
 Enter the state machine.
 
virtual bool exit () override
 Exit the state machine.
 
bool isRunning () const
 Check if this client is in runnig state.
 
void replaceEvent (const JTag &oldTag, const JTag &newTag, JDAQEvent_t &event)
 Replace tag of given event in event table.
 
JDAQEvent_tfindEvent (const JTag &tag, const std::string &event_name)
 Find event in event table.
 
void addSubscription (const JSubscription &subscription)
 Add custom subscription.
 
template<class T >
void addParameter (const char option, T &parameter)
 Add parameter to parser used in method enter().
 
template<class T >
void addParameter (const char option, T &parameter, const T &value)
 Add parameter to parser used in method enter().
 
void setSelect ()
 Set the file descriptor mask for the select call.
 
virtual void actionInput (int length, const char *buffer) override
 This method is called at ev_input.
 
virtual bool filter (const JTag &tag, int length, const char *buffer)
 Filter message.
 
void run ()
 Run as run control client following command messages via JNET::JControlHost.
 
void run (const int port)
 Run for ever.
 
void run (std::istream &in)
 Run client with commands from input stream (e.g. for debugging).
 
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::string & getName () const
 Get name of state machine.
 
int getDetectorID () const
 Get detector identifier.
 
int getRunNumber () const
 Get run number.
 
virtual void actionError ()
 
virtual void actionRecover (int, const char *)
 
const std::string & getHostname () const
 Get hostname.
 
const std::string & getFullName () const
 Get full name of this run control client.
 
const JTaggetUniqueTag () const
 Get unique tag of this run control client.
 
long long int getClockDelay () const
 Get total delay time.
 
long long int getClockInterval () const
 Get interval time.
 
void setClockInterval (const long long int interval_us)
 Set interval time.
 
void resetClock ()
 Reset clock.
 
const std::string & getEventInfo () const
 Get last event information.
 
void setEventInfo (const std::string &info)
 Set last event information.
 

Static Public Member Functions

static bool compare (const JDAQProcess &first, const JDAQProcess &second)
 Sort DAQ process by index.
 

Public Attributes

JMeta meta
 meta data
 
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 TIMEOUT_S = 1
 time out of update [s]
 

Protected Types

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

Protected Attributes

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

Private Types

typedef JControlHostObjectOutput< JDAQTypes_tJControlHost_t
 

Private Member Functions

template<class T >
void put (const T &object)
 Auxiliary method to send object to data server.
 
void update ()
 Update state machine.
 
void update (const JTag &tag, int length, const char *buffer)
 Update state machine.
 
void configure ()
 Configure client.
 
std::string getMessage (const CHSM::state &state, const CHSM::event &event) const
 Get event message.
 
virtual void enterState (const CHSM::state &state, const CHSM::event &event) override
 Action when entering state.
 
virtual void actionCheck (int length, const char *buffer) override
 This method is called at ev_check and reports a system check by mimicing an enter state action.
 
void execute (action __action, const CHSM::event &__event) override
 The method to execute the action.
 
const CHSM::state * getState () const
 Get current state.
 

Private Attributes

JSinglePointer< JControlHost_tdatawriter
 controlhost of data server (to which data writer should be connected)
 
std::string hostname
 host name of data server
 
int port
 server socket port
 
int backlog
 
JSinglePointer< JServerSocketserversocket
 server for data queue connections
 
JChannelList_t channelList
 connections to data queue
 
JTimer timer
 
JStats Qt
 
JStats Qx
 
std::deque< JDAQTimesliceL0timeslices
 buffer with pending time slice data
 
int current_slice_index
 
size_t frames_per_slice
 
double factor_per_slice
 
int maximal_frame_index
 
std::set< int > modules
 
 dataqueue_slice_index
 
JTriggerParameters parameters
 
JSinglePointer< JTimesliceRoutertimesliceRouter
 
JDetector detector
 
JSinglePointer< JModuleRoutermoduleRouter
 
JSinglePointer< JBuildL1_tbuildL1
 
JSinglePointer< JBuildL2_tbuildL2
 
JSinglePointer< JBuildL2_tbuildSN
 
JSinglePointer< JBuildL2_tbuildNB
 
JSinglePointer< JTriggerNBtriggerNB
 
JSinglePointer< JTrigger3DMuontrigger3DMuon
 
JSinglePointer< JTrigger3DShowertrigger3DShower
 
JSinglePointer< JTriggerMXShowertriggerMXShower
 
JMessageScheduler logErrorRun
 
JMessageScheduler logErrorDetector
 
JMessageScheduler logErrorIndex
 
JMessageScheduler logErrorIncomplete
 
JMessageScheduler logErrorOvercomplete
 
int dumpCount
 
int dumpLimit
 maximum number of time slices to be dumped
 
JStatus dumpMask
 mask for data to be dumped
 
std::vector< JDAQProcessdataFilters
 
std::vector< JDAQProcessdataQueues
 
long long int totalCPURAM
 
size_t maxQueueDepth
 
long long int maxQueueSize
 
long long int queueSize
 
bool reporting
 
long long int numberOfEvents
 
long long int numberOfBytes
 
long long int numberOfTimeslicesProcessed
 
long long int numberOfIncompleteTimeslicesProcessed
 
int minFrameNumber
 
int maxFrameNumber
 
long long int number_of_packets_received
 
long long int number_of_packets_discarded
 
long long int number_of_reads
 
long long int number_of_bytes_received
 
JCircularBuffer_t c_buffer
 
JSelectReader select
 select call
 
JParser parser
 parser method enter()
 
JSubscriptionList subscription
 custom subscription
 
CHSM_ns_alias::state * state_ [11]
 
CHSM_ns_alias::event const * taken_ [14]
 
CHSM_ns_alias::state * target_ [14]
 

Static Private Attributes

static int const ev_daq_transitions []
 
static int const ev_init_transitions []
 
static int const ev_configure_transitions []
 
static int const ev_start_transitions []
 
static int const ev_pause_transitions []
 
static int const ev_continue_transitions []
 
static int const ev_stop_transitions []
 
static int const ev_reset_transitions []
 
static int const ev_quit_transitions []
 
static int const ev_off_transitions []
 
static int const ev_check_transitions []
 
static int const ev_input_transitions []
 
static int const ev_recover_transitions []
 
static int const ev_error_transitions []
 
static CHSM_ns_alias::transition const transition_ []
 

Detailed Description

Main class for real-time filtering of data.

This class implements the action methods for each transition of the state machine.
When the state machine is entered, data are continually collected using custom implementation of virtual methods JDataFilter::setSelect and JDataFilter::actionSelect.

In state Running, all incoming data from the DataQueue.cc are buffered, referred to as "queue".
These data are formatted as a JDAQSuperFrame and aggregated into a JDAQTimeslice.
When a JDAQTimeslice is complete, it processed in the same way as applications JTriggerProcessor.cc and JTriggerEfficiency.cc.

The completeness of a time slice is defined by two parameters, namely
frames_per_slice and factor_per_slice.
These are parsed in method actionConfigure as follows.

  numberOfFramesPerSlice = <frames per slice> = 1;
  factorOfFramesPerSlice = <factor per slice> = 1.0;

The expected number of frames in a time slices is defined by their product.
Note that the first parameter can change during operation (see below).

A timeout may occur when the total amount of data or the number of incomplete time slices in the queue exceeds one of the limits queueSize or queueDepth.
These are parsed in method actionConfigure as follows.

  queueSize  = <maximal queue size [B]>;
  queueDepth = <maximal queue depth>;

Note that these values apply per JDataFilter.
The parameter frames_per_slice is subject to a servo mechanism.
When a timeout occurs, it is set to the number of frames in the oldest time slice.
When data are received with a frame index below the current frame index, it is incremented by one.

In addition, a circular buffer based on a ROOT TTree for each JDAQTimeslice type can be maintained.
The following parameters can be used to configure the circular buffer.

  path     = <write directory for temporary circular buffer>;
  archive  = <write directory for archival of circular buffer>;
  c_sizeL0 = <L0 buffer size>;
  c_sizeL1 = <L1 buffer size>;
  c_sizeL2 = <L2 buffer size>;
  c_sizeSN = <SN buffer size>;

Note that when one (or more) of the buffer sizes is non-zero and the path corresponds to a valid directory:

  • There will always be a file created which is deleted when the state machine is exited;
  • The temporary file name is <path>/KM3NeT_<tag>.root;
  • Following an alert, the temporary file is archived to a file with name <path>/KM3NeT_YYYY-MM-DD_<tag>[_<index>].root;
  • After archival of the temporary file, a new temporary file will be opened;
  • L0, L1, L2 and SN buffer sizes are per JDataFilter;
  • The tag KM3NETDAQ::RC_ALERT defined in JDAQTags.hh has tentatively been reserved to trigger the archival of the temporary file following an external alert;

In this, YYYY, MM and DD correspond to the year, month and day at the time of the alert, respectively.
The <tag> corresponds to the unique JNET::JTag of the JDataFilter process.
The <index> is optional and will only be used to prevent overwriting of an existing file (e.g. when there is more than one alert on a given day).

Data can be discarded for various reasons.
The list of criteria includes validity ranges of the PMT number and TDC values as well as the sorted times per PMT.
The discarded data can be written to disk according to the parameters:

    dumpLimit = <maximum number of time slices to be dumped>
    dumpMask =  <mask for data to be dumped>

The first limits the number of time slices with discarded data that will be dumped and
the latter corresponds to bits according to the enumeration JChecksum::error_types.
The discarded data will be stored as JDAQTimeslice.

Note that the application JConvert.cc can be used to readily convert multiple input files to a single output file.

The script $JPP_DIR/tests/JDataFilter/JDataFilter.sh can be used to test this application.

Definition at line 195 of file JDataFilter.cc.

Member Typedef Documentation

◆ JSocketInputChannel_t

◆ JChannelList_t

◆ hit_type

Definition at line 203 of file JDataFilter.cc.

◆ JSuperFrame1D_t

◆ JSuperFrame2D_t

◆ JTimeslice_t

◆ JBuildL1_t

◆ JBuildL2_t

◆ JControlHost_t

◆ action

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

Type definition of action method.

Definition at line 152 of file JDAQCHSM.hh.

Constructor & Destructor Documentation

◆ JDataFilter()

KM3NETDAQ::JDataFilter::JDataFilter ( const std::string & name,
const std::string & server,
const std::string & hostname,
JLogger * logger,
const int level,
const int port,
const int backlog,
const std::string & path,
const std::string & archive )
inline

Constructor.

Parameters
namename of client
servername of command message server
hostnamename of data server
loggerpointer to logger
leveldebug level
portserver port
backlogserver backlog
pathdirectory for temporary storage
archivedirectory for parmanent archival

replace tag to receive dfilter specific messages in configure

Definition at line 408 of file JDataFilter.cc.

416 :
419 port (port),
421 c_buffer (path, archive, getUniqueTag())
422 {
423 replaceEvent(RC_CMD, RC_DFILTER, ev_configure); /// replace tag to receive dfilter specific messages in configure
424
426
427 totalCPURAM = getRAM();
429 dataqueue_slice_index.clear();
430 reporting = false;
431
432 this->server->setReceiveBufferSize(DFILTER_RECEIVE_BUFFER_SIZE);
433 }
std::string name
Definition JDAQCHSM.hh:165
JDAQStateMachine::ev_configure_event ev_configure
JSharedPointer< JControlHost > server
message server
void replaceEvent(const JTag &oldTag, const JTag &newTag, JDAQEvent_t &event)
Replace tag of given event in event table.
JMessageLogger logger
message logger
JDAQClient(const std::string &name, const std::string &server, JLogger *logger, const int level)
Constructor.
void addSubscription(const JSubscription &subscription)
Add custom subscription.
JCircularBuffer_t c_buffer
int port
server socket port
long long int totalCPURAM
std::string hostname
host name of data server
unsigned long long int getRAM()
Get RAM of this CPU.
static const JNET::JTag RC_DFILTER
Definition JDAQTags.hh:73
static const JNET::JTag RC_ALERT
Definition JDAQTags.hh:79
static const int DFILTER_RECEIVE_BUFFER_SIZE
socket JDataFilter.cc <- JLigier.cc
Definition JDAQTags.hh:37
static const JNET::JTag RC_CMD
Definition JDAQTags.hh:66
Auxiliary class for all subscription.
const JTag & getUniqueTag() const
Get unique tag of this run control client.

Member Function Documentation

◆ compare()

static bool KM3NETDAQ::JDataFilter::compare ( const JDAQProcess & first,
const JDAQProcess & second )
inlinestatic

Sort DAQ process by index.

Parameters
firstfirst DAQ process
secondsecond DAQ process
Returns
true if index of first DAQ process less than that of second; else false

Definition at line 389 of file JDataFilter.cc.

390 {
391 return first.index < second.index;
392 }
std::string index
index in process list

◆ actionEnter()

virtual void KM3NETDAQ::JDataFilter::actionEnter ( )
inlineoverridevirtual

Interface methods for actions corresponding to state transitions.

Reimplemented from JDAQCHSM.

Definition at line 436 of file JDataFilter.cc.

437 {}

◆ actionExit()

virtual void KM3NETDAQ::JDataFilter::actionExit ( )
inlineoverridevirtual

Reimplemented from JDAQCHSM.

Definition at line 440 of file JDataFilter.cc.

441 {
442 if (c_buffer.is_open()) {
443
444 JStatusStream(logger) << "Close and remove circular buffer " << c_buffer;
445
446 c_buffer.close(false);
447 }
448
449 datawriter.reset();
450 }
virtual bool is_open() const override
Check is file is open.
Definition JRootFile.hh:77
JSinglePointer< JControlHost_t > datawriter
controlhost of data server (to which data writer should be connected)
void close(const bool option)
Close file.

◆ actionInit()

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

Reimplemented from JDAQCHSM.

Definition at line 453 of file JDataFilter.cc.

454 {
455 JDebugStream(logger) << "actionInit() " << std::string(buffer,length);
456
457 try {
458
459 JDebugStream(logger) << "Start server.";
460
461 if (serversocket.is_valid()) {
462 serversocket->shutdown();
463 }
464
466 }
467 catch(const std::exception& error) {
468 JErrorStream(logger) << "Error \"" << error.what() << "\"; trigger ev_error.";
469 ev_error();
470 }
471 }
JDAQStateMachine::ev_error_event ev_error
TCP server socket.
JSinglePointer< JServerSocket > serversocket
server for data queue connections
Level specific message streamers.

◆ actionConfigure()

virtual void KM3NETDAQ::JDataFilter::actionConfigure ( int length,
const char * buffer )
inlineoverridevirtual

Reimplemented from JDAQCHSM.

Definition at line 474 of file JDataFilter.cc.

475 {
476 using namespace std;
477
478 JDebugStream(logger) << "actionConfigure() " << endl << std::string(buffer,length);
479
480 string _hostname_ = "";
481
482 long long int update_s = 20;
483 long long int logger_s = 10;
484
485 parameters .reset();
486 dataFilters.clear();
487 dataQueues .clear();
488
489 reporting = false;
490 dumpCount = 0;
491 dumpLimit = numeric_limits<int>::max();
492 dumpMask = 0;
496 //dumpMask.set(JChecksum::EUDP_t);
498
499 detector.comment.clear();
500 detector.clear();
501
502 JProperties properties(JEquationParameters("=", ";", "", ""), 0);
503
504 properties["dataWriter"] = _hostname_;
505 properties["numberOfFramesPerSlice"] = frames_per_slice = 1;
506 properties["factorOfFramesPerSlice"] = factor_per_slice = 1.0;
507 properties["detector"] = detector;
508 properties["triggerParameters"] = parameters;
509 properties["queueSize"] = maxQueueSize = (totalCPURAM - GIGABYTE); // leave 1 GB left ...
510 properties["queueDepth"] = maxQueueDepth = 20; // to be optimized
511 properties["frameIndex"] = maximal_frame_index = 100000;
512 properties["logger_s"] = logger_s;
513 properties["update_s"] = update_s;
514 properties["JDataFilter"] = dataFilters;
515 properties["DataQueue"] = dataQueues;
516 properties["path"] = c_buffer.path;
517 properties["archive"] = c_buffer.archive;
518 properties["c_sizeL0"] = c_buffer.sizeL0;
519 properties["c_sizeL1"] = c_buffer.sizeL1;
520 properties["c_sizeL2"] = c_buffer.sizeL2;
521 properties["c_sizeSN"] = c_buffer.sizeSN;
522 properties["dumpLimit"] = dumpLimit;
523 properties["dumpMask"] = dumpMask;
524
525 try {
526 properties.read(string(buffer, length));
527 }
528 catch(const std::exception& error) {
529 JErrorStream(logger) << error.what();
530 }
531
532 if (update_s <= 0) { update_s = 20; }
533 if (logger_s <= 0) { logger_s = 10; }
534
535 setClockInterval(update_s * 1000000LL);
536
537 _hostname_ = trim(_hostname_);
538
539 if (_hostname_ != "" && _hostname_ != hostname) {
540
541 datawriter.reset();
542
543 hostname = _hostname_;
544 }
545
546 bool status = datawriter.is_valid();
547
548 if (status) {
549
550 try {
551 status = datawriter->Connected() == 0;
552 }
553 catch (const exception&) {
554 status = false;
555 }
556 }
557
558 if (!status) {
559
561
562 datawriter->MyId(getFullName());
563 }
564
565 datawriter->setSendBufferSize(DFILTER_SEND_BUFFER_SIZE);
566
567 // process processlist
568
569 if (dataFilters.empty()) {
570 JNoticeStream(logger) << "No DataFilters in process list, or no process list. "
571 << "Assuming that this process is the only process on this CPU and setting parameters accordingly.";
572 }
573
574 sort(dataFilters.begin(), dataFilters.end(), compare);
575
576 unsigned int numberOfDataFiltersOnThisMachine = 0;
577 vector<JDAQProcess>::iterator thisProcess = dataFilters.end();
578
580
581 for (vector<JDAQProcess>::iterator i = dataFilters.begin(); i != dataFilters.end(); ++i) {
582
583 if (find(IP.begin(), IP.end(), i->hostname) != IP.end()) {
584
585 numberOfDataFiltersOnThisMachine++;
586
587 if (i->port == this->port) {
588 thisProcess = i;
589 }
590 }
591 }
592
593 if (numberOfDataFiltersOnThisMachine == 0) {
594 JNoticeStream(logger) << "Zero data filters on this machine according to process list (if it exists). "
595 << "Assuming one datafilter on this machine.";
596 numberOfDataFiltersOnThisMachine = 1;
597 }
598
599 if (thisProcess == dataFilters.end()) {
600
601 JErrorStream error(logger);
602
603 error << "This process cannot be found in the process list. Why do I exist?";
604 error << " my IP addresses:";
605
606 for (vector<string>::const_iterator i = IP.begin(); i != IP.end(); ++i) {
607 error << ' ' << *i;
608 }
609
610 error << " my port: " << this->port;
611 error << " process list";
612
613 for (vector<JDAQProcess>::iterator i = dataFilters.begin(); i != dataFilters.end(); ++i) {
614 error << ' ' << i->hostname << ':' << i->port;
615 }
616 }
617
618 if (thisProcess != dataFilters.end() && thisProcess->index != getName()) {
619 JErrorStream(logger) << "Mismatch between given process names: "
620 << "I am called " << getName()
621 << ", but in the process list I am referred to as " << thisProcess->index;
622 }
623
624 if (dataFilters.begin() == thisProcess || dataFilters.empty()) { // set reporting
625 reporting = true;
626 }
627
628 if (maxQueueSize > (totalCPURAM-GIGABYTE)/(numberOfDataFiltersOnThisMachine)) { // check maximum size of queue
629
630 maxQueueSize = (totalCPURAM-GIGABYTE)/(numberOfDataFiltersOnThisMachine);
631
632 JNoticeStream(logger) << "Maximum queue size is too large given the number of processes on this machine. "
633 << "Queue size reduced to "
634 << maxQueueSize << " bytes." ;
635 }
636
637 // detector
638
639 if (parameters.disableHighRateVeto) {
640
641 JNoticeStream(logger) << "Disabling high-rate veto of all PMTs.";
642
643 detector.setPMTStatus(HIGH_RATE_VETO_DISABLE);
644 }
645
646 // trigger parameters
647
649
650 triggerNB .reset(new JTriggerNB (parameters));
654
656
657 if (reporting) {
658 JNoticeStream(logger) << "This data filter process will report.";
659 JNoticeStream(logger) << "Detector version/size " << detector.getVersion() << '/' << detector.size();
660 JDebugStream (logger) << "Trigger parameters: " << parameters;
661 JDebugStream (logger) << "Detector description: " << endl << detector;
662 JNoticeStream(logger) << "Update period [s]: " << getClockInterval();
663 }
664
665 timesliceRouter.reset(new JTimesliceRouter(parameters.numberOfBins));
666
667 // set L1, L2 and SN builders
668
669 buildL1.reset(new JBuildL1_t(parameters));
670 buildL2.reset(new JBuildL2_t(parameters.L2));
671 buildSN.reset(new JBuildL2_t(parameters.SN));
672 buildNB.reset(new JBuildL2_t(parameters.NB));
673
674 if (buildL1.get() == NULL) { JErrorStream(logger) << "Failed to allocate buildL1."; }
675 if (buildL2.get() == NULL) { JErrorStream(logger) << "Failed to allocate buildL2."; }
676 if (buildSN.get() == NULL) { JErrorStream(logger) << "Failed to allocate buildSN."; }
677 if (buildNB.get() == NULL) { JErrorStream(logger) << "Failed to allocate buildSN."; }
678
679 logErrorRun = JMessageScheduler(logger, JTimekeeper(logger_s * 1000000LL));
680 logErrorDetector = JMessageScheduler(logger, JTimekeeper(logger_s * 1000000LL));
681 logErrorIndex = JMessageScheduler(logger, JTimekeeper(logger_s * 1000000LL));
682 logErrorIncomplete = JMessageScheduler(logger, JTimekeeper(logger_s * 1000000LL));
684
685 if (c_buffer.is_enabled()) {
686
687 if (!c_buffer.is_open()) {
688
689 c_buffer.open();
690
691 if (c_buffer.is_open()) {
692
694
695 JStatusStream(logger) << "Created circular buffer " << c_buffer;
696
697 } else {
698
699 JErrorStream (logger) << "Failed to create circular buffer in directory <" << c_buffer.path << ">; disable functionality.";
700 }
701
702 } else {
703
704 JNoticeStream(logger) << "Continue using circular buffer " << c_buffer;
705 }
706 }
707
708 if (c_buffer.is_open()) {
709 if (c_buffer.sizeL0 > 0) { static_cast<JTreeWriterObjectOutput<JDAQTimesliceL0>&>(c_buffer).SetCircular(c_buffer.sizeL0); }
710 if (c_buffer.sizeL1 > 0) { static_cast<JTreeWriterObjectOutput<JDAQTimesliceL1>&>(c_buffer).SetCircular(c_buffer.sizeL1); }
711 if (c_buffer.sizeL2 > 0) { static_cast<JTreeWriterObjectOutput<JDAQTimesliceL2>&>(c_buffer).SetCircular(c_buffer.sizeL2); }
712 if (c_buffer.sizeSN > 0) { static_cast<JTreeWriterObjectOutput<JDAQTimesliceSN>&>(c_buffer).SetCircular(c_buffer.sizeSN); }
713 } else {
715 }
716 }
Router for direct addressing of module data in detector data structure.
Utility class to parse parameter values.
Time keeper.
Simple data structure to support I/O of equations (see class JLANG::JEquation).
Message logger with time scheduler.
TFile * getFile() const
Get file.
Definition JRootFile.hh:66
Nano-beacon trigger.
Definition JTriggerNB.hh:21
JMessageScheduler logErrorRun
int dumpLimit
maximum number of time slices to be dumped
JMessageScheduler logErrorDetector
JMessageScheduler logErrorIndex
static bool compare(const JDAQProcess &first, const JDAQProcess &second)
Sort DAQ process by index.
long long int maxQueueSize
std::vector< JDAQProcess > dataQueues
JMessageScheduler logErrorOvercomplete
JSinglePointer< JBuildL2_t > buildNB
JSinglePointer< JBuildL2_t > buildL2
JBuildL1< hit_type > JBuildL1_t
JSinglePointer< JBuildL1_t > buildL1
JSinglePointer< JTrigger3DMuon > trigger3DMuon
JMessageScheduler logErrorIncomplete
JStatus dumpMask
mask for data to be dumped
JSinglePointer< JModuleRouter > moduleRouter
JSinglePointer< JTimesliceRouter > timesliceRouter
JControlHostObjectOutput< JDAQTypes_t > JControlHost_t
JSinglePointer< JTriggerNB > triggerNB
JBuildL2< hit_type > JBuildL2_t
std::vector< JDAQProcess > dataFilters
JSinglePointer< JTrigger3DShower > trigger3DShower
JSinglePointer< JTriggerMXShower > triggerMXShower
JSinglePointer< JBuildL2_t > buildSN
JTriggerParameters parameters
double getMaximalDistance(const JDetector &detector, const bool option=false)
Get maximal distance between modules in detector.
std::string trim(const std::string &buffer)
Trim string.
static const long long int GIGABYTE
Number of bytes in a mega-byte.
bool putObject(TDirectory &dir, const TObject &object)
Write object to ROOT directory.
const char * getName()
Get ROOT name of given data type.
std::vector< std::string > getListOfIPaddresses()
Get list of IP address (decimal-dot notation).
Definition JNetwork.hh:216
static const int DFILTER_SEND_BUFFER_SIZE
socket JDataFilter.cc -> JDataWriter.cc
Definition JDAQTags.hh:38
static const int HIGH_RATE_VETO_DISABLE
Enable (disable) use of high-rate veto test if this status bit is 0 (1);.
Definition pmt_status.hh:13
Detector file.
Definition JHead.hh:227
void set(const int bit)
Set PMT status.
Definition JStatus.hh:131
@ ETDC_t
TDC value error.
Definition JChecksum.hh:47
@ SIZE_t
size error
Definition JChecksum.hh:50
@ EPMT_t
PMT number error.
Definition JChecksum.hh:46
@ TIME_t
Time order error.
Definition JChecksum.hh:48
Router for fast addressing of hits in KM3NETDAQ::JDAQTimeslice data structure as a function of the op...
const std::string & getFullName() const
Get full name of this run control client.
void setClockInterval(const long long int interval_us)
Set interval time.
long long int getClockInterval() const
Get interval time.
std::string archive
Directory for permanent archival.
std::string path
Directory for temporary storage.
Long64_t sizeL1
Number of L1 time slices.
Long64_t sizeSN
Number of SN time slices.
Long64_t sizeL0
Number of L0 time slices.
Long64_t sizeL2
Number of L2 time slices.
bool is_enabled() const
Check whether writing of data is enabled.

◆ actionStart()

virtual void KM3NETDAQ::JDataFilter::actionStart ( int length,
const char * buffer )
inlineoverridevirtual

Reimplemented from JDAQCHSM.

Definition at line 719 of file JDataFilter.cc.

720 {
721 using namespace std;
722
723 if (reporting) {
724 JNoticeStream(logger) << "Start run " << getRunNumber();
725 }
726
727 timeslices.clear();
728
730 dataqueue_slice_index.clear();
731 queueSize = 0;
732
733 numberOfEvents = 0;
734 numberOfBytes = 0;
737
741 number_of_reads = 0;
742
743 minFrameNumber = numeric_limits<int>::max();
744 maxFrameNumber = numeric_limits<int>::min();
745
746 // Reset global trigger counter.
747
749
755
756 timer.reset();
757 timer.start();
758
759 Qt.reset();
760 Qx.reset();
761
762 // send trigger parameters to the datawriter
763
764 ostringstream os;
765
766 os << getRunNumber() << ' ' << parameters;
767
768 datawriter->PutFullString(IO_TRIGGER_PARAMETERS, os.str());
769 }
int getRunNumber() const
Get run number.
Definition JDAQCHSM.hh:111
void reset()
Reset timer.
Definition JTimer.hh:93
void start()
Start timer.
Definition JTimer.hh:106
static void reset()
Reset counter of unique instance of this class object.
long long int number_of_packets_received
long long int numberOfBytes
long long int number_of_packets_discarded
long long int number_of_bytes_received
std::deque< JDAQTimesliceL0 > timeslices
buffer with pending time slice data
long long int number_of_reads
long long int numberOfTimeslicesProcessed
long long int numberOfIncompleteTimeslicesProcessed
long long int numberOfEvents
static const JNET::JTag IO_TRIGGER_PARAMETERS
Definition JDAQTags.hh:90
void reset()
Reset.
Definition JStats.hh:79

◆ actionPause()

virtual void KM3NETDAQ::JDataFilter::actionPause ( int length,
const char * buffer )
inlineoverridevirtual

Reimplemented from JDAQCHSM.

Definition at line 772 of file JDataFilter.cc.

773 {
774 using namespace std;
775
776 if (!timeslices.empty()) {
777
778 JNoticeStream(logger) << "Flushing " << timeslices.size() << " slices.";
779
780 for (deque<JDAQTimesliceL0>::const_iterator i = timeslices.begin(); i != timeslices.end(); ++i) {
781 queueSize -= getSizeof(*i);
782 }
783
784 timeslices.clear();
785 }
786
787 { // force clearance of memory
788
789 deque<JDAQTimesliceL0> buffer;
790
791 timeslices.swap(buffer);
792 }
793
794 if (queueSize != 0) {
795 JWarningStream(logger) << "Pending data in queue " << queueSize << " [B]";
796 }
797
799 dataqueue_slice_index.clear();
800 queueSize = 0;
801
802 timer.stop();
803 }
void stop()
Stop timer.
Definition JTimer.hh:127
size_t getSizeof()
Definition of method to get size of data type.

◆ actionContinue()

virtual void KM3NETDAQ::JDataFilter::actionContinue ( int length,
const char * buffer )
inlineoverridevirtual

Reimplemented from JDAQCHSM.

Definition at line 806 of file JDataFilter.cc.

807 {
808 timer.start();
809 }

◆ actionStop()

virtual void KM3NETDAQ::JDataFilter::actionStop ( int length,
const char * buffer )
inlineoverridevirtual

Reimplemented from JDAQCHSM.

Definition at line 812 of file JDataFilter.cc.

813 {
814 typeout();
815 }
void typeout()
Report status to message logger.

◆ actionReset()

virtual void KM3NETDAQ::JDataFilter::actionReset ( int length,
const char * buffer )
inlineoverridevirtual

Reimplemented from JDAQCHSM.

Definition at line 818 of file JDataFilter.cc.

819 {
820 if (serversocket.is_valid()) {
821 serversocket->shutdown();
822 }
823
824 serversocket.reset();
825 }

◆ actionQuit()

virtual void KM3NETDAQ::JDataFilter::actionQuit ( int length,
const char * buffer )
inlineoverridevirtual

Reimplemented from JDAQCHSM.

Definition at line 828 of file JDataFilter.cc.

829 {
830 datawriter.reset();
831 }

◆ setSelect() [1/2]

virtual void KM3NETDAQ::JDataFilter::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 834 of file JDataFilter.cc.

835 {
836 if (serversocket.is_valid()) {
837 mask.set(*serversocket);
838 }
839
840 for (JChannelList_t::const_iterator channel = channelList.begin(); channel != channelList.end(); ++channel) {
841 if (!channel->isReady()) {
842 mask.set(channel->getFileDescriptor());
843 }
844 }
845 }
void set(const int file_descriptor)
Set file descriptor.
JChannelList_t channelList
connections to data queue

◆ actionSelect()

virtual void KM3NETDAQ::JDataFilter::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 848 of file JDataFilter.cc.

849 {
850 using namespace std;
851
852 for (JChannelList_t::iterator channel = channelList.begin(); channel != channelList.end(); ) {
853
854 try {
855
856 if (mask.has(channel->getFileDescriptor())) {
857 channel->read();
858 }
859
860 if (channel->isReady()) {
861
863 number_of_reads += channel->getCounter();
864 number_of_bytes_received += channel->size();
865
866 if (isRunning()) {
867
868 try {
869 updateFrameQueue(*channel);
870 }
871 catch(const std::exception& error) {
872
873 JErrorStream(logErrorRun) << "Update frame queue " << channel->getFileDescriptor() << ' ' << channel->size() << ' ' << error.what();
874
876 }
877
878 } else {
879
880 JErrorStream(logErrorRun) << "Receiving data while not running.";
881
883 }
884
885 channel->reset();
886 }
887
888 ++channel;
889 }
890 catch(const std::exception& error) {
891
892 if (isRunning()) {
893 JErrorStream(logger) << "Disconnect channel " << channel->getFileDescriptor() << ' ' << error.what();
894 }
895
896 channel->shutdown();
897
898 channel = channelList.erase(channel);
899 }
900 }
901
902
903 if (serversocket.is_valid()) {
904
905 if (mask.has(*serversocket)) {
906
907 JTCPSocket socket(serversocket->getFileDescriptor());
908
909 socket.setReceiveBufferSize(DFILTER_DQUEUE_BUFFER_SIZE);
910
911 socket.setKeepAlive (true);
912 socket.setNonBlocking(false);
913
914 JStatusStream(logger) << "New channel" << '[' << socket.getFileDescriptor() << ']' << ' ' << socket.getReceiveBufferSize();
915
916 channelList.push_back(JSocketInputChannel_t(socket));
917 }
918 }
919
920
921 if (!timeslices.empty()) {
922
923 const size_t number_of_frames = getNumberOfFrames(frames_per_slice, factor_per_slice);
924 const size_t maximum_in_queue = getMaximum(make_array(next(timeslices.begin()), timeslices.end(), &JDAQTimesliceL0::size), (size_t) 0);
925
926 if (((timeslices[0].size() >= number_of_frames && // normal
927 timeslices[0].getFrameIndex() < dataqueue_slice_index.min()) ||
928
929 (maximum_in_queue >= number_of_frames && // intermittent problem
930 timeslices[0].getFrameIndex() < dataqueue_slice_index.min()) ||
931
932 (timeslices.size() >= maxQueueDepth) || // timeout
933 (queueSize >= maxQueueSize))) {
934
935
936 const JDAQTimesliceL0& pending_slice = timeslices.front();
937 queueSize -= getSizeof(pending_slice);
938
939 current_slice_index = pending_slice.getFrameIndex();
940 minFrameNumber = min(minFrameNumber, pending_slice.getFrameIndex());
941 maxFrameNumber = max(maxFrameNumber, pending_slice.getFrameIndex());
942
943 for (JDAQTimesliceL0::const_iterator i = pending_slice.begin(); i != pending_slice.end(); ++i) {
944 modules.insert(i->getModuleID());
945 }
946
947
948 if (isRunning()) {
949
950 const localtime_t t0 = getLocalTime();
951
952 if (!pending_slice.empty()) {
953 processTimeSlice(pending_slice);
954 }
955
956 const localtime_t t1 = getLocalTime();
957
959
960 Qt.put(t1 - t0);
961
962 } else {
963
964 JErrorStream(logErrorRun) << "Skip processing of data while not running.";
965 }
966
967
968 if (modules.size() > frames_per_slice) {
969
970 JErrorStream(logErrorOvercomplete) << "More active modules than expected "
971 << modules.size() << " > " << frames_per_slice
972 << " adjusting frames per slice to " << modules.size();
973
974 frames_per_slice = modules.size();
975 }
976
977
978 if (pending_slice.size() < number_of_frames) {
979
981
982 ostringstream error;
983
984 error << "Timeout -> processed incomplete timeslice: "
985 << "Frame index = " << pending_slice.getFrameIndex() << ';'
986 << "Size of timeslice = " << pending_slice.size() << ';'
987 << "Queue depth = " << timeslices.size() << ';'
988 << "Queue size = " << queueSize << ';'
989 << "DataQueue min = " << dataqueue_slice_index.min() << ';'
990 << "DataQueue max = " << dataqueue_slice_index.max() << ';';
991
992 if (maximum_in_queue >= number_of_frames) {
993
994 error << " intermittent problem -> continues as-is";
995
996 } else {
997
998 modules.clear(); // remove history
999
1000 for (JDAQTimesliceL0::const_iterator i = pending_slice.begin(); i != pending_slice.end(); ++i) {
1001 modules.insert(i->getModuleID());
1002 }
1003
1004 error << " adjusting frames per timeslice from " << frames_per_slice << " to " << modules.size();
1005
1006 frames_per_slice = modules.size();
1007 }
1008
1009 JErrorStream(logErrorIncomplete) << error.str();
1010 }
1011
1012
1013 timeslices.pop_front();
1014 }
1015 }
1016 }
bool has(const int file_descriptor) const
Has file descriptor.
TCP socket.
Definition JTCPSocket.hh:30
int getFrameIndex() const
Get frame index.
bool isRunning() const
Check if this client is in runnig state.
JSocketInputChannel< JDAQAbstractPreamble > JSocketInputChannel_t
void processTimeSlice(const JDAQTimesliceL0 &timeslice)
Process time slice.
void updateFrameQueue(const JSocketInputChannel_t &channel)
Update queue with data frames.
std::set< int > modules
const array_type< JValue_t > & make_array(const JValue_t(&array)[N])
Method to create array of values.
Definition JVectorize.hh:54
T getMaximum(const array_type< T > &buffer, const T value)
Get maximum of values.
static const JLocalTime getLocalTime
Function object to get local time in micro seconds.
long long int localtime_t
Type definition of local time.
size_t getNumberOfFrames(const size_t number_of_frames, const double factor)
Get expected number of frames according a given allowed fraction of active modules.
static const int DFILTER_DQUEUE_BUFFER_SIZE
socket JDataFilter.cc <- DataQueue.cc
Definition JDAQTags.hh:36
void put(const double x, const double w=1.0)
Put value.
Definition JStats.hh:119
Timeslice data structure for L0 data.

◆ actionRunning()

virtual void KM3NETDAQ::JDataFilter::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 1019 of file JDataFilter.cc.

1020 {
1021 if (reporting) {
1022 typeout();
1023 }
1024 }

◆ updateFrameQueue()

void KM3NETDAQ::JDataFilter::updateFrameQueue ( const JSocketInputChannel_t & channel)
inline

Update queue with data frames.

Note that any discarded data will be reported.

Parameters
channelincoming data channel

Definition at line 1034 of file JDataFilter.cc.

1035 {
1036 using namespace std;
1037
1038 JByteArrayReader in(channel.data(), channel.size());
1039
1040 JDAQPreamble preamble;
1041 JDAQSuperFrameHeader header;
1042
1043 in >> preamble;
1044 in >> header;
1045
1046 if (preamble.getLength() != channel.size()) {
1047
1048 JErrorStream(logErrorRun) << "Size of received data does not match size reported by preamble: "
1049 << "preamble.getLength() = " << preamble.getLength() << ';'
1050 << "channel.size(): " << channel.size() << ';';
1051
1053
1054 return;
1055 }
1056
1057 if (header.getRunNumber() != getRunNumber()) {
1058
1059 JErrorStream(logErrorRun) << "Run number " << header.getRunNumber()
1060 << " != " << getRunNumber()
1061 << " -> Dropping frame.";
1062
1064
1065 return;
1066 }
1067
1068 if (header.getFrameIndex() <= current_slice_index) {
1069
1071
1072 if (modules.insert(header.getModuleID()).second) {
1073
1074 frames_per_slice = modules.size();
1075
1076 JErrorStream(logErrorIndex) << "Frame index " << header.getFrameIndex() << " <= " << current_slice_index
1077 << " module " << header.getModuleID()
1078 << " -> dropping frame;"
1079 << " increase number of frames expected to: " << frames_per_slice;
1080 }
1081
1082 return;
1083 }
1084
1086
1088
1089 JErrorStream(logErrorIndex) << "Frame index " << header.getFrameIndex() << " > " << current_slice_index + maximal_frame_index
1090 << " module " << header.getModuleID()
1091 << " -> Dropping frame.";
1092
1093 return;
1094 }
1095
1096 deque<JDAQTimesliceL0>::iterator timesliceIterator = timeslices.begin();
1097
1098 while (timesliceIterator != timeslices.end() && timesliceIterator->getFrameIndex() < header.getFrameIndex()) {
1099 ++timesliceIterator;
1100 }
1101
1102 if (timesliceIterator != timeslices.end() && timesliceIterator->getFrameIndex() == header.getFrameIndex()) {
1103
1104 // The corresponding time slice already exists
1105
1106 } else {
1107
1108 // This is the first frame of this time slice; insert a new time slice in the buffer at the right position in the list
1109
1110 timesliceIterator = timeslices.insert(timesliceIterator, JDAQTimesliceL0());
1111
1112 timesliceIterator->setDAQChronometer(header.getDAQChronometer());
1113
1114 queueSize += getSizeof(*timesliceIterator);
1115 }
1116
1117 timesliceIterator->push_back(JDAQSuperFrame(header));
1118
1119 in >> static_cast<JDAQFrame&>(*(timesliceIterator->rbegin()));
1120
1121 queueSize += getSizeof(*timesliceIterator->rbegin());
1122
1124 }
Byte array binary input.
const char * data() const
Get data.
int size() const
Get size.
int getFileDescriptor() const
Get file descriptor.
const JDAQChronometer & getDAQChronometer() const
Get DAQ chronometer.
int getRunNumber() const
Get run number.
int getModuleID() const
Get module identifier.
Data frame of one optical module.

◆ processTimeSlice()

void KM3NETDAQ::JDataFilter::processTimeSlice ( const JDAQTimesliceL0 & timeslice)
inline

Process time slice.

Parameters
timeslicetime slice

Definition at line 1132 of file JDataFilter.cc.

1133 {
1134 using namespace std;
1135
1136 try {
1137
1138 timesliceRouter->configure(timeslice);
1139
1140 if (parameters.writeSummary()) {
1141 this->put(JDAQSummaryslice(timeslice));
1142 }
1143
1144 if (parameters.trigger3DMuon.enabled ||
1145 parameters.trigger3DShower.enabled ||
1146 parameters.triggerMXShower.enabled ||
1147 parameters.triggerNB.enabled ||
1148 parameters.writeL0.prescale ||
1149 parameters.writeL1.prescale ||
1150 parameters.writeL2.prescale ||
1151 parameters.writeSN.prescale ||
1152 c_buffer.is_enabled()) {
1153
1154 JTimeslice_t timesliceL0(timeslice.getDAQChronometer());
1155 JTimeslice_t timesliceL1(timeslice.getDAQChronometer());
1156 JTimeslice_t timesliceL2(timeslice.getDAQChronometer());
1157 JTimeslice_t timesliceSN(timeslice.getDAQChronometer());
1158 JTimeslice_t timesliceNB(timeslice.getDAQChronometer());
1159 JDAQTimeslice timesliceTX(timeslice.getDAQChronometer());
1160
1161 for (JDAQTimesliceL0::const_iterator frame = timeslice.begin(); frame != timeslice.end(); ++frame) {
1162
1163 if (moduleRouter->hasModule(frame->getModuleID())) {
1164
1165 const JChecksum::result_type& result = checksum(*frame);
1166
1167 if (!result) {
1168
1169 JWarningStream(logger) << "Invalid data at "
1170 << "run = " << timeslice.getRunNumber() << ";"
1171 << "frame index = " << timeslice.getFrameIndex() << ";"
1172 << "module = " << frame->getModuleID() << ";"
1173 << "discard" << (dumpCount < dumpLimit ? " and dump" : "");
1174
1175 if (dumpCount < dumpLimit && result.has(dumpMask)) {
1176 timesliceTX.push_back(*frame);
1177 }
1178
1179 continue;
1180 }
1181
1182 const JModule& module = moduleRouter->getModule(frame->getModuleID());
1183 JSuperFrame2D_t& buffer = JSuperFrame2D_t::demultiplex(*frame, module);
1184
1185 // Apply high-rate veto
1186
1187 buffer.applyHighRateVeto(parameters.highRateVeto_Hz);
1188
1189 // L0
1190
1191 timesliceL0.push_back(JSuperFrame1D_t(buffer));
1192
1193 // Nano-beacon trigger
1194
1195 if (parameters.triggerNB.enabled) {
1196
1197 JSuperFrame2D_t::iterator __end = partition(buffer.begin(), buffer.end(), parameters.triggerNB.pmts);
1198
1199 if (buffer.begin() != __end) {
1200
1201 timesliceNB.push_back(JSuperFrame1D_t(frame->getDAQChronometer(),
1202 frame->getModuleIdentifier(),
1203 module.getPosition()));
1204
1205 JSuperFrame1D_t zbuf;
1206
1207 (*buildL1)(buffer.begin(), __end, back_inserter(zbuf));
1208
1209 (*buildNB)(buffer.begin(), __end, zbuf, back_inserter(*timesliceNB.rbegin()));
1210 }
1211 }
1212
1213 // L1
1214
1215 timesliceL1.push_back(JSuperFrame1D_t(frame->getDAQChronometer(),
1216 frame->getModuleIdentifier(),
1217 module.getPosition()));
1218
1219 (*buildL1)(*timesliceL0.rbegin(), back_inserter(*timesliceL1.rbegin()));
1220
1221 // L2
1222
1223 timesliceL2.push_back(JSuperFrame1D_t(frame->getDAQChronometer(),
1224 frame->getModuleIdentifier(),
1225 module.getPosition()));
1226
1227 (*buildL2)(buffer, *timesliceL1.rbegin(), back_inserter(*timesliceL2.rbegin()));
1228
1229 // SN
1230 {
1231 JTimeslice_t::value_type tv(frame->getDAQChronometer(),
1232 frame->getModuleIdentifier(),
1233 module.getPosition());
1234
1235 (*buildSN)(buffer, *timesliceL1.rbegin(), back_inserter(tv));
1236
1237 if (!tv.empty()) {
1238 timesliceSN.push_back(tv);
1239 }
1240 }
1241
1242 } else {
1243
1244 JErrorStream(logErrorDetector) << "No detector information for module " << frame->getModuleID();
1245 }
1246 }
1247
1248 if (!timesliceTX.empty()) {
1249
1250 if (dumpCount < dumpLimit) {
1251
1252 this->put(timesliceTX);
1253
1254 dumpCount += 1;
1255 }
1256 }
1257
1258 // Trigger
1259
1260 if (parameters.triggerNB.enabled) {
1261
1262 const JTriggerInput trigger_input(timesliceNB);
1263
1264 for (JTriggerInput::const_iterator hit = trigger_input.begin(); hit != trigger_input.end(); ++hit) {
1265
1266 if (parameters.triggerNB.write()) {
1267
1268 JTriggeredEvent tev(timesliceNB.getDAQChronometer(),
1269 getTriggerMask(triggerNB->getTriggerBit()),
1270 *hit,
1272 *moduleRouter,
1273 parameters.TMaxLocal_ns,
1274 parameters.triggerNB.DMax_m,
1275 getTimeRange(parameters.triggerNB));
1276
1277 this->put(tev);
1278 }
1279 }
1280 }
1281
1282 JTriggerInput trigger_input(timesliceL2);
1283 JTriggerOutput trigger_output;
1284
1285 (*trigger3DMuon) (trigger_input, back_inserter(trigger_output));
1286 (*trigger3DShower)(trigger_input, back_inserter(trigger_output));
1287 (*triggerMXShower)(trigger_input, timesliceL0, back_inserter(trigger_output));
1288
1289 trigger_output.merge(JEventOverlap(parameters.TMaxEvent_ns));
1290
1291 for (JTriggerOutput::const_iterator event = trigger_output.begin(); event != trigger_output.end(); ++event) {
1292
1293 const JTriggeredEvent object(*event, *timesliceRouter, *moduleRouter, parameters.TMaxLocal_ns, getTimeRange(parameters));
1294
1295 this->put(object);
1296
1297 numberOfEvents += 1;
1298 }
1299
1300 if (parameters.writeL1() || c_buffer.sizeL1 > 0) {
1301
1302 const JTimesliceL1<JDAQTimesliceL1> object(timesliceL1, *timesliceRouter, *moduleRouter, parameters.TMaxLocal_ns);
1303
1304 if (parameters.writeL1) { this->put(object); }
1305 if (c_buffer.sizeL1 > 0) { c_buffer.put(object); }
1306 }
1307
1308 if (parameters.writeL2() || c_buffer.sizeL2 > 0) {
1309
1310 const JTimesliceL1<JDAQTimesliceL2> object(timesliceL2, *timesliceRouter, *moduleRouter, parameters.L2.TMaxLocal_ns);
1311
1312 if (parameters.writeL2) { this->put(object); }
1313 if (c_buffer.sizeL2 > 0) { c_buffer.put(object); }
1314 }
1315
1316 if (parameters.writeSN() || c_buffer.sizeSN > 0) {
1317
1318 const JTimesliceL1<JDAQTimesliceSN> object(timesliceSN, *timesliceRouter, *moduleRouter, parameters.SN.TMaxLocal_ns);
1319
1320 if (parameters.writeSN) { this->put(object); }
1321 if (c_buffer.sizeSN > 0) { c_buffer.put(object); }
1322 }
1323
1324 if (parameters.writeL0() || c_buffer.sizeL0 > 0) {
1325
1326 if (parameters.writeL0) { this->put(timeslice); }
1327 if (c_buffer.sizeL0 > 0) { c_buffer.put(timeslice); }
1328 }
1329 }
1330
1331 } catch(const std::exception& error) {
1332
1333 JErrorStream(logger) << "Error = " << error.what() << ";"
1334 << "run = " << timeslice.getRunNumber() << ";"
1335 << "frame index = " << timeslice.getFrameIndex() << ";"
1336 << "time slice not correctly processed;"
1337 << "discard" << (dumpCount < dumpLimit ? " and dump" : "");
1338
1339 if (dumpCount < dumpLimit) {
1340
1341 this->put(static_cast<const JDAQTimeslice&>(timeslice));
1342
1343 dumpCount += 1;
1344 }
1345 }
1346
1347 timesliceRouter->reset();
1348 }
void merge(const JMatch_t &match)
Merge events.
Data structure for a composite optical module.
Definition JModule.hh:75
const JPosition3D & getPosition() const
Get position.
virtual bool put(const T &object) override
Object output.
static JSuperFrame2D< JElement_t, JAllocator_t > demultiplex
Demultiplexer.
std::vector< value_type >::iterator iterator
Auxiliary class to build JDAQTimeslice for L1 timeslice.
JSuperFrame1D< JElement_t > value_type
Definition JTimeslice.hh:32
Data structure for input to trigger algorithm.
Auxiliary class to build KM3NETDAQ::JDAQEvent for a triggered event.
void put(const T &object)
Auxiliary method to send object to data server.
JSuperFrame1D< hit_type > JSuperFrame1D_t
JSuperFrame2D< hit_type > JSuperFrame2D_t
JTimeslice< hit_type > JTimeslice_t
return result
Definition JPolint.hh:862
static const JChecksum checksum
Function object to perform check-sum of raw data.
Definition JChecksum.hh:200
Match of two events considering overlap in time and position.
Auxiliary data structure for result of checksum.
Definition JChecksum.hh:90

◆ typeout()

void KM3NETDAQ::JDataFilter::typeout ( )
inline

Report status to message logger.

Definition at line 1354 of file JDataFilter.cc.

1355 {
1356 timer.stop();
1357
1358 const double T_us = (double) timer.usec_wall;
1359
1360 JStatusStream(logger) << "Elapsed real (wall) time [s] " << T_us / 1e6;
1361 JStatusStream(logger) << "Elapsed user CPU time [s] " << (double) timer.usec_ucpu/ 1e6;
1362 JStatusStream(logger) << "Elapsed system CPU time [s] " << (double) timer.usec_scpu/ 1e6;
1363 JStatusStream(logger) << "Elapsed real time per time slice [ms] " << Qt.getMean(0.0) * 1.0e-3 << " <= " << Qt.getXmax() * 1.0e-3;
1364 JStatusStream(logger) << "Number of packets received/discarded " << number_of_packets_received << "/" << number_of_packets_discarded;
1365 JStatusStream(logger) << "Number of events/MB/us " << numberOfEvents << "/" << numberOfBytes/1e6 << "/" << Qx.getMean(0.0);
1366
1368 JStatusStream(logger) << "Number of reads/packet " << (double) number_of_reads / (double) number_of_packets_received;
1369 }
1370
1371 JStatusStream(logger) << "Current queue depth/size " << timeslices.size() << "/" << queueSize;
1372 JStatusStream(logger) << "Current number of frames per slice expected: " << frames_per_slice << ' ' << FIXED(5,3) << factor_per_slice;
1373
1374 JStatusStream(logger) << "Number of timeslices processed total/incomplete " << numberOfTimeslicesProcessed << "/" << numberOfIncompleteTimeslicesProcessed;
1375
1376 const double processedSlicesTime_us = numberOfTimeslicesProcessed * getFrameTime() / 1000;
1377 const double processedDetectorTime_us = (maxFrameNumber - minFrameNumber) * getFrameTime() / 1000;
1378
1379 if (processedSlicesTime_us > 0) {
1380 JStatusStream(logger) << "Performance factor (inaccurate estimate): " << T_us / processedSlicesTime_us;
1381 }
1382 if (processedDetectorTime_us > 0) {
1383 JStatusStream(logger) << "Performance factor whole detector (inaccurate estimate): " << T_us / processedDetectorTime_us;
1384 }
1385
1386 timer.start();
1387 }
unsigned long long usec_ucpu
Definition JTimer.hh:239
unsigned long long usec_wall
Definition JTimer.hh:238
unsigned long long usec_scpu
Definition JTimer.hh:240
double getFrameTime()
Get frame time duration.
Definition JDAQClock.hh:162
Auxiliary data structure for floating point format specification.
Definition JManip.hh:448
double getXmax() const
Get maximum value.
Definition JStats.hh:201
double getMean() const
Get mean value.
Definition JStats.hh:234

◆ actionTagged()

virtual void KM3NETDAQ::JDataFilter::actionTagged ( const JTag & tag,
int length,
const char * buffer )
inlineoverridevirtual

Tagged action to handle alerts.

Parameters
tagtag
lengthnumber of characters
buffermessage

Reimplemented from KM3NETDAQ::JDAQClient.

Definition at line 1397 of file JDataFilter.cc.

1398 {
1399 using namespace std;
1400
1401 JDebugStream(logger) << "Received message <" << tag.toString() << "> \"" << string(buffer, length) << "\"";
1402
1403 if (tag == RC_ALERT) {
1404
1405 if (c_buffer.is_open()) {
1406
1407 JStatusStream(logger) << "Archive circular buffer in <" << c_buffer.archive << ">";
1408
1409 c_buffer.close(true);
1410 }
1411
1412 if (c_buffer.is_enabled()) {
1413
1414 c_buffer.open();
1415
1416 if (c_buffer.is_open()) {
1417
1418 JStatusStream(logger) << "Created circular buffer " << c_buffer;
1419
1421
1422 } else {
1423
1424 JErrorStream (logger) << "Failed to create circular buffer in directory <" << c_buffer.path << ">; disable functionality.";
1425
1426 c_buffer.disable();
1427 }
1428 }
1429
1430 } else {
1431
1432 JWarningStream(logger) << "Tag <" << tag.toString() << "> not implemented";
1433 }
1434 }
std::string toString() const
Convert tag to string.
Definition JTag.hh:171

◆ put()

template<class T >
void KM3NETDAQ::JDataFilter::put ( const T & object)
inlineprivate

Auxiliary method to send object to data server.

Parameters
objectobject to be sent

Definition at line 1450 of file JDataFilter.cc.

1451 {
1452 try {
1453
1454 const localtime_t t0 = getLocalTime();
1455
1456 datawriter->put(object);
1457
1458 const localtime_t t1 = getLocalTime();
1459
1460 numberOfBytes += getSizeof(object);
1461
1462 Qx.put(t1 - t0);
1463 }
1464 catch(const std::exception& error) {
1465 JErrorStream(logger) << "Error \"" << error.what() << "\"; trigger ev_error.";
1466 ev_error();
1467 }
1468 }

◆ enter() [1/2]

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 }
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
int read(const int argc, const char *const argv[])
Parse the program's command line options.
Definition JParser.hh:1992
JParser parser
parser method enter()
virtual bool enter() override
Enter the state machine.

◆ enter() [2/2]

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
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 }
bool is_valid() const
Check validity of logger object.
Subscription list.
std::string toString() const
Convert subscription list to string.
JSubscriptionList subscription
custom subscription
const char * getGITVersion()
Get GIT version.
Definition Jpp.cc:9
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
JSubscriptionList getSubscription(const JEventTable &event_table)
Convert event table to ControlHost subscription.
JEventTable eventTable
event table

◆ exit()

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.

◆ isRunning()

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::state_RunControl::state_Operational Operational
JDAQStateMachine::state_Main::state_RunControl RunControl
JDAQStateMachine::state_Main Main

◆ replaceEvent()

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.

◆ findEvent()

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 }
const_iterator find(const JTag &tag, const std::string &event_name) const
Find entry.

◆ addSubscription()

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.

◆ addParameter() [1/2]

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 }

◆ addParameter() [2/2]

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 }

◆ setSelect() [2/2]

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 }
void setReaderMask(const JAbstractFile &file)
Set reader mask.
JFileDescriptorMask & getReaderMask()
Get reader mask.
JSelectReader select
select call
void setSelect()
Set the file descriptor mask for the select call.

◆ actionInput()

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 }
JLevel_t getLevel()
Get debug level.
void setLevel(const int __level)
Set debug level.

◆ filter()

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

Reimplemented in KM3NETDAQ::JDAQDriver.

Definition at line 662 of file JDAQClient.hh.

663 {
664 return false;
665 }

◆ run() [1/3]

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
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
728
730 update();
731 }
732
734
735 } else {
736
737 try {
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.
void wait() const
Wait until the number of time intervals has elapsed since the last call to the reset method.
void reset(const long long int t0)
Reset time.
long long int getInterval() const
Get interval time.
virtual const char * what() const override
Get error message.
Definition JException.hh:64
Exception for socket.
Auxiliary class for time values.
Definition JTimeval.hh:29
void error(const JMessage_t &message)
bool hasReaderMask(const JAbstractFile &file) const
Has reader file.
void update()
Update state machine.
virtual void actionSelect(const JFileDescriptorMask &mask)
Action method following last select call.
virtual void actionRunning()
This method is repeatedly called when this client machine is in state Running and the clock interval ...
JTimekeeper clock
central clock
static const int TIMEOUT_S
time out of update [s]
Definition JDAQClient.hh:63

◆ run() [2/3]

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 }
Data structure to store command line arguments.
Definition JArgs.hh:26
ControlHost prefix.
Definition JPrefix.hh:33
int getSize() const
Get size.
Definition JPrefix.hh:62
virtual bool exit() override
Exit the state machine.
void run()
Run as run control client following command messages via JNET::JControlHost.

◆ run() [3/3]

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

◆ update() [1/2]

void KM3NETDAQ::JDAQClient::update ( )
inlineprivateinherited

Update state machine.

This method waits for a message from JNET::JControlHost server.

Definition at line 842 of file JDAQClient.hh.

843 {
844 JNET::JPrefix prefix;
845
846 server->WaitHead(prefix);
847
848 const int length = prefix.getSize();
849
850 char* buffer = new char[length];
851
852 server->GetFullData(buffer, length);
853
854 update(prefix.getTag(), length, buffer);
855
856 delete [] buffer;
857 }
const JTag & getTag() const
Get tag.
Definition JTag.hh:86

◆ update() [2/2]

void KM3NETDAQ::JDAQClient::update ( const JTag & tag,
int length,
const char * buffer )
inlineprivateinherited

Update state machine.

Parameters
tagtag
lengthnumber of characters
buffermessage

Definition at line 867 of file JDAQClient.hh.

868 {
869 using namespace std;
870 using namespace JPP;
871
872 if (filter(tag, length, buffer)) {
873 return;
874 }
875
876 if (getSubscription(eventTable)->count(JSubscriptionAny(tag)) == 0 &&
877 getSubscription(eventTable)->count(JSubscriptionAll(tag)) == 0) {
878
879 actionTagged(tag, length, buffer);
880
881 return;
882 }
883
884
885 string::size_type pos = 0;
886
887 while (pos != (string::size_type) length && TOKEN_DELIMETER.find(*(buffer + pos)) == string::npos) {
888 ++pos;
889 }
890
891 const JEvent_t event = JEvent_t::toValue(string(buffer, pos));
892
893 if (event.hasInfo()) {
894 setEventInfo(event.getInfo());
895 }
896
897 while (pos != (string::size_type) length && TOKEN_DELIMETER.find(*(buffer + pos)) != string::npos) {
898 ++pos;
899 }
900
901
902 JEventTable::const_iterator i = eventTable.find(tag, event.getName());
903
904 if (i != eventTable.end()) {
905
906 const CHSM::state* const s0 = getState();
907
908 if (!i->second->active()) {
909
910 JWarningStream(logger) << "Event " << i->second->name() << " not active (" << (s0 != NULL ? s0->name() : "") << ")";
911
912 if (server.is_valid() && s0 != NULL) {
913 server->PutFullString(RC_FAIL, getMessage(*s0, *i->second));
914 }
915 }
916
917 // redirect all I/O
918
919 {
921 JErrorStream error(logger);
922
923 JRedirectStream rs_cin (cin, JLANG::null);
924 JRedirectStream rs_cout(cout, debug);
925 JRedirectStream rs_cerr(cerr, error);
926
927 if (rs_cin &&
928 rs_cout &&
929 rs_cerr) {
930
931 (*(i->second))(length - pos, buffer + pos);
932 }
933 }
934
935 const CHSM::state* const s1 = getState();
936
937 JStatusStream(logger) << "Transition "
938 << (s0 != NULL ? s0->name() : "")
939 << "->(" << i->second->name() << ")->"
940 << (s1 != NULL ? s1->name() : "");
941 } else {
942
943 JErrorStream(logger) << "Unknown key <" << tag << "," << event.getName() << ">";
944 }
945 }
int debug
debug level
Definition JSirene.cc:72
This class can be used to temporarily redirect one output (input) stream to another output (input) st...
virtual bool filter(const JTag &tag, int length, const char *buffer)
Filter message.
virtual void actionTagged(const JTag &tag, int length, const char *buffer)
This method is called when a custom tag is encountered.
std::string getMessage(const CHSM::state &state, const CHSM::event &event) const
Get event message.
const CHSM::state * getState() const
Get current state.
static JNullStream null
Null I/O stream.
static const std::string TOKEN_DELIMETER
Definition JDAQTags.hh:58
static const JNET::JTag RC_FAIL
Definition JDAQTags.hh:68
Auxiliary class for any subscription.
void setEventInfo(const std::string &info)
Set last event information.
static JEvent_t toValue(const std::string &buffer)
Convert string to event.
Definition JEvent_t.hh:99

◆ configure()

void KM3NETDAQ::JDAQClient::configure ( )
inlineprivateinherited

Configure client.

This method is used to setup the event table.

Definition at line 952 of file JDAQClient.hh.

953 {
954 }

◆ getMessage()

std::string KM3NETDAQ::JDAQClient::getMessage ( const CHSM::state & state,
const CHSM::event & event ) const
inlineprivateinherited

Get event message.

Parameters
statestate
eventevent
Returns
message

Definition at line 964 of file JDAQClient.hh.

965 {
966 std::ostringstream os;
967
968 os << getFullName()
970 << (getEventInfo() != "" ?
971 JEvent_t(event.name(), getEventInfo()) :
972 JEvent_t(event.name()))
974 << getStateName(state.name());
975
976 return os.str();
977 }
std::string getStateName(const std::string &name)
Get name of state.
char getTokenDelimeter()
Get the token delimeter for command messages.
const std::string & getEventInfo() const
Get last event information.

◆ enterState()

virtual void KM3NETDAQ::JDAQClient::enterState ( const CHSM::state & state,
const CHSM::event & event )
inlineoverrideprivatevirtualinherited

Action when entering state.

This method provides for the hand shaking with the run control program.

Parameters
stateentered state
eventevent that triggered transition

Implements JDAQCHSM.

Reimplemented in KM3NETDAQ::JDAQDriver.

Definition at line 987 of file JDAQClient.hh.

988 {
989 if (server.is_valid()) {
990 server->PutFullString(RC_REPLY, getMessage(state, event));
991 }
992 }
static const JNET::JTag RC_REPLY
Definition JDAQTags.hh:67

◆ actionCheck()

virtual void KM3NETDAQ::JDAQClient::actionCheck ( int length,
const char * buffer )
inlineoverrideprivatevirtualinherited

This method is called at ev_check and reports a system check by mimicing an enter state action.

Parameters
lengthnumber of characters
buffermessage

Reimplemented from JDAQCHSM.

Definition at line 1001 of file JDAQClient.hh.

1002 {
1003 if (Main.RunControl.Error.active()) {
1004
1006
1007 } else {
1008
1009 for (CHSM::parent::iterator state = Main.RunControl.Operational.begin(); state != Main.RunControl.Operational.end(); ++state) {
1010
1011 if (state->active()) {
1012
1013 // mimic enter state
1014
1015 enterState(*state, ev_check);
1016 }
1017 }
1018 }
1019 }
JDAQStateMachine::ev_check_event ev_check
virtual void enterState(const CHSM::state &state, const CHSM::event &event) override
Action when entering state.

◆ execute()

void KM3NETDAQ::JDAQClient::execute ( action __action,
const CHSM::event & __event )
inlineoverrideprivatevirtualinherited

The method to execute the action.

Parameters
__actionpointer to action method
__eventevent that triggered the action

Implements JDAQCHSM.

Definition at line 1028 of file JDAQClient.hh.

1029 {
1030 try {
1031
1032 const JDAQStateMachine::ev_daq_event& event = dynamic_cast<const JDAQStateMachine::ev_daq_event&>(__event);
1033
1034 (this->*__action)(event->length, event->buffer);
1035 }
1036 catch(const std::exception& error) {
1037 JErrorStream(logger) << "Error at event " << __event.name() << " \"" << error.what() << "\"; trigger ev_error.";
1038 ev_error();
1039 }
1040 }

◆ getState()

const CHSM::state * KM3NETDAQ::JDAQClient::getState ( ) const
inlineprivateinherited

Get current state.

Returns
state

Definition at line 1048 of file JDAQClient.hh.

1049 {
1050 for (CHSM::parent::const_iterator state = Main.RunControl.Operational.begin(); state != Main.RunControl.Operational.end(); ++state) {
1051 if (state->active()) {
1052 return &(*state);
1053 }
1054 }
1055
1056 if (Main.RunControl.Error.active()) {
1057 return &Main.RunControl.Error;
1058 }
1059
1060 return NULL;
1061 }

◆ A1()

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.hh:135

◆ A2()

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.hh:123
virtual void execute(action __action, const CHSM::event &__event)=0
The method to execute the action.

◆ A3()

void JDAQStateMachine::A3 ( CHSM_ns_alias::event const & event)
inherited

Definition at line 348 of file JDAQCHSM.cc.

348{ JDAQCHSM::exit(); }

◆ A4()

void JDAQStateMachine::A4 ( CHSM_ns_alias::event const & event)
inherited

Definition at line 350 of file JDAQCHSM.cc.

virtual void actionConfigure(int, const char *)
Definition JDAQCHSM.hh:124

◆ A5()

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.hh:129

◆ A6()

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 }
int run_number
Definition JDAQCHSM.hh:167
virtual void actionStart(int, const char *)
Definition JDAQCHSM.hh:125
int detector_id
Definition JDAQCHSM.hh:166
JDAQStateMachine::ev_start_event ev_start

◆ A7()

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.hh:130

◆ A8()

void JDAQStateMachine::A8 ( CHSM_ns_alias::event const & event)
inherited

Definition at line 366 of file JDAQCHSM.cc.

virtual void actionContinue(int, const char *)
Definition JDAQCHSM.hh:127

◆ A9()

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.hh:128

◆ A10()

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.hh:126

◆ A11()

void JDAQStateMachine::A11 ( CHSM_ns_alias::event const & event)
inherited

Definition at line 372 of file JDAQCHSM.cc.

virtual void actionRecover(int, const char *)
Definition JDAQCHSM.hh:136

◆ A12()

void JDAQStateMachine::A12 ( CHSM_ns_alias::event const & event)
inherited

Definition at line 374 of file JDAQCHSM.cc.

374{ JDAQCHSM::exit(); }

◆ A13()

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.hh:132

◆ A14()

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.hh:133

◆ EAM4root()

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.hh:120

◆ XAM4root()

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.hh:121

◆ getName()

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 }

◆ getDetectorID()

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 }

◆ getRunNumber()

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 }

◆ actionError()

virtual void JDAQCHSM::actionError ( )
inlinevirtualinherited

Definition at line 135 of file JDAQCHSM.hh.

135{}

◆ actionRecover()

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

Definition at line 136 of file JDAQCHSM.hh.

136{}

◆ getHostname()

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 }

◆ getFullName()

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 }

◆ getUniqueTag()

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 }

◆ getClockDelay()

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 }

◆ getClockInterval()

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 }

◆ setClockInterval()

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 }
void setInterval(const long long int interval_us)
Set interval time.

◆ resetClock()

void KM3NETDAQ::JDAQClient_t::resetClock ( )
inlineinherited

Reset clock.

Definition at line 174 of file JDAQClient.hh.

175 {
176 clock.reset();
177 }

◆ getEventInfo()

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

◆ setEventInfo()

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 }

Member Data Documentation

◆ meta

JMeta KM3NETDAQ::JDataFilter::meta

meta data

Definition at line 1436 of file JDataFilter.cc.

◆ datawriter

JSinglePointer<JControlHost_t> KM3NETDAQ::JDataFilter::datawriter
private

controlhost of data server (to which data writer should be connected)

Definition at line 1441 of file JDataFilter.cc.

◆ hostname

std::string KM3NETDAQ::JDataFilter::hostname
private

host name of data server

Definition at line 1442 of file JDataFilter.cc.

◆ port

int KM3NETDAQ::JDataFilter::port
private

server socket port

Definition at line 1471 of file JDataFilter.cc.

◆ backlog

int KM3NETDAQ::JDataFilter::backlog
private

Definition at line 1472 of file JDataFilter.cc.

◆ serversocket

JSinglePointer<JServerSocket> KM3NETDAQ::JDataFilter::serversocket
private

server for data queue connections

Definition at line 1474 of file JDataFilter.cc.

◆ channelList

JChannelList_t KM3NETDAQ::JDataFilter::channelList
private

connections to data queue

Definition at line 1475 of file JDataFilter.cc.

◆ timer

JTimer KM3NETDAQ::JDataFilter::timer
private

Definition at line 1477 of file JDataFilter.cc.

◆ Qt

JStats KM3NETDAQ::JDataFilter::Qt
private

Definition at line 1478 of file JDataFilter.cc.

◆ Qx

JStats KM3NETDAQ::JDataFilter::Qx
private

Definition at line 1478 of file JDataFilter.cc.

◆ timeslices

std::deque<JDAQTimesliceL0> KM3NETDAQ::JDataFilter::timeslices
private

buffer with pending time slice data

Definition at line 1480 of file JDataFilter.cc.

◆ current_slice_index

int KM3NETDAQ::JDataFilter::current_slice_index
private

Definition at line 1481 of file JDataFilter.cc.

◆ frames_per_slice

size_t KM3NETDAQ::JDataFilter::frames_per_slice
private

Definition at line 1482 of file JDataFilter.cc.

◆ factor_per_slice

double KM3NETDAQ::JDataFilter::factor_per_slice
private

Definition at line 1483 of file JDataFilter.cc.

◆ maximal_frame_index

int KM3NETDAQ::JDataFilter::maximal_frame_index
private

Definition at line 1484 of file JDataFilter.cc.

◆ modules

std::set<int> KM3NETDAQ::JDataFilter::modules
private

Definition at line 1485 of file JDataFilter.cc.

◆ dataqueue_slice_index

KM3NETDAQ::JDataFilter::dataqueue_slice_index
private

◆ parameters

JTriggerParameters KM3NETDAQ::JDataFilter::parameters
private

Definition at line 1544 of file JDataFilter.cc.

◆ timesliceRouter

JSinglePointer<JTimesliceRouter> KM3NETDAQ::JDataFilter::timesliceRouter
private

Definition at line 1545 of file JDataFilter.cc.

◆ detector

JDetector KM3NETDAQ::JDataFilter::detector
private

Definition at line 1547 of file JDataFilter.cc.

◆ moduleRouter

JSinglePointer<JModuleRouter> KM3NETDAQ::JDataFilter::moduleRouter
private

Definition at line 1548 of file JDataFilter.cc.

◆ buildL1

JSinglePointer<JBuildL1_t> KM3NETDAQ::JDataFilter::buildL1
private

Definition at line 1549 of file JDataFilter.cc.

◆ buildL2

JSinglePointer<JBuildL2_t> KM3NETDAQ::JDataFilter::buildL2
private

Definition at line 1550 of file JDataFilter.cc.

◆ buildSN

JSinglePointer<JBuildL2_t> KM3NETDAQ::JDataFilter::buildSN
private

Definition at line 1551 of file JDataFilter.cc.

◆ buildNB

JSinglePointer<JBuildL2_t> KM3NETDAQ::JDataFilter::buildNB
private

Definition at line 1552 of file JDataFilter.cc.

◆ triggerNB

JSinglePointer<JTriggerNB> KM3NETDAQ::JDataFilter::triggerNB
private

Definition at line 1554 of file JDataFilter.cc.

◆ trigger3DMuon

JSinglePointer<JTrigger3DMuon> KM3NETDAQ::JDataFilter::trigger3DMuon
private

Definition at line 1555 of file JDataFilter.cc.

◆ trigger3DShower

JSinglePointer<JTrigger3DShower> KM3NETDAQ::JDataFilter::trigger3DShower
private

Definition at line 1556 of file JDataFilter.cc.

◆ triggerMXShower

JSinglePointer<JTriggerMXShower> KM3NETDAQ::JDataFilter::triggerMXShower
private

Definition at line 1557 of file JDataFilter.cc.

◆ logErrorRun

JMessageScheduler KM3NETDAQ::JDataFilter::logErrorRun
private

Definition at line 1559 of file JDataFilter.cc.

◆ logErrorDetector

JMessageScheduler KM3NETDAQ::JDataFilter::logErrorDetector
private

Definition at line 1560 of file JDataFilter.cc.

◆ logErrorIndex

JMessageScheduler KM3NETDAQ::JDataFilter::logErrorIndex
private

Definition at line 1561 of file JDataFilter.cc.

◆ logErrorIncomplete

JMessageScheduler KM3NETDAQ::JDataFilter::logErrorIncomplete
private

Definition at line 1562 of file JDataFilter.cc.

◆ logErrorOvercomplete

JMessageScheduler KM3NETDAQ::JDataFilter::logErrorOvercomplete
private

Definition at line 1563 of file JDataFilter.cc.

◆ dumpCount

int KM3NETDAQ::JDataFilter::dumpCount
private

Definition at line 1565 of file JDataFilter.cc.

◆ dumpLimit

int KM3NETDAQ::JDataFilter::dumpLimit
private

maximum number of time slices to be dumped

Definition at line 1566 of file JDataFilter.cc.

◆ dumpMask

JStatus KM3NETDAQ::JDataFilter::dumpMask
private

mask for data to be dumped

Definition at line 1567 of file JDataFilter.cc.

◆ dataFilters

std::vector<JDAQProcess> KM3NETDAQ::JDataFilter::dataFilters
private

Definition at line 1571 of file JDataFilter.cc.

◆ dataQueues

std::vector<JDAQProcess> KM3NETDAQ::JDataFilter::dataQueues
private

Definition at line 1572 of file JDataFilter.cc.

◆ totalCPURAM

long long int KM3NETDAQ::JDataFilter::totalCPURAM
private

Definition at line 1576 of file JDataFilter.cc.

◆ maxQueueDepth

size_t KM3NETDAQ::JDataFilter::maxQueueDepth
private

Definition at line 1577 of file JDataFilter.cc.

◆ maxQueueSize

long long int KM3NETDAQ::JDataFilter::maxQueueSize
private

Definition at line 1578 of file JDataFilter.cc.

◆ queueSize

long long int KM3NETDAQ::JDataFilter::queueSize
private

Definition at line 1579 of file JDataFilter.cc.

◆ reporting

bool KM3NETDAQ::JDataFilter::reporting
private

Definition at line 1583 of file JDataFilter.cc.

◆ numberOfEvents

long long int KM3NETDAQ::JDataFilter::numberOfEvents
private

Definition at line 1585 of file JDataFilter.cc.

◆ numberOfBytes

long long int KM3NETDAQ::JDataFilter::numberOfBytes
private

Definition at line 1586 of file JDataFilter.cc.

◆ numberOfTimeslicesProcessed

long long int KM3NETDAQ::JDataFilter::numberOfTimeslicesProcessed
private

Definition at line 1587 of file JDataFilter.cc.

◆ numberOfIncompleteTimeslicesProcessed

long long int KM3NETDAQ::JDataFilter::numberOfIncompleteTimeslicesProcessed
private

Definition at line 1588 of file JDataFilter.cc.

◆ minFrameNumber

int KM3NETDAQ::JDataFilter::minFrameNumber
private

Definition at line 1590 of file JDataFilter.cc.

◆ maxFrameNumber

int KM3NETDAQ::JDataFilter::maxFrameNumber
private

Definition at line 1591 of file JDataFilter.cc.

◆ number_of_packets_received

long long int KM3NETDAQ::JDataFilter::number_of_packets_received
private

Definition at line 1595 of file JDataFilter.cc.

◆ number_of_packets_discarded

long long int KM3NETDAQ::JDataFilter::number_of_packets_discarded
private

Definition at line 1596 of file JDataFilter.cc.

◆ number_of_reads

long long int KM3NETDAQ::JDataFilter::number_of_reads
private

Definition at line 1597 of file JDataFilter.cc.

◆ number_of_bytes_received

long long int KM3NETDAQ::JDataFilter::number_of_bytes_received
private

Definition at line 1598 of file JDataFilter.cc.

◆ c_buffer

JCircularBuffer_t KM3NETDAQ::JDataFilter::c_buffer
private

Definition at line 1602 of file JDataFilter.cc.

◆ server

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

message server

Definition at line 834 of file JDAQClient.hh.

◆ logger

JMessageLogger KM3NETDAQ::JDAQClient::logger
protectedinherited

message logger

Definition at line 835 of file JDAQClient.hh.

◆ select

JSelectReader KM3NETDAQ::JDAQClient::select
privateinherited

select call

Definition at line 1064 of file JDAQClient.hh.

◆ parser

JParser KM3NETDAQ::JDAQClient::parser
privateinherited

parser method enter()

Definition at line 1065 of file JDAQClient.hh.

◆ subscription

JSubscriptionList KM3NETDAQ::JDAQClient::subscription
privateinherited

custom subscription

Definition at line 1066 of file JDAQClient.hh.

◆ root

JDAQStateMachine::state_root JDAQStateMachine::root
inherited

◆ Main

JDAQStateMachine::state_Main JDAQStateMachine::Main
inherited

◆ ev_daq_transitions

int const JDAQStateMachine::ev_daq_transitions
staticprivateinherited
Initial value:
= {
-1
}

Definition at line 52 of file JDAQCHSM.hh.

◆ ev_daq

JDAQStateMachine::ev_daq_event JDAQStateMachine::ev_daq
inherited

◆ ev_daq_param_block

char JDAQStateMachine::ev_daq_param_block[sizeof(ev_daq_event::param_block)]
inherited

Definition at line 238 of file JDAQCHSM.hh.

◆ ev_init_transitions

int const JDAQStateMachine::ev_init_transitions
staticprivateinherited
Initial value:
= {
1, -1
}

Definition at line 69 of file JDAQCHSM.hh.

◆ ev_init

JDAQStateMachine::ev_init_event JDAQStateMachine::ev_init
inherited

◆ ev_init_param_block

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

Definition at line 258 of file JDAQCHSM.hh.

◆ ev_configure_transitions

int const JDAQStateMachine::ev_configure_transitions
staticprivateinherited
Initial value:
= {
3, -1
}

Definition at line 86 of file JDAQCHSM.hh.

◆ ev_configure

JDAQStateMachine::ev_configure_event JDAQStateMachine::ev_configure
inherited

◆ ev_configure_param_block

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

Definition at line 278 of file JDAQCHSM.hh.

◆ ev_start_transitions

int const JDAQStateMachine::ev_start_transitions
staticprivateinherited
Initial value:
= {
5, -1
}

Definition at line 103 of file JDAQCHSM.hh.

◆ ev_start

JDAQStateMachine::ev_start_event JDAQStateMachine::ev_start
inherited

◆ ev_start_param_block

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

Definition at line 298 of file JDAQCHSM.hh.

◆ ev_pause_transitions

int const JDAQStateMachine::ev_pause_transitions
staticprivateinherited
Initial value:
= {
9, -1
}

Definition at line 120 of file JDAQCHSM.hh.

120 {}
121 virtual void actionExit() {}
122

◆ ev_pause

JDAQStateMachine::ev_pause_event JDAQStateMachine::ev_pause
inherited

◆ ev_pause_param_block

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

Definition at line 318 of file JDAQCHSM.hh.

◆ ev_continue_transitions

int const JDAQStateMachine::ev_continue_transitions
staticprivateinherited
Initial value:
= {
7, -1
}

Definition at line 137 of file JDAQCHSM.hh.

139 :
140

◆ ev_continue

JDAQStateMachine::ev_continue_event JDAQStateMachine::ev_continue
inherited

◆ ev_continue_param_block

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

Definition at line 338 of file JDAQCHSM.hh.

◆ ev_stop_transitions

int const JDAQStateMachine::ev_stop_transitions
staticprivateinherited
Initial value:
= {
8, -1
}

Definition at line 154 of file JDAQCHSM.hh.

◆ ev_stop

JDAQStateMachine::ev_stop_event JDAQStateMachine::ev_stop
inherited

◆ ev_stop_param_block

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

Definition at line 358 of file JDAQCHSM.hh.

◆ ev_reset_transitions

int const JDAQStateMachine::ev_reset_transitions
staticprivateinherited
Initial value:
= {
4, -1
}

Definition at line 171 of file JDAQCHSM.hh.

173 : public JDAQCHSM {
DAQ state machine interface.
Definition JDAQCHSM.hh:25

◆ ev_reset

JDAQStateMachine::ev_reset_event JDAQStateMachine::ev_reset
inherited

◆ ev_reset_param_block

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

Definition at line 378 of file JDAQCHSM.hh.

◆ ev_quit_transitions

int const JDAQStateMachine::ev_quit_transitions
staticprivateinherited
Initial value:
= {
6, -1
}

Definition at line 188 of file JDAQCHSM.hh.

188 : public CHSM_ns_alias::cluster { // 1
189 public:
190 class state_Operational : public CHSM_ns_alias::cluster { // 2

◆ ev_quit

JDAQStateMachine::ev_quit_event JDAQStateMachine::ev_quit
inherited

◆ ev_quit_param_block

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

Definition at line 398 of file JDAQCHSM.hh.

◆ ev_off_transitions

int const JDAQStateMachine::ev_off_transitions
staticprivateinherited
Initial value:
= {
2, 11, -1
}

Definition at line 205 of file JDAQCHSM.hh.

205 :
206 static int const children_[];
207 } RunControl;

◆ ev_off

JDAQStateMachine::ev_off_event JDAQStateMachine::ev_off
inherited

◆ ev_off_param_block

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

Definition at line 418 of file JDAQCHSM.hh.

◆ ev_check_transitions

int const JDAQStateMachine::ev_check_transitions
staticprivateinherited
Initial value:
= {
12, -1
}

Definition at line 222 of file JDAQCHSM.hh.

◆ ev_check

JDAQStateMachine::ev_check_event JDAQStateMachine::ev_check
inherited

◆ ev_check_param_block

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

Definition at line 438 of file JDAQCHSM.hh.

◆ ev_input_transitions

int const JDAQStateMachine::ev_input_transitions
staticprivateinherited
Initial value:
= {
13, -1
}

Definition at line 239 of file JDAQCHSM.hh.

240 : static int const ev_init_transitions[]; public:
241 class ev_init_event : public JDAQStateMachine::ev_daq_event {
static int const ev_init_transitions[]
Definition JDAQCHSM.hh:69

◆ ev_input

JDAQStateMachine::ev_input_event JDAQStateMachine::ev_input
inherited

◆ ev_input_param_block

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

Definition at line 458 of file JDAQCHSM.hh.

◆ ev_recover_transitions

int const JDAQStateMachine::ev_recover_transitions
staticprivateinherited
Initial value:
= {
10, -1
}

Definition at line 256 of file JDAQCHSM.hh.

◆ ev_recover

JDAQStateMachine::ev_recover_event JDAQStateMachine::ev_recover
inherited

◆ ev_recover_param_block

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

Definition at line 478 of file JDAQCHSM.hh.

◆ ev_error_transitions

int const JDAQStateMachine::ev_error_transitions
staticprivateinherited
Initial value:
= {
0, -1
}

Definition at line 273 of file JDAQCHSM.hh.

273 :
274 ev_configure_event( CHSM_EVENT_ARGS ) :
275 JDAQStateMachine::ev_daq_event( CHSM_EVENT_INIT ) { }

◆ ev_error

JDAQStateMachine::ev_error_event JDAQStateMachine::ev_error
inherited

◆ ev_error_param_block

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

Definition at line 495 of file JDAQCHSM.hh.

◆ state_

CHSM_ns_alias::state* JDAQStateMachine::state_[11]
privateinherited

Definition at line 522 of file JDAQCHSM.hh.

◆ transition_

CHSM_ns_alias::transition const JDAQStateMachine::transition_
staticprivateinherited
Initial value:
= {
{ 0, 2, 8, 0, (CHSM_ns_alias::transition::action)&JDAQStateMachine::A1 },
{ 0, 3, 4, 0, (CHSM_ns_alias::transition::action)&JDAQStateMachine::A2 },
{ 0, 3, -1, 0, (CHSM_ns_alias::transition::action)&JDAQStateMachine::A3 },
{ 0, 4, 5, 0, (CHSM_ns_alias::transition::action)&JDAQStateMachine::A4 },
{ 0, 4, 3, 0, (CHSM_ns_alias::transition::action)&JDAQStateMachine::A5 },
{ 0, 5, 7, 0, (CHSM_ns_alias::transition::action)&JDAQStateMachine::A6 },
{ 0, 5, 4, 0, (CHSM_ns_alias::transition::action)&JDAQStateMachine::A7 },
{ 0, 6, 7, 0, (CHSM_ns_alias::transition::action)&JDAQStateMachine::A8 },
{ 0, 6, 4, 0, (CHSM_ns_alias::transition::action)&JDAQStateMachine::A9 },
{ 0, 7, 6, 0, (CHSM_ns_alias::transition::action)&JDAQStateMachine::A10 },
{ 0, 8, 2, 0, (CHSM_ns_alias::transition::action)&JDAQStateMachine::A11 },
{ 0, 8, -1, 0, (CHSM_ns_alias::transition::action)&JDAQStateMachine::A12 },
{ 0, 9, -1, 0, (CHSM_ns_alias::transition::action)&JDAQStateMachine::A13 },
{ 0, 9, -1, 0, (CHSM_ns_alias::transition::action)&JDAQStateMachine::A14 },
0
}
void A1(CHSM_ns_alias::event const &)
Definition JDAQCHSM.cc:344
void A4(CHSM_ns_alias::event const &)
Definition JDAQCHSM.cc:350
void A13(CHSM_ns_alias::event const &)
Definition JDAQCHSM.cc:376
void A11(CHSM_ns_alias::event const &)
Definition JDAQCHSM.cc:372
void A2(CHSM_ns_alias::event const &)
Definition JDAQCHSM.cc:346
void A14(CHSM_ns_alias::event const &)
Definition JDAQCHSM.cc:378
void A7(CHSM_ns_alias::event const &)
Definition JDAQCHSM.cc:364
void A9(CHSM_ns_alias::event const &)
Definition JDAQCHSM.cc:368
void A12(CHSM_ns_alias::event const &)
Definition JDAQCHSM.cc:374
void A3(CHSM_ns_alias::event const &)
Definition JDAQCHSM.cc:348
void A8(CHSM_ns_alias::event const &)
Definition JDAQCHSM.cc:366
void A5(CHSM_ns_alias::event const &)
Definition JDAQCHSM.cc:352
void A10(CHSM_ns_alias::event const &)
Definition JDAQCHSM.cc:370
void A6(CHSM_ns_alias::event const &)
Definition JDAQCHSM.cc:354

Definition at line 280 of file JDAQCHSM.hh.

280 : static int const ev_start_transitions[]; public:
281 class ev_start_event : public JDAQStateMachine::ev_daq_event {
282 public:
285 param_block( CHSM_ns_alias::event const &, int , const char * );
286 protected:
287 virtual ~param_block();
288 };
289 param_block* operator->() const {
290 return (param_block*)param_block_;
291 }
292 void operator()( int , const char * );
293 protected:
294 ev_start_event( CHSM_EVENT_ARGS ) :
295 JDAQStateMachine::ev_daq_event( CHSM_EVENT_INIT ) { }
296 friend class JDAQStateMachine;
ev_daq_event(CHSM_EVENT_ARGS)
Definition JDAQCHSM.hh:234
param_block * operator->() const
Definition JDAQCHSM.hh:289
JDAQStateMachine::ev_daq_event::param_block base_param_block
Definition JDAQCHSM.hh:283
void operator()(int, const char *)
Definition JDAQCHSM.cc:111
ev_start_event(CHSM_EVENT_ARGS)
Definition JDAQCHSM.hh:294
static int const ev_start_transitions[]
Definition JDAQCHSM.hh:103
param_block(CHSM_ns_alias::event const &, int, const char *)
Definition JDAQCHSM.cc:106

◆ taken_

CHSM_ns_alias::event const* JDAQStateMachine::taken_[14]
privateinherited

Definition at line 524 of file JDAQCHSM.hh.

◆ target_

CHSM_ns_alias::state* JDAQStateMachine::target_[14]
privateinherited

Definition at line 525 of file JDAQCHSM.hh.

◆ name

std::string JDAQCHSM::name
protectedinherited

Definition at line 165 of file JDAQCHSM.hh.

◆ detector_id

int JDAQCHSM::detector_id
protectedinherited

Definition at line 166 of file JDAQCHSM.hh.

◆ run_number

int JDAQCHSM::run_number
protectedinherited

Definition at line 167 of file JDAQCHSM.hh.

◆ TIMEOUT_S

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

time out of update [s]

Definition at line 63 of file JDAQClient.hh.

◆ eventTable

JEventTable KM3NETDAQ::JDAQClient_t::eventTable
protectedinherited

event table

Definition at line 203 of file JDAQClient.hh.

◆ fullname

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

Definition at line 205 of file JDAQClient.hh.

◆ unique_tag

JTag KM3NETDAQ::JDAQClient_t::unique_tag
protectedinherited

Definition at line 206 of file JDAQClient.hh.

◆ clock

JTimekeeper KM3NETDAQ::JDAQClient_t::clock
protectedinherited

central clock

Definition at line 207 of file JDAQClient.hh.

◆ event_info

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: