00001 #ifndef artdaq_demo_Generators_ToySimulator_hh
00002 #define artdaq_demo_Generators_ToySimulator_hh
00003
00004
00005
00006
00007
00008
00009 #include "fhiclcpp/fwd.h"
00010 #include "artdaq-core/Data/Fragment.hh"
00011 #include "artdaq/Application/CommandableFragmentGenerator.hh"
00012 #include "artdaq-core-demo/Overlays/ToyFragment.hh"
00013 #include "artdaq-core-demo/Overlays/FragmentType.hh"
00014
00015 #include "ToyHardwareInterface/ToyHardwareInterface.hh"
00016
00017 #include <random>
00018 #include <vector>
00019 #include <atomic>
00020
00021 namespace demo
00022 {
00037 class ToySimulator : public artdaq::CommandableFragmentGenerator
00038 {
00039 public:
00049 explicit ToySimulator(fhicl::ParameterSet const& ps);
00050
00054 virtual ~ToySimulator();
00055
00056 private:
00057
00065 bool getNext_(artdaq::FragmentPtrs& output) override;
00066
00067
00068
00069
00070
00076 void start() override;
00077
00083 void stop() override;
00084
00089 void stopNoMutex() override {}
00090
00091 std::unique_ptr<ToyHardwareInterface> hardware_interface_;
00092 artdaq::Fragment::timestamp_t timestamp_;
00093 int timestampScale_;
00094 int rollover_subrun_interval_;
00095
00096 ToyFragment::Metadata metadata_;
00097
00098
00099
00100
00101
00102
00103 char* readout_buffer_;
00104
00105 FragmentType fragment_type_;
00106 ToyHardwareInterface::DistributionType distribution_type_;
00107 };
00108 }
00109
00110 #endif