artdaq  v2_02_03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
RawEventQueueReader.hh
1 #ifndef artdaq_ArtModules_detail_RawEventQueueReader_hh
2 #define artdaq_ArtModules_detail_RawEventQueueReader_hh
3 
4 #include "art/Framework/Core/Frameworkfwd.h"
5 
6 #include "art/Framework/Core/FileBlock.h"
7 #include "art/Framework/Core/ProductRegistryHelper.h"
8 #include "art/Framework/IO/Sources/SourceHelper.h"
9 #include "art/Framework/IO/Sources/SourceTraits.h"
10 #include "art/Framework/Principal/EventPrincipal.h"
11 #include "art/Framework/Principal/RunPrincipal.h"
12 #include "art/Framework/Principal/SubRunPrincipal.h"
13 #include "artdaq-core/Core/GlobalQueue.hh"
14 #include "fhiclcpp/ParameterSet.h"
15 
16 #include <string>
17 #include <map>
18 
19 namespace artdaq
20 {
21  namespace detail
22  {
27  {
32 
38 
39  art::SourceHelper const pmaker;
40  RawEventQueue& incoming_events;
41  artdaq::detail::seconds waiting_time;
43  std::string pretend_module_name;
47 
61  RawEventQueueReader(fhicl::ParameterSet const& ps,
62  art::ProductRegistryHelper& help,
63  art::SourceHelper const& pm);
64 
73  RawEventQueueReader(fhicl::ParameterSet const& ps,
74  art::ProductRegistryHelper& help,
75  art::SourceHelper const& pm,
76  art::MasterProductRegistry&) : RawEventQueueReader(ps, help, pm) {}
77 
81  void closeCurrentFile();
82 
87  void readFile(std::string const&, art::FileBlock*& fb);
88 
93  bool hasMoreData() const { return (!shutdownMsgReceived); }
94 
105  bool readNext(art::RunPrincipal* const & inR,
106  art::SubRunPrincipal* const & inSR,
107  art::RunPrincipal*& outR,
108  art::SubRunPrincipal*& outSR,
109  art::EventPrincipal*& outE);
110 
111  std::map<Fragment::type_t, std::string> fragment_type_map_;
112  unsigned readNext_calls_;
113  };
114  } // detail
115 } // artdaq
116 
117 namespace art
118 {
123  template <>
124  struct Source_generator<artdaq::detail::RawEventQueueReader>
125  {
126  static constexpr bool value = true;
127  };
128 }
129 
130 #endif /* artdaq_ArtModules_detail_RawEventQueueReader_hh */
std::string pretend_module_name
The module name to store data under.
bool readNext(art::RunPrincipal *const &inR, art::SubRunPrincipal *const &inSR, art::RunPrincipal *&outR, art::SubRunPrincipal *&outSR, art::EventPrincipal *&outE)
Dequeue a RawEvent and declare its Fragment contents to art, creating Run, SubRun, and EventPrincipal objects as necessary.
bool shutdownMsgReceived
Whether a shutdown message has been received.
bool hasMoreData() const
Whether more data is expected from the RawEventQueueReader.
RawEventQueueReader(RawEventQueueReader const &)=delete
Copy Constructor is deleted.
RawEventQueueReader & operator=(RawEventQueueReader const &)=delete
Copy Assignment operator is deleted.
The RawEventQueueReader is a class which implements the methods needed by art::Source.
std::string unidentified_instance_name
The name to use for unknown Fragment types.
void readFile(std::string const &, art::FileBlock *&fb)
Emulate opening a file.
RawEventQueueReader(fhicl::ParameterSet const &ps, art::ProductRegistryHelper &help, art::SourceHelper const &pm, art::MasterProductRegistry &)
RawEventQueueReader Constructor.
void closeCurrentFile()
Emulate closing a file. No-Op.
bool outputFileCloseNeeded
If an explicit output file close message is needed.
bool resume_after_timeout
Whether to resume if the dequeue action times out.
RawEventQueue & incoming_events
The events from the EventStore.
std::map< Fragment::type_t, std::string > fragment_type_map_
The Fragment type names that this RawEventQueueReader knows about.
artdaq::detail::seconds waiting_time
The amount of time to wait for an event from the queue.
unsigned readNext_calls_
The number of times readNext has been called.
art::SourceHelper const pmaker
An art::SourceHelper instance.