Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JGeant_t.hh
Go to the documentation of this file.
1#ifndef __JPHYSICS__JGEANT_T__
2#define __JPHYSICS__JGEANT_T__
3
6
7/**
8 * \file
9 * Base class for photon emission profile EM-shower.
10 * \author mdejong
11 */
12
13namespace JPHYSICS {}
14namespace JPP { using namespace JPHYSICS; }
15
16namespace JPHYSICS {
17
18 using JIO::JReader;
19 using JIO::JWriter;
20
22
23
24 /**
25 * Base class for the probability density function of photon emission from EM-shower
26 * as a function of the index of refraction and the cosine of the emission angle.
27 *
28 * The implementation of this function is based on a linear interpolation of tabulated values.
29 * In this, a linear approximation of the dependence of the normalisation constant on
30 * the index of refraction is assumed. This assumption is valid to within 10^-3.
31 */
32 class JGeant_t :
34 {
35 public:
36 /**
37 * Default constructor.
38 */
40 {}
41
42
43 /**
44 * Number of photons from EM-shower as a function of emission angle.
45 * The integral over full solid angle is normalised to one.
46 *
47 * \param n index of refraction
48 * \param ct cosine angle of emmision
49 * \return d^2P/dcos()dphi
50 */
51 double operator()(const double n,
52 const double ct) const
53 {
54 const double y = JGeantFunction1D_t::operator()(ct - 1.0/n);
55
56 return y * (a0 - a1*n);
57 }
58
59
60 /**
61 * Integral number of photons from EM-shower between two emission angles.
62 * The integral over full solid angle is normalised to one.
63 *
64 * \param n index of refraction
65 * \param xmin minimal cosine angle of emmision
66 * \param xmax maximal cosine angle of emmision
67 * \return dnpe/dphi
68 */
69 double operator()(const double n,
70 const double xmin,
71 const double xmax) const
72 {
73 const double x_min = std::max(xmin - 1.0/n, buffer. begin()->getX());
74 const double x_max = std::min(xmax - 1.0/n, buffer.rbegin()->getX());
75
76 const double y = buffer(x_max) - buffer(x_min);
77
78 return y * (a0 - a1*n);
79 }
80
81
82 /**
83 * Read geant from input.
84 *
85 * \param in reader
86 * \param geant geant
87 * \return reader
88 */
89 friend inline JReader& operator>>(JReader& in, JGeant_t& geant)
90 {
91 in >> geant.a0;
92 in >> geant.a1;
93 in >> static_cast<JGeantFunction1D_t&>(geant);
94
95 geant.compile();
96
97 return in;
98 }
99
100
101 /**
102 * Write geant to output.
103 *
104 * \param out writer
105 * \param geant geant
106 * \return writer
107 */
108 friend inline JWriter& operator<<(JWriter& out, const JGeant_t& geant)
109 {
110 out << geant.a0;
111 out << geant.a1;
112 out << static_cast<const JGeantFunction1D_t&>(geant);
113
114 return out;
115 }
116
117
118 protected:
119 /**
120 * Function compilation.
121 */
122 virtual void do_compile() override
123 {
124 JGeantFunction1D_t::do_compile();
125
126 buffer.clear();
127
129
130 buffer.compile();
131 }
132
133
134 double a0; //!< offset of the normalisation dependence
135 double a1; //!< slope of the normalisation dependence
137 };
138}
139
140#endif
Interface for binary input.
Interface for binary output.
Base class for the probability density function of photon emission from EM-shower as a function of th...
Definition JGeant_t.hh:34
friend JReader & operator>>(JReader &in, JGeant_t &geant)
Read geant from input.
Definition JGeant_t.hh:89
friend JWriter & operator<<(JWriter &out, const JGeant_t &geant)
Write geant to output.
Definition JGeant_t.hh:108
JGeantFunction1D_t buffer
Definition JGeant_t.hh:136
double a0
offset of the normalisation dependence
Definition JGeant_t.hh:134
double operator()(const double n, const double xmin, const double xmax) const
Integral number of photons from EM-shower between two emission angles.
Definition JGeant_t.hh:69
double operator()(const double n, const double ct) const
Number of photons from EM-shower as a function of emission angle.
Definition JGeant_t.hh:51
JGeant_t()
Default constructor.
Definition JGeant_t.hh:39
virtual void do_compile() override
Function compilation.
Definition JGeant_t.hh:122
double a1
slope of the normalisation dependence
Definition JGeant_t.hh:135
Auxiliary methods for light properties of deep-sea water.
static const JGeant geant(geanx, 0.0001)
Function object for the number of photons from EM-shower as a function of emission angle.
JTOOLS::JGridPolint1Function1D_t JGeantFunction1D_t
Definition JGeant_t.hh:21
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
JElement_t::ordinate_type integrate(const JCollection< JElement_t, JDistance_t > &input, typename JMappable< JElement_t >::map_type &output)
Conversion of data points to integral values.
Type definition of a 1st degree polynomial interpolation based on a JGridCollection with result type ...