Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
pmtana::PedAlgoEdges Class Reference

#include <PedAlgoEdges.h>

Inheritance diagram for pmtana::PedAlgoEdges:
pmtana::PMTPedestalBase

Public Types

enum  PED_METHOD { kHEAD = 0, kTAIL, kBOTH }
 enum to define algorithm options More...
 

Public Member Functions

 PedAlgoEdges (const std::string name="PedEdges")
 Default constructor. More...
 
 PedAlgoEdges (const fhicl::ParameterSet &pset, const std::string name="PedEdges")
 Alternative ctor. More...
 
- Public Member Functions inherited from pmtana::PMTPedestalBase
 PMTPedestalBase (std::string name="noname")
 Default constructor. More...
 
virtual ~PMTPedestalBase ()
 Default destructor. More...
 
const std::stringName () 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...
 
double Sigma (size_t i) const
 Getter of the pedestal standard deviation. More...
 
const pmtana::PedestalMean_tMean () const
 Getter of the pedestal mean value. 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...
 
- Protected Member Functions inherited from pmtana::PMTPedestalBase
virtual bool ComputePedestal (const ::pmtana::Waveform_t &wf, pmtana::PedestalMean_t &mean_v, pmtana::PedestalSigma_t &sigma_v)=0
 

Private Attributes

size_t _nsample_front
 

ADC sample in front to be used

More...
 
size_t _nsample_tail
 

ADC sample in tail to be used

More...
 
PED_METHOD _method
 Methods. More...
 

Detailed Description

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

Definition at line 32 of file PedAlgoEdges.h.

Member Enumeration Documentation

enum to define algorithm options

Enumerator
kHEAD 

Use first N samples.

kTAIL 

Use last N samples.

kBOTH 

Calculate both and use the one with smaller RMS.

Definition at line 44 of file PedAlgoEdges.h.

44  {
45  kHEAD = 0, ///< Use first N samples
46  kTAIL, ///< Use last N samples
47  kBOTH ///< Calculate both and use the one with smaller RMS
48  };
Use last N samples.
Definition: PedAlgoEdges.h:46
Calculate both and use the one with smaller RMS.
Definition: PedAlgoEdges.h:47
Use first N samples.
Definition: PedAlgoEdges.h:45

Constructor & Destructor Documentation

pmtana::PedAlgoEdges::PedAlgoEdges ( const std::string  name = "PedEdges")

Default constructor.

Definition at line 16 of file PedAlgoEdges.cxx.

18  //************************************************
19  {
20  _nsample_front = 3;
21  _nsample_tail = 5;
22  _method = kHEAD;
23  }
static QCString name
Definition: declinfo.cpp:673
PMTPedestalBase(std::string name="noname")
Default constructor.
PED_METHOD _method
Methods.
Definition: PedAlgoEdges.h:59
Use first N samples.
Definition: PedAlgoEdges.h:45
size_t _nsample_tail
ADC sample in tail to be used
Definition: PedAlgoEdges.h:58
size_t _nsample_front
ADC sample in front to be used
Definition: PedAlgoEdges.h:57
pmtana::PedAlgoEdges::PedAlgoEdges ( const fhicl::ParameterSet pset,
const std::string  name = "PedEdges" 
)

Alternative ctor.

Definition at line 26 of file PedAlgoEdges.cxx.

30  //*************************************************************
31  {
32 
33  _nsample_front = pset.get< size_t > ( "NumSampleFront" );
34  _nsample_tail = pset.get< size_t > ( "NumSampleTail" );
35  int method = pset.get< int > ( "Method" );
36 
37  if(method < 0 || method > kBOTH) throw OpticalRecoException("PedAlgoEdges received invalid \"Method\" parameter value!");
38 
39  _method = (PED_METHOD)method;
40 
41  }
static QCString name
Definition: declinfo.cpp:673
PMTPedestalBase(std::string name="noname")
Default constructor.
PED_METHOD _method
Methods.
Definition: PedAlgoEdges.h:59
T get(std::string const &key) const
Definition: ParameterSet.h:271
PED_METHOD
enum to define algorithm options
Definition: PedAlgoEdges.h:44
Calculate both and use the one with smaller RMS.
Definition: PedAlgoEdges.h:47
size_t _nsample_tail
ADC sample in tail to be used
Definition: PedAlgoEdges.h:58
size_t _nsample_front
ADC sample in front to be used
Definition: PedAlgoEdges.h:57

Member Function Documentation

bool pmtana::PedAlgoEdges::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 44 of file PedAlgoEdges.cxx.

48  {
49 
50  double ped_mean=0;
51  double ped_sigma=0;
52  switch(_method) {
53  case kHEAD:
54  ped_mean = mean ( wf, 0, _nsample_front);
55  ped_sigma = std ( wf, ped_mean, 0, _nsample_front);
56  for( auto &v : mean_v ) v = ped_mean;
57  for( auto &v : sigma_v ) v = ped_sigma;
58  break;
59  case kTAIL:
60  ped_mean = mean ( wf, (wf.size() - _nsample_tail), _nsample_tail);
61  ped_sigma = std ( wf, ped_mean, (wf.size() - _nsample_tail), _nsample_tail);
62  for( auto &v : mean_v ) v = ped_mean;
63  for( auto &v : sigma_v ) v = ped_sigma;
64  break;
65  case kBOTH:
66  double ped_mean_head = mean ( wf, 0, _nsample_front);
67  double ped_sigma_head = std ( wf, ped_mean_head, 0, _nsample_front);
68  double ped_mean_tail = mean ( wf, (wf.size() - _nsample_tail), _nsample_tail);
69  double ped_sigma_tail = std ( wf, ped_mean_tail, (wf.size() - _nsample_tail), _nsample_tail);
70 
71  ped_mean = ped_mean_head;
72  ped_sigma = ped_sigma_head;
73  if(ped_sigma_tail < ped_sigma) {
74  ped_mean = ped_mean_tail;
75  ped_sigma = ped_sigma_tail;
76  }
77  for( auto &v : mean_v ) v = ped_mean;
78  for( auto &v : sigma_v ) v = ped_sigma;
79  break;
80  }
81  return true;
82 
83  }
Use last N samples.
Definition: PedAlgoEdges.h:46
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
Definition: UtilFunc.cxx:42
PED_METHOD _method
Methods.
Definition: PedAlgoEdges.h:59
double mean(const std::vector< short > &wf, size_t start, size_t nsample)
Definition: UtilFunc.cxx:13
Calculate both and use the one with smaller RMS.
Definition: PedAlgoEdges.h:47
Use first N samples.
Definition: PedAlgoEdges.h:45
size_t _nsample_tail
ADC sample in tail to be used
Definition: PedAlgoEdges.h:58
size_t _nsample_front
ADC sample in front to be used
Definition: PedAlgoEdges.h:57

Member Data Documentation

PED_METHOD pmtana::PedAlgoEdges::_method
private

Methods.

Definition at line 59 of file PedAlgoEdges.h.

size_t pmtana::PedAlgoEdges::_nsample_front
private

ADC sample in front to be used

Definition at line 57 of file PedAlgoEdges.h.

size_t pmtana::PedAlgoEdges::_nsample_tail
private

ADC sample in tail to be used

Definition at line 58 of file PedAlgoEdges.h.


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