All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
icaruscode/icaruscode/PMT/OpReco/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 pmtana {
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  if(_spe_area_gain_v.empty()) {
17  double spe_area_gain = pset.get<double>("SPEAreaGain");
18  _spe_area_gain_v.resize(NOpDets(),spe_area_gain);
19  }
20  if(_spe_area_gain_v.size() != NOpDets()) {
21  std::cerr << "SPEAreaGain array size (" << _spe_area_gain_v.size()
22  << ") != NOpDets (" << NOpDets() << ")..." << std::endl;
23  throw std::exception();
24  }
25 
26  _relative_qe_v.clear();
27  _relative_qe_v = pset.get<std::vector<double> >("RelativeQEList",_relative_qe_v);
28  if(_relative_qe_v.empty())
29  _relative_qe_v.resize(NOpDets(),1.0);
30 
31  if(_relative_qe_v.size() != NOpDets()) {
32  std::cerr << "RelativeQE array size (" << _relative_qe_v.size()
33  << ") != NOpDets (" << NOpDets() << ")..." << std::endl;
34  throw std::exception();
35  }
36  }
37 
38  double PECalib::Calibrate(const size_t opdet, const double area) const
39  {
40  if( opdet > NOpDets() ) {
41  std::cerr << "OpDet ID " << opdet << " exceeding max # of OpDet (" << NOpDets() << ")" << std::endl;
42  throw std::exception();
43  }
44 
45  double area_pe = area / _spe_area_gain_v[opdet] * _relative_qe_v[opdet];
46 
47  return area_pe;
48 
49  }
50 
51 }
52 
53 
54 #endif
BEGIN_PROLOG could also be cerr
double Calibrate(const size_t opdet, const double area) const