Jpp  18.3.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JPMTParametersToolkit.hh
Go to the documentation of this file.
1 #ifndef __JDETECTOR__JPMTPARAMETERSTOOLKIT__
2 #define __JDETECTOR__JPMTPARAMETERSTOOLKIT__
3 
4 #include <limits>
5 
8 #include "JLang/JException.hh"
9 #include "JLang/JThrow.hh"
10 
11 
12 /**
13  * \author mdejong
14  * \file
15  * Auxiliary methods to convert hit probability to QE and vice versa.
16  */
17 
18 namespace JDETECTOR {}
19 namespace JPP { using namespace JDETECTOR; }
20 
21 namespace JDETECTOR {
22 
24 
25 
26  /**
27  * Get model dependent probability that a one photo-electron hit survives the simulation of the PMT assuming QE = 1.
28  *
29  * \param parameters PMT parameters
30  * \return probability
31  */
33  {
35  const int NPE = 1;
36 
37  data.QE = 1.0;
38 
40  }
41 
42 
43  /**
44  * Get ratio of hit probabilities for given QE and expectation value of the number of photo-electrons.\n
45  * The ratio corresponds to the hit probability with given QE divided by that with QE = 1.\n
46  * The expectation value is defined for a two-fold (or higher) coincidence.
47  *
48  * \param QE QE
49  * \param mu expectation value
50  * \return ratio
51  */
52  inline double getHitProbability(const double QE, const double mu)
53  {
54  if (mu > 0.0)
55  return (1.0 - exp(-QE*mu)) / (1.0 - exp(-mu));
56  else
57  return QE;
58  }
59 
60 
61  /**
62  * Get maximal ratio of hit probabilities for given QE and expectation value of the number of photo-electrons.\n
63  * The ratio corresponds to the hit probability with infinite QE divided by that with QE = 1.\n
64  * The expectation value is defined for a two-fold (or higher) coincidence.
65  *
66  * \param mu expectation value
67  * \return ratio
68  */
69  inline double getMaximalHitProbability(const double mu)
70  {
71  using namespace std;
72 
73  if (mu > 0.0)
74  return 1.0 / (1.0 - exp(-mu));
75  else
76  return numeric_limits<double>::max();
77  }
78 
79 
80  /**
81  * Get QE for given ratio of hit probabilities and expectation value of the number of photo-electrons.\n
82  * The ratio corresponds to the hit probability with given QE divided by that with QE = 1.\n
83  * The expectation value is defined for a two-fold (or higher) coincidence.
84  *
85  * \param R ratio
86  * \param mu expectation value
87  * \return QE
88  */
89  inline double getQE(const double R, const double mu)
90  {
91  if (R < getMaximalHitProbability(mu)) {
92 
93  if (mu > 0.0)
94  return -log(1.0 - R*(1.0 - exp(-mu))) / mu;
95  else
96  return R;
97 
98  } else {
99 
100  THROW(JValueOutOfRange, "Inconsistent arguments at method getQE(" << R << "," << mu <<")");
101  }
102  }
103 }
104 
105 #endif
Exceptions.
then set_variable DIR else fatal Wrong number of arguments fi for INPUT_FILE in ls rt $DIR stage * log
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Definition: diff-Tuna.sh:38
double getQE(const double R, const double mu)
Get QE for given ratio of hit probabilities and expectation value of the number of photo-electrons...
double getHitProbability(const double QE, const double mu)
Get ratio of hit probabilities for given QE and expectation value of the number of photo-electrons...
then JCookie sh JDataQuality D $DETECTOR_ID R
Definition: JDataQuality.sh:41
double getSurvivalProbability(const JPMTParameters &parameters)
Get model dependent probability that a one photo-electron hit survives the simulation of the PMT assu...
Exception handling.
PMT analogue signal processor.
Exception for accessing a value in a collection that is outside of its range.
Definition: JException.hh:178
Data structure for PMT parameters.
double getMaximalHitProbability(const double mu)
Get maximal ratio of hit probabilities for given QE and expectation value of the number of photo-elec...
double QE
relative quantum efficiency
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable STRING $argv[2] set_array QUANTILES set_variable FORMULA *[0] exp(-0.5 *(x-[1])*(x-[1])/([2]*[2]))" set_variable MODULE `getModule -a $DETECTOR -L "$STRING 0"` source JAcousticsToolkit.sh typeset -A TRIPODS get_tripods $WORKDIR/tripod.txt TRIPODS XMEAN
virtual double getSurvivalProbability(const int NPE) const override
Probability that a hit survives the simulation of the PMT.