All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sbncode/sbncode/OpT0Finder/flashmatch/Base/FMWKTools/PhotonVisibilityService.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // \file PhotonVisibilityService.h
3 //
4 // \brief Service to report opdet visibility to different points in
5 // the system
6 //
7 // \author bjpjones@mit.edu
8 //
9 ////////////////////////////////////////////////////////////////////////
10 #ifndef PHOTONVISIBILITYSERVICE_H
11 #define PHOTONVISIBILITYSERVICE_H
12 
13 
14 //#include "art/Framework/Services/Registry/ActivityRegistry.h"
15 //#include "art/Framework/Services/Registry/ServiceHandle.h"
16 //#include "art/Framework/Services/Registry/ServiceDeclarationMacros.h"
17 #include "PhotonLibrary.h"
18 #include "PhotonVoxels.h"
19 #include <cassert>
20 
21 ///General LArSoft Utilities
22 namespace phot{
23 
24  class PhotonVisibilityService {
25  public:
26 
27  //PhotonVisibilityService(fhicl::ParameterSet const& pset, art::ActivityRegistry& reg);
28  //PhotonVisibilityService(const std::string library="uboone_photon_library_v5.root");
29  PhotonVisibilityService(const std::string library="PhotonLibrary-20180801.root");
30 
31  //void reconfigure(fhicl::ParameterSet const& p);
32 
33  //double GetQuenchingFactor(double dQdx);
34 
35  //double DistanceToOpDet( double* xyz, unsigned int OpDet );
36  //double SolidAngleFactor( double* xyz, unsigned int OpDet );
37  float GetVisibility(double* xyz, unsigned int OpChannel ) const;
38  float GetVisibility(double x, double y, double z, unsigned int OpChannel ) const;
39 
40  std::vector<std::vector<float> > GetVisibilityXY(double z) const;
41  std::vector<std::vector<float> > GetVisibilityYZ(double x) const;
42  std::vector<std::vector<float> > GetVisibilityZX(double y) const;
43 
44  float Fraction2AbsoluteX(float frac) const;
45  float Fraction2AbsoluteY(float frac) const;
46  float Fraction2AbsoluteZ(float frac) const;
47 
48  inline float GetMaxX() const { return fXmax; }
49  inline float GetMaxY() const { return fYmax; }
50  inline float GetMaxZ() const { return fZmax; }
51  inline float GetMinX() const { return fXmin; }
52  inline float GetMinY() const { return fYmin; }
53  inline float GetMinZ() const { return fZmin; }
54  inline int GetNX() const { return fNx; }
55  inline int GetNY() const { return fNy; }
56  inline int GetNZ() const { return fNz; }
57  inline size_t GetNOpChannels() const { return fNOpDetChannels; }
58 
59  const std::vector<float>* GetAllVisibilities( double* xyz ) const;
60 
61  inline const std::vector<std::vector<float> >& GetLibraryData() const
62  { if(!fTheLibrary) LoadLibrary(); return fTheLibrary->GetData(); }
63 
64  void LoadLibrary() const;
65  void StoreLibrary();
66 
67 
68  void StoreLightProd( int VoxID, double N );
69  void RetrieveLightProd( int& VoxID, double& N ) const;
70 
71  void SetLibraryEntry( int VoxID, int OpChannel, float N);
72  float GetLibraryEntry( int VoxID, int OpChannel) const;
73  const std::vector<float>* GetLibraryEntries( int VoxID ) const;
74 
75 
76  bool IsBuildJob() const { return fLibraryBuildJob; }
77  bool UseParameterization() const {return fParameterization;}
78 
80  int NOpChannels() const { return fNOpDetChannels; }
81 
82  const std::string& GetLibraryFilename() { return fLibraryFile; }; // Allows one to check loaded filename
83 
84  static PhotonVisibilityService& GetME(std::string filename="PhotonLibrary-20180801.root")
85  {
86  // argument allows user to choose file loaded
87  // if relative, searches for file in designated folder
88  // if absolute, searches for file with given path
89  // see LoadLibrary()
91  return *_me;
92  }
93 
94  private:
95 
97 
98  int fCurrentVoxel;
99  double fCurrentValue;
100 
101  float fXmin, fXmax;
102  float fYmin, fYmax;
103  float fZmin, fZmax;
104  int fNx, fNy, fNz;
106  bool fUseCryoBoundary;
107 
108  bool fLibraryBuildJob;
109  bool fDoNotLoadLibrary;
110  bool fParameterization;
111  std::string fLibraryFile;
114 
115 
116  }; // class PhotonVisibilityService
117 } //namespace utils
118 //DECLARE_ART_SERVICE(phot::PhotonVisibilityService, LEGACY)
119 #endif // UTIL_DETECTOR_PROPERTIES_H
process_name opflash particleana ie ie ie z
std::vector< std::vector< float > > GetVisibilityYZ(double x) const
std::vector< std::vector< float > > GetVisibilityXY(double z) const
phot::IPhotonLibrary::Counts_t GetLibraryEntries(int VoxID, bool wantReflected=false) const
void RetrieveLightProd(int &VoxID, double &N) const
std::vector< std::vector< float > > GetVisibilityZX(double y) const
process_name opflash particleana ie x
BEGIN_PROLOG could also be dds filename
Representation of a region of space diced into voxels.
float GetLibraryEntry(int VoxID, OpDetID_t libOpChannel, bool wantReflected=false) const
static PhotonVisibilityService & GetME(std::string filename="PhotonLibrary-20180801.root")
void StoreLightProd(int VoxID, double N)
PhotonVisibilityService(fhicl::ParameterSet const &pset)
process_name opflash particleana ie ie y
float Fraction2AbsoluteZ(float frac) const
MappedCounts_t GetAllVisibilities(Point const &p, bool wantReflected=false) const
void SetLibraryEntry(int VoxID, OpDetID_t libOpChannel, float N, bool wantReflected=false)
process_name largeant stream1 can override from command line with o or output physics producers generator N
float Fraction2AbsoluteY(float frac) const
float GetVisibility(Point const &p, unsigned int OpChannel, bool wantReflected=false) const
float Fraction2AbsoluteX(float frac) const