SliceFanout.cxx
Go to the documentation of this file.
2 
5 
8 
9 
10 using namespace WireCell;
11 
12 Img::SliceFanout::SliceFanout(size_t multiplicity)
13  : m_multiplicity(multiplicity)
14  , l(Log::logger("glue"))
15 {
16 }
17 Img::SliceFanout::~SliceFanout()
18 {
19 }
20 
21 WireCell::Configuration Img::SliceFanout::default_configuration() const
22 {
24  // How many output ports
25  cfg["multiplicity"] = (int)m_multiplicity;
26  return cfg;
27 }
29 {
30  int m = get<int>(cfg, "multiplicity", (int)m_multiplicity);
31  if (m<=0) {
32  l->critical("SliceFanout multiplicity must be positive");
33  THROW(ValueError() << errmsg{"SliceFanout multiplicity must be positive"});
34  }
35  m_multiplicity = m;
36 }
37 
38 
39 std::vector<std::string> Img::SliceFanout::output_types()
40 {
41  const std::string tname = std::string(typeid(output_type).name());
42  std::vector<std::string> ret(m_multiplicity, tname);
43  return ret;
44 }
45 
46 
47 bool Img::SliceFanout::operator()(const input_pointer& in, output_vector& outv)
48 {
49  outv.resize(m_multiplicity);
50 
51  if (!in) {
52  SPDLOG_LOGGER_TRACE(l,"SliceFanout: sending out {} EOSes", m_multiplicity);
53  for (size_t ind=0; ind<m_multiplicity; ++ind) {
54  outv[ind] = nullptr;
55  }
56  return true;
57  }
58 
59  SPDLOG_LOGGER_TRACE(l, "SliceFanout: {}x of #{} t={} + {} in nchan={}",
60  m_multiplicity, in->ident(), in->start(), in->span(),
61  in->activity().size());
62 
63  for (size_t ind=0; ind<m_multiplicity; ++ind) {
64  outv[ind] = in;
65  }
66  return true;
67 }
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
cfg
Definition: dbjson.py:29
static QStrList * l
Definition: config.cpp:1044
def configure(cfg)
Definition: cuda.py:34
#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
Definition: Main.h:22
std::shared_ptr< const ISlice > input_pointer
Definition: IFanoutNode.h:43
#define SPDLOG_LOGGER_TRACE(logger,...)
Definition: spdlog.h:319
WIRECELL_FACTORY(SliceFanout, WireCell::Img::SliceFanout, WireCell::ISliceFanout, WireCell::IConfigurable) using namespace WireCell
Json::Value Configuration
Definition: Configuration.h:50