All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PhotonLibraryHybrid.h
Go to the documentation of this file.
1 ////# PhotonLibraryHybrid.h header file
2 ////#
3 ////# Chris Backhouse, UCL, 2017
4 #ifndef PHOTONLIBRARYHYBRID_H
5 #define PHOTONLIBRARYHYBRID_H
6 
8 
9 #include <cmath>
10 #include <string>
11 #include <vector>
12 
13 namespace sim{class PhotonVoxelDef;}
14 
15 namespace phot
16 {
17  /// TODO doc
19  {
20  public:
21  PhotonLibraryHybrid(const std::string& fname,
22  const sim::PhotonVoxelDef& voxdef);
23  virtual ~PhotonLibraryHybrid();
24 
25  virtual float GetCount(size_t Voxel, size_t OpChannel) const override;
26 
27  // This one is unimplemented
28  virtual const float* GetCounts(size_t Voxel) const override;
29 
30  /// Don't implement reflected light
31  virtual bool hasReflected() const override {return false;}
32  virtual const float* GetReflCounts(size_t Voxel) const override {return 0;}
33  virtual float GetReflCount(size_t Voxel, size_t OpChannel) const override {return 0;}
34 
35  /// Don't implement reflected light timing
36  virtual bool hasReflectedT0() const override {return false;}
37  virtual const float* GetReflT0s(size_t Voxel) const override {return 0;}
38  virtual float GetReflT0(size_t Voxel, size_t OpChannel) const override {return 0;}
39 
40  virtual int NOpChannels() const override {return fRecords.size();}
41  virtual int NVoxels() const override;
42 
43  protected:
45 
46  struct FitFunc
47  {
48  FitFunc() {}
49  FitFunc(float n, float d) : norm(n), decay(d) {}
50  double Eval(double x) const {return exp(norm+decay*x)/(x*x);}
51 
52  float norm, decay;
53  };
54 
55  struct Exception
56  {
57  Exception(size_t _vox, float _vis) : vox(_vox), vis(_vis) {}
58 
59  bool operator<(const Exception& e) const {return vox < e.vox;}
60  bool operator<(size_t v) const {return vox < v;}
61 
62  size_t vox;
63  float vis;
64  };
65 
66  struct OpDetRecord
67  {
69  // std::map is particularly space-inefficient, and sorted vector can also
70  // be searched in log(N) time.
71  std::vector<Exception> exceptions;
72  };
73 
74  std::vector<OpDetRecord> fRecords;
75  };
76 } // namespace
77 
78 #endif
virtual float GetReflT0(size_t Voxel, size_t OpChannel) const override
string fname
Definition: demo.py:5
virtual int NVoxels() const override
bool operator<(const Exception &e) const
process_name opflash particleana ie x
Representation of a region of space diced into voxels.
virtual bool hasReflected() const override
Don&#39;t implement reflected light.
virtual const float * GetReflT0s(size_t Voxel) const override
PhotonLibraryHybrid(const std::string &fname, const sim::PhotonVoxelDef &voxdef)
virtual float GetCount(size_t Voxel, size_t OpChannel) const override
virtual const float * GetReflCounts(size_t Voxel) const override
virtual bool hasReflectedT0() const override
Don&#39;t implement reflected light timing.
const sim::PhotonVoxelDef & fVoxDef
virtual float GetReflCount(size_t Voxel, size_t OpChannel) const override
do i e
std::vector< OpDetRecord > fRecords
Interface shared by all PhotonLibrary-like classes.
virtual const float * GetCounts(size_t Voxel) const override
Returns a pointer to NOpChannels() visibility values, one per channel.
virtual int NOpChannels() const override