16 #include <boost/array.hpp> 41 std::vector<art::Worker*>
const& workers)
59 throw cet::exception(
"Landed") <<
"input is not root file, therefore not seekable and therefore unsuitable for EventViewer\n";
61 boost::array<char, 128> instr;
62 size_t len=
socket_->receive(boost::asio::buffer(instr));
65 long newrec=atol(instr.data());
71 LOG_DEBUG(
"Landed") <<
"seek succeeded\n";
72 socket_->send(boost::asio::buffer(
"OK\n", 3));
79 throw cet::exception(
"Landed") <<
"problem performing seek on input, lost track of input event\n";
80 socket_->send(boost::asio::buffer(
"NO\n", 3));
84 boost::array<char, 2> conf;
85 if (
socket_->receive(boost::asio::buffer(conf))!=1)
86 throw cet::exception(
"Landed") <<
"LANDED app did not confirm instruction result\n";
90 throw cet::exception(
"Landed") <<
"bad instruction from LANDED app\n";
98 std::ostringstream sockfile;
99 sockfile << getenv(
"HOME") <<
"/.landed.sock";
100 endpoint_=
new boost::asio::local::stream_protocol::endpoint(sockfile.str());
103 mf::LogError(
"Landed") <<
"failed to create socket for connection to LANDED app\n";
115 std::ostringstream
ss;
116 ss <<
"GEO:"<< vrml.length() <<
"\n";
117 if (
socket_->send(boost::asio::buffer(ss.str().c_str(), ss.str().length()))!=ss.str().length() ||
118 socket_->send(boost::asio::buffer(vrml.c_str(), vrml.length()))!=vrml.length())
120 throw cet::exception(
"Landed") <<
"failed to send detector geometry to LANDED app\n";
122 boost::array<char, 2> conf;
123 if (
socket_->receive(boost::asio::buffer(conf))!=1)
124 throw cet::exception(
"Landed") <<
"LANDED app did not confirm detector geometry\n";
126 LOG_DEBUG(
"Landed") <<
"LANDED app has confirmed detector geometry\n";
132 std::ostringstream
ss;
133 ss <<
"EVT:" <<
record_ <<
"," << nhits <<
"," << nvertex <<
", " << run <<
"," << subrun <<
"," <<
event <<
"\n";
135 if (
socket_->send(boost::asio::buffer(ss.str().c_str(), ss.str().length()))!=ss.str().length())
136 throw cet::exception(
"Landed") <<
"failed to send event introduction to LANDED app\n";
137 boost::array<char, 2> conf;
138 if (
socket_->receive(boost::asio::buffer(conf))!=1)
139 throw cet::exception(
"Landed") <<
"LANDED app did not confirm event\n";
144 std::ostringstream
ss;
145 ss <<
"HIT:" << x <<
"," << y <<
"," << z <<
"," << e <<
"," << ne <<
"," << track <<
"\n";
147 if (
socket_->send(boost::asio::buffer(ss.str().c_str(), ss.str().length()))!=ss.str().length())
148 throw cet::exception(
"Landed") <<
"failed to send hit to LANDED app\n";
149 boost::array<char, 2> conf;
150 if (
socket_->receive(boost::asio::buffer(conf))!=1)
151 throw cet::exception(
"Landed") <<
"LANDED app did not confirm hit\n";
157 std::ostringstream
ss;
158 ss <<
"VTX:" << x <<
"," << y <<
"," << z <<
"," << e <<
"," <<
id <<
"," << pdgcode <<
"\n";
159 if (
socket_->send(boost::asio::buffer(ss.str().c_str(), ss.str().length()))!=ss.str().length())
160 throw cet::exception(
"Landed") <<
"failed to send vertex to LANDED app\n";
161 boost::array<char, 2> conf;
162 if (
socket_->receive(boost::asio::buffer(conf))!=1)
163 throw cet::exception(
"Landed") <<
"LANDED app did not confirm vertex\n";
GlobalSignal< detail::SignalResponseType::FIFO, void()> sPostBeginJob
LandedSocket(fhicl::ParameterSet const &, art::ActivityRegistry ®)
void postBeginJobWorkers(art::InputSource *, std::vector< art::Worker * > const &)
#define DEFINE_ART_SERVICE(svc)
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
void sendVertex(double, double, double, double, int, int)
GlobalSignal< detail::SignalResponseType::LIFO, void(InputSource *, std::vector< Worker * > const &)> sPostBeginJobWorkers
void preProcessEvent(art::Event const &)
void sendHit(double, double, double, double, double, int)
void sendGeometry(std::string)
void sendEvent(int, int, int, int, int)
void postProcessEvent(art::Event const &)
art::InputSource * inputSource_
boost::asio::local::stream_protocol::endpoint * endpoint_
boost::asio::io_service service_
GlobalSignal< detail::SignalResponseType::FIFO, void(Event const &)> sPreProcessEvent
GlobalSignal< detail::SignalResponseType::LIFO, void(Event const &)> sPostProcessEvent
boost::asio::local::stream_protocol::socket * socket_
cet::coded_exception< error, detail::translate > exception
Event finding and building.