3 #include "art/Framework/Principal/Event.h"
5 #include "WireCellUtil/NamedFactory.h"
11 using namespace WireCell;
21 void wcls::MultiChannelNoiseDB::MultiChannelNoiseDB::visit(art::Event & event)
23 for (
auto one : m_rules) {
24 if (
one.check(event)) {
30 m_pimpl_visitor =
one.visitor;
31 if (m_pimpl_visitor) {
32 m_pimpl_visitor->visit(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();
62 std::unordered_set<int>
runs;
64 for (
auto j : jargs) {
65 runs.insert(j.asInt());
69 int run =
event.run();
80 int thisrun =
event.run();
81 return thisrun >= run;
90 int thisrun =
event.run();
95 void wcls::MultiChannelNoiseDB::MultiChannelNoiseDB::configure(
const WireCell::Configuration& cfg)
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") {
108 m_rules.push_back(SubDB(
RunRange(jargs), chndb, visitor));
111 if (rule ==
"runlist") {
112 m_rules.push_back(SubDB(
RunList(jargs), chndb, visitor));
115 if (rule ==
"runstarting") {
116 m_rules.push_back(SubDB(
RunStarting(jargs), chndb, visitor));
119 if (rule ==
"runbefore") {
120 m_rules.push_back(SubDB(
RunBefore(jargs), chndb, visitor));
124 if (rule ==
"bool") {
125 m_rules.push_back(SubDB(
ReturnBool(jargs), chndb, visitor));
128 THROW(KeyError() << errmsg{
"Unknown multi channel noise DB rule: " + rule});
153 WireCell::Configuration wcls::MultiChannelNoiseDB::MultiChannelNoiseDB::default_configuration()
const
156 cfg[
"rules"] = Json::arrayValue;
BEGIN_PROLOG could also be cerr
ReturnBool(Json::Value jargs)
RunStarting(Json::Value jargs)
then echo fcl sbnd_project sbnd_project sbnd_project sbnd_project production production runs
std::unordered_set< int > runs
virtual ~MultiChannelNoiseDB()
bool operator()(art::Event &event)
return match has_match and(match.match_pdg==11 or match.match_pdg==-11)
RunList(Json::Value jargs)
WIRECELL_FACTORY(wclsChannelNoiseDB, wcls::ChannelNoiseDB, wcls::IArtEventVisitor, WireCell::IChannelNoiseDatabase) using namespace WireCell
bool operator()(art::Event &event)
bool operator()(art::Event &event)
then echo Cowardly refusing to create a new FHiCL file with the same name as the original one('${SourceName}')." >&2 exit 1 fi echo "'$
RunBefore(Json::Value jargs)
bool operator()(art::Event &event)
RunRange(Json::Value jargs)
bool operator()(art::Event &)