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 
16 #include "larcorealg/Geometry/geo_vectors_utils.h" // geo::vect namespace
17 #include "larcoreobj/SimpleTypesAndConstants/geo_vectors.h" // geo::Point_t
22 
23 // ROOT libraries
24 #include "TF1.h"
25 
26 // C/C++ standard libraries
27 #include <memory> // std::unique_ptr<>
28 
29 ///General LArSoft Utilities
30 namespace phot {
31 
33 
34  /// Type of optical library index.
36 
37  public:
40 
41  void reconfigure(fhicl::ParameterSet const& p);
42 
43  double GetQuenchingFactor(double dQdx) const;
44 
45  template <typename Point>
46  static double
47  DistanceToOpDet(Point const& p, unsigned int OpDet)
48  {
49  return DistanceToOpDetImpl(geo::vect::toPoint(p), OpDet);
50  }
51  template <typename Point>
52  static double
53  SolidAngleFactor(Point const& p, unsigned int OpDet)
54  {
55  return SolidAngleFactorImpl(geo::vect::toPoint(p), OpDet);
56  }
57 
58  template <typename Point>
59  bool
60  HasVisibility(Point const& p, bool wantReflected = false) const
61  {
62  return doHasVisibility(geo::vect::toPoint(p), wantReflected);
63  }
64 
65  template <typename Point>
66  float
67  GetVisibility(Point const& p, unsigned int OpChannel, bool wantReflected = false) const
68  {
69  return doGetVisibility(geo::vect::toPoint(p), OpChannel, wantReflected);
70  }
71 
72  template <typename Point>
74  GetAllVisibilities(Point const& p, bool wantReflected = false) const
75  {
76  return doGetAllVisibilities(geo::vect::toPoint(p), wantReflected);
77  }
78 
79  void LoadLibrary() const;
80  void StoreLibrary();
81 
82  void StoreLightProd(int VoxID, double N);
83  void RetrieveLightProd(int& VoxID, double& N) const;
84 
85  void SetLibraryEntry(int VoxID, OpDetID_t libOpChannel, float N, bool wantReflected = false);
86  float GetLibraryEntry(int VoxID, OpDetID_t libOpChannel, bool wantReflected = false) const;
87  bool HasLibraryEntries(int VoxID, bool wantReflected = false) const;
88  phot::IPhotonLibrary::Counts_t GetLibraryEntries(int VoxID, bool wantReflected = false) const;
89 
90  template <typename Point>
92  GetReflT0s(Point const& p) const
93  {
95  }
96  void SetLibraryReflT0Entry(int VoxID, int OpChannel, float value);
98  float GetLibraryReflT0Entry(int VoxID, OpDetID_t libOpChannel) const;
99 
100  template <typename Point>
102  GetTimingPar(Point const& p) const
103  {
105  }
106  void SetLibraryTimingParEntry(int VoxID, int OpChannel, float value, size_t parnum);
108  float GetLibraryTimingParEntry(int VoxID, OpDetID_t libOpChannel, size_t npar) const;
109 
110  template <typename Point>
112  GetTimingTF1(Point const& p) const
113  {
115  }
116  void SetLibraryTimingTF1Entry(int VoxID, int OpChannel, TF1 const& func);
118 
119  void SetDirectLightPropFunctions(TF1 const* functions[8],
120  double& d_break,
121  double& d_max,
122  double& tf1_sampling_factor) const;
123  void SetReflectedCOLightPropFunctions(TF1 const* functions[5],
124  double& t0_max,
125  double& t0_break_point) const;
126  void LoadTimingsForVUVPar(std::vector<std::vector<double>> (&v)[7],
127  double& step_size,
128  double& max_d,
129  double& min_d,
130  double& vuv_vgroup_mean,
131  double& vuv_vgroup_max,
132  double& inflexion_point_distance,
133  double& angle_bin_timing_vuv) const;
134  void LoadTimingsForVISPar(std::vector<double>& distances,
135  std::vector<double>& radial_distances,
136  std::vector<std::vector<std::vector<double>>>& cut_off,
137  std::vector<std::vector<std::vector<double>>>& tau,
138  double& vis_vmean,
139  double& angle_bin_timing_vis) const;
140  void LoadVUVSemiAnalyticProperties ( bool &isFlatPDCorr,
141  bool &isDomePDCorr,
142  double &delta_angulo_vuv,
143  double &radius) const;
144  void LoadGHFlat( std::vector<std::vector<double>> &GHvuvpars_flat,
145  std::vector<double> &border_corr_angulo_flat,
146  std::vector<std::vector<double>> &border_corr_flat) const;
147  void LoadGHDome( std::vector<std::vector<double>> &GHvuvpars_dome,
148  std::vector<double> &border_corr_angulo_dome,
149  std::vector<std::vector<double>> &border_corr_dome) const;
150  void LoadVisSemiAnalyticProperties ( double &delta_angulo_vis,
151  double &radius) const;
152  void LoadVisParsFlat(std::vector<double> &vis_distances_x_flat,
153  std::vector<double> &vis_distances_r_flat,
154  std::vector<std::vector<std::vector<double>>> &vispars_flat) const;
155  void LoadVisParsDome(std::vector<double> &vis_distances_x_dome,
156  std::vector<double> &vis_distances_r_dome,
157  std::vector<std::vector<std::vector<double>>> &vispars_dome) const;
158 
159  bool
160  IsBuildJob() const
161  {
162  return fLibraryBuildJob;
163  }
164  bool
166  {
167  return fParameterization;
168  }
169  bool
171  {
172  return fStoreReflected;
173  }
174  bool
175  StoreReflT0() const
176  {
177  return fStoreReflT0;
178  }
179  bool
181  {
182  return fParPropTime;
183  }
184  size_t
186  {
187  return fParPropTime_npar;
188  }
191  {
192  return fParPropTime_formula;
193  }
194 
195  bool
197  {
198  return fIncludePropTime;
199  }
200  bool
202  {
203  return fUseNhitsModel;
204  }
205  bool
207  {
209  }
212  {
214  }
215 
216  const sim::PhotonVoxelDef&
217  GetVoxelDef() const
218  {
219  return fVoxelDef;
220  }
221  size_t NOpChannels() const;
222 
223  private:
226  // for c2: fCurrentReflValue is unused
227  //double fCurrentReflValue;
228 
229  float fXmin, fXmax;
230  float fYmin, fYmax;
231  float fZmin, fZmax;
232  int fNx, fNy, fNz;
233 
235 
239  bool fHybrid;
246 
253 
254  TF1* fparslogNorm = nullptr;
255  TF1* fparslogNorm_far = nullptr;
256  TF1* fparsMPV = nullptr;
257  TF1* fparsMPV_far = nullptr;
258  TF1* fparsWidth = nullptr;
259  TF1* fparsCte = nullptr;
260  TF1* fparsCte_far = nullptr;
261  TF1* fparsSlope = nullptr;
263  TF1* fparslogNorm_refl = nullptr;
264  TF1* fparsMPV_refl = nullptr;
265  TF1* fparsWidth_refl = nullptr;
266  TF1* fparsCte_refl = nullptr;
267  TF1* fparsSlope_refl = nullptr;
269 
270  //for vuv time parametrization
271  std::vector<double> fDistances_landau;
272  std::vector<std::vector<double>> fNorm_over_entries;
273  std::vector<std::vector<double>> fMpv;
274  std::vector<std::vector<double>> fWidth;
275  std::vector<double> fDistances_exp;
276  std::vector<std::vector<double>> fSlope;
277  std::vector<std::vector<double>> fExpo_over_Landau_norm;
279  // for vis time parameterisation (exists for SBND, DUNE-SP)
280  std::vector<double> fDistances_refl;
281  std::vector<double> fDistances_radial_refl;
282  std::vector<std::vector<std::vector<double>>> fCut_off;
283  std::vector<std::vector<std::vector<double>>> fTau;
285 
286  //for the semi-analytic vuv/direct light signal (number of hits) correction
288  //parametrization exists for DUNE-SP and for SBND
290  // flat PDs
291  std::vector<std::vector<double>> fGHvuvpars_flat;
292  std::vector<double> fborder_corr_angulo_flat;
293  std::vector<std::vector<double>> fborder_corr_flat;
294  // dome PDs
295  std::vector<std::vector<double>> fGHvuvpars_dome;
296  std::vector<double> fborder_corr_angulo_dome;
297  std::vector<std::vector<double>> fborder_corr_dome;
298  // for the semi-analytic visible/reflection light hits correction
299  // parameterization exists for DUNE-SP and SBND
301  // flat PDs
302  std::vector<double> fvis_distances_x_flat;
303  std::vector<double> fvis_distances_r_flat;
304  std::vector<std::vector<std::vector<double>>> fvispars_flat;
305  // dome PDs
306  std::vector<double> fvis_distances_x_dome;
307  std::vector<double> fvis_distances_r_dome;
308  std::vector<std::vector<std::vector<double>>> fvispars_dome;
309 
310  // optical detector information, rest using geometry service
311  double fradius;
312 
316 
317  /// Mapping of detector space into library space.
318  std::unique_ptr<phot::IPhotonMappingTransformations> fMapping;
319 
320  geo::Point_t LibLocation(geo::Point_t const& p) const;
321 
322  int
323  VoxelAt(geo::Point_t const& p) const
324  {
325  return fVoxelDef.GetVoxelID(LibLocation(p));
326  }
327 
328  // same as `doGetVisibility()` but the channel number refers to the library
329  // ID rather than to the actual optical detector ID.
331  LibraryIndex_t libIndex,
332  bool wantReflected = false) const;
333 
334  // --- BEGIN Implementation functions --------------------------------------
335  /// @name Implementation functions
336  /// @{
337 
338  static double DistanceToOpDetImpl(geo::Point_t const& p, unsigned int OpDet);
339 
340  static double SolidAngleFactorImpl(geo::Point_t const& p, unsigned int OpDet);
341 
342  bool doHasVisibility(geo::Point_t const& p, bool wantReflected = false) const;
343 
344  float doGetVisibility(geo::Point_t const& p,
345  unsigned int OpChannel,
346  bool wantReflected = false) const;
347 
348  MappedCounts_t doGetAllVisibilities(geo::Point_t const& p, bool wantReflected = false) const;
349 
350  MappedT0s_t doGetReflT0s(geo::Point_t const& p) const;
351 
353 
355 
356  /// @}
357  // --- END Implementation functions ----------------------------------------
358 
359  }; // class PhotonVisibilityService
360 } //namespace phot
362 #endif // PHOTONVISIBILITYSERVICE_H
Definitions of voxel data structures.
std::vector< std::vector< std::vector< double > > > fTau
MappedParams_t doGetTimingPar(geo::Point_t const &p) const
Interface for transformation of photon visibility maps.
void LoadTimingsForVISPar(std::vector< double > &distances, std::vector< double > &radial_distances, std::vector< std::vector< std::vector< double >>> &cut_off, std::vector< std::vector< std::vector< double >>> &tau, double &vis_vmean, double &angle_bin_timing_vis) const
Index OpChannel(Index detNum, Index channel)
Utilities to extend the interface of geometry vectors.
phot::IPhotonLibrary::Counts_t GetLibraryReflT0Entries(int VoxID) const
MappedCounts_t doGetAllVisibilities(geo::Point_t const &p, bool wantReflected=false) const
phot::IPhotonLibrary::Counts_t GetLibraryEntries(int VoxID, bool wantReflected=false) const
std::unique_ptr< phot::IPhotonMappingTransformations > fMapping
Mapping of detector space into library space.
void RetrieveLightProd(int &VoxID, double &N) const
void SetDirectLightPropFunctions(TF1 const *functions[8], double &d_break, double &d_max, double &tf1_sampling_factor) const
std::vector< std::vector< double > > fborder_corr_flat
std::vector< double > fvis_distances_r_flat
void LoadTimingsForVUVPar(std::vector< std::vector< double >>(&v)[7], double &step_size, double &max_d, double &min_d, double &vuv_vgroup_mean, double &vuv_vgroup_max, double &inflexion_point_distance, double &angle_bin_timing_vuv) const
std::vector< double > fvis_distances_x_dome
std::string string
Definition: nybbler.cc:12
void SetLibraryTimingParEntry(int VoxID, int OpChannel, float value, size_t parnum)
std::vector< std::vector< double > > fWidth
std::vector< double > fvis_distances_r_dome
OpDetID_t LibraryIndex_t
Type describing a library index. FIXME former LibraryOpDetID_t.
phot::IPhotonMappingTransformations::LibraryIndex_t LibraryIndex_t
Type of optical library index.
Representation of a region of space diced into voxels.
Definition: PhotonVoxels.h:58
struct vector vector
::geo::Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
float GetLibraryTimingParEntry(int VoxID, OpDetID_t libOpChannel, size_t npar) const
bool HasLibraryEntries(int VoxID, bool wantReflected=false) const
void LoadVisParsFlat(std::vector< double > &vis_distances_x_flat, std::vector< double > &vis_distances_r_flat, std::vector< std::vector< std::vector< double >>> &vispars_flat) const
float doGetVisibilityOfOpLib(geo::Point_t const &p, LibraryIndex_t libIndex, bool wantReflected=false) const
MappedFunctions_t GetTimingTF1(Point const &p) const
bool doHasVisibility(geo::Point_t const &p, bool wantReflected=false) const
std::vector< double > fvis_distances_x_flat
static double DistanceToOpDet(Point const &p, unsigned int OpDet)
std::vector< std::vector< std::vector< double > > > fCut_off
float GetLibraryEntry(int VoxID, OpDetID_t libOpChannel, bool wantReflected=false) const
void LoadGHDome(std::vector< std::vector< double >> &GHvuvpars_dome, std::vector< double > &border_corr_angulo_dome, std::vector< std::vector< double >> &border_corr_dome) const
int VoxelAt(geo::Point_t const &p) const
int GetVoxelID(Point const &p) const
Returns the ID of the voxel containing p, or -1 if none.
Definition: PhotonVoxels.h:234
void LoadVUVSemiAnalyticProperties(bool &isFlatPDCorr, bool &isDomePDCorr, double &delta_angulo_vuv, double &radius) const
float GetLibraryReflT0Entry(int VoxID, OpDetID_t libOpChannel) const
bool HasVisibility(Point const &p, bool wantReflected=false) const
void SetReflectedCOLightPropFunctions(TF1 const *functions[5], double &t0_max, double &t0_break_point) const
PhotonVisibilityService(fhicl::ParameterSet const &pset)
void LoadGHFlat(std::vector< std::vector< double >> &GHvuvpars_flat, std::vector< double > &border_corr_angulo_flat, std::vector< std::vector< double >> &border_corr_flat) const
MappedFunctions_t doGetTimingTF1(geo::Point_t const &p) const
geo::Point_t LibLocation(geo::Point_t const &p) const
MappedT0s_t GetReflT0s(Point const &p) const
void LoadVisParsDome(std::vector< double > &vis_distances_x_dome, std::vector< double > &vis_distances_r_dome, std::vector< std::vector< std::vector< double >>> &vispars_dome) const
std::vector< double > fDistances_radial_refl
#define DECLARE_ART_SERVICE(svc, scope)
std::string VISBorderCorrectionType() const
void SetLibraryReflT0Entry(int VoxID, int OpChannel, float value)
void reconfigure(fhicl::ParameterSet const &p)
p
Definition: test.py:223
std::vector< std::vector< double > > fGHvuvpars_flat
phot::IPhotonMappingTransformations::OpDetID_t OpDetID_t
Type of (global) optical detector ID.
std::vector< float > const * Params_t
MappedCounts_t GetAllVisibilities(Point const &p, bool wantReflected=false) const
std::vector< std::vector< double > > fGHvuvpars_dome
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:184
std::vector< std::vector< double > > fExpo_over_Landau_norm
const sim::PhotonVoxelDef & GetVoxelDef() const
void LoadVisSemiAnalyticProperties(double &delta_angulo_vis, double &radius) const
General LArSoft Utilities.
std::vector< std::vector< double > > fMpv
void SetLibraryEntry(int VoxID, OpDetID_t libOpChannel, float N, bool wantReflected=false)
A container for photon visibility mapping data.
Declaration of types related to photon visibility.
std::vector< std::vector< double > > fborder_corr_dome
float doGetVisibility(geo::Point_t const &p, unsigned int OpChannel, bool wantReflected=false) const
std::vector< double > fborder_corr_angulo_flat
def func()
Definition: docstring.py:7
void SetLibraryTimingTF1Entry(int VoxID, int OpChannel, TF1 const &func)
std::vector< std::vector< std::vector< double > > > fvispars_dome
std::vector< std::vector< double > > fNorm_over_entries
Definitions of geometry vector data types.
static double SolidAngleFactor(Point const &p, unsigned int OpDet)
const float * Counts_t
Type for visibility count per optical channel.
Interface shared by all PhotonLibrary-like classes.
static double DistanceToOpDetImpl(geo::Point_t const &p, unsigned int OpDet)
MappedT0s_t doGetReflT0s(geo::Point_t const &p) const
static double SolidAngleFactorImpl(geo::Point_t const &p, unsigned int OpDet)
MappedParams_t GetTimingPar(Point const &p) const
std::vector< std::vector< double > > fSlope
float GetVisibility(Point const &p, unsigned int OpChannel, bool wantReflected=false) const
phot::IPhotonLibrary::Functions_t GetLibraryTimingTF1Entries(int VoxID) const
std::vector< double > fborder_corr_angulo_dome
phot::IPhotonLibrary::Params_t GetLibraryTimingParEntries(int VoxID) const
std::vector< std::vector< std::vector< double > > > fvispars_flat