$treeview $search $mathjax $extrastylesheet
artdaq_demo
v3_04_00
$projectbrief
|
$projectbrief
|
$searchbox |
00001 #ifndef artdaq_demo_Generators_ToySimulator_hh 00002 #define artdaq_demo_Generators_ToySimulator_hh 00003 00004 00005 // Some C++ conventions used: 00006 00007 // -Append a "_" to every private member function and variable 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 // The start, stop and stopNoMutex methods are declared pure 00068 // virtual in CommandableFragmentGenerator and therefore MUST be 00069 // overridden; note that stopNoMutex() doesn't do anything here 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 // buffer_ points to the buffer which the hardware interface will 00099 // fill. Notice that it's a raw pointer rather than a smart 00100 // pointer as the API to ToyHardwareInterface was chosen to be a 00101 // C++03-style API for greater realism 00102 00103 char* readout_buffer_; 00104 00105 FragmentType fragment_type_; 00106 ToyHardwareInterface::DistributionType distribution_type_; 00107 int generated_fragments_per_event_; 00108 bool exception_on_config_; 00109 bool dies_on_config_; 00110 }; 00111 } 00112 00113 #endif /* artdaq_demo_Generators_ToySimulator_hh */