All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
caldata::RawDigitFilterAlg Class Reference
Inheritance diagram for caldata::RawDigitFilterAlg:
caldata::IRawDigitFilter

Public Member Functions

 RawDigitFilterAlg (const fhicl::ParameterSet &pset)
 
 ~RawDigitFilterAlg ()
 Destructor. More...
 
void configure (const fhicl::ParameterSet &pset) override
 
void initializeHistograms (art::TFileDirectory &) const override
 
size_t plane () const override
 
void FilterWaveform (RawDigitVector &, size_t, size_t, float=0.) const override
 
- Public Member Functions inherited from caldata::IRawDigitFilter
virtual ~IRawDigitFilter () noexcept=default
 

Private Member Functions

void doAdaptiveFilter (RawDigitVector &) const
 

Private Attributes

float fTruncMeanFraction
 Fraction for truncated mean. More...
 
size_t fStructuringElement
 Structuring element to use with Top Hat filter. More...
 
bool fFillHistograms
 if true then will fill diagnostic hists More...
 
size_t fPlane
 
RawDigitCharacterizationAlg fCharacterizationAlg
 
art::ServiceHandle< geo::GeometryfGeometry
 pointer to Geometry service More...
 

Detailed Description

Definition at line 26 of file RawDigitFilterAlg_tool.cc.

Constructor & Destructor Documentation

caldata::RawDigitFilterAlg::RawDigitFilterAlg ( const fhicl::ParameterSet &  pset)
explicit

Constructor.

Arguments:

pset - Fcl parameters.

Definition at line 66 of file RawDigitFilterAlg_tool.cc.

66  :
67  fPlane(0),
69 {
70  configure(pset);
71 
72  // Report.
73  mf::LogInfo("RawDigitFilterAlg") << "RawDigitFilterAlg configured\n";
74 }
RawDigitCharacterizationAlg fCharacterizationAlg
void configure(const fhicl::ParameterSet &pset) override
caldata::RawDigitFilterAlg::~RawDigitFilterAlg ( )

Destructor.

Definition at line 78 of file RawDigitFilterAlg_tool.cc.

79 {}

Member Function Documentation

void caldata::RawDigitFilterAlg::configure ( const fhicl::ParameterSet &  pset)
overridevirtual

Reconfigure method.

Arguments:

pset - Fcl parameter set.

Implements caldata::IRawDigitFilter.

Definition at line 88 of file RawDigitFilterAlg_tool.cc.

89 {
90  fTruncMeanFraction = pset.get<float> ("TruncMeanFraction", 0.15);
91  fStructuringElement = pset.get<size_t>("StructuringElement", 30);
92  fFillHistograms = pset.get<bool> ("FillHistograms", false);
93 
95 }
bool fFillHistograms
if true then will fill diagnostic hists
size_t fStructuringElement
Structuring element to use with Top Hat filter.
float fTruncMeanFraction
Fraction for truncated mean.
RawDigitCharacterizationAlg fCharacterizationAlg
void reconfigure(fhicl::ParameterSet const &pset)
void caldata::RawDigitFilterAlg::doAdaptiveFilter ( RawDigitVector ) const
private
void caldata::RawDigitFilterAlg::FilterWaveform ( RawDigitVector dataVec,
size_t  channel,
size_t  cnt,
float  pedestal = 0. 
) const
overridevirtual

Implements caldata::IRawDigitFilter.

Definition at line 103 of file RawDigitFilterAlg_tool.cc.

104 {
105  // We need to start by collecting mean/rms
106  float truncMean;
107  float rmsVal;
108  int numBins;
109 
110  fCharacterizationAlg.getMeanAndRms(dataVec, truncMean, rmsVal, numBins);
111 
112  // Declare erosion vector
113  std::vector<float> meanVec;
114 
115  meanVec.resize(dataVec.size(), 0);
116  std::vector<float>::iterator meanVecItr = meanVec.begin();
117 
118  size_t halfStructure(fStructuringElement/2);
119 
120  float runningSum(0.);
121 
122  for(size_t idx = 0; idx < halfStructure - 1; idx++) runningSum += dataVec[idx];
123 
124  // First pass through to build the erosion vector
125  for(RawDigitVector::iterator dataItr = dataVec.begin(); dataItr != dataVec.end(); dataItr++)
126  {
127  size_t startOffset = std::distance(dataVec.begin(),dataItr);
128  size_t stopOffset = std::distance(dataItr,dataVec.end());
129  size_t count = std::min(2 * halfStructure, std::min(startOffset + halfStructure, halfStructure + stopOffset));
130 
131  if (startOffset > halfStructure) runningSum -= *(dataItr - halfStructure - 1);
132  if (stopOffset >= halfStructure) runningSum += *(dataItr + halfStructure - 1);
133 
134  float adaptVal = runningSum / float(count) - truncMean;
135 
136  *meanVecItr++ = adaptVal;
137  }
138 
139  // Now do baseline correction
140  for(size_t idx = 0; idx < dataVec.size(); idx++)
141  dataVec[idx] = dataVec[idx] - std::round(meanVec[idx]);
142 
143  return;
144 }
void getMeanAndRms(const RawDigitVector &rawWaveform, float &aveVal, float &rmsVal, int &numBins) const
size_t fStructuringElement
Structuring element to use with Top Hat filter.
double distance(geo::Point_t const &point, CathodeDesc_t const &cathode)
Returns the distance of a point from the cathode.
RawDigitCharacterizationAlg fCharacterizationAlg
std::size_t count(Cont const &cont)
void caldata::RawDigitFilterAlg::initializeHistograms ( art::TFileDirectory &  tfs) const
overridevirtual

Implements caldata::IRawDigitFilter.

Definition at line 97 of file RawDigitFilterAlg_tool.cc.

98 {
99 
100  return;
101 }
size_t caldata::RawDigitFilterAlg::plane ( ) const
inlineoverridevirtual

Implements caldata::IRawDigitFilter.

Definition at line 37 of file RawDigitFilterAlg_tool.cc.

Member Data Documentation

RawDigitCharacterizationAlg caldata::RawDigitFilterAlg::fCharacterizationAlg
private

Definition at line 53 of file RawDigitFilterAlg_tool.cc.

bool caldata::RawDigitFilterAlg::fFillHistograms
private

if true then will fill diagnostic hists

Definition at line 48 of file RawDigitFilterAlg_tool.cc.

art::ServiceHandle<geo::Geometry> caldata::RawDigitFilterAlg::fGeometry
private

pointer to Geometry service

Definition at line 56 of file RawDigitFilterAlg_tool.cc.

size_t caldata::RawDigitFilterAlg::fPlane
private

Definition at line 50 of file RawDigitFilterAlg_tool.cc.

size_t caldata::RawDigitFilterAlg::fStructuringElement
private

Structuring element to use with Top Hat filter.

Definition at line 47 of file RawDigitFilterAlg_tool.cc.

float caldata::RawDigitFilterAlg::fTruncMeanFraction
private

Fraction for truncated mean.

Definition at line 46 of file RawDigitFilterAlg_tool.cc.


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