Jpp  19.1.0
the software that should make you happy
JOscProbFunction.hh
Go to the documentation of this file.
1 #ifndef __JOSCPROB__JOSCPROBFUNCTION__
2 #define __JOSCPROB__JOSCPROBFUNCTION__
3 
4 #include "JLang/JClonable.hh"
5 
9 
10 
11 /**
12  * \author bjung
13  */
14 
15 namespace JOSCPROB {}
16 namespace JPP { using namespace JOSCPROB; }
17 
18 namespace JOSCPROB {
19 
20  using JLANG::JClonable;
21 
22 
23  /**
24  * Implementation of oscillation probability function interface.
25  *
26  * The template argument refers to a function of which the copy constuctor needs to be defined\n
27  * and which must contain the methods `setParameters(const JOscParameters&)` and `getP(const JOscChannel&, const double, const double)`.
28  */
29  template<class JFunction_t>
30  struct JOscProbFunction final :
31  public JClonable<JOscProbInterface, JOscProbFunction<JFunction_t> >
32  {
34 
35  /**
36  * Constructor.
37  *
38  * \param function oscillation probability function
39  */
40  JOscProbFunction(const JFunction_t& function) :
42  {}
43 
44 
45  /**
46  * Set oscillation parameters.
47  *
48  * \param parameters oscillation parameters
49  */
50  void setParameters(const JOscParameters_t& parameters) const
51  {
52  function.setParameters(parameters);
53  }
54 
55 
56  /**
57  * Get oscillation probability for given oscillation channel.
58  *
59  * \param channel oscillation channel
60  * \param energy neutrino energy [GeV]
61  * \param costh cosine zenith angle
62  * \return oscillation probability
63  */
64  double getP(const JOscChannel& channel,
65  const double energy,
66  const double costh) const override final
67  {
68  return function.getP(channel, energy, costh);
69  }
70 
71 
72  private:
73 
74  JFunction_t function; //!< oscillation probability function
75  };
76 
77 
78  /**
79  * Auxiliary method for creating an interface to an oscillation probability function.
80  *
81  * \param function oscillation probability function object
82  * \return oscillation probability function interface
83  */
84  template<class JFunction_t>
85  inline JOscProbFunction<JFunction_t> make_oscProbFunction(const JFunction_t& function) {
86  return JOscProbFunction<JFunction_t>(function);
87  }
88 }
89 
90 #endif
Interface class for sets of oscillation parameters.
JOscProbFunction< JFunction_t > make_oscProbFunction(const JFunction_t &function)
Auxiliary method for creating an interface to an oscillation probability function.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Template class for object cloning.
Definition: JClonable.hh:59
Neutrino oscillation channel.
Definition: JOscChannel.hh:112
Implementation of oscillation probability function interface.
double getP(const JOscChannel &channel, const double energy, const double costh) const override final
Get oscillation probability for given oscillation channel.
JFunction_t function
oscillation probability function
JOscProbFunction(const JFunction_t &function)
Constructor.
JOscProbInterface::JOscParameters_t JOscParameters_t
void setParameters(const JOscParameters_t &parameters) const
Set oscillation parameters.