All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sbndcode/sbndcode/OpDetReco/OpFlash/FlashFinder/PECalib.cxx
Go to the documentation of this file.
1 #ifndef PECALIB_CXX
2 #define PECALIB_CXX
3 
4 #include "PECalib.h"
5 
6 namespace lightana {
7 
9  {}
10 
11  void PECalib::Configure(const Config_t &pset)
12  {
13 
14  _spe_area_gain_v.clear();
15  _spe_area_gain_v = pset.get<std::vector<double> >("SPEAreaGainList",_spe_area_gain_v);
16 
17  if(_spe_area_gain_v.empty()) {
18  double spe_area_gain = pset.get<double>("SPEAreaGain");
19  _spe_area_gain_v.resize(NOpDets(),spe_area_gain);
20  }
21 
22  if(_spe_area_gain_v.size() != NOpDets()) {
23  std::cerr << "SPEAreaGain array size (" << _spe_area_gain_v.size()
24  << ") != NOpDets (" << NOpDets() << ")..." << std::endl;
25  throw std::exception();
26  }
27 
28  _relative_qe_v.clear();
29  _relative_qe_v = pset.get<std::vector<double> >("RelativeQEList",_relative_qe_v);
30 
31  if(_relative_qe_v.empty())
32  _relative_qe_v.resize(NOpDets(),1.0);
33 
34  if(_relative_qe_v.size() != NOpDets()) {
35  std::cerr << "RelativeQE array size (" << _relative_qe_v.size()
36  << ") != NOpDets (" << NOpDets() << ")..." << std::endl;
37  throw std::exception();
38  }
39  }
40 
41  double PECalib::Calibrate(const size_t opdet, const double area) const
42  {
43  if( opdet > NOpDets() ) {
44  std::cerr << "OpDet ID " << opdet << " exceeding max # of OpDet (" << NOpDets() << ")" << std::endl;
45  throw std::exception();
46  }
47 
48  double area_pe = area / _spe_area_gain_v[opdet] * _relative_qe_v[opdet];
49 
50  return area_pe;
51  }
52 
53 }
54 #endif
55 
BEGIN_PROLOG could also be cerr
double Calibrate(const size_t opdet, const double area) const