13 using namespace WireCell::SigProc;
18 , m_default_baseline(0.0)
20 , m_default_offset(0.0)
21 , m_default_min_rms(0.5)
22 , m_default_max_rms(10)
25 , m_default_decon_limit(0.02)
26 , m_default_decon_lf_cutoff(0.08)
27 , m_default_adc_limit(15.0)
28 , m_default_decon_limit1(0.08)
29 , m_default_protection_factor(5.0)
30 , m_default_min_adc_limit(50)
31 , m_default_roi_min_max_ratio(0.8)
33 set_sampling(tick, nsamples);
35 SimpleChannelNoiseDB::~SimpleChannelNoiseDB()
43 const int ind =
chind(channel);
44 if (0 <= ind && ind < (
int)
m_baseline.size()) {
52 const int ind =
chind(channel);
53 if (0 <= ind && ind < (
int)
m_gain.size()) {
61 const int ind =
chind(channel);
62 if (0 <= ind && ind < (
int)
m_offset.size()) {
71 const int ind =
chind(channel);
72 if (0 <= ind && ind < (
int)
m_min_rms.size()) {
80 const int ind =
chind(channel);
81 if (0 <= ind && ind < (
int)
m_max_rms.size()) {
91 const int ind =
chind(channel);
92 if (0 <= ind && ind < (
int)
m_pad_f.size()) {
101 const int ind =
chind(channel);
102 if (0 <= ind && ind < (
int)
m_pad_b.size()) {
111 const int ind =
chind(channel);
120 const int ind =
chind(channel);
129 const int ind =
chind(channel);
138 const int ind =
chind(channel);
147 const int ind =
chind(channel);
156 const int ind =
chind(channel);
166 const int ind =
chind(channel);
176 const int ind =
chind(channel);
178 if (0 <= ind && ind < (
int)fv.size()) {
228 spectrum.resize(nsamples,std::complex<float>(1,0));
239 if (ind >= (
int)vec.size()) {
240 vec.resize(ind+1, def);
248 for (
auto ch : channels) {
277 auto filt = std::make_shared<filter_t>(spectrum2);
279 for (
auto ch : channels) {
288 auto filt = std::make_shared<filter_t>(spectrum);
289 for (
auto ch : channels) {
296 double from_gain,
double to_gain,
297 double from_shaping,
double to_shaping)
299 const double gain_ratio = to_gain/from_gain;
322 auto filt = std::make_shared<filter_t>(to_filt);
334 for (
auto ch : channels) {
344 for (
auto ch : channels) {
355 for (
auto ch : channels) {
373 for (
auto ch : channels) {
390 for (
auto ch : channels) {
399 for (
auto ch : channels) {
408 for (
auto ch : channels) {
417 for (
auto ch : channels) {
427 for (
auto ch : channels) {
436 for (
auto ch : channels) {
445 for (
auto ch : channels) {
454 for (
auto ch : channels) {
463 for (
auto ch : channels) {
472 spectrum.resize(
m_nsamples,std::complex<float>(1,0));
474 for (
auto m : masks) {
475 for (
int ind=get<1>(
m); ind <= get<2>(
m); ++ind) {
477 spectrum.at(ind) = get<0>(
m);
481 auto filt = std::make_shared<filter_t>(spectrum);
484 for (
auto ch : channels) {
float m_default_decon_lf_cutoff
std::vector< int > channel_group_t
float m_default_decon_limit1
void set_coherent_nf_decon_lf_cutoff(const std::vector< int > &channels, float decon_lf_cutoff)
void set_coherent_nf_decon_limit(const std::vector< int > &channels, float decon_limit)
virtual int pad_window_back(int channel) const
std::vector< mask_t > multimask_t
void set_one(int ind, T val, std::vector< T > &vec, T def)
void set_gains_shapings(const std::vector< int > &channels, double from_gain_mVfC=7.8, double to_gain_mVfC=14.0, double from_shaping=1.0 *units::us, double to_shaping=2.0 *units::us)
void set_coherent_nf_protection_factor(const std::vector< int > &channels, float protection_factor)
std::vector< double > m_max_rms
void set_max_rms_cut(const std::vector< int > &channels, double max_rms)
virtual const filter_t & config(int channel) const
Return the filter to correct any wrongly configured channels.
std::vector< float > m_protection_factor
void set_coherent_nf_min_adc_limit(const std::vector< int > &channels, float min_adc_limit)
virtual double min_rms_cut(int channel) const
virtual int pad_window_front(int channel) const
void set_coherent_nf_roi_min_max_ratio(const std::vector< int > &channels, float roi_min_max_ratio)
shared_filter_t m_default_filter
void set_max_rms_cut_one(int channel, double max_rms)
void set_nominal_baseline(const std::vector< int > &channels, double baseline)
Set nominal baseline in units of ADC (eg uB is -2048 for U/V, -400 for W)
void set_rcrc_constant(const std::vector< int > &channels, double rcrc=2000.0)
std::vector< double > m_gain
std::vector< double > m_offset
A functional object caching gain and shape.
std::vector< double > m_min_rms
shared_filter_t m_default_response
void set_filter(const std::vector< int > &channels, const multimask_t &mask)
std::vector< float > m_min_adc_limit
void set_min_rms_cut(const std::vector< int > &channels, double min_rms)
float m_default_adc_limit
std::vector< float > m_roi_min_max_ratio
virtual float coherent_nf_roi_min_max_ratio(int channel) const
std::unordered_map< int, int > m_ch2ind
void set_pad_window_front(const std::vector< int > &channels, int pad_f)
virtual const filter_t & response(int channel) const
A nominal detector response spectrum for a given channel.
virtual float coherent_nf_adc_limit(int channel) const
WireCell::Waveform::realseq_t generate(const WireCell::Waveform::Domain &domain, int nsamples)
FIXME: eradicate Domain in favor of Binning.
float m_default_decon_limit
WIRECELL_FACTORY(testChannelNoiseDB, WireCell::SigProc::SimpleChannelNoiseDB, WireCell::IChannelNoiseDatabase) using namespace WireCell
std::vector< float > m_decon_limit
std::vector< float > m_decon_limit1
float m_default_roi_min_max_ratio
void set_min_rms_cut_one(int channel, double min_rms)
void set_response_offset(const std::vector< int > &channels, double offset)
Set a response offset for the given set of channels.
virtual float coherent_nf_decon_limit1(int channel) const
std::vector< double > m_baseline
float m_default_protection_factor
channel_group_t m_bad_channels
void set_coherent_nf_decon_limit1(const std::vector< int > &channels, float decon_limit)
WireCell::Waveform::compseq_t filter_t
The data type for all frequency-space, multiplicative filters.
virtual double max_rms_cut(int channel) const
double m_default_baseline
virtual double response_offset(int channel) const
Return a time offset associated with the response().
virtual float coherent_nf_protection_factor(int channel) const
virtual float coherent_nf_min_adc_limit(int channel) const
void set_response(const std::vector< int > &channels, const filter_t &spectrum)
Set a detector response spectrum for the set of channels.
virtual const filter_t & noise(int channel) const
Return the filter to attenuate noise.
std::vector< float > m_adc_limit
std::shared_ptr< filter_t > shared_filter_t
std::vector< int > m_pad_b
const IChannelNoiseDatabase::filter_t & get_filter(int channel, const filter_vector_t &fv) const
void set_channel_groups(const std::vector< channel_group_t > &channel_groups)
Set the channel groups.
virtual float coherent_nf_decon_limit(int channel) const
std::vector< shared_filter_t > filter_vector_t
std::vector< float > m_decon_lf_cutoff
float m_default_min_adc_limit
void set_pad_window_back(const std::vector< int > &channels, int pad_b)
std::vector< channel_group_t > m_channel_groups
virtual const filter_t & rcrc(int channel) const
Return the filter for the RC+RC coupling response function.
virtual float coherent_nf_decon_lf_cutoff(int channel) const
std::vector< int > m_pad_f
void set_coherent_nf_adc_limit(const std::vector< int > &channels, float adc_limit)
void set_bad_channels(const channel_group_t &bc)
Set "bad" channels.
filter_vector_t m_response
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
void set_sampling(double tick=0.5 *units::us, int nsamples=9600)
virtual double nominal_baseline(int channel) const
Return a nominal baseline correction (additive offset)
virtual double gain_correction(int channel) const