36 if (classname==
"hadaq_iter")
46 if (url.GetProtocol()==
"hld") {
47 DOUT1(
"HLD input file name %s", url.GetFullName().c_str());
58 if (url.GetProtocol()==
"hld") {
59 DOUT1(
"HLD output file name %s", url.GetFullName().c_str());
72 if (!portref.
IsInput() || url.GetFullName().empty() ||
73 ((url.GetProtocol()!=
"hadaq") && (url.GetProtocol()!=
"nhadaq") && (url.GetProtocol()!=
"ohadaq")))
78 std::string portname = portref.
GetName();
80 int calibr = url.GetOptionInt(
"calibr", -1);
82 if (url.HasOption(
"trb") && (url.HasOption(
"tdc") || (calibr>=0))) {
85 std::string calname =
dabc::format(
"TRB%04x_TdcCal", (
unsigned) url.GetOptionInt(
"trb"));
89 DOUT0(
"Create calibration module %s AUTOMODE %d", calname.c_str(), calibr);
91 DOUT0(
"Create calibration module %s TDCS %s", calname.c_str(), url.GetOptionStr(
"tdc").c_str());
94 mcmd.SetStr(
"TRB", url.GetOptionStr(
"trb"));
95 if ((calibr>=0) && !url.HasOption(
"dummy")) {
96 mcmd.SetInt(
"Mode", calibr);
98 mcmd.SetInt(
"Mode", -1);
99 mcmd.SetStr(
"TDC", url.GetOptionStr(
"tdc"));
102 if (url.HasOption(
"hub")) mcmd.SetStr(
"HUB", url.GetOptionStr(
"hub"));
103 if (url.HasOption(
"trig")) mcmd.SetStr(
"CalibrTrigger", url.GetOptionStr(
"trig"));
104 if (url.HasOption(
"dummy")) mcmd.SetBool(
"Dummy",
true);
105 mcmd.SetInt(
"portid", portref.
ItemSubId());
123 if (url.HasOption(
"resort")) {
126 std::string sortname =
dabc::format(
"%sResort", portname.c_str());
128 DOUT0(
"Create sort module %s trignum 0x%06x", sortname.c_str(), trignum);
146 int nport = url.GetPort();
147 if (nport<=0) {
EOUT(
"Port not specified");
return 0; }
149 int rcvbuflen = url.GetOptionInt(
"udpbuf", 200000);
151 if (fd<=0) {
EOUT(
"Cannot open UDP socket for %s", url.GetHostNameWithPort().c_str());
return 0; }
153 int mtu = url.GetOptionInt(
"mtu", 64512);
154 int maxloop = url.GetOptionInt(
"maxloop", 100);
156 double reduce = url.GetOptionDouble(
"reduce", 1.);
157 double lost_rate = url.GetOptionDouble(
"lost", 0);
158 bool debug = url.HasOption(
"debug");
159 int udp_queue = url.GetOptionInt(
"upd_queue", 0);
160 double heartbeat = url.GetOptionDouble(
"heartbeat", -1.);
162 if (udp_queue>0) cmd.
SetInt(
"TransportQueue", udp_queue);
164 DOUT0(
"Start HADAQ UDP transport on %s", url.GetHostNameWithPort().c_str());
166 NewAddon* addon =
new NewAddon(fd, nport, mtu, debug, maxloop, reduce, lost_rate);
173 if (classname ==
"hadaq::CombinerModule")
176 if (classname ==
"hadaq::SorterModule")
179 if (classname ==
"hadaq::MbsTransmitterModule") {
180 EOUT(
"MbsTransmitterModule class no longer supported");
184 if (classname ==
"hadaq::ReadoutModule")
187 if (classname ==
"hadaq::TerminalModule")
190 if (classname ==
"hadaq::BnetMasterModule")
193 if (classname ==
"hadaq::MonitorModule")
bool AddObject(const std::string &kind, const std::string &name)
Adds object into application list List used when objects must be destroyed or application start/stop ...
static const char * PortArg()
Represents command with its arguments.
bool SetStr(const std::string &name, const char *value)
bool SetInt(const std::string &name, int v)
Interface for implementing any kind of data output.
Small helper class to correctly instantiate user-specific factories.
virtual Module * CreateTransport(const Reference &port, const std::string &typ, Command cmd)
Factory method to create transport.
virtual Module * CreateModule(const std::string &classname, const std::string &modulename, Command cmd)
Factory method to create module.
virtual Reference CreateObject(const std::string &classname, const std::string &objname, Command cmd)
Factory method to create object.
static int ConnectPorts(Reference port1ref, Reference port2ref, Command cmd=nullptr)
ModuleRef FindModule(const std::string &name)
WorkerRef GetModule() const
unsigned ItemSubId() const
Reference on dabc::Module class
PortRef FindPort(const std::string &name)
Return reference on the port.
Base for dabc::ModuleSync and dabc::ModuleAsync classes.
Reference on the dabc::Port class
bool IsInput() const
Returns true if it is input port.
uint64_t AsUInt(uint64_t dflt=0) const
Reference on the arbitrary object
const char * GetName() const
Return name of referenced object, if object not assigned, returns "---".
std::string ItemName(bool compact=true) const
Produce string, which can be used as name argument in dabc::mgr.FindItem(name) call.
Uniform Resource Locator interpreter.
RecordField Cfg(const std::string &name, Command cmd=nullptr) const
Returns configuration record of specified name.
bool Execute(Command cmd, double tmout=-1.)
Master monitor for BNet components.
Factory for HADAQ classes
dabc::DataInput * CreateDataInput(const std::string &typ) override
Factory method to create data input.
dabc::DataOutput * CreateDataOutput(const std::string &typ) override
Factory method to create data output.
dabc::Module * CreateModule(const std::string &classname, const std::string &modulename, dabc::Command cmd) override
Factory method to create module.
dabc::Module * CreateTransport(const dabc::Reference &port, const std::string &typ, dabc::Command cmd) override
Factory method to create transport.
dabc::Reference CreateObject(const std::string &classname, const std::string &objname, dabc::Command cmd) override
Factory method to create object.
Implementation of file output for HLD files.
Monitor of TRB slow control data.
static int OpenUdp(const std::string &host, int nport, int rcvbuflen)
Sorts HADAQ subevents according to trigger number.
Terminal for HADAQ event builder.
const char * xmlNumOutputs
std::string format(const char *fmt,...)
const char * xmlNumInputs
const char * xmlHadaqTrignumRange
dabc::FactoryPlugin hadaqfactory(new hadaq::Factory("hadaq"))