DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
AlgorithmPlugins.hpp
Go to the documentation of this file.
1
11#ifndef TRIGGER_INCLUDE_TRIGGER_ALGORITHMPLUGINS_HPP_
12#define TRIGGER_INCLUDE_TRIGGER_ALGORITHMPLUGINS_HPP_
13
17#include "trigger/Issues.hpp"
18
19#include "cetlib/BasicPluginFactory.h"
20
21#include <memory>
22#include <string>
23
31inline std::unique_ptr<triggeralgs::TriggerActivityMaker>
32make_ta_maker(std::string const& plugin_name)
33{
35 auto ta_maker = ta_factory->build_maker(plugin_name);
36 if (!ta_maker) {
37 throw MissingFactoryItemError(ERS_HERE, plugin_name);
38 }
39 return ta_maker;
40}
41
42} // namespace dunedaq::trigger
43
44namespace dunedaq::trigger {
51inline std::unique_ptr<triggeralgs::TriggerCandidateMaker>
52make_tc_maker(std::string const& plugin_name)
53{
55 auto tc_maker = tc_factory->build_maker(plugin_name);
56 if (!tc_maker) {
57 throw MissingFactoryItemError(ERS_HERE, plugin_name);
58 }
59 return tc_maker;
60}
61
62} // namespace dunedaq::trigger
63
68// NOLINTNEXTLINE(build/define_used)
69#define DEFINE_DUNE_TD_MAKER(klass) \
70 extern "C" \
71 { \
72 std::unique_ptr<triggeralgs::TriggerDecisionMaker> make() \
73 { \
74 return std::unique_ptr<triggeralgs::TriggerDecisionMaker>(new klass()); \
75 } \
76 }
77
78namespace dunedaq::trigger {
85inline std::unique_ptr<triggeralgs::TriggerDecisionMaker>
86make_td_maker(std::string const& plugin_name)
87{
88 static cet::BasicPluginFactory bpf("duneTDMaker", "make");
89
90 // TODO Philip Rodrigues <philiprodrigues@github.com> Apr-04-2021: Rethrow any cetlib exception as an ERS issue
91 return bpf.makePlugin<std::unique_ptr<triggeralgs::TriggerDecisionMaker>>(plugin_name);
92}
93
94} // namespace dunedaq::trigger
95
96#endif // TRIGGER_INCLUDE_TRIGGER_ALGORITHMPLUGINS_HPP_
#define ERS_HERE
static std::shared_ptr< AbstractFactory< TriggerActivityMaker > > get_instance()
std::unique_ptr< triggeralgs::TriggerCandidateMaker > make_tc_maker(std::string const &plugin_name)
Load a TriggerCandidateMaker plugin and return a unique_ptr to the contained class.
std::unique_ptr< triggeralgs::TriggerActivityMaker > make_ta_maker(std::string const &plugin_name)
Load a TriggerActivityMaker plugin and return a unique_ptr to the contained class.
std::unique_ptr< triggeralgs::TriggerDecisionMaker > make_td_maker(std::string const &plugin_name)
Load a TriggerDecisionMaker plugin and return a unique_ptr to the contained class.