Jpp  18.0.0-rc.4
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JGeanz.hh
Go to the documentation of this file.
1 #ifndef __JPHYSICS__JGEANZ__
2 #define __JPHYSICS__JGEANZ__
3 
4 #include <cmath>
5 
7 
8 /**
9  * \file
10  * Longitudinal emission profile EM-shower.
11  * \author mdejong
12  */
13 
14 namespace JPHYSICS {}
15 namespace JPP { using namespace JPHYSICS; }
16 
17 namespace JPHYSICS {
18 
19  /**
20  * Function object for longitudinal profile of EM-shower.
21  *
22  *
23  * \f[P(z) \propto z^{a-1} \times e^{-z/b}\f]
24  *
25  * where: \f[a = a_{0} + a_{1} \times \ln(E)\f]
26  *
27  * The parametrisation is taken from reference:
28  * C. Kopper, "Performance Studies for the KM3NeT Neutrino Telescope.",
29  * PhD thesis, University of Erlangen.
30  */
31  class JGeanz {
32  public:
33  /**
34  * constructor
35  * \param __a0 power term (constant)
36  * \param __a1 power term (E dependence)
37  * \param __b expontial slope
38  */
39  JGeanz(const double __a0,
40  const double __a1,
41  const double __b) :
42  a0(__a0),
43  a1(__a1),
44  b (__b),
45  Emin(exp(-a0/a1))
46  {}
47 
48 
49  /**
50  * Probability Density Function
51  *
52  * \param E EM-shower energy [GeV]
53  * \param z z position of light emission point relative to vertex location (z >= 0) [m]
54  * \return dP/dz
55  */
56  double getProbability(const double E,
57  const double z) const
58  {
59  if (E > Emin) {
60 
61  const double a = a0 + a1 * log(E);
62  const double y = pow(z,a-1.0) * exp(-z/b) / (pow(b,a) * std::tgamma(a));
63 
64  return y;
65  }
66 
67  if (z <= getMinimalShowerSize())
68  return 1.0 / getMinimalShowerSize();
69  else
70  return 0.0;
71  }
72 
73 
74  /**
75  * Probability Density Function
76  *
77  * \param E EM-shower energy [GeV]
78  * \param z z position of light emission point relative to vertex location (z >= 0) [m]
79  * \return dP/dz
80  */
81  double operator()(const double E,
82  const double z) const
83  {
84  return getProbability(E, z);
85  }
86 
87 
88  /**
89  * Integral of PDF (starting from 0).
90  *
91  * \param E EM-shower energy [GeV]
92  * \param z z position [m] (>= 0)
93  * \return dP
94  */
95  double getIntegral(const double E,
96  const double z) const
97  {
98  if (E > Emin) {
99 
100  const double a = a0 + a1 * log(E);
101  const double x = z / b;
102  const double y = JMATH::Gamma(a,x);
103 
104  return y;
105  }
106 
107  if (z <= getMinimalShowerSize())
108  return z / getMinimalShowerSize();
109  else
110  return 1.0;
111  }
112 
113 
114  /**
115  * Get shower length for a given integrated probability.
116  *
117  * \param E EM-shower energy [GeV]
118  * \param P integrated probability [0,1]
119  * \param eps relative precision
120  * \return shower length [m]
121  */
122  double getLength(const double E,
123  const double P,
124  const double eps = 1.0e-3) const
125  {
126  double zmin = 0.0; // [m]
127  double zmax = 30.0; // [m]
128 
129  if (E > Emin) {
130 
131  const double Q = P * (1.0 - eps);
132 
133  for (int i = 100; i != 0; --i) {
134 
135  const double z = 0.5 * (zmin + zmax);
136  const double p = getIntegral(E, z);
137 
138  if (fabs(p-Q) < p*eps) {
139  return z;
140  }
141 
142  if (p > P)
143  zmax = z;
144  else
145  zmin = z;
146  }
147 
148  return 0.5 * (zmin + zmax);
149 
150  } else
151 
152  return 0.0;
153  }
154 
155  /**
156  * Get depth of shower maximum
157  *
158  * \param E EM-shower energy[GeV]
159  * \return depth of maximum [m]
160  */
161 
162  double getMaximum(const double E) const
163  {
164  const double a = a0 + a1 * log(E);
165 
166  return (a-1)*b;
167  }
168 
169 
170  /**
171  * Get minimal shower size.
172  *
173  * \return size [m]
174  */
175  static double getMinimalShowerSize()
176  {
177  return 1e-6;
178  }
179 
180  protected:
181  const double a0;
182  const double a1;
183  const double b;
184  const double Emin;
185  };
186 
187 
188  /**
189  * Function object for longitudinal EM-shower profile
190  */
191  static const JGeanz geanz(1.85, 0.62, 0.54);
192 }
193 
194 #endif
Q(UTCMax_s-UTCMin_s)-livetime_s
Auxiliary methods for mathematics.
then usage $script< input file >[option[primary[working directory]]] nWhere option can be E
Definition: JMuonPostfit.sh:40
Function object for longitudinal profile of EM-shower.
Definition: JGeanz.hh:31
double Gamma(const double a, const double x)
Incomplete gamma function.
JGeanz(const double __a0, const double __a1, const double __b)
constructor
Definition: JGeanz.hh:39
const double a1
Definition: JGeanz.hh:182
then JCalibrateToT a
Definition: JTuneHV.sh:116
static const JGeanz geanz(1.85, 0.62, 0.54)
Function object for longitudinal EM-shower profile.
T pow(const T &x, const double y)
Power .
Definition: JMath.hh:97
const double a0
Definition: JGeanz.hh:181
static double getMinimalShowerSize()
Get minimal shower size.
Definition: JGeanz.hh:175
then set_variable DIR else fatal Wrong number of arguments fi for INPUT_FILE in ls rt $DIR stage * log
const double Emin
Definition: JGeanz.hh:184
double getIntegral(const double E, const double z) const
Integral of PDF (starting from 0).
Definition: JGeanz.hh:95
double getMaximum(const double E) const
Get depth of shower maximum.
Definition: JGeanz.hh:162
double getLength(const double E, const double P, const double eps=1.0e-3) const
Get shower length for a given integrated probability.
Definition: JGeanz.hh:122
double getProbability(const double E, const double z) const
Probability Density Function.
Definition: JGeanz.hh:56
const double b
Definition: JGeanz.hh:183
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
double operator()(const double E, const double z) const
Probability Density Function.
Definition: JGeanz.hh:81
then $DIR JPlotNPE PDG P
Definition: JPlotNPE-PDG.sh:62