LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
pmtana::PedAlgoUB Class Referenceabstract

#include "PedAlgoUB.h"

Inheritance diagram for pmtana::PedAlgoUB:
pmtana::PMTPedestalBase

Public Member Functions

 PedAlgoUB (const std::string name="PedCD")
 Default constructor. More...
 
 PedAlgoUB (const fhicl::ParameterSet &pset, const std::string name="PedAlgoUB")
 Alternative ctor. More...
 
const std::string & Name () const
 Name getter. More...
 
bool Evaluate (const pmtana::Waveform_t &wf)
 Method to compute a pedestal. More...
 
double Mean (size_t i) const
 Getter of the pedestal mean value. More...
 
const pmtana::PedestalMean_tMean () const
 Getter of the pedestal mean value. More...
 
double Sigma (size_t i) const
 Getter of the pedestal standard deviation. More...
 
const pmtana::PedestalSigma_tSigma () const
 Getter of the pedestal standard deviation. More...
 

Protected Member Functions

bool ComputePedestal (const pmtana::Waveform_t &wf, pmtana::PedestalMean_t &mean_v, pmtana::PedestalSigma_t &sigma_v)
 Method to compute a pedestal of the input waveform using "nsample" ADC samples from "start" index. More...
 
virtual bool ComputePedestal (const ::pmtana::Waveform_t &wf, pmtana::PedestalMean_t &mean_v, pmtana::PedestalSigma_t &sigma_v)=0
 

Private Attributes

PedAlgoRmsSlider _beamgatealgo
 
unsigned int _beam_gate_samples
 

Detailed Description

A class that calculates pedestal mean & standard deviation (here and elsewhere called as "RMS").

Definition at line 33 of file PedAlgoUB.h.

Constructor & Destructor Documentation

pmtana::PedAlgoUB::PedAlgoUB ( const std::string  name = "PedCD")

Default constructor.

Definition at line 14 of file PedAlgoUB.cxx.

14  : PMTPedestalBase(name), _beamgatealgo(name)
15  //************************************************
16  {}
PedAlgoRmsSlider _beamgatealgo
Definition: PedAlgoUB.h:52
PMTPedestalBase(std::string name="noname")
Default constructor.
pmtana::PedAlgoUB::PedAlgoUB ( const fhicl::ParameterSet pset,
const std::string  name = "PedAlgoUB" 
)

Alternative ctor.

Definition at line 19 of file PedAlgoUB.cxx.

References _beam_gate_samples, and fhicl::ParameterSet::get().

22  : PMTPedestalBase(name)
23  //, _beamgatealgo(pset.get_pset("BeamGateAlgo"),"BeamGateAlgo")
24  , _beamgatealgo(pset, "BeamGateAlgo")
25  //*************************************************************
26  {
27  _beam_gate_samples = pset.get<unsigned int>("BeamGateSamples");
28  }
PedAlgoRmsSlider _beamgatealgo
Definition: PedAlgoUB.h:52
PMTPedestalBase(std::string name="noname")
Default constructor.
unsigned int _beam_gate_samples
Definition: PedAlgoUB.h:53
T get(std::string const &key) const
Definition: ParameterSet.h:314

Member Function Documentation

bool pmtana::PedAlgoUB::ComputePedestal ( const pmtana::Waveform_t wf,
pmtana::PedestalMean_t mean_v,
pmtana::PedestalSigma_t sigma_v 
)
protected

Method to compute a pedestal of the input waveform using "nsample" ADC samples from "start" index.

Definition at line 31 of file PedAlgoUB.cxx.

References _beam_gate_samples, _beamgatealgo, pmtana::PMTPedestalBase::Evaluate(), pmtana::PMTPedestalBase::Mean(), and pmtana::PMTPedestalBase::Sigma().

35  {
36 
37  if (wf.size() < _beam_gate_samples) {
38 
39  double ped_mean = wf.front(); //first sample
40  double ped_sigma = 0;
41 
42  for (auto& v : mean_v)
43  v = ped_mean;
44  for (auto& v : sigma_v)
45  v = ped_sigma;
46 
47  return true;
48  }
49 
50  else {
51 
53  mean_v = _beamgatealgo.Mean();
54  sigma_v = _beamgatealgo.Sigma();
55 
56  return true;
57  }
58  }
double Mean(size_t i) const
Getter of the pedestal mean value.
PedAlgoRmsSlider _beamgatealgo
Definition: PedAlgoUB.h:52
unsigned int _beam_gate_samples
Definition: PedAlgoUB.h:53
bool Evaluate(const pmtana::Waveform_t &wf)
Method to compute a pedestal.
double Sigma(size_t i) const
Getter of the pedestal standard deviation.
virtual bool pmtana::PMTPedestalBase::ComputePedestal ( const ::pmtana::Waveform_t wf,
pmtana::PedestalMean_t mean_v,
pmtana::PedestalSigma_t sigma_v 
)
protectedpure virtualinherited

Method to compute pedestal: mean and sigma array should be filled per ADC. The length of each array is guaranteed to be same.

Referenced by pmtana::PMTPedestalBase::Evaluate().

bool pmtana::PMTPedestalBase::Evaluate ( const pmtana::Waveform_t wf)
inherited

Method to compute a pedestal.

Definition at line 30 of file PMTPedestalBase.cxx.

References pmtana::PMTPedestalBase::_mean_v, pmtana::PMTPedestalBase::_sigma_v, and pmtana::PMTPedestalBase::ComputePedestal().

Referenced by ComputePedestal(), and pmtana::PulseRecoManager::Reconstruct().

32  {
33  _mean_v.resize(wf.size(), 0);
34  _sigma_v.resize(wf.size(), 0);
35 
36  for (size_t i = 0; i < wf.size(); ++i)
37  _mean_v[i] = _sigma_v[i] = 0;
38 
39  const bool res = ComputePedestal(wf, _mean_v, _sigma_v);
40 
41  if (wf.size() != _mean_v.size())
42  throw OpticalRecoException("Internal error: computed pedestal mean array length changed!");
43  if (wf.size() != _sigma_v.size())
44  throw OpticalRecoException("Internal error: computed pedestal sigma array length changed!");
45 
46  return res;
47  }
pmtana::PedestalMean_t _mean_v
A variable holder for pedestal mean value.
virtual bool ComputePedestal(const ::pmtana::Waveform_t &wf, pmtana::PedestalMean_t &mean_v, pmtana::PedestalSigma_t &sigma_v)=0
pmtana::PedestalSigma_t _sigma_v
A variable holder for pedestal standard deviation.
double pmtana::PMTPedestalBase::Mean ( size_t  i) const
inherited

Getter of the pedestal mean value.

Definition at line 50 of file PMTPedestalBase.cxx.

References pmtana::PMTPedestalBase::_mean_v.

Referenced by ComputePedestal(), and pmtana::PulseRecoManager::Reconstruct().

52  {
53  if (i > _mean_v.size()) {
54  std::stringstream ss;
55  ss << "Invalid index: no pedestal mean exist @ " << i;
56  throw OpticalRecoException(ss.str());
57  }
58  return _mean_v[i];
59  }
pmtana::PedestalMean_t _mean_v
A variable holder for pedestal mean value.
const PedestalMean_t & pmtana::PMTPedestalBase::Mean ( ) const
inherited

Getter of the pedestal mean value.

Definition at line 74 of file PMTPedestalBase.cxx.

References pmtana::PMTPedestalBase::_mean_v.

76  {
77  return _mean_v;
78  }
pmtana::PedestalMean_t _mean_v
A variable holder for pedestal mean value.
const std::string & pmtana::PMTPedestalBase::Name ( ) const
inherited

Name getter.

Definition at line 23 of file PMTPedestalBase.cxx.

References pmtana::PMTPedestalBase::_name.

25  {
26  return _name;
27  }
std::string _name
Name.
double pmtana::PMTPedestalBase::Sigma ( size_t  i) const
inherited

Getter of the pedestal standard deviation.

Definition at line 62 of file PMTPedestalBase.cxx.

References pmtana::PMTPedestalBase::_sigma_v.

Referenced by ComputePedestal(), and pmtana::PulseRecoManager::Reconstruct().

64  {
65  if (i > _sigma_v.size()) {
66  std::stringstream ss;
67  ss << "Invalid index: no pedestal sigma exist @ " << i;
68  throw OpticalRecoException(ss.str());
69  }
70  return _sigma_v[i];
71  }
pmtana::PedestalSigma_t _sigma_v
A variable holder for pedestal standard deviation.
const PedestalSigma_t & pmtana::PMTPedestalBase::Sigma ( ) const
inherited

Getter of the pedestal standard deviation.

Definition at line 81 of file PMTPedestalBase.cxx.

References pmtana::PMTPedestalBase::_sigma_v.

83  {
84  return _sigma_v;
85  }
pmtana::PedestalSigma_t _sigma_v
A variable holder for pedestal standard deviation.

Member Data Documentation

unsigned int pmtana::PedAlgoUB::_beam_gate_samples
private

Definition at line 53 of file PedAlgoUB.h.

Referenced by ComputePedestal(), and PedAlgoUB().

PedAlgoRmsSlider pmtana::PedAlgoUB::_beamgatealgo
private

Definition at line 52 of file PedAlgoUB.h.

Referenced by ComputePedestal().


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