LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
PhotonLibraryHybrid.h
Go to the documentation of this file.
1 #ifndef PHOTONLIBRARYHYBRID_H
5 #define PHOTONLIBRARYHYBRID_H
6 
8 
9 #include <cmath>
10 #include <string>
11 #include <vector>
12 
13 namespace sim {
14  class PhotonVoxelDef;
15 }
16 
17 namespace phot {
20  public:
21  PhotonLibraryHybrid(const std::string& fname, const sim::PhotonVoxelDef& voxdef);
22  virtual ~PhotonLibraryHybrid();
23 
24  virtual float GetCount(size_t Voxel, size_t OpChannel) const override;
25 
26  // This one is unimplemented
27  virtual const float* GetCounts(size_t Voxel) const override;
28 
30  virtual bool hasReflected() const override { return false; }
31  virtual const float* GetReflCounts(size_t Voxel) const override { return 0; }
32  virtual float GetReflCount(size_t Voxel, size_t OpChannel) const override { return 0; }
33 
35  virtual bool hasReflectedT0() const override { return false; }
36  virtual const float* GetReflT0s(size_t Voxel) const override { return 0; }
37  virtual float GetReflT0(size_t Voxel, size_t OpChannel) const override { return 0; }
38 
39  virtual int NOpChannels() const override { return fRecords.size(); }
40  virtual int NVoxels() const override;
41 
42  protected:
44 
45  struct FitFunc {
46  FitFunc() {}
47  FitFunc(float n, float d) : norm(n), decay(d) {}
48  double Eval(double x) const { return exp(norm + decay * x) / (x * x); }
49 
50  float norm, decay;
51  };
52 
53  struct Exception {
54  Exception(size_t _vox, float _vis) : vox(_vox), vis(_vis) {}
55 
56  bool operator<(const Exception& e) const { return vox < e.vox; }
57  bool operator<(size_t v) const { return vox < v; }
58 
59  size_t vox;
60  float vis;
61  };
62 
63  struct OpDetRecord {
65  // std::map is particularly space-inefficient, and sorted vector can also
66  // be searched in log(N) time.
67  std::vector<Exception> exceptions;
68  };
69 
70  std::vector<OpDetRecord> fRecords;
71  };
72 } // namespace
73 
74 #endif
Float_t x
Definition: compare.C:6
bool operator<(const Exception &e) const
Float_t vox
Definition: plot.C:38
Representation of a region of space diced into voxels.
Definition: PhotonVoxels.h:58
virtual const float * GetReflCounts(size_t Voxel) const override
Float_t d
Definition: plot.C:235
virtual float GetReflCount(size_t Voxel, size_t OpChannel) const override
Monte Carlo Simulation.
virtual bool hasReflectedT0() const override
Don&#39;t implement reflected light timing.
const sim::PhotonVoxelDef & fVoxDef
virtual int NOpChannels() const override
General LArSoft Utilities.
virtual const float * GetReflT0s(size_t Voxel) const override
Float_t norm
std::vector< OpDetRecord > fRecords
Char_t n[5]
Interface shared by all PhotonLibrary-like classes.
Float_t e
Definition: plot.C:35
virtual bool hasReflected() const override
Don&#39;t implement reflected light.
virtual float GetReflT0(size_t Voxel, size_t OpChannel) const override