DepoSetFanout.cxx
Go to the documentation of this file.
2 
5 
6 #include <iostream>
7 
10 
11 
12 using namespace WireCell;
13 using namespace std;
14 
15 
16 Gen::DepoSetFanout::DepoSetFanout(size_t multiplicity)
17  : m_multiplicity(multiplicity)
18  , log(Log::logger("glue"))
19 {
20 }
21 
22 Gen::DepoSetFanout::~DepoSetFanout()
23 {
24 }
25 
26 
27 WireCell::Configuration Gen::DepoSetFanout::default_configuration() const
28 {
30  cfg["multiplicity"] = (int)m_multiplicity;
31  return cfg;
32 }
33 
35 {
36  int m = get<int>(cfg, "multiplicity", (int)m_multiplicity);
37  if (m<=0) {
38  log->critical("DepoSetFanout multiplicity must be positive");
39  THROW(ValueError() << errmsg{"DepoSetFanout multiplicity must be positive"});
40  }
41  m_multiplicity = m;
42 }
43 
44 
45 std::vector<std::string> Gen::DepoSetFanout::output_types()
46 {
47  const std::string tname = std::string(typeid(output_type).name());
48  std::vector<std::string> ret(m_multiplicity, tname);
49  return ret;
50 }
51 
52 
53 bool Gen::DepoSetFanout::operator()(const input_pointer& in, output_vector& outv)
54 {
55  // Note: if "in" indicates EOS, just pass it on
56  if (in) {
57  log->debug("DepoSetFanout ({}) fanout data", in->ident());
58  }
59  else {
60  log->debug("DepoSetFanout fanout EOS");
61  }
62 
63  outv.resize(m_multiplicity);
64  for (size_t ind=0; ind<m_multiplicity; ++ind) {
65  outv[ind] = in;
66  }
67  return true;
68 }
static QCString name
Definition: declinfo.cpp:673
static const double m
Definition: Units.h:79
std::string string
Definition: nybbler.cc:12
boost::error_info< struct tag_errmsg, std::string > errmsg
Definition: Exceptions.h:54
STL namespace.
cfg
Definition: dbjson.py:29
def configure(cfg)
Definition: cuda.py:34
WIRECELL_FACTORY(DepoSetFanout, WireCell::Gen::DepoSetFanout, WireCell::IDepoSetFanout, WireCell::IConfigurable) using namespace WireCell
#define THROW(e)
Definition: Exceptions.h:25
std::vector< output_pointer > output_vector
Definition: IFanoutNode.h:45
logptr_t logger(std::string name)
Definition: Logging.cxx:71
Thrown when a wrong value has been encountered.
Definition: Exceptions.h:37
void log(source_loc source, level::level_enum lvl, const char *fmt, const Args &...args)
Definition: spdlog.h:165
Definition: Main.h:22
std::shared_ptr< const IDepoSet > input_pointer
Definition: IFanoutNode.h:43
Json::Value Configuration
Definition: Configuration.h:50