Functions
test_filter.cxx File Reference
#include "WireCellUtil/Units.h"
#include "WireCellUtil/Testing.h"
#include "WireCellUtil/PluginManager.h"
#include "WireCellUtil/NamedFactory.h"
#include "WireCellIface/IFilterWaveform.h"
#include "WireCellIface/IConfigurable.h"
#include "WireCellUtil/Waveform.h"
#include "TFile.h"
#include "TGraph.h"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 18 of file test_filter.cxx.

18  {
19 
20  const std::string ncr_tn = "LfFilter";
21  const std::string ncr_tn1 = "HfFilter";
22  {
24  pm.add("WireCellSigProc");
25 
26 
27  auto incrcfg = Factory::lookup<IConfigurable>(ncr_tn,"lf1");
28  auto cfg = incrcfg->default_configuration();
29  cfg["nbins"] = 9594;
30  cfg["max_freq"] = 1 * units::megahertz;
31  cfg["tau"] = 0.02 * units::megahertz;
32  incrcfg->configure(cfg);
33 
34  }
35 
36  {
37  auto incrcfg = Factory::lookup<IConfigurable>(ncr_tn1,"hf1");
38  auto cfg = incrcfg->default_configuration();
39  cfg["nbins"] = 9594;
40  cfg["max_freq"] = 1 * units::megahertz;
41  cfg["sigma"] = 4 * units::megahertz;
42  cfg["power"] = 2;
43  cfg["flag"] = true;
44  incrcfg->configure(cfg);
45 
46  }
47 
48  auto ncr = Factory::find<IFilterWaveform>(ncr_tn,"lf1");
49  auto ncr1 = Factory::find<IFilterWaveform>(ncr_tn1,"hf1");
50 
51  const int nfbins = 100;
52  auto wfs = ncr->filter_waveform(nfbins);
53  auto wfs1 = ncr1->filter_waveform(nfbins);
54 
55  TFile *file = new TFile(Form("%s.root", argv[0]),"RECREATE");
56  TGraph *g1 = new TGraph();
57  TGraph *g2 = new TGraph();
58  for (size_t i=0;i!=wfs.size();i++){
59  g1->SetPoint(i,i,wfs.at(i));
60  g2->SetPoint(i,i,wfs1.at(i));
61  }
62  g1->Write("g1");
63  g2->Write("g2");
64  file->Write();
65  file->Close();
66 
67  return 0;
68 }
Definition: posix.h:188
std::string string
Definition: nybbler.cc:12
const std::string instance
cfg
Definition: dbjson.py:29
megahertz_as<> megahertz
Type of frequency stored in megahertz, in double precision.
Definition: frequency.h:101
Plugin * add(const std::string &plugin_name, const std::string &libname="")
Add a plugin. If libname is not given, try to derive it.