15 : m_multiplicity(multiplicity)
19 SigProc::ChannelSplitter::~ChannelSplitter()
28 cfg[
"anodes"] = Json::arrayValue;
34 cfg[
"tag_rules"] = Json::arrayValue;
42 for (
auto janode : cfg[
"anodes"]) {
43 auto anode = Factory::find_tn<IAnodePlane>(janode.asString());
44 for (
auto c : anode->channels()) {
45 m_c2p[
c] = m_multiplicity;
52 m_ft.configure(cfg[
"tag_rules"]);
56 std::vector<std::string> SigProc::ChannelSplitter::output_types()
59 std::vector<std::string> ret(m_multiplicity, tname);
66 outv.resize(m_multiplicity);
69 for (
size_t ind=0; ind < m_multiplicity; ++ind) {
72 log->debug(
"ChannelSplitter: see EOS");
76 std::vector<ITrace::vector> port_traces(m_multiplicity);
78 for (
const auto& itrace : *(in->traces())) {
79 int chan = itrace->channel();
80 const auto& it = m_c2p.find(chan);
81 if (it == m_c2p.end()) {
82 log->debug(
"ChannelSplitter: no port for channel {}, dropping", chan);
85 const int port = it->second;
86 port_traces[port].push_back(itrace);
89 auto fintags = in->frame_tags();
90 std::stringstream taginfo;
91 for (
size_t iport=0; iport<m_multiplicity; ++iport) {
94 auto sfout =
new SimpleFrame(in->ident(), in->time(), port_traces[iport], in->tick());
97 auto fouttags = m_ft.transform(iport,
"frame", fintags);
99 for (
auto ftag : fouttags) {
101 taginfo <<
" ftag:" << ftag;
104 for (
auto inttag : in->trace_tags()) {
106 if (touttags.empty()) {
109 const auto& traces = in->tagged_traces(inttag);
110 const auto&
summary = in->trace_summary(inttag);
111 for (
auto otag : touttags) {
112 sfout->tag_traces(otag, traces,
summary);
113 taginfo <<
" " << inttag <<
"->" << otag;
121 if (!tagmsg.empty()) {
122 log->debug(
"ChannelSplitter: tagnifo:{}", taginfo.str());
std::unordered_set< tag_t > tagset_t
boost::error_info< struct tag_errmsg, std::string > errmsg
WIRECELL_FACTORY(ChannelSplitter, WireCell::SigProc::ChannelSplitter, WireCell::IFrameFanout, WireCell::IConfigurable) using namespace WireCell
void tag_frame(const tag_t &tag)
std::vector< output_pointer > output_vector
logptr_t logger(std::string name)
Thrown when a wrong value has been encountered.
void log(source_loc source, level::level_enum lvl, const char *fmt, const Args &...args)
std::shared_ptr< const IFrame > input_pointer
Json::Value Configuration
const GenericPointer< typename T::ValueType > & pointer