Jpp  16.0.0-rc.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JGeanx.hh
Go to the documentation of this file.
1 #ifndef __JPHYSICS__JGEANX__
2 #define __JPHYSICS__JGEANX__
3 
4 #include <cmath>
5 
7 #include "JPhysics/JConstants.hh"
8 
9 /**
10  * \file
11  * Photon emission profile EM-shower.
12  * \author mdejong
13  */
14 
15 namespace JPHYSICS {}
16 namespace JPP { using namespace JPHYSICS; }
17 
18 namespace JPHYSICS {
19 
20  /**
21  * Probability density function of photon emission from EM-shower as a function of cosine of the emission angle.
22  *
23  * \f[P(\cos(\theta)) = c \times e^{b \times |\cos(\theta) - 1/n|^a}\f]
24  *
25  * where \f$c\f$ is a normalisation constant such that the integral of \f$P\f$ over the full solid angle is one.
26  *
27  * The parametrisation is taken from reference:
28  * R. Mirani, "Parametrisation of EM-showers in the ANTARES detector volume.",
29  * Doctoral thesis in computational physics, University of Amsterdam.
30  */
31  class JGeanx
32  {
33  public:
34  /**
35  * Constructor.
36  *
37  * \param __a power
38  * \param __b exponential slope
39  * \param __n index of refraction
40  */
41  JGeanx(const double __a,
42  const double __b,
43  const double __n = getIndexOfRefractionPhase()) :
44  a(__a),
45  b(__b),
46  n(__n)
47  {
48  const double y = evaluate(-1.0, +1.0);
49 
50  c = 1.0 / (y * 2*PI);
51  }
52 
53 
54  /**
55  * Number of photons from EM-shower as a function of emission angle.
56  * The integral over full solid angle is normalised to one.
57  *
58  * \param ct cosine angle of emmision
59  * \return d^2P/dcos()dphi
60  */
61  double operator()(const double ct) const
62  {
63  return c * evaluate(ct);
64  }
65 
66 
67  /**
68  * Integral number of photons from EM-shower between two emission angles.
69  * The integral over full solid angle is normalised to one.
70  *
71  * \param xmin minimal cosine angle of emmision
72  * \param xmax maximal cosine angle of emmision
73  * \return dnpe/dphi
74  */
75  double operator()(const double xmin,
76  const double xmax) const
77  {
78  return c * evaluate(xmin, xmax);
79  }
80 
81 
82  /**
83  * Functional dependence.
84  * In this, the normalisation constant c = 1.
85  *
86  * \param ct cosine angle of emmision
87  * \return f()
88  */
89  double evaluate(const double ct) const
90  {
91  const double x = fabs(ct - 1.0/n);
92 
93  return exp(b * pow(x,a));
94  }
95 
96 
97  /**
98  * Integral.
99  * In this, the normalisation constant <tt>c = 1</tt>.
100  *
101  * \param xmin minimal cosine angle of emmision
102  * \param xmax maximal cosine angle of emmision
103  * \return integral f() x dcos()
104  */
105  double evaluate(const double xmin,
106  const double xmax) const
107  {
108  using namespace std;
109  using namespace JPP;
110 
111  const double x = 1.0 / n;
112 
113  const double ai = 1.0 / a;
114  const double bi = 1.0 / b;
115 
116  const double xl = pow(fabs(x - xmin), a) * -b;
117  const double xr = pow(fabs(x - xmax), a) * -b;
118 
119  const double gp = tgamma(ai);
120 
121  double yl = Gamma(ai, xl) * gp;
122  double yr = Gamma(ai, xr) * gp;
123 
124  if (xmin > x)
125  yl = -yl;
126  if (xmax < x)
127  yr = -yr;
128 
129  return ai * pow(-bi,ai) * (yl + yr);
130  }
131 
132 
133  const double a; //!< power
134  const double b; //!< slope
135  const double n; //!< index of refraction
136 
137  private:
138  double c; //!< normalisation constant
139  };
140 
141 
142  /**
143  * Function object for the number of photons from EM-shower as a function of emission angle.
144  */
145  static const JGeanx geanx(0.35, -5.40);
146 }
147 
148 #endif
Auxiliary methods for mathematics.
const double b
slope
Definition: JGeanx.hh:134
double Gamma(const double a, const double x)
Incomplete gamma function.
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 JAcoustics.sh -- typeset -A TRIPODS get_tripods $WORKDIR/tripod.txt TRIPODS XMEAN
double evaluate(const double xmin, const double xmax) const
Integral.
Definition: JGeanx.hh:105
T pow(const T &x, const double y)
Power .
Definition: JMath.hh:98
Physics constants.
const double n
index of refraction
Definition: JGeanx.hh:135
static const double PI
Mathematical constants.
double getIndexOfRefractionPhase()
Get average index of refraction of water corresponding to phase velocity.
double c
normalisation constant
Definition: JGeanx.hh:138
Probability density function of photon emission from EM-shower as a function of cosine of the emissio...
Definition: JGeanx.hh:31
double operator()(const double ct) const
Number of photons from EM-shower as a function of emission angle.
Definition: JGeanx.hh:61
static const JGeanx geanx(0.35,-5.40)
Function object for the number of photons from EM-shower as a function of emission angle...
const double a
power
Definition: JGeanx.hh:133
double operator()(const double xmin, const double xmax) const
Integral number of photons from EM-shower between two emission angles.
Definition: JGeanx.hh:75
double evaluate(const double ct) const
Functional dependence.
Definition: JGeanx.hh:89
JGeanx(const double __a, const double __b, const double __n=getIndexOfRefractionPhase())
Constructor.
Definition: JGeanx.hh:41