1 #ifndef artdaq_DAQdata_GenericFragmentSimulator_hh
2 #define artdaq_DAQdata_GenericFragmentSimulator_hh
4 #include "artdaq/DAQdata/Globals.hh"
5 #include "artdaq-core/Data/Fragment.hh"
6 #include "artdaq-core/Generators/FragmentGenerator.hh"
7 #include "fhiclcpp/fwd.h"
13 class GenericFragmentSimulator;
32 fhicl::Atom<size_t> content_selection{ fhicl::Name{
"content_selection"}, fhicl::Comment{
"What type of data to fill in generated Fragment payloads"}, 0 };
33 fhicl::Atom<size_t> payload_size{ fhicl::Name{
"payload_size"}, fhicl::Comment{
"The size (in words) of the Fragment payload"}, 10240 };
34 fhicl::Atom<bool> want_random_payload_size{ fhicl::Name{
"want_random_payload_size"}, fhicl::Comment{
"Whether payload size should be sampled from a random distribution"},
false };
35 fhicl::Atom<int64_t> random_seed{ fhicl::Name{
"random_seed"}, fhicl::Comment{
"Random seed for random number distributions"}, 314159 };
36 fhicl::Atom<size_t> fragments_per_event{ fhicl::Name{
"fragments_per_event"}, fhicl::Comment{
"The number of Fragment objects to generate for each sequence ID"}, 5 };
37 fhicl::Atom<Fragment::fragment_id_t> starting_fragment_id{ fhicl::Name{
"starting_fragment_id"}, fhicl::Comment{
"The first Fragment ID handled by this GenericFragmentSimulator."}, 0 };
39 #if MESSAGEFACILITY_HEX_VERSION >= 0x20103
40 using Parameters = fhicl::WrappedTable<Config>;
76 using FragmentGenerator::getNext;
85 bool getNext(Fragment::sequence_id_t sequence_id,
86 Fragment::fragment_id_t fragment_id,
87 FragmentPtr& frag_ptr);
94 bool getNext(FragmentPtrs& output)
override
96 return getNext_(output);
105 return fragmentIDs_();
109 bool getNext_(FragmentPtrs& output);
111 std::vector<Fragment::fragment_id_t> fragmentIDs_();
113 std::size_t generateFragmentSize_();
117 std::size_t
const payload_size_spec_;
118 std::vector<Fragment::fragment_id_t> fragment_ids_;
120 bool const want_random_payload_size_;
123 std::size_t current_event_num_;
124 std::mt19937 engine_;
125 std::poisson_distribution<size_t> payload_size_generator_;
126 std::uniform_int_distribution<uint64_t> fragment_content_generator_;
bool getNext(FragmentPtrs &output) override
Get the next Fragment from the generator.
GenericFragmentSimulator(fhicl::ParameterSet const &ps)
GenericFragmentSimulator Constructor.
std::vector< Fragment::fragment_id_t > fragmentIDs() override
Get the Fragment IDs generated by this instance.
Fill the payload with the Fragment ID.
GenericFragmentSimulator creates simulated Generic events, with data distributed according to a "hist...
Nothing (Default-initialized Fragment)
content_selector_t
What type of content should the GenericFragmentSimulator put in Fragment objects? ...
Use a random distribution to fill the payload.
bool getNext(Fragment::sequence_id_t sequence_id, Fragment::fragment_id_t fragment_id, FragmentPtr &frag_ptr)
Generate a Fragment according to the value of the content_selectior_t enum.
Fill the payload with 0xDEADBEEFDEADBEEF.