10 #include <unordered_set> 29 Gen::Reframer::~Reframer()
39 cfg[
"tags"] = Json::arrayValue;
50 const std::string anode_tn = cfg[
"anode"].asString();
51 log->debug(
"Gen::Reframer: using anode: \"{}\"", anode_tn);
52 m_anode = Factory::find_tn<IAnodePlane>(anode_tn);
55 for (
auto jtag : cfg[
"tags"]) {
75 std::map<int, std::vector<float> > waves;
78 for (
auto chid :
m_anode->channels()) {
83 std::vector<ITrace::pointer> traces;
84 auto all_traces = inframe->traces();
86 traces.insert(traces.begin(), all_traces->begin(), all_traces->end());
90 std::unordered_set<int> trace_indices;
95 for (
int ind : trace_indices) {
96 traces.push_back(all_traces->at(ind));
101 for (
auto trace : traces) {
102 const int chid =
trace->channel();
104 const int tbin_in =
trace->tbin();
105 auto in_it =
trace->charge().begin();
107 auto& wave = waves[chid];
108 auto out_it = wave.begin();
110 const int delta_tbin =
m_tbin - tbin_in;
111 if (delta_tbin > 0) {
115 out_it += -delta_tbin;
119 const auto in_end =
trace->charge().end();
120 const auto out_end = wave.end();
121 while (in_it < in_end and out_it < out_end) {
131 for (
auto& it : waves) {
132 const int chid = it.first;
133 auto& wave = it.second;
134 auto out_trace = make_shared<SimpleTrace>(chid, 0, wave);
135 out_traces.push_back(out_trace);
138 outframe = make_shared<SimpleFrame>(inframe->ident(),
142 log->debug(
"Gen::Reframer: frame {} {} traces, {} ticks",
143 inframe->ident(), out_traces.size(),
m_nticks);
virtual bool operator()(const input_pointer &inframe, output_pointer &outframe)
The calling signature:
std::vector< std::string > m_input_tags
virtual WireCell::Configuration default_configuration() const
Optional, override to return a hard-coded default configuration.
std::vector< pointer > vector
std::shared_ptr< const IFrame > input_pointer
WIRECELL_FACTORY(Reframer, WireCell::Gen::Reframer, WireCell::IFrameFilter, WireCell::IConfigurable) using namespace std
constexpr std::array< std::size_t, geo::vect::dimension< Vector >)> indices()
Returns a sequence of indices valid for a vector of the specified type.
std::shared_ptr< const IFrame > output_pointer
logptr_t logger(std::string name)
void log(source_loc source, level::level_enum lvl, const char *fmt, const Args &...args)
IAnodePlane::pointer m_anode
Json::Value Configuration
virtual void configure(const WireCell::Configuration &config)
Accept a configuration.