62      in >> index >> 
static_cast<std::string&
>(source);
 
 
   77      out << static_cast<const std::string&>(source);
 
 
 
  114      if (in >> index >> hostname) {
 
  120          target.setTcpNoDelay  (
true);
 
  121          target.setReuseAddress(
true);
 
  122          target.setKeepAlive   (
true);
 
  123          target.setReceiveBufferSize(1024);
 
  124          target.setSendBufferSize   (1024*1024);
 
  125          target.setNonBlocking (
false);
 
  128          cout << error << endl;
 
 
  148      out << 
"TCP no-delay    " << 
target.getTcpNoDelay()        << endl;
 
  149      out << 
"Reuse address   " << 
target.getReuseAddress()      << endl;
 
  150      out << 
"Keep alive      " << 
target.getKeepAlive()         << endl;
 
  151      out << 
"Receive buffer  " << 
target.getReceiveBufferSize() << endl;
 
  152      out << 
"Send    buffer  " << 
target.getSendBufferSize()    << endl;
 
  153      out << 
"Non blocking    " << 
target.getNonBlocking()       << endl;
 
 
 
  181                 const std::string& 
server,
 
 
  198      Long64_t        numberOfEvents = 1;
 
  199      int             numberOfFrames = numeric_limits<int>::max();
 
  204      properties[
"source"]         = 
source;
 
  205      properties[
"target"]         = 
target;
 
  206      properties[
"snooze"]         = 
snooze;
 
  207      properties[
"inputFile"]      = inputFile;
 
  208      properties[
"numberOfEvents"] = numberOfEvents;
 
  209      properties[
"numberOfFrames"] = numberOfFrames;
 
  210      properties[
"probability"]    = P;
 
  212      properties.
read(
string(buffer, length));
 
  231        for (map_type::const_iterator i = 
snooze.begin(); i != 
snooze.end(); ++i) {
 
  232          os << 
' ' << setw(8) << i->first << 
" [" << 
FILL(6,
'0') << i->second.getLowerLimit() << 
"," << 
FILL(6,
'0') << i->second.getUpperLimit() << 
"]";
 
  240      int number_of_hits   = 0;
 
  241      int number_of_errors = 0;
 
  243      if (index < 
source.size()) {
 
  249          int i1 = (timeslice->size() * (index + 0)) / 
source.size();
 
  250          int i2 = (timeslice->size() * (index + 1)) / 
source.size();
 
  252          if (i2 - i1 > numberOfFrames) {
 
  253            i2 = i1 + numberOfFrames;
 
  256          for (
int i = i1; i != i2; ++i) {
 
  264              if (gRandom->Rndm() <= P) {
 
  266                *hit = 
JDAQHit(hit->getPMT(), getRandom<JDAQHit::JTDC_t>(), hit->getToT());
 
  277          for (
int i = i1; i != i2; ++i) {
 
  278            data.rbegin()->at(i - i1) << timeslice->at(i);
 
  282        JNoticeStream(
logger) << 
"Number of errors / hits " << number_of_errors << 
" / " << number_of_hits << 
" for P = " << P;
 
 
  305    virtual void actionQuit(
int length, 
const char* buffer)
 override 
 
  325    virtual void actionStop(
int length, 
const char* buffer)
 override 
 
  343          for (JTimeslice::const_iterator frame = 
data->begin(); frame != 
data->end(); ++frame) {
 
  350            if (
snooze.count(header.getModuleID()) == 0 || !
snooze[header.getModuleID()](header.getFrameIndex())) {
 
  354              socket.
write(frame->data(), frame->size());
 
 
  405        for (
iterator timeslice = begin(); timeslice != end(); ++timeslice) {
 
 
  442        if (
page != end() && ++
page == end()) {
 
  446          for (
iterator timeslice = begin(); timeslice != end(); ++timeslice) {
 
 
 
 
  502int main(
int argc, 
char* argv[])
 
  514    JParser<> zap(
"Program for real-time simulation of data queue.");
 
  518    zap[
'u'] = 
make_field(client_name)     = 
"JDQSimulator";
 
  524  catch(
const exception &error) {
 
  525    FATAL(error.what() << endl);
 
 
KM3NeT DAQ constants, bit handling, etc.
int main(int argc, char *argv[])
Definition of random value generator.
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Utility class to parse parameter values.
Auxiliary class to define a range between two values.
Base class for interprocess communication.
ROOT TTree parameter settings of various packages.
Scheduling of actions via fixed latency intervals.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
int getRunNumber() const
Get run number.
JDAQStateMachine::ev_configure_event ev_configure
Utility class to parse parameter values.
bool read(const JEquation &equation)
Read equation.
Auxiliary class for CPU timing and usage.
unsigned long long usec_wall
void seekg(const int pos)
Set read position.
Byte array binary output.
Simple data structure to support I/O of equations (see class JLANG::JEquation).
Message logging based on ControlHost.
Interface for logging messages.
Message logging based on std::ostream.
int write(const char *buffer, const int length) override
Write data to socket.
Utility class to parse command line options.
General purpose class for object reading from a list of file names.
virtual bool hasNext() override
Check availability of next element.
counter_type getCounter() const
Get counter.
virtual const pointer_type & next() override
Get next element.
std::vector< value_type >::iterator iterator
void setFrameIndex(const int frame_index)
Set frame index.
void setRunNumber(const int run)
Set run number.
Control unit client base class.
JSharedPointer< JControlHost > server
message server
void replaceEvent(const JTag &oldTag, const JTag &newTag, JDAQEvent_t &event)
Replace tag of given event in event table.
void run()
Run as run control client following command messages via JNET::JControlHost.
JMessageLogger logger
message logger
virtual bool enter(const JArgs &args)
Enter the state machine.
const_iterator end() const
const_iterator begin() const
Data frame of one optical module.
Data structure for UTC time.
void reset()
Reset internal iterator to begin.
JData()
Default constructor.
JData::const_iterator page
void setRunNumber(int run_number)
Set run number.
void next()
Increment internal iterator.
const_iterator operator->()
Smart pointer operator.
Runcontrol client to simulate data queue.
long long int numberOfBytes
JIO::JByteArrayWriter JFrame
Memory management for sending of raw data.
virtual void actionConfigure(int length, const char *buffer) override
virtual void actionStart(int length, const char *buffer) override
virtual void actionRunning() override
This method is repeatedly called when this client machine is in state Running and the clock interval ...
virtual void actionStop(int length, const char *buffer) override
std::vector< JTarget > target
virtual void actionReset(int length, const char *buffer) override
std::vector< JFrame > JTimeslice
virtual void actionQuit(int length, const char *buffer) override
JDQSimulator(const std::string &name, const std::string &server, JLogger *logger, const int level)
Constructor.
long long int numberOfSlices
std::vector< JSource > source
Data structure for configuration of JDQSimulator.
JSource()
Default constructor.
friend std::istream & operator>>(std::istream &in, JSource &source)
Read JSource from input stream.
friend std::ostream & operator<<(std::ostream &out, const JSource &source)
Write JSource to output stream.
Data structure for configuration of JDataFilter.
friend std::istream & operator>>(std::istream &in, JTarget &target)
Read JTarget from input stream.
friend std::ostream & operator<<(std::ostream &out, const JTarget &target)
Write JTarget to output stream.
JTarget()
Default constructor.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
const char * getName()
Get ROOT name of given data type.
KM3NeT DAQ data structures and auxiliaries.
double getFrameTime()
Get frame time duration.
double getTimeOfFrame(const int frame_index)
Get start time of frame in ns since start of run for a given frame index.
size_t getSizeof< JDAQSuperFrameHeader >()
Get size of type.
static const JNET::JTag RC_CMD
size_t getSizeof< JDAQPreamble >()
Get size of type.
std::map< int, range_type > map_type
static const JNET::JTag RC_DQSIMULATOR
Auxiliary data structure for sequence of same character.
Level specific message streamers.
Auxiliary data structure for hostname and port number.
void setClockInterval(const long long int interval_us)
Set interval time.
long long int getClockDelay() const
Get total delay time.
void resetClock()
Reset clock.