16 : m_multiplicity(multiplicity)
19 Gen::FrameFanin::~FrameFanin()
26 cfg[
"multiplicity"] = (
int)m_multiplicity;
33 cfg[
"tags"] = Json::arrayValue;
40 cfg[
"tag_rules"] = Json::arrayValue;
46 int m = get<int>(
cfg,
"multiplicity", (
int)m_multiplicity);
54 auto jtags = cfg[
"tags"];
55 for (
int ind=0; ind<
m; ++ind) {
56 m_tags[ind] = convert<std::string>(jtags[ind],
"");
60 m_ft.configure(cfg[
"tag_rules"]);
64 std::vector<std::string> Gen::FrameFanin::input_types()
67 std::vector<std::string> ret(m_multiplicity, tname);
76 for (
const auto& fr : invec) {
81 if (neos == invec.size()) {
85 std::cerr <<
"Gen::FrameFanin: " << neos <<
" input frames missing\n";
88 if (invec.size() != m_multiplicity) {
89 std::cerr <<
"Gen::FrameFanin: got unexpected multiplicity, got:" 90 << invec.size() <<
" want:" << m_multiplicity <<
std::endl;
95 std::vector<IFrame::trace_list_t> by_port(m_multiplicity);
98 std::vector< std::tuple<tagrules::tag_t, IFrame::trace_list_t, IFrame::trace_summary_t> > stash;
103 for (
size_t iport=0; iport < m_multiplicity; ++iport) {
104 const size_t trace_offset = out_traces.size();
106 const auto& fr = invec[iport];
107 if (!one) { one = fr; }
108 auto traces = fr->traces();
112 auto fintags = fr->frame_tags();
113 fintags.push_back(
"");
114 auto fo = m_ft.transform(iport,
"frame", fintags);
115 fouttags.insert(fo.begin(), fo.end());
120 for (
auto inttag : fr->trace_tags()) {
122 if (touttags.empty()) {
131 const auto&
summary = fr->trace_summary(inttag);
133 for (
size_t trind : fr->tagged_traces(inttag)) {
134 outtrinds.push_back(trind + trace_offset);
136 for (
auto ot : touttags) {
138 stash.push_back(std::make_tuple(ot, outtrinds,
summary));
143 if (! m_tags[iport].
empty() ) {
145 std::iota(tl.begin(), tl.end(), trace_offset);
150 out_traces.insert(out_traces.end(), traces->begin(), traces->end());
153 auto sf =
new SimpleFrame(one->ident(), one->time(), out_traces, one->tick());
154 for (
size_t iport=0; iport < m_multiplicity; ++iport) {
155 if (m_tags[iport].
size()) {
158 sf->
tag_traces(m_tags[iport], by_port[iport]);
161 for (
auto ftag : fouttags) {
165 for (
auto ttt : stash) {
168 sf->tag_traces(get<0>(ttt), get<1>(ttt), get<2>(ttt));
std::shared_ptr< const IFrame > pointer
std::vector< input_pointer > input_vector
std::unordered_set< tag_t > tagset_t
void tag_traces(const tag_t &tag, const IFrame::trace_list_t &indices, const IFrame::trace_summary_t &summary=IFrame::trace_summary_t(0))
boost::error_info< struct tag_errmsg, std::string > errmsg
std::vector< pointer > vector
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
WIRECELL_FACTORY(FrameFanin, WireCell::Gen::FrameFanin, WireCell::IFrameFanin, WireCell::IConfigurable) using namespace WireCell
Thrown when a wrong value has been encountered.
Json::Value Configuration
std::shared_ptr< const IFrame > output_pointer
const GenericPointer< typename T::ValueType > & pointer
std::vector< size_t > trace_list_t
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
QTextStream & endl(QTextStream &s)