LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
phot Namespace Reference

General LArSoft Utilities. More...

Namespaces

 details
 

Classes

class  CreateHybridLibrary
 
class  IPhotonLibrary
 Interface shared by all PhotonLibrary-like classes. More...
 
class  IPhotonMappingTransformations
 Collection of functions to transform photon mapping data. More...
 
struct  LibraryDataValidatorStruct
 Trait for determining the validity of library data in a container. More...
 
class  OpDetVisibilityData
 A container for photon visibility mapping data. More...
 
class  PDFastSimANN
 
class  PDFastSimPAR
 
class  PDFastSimPVS
 
class  PhotonLibrary
 
class  PhotonLibraryAnalyzer
 
class  PhotonLibraryHybrid
 TODO doc. More...
 
class  PhotonLibraryPropagation
 Fast simulation of propagating the photons created from SimEnergyDeposits. More...
 
class  PhotonMappingIdentityTransformations
 Trivial photon mapping transformation. More...
 
class  PhotonMappingXMirrorTransformations
 Photon mapping transformation with reflection at x = 0. More...
 
class  PhotonVisibilityService
 
class  PropagationTimeModel
 
class  ScintTime
 
class  ScintTimeLAr
 
class  SemiAnalyticalModel
 
class  TFLoader
 
class  TFLoaderMLP
 

Typedefs

using OpDetID_t = phot::IPhotonMappingTransformations::OpDetID_t
 Type of (global) optical detector ID. More...
 
using MappedCounts_t = phot::IPhotonMappingTransformations::MappedOpDetData_t< phot::IPhotonLibrary::Counts_t >
 Type of mapped visibility counts. More...
 
using MappedT0s_t = phot::IPhotonMappingTransformations::MappedOpDetData_t< phot::IPhotonLibrary::T0s_t >
 Type of mapped arrival times. More...
 
using MappedParams_t = phot::IPhotonMappingTransformations::MappedOpDetData_t< phot::IPhotonLibrary::Params_t >
 Type of set of parameters for functions. More...
 
using MappedFunctions_t = phot::IPhotonMappingTransformations::MappedOpDetData_t< phot::IPhotonLibrary::Functions_t >
 Type of mapped parametrization functions. More...
 

Functions

template<typename Cont >
bool isValidLibraryData (Cont &&cont)
 Returns the validity of content of library data in the container. More...
 
double fast_acos (double xin)
 
double interpolate (const std::vector< double > &xData, const std::vector< double > &yData, const double x, const bool extrapolate, size_t i)
 
double interpolate2 (const std::vector< double > &xDistances, const std::vector< double > &rDistances, const std::vector< std::vector< std::vector< double >>> &parameters, const double x, const double r, const size_t k)
 
void interpolate3 (std::array< double, 3 > &inter, const std::vector< double > &xData, const std::vector< double > &yData1, const std::vector< double > &yData2, const std::vector< double > &yData3, const double x, const bool extrapolate)
 
template<typename TReal >
static constexpr bool isApproximatelyEqual (TReal a, TReal b, TReal tolerance=std::numeric_limits< TReal >::epsilon())
 
template<typename TReal >
static constexpr bool isApproximatelyZero (TReal a, TReal tolerance=std::numeric_limits< TReal >::epsilon())
 
template<typename TReal >
static constexpr bool isDefinitelyLessThan (TReal a, TReal b, TReal tolerance=std::numeric_limits< TReal >::epsilon())
 
template<typename TReal >
static constexpr bool isDefinitelyGreaterThan (TReal a, TReal b, TReal tolerance=std::numeric_limits< TReal >::epsilon())
 

Detailed Description

General LArSoft Utilities.

Typedef Documentation

Type of mapped visibility counts.

No data storage is provided.

This is the type returned by phot::PhotonVisibilityService when asked about visibility of a point from all the optical detectors.

It used to be float const*.

Definition at line 38 of file PhotonVisibilityTypes.h.

Type of mapped parametrization functions.

No data storage is provided.

This is the type returned by phot::PhotonVisibilityService when asked about any parameter directlyt described by functions (glorious ROOT TF1), from a point to all the optical detectors.

Definition at line 73 of file PhotonVisibilityTypes.h.

Type of set of parameters for functions.

No data storage is provided.

This is the type returned by phot::PhotonVisibilityService when asked about any parametrized... parameter, from a point to all the optical detectors.

Definition at line 61 of file PhotonVisibilityTypes.h.

Type of mapped arrival times.

No data storage is provided.

This is the type returned by phot::PhotonVisibilityService when asked about time of arrival from a point to all the optical detectors.

Definition at line 49 of file PhotonVisibilityTypes.h.

Type of (global) optical detector ID.

Definition at line 25 of file PhotonVisibilityTypes.h.

Function Documentation

double phot::fast_acos ( double  xin)

Definition at line 25 of file PhotonPropagationUtils.cxx.

References a0, a1, a2, a3, util::abs(), and x.

Referenced by phot::PropagationTimeModel::getVISTimes(), phot::PropagationTimeModel::propagationTime(), phot::SemiAnalyticalModel::Rectangle_SolidAngle(), phot::SemiAnalyticalModel::VISVisibility(), and phot::SemiAnalyticalModel::VUVVisibility().

26  {
27  double const a3 = -2.08730442907856008e-02;
28  double const a2 = 7.68769404161671888e-02;
29  double const a1 = -2.12871094165645952e-01;
30  double const a0 = 1.57075835365209659e+00;
31  double const x = std::abs(xin);
32  double ret = a3;
33  ret *= x;
34  ret += a2;
35  ret *= x;
36  ret += a1;
37  ret *= x;
38  ret += a0;
39  ret *= std::sqrt(1.0 - x);
40  if (xin >= 0) return ret;
41  return M_PI - ret;
42  }
Float_t x
Definition: compare.C:6
#define a0
constexpr auto abs(T v)
Returns the absolute value of the argument.
#define a2
#define a3
#define a1
double phot::interpolate ( const std::vector< double > &  xData,
const std::vector< double > &  yData,
const double  x,
const bool  extrapolate,
size_t  i 
)

Definition at line 49 of file PhotonPropagationUtils.cxx.

References util::size().

Referenced by phot::SemiAnalyticalModel::detectedReflectedVisibilities(), phot::PropagationTimeModel::generateVUVParams(), phot::PropagationTimeModel::getVISTimes(), interpolate2(), phot::SemiAnalyticalModel::VUVAbsorptionLength(), and phot::SemiAnalyticalModel::VUVVisibility().

54  {
55  if (i == 0) {
56  size_t size = xData.size();
57  if (x >= xData[size - 2]) { // special case: beyond right end
58  i = size - 2;
59  }
60  else {
61  while (x > xData[i + 1])
62  i++;
63  }
64  }
65  double xL = xData[i];
66  double xR = xData[i + 1];
67  double yL = yData[i];
68  double yR = yData[i + 1]; // points on either side (unless beyond ends)
69  if (!extrapolate) { // if beyond ends of array and not extrapolating
70  if (x < xL) return yL;
71  if (x > xR) return yL;
72  }
73  const double dydx = (yR - yL) / (xR - xL); // gradient
74  return yL + dydx * (x - xL); // linear interpolation
75  }
Float_t x
Definition: compare.C:6
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:101
double phot::interpolate2 ( const std::vector< double > &  xDistances,
const std::vector< double > &  rDistances,
const std::vector< std::vector< std::vector< double >>> &  parameters,
const double  x,
const double  r,
const size_t  k 
)

Definition at line 77 of file PhotonPropagationUtils.cxx.

References interpolate(), and util::size().

Referenced by phot::SemiAnalyticalModel::VISVisibility().

83  {
84  // interpolate in x for each r bin, for angle bin k
85  const size_t nbins_r = parameters[k].size();
86  std::vector<double> interp_vals(nbins_r, 0.);
87 
88  size_t idx = 0;
89  size_t size = xDistances.size();
90  if (x >= xDistances[size - 2])
91  idx = size - 2;
92  else {
93  while (x > xDistances[idx + 1])
94  idx++;
95  }
96  for (size_t i = 0; i < nbins_r; ++i) {
97  interp_vals[i] = interpolate(xDistances, parameters[k][i], x, false, idx);
98  }
99 
100  // interpolate in r
101  double border_correction = interpolate(rDistances, interp_vals, r, false);
102  return border_correction;
103  }
Float_t x
Definition: compare.C:6
TRandom r
Definition: spectrum.C:23
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:101
double interpolate(const std::vector< double > &xData, const std::vector< double > &yData, const double x, const bool extrapolate, size_t i)
void phot::interpolate3 ( std::array< double, 3 > &  inter,
const std::vector< double > &  xData,
const std::vector< double > &  yData1,
const std::vector< double > &  yData2,
const std::vector< double > &  yData3,
const double  x,
const bool  extrapolate 
)

Definition at line 106 of file PhotonPropagationUtils.cxx.

References util::size().

Referenced by phot::PropagationTimeModel::generateVUVParams().

113  {
114  size_t size = xData.size();
115  size_t i = 0; // find left end of interval for interpolation
116  if (x >= xData[size - 2]) { // special case: beyond right end
117  i = size - 2;
118  }
119  else {
120  while (x > xData[i + 1])
121  i++;
122  }
123  double xL = xData[i];
124  double xR = xData[i + 1]; // points on either side (unless beyond ends)
125  double yL1 = yData1[i];
126  double yR1 = yData1[i + 1];
127  double yL2 = yData2[i];
128  double yR2 = yData2[i + 1];
129  double yL3 = yData3[i];
130  double yR3 = yData3[i + 1];
131 
132  if (!extrapolate) { // if beyond ends of array and not extrapolating
133  if (x < xL) {
134  inter[0] = yL1;
135  inter[1] = yL2;
136  inter[2] = yL3;
137  return;
138  }
139  if (x > xR) {
140  inter[0] = yL1;
141  inter[1] = yL2;
142  inter[2] = yL3;
143  return;
144  }
145  }
146  const double m = (x - xL) / (xR - xL);
147  inter[0] = m * (yR1 - yL1) + yL1;
148  inter[1] = m * (yR2 - yL2) + yL2;
149  inter[2] = m * (yR3 - yL3) + yL3;
150  }
Float_t x
Definition: compare.C:6
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:101
template<typename TReal >
static constexpr bool phot::isApproximatelyEqual ( TReal  a,
TReal  b,
TReal  tolerance = std::numeric_limits<TReal>::epsilon() 
)
inlinestatic

Definition at line 38 of file PhotonPropagationUtils.h.

Referenced by phot::SemiAnalyticalModel::Disk_SolidAngle().

39  {
40  TReal diff = std::fabs(a - b);
41  if (diff <= tolerance) return true;
42  if (diff < std::fmax(std::fabs(a), std::fabs(b)) * tolerance) return true;
43  return false;
44  }
template<typename TReal >
static constexpr bool phot::isApproximatelyZero ( TReal  a,
TReal  tolerance = std::numeric_limits<TReal>::epsilon() 
)
inlinestatic

Definition at line 50 of file PhotonPropagationUtils.h.

Referenced by phot::SemiAnalyticalModel::Disk_SolidAngle(), and phot::SemiAnalyticalModel::Rectangle_SolidAngle().

53  {
54  if (std::fabs(a) <= tolerance) return true;
55  return false;
56  }
template<typename TReal >
static constexpr bool phot::isDefinitelyGreaterThan ( TReal  a,
TReal  b,
TReal  tolerance = std::numeric_limits<TReal>::epsilon() 
)
inlinestatic

Definition at line 72 of file PhotonPropagationUtils.h.

Referenced by phot::SemiAnalyticalModel::Disk_SolidAngle(), and phot::SemiAnalyticalModel::Rectangle_SolidAngle().

73  {
74  TReal diff = a - b;
75  if (diff > tolerance) return true;
76  if (diff > std::fmax(std::fabs(a), std::fabs(b)) * tolerance) return true;
77  return false;
78  }
template<typename TReal >
static constexpr bool phot::isDefinitelyLessThan ( TReal  a,
TReal  b,
TReal  tolerance = std::numeric_limits<TReal>::epsilon() 
)
inlinestatic

Definition at line 62 of file PhotonPropagationUtils.h.

Referenced by phot::SemiAnalyticalModel::Disk_SolidAngle().

63  {
64  TReal diff = a - b;
65  if (diff < tolerance) return true;
66  if (diff < std::fmax(std::fabs(a), std::fabs(b)) * tolerance) return true;
67  return false;
68  }
template<typename Cont >
bool phot::isValidLibraryData ( Cont &&  cont)

Returns the validity of content of library data in the container.

Template Parameters
Conttype of the container being tested
Parameters
conta reference to the container being tested
Returns
whether the content of library data in cont is valid.

Customization of this behaviour should be through specialization of phot::LibraryDataValidatorStruct.

Definition at line 344 of file OpDetVisibilityData.h.

References phot::OpDetVisibilityData< Cont, Mapping >::isValid().

Referenced by phot::OpDetVisibilityData< Cont, Mapping >::effectiveSize().

345  {
346  return LibraryDataValidatorStruct<std::remove_reference_t<Cont>>::isValid(cont);
347  } // isValidLibraryData()