Public Member Functions | Private Attributes | List of all members
ThresholdNoiseRemovalService Class Reference

#include <ThresholdNoiseRemovalService.h>

Inheritance diagram for ThresholdNoiseRemovalService:
AdcChannelNoiseRemovalService

Public Member Functions

 ThresholdNoiseRemovalService (fhicl::ParameterSet const &pset, art::ActivityRegistry &)
 
int update (AdcChannelData &data) const
 
std::ostream & print (std::ostream &out=std::cout, std::string prefix="") const
 
- Public Member Functions inherited from AdcChannelNoiseRemovalService
virtual ~AdcChannelNoiseRemovalService ()=default
 

Private Attributes

int m_LogLevel
 
AdcSignal m_Threshold
 

Detailed Description

Definition at line 27 of file ThresholdNoiseRemovalService.h.

Constructor & Destructor Documentation

ThresholdNoiseRemovalService::ThresholdNoiseRemovalService ( fhicl::ParameterSet const &  pset,
art::ActivityRegistry  
)

Definition at line 24 of file ThresholdNoiseRemovalService_service.cc.

25 : m_LogLevel(1) {
26  const string myname = "ThresholdNoiseRemovalService::ctor: ";
27  pset.get_if_present<int>("LogLevel", m_LogLevel);
28  m_Threshold = pset.get<AdcSignal>("Threshold");
29  print(cout, myname);
30 }
float AdcSignal
Definition: AdcTypes.h:21
std::ostream & print(std::ostream &out=std::cout, std::string prefix="") const

Member Function Documentation

ostream & ThresholdNoiseRemovalService::print ( std::ostream &  out = std::cout,
std::string  prefix = "" 
) const
virtual

Implements AdcChannelNoiseRemovalService.

Definition at line 64 of file ThresholdNoiseRemovalService_service.cc.

64  {
65  out << prefix << "ThresholdNoiseRemovalService:" << endl;
66  out << prefix << " LogLevel: " << m_LogLevel << endl;
67  out << prefix << " Threshold: " << m_Threshold << endl;
68  return out;
69 }
QTextStream & endl(QTextStream &s)
int ThresholdNoiseRemovalService::update ( AdcChannelData data) const
virtual

Implements AdcChannelNoiseRemovalService.

Definition at line 34 of file ThresholdNoiseRemovalService_service.cc.

34  {
35  const string myname = "ThresholdNoiseRemovalService:update: ";
36  AdcSignalVector& sigs = data.samples;
37  AdcFlagVector& flags = data.flags;
38  if ( sigs.size() == 0 ) {
39  cout << myname << "WARNING: No data found." << endl;
40  return 1;
41  }
42  if ( flags.size() == 0 ) flags.resize(sigs.size(), AdcGood );
43  if ( flags.size() != sigs.size() ) {
44  cout << myname << "ERROR: samples and flags vectors have different sizes." << endl;
45  return 2;
46  }
47  AdcIndex count = 0;
48  for ( unsigned int isig=0; isig<sigs.size(); ++isig ) {
49  AdcSignal& sig = sigs[isig];
50  if ( fabs(sig) < m_Threshold ) {
51  sig = 0.0;
52  flags[isig] = AdcSetFixed;
53  ++count;
54  }
55  }
56  if ( m_LogLevel >= 2 ) cout << myname << "Suppressed " << count << " of "
57  << sigs.size() << " ticks." << endl;
58  return 0;
59 }
float AdcSignal
Definition: AdcTypes.h:21
std::vector< AdcFlag > AdcFlagVector
Definition: AdcTypes.h:30
const AdcFlag AdcSetFixed
Definition: AdcTypes.h:41
const AdcFlag AdcGood
Definition: AdcTypes.h:32
unsigned int AdcIndex
Definition: AdcTypes.h:15
std::vector< AdcSignal > AdcSignalVector
Definition: AdcTypes.h:22
AdcSignalVector samples
QTextStream & endl(QTextStream &s)
AdcFlagVector flags

Member Data Documentation

int ThresholdNoiseRemovalService::m_LogLevel
private

Definition at line 40 of file ThresholdNoiseRemovalService.h.

AdcSignal ThresholdNoiseRemovalService::m_Threshold
private

Definition at line 41 of file ThresholdNoiseRemovalService.h.


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