All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PMTPedestalBase.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // PMTPedestalBase source
4 //
5 ////////////////////////////////////////////////////////////////////////
6 
7 #include "PMTPedestalBase.h"
8 #include "OpticalRecoException.h"
9 #include <sstream>
10 namespace pmtana{
11 
12  //**************************************************************
13  PMTPedestalBase::PMTPedestalBase(std::string name) : _name(name)
14  , _mean_v()
15  , _sigma_v()
16  //**************************************************************
17  {}
18 
19  //*********************************
21  //*********************************
22  {}
23 
24  //**********************************************
25  const std::string& PMTPedestalBase::Name() const
26  //**********************************************
27  { return _name;}
28 
29  //************************************************************
31  //************************************************************
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  }
48 
49  //*******************************************
50  double PMTPedestalBase::Mean(size_t i) const
51  //*******************************************
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  }
60 
61  //*******************************************
62  double PMTPedestalBase::Sigma(size_t i) const
63  //*******************************************
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  }
72 
73  //*************************************************
75  //*************************************************
76  { return _mean_v; }
77 
78  //***************************************************
80  //***************************************************
81  { return _sigma_v; }
82 }
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.
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
then echo fcl name
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.