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;
40 fhicl::Atom<size_t>
content_selection{ fhicl::Name{
"content_selection"}, fhicl::Comment{
"What type of data to fill in generated Fragment payloads"}, 0 };
42 fhicl::Atom<size_t>
payload_size{ fhicl::Name{
"payload_size"}, fhicl::Comment{
"The size (in words) of the Fragment payload"}, 10240 };
44 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 };
46 fhicl::Atom<int64_t>
random_seed{ fhicl::Name{
"random_seed"}, fhicl::Comment{
"Random seed for random number distributions"}, 314159 };
48 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 };
51 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 };
53 using Parameters = fhicl::WrappedTable<Config>;
73 using FragmentGenerator::getNext;
82 bool getNext(Fragment::sequence_id_t sequence_id,
83 Fragment::fragment_id_t fragment_id,
84 FragmentPtr& frag_ptr);
91 bool getNext(FragmentPtrs& output)
override
93 return getNext_(output);
102 return fragmentIDs_();
106 bool getNext_(FragmentPtrs& output);
108 std::vector<Fragment::fragment_id_t> fragmentIDs_();
110 std::size_t generateFragmentSize_();
114 std::size_t
const payload_size_spec_;
115 std::vector<Fragment::fragment_id_t> fragment_ids_;
117 bool const want_random_payload_size_;
120 std::size_t current_event_num_;
121 std::mt19937 engine_;
122 std::poisson_distribution<size_t> payload_size_generator_;
123 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.
fhicl::Atom< int64_t > random_seed
"random_seed" (Default: 314159) : Random seed for random number distributions
Fill the payload with the Fragment ID.
GenericFragmentSimulator creates simulated Generic events, with data distributed according to a "hist...
Nothing (Default-initialized Fragment)
fhicl::Atom< bool > want_random_payload_size
"want_random_payload_size" (Default: false) : Whether payload size should be sampled from a random di...
fhicl::Atom< Fragment::fragment_id_t > starting_fragment_id
fhicl::Atom< size_t > fragments_per_event
"fragments_per_event" (Default: 5) : The number of Fragment objects to generate for each sequence ID ...
Configuration of the GenericFragmentSimulator. May be used for parameter validation ...
content_selector_t
What type of content should the GenericFragmentSimulator put in Fragment objects? ...
fhicl::Atom< size_t > payload_size
"payload_size" (Default: 10240) : The size(in words) of the Fragment payload
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.
fhicl::Atom< size_t > content_selection
Fill the payload with 0xDEADBEEFDEADBEEF.