LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
PMTPedestalBase.cxx
Go to the documentation of this file.
1 //
3 // PMTPedestalBase source
4 //
6 
7 #ifndef larana_OPTICALDETECTOR_PMTPEDESTALBASE_CXX
8 #define larana_OPTICALDETECTOR_PMTPEDESTALBASE_CXX
9 
10 #include "PMTPedestalBase.h"
11 #include "OpticalRecoException.h"
12 #include <sstream>
13 namespace pmtana{
14 
15  //**************************************************************
16  PMTPedestalBase::PMTPedestalBase(std::string name) : _name(name)
17  , _mean_v()
18  , _sigma_v()
19  //**************************************************************
20  {}
21 
22  //*********************************
24  //*********************************
25  {}
26 
27  //**********************************************
28  const std::string& PMTPedestalBase::Name() const
29  //**********************************************
30  { return _name;}
31 
32  //************************************************************
34  //************************************************************
35  {
36  _mean_v.resize(wf.size(),0);
37  _sigma_v.resize(wf.size(),0);
38 
39  for(size_t i=0; i<wf.size(); ++i)
40  _mean_v[i] = _sigma_v[i] = 0;
41 
42  const bool res = ComputePedestal(wf, _mean_v, _sigma_v);
43 
44  if(wf.size() != _mean_v.size())
45  throw OpticalRecoException("Internal error: computed pedestal mean array length changed!");
46  if(wf.size() != _sigma_v.size())
47  throw OpticalRecoException("Internal error: computed pedestal sigma array length changed!");
48 
49  return res;
50  }
51 
52  //*******************************************
53  double PMTPedestalBase::Mean(size_t i) const
54  //*******************************************
55  {
56  if(i > _mean_v.size()) {
57  std::stringstream ss;
58  ss << "Invalid index: no pedestal mean exist @ " << i;
59  throw OpticalRecoException(ss.str());
60  }
61  return _mean_v[i];
62  }
63 
64  //*******************************************
65  double PMTPedestalBase::Sigma(size_t i) const
66  //*******************************************
67  {
68  if(i > _sigma_v.size()) {
69  std::stringstream ss;
70  ss << "Invalid index: no pedestal sigma exist @ " << i;
71  throw OpticalRecoException(ss.str());
72  }
73  return _sigma_v[i];
74  }
75 
76  //*************************************************
78  //*************************************************
79  { return _mean_v; }
80 
81  //***************************************************
83  //***************************************************
84  { return _sigma_v; }
85 }
86 
87 #endif
Class def header for exception classes in OpticalDetector package.
std::string _name
Name.
std::vector< double > PedestalSigma_t
PMTPedestalBase(std::string name="noname")
Default constructor.
const std::string & Name() const
Name getter.
Float_t ss
Definition: plot.C:23
pmtana::PedestalMean_t _mean_v
A variable holder for pedestal mean value.
Class definition file of PMTPedestalBase.
virtual ~PMTPedestalBase()
Default destructor.
bool Evaluate(const pmtana::Waveform_t &wf)
Method to compute a pedestal.
virtual bool ComputePedestal(const ::pmtana::Waveform_t &wf, pmtana::PedestalMean_t &mean_v, pmtana::PedestalSigma_t &sigma_v)=0
std::vector< short > Waveform_t
pmtana::PedestalSigma_t _sigma_v
A variable holder for pedestal standard deviation.
const pmtana::PedestalSigma_t & Sigma() const
Getter of the pedestal standard deviation.
std::vector< double > PedestalMean_t
const pmtana::PedestalMean_t & Mean() const
Getter of the pedestal mean value.