artdaq  v3_05_00
RootNetOutput_module.cc
1 
2 #define TRACE_NAME (app_name + "_RootNetOutput").c_str()
3 #include "artdaq/ArtModules/ArtdaqOutput.hh"
4 
5 #include "artdaq/ArtModules/NetMonTransportService.h"
6 #include "artdaq/DAQdata/NetMonHeader.hh"
7 
8 namespace art {
9 class RootNetOutput;
10 }
11 
18 {
19 public:
27  explicit RootNetOutput(fhicl::ParameterSet const& ps);
28 
33 
34 protected:
41  virtual void SendMessage(artdaq::Fragment::sequence_id_t sequence_id, artdaq::Fragment::type_t messageType, TBufferFile& msg);
42 };
43 
44 art::RootNetOutput::RootNetOutput(fhicl::ParameterSet const& ps)
45  : ArtdaqOutput(ps)
46 {
47  TLOG(TLVL_DEBUG) << "Begin: RootNetOutput::RootNetOutput(ParameterSet const& ps)";
48  ServiceHandle<NetMonTransportService> transport;
49  transport->connect();
50  TLOG(TLVL_DEBUG) << "End: RootNetOutput::RootNetOutput(ParameterSet const& ps)";
51 }
52 
54 {
55  TLOG(TLVL_DEBUG) << "Begin: RootNetOutput::~RootNetOutput()";
56  ServiceHandle<NetMonTransportService> transport;
57  transport->disconnect();
58  TLOG(TLVL_DEBUG) << "End: RootNetOutput::~RootNetOutput()";
59 }
60 
61 void art::RootNetOutput::SendMessage(artdaq::Fragment::sequence_id_t sequence_id, artdaq::Fragment::type_t messageType, TBufferFile& msg)
62 {
63  //
64  // Send message.
65  //
66  {
67  ServiceHandle<NetMonTransportService> transport;
68  if (!transport.get())
69  {
70  TLOG(TLVL_ERROR) << "Could not get handle to NetMonTransportService!";
71  return;
72  }
73  TLOG(TLVL_WRITE) << "RootNetOutput::SendMessage Sending a message with type code "
74  << artdaq::detail::RawFragmentHeader::SystemTypeToString(messageType);
75  transport->sendMessage(sequence_id, messageType, msg);
76  TLOG(TLVL_WRITE) << "RootNetOutput::SendMessage: Message sent.";
77  }
78 }
79 
80 DEFINE_ART_MODULE(art::RootNetOutput)
This is the base class for artdaq OutputModules, providing the serialization interface for art Events...
Definition: ArtdaqOutput.hh:99
virtual void SendMessage(artdaq::Fragment::sequence_id_t sequence_id, artdaq::Fragment::type_t messageType, TBufferFile &msg)
Send a message using DataSenderManager
~RootNetOutput()
RootNetOutput Destructor.
An art::OutputModule which sends events using DataSenderManager. This module is designed for transpor...
RootNetOutput(fhicl::ParameterSet const &ps)
RootNetOutput Constructor.