Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
wcls::ChannelNoiseDB Class Reference

#include <ChannelNoiseDB.h>

Inheritance diagram for wcls::ChannelNoiseDB:
wcls::IArtEventVisitor wcls::ChannelSelectorDB

Public Member Functions

 ChannelNoiseDB ()
 
virtual ~ChannelNoiseDB ()
 
virtual void visit (art::Event &event)
 IArtEventVisitor. More...
 
virtual void configure (const WireCell::Configuration &config)
 IConfigurable. More...
 
- Public Member Functions inherited from wcls::IArtEventVisitor
virtual ~IArtEventVisitor ()
 
virtual void produces (art::ProducesCollector &collector)
 

Private Types

enum  OverridePolicy_t { kNothing = 0, kReplace, kUnion }
 All IChannelNoiseDatabase interface is defered to parent. More...
 

Private Member Functions

OverridePolicy_t parse_policy (const WireCell::Configuration &jpol)
 

Private Attributes

OverridePolicy_t m_bad_channel_policy
 
OverridePolicy_t m_misconfig_channel_policy
 
double m_fgstgs [4]
 

Detailed Description

Definition at line 9 of file ChannelNoiseDB.h.

Member Enumeration Documentation

All IChannelNoiseDatabase interface is defered to parent.

Enumerator
kNothing 
kReplace 
kUnion 

Definition at line 36 of file ChannelNoiseDB.h.

36  {
37  kNothing = 0, // this class leaves info untouched.
38  kReplace, // this class replaces all parent info with what is given by service.
39  kUnion // this class adds to parent only for channels given by service.
40  };

Constructor & Destructor Documentation

wcls::ChannelNoiseDB::ChannelNoiseDB ( )

Definition at line 49 of file ChannelNoiseDB.cxx.

50  : OmniChannelNoiseDB()
53 {
54 }
OverridePolicy_t m_bad_channel_policy
OverridePolicy_t m_misconfig_channel_policy
wcls::ChannelNoiseDB::~ChannelNoiseDB ( )
virtual

Definition at line 56 of file ChannelNoiseDB.cxx.

57 {
58 }

Member Function Documentation

void wcls::ChannelNoiseDB::configure ( const WireCell::Configuration &  config)
virtual

IConfigurable.

Reimplemented in wcls::ChannelSelectorDB.

Definition at line 118 of file ChannelNoiseDB.cxx.

119 {
120  // forward
121  OmniChannelNoiseDB::configure(cfg);
122 
123  auto jbc = cfg["bad_channel"];
124  if (!jbc.empty()) {
125  m_bad_channel_policy = parse_policy(jbc["policy"]);
126  }
127 
128  auto jmc = cfg["misconfig_channel"];
129  if (!jmc.empty()) {
130  m_misconfig_channel_policy = parse_policy(jmc["policy"]);
131 
132  // stash this for later
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();
137  }
138 }
OverridePolicy_t m_bad_channel_policy
OverridePolicy_t m_misconfig_channel_policy
OverridePolicy_t parse_policy(const WireCell::Configuration &jpol)
wcls::ChannelNoiseDB::OverridePolicy_t wcls::ChannelNoiseDB::parse_policy ( const WireCell::Configuration &  jpol)
private

Definition at line 99 of file ChannelNoiseDB.cxx.

100 {
101  if (jpol.empty()) {
102  THROW(ValueError() << errmsg{"ChannelNoiseDB: empty override policy given"});
103  }
104 
105  std::string pol = jpol.asString();
106 
107  if (pol == "union") {
108  return kUnion;
109  }
110 
111  if (pol == "replace") {
112  return kReplace;
113  }
114 
115  THROW(ValueError() << errmsg{"ChannelNoiseDB: unknown override policy given: " + pol});
116 }
std::string string
Definition: nybbler.cc:12
void wcls::ChannelNoiseDB::visit ( art::Event event)
virtual

IArtEventVisitor.

Implements wcls::IArtEventVisitor.

Reimplemented in wcls::ChannelSelectorDB.

Definition at line 60 of file ChannelNoiseDB.cxx.

61 {
63  return; // no override
64  }
65 
66  // FIXME: the current assumption in this code is that LS channel
67  // numbers are identified with WCT channel IDs. For MicroBooNE
68  // this holds but in general some translation is needed here.
69  auto const& gc = *lar::providerFrom<geo::Geometry>();
70  auto nchans = gc.Nchannels();
71 
72 
74  auto const& csvc = art::ServiceHandle<lariov::ChannelStatusService const>()->GetProvider();
75 
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);
80  }
81  }
82  OmniChannelNoiseDB::set_bad_channels(bad_channels);
83  }
84 
86  const auto& esvc = art::ServiceHandle<lariov::ElectronicsCalibService const>()->GetProvider();
87 
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);
92  }
93  }
94  OmniChannelNoiseDB::set_misconfigured(mc_channels, m_fgstgs[0], m_fgstgs[1], m_fgstgs[2], m_fgstgs[3]);
95  }
96 }
OverridePolicy_t m_bad_channel_policy
OverridePolicy_t m_misconfig_channel_policy

Member Data Documentation

OverridePolicy_t wcls::ChannelNoiseDB::m_bad_channel_policy
private

Definition at line 46 of file ChannelNoiseDB.h.

double wcls::ChannelNoiseDB::m_fgstgs[4]
private

Definition at line 48 of file ChannelNoiseDB.h.

OverridePolicy_t wcls::ChannelNoiseDB::m_misconfig_channel_policy
private

Definition at line 47 of file ChannelNoiseDB.h.


The documentation for this class was generated from the following files: