5 #include "WireCellUtil/NamedFactory.h" 21 void wcls::MultiChannelNoiseDB::MultiChannelNoiseDB::visit(
art::Event &
event)
24 if (one.check(event)) {
37 THROW(KeyError() << errmsg{
"MultiChannelNoiseDB: no matching rule for event, consider 'bool' catch all in config"});
43 : ok(jargs.asBool()) {}
52 first = jargs[
"first"].asInt();
53 last = jargs[
"last"].asInt();
56 int run =
event.run();
57 return first <= run and run <= last;
62 std::unordered_set<int>
runs;
64 for (
auto j : jargs) {
65 runs.insert(j.asInt());
69 int run =
event.run();
70 return runs.find(run) != runs.end();
80 int thisrun =
event.run();
81 return thisrun >=
run;
90 int thisrun =
event.run();
97 for (
auto jrule : cfg[
"rules"]) {
98 auto rule = jrule[
"rule"].asString();
99 auto tn = jrule[
"chndb"].asString();
100 std::cerr <<
"\tMultiChannelNoiseDB: " << tn <<
" using rule: " << rule <<
std::endl;
101 auto chndb = Factory::find_tn<IChannelNoiseDatabase>(tn);
103 THROW(KeyError() << errmsg{
"Failed to find (sub) channel noise DB object: " + tn});
105 IArtEventVisitor::pointer visitor = Factory::find_maybe_tn<IArtEventVisitor>(tn);
106 auto jargs = jrule[
"args"];
107 if (rule ==
"runrange") {
111 if (rule ==
"runlist") {
115 if (rule ==
"runstarting") {
119 if (rule ==
"runbefore") {
124 if (rule ==
"bool") {
128 THROW(KeyError() << errmsg{
"Unknown multi channel noise DB rule: " + rule});
156 cfg[
"rules"] = Json::arrayValue;
WireCell::IChannelNoiseDatabase::pointer m_pimpl
WIRECELL_FACTORY(wclsMultiChannelNoiseDB, wcls::MultiChannelNoiseDB, wcls::IArtEventVisitor, WireCell::IChannelNoiseDatabase, WireCell::IConfigurable) using namespace WireCell
ReturnBool(Json::Value jargs)
IArtEventVisitor::pointer m_pimpl_visitor
RunStarting(Json::Value jargs)
std::unordered_set< int > runs
virtual ~MultiChannelNoiseDB()
bool operator()(art::Event &event)
RunList(Json::Value jargs)
bool operator()(art::Event &event)
bool operator()(art::Event &event)
RunBefore(Json::Value jargs)
bool operator()(art::Event &event)
RunRange(Json::Value jargs)
bool operator()(art::Event &)
QTextStream & endl(QTextStream &s)
Event finding and building.