All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ChargeAnalytical.cxx
Go to the documentation of this file.
1 #ifndef CHARGEANALYTICAL_CXX
2 #define CHARGEANALYTICAL_CXX
3 
4 #include "ChargeAnalytical.h"
5 
6 namespace flashmatch {
7 
9 
11  : BaseFlashHypothesis(name)
12  {}
13 
15  {
16  _global_qe = pset.get<double>("GlobalQE");
17  _qe_v = pset.get<std::vector<double> >("CCVCorrection");
18  if(_qe_v.size() != DetectorSpecs::GetME().NOpDets()) {
19  FLASH_CRITICAL() << "CCVCorrection factor array has size " << _qe_v.size()
20  << " != number of opdet (" << DetectorSpecs::GetME().NOpDets() << ")!" << std::endl;
21  throw OpT0FinderException();
22  }
23  }
24 
26  Flash_t &flash) const
27  {
28 
29  size_t n_pmt = DetectorSpecs::GetME().NOpDets();
30 
31  for (size_t i = 0; i < n_pmt; ++i) {
32  flash.pe_v[i] = 0;
33  }
34 
35  for (size_t pmt_index = 0; pmt_index < n_pmt; ++pmt_index) {
36 
37  for (size_t pt_index = 0; pt_index < track.size(); ++pt_index) {
38 
39  auto const &pt = track[pt_index];
40 
41  auto const& pmt_pos = DetectorSpecs::GetME().PMTPosition(pmt_index);
42  double dx = pmt_pos[0] - pt.x;
43  double dy = pmt_pos[1] - pt.y;
44  double dz = pmt_pos[2] - pt.z;
45 
46  double r2 = (pow(dx, 2) + pow(dy, 2) + pow(dz, 2));
47 
48  double angle = dx / sqrt(r2);
49 
50  if (angle < 0) angle *= -1;
51 
52  flash.pe_v[pmt_index] += pt.q * angle / r2 * _global_qe / _qe_v[pmt_index];
53 
54  }
55  }
56  }
57 }
58 #endif
59 
size_t NOpDets() const
of PMTs
Definition: FMWKInterface.h:60
process_name use argoneut_mc_hitfinder track
fhicl::ParameterSet Config_t
Configuration object.
Definition: FMWKInterface.h:31
static DetectorSpecs & GetME(std::string filename="detector_specs.cfg")
Definition: FMWKInterface.h:44
Struct to represent an optical flash.
std::vector< double > pe_v
PE distribution over photo-detectors.
#define FLASH_CRITICAL()
Compiler macro for CRITICAL message.
Collection of charge deposition 3D point (cluster)
void _Configure_(const Config_t &pset)
std::vector< double > _qe_v
PMT-wise relative QE.
ChargeAnalytical(const std::string name="ChargeAnalytical")
Default constructor.
const geoalgo::Point_t & PMTPosition(size_t opch)
PMT XYZ position filler.
Definition: FMWKInterface.h:51
Class def header for a class ChargeAnalytical.
static ChargeAnalyticalFactory __global_ChargeAnalyticalFactory__
then echo fcl name
finds tracks best matching by angle
void FillEstimate(const QCluster_t &, Flash_t &) const
Method to simply fill provided reference of flashmatch::Flash_t.