HfFilter.cxx
Go to the documentation of this file.
2 
4 
7 
8 
9 using namespace WireCell;
10 
11 SigProc::HfFilter::HfFilter(double max_freq, double sigma, double power, bool flag)
12  : m_max_freq(max_freq)
13  , m_sigma(sigma)
14  , m_power(power)
15  , m_flag(flag)
16 {
17 }
18 
19 SigProc::HfFilter::~HfFilter()
20 {
21 }
22 
23 WireCell::Configuration SigProc::HfFilter::default_configuration() const
24 {
26  cfg["sigma"] = m_sigma;
27  cfg["power"] = m_power;
28  cfg["flag"] = m_flag;
29  cfg["max_freq"] = m_max_freq;
30  return cfg;
31 }
32 
34 {
35  m_sigma = get(cfg,"sigma",m_sigma);
36  m_power = get(cfg,"power",m_power);
37  m_flag = get(cfg,"flag",m_flag);
38 
39  m_max_freq = get(cfg,"max_freq",m_max_freq);
40 }
41 
42 
43 const Waveform::realseq_t SigProc::HfFilter::filter_waveform(int nbins) const
44 {
45  Waveform::realseq_t m_wfs(nbins);
46 
47  Response::HfFilter hf_filter(m_sigma,m_power,m_flag);
48 
49  for (size_t i=0; i!=m_wfs.size();i++){
50  double freq = i * 1.0 / int(m_wfs.size()) * 2 * m_max_freq;
51  if (freq > m_max_freq)
52  freq = freq - 2*m_max_freq;
53  m_wfs.at(i) = hf_filter(fabs(freq));
54  }
55  // std::cout << m_wfs.size() << std::endl;
56 
57  return m_wfs;
58 }
WIRECELL_FACTORY(HfFilter, WireCell::SigProc::HfFilter, WireCell::IFilterWaveform, WireCell::IConfigurable) using namespace WireCell
Sequence< real_t > realseq_t
Definition: Waveform.h:31
cfg
Definition: dbjson.py:29
def configure(cfg)
Definition: cuda.py:34
Definition: Main.h:22
double hf_filter(double freq, double sigma=1, double power=2, bool zero_freq_removal=true)
Definition: Response.cxx:377
Json::Value Configuration
Definition: Configuration.h:50