60 in >> index >>
static_cast<std::string&
>(source);
75 out << static_cast<const std::string&>(source);
112 if (in >> index >> hostname) {
118 target.
connect(hostname.hostname, hostname.port);
129 cout << error << endl;
179 const std::string& server,
191 using namespace KM3NETDAQ;
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()) {
229 while (inputFile.hasNext()) {
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) {
248 if (gRandom->Rndm() <=
P) {
250 *hit =
JDAQHit(hit->getPMT(), getRandom<JDAQHit::JTDC_t>(), hit->getToT());
257 JDebugStream(logger) <<
"Processing timeslice: " << inputFile.getCounter() <<
" [" << i1 <<
"," << i2 <<
"]";
261 for (
int i = i1; i != i2; ++i) {
262 data.rbegin()->at(i - i1) << timeslice->at(i);
266 JNoticeStream(logger) <<
"Number of errors / hits " << number_of_errors <<
" / " << number_of_hits <<
" for P = " <<
P;
273 setClockInterval((
long long int) (1e-3 *
getFrameTime()));
290 actionReset(0, NULL);
310 if (timer.usec_wall > 0)
JNoticeStream(logger) <<
"I/O " << (int) (numberOfBytes / timer.usec_wall) <<
" MB/s";
311 if (numberOfSlices > 0)
JNoticeStream(logger) <<
"Delay/slice " << (int) (getClockDelay() / numberOfSlices) <<
" us";
317 if (!data.empty() && !
target.empty()) {
335 socket.
write(frame->data(), frame->size());
337 numberOfBytes += frame->size();
383 for (
iterator timeslice = begin(); timeslice != end(); ++timeslice) {
420 if (page != end() && ++page == end()) {
424 for (
iterator timeslice = begin(); timeslice != end(); ++timeslice) {
479 int main(
int argc,
char* argv[])
491 JParser<> zap(
"Program for real-time simulation of optical modules.");
495 zap[
'u'] =
make_field(client_name) =
"JDOMSimulator";
501 catch(
const exception &error) {
502 FATAL(error.what() << endl);
506 using namespace KM3NETDAQ;
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.
ROOT TTree parameter settings.
then JLigiers sh continue fi cat driver txt<< EOFprocess dfilter $HOST1 ssh\$HOST\$"JDataFilter -H \$SERVER\$ -M \$LOGGER\$ -d $DEBUG &";enterevent ev_init{RC_CMD%< ev_init.txt > from me< ev_init.txt > event ev_configure
bool getReuseAddress() const
Get reuse address.
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
Message logging based on std::ostream.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
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.
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
Interface for logging messages.
Message logging based on ControlHost.
const_iterator operator->()
Smart pointer operator.
Utility class to parse parameter values.
std::vector< JTarget > target
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).
Definition of random value generator.
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
const_iterator begin() const
double getFrameTime()
Get frame time duration.
int getRunNumber(const std::string &file_name)
Get run number for given file name of data taking run.
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.
Control unit 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)
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.
size_t getSizeof< JDAQSuperFrameHeader >()
Get size of 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.
size_t getSizeof< JDAQPreamble >()
Get size of type.
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.
Data frame of one optical module.
void reset()
Reset internal iterator to begin.
long long int numberOfSlices
static const JNET::JTag RC_DOMSIMULATOR
const_iterator end() const
int main(int argc, char *argv[])