Public Member Functions | List of all members
WireCell::SigProc::Microboone::CoherentNoiseSub Class Reference

#include <Microboone.h>

Inheritance diagram for WireCell::SigProc::Microboone::CoherentNoiseSub:
WireCell::IChannelFilter WireCell::SigProc::Microboone::ConfigFilterBase WireCell::IComponent< IChannelFilter > WireCell::IConfigurable WireCell::Interface WireCell::IComponent< IConfigurable > WireCell::Interface

Public Member Functions

 CoherentNoiseSub (const std::string &anode="AnodePlane", const std::string &noisedb="OmniChannelNoiseDB")
 
virtual ~CoherentNoiseSub ()
 
virtual WireCell::Waveform::ChannelMaskMap apply (int channel, signal_t &sig) const
 
virtual WireCell::Waveform::ChannelMaskMap apply (channel_signals_t &chansig) const
 
- Public Member Functions inherited from WireCell::IChannelFilter
virtual ~IChannelFilter ()
 
- Public Member Functions inherited from WireCell::IComponent< IChannelFilter >
virtual ~IComponent ()
 
- Public Member Functions inherited from WireCell::Interface
virtual ~Interface ()
 
- Public Member Functions inherited from WireCell::SigProc::Microboone::ConfigFilterBase
 ConfigFilterBase (const std::string &anode="AnodePlane", const std::string &noisedb="OmniChannelNoiseDB")
 
virtual ~ConfigFilterBase ()
 
virtual void configure (const WireCell::Configuration &config)
 IConfigurable configuration interface. More...
 
virtual WireCell::Configuration default_configuration () const
 Optional, override to return a hard-coded default configuration. More...
 
void set_channel_noisedb (WireCell::IChannelNoiseDatabase::pointer ndb)
 
- Public Member Functions inherited from WireCell::IConfigurable
virtual ~IConfigurable ()
 
- Public Member Functions inherited from WireCell::IComponent< IConfigurable >
virtual ~IComponent ()
 

Additional Inherited Members

- Public Types inherited from WireCell::IChannelFilter
typedef Waveform::realseq_t signal_t
 
typedef std::map< int, signal_tchannel_signals_t
 
- Public Types inherited from WireCell::IComponent< IChannelFilter >
typedef std::shared_ptr< IChannelFilterpointer
 Access subclass facet by pointer. More...
 
typedef std::vector< pointervector
 Vector of shared pointers. More...
 
- Public Types inherited from WireCell::Interface
typedef std::shared_ptr< Interfacepointer
 
- Public Types inherited from WireCell::IComponent< IConfigurable >
typedef std::shared_ptr< IConfigurablepointer
 Access subclass facet by pointer. More...
 
typedef std::vector< pointervector
 Vector of shared pointers. More...
 
- Protected Attributes inherited from WireCell::SigProc::Microboone::ConfigFilterBase
std::string m_anode_tn
 
std::string m_noisedb_tn
 
IAnodePlane::pointer m_anode
 
IChannelNoiseDatabase::pointer m_noisedb
 

Detailed Description

Microboone style coherent noise subtraction.

Fixme: in principle, this class could be general purpose for other detectors. However, it uses the functions above which hard code microboone-isms. If those microboone-specific parameters can be pulled out to a higher layer then this class can become generic and move outside of this file.

Definition at line 67 of file Microboone.h.

Constructor & Destructor Documentation

Microboone::CoherentNoiseSub::CoherentNoiseSub ( const std::string anode = "AnodePlane",
const std::string noisedb = "OmniChannelNoiseDB" 
)

Definition at line 871 of file Microboone.cxx.

872  : ConfigFilterBase(anode, noisedb) {}
ConfigFilterBase(const std::string &anode="AnodePlane", const std::string &noisedb="OmniChannelNoiseDB")
Definition: Microboone.cxx:849
Microboone::CoherentNoiseSub::~CoherentNoiseSub ( )
virtual

Definition at line 873 of file Microboone.cxx.

873 {}

Member Function Documentation

WireCell::Waveform::ChannelMaskMap Microboone::CoherentNoiseSub::apply ( int  channel,
signal_t sig 
) const
virtual

Filter in place the signal sig from given channel.

Implements WireCell::IChannelFilter.

Definition at line 947 of file Microboone.cxx.

948 {
949  return WireCell::Waveform::ChannelMaskMap(); // not implemented
950 }
std::map< std::string, ChannelMasks > ChannelMaskMap
Collect channel masks by some label.
Definition: Waveform.h:59
WireCell::Waveform::ChannelMaskMap Microboone::CoherentNoiseSub::apply ( channel_signals_t chansig) const
virtual

Filter in place a group of signals together.

Implements WireCell::IChannelFilter.

Definition at line 876 of file Microboone.cxx.

877 {
878  //std::cout << "Xin2: " << " " << chansig.size() << std::endl;
879  // find the median among all
881 
882  // std::cout << medians.size() << " " << medians.at(100) << " " << medians.at(101) << std::endl;
883 
884 
885  // For Xin: here is how you can get the response spectrum for this group.
886  const int achannel = chansig.begin()->first;
887 
888  //std::cerr << "CoherentNoiseSub: ch=" << achannel << " response offset:" << m_noisedb->response_offset(achannel) << std::endl;
889 
890  const Waveform::compseq_t& respec = m_noisedb->response(achannel);
891  const int res_offset = m_noisedb->response_offset(achannel);
892  const int pad_f = m_noisedb->pad_window_front(achannel);
893  const int pad_b = m_noisedb->pad_window_back(achannel);
894 
895  // need to move these to data base, consult with Brett ...
896  // also need to be time dependent ...
897  const float decon_limit = m_noisedb->coherent_nf_decon_limit(achannel);// 0.02;
898  const float decon_lf_cutoff = m_noisedb->coherent_nf_decon_lf_cutoff(achannel);
899  const float adc_limit = m_noisedb->coherent_nf_adc_limit(achannel);//15;
900  const float decon_limit1 = m_noisedb->coherent_nf_decon_limit1(achannel);// 0.08; // loose filter
901  const float roi_min_max_ratio = m_noisedb->coherent_nf_roi_min_max_ratio(achannel);// 0.8 default
902 
903  const float protection_factor = m_noisedb->coherent_nf_protection_factor(achannel);
904  const float min_adc_limit = m_noisedb->coherent_nf_min_adc_limit(achannel);
905 
906  // std::cout << decon_limit << " " << adc_limit << " " << protection_factor << " " << min_adc_limit << std::endl;
907 
908  // if (respec.size()) {
909  // now, apply the response spectrum to deconvolve the median
910  // and apply the special protection or pass respec into
911  // SignalProtection().
912  //}
913 
914  //std::cout << achannel << std::endl;
915 
916  // do the signal protection and adaptive baseline
917  std::vector< std::vector<int> > rois = Microboone::SignalProtection(medians,respec,res_offset,pad_f,pad_b,decon_limit, decon_lf_cutoff, adc_limit, protection_factor, min_adc_limit);
918 
919  // if (achannel == 3840){
920  // std::cout << "Xin1: " << rois.size() << std::endl;
921  // for (size_t i=0;i!=rois.size();i++){
922  // std::cout << "Xin1: " << rois.at(i).front() << " " << rois.at(i).back() << std::endl;
923  // }
924  // }
925 
926  //std::cerr <<"\tSigprotection done: " << chansig.size() << " " << medians.size() << " " << medians.at(100) << " " << medians.at(101) << std::endl;
927 
928  // calculate the scaling coefficient and subtract
929  Microboone::Subtract_WScaling(chansig, medians, respec, res_offset, rois, decon_limit1, roi_min_max_ratio);
930 
931 
932  // WireCell::IChannelFilter::signal_t& signal = chansig.begin()->second;
933  // for (size_t i=0;i!=signal.size();i++){
934  // signal.at(i) = medians.at(i);
935  // }
936 
937  //std::cerr <<"\tSubtrace_WScaling done" << std::endl;
938 
939  // for (auto it: chansig){
940  // std::cout << "Xin3 " << it.first << std::endl;
941  // break;
942  // }
943 
944  return WireCell::Waveform::ChannelMaskMap(); // not implemented
945 }
std::vector< std::vector< int > > SignalProtection(WireCell::Waveform::realseq_t &sig, const WireCell::Waveform::compseq_t &respec, int res_offset, int pad_f, int pad_b, float upper_decon_limit=0.02, float decon_lf_cutoff=0.08, float upper_adc_limit=15, float protection_factor=5.0, float min_adc_limit=50)
Definition: Microboone.cxx:232
Sequence< real_t > realseq_t
Definition: Waveform.h:31
bool Subtract_WScaling(WireCell::IChannelFilter::channel_signals_t &chansig, const WireCell::Waveform::realseq_t &medians, const WireCell::Waveform::compseq_t &respec, int res_offset, std::vector< std::vector< int > > &rois, float upper_decon_limit1=0.08, float roi_min_max_ratio=0.8)
Definition: Microboone.cxx:55
std::map< std::string, ChannelMasks > ChannelMaskMap
Collect channel masks by some label.
Definition: Waveform.h:59
WireCell::Waveform::realseq_t CalcMedian(const WireCell::IChannelFilter::channel_signals_t &chansig)
Definition: Derivations.cxx:22
IChannelNoiseDatabase::pointer m_noisedb
Definition: Microboone.h:55
Sequence< complex_t > compseq_t
A complex-valued sequence, eg for discrete spectrum powers.
Definition: Waveform.h:34

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