LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
PulseRecoManager.cxx
Go to the documentation of this file.
1 //
3 // PulseRecoManager source
4 //
6 
7 #ifndef PULSERECOMANAGER_CXX
8 #define PULSERECOMANAGER_CXX
9 
10 #include "PulseRecoManager.h"
11 #include "OpticalRecoException.h"
12 #include <sstream>
13 namespace pmtana{
14 
15  //*******************************************************
16  PulseRecoManager::PulseRecoManager() : _ped_algo(nullptr)
17  //*******************************************************
18  {
19  _reco_algo_v.clear();
20  }
21 
22  //***************************************************************
24  //***************************************************************
25  {}
26 
27  //************************************************************************************
29  //************************************************************************************
30  {
31  if(!algo) throw OpticalRecoException("Invalid PulseReco algorithm!");
32 
33  _reco_algo_v.push_back(std::make_pair(algo,ped_algo));
34  }
35 
36  //**************************************************************
38  //**************************************************************
39  {
40  if(!algo) throw OpticalRecoException("Invalid Pedestal algorithm!");
41  _ped_algo = algo;
42  }
43 
44  //**********************************************************************
46  //**********************************************************************
47  {
48  if(_reco_algo_v.empty() && !_ped_algo)
49 
50  throw OpticalRecoException("No Pulse/Pedestal reconstruction to run!");
51 
52  bool ped_status = true;
53 
54  if(_ped_algo)
55 
56  ped_status = _ped_algo->Evaluate(wf);
57 
58  bool pulse_reco_status = ped_status;
59 
60  for(auto& algo_pair : _reco_algo_v) {
61 
62  auto& pulse_algo = algo_pair.first;
63  auto& ped_algo = algo_pair.second;
64 
65  if(ped_algo) {
66 
67  ped_status = ped_status && ped_algo->Evaluate(wf);
68 
69  pulse_reco_status = ( ped_status &&
70  pulse_reco_status &&
71  pulse_algo->Reconstruct( wf, ped_algo->Mean(), ped_algo->Sigma() )
72  );
73 
74  } else {
75 
76  if( !_ped_algo ) {
77  std::stringstream ss;
78  ss << "No pedestal algorithm available for pulse algo " << pulse_algo->Name();
79  throw OpticalRecoException(ss.str());
80  }
81 
82  pulse_reco_status = ( pulse_reco_status &&
83  pulse_algo->Reconstruct( wf, _ped_algo->Mean(), _ped_algo->Sigma() )
84  );
85  }
86  }
87 
88  return pulse_reco_status;
89 
90  }
91 
92 }
93 
94 #endif
Class def header for exception classes in OpticalDetector package.
double Mean(size_t i) const
Getter of the pedestal mean value.
Float_t ss
Definition: plot.C:23
void AddRecoAlgo(pmtana::PMTPulseRecoBase *algo, PMTPedestalBase *ped_algo=nullptr)
A method to set pulse reconstruction algorithm.
bool Evaluate(const pmtana::Waveform_t &wf)
Method to compute a pedestal.
~PulseRecoManager()
Default constructor.
double Sigma(size_t i) const
Getter of the pedestal standard deviation.
bool Reconstruct(const pmtana::Waveform_t &) const
Implementation of ana_base::analyze method.
std::vector< short > Waveform_t
PMTPedestalBase * _ped_algo
ped_estimator object
void SetDefaultPedAlgo(pmtana::PMTPedestalBase *algo)
A method to set a choice of pedestal estimation method.
PulseRecoManager()
Default constructor.
std::vector< std::pair< pmtana::PMTPulseRecoBase *, pmtana::PMTPedestalBase * > > _reco_algo_v
pulse reconstruction algorithm pointer
Class definition file of PulseRecoManager.