Go to the documentation of this file.
   60       in >> index >> static_cast<std::string&>(source);
 
   75       out << static_cast<const std::string&>(source);
 
  112       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);
 
  126           target.setNonBlocking (
false);
 
  129           cout << error << endl;
 
  149       out << 
"TCP no-delay    " << 
target.getTcpNoDelay()        << endl;
 
  150       out << 
"Reuse address   " << 
target.getReuseAddress()      << endl;
 
  151       out << 
"Keep alive      " << 
target.getKeepAlive()         << endl;
 
  152       out << 
"Receive buffer  " << 
target.getReceiveBufferSize() << endl;
 
  153       out << 
"Send    buffer  " << 
target.getSendBufferSize()    << endl;
 
  154       out << 
"Non blocking    " << 
target.getNonBlocking()       << endl;
 
  179                   const std::string& server,
 
  196       Long64_t        numberOfEvents = 1;
 
  197       int             numberOfFrames = numeric_limits<int>::max();
 
  202       properties[
"source"]         = source;
 
  203       properties[
"target"]         = 
target;
 
  204       properties[
"inputFile"]      = inputFile;
 
  205       properties[
"numberOfEvents"] = numberOfEvents;
 
  206       properties[
"numberOfFrames"] = numberOfFrames;
 
  207       properties[
"probability"]    = P;
 
  209       properties.
read(
string(buffer, length));
 
  219       if (inputFile.empty()) 
JErrorStream(logger) << 
"No input files ";
 
  222       const unsigned int index = 
distance(source.begin(), find(source.begin(), source.end(), 
getName()));
 
  224       int number_of_hits   = 0;
 
  225       int number_of_errors = 0;
 
  227       if (index < source.size()) {
 
  233           int i1 = (timeslice->size() * (index + 0)) / source.size();
 
  234           int i2 = (timeslice->size() * (index + 1)) / source.size();
 
  236           if (i2 - i1 > numberOfFrames) {
 
  237             i2 = i1 + numberOfFrames;
 
  240           for (
int i = i1; i != i2; ++i) {
 
  255               if (gRandom->Rndm() <= P) {
 
  257                 *hit = 
JDAQHit(hit->getPMT(), getRandom<JDAQHit::JTDC_t>(), hit->getToT());
 
  264           JDebugStream(logger) << 
"Processing timeslice: " << inputFile.
getCounter() << 
" [" << i1 << 
"," << i2 << 
"]";
 
  268           for (
int i = i1; i != i2; ++i) {
 
  269             data.rbegin()->at(i - i1) << timeslice->at(i);
 
  273         JNoticeStream(logger) << 
"Number of errors / hits " << number_of_errors << 
" / " << number_of_hits << 
" for P = " << P;
 
  280       setClockInterval((
long long int) (1e-3 * 
getFrameTime()));
 
  297       actionReset(0, NULL);
 
  306       data.setRunNumber(getRunNumber());
 
  317       if (timer.usec_wall > 0) 
JNoticeStream(logger) << 
"I/O "         << (int) (numberOfBytes   / timer.usec_wall) << 
" MB/s";
 
  318       if (numberOfSlices  > 0) 
JNoticeStream(logger) << 
"Delay/slice " << (int) (getClockDelay() / numberOfSlices)  << 
" us";
 
  324       if (!data.empty() && !
target.empty()) {
 
  342             socket.
write(frame->data(), frame->size());
 
  344             numberOfBytes += frame->size();
 
  390         for (
iterator timeslice = begin(); timeslice != end(); ++timeslice) {
 
  427         if (page != end() && ++page == end()) {
 
  431           for (
iterator timeslice = begin(); timeslice != end(); ++timeslice) {
 
  486 int main(
int argc, 
char* argv[])
 
  498     JParser<> zap(
"Program for real-time simulation of optical modules.");
 
  502     zap[
'u'] = 
make_field(client_name)     = 
"JDOMSimulator";
 
  508   catch(
const exception &error) {
 
  509     FATAL(error.what() << endl);
 
  519     out = 
new JStreamLogger(cout);
 
  521     out = 
new JControlHostLogger(logger);
 
  
Level specific message streamers.
 
Interface for logging messages.
 
Data structure for configuration of JDOMSimulator.
 
int main(int argc, char *argv[])
 
void next()
Increment internal iterator.
 
const_iterator operator->()
Smart pointer operator.
 
friend std::ostream & operator<<(std::ostream &out, const JSource &source)
Write JSource to output stream.
 
Auxiliary class for CPU timing and usage.
 
void reset()
Reset internal iterator to begin.
 
JTarget()
Default constructor.
 
std::vector< JSource > source
 
int write(const char *buffer, const int length)
Write data to socket.
 
virtual void actionStop(int length, const char *buffer)
 
long long int numberOfSlices
 
void run()
Run as run control client following command messages via JNET::JControlHost.
 
virtual void actionReset(int length, const char *buffer)
 
std::vector< JTarget > target
 
void setRunNumber(const int run)
Set run number.
 
virtual void actionConfigure(int length, const char *buffer)
 
Utility class to parse command line options.
 
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
 
static int sizeOf()
Get size of object.
 
bool read(const JEquation &equation)
Read equation.
 
virtual void actionRunning()
This method is repeatedly called when this client machine is in state Running and the clock interval ...
 
std::vector< JFrame > JTimeslice
 
Auxiliary data structure for hostname and port number.
 
double getFrameTime()
Get frame time duration.
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
 
counter_type getCounter() const
Get counter.
 
JDOMSimulator(const std::string &name, const std::string &server, JLogger *logger, const int level)
Constructor.
 
void setFrameIndex(const int frame_index)
Set frame index.
 
virtual const pointer_type & next()
Get next element.
 
JIO::JByteArrayWriter JFrame
Memory management for sending of raw data.
 
Runcontrol client to simulate DOM.
 
static const JNET::JTag RC_DOMSIMULATOR
 
JSource()
Default constructor.
 
virtual bool hasNext()
Check availability of next element.
 
Control unit client base class.
 
void reset(JCLBInput &data, size_t size)
Reset CLB buffers.
 
long long int numberOfBytes
 
virtual void actionQuit(int length, const char *buffer)
 
std::vector< value_type >::const_iterator const_iterator
 
Simple data structure to support I/O of equations (see class JLANG::JEquation).
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
 
std::vector< value_type >::iterator iterator
 
General purpose class for object reading from a list of file names.
 
Utility class to parse parameter values.
 
const char * getName()
Get ROOT name of given data type.
 
friend std::istream & operator>>(std::istream &in, JTarget &target)
Read JTarget from input stream.
 
KM3NeT DAQ data structures and auxiliaries.
 
Data frame of one optical module.
 
friend std::istream & operator>>(std::istream &in, JSource &source)
Read JSource from input stream.
 
static const JNET::JTag RC_CMD
 
virtual void actionStart(int length, const char *buffer)
 
JData::const_iterator page
 
const_iterator begin() const
 
friend std::ostream & operator<<(std::ostream &out, const JTarget &target)
Write JTarget to output stream.
 
const_iterator end() const
 
void seekg(const int pos)
Set read position.
 
virtual bool enter(const JArgs &args)
Enter the state machine.
 
JData()
Default constructor.
 
void setRunNumber(int run_number)
Set run number.
 
Byte array binary output.
 
Data structure for configuration of JDataFilter.