41 #include "WireCellUtil/NamedFactory.h"
47 using namespace WireCell;
50 : OmniChannelNoiseDB()
51 , m_bad_channel_policy(kNothing)
52 , m_misconfig_channel_policy(kNothing)
62 if ((!m_bad_channel_policy) && (!m_misconfig_channel_policy)) {
69 auto const& gc = *lar::providerFrom<geo::Geometry>();
70 auto nchans = gc.Nchannels();
73 if (m_bad_channel_policy) {
74 auto const& csvc = art::ServiceHandle<lariov::ChannelStatusService const>()->GetProvider();
76 std::vector<int> bad_channels;
77 for(
size_t ich=0; ich<nchans; ++ich) {
78 if (csvc.IsBad(ich)) {
79 bad_channels.push_back(ich);
82 OmniChannelNoiseDB::set_bad_channels(bad_channels);
85 if (m_misconfig_channel_policy) {
86 const auto& esvc = art::ServiceHandle<lariov::ElectronicsCalibService const>()->GetProvider();
88 std::vector<int> mc_channels;
89 for(
size_t ich=0; ich<nchans; ++ich) {
90 if (esvc.ExtraInfo(ich).GetBoolData(
"is_misconfigured")) {
91 mc_channels.push_back(ich);
94 OmniChannelNoiseDB::set_misconfigured(mc_channels, m_fgstgs[0], m_fgstgs[1], m_fgstgs[2], m_fgstgs[3]);
102 THROW(ValueError() << errmsg{
"ChannelNoiseDB: empty override policy given"});
105 std::string pol = jpol.asString();
107 if (pol ==
"union") {
111 if (pol ==
"replace") {
115 THROW(ValueError() << errmsg{
"ChannelNoiseDB: unknown override policy given: " + pol});
121 OmniChannelNoiseDB::configure(cfg);
123 auto jbc = cfg[
"bad_channel"];
125 m_bad_channel_policy = parse_policy(jbc[
"policy"]);
128 auto jmc = cfg[
"misconfig_channel"];
130 m_misconfig_channel_policy = parse_policy(jmc[
"policy"]);
133 m_fgstgs[0] = jmc[
"from"][
"gain"].asDouble();
134 m_fgstgs[1] = jmc[
"from"][
"shaping"].asDouble();
135 m_fgstgs[2] = jmc[
"to"][
"gain"].asDouble();
136 m_fgstgs[3] = jmc[
"to"][
"shaping"].asDouble();
virtual void configure(const WireCell::Configuration &config)
IConfigurable.
virtual ~ChannelNoiseDB()
OverridePolicy_t
All IChannelNoiseDatabase interface is defered to parent.
Interface for experiment-specific service for pmt gain info.
OverridePolicy_t parse_policy(const WireCell::Configuration &jpol)
WIRECELL_FACTORY(wclsChannelNoiseDB, wcls::ChannelNoiseDB, wcls::IArtEventVisitor, WireCell::IChannelNoiseDatabase) using namespace WireCell
Interface for experiment-specific channel quality info provider.
Interface for experiment-specific service for channel quality info.
virtual void visit(art::Event &event)
IArtEventVisitor.
art framework interface to geometry description