LArSoft  v07_13_02
Liquid Argon Software toolkit - http://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{class PhotonVoxelDef;}
14 
15 namespace phot
16 {
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 
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 
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
Float_t x
Definition: compare.C:6
bool operator<(const Exception &e) const
Float_t vox
Definition: plot.C:40
virtual const float * GetReflCounts(size_t Voxel) const override
Float_t d
Definition: plot.C:237
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:34
virtual bool hasReflected() const override
Don&#39;t implement reflected light.
virtual float GetReflT0(size_t Voxel, size_t OpChannel) const override