57 in >> index >>
static_cast<std::string&
>(source);
72 out << static_cast<const std::string&>(source);
109 if (in >> index >> hostname) {
115 target.
connect(hostname.hostname, hostname.port);
126 cout << error << endl;
176 const std::string& server,
188 using namespace KM3NETDAQ;
193 Long64_t numberOfEvents = 1;
194 int numberOfFrames = numeric_limits<int>::max();
198 properties[
"source"] = source;
199 properties[
"target"] =
target;
200 properties[
"inputFile"] = inputFile;
201 properties[
"numberOfEvents"] = numberOfEvents;
202 properties[
"numberOfFrames"] = numberOfFrames;
204 properties.
read(
string(buffer, length));
214 if (inputFile.empty())
JErrorStream(logger) <<
"No input files ";
217 const unsigned int index = distance(source.begin(), find(source.begin(), source.end(),
getName()));
219 if (index < source.size()) {
221 while (inputFile.hasNext()) {
225 int i1 = (timeslice->size() * (index + 0)) / source.size();
226 int i2 = (timeslice->size() * (index + 1)) / source.size();
228 if (i2 - i1 > numberOfFrames) {
229 i2 = i1 + numberOfFrames;
232 JDebugStream(logger) <<
"Processing timeslice: " << inputFile.getCounter() <<
" [" << i1 <<
"," << i2 <<
"]";
236 for (
int i = i1; i != i2; ++i) {
237 data.rbegin()->at(i - i1) << timeslice->at(i);
246 setClockInterval((
long long int) (1e-3 *
getFrameTime()));
263 actionReset(0, NULL);
272 data.setRunNumber(getRunNumber());
283 if (timer.usec_wall > 0)
JNoticeStream(logger) <<
"I/O " << (int) (numberOfBytes / timer.usec_wall) <<
" MB/s";
284 if (numberOfSlices > 0)
JNoticeStream(logger) <<
"Delay/slice " << (int) (getClockDelay() / numberOfSlices) <<
" us";
290 if (!data.empty() && !
target.empty()) {
308 socket.
write(frame->data(), frame->size());
310 numberOfBytes += frame->size();
357 for (
iterator timeslice = begin(); timeslice != end(); ++timeslice) {
394 if (page != end() && ++page == end()) {
398 for (
iterator timeslice = begin(); timeslice != end(); ++timeslice) {
453 int main(
int argc,
char* argv[])
465 JParser<> zap(
"Program for real-time simulation of optical modules.");
469 zap[
'u'] =
make_field(client_name) =
"JDOMSimulator";
475 catch(
const exception &error) {
476 FATAL(error.what() << endl);
480 using namespace KM3NETDAQ;
486 out =
new JStreamLogger(cout);
488 out =
new JControlHostLogger(logger);
void setReuseAddress(const bool on)
Set reuse address.
Utility class to parse command line options.
std::vector< value_type >::const_iterator const_iterator
int getSendBufferSize() const
Get send buffer size.
bool read(const JEquation &equation)
Read equation.
bool getReuseAddress() const
Get reuse address.
void seekg(const int pos)
Set read position.
JTarget()
Default constructor.
void setRunNumber(int run_number)
Set run number.
JData()
Default constructor.
int write(const char *buffer, const int length)
Write data to socket.
std::vector< JFrame > JTimeslice
void setSendBufferSize(const int size)
Set send buffer size.
int getReceiveBufferSize() const
Set receive buffer size.
void next()
Increment internal iterator.
bool getNonBlocking() const
Get non-blocking of I/O.
Interface for logging messages.
const_iterator operator->()
Smart pointer operator.
Utility class to parse parameter values.
std::vector< JTarget > target
void reset(JCLBInput &data, size_t size)
Reset CLB buffers.
std::vector< value_type >::iterator iterator
virtual void actionReset(int length, const char *buffer)
Simple data structure to support I/O of equations (see class JLANG::JEquation).
Runcontrol client to simulate DOM.
virtual void actionRunning()
This method is repeatedly called when this client machine is in state Running and the clock interval ...
virtual void actionConfigure(int length, const char *buffer)
void run()
Run as run control client following command messages via JNET::JControlHost.
Auxiliary data structure for hostname and port number.
JSource()
Default constructor.
Utility class to parse parameter values.
bool getKeepAlive() const
Get keep alive of socket.
long long int numberOfBytes
friend std::istream & operator>>(std::istream &in, JSource &source)
Read JSource from input stream.
Scheduling of actions via fixed latency intervals.
virtual void actionStop(int length, const char *buffer)
JIO::JByteArrayWriter JFrame
Memory management for sending of raw data.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
std::vector< JSource > source
double getFrameTime()
Get frame time duration.
Auxiliary class for CPU timing and usage.
Data structure for configuration of JDOMSimulator.
Level specific message streamers.
void setReceiveBufferSize(const int size)
Set receive buffer size.
Data structure for configuration of JDataFilter.
Scanning of objects from multiple files according a format that follows from the extension of each fi...
JDOMSimulator(const std::string &name, const std::string &server, JLogger *logger, const int level)
Constructor.
Run control client base class.
General purpose class for object reading from a list of file names.
Utility class to parse command line options.
virtual void actionQuit(int length, const char *buffer)
ROOT TTree parameter settings.
void connect(const int port)
Connect to port on local host.
friend std::ostream & operator<<(std::ostream &out, const JSource &source)
Write JSource to output stream.
void setNonBlocking(const bool on)
Set non-blocking of I/O.
virtual bool enter(const JArgs &args)
Enter the state machine.
bool getTcpNoDelay() const
Get TCP no-delay.
virtual void actionStart(int length, const char *buffer)
const char * getName()
Get ROOT name of given data type.
static const JNET::JTag RC_CMD
void setKeepAlive(const bool on)
Set keep alive of socket.
void setRunNumber(const int run)
Set run number.
void setTcpNoDelay(const bool on)
Set TCP no-delay.
Byte array binary output.
friend std::istream & operator>>(std::istream &in, JTarget &target)
Read JTarget from input stream.
KM3NeT DAQ constants, bit handling, etc.
void setFrameIndex(const int frame_index)
Set frame index.
JData::const_iterator page
friend std::ostream & operator<<(std::ostream &out, const JTarget &target)
Write JTarget to output stream.
void reset()
Reset internal iterator to begin.
long long int numberOfSlices
static const JNET::JTag RC_DOMSIMULATOR
static int sizeOf()
Get size of object.
int main(int argc, char *argv[])