1 #define TRACE_NAME "daq_flow_t"
3 #include "art/Framework/Art/artapp.h"
4 #include "artdaq-core/Data/Fragment.hh"
5 #include "artdaq/DAQdata/GenericFragmentSimulator.hh"
6 #include "artdaq/DAQrate/SharedMemoryEventManager.hh"
7 #include "cetlib_except/exception.h"
8 #include "fhiclcpp/make_ParameterSet.h"
9 #include "artdaq/Application/LoadParameterSet.hh"
16 using artdaq::FragmentPtrs;
22 int main(
int argc,
char* argv[])
24 auto pset = LoadParameterSet(argc, argv);
28 size_t const NUM_FRAGS_PER_EVENT = 5;
29 SharedMemoryEventManager::run_id_t
const RUN_ID = 2112;
30 size_t const NUM_EVENTS = 100;
31 pset.put(
"expected_fragments_per_event", NUM_FRAGS_PER_EVENT);
32 pset.put(
"run_number", RUN_ID);
33 pset.put(
"print_event_store_stats",
true);
34 pset.put(
"event_queue_wait_time", 10.0);
35 pset.put(
"max_event_size_bytes", 0x100000);
36 pset.put(
"buffer_count", 10);
37 pset.put(
"send_init_fragments",
false);
39 auto temp = pset.to_string() +
" source.waiting_time: 10";
40 pset = fhicl::ParameterSet();
41 fhicl::make_ParameterSet(temp, pset);
48 events.startRun(RUN_ID);
50 size_t event_count = 0;
51 while (frags.clear() , event_count++ < NUM_EVENTS && sim.getNext(frags))
53 TLOG(TLVL_DEBUG) <<
"Number of fragments: " << frags.size() ;
54 assert(frags.size() == NUM_FRAGS_PER_EVENT);
55 for (
auto&& frag : frags)
57 assert(frag !=
nullptr);
58 artdaq::FragmentPtr tempFrag;
59 auto sts = events.AddFragment(std::move(frag), 1000000, tempFrag);
62 TLOG(TLVL_ERROR) <<
"Fragment was not added after 1s. Check art thread status!" ;
68 bool endSucceeded = events.endOfData();
78 catch (cet::exception& x)
80 std::cerr << argv[0] <<
" failure\n" << x << std::endl;
83 catch (std::string& x)
85 std::cerr << argv[0] <<
" failure\n" << x << std::endl;
90 std::cerr << argv[0] <<
" failure\n" << x << std::endl;
The SharedMemoryEventManager is a SharedMemoryManger which tracks events as they are built...
GenericFragmentSimulator creates simulated Generic events, with data distributed according to a "hist...