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:
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
Index OpChannel(Index detNum, Index channel)
bool operator<(const Exception &e) const
std::string string
Definition: nybbler.cc:12
Representation of a region of space diced into voxels.
Definition: PhotonVoxels.h:58
virtual const float * GetReflCounts(size_t Voxel) const override
const double e
std::void_t< T > n
virtual float GetReflCount(size_t Voxel, size_t OpChannel) const override
Code to link reconstructed objects back to the MC truth information.
virtual bool hasReflectedT0() const override
Don&#39;t implement reflected light timing.
const sim::PhotonVoxelDef & fVoxDef
auto norm(Vector const &v)
Return norm of the specified vector.
virtual int NOpChannels() const override
General LArSoft Utilities.
virtual const float * GetReflT0s(size_t Voxel) const override
std::vector< OpDetRecord > fRecords
list x
Definition: train.py:276
Interface shared by all PhotonLibrary-like classes.
virtual bool hasReflected() const override
Don&#39;t implement reflected light.
virtual float GetReflT0(size_t Voxel, size_t OpChannel) const override