Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JGeant_t.hh
Go to the documentation of this file.
1 #ifndef __JPHYSICS__JGEANT_T__
2 #define __JPHYSICS__JGEANT_T__
3 
5 #include "JIO/JSerialisable.hh"
6 
7 /**
8  * \file
9  * Base class for photon emission profile EM-shower.
10  * \author mdejong
11  */
12 
13 namespace JPHYSICS {}
14 namespace JPP { using namespace JPHYSICS; }
15 
16 namespace 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 :
33  public JGeantFunction1D_t
34  {
35  public:
36  /**
37  * Default constructor.
38  */
40  {}
41 
42 
43  /**
44  * Function compilation.
45  */
46  virtual void compile()
47  {
48  JGeantFunction1D_t::compile();
49 
50  buffer.clear();
51 
52  JTOOLS::integrate(*this, buffer);
53 
54  buffer.compile();
55  }
56 
57 
58  /**
59  * Number of photons from EM-shower as a function of emission angle.
60  * The integral over full solid angle is normalised to one.
61  *
62  * \param n index of refraction
63  * \param ct cosine angle of emmision
64  * \return d^2P/dcos()dphi
65  */
66  double operator()(const double n,
67  const double ct) const
68  {
69  const double y = JGeantFunction1D_t::operator()(ct - 1.0/n);
70 
71  return y * (a0 - a1*n);
72  }
73 
74 
75  /**
76  * Integral number of photons from EM-shower between two emission angles.
77  * The integral over full solid angle is normalised to one.
78  *
79  * \param n index of refraction
80  * \param xmin minimal cosine angle of emmision
81  * \param xmax maximal cosine angle of emmision
82  * \return dnpe/dphi
83  */
84  double operator()(const double n,
85  const double xmin,
86  const double xmax) const
87  {
88  const double x_min = std::max(xmin - 1.0/n, buffer. begin()->getX());
89  const double x_max = std::min(xmax - 1.0/n, buffer.rbegin()->getX());
90 
91  const double y = buffer(x_max) - buffer(x_min);
92 
93  return y * (a0 - a1*n);
94  }
95 
96 
97  /**
98  * Read geant from input.
99  *
100  * \param in reader
101  * \param geant geant
102  * \return reader
103  */
105  {
106  in >> geant.a0;
107  in >> geant.a1;
108  in >> static_cast<JGeantFunction1D_t&>(geant);
109 
110  geant.compile();
111 
112  return in;
113  }
114 
115 
116  /**
117  * Write geant to output.
118  *
119  * \param out writer
120  * \param geant geant
121  * \return writer
122  */
123  friend inline JWriter& operator<<(JWriter& out, const JGeant_t& geant)
124  {
125  out << geant.a0;
126  out << geant.a1;
127  out << static_cast<const JGeantFunction1D_t&>(geant);
128 
129  return out;
130  }
131 
132 
133  protected:
134  double a0; //!< offset of the normalisation dependence
135  double a1; //!< slope of the normalisation dependence
137  };
138 }
139 
140 #endif
friend JWriter & operator<<(JWriter &out, const JGeant_t &geant)
Write geant to output.
Definition: JGeant_t.hh:123
virtual void compile()
Function compilation.
Definition: JGeant_t.hh:46
Interface for binary output.
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:84
result_type operator()(const argument_type x) const
Function value evaluation.
Definition: JFunctional.hh:333
double a1
slope of the normalisation dependence
Definition: JGeant_t.hh:135
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
Definition: JSirene.sh:45
friend JReader & operator>>(JReader &in, JGeant_t &geant)
Read geant from input.
Definition: JGeant_t.hh:104
static const JGeant geant(geanx, 0.0001)
Function object for the number of photons from EM-shower as a function of emission angle...
Type definition of a 1st degree polynomial interpolation based on a JGridCollection with result type ...
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:66
double a0
offset of the normalisation dependence
Definition: JGeant_t.hh:134
Interface for binary input.
Base class for the probability density function of photon emission from EM-shower as a function of th...
Definition: JGeant_t.hh:32
JGeant_t()
Default constructor.
Definition: JGeant_t.hh:39
JGeantFunction1D_t buffer
Definition: JGeant_t.hh:136
alias put_queue eval echo n
Definition: qlib.csh:19
JTOOLS::JGridPolint1Function1D_t JGeantFunction1D_t
Definition: JGeant_t.hh:21
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.
Definition: JCollection.hh:812