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
JOscProbFunction.hh
Go to the documentation of this file.
1 #ifndef __JOSCPROB__JOSCPROBFUNCTION__
2 #define __JOSCPROB__JOSCPROBFUNCTION__
3 
4 #include "JLang/JClonable.hh"
5 
6 #include "JOscProb/JOscProb.hh"
8 
9 
10 /**
11  * \author bjung
12  */
13 
14 namespace JOSCPROB {
15 
16  using JLANG::JClonable;
17 
18 
19  /**
20  * Implementation of oscillation probability function interface.
21  *
22  * The template argument refers to a function of which the copy constuctor needs to be defined.
23  */
24  template<class JFunction_t>
26  public JClonable<JOscProb, JOscProbFunction<JFunction_t> >
27  {
28  /**
29  * Constructor.
30  *
31  * \param function oscillation probability function
32  */
33  JOscProbFunction(const JFunction_t& function) :
35  {}
36 
37 
38  /**
39  * Get oscillation probability for given oscillation channel.
40  *
41  * \param channel oscillation channel
42  * \param energy neutrino energy [GeV]
43  * \param costh cosine zenith angle
44  * \return oscillation probability
45  */
46  double getOscProb(const JOscChannel& channel,
47  const double energy,
48  const double costh) const override
49  {
50  return function(channel, energy, costh);
51  }
52 
53  private:
54 
55  JFunction_t function; //!< oscillation probability function
56  };
57 
58 
59  /* Type definition of pointer to oscillation probability function. */
60  typedef double (*pOscProb)(const JOscChannel&, const double, const double);
61 
62 
63  /**
64  * Implementation of C-style oscillation probability function.
65  */
66  template<>
68  public JClonable< JOscProb, JOscProbFunction<pOscProb> >
69  {
70  /**
71  * Constructor.
72  *
73  * \param pFunction oscillation probability function
74  */
76  pFunction(pFunction)
77  {}
78 
79 
80  /**
81  * Get oscillation probability for given oscillation channel.
82  *
83  * \param channel oscillation channel
84  * \param energy neutrino energy [GeV]
85  * \param costh cosine zenith angle
86  * \return oscillation probability
87  */
88  double getOscProb(const JOscChannel& channel,
89  const double energy,
90  const double costh) const override
91  {
92  return (*pFunction)(channel, energy, costh);
93  }
94 
95  private:
96 
98  };
99 
100 
101  /**
102  * Auxiliary method for creating an interface to an oscillation probability function.
103  *
104  * \param function oscillation probability function object
105  * \return oscillation probability function interface
106  */
107  template<class JFunction_t>
108  inline JOscProbFunction<JFunction_t> make_oscProbFunction(const JFunction_t& function) {
109  return JOscProbFunction<JFunction_t>(function);
110  }
111 
112 
113  /**
114  * Auxiliary method for creating an interface to an oscillation probability function.
115  *
116  * \param function oscillation probability function pointer
117  * \return oscillation probability function interface
118  */
120  return JOscProbFunction<pOscProb>(function);
121  }
122 }
123 
124 #endif
Implementation of C-style oscillation probability function.
double(* pOscProb)(const JOscChannel &, const double, const double)
Implementation of oscillation probability function interface.
Neutrino oscillation channel.
Definition: JOscChannel.hh:110
JFunction_t function
oscillation probability function
JOscProbFunction< JFunction_t > make_oscProbFunction(const JFunction_t &function)
Auxiliary method for creating an interface to an oscillation probability function.
Template class for object cloning.
Definition: JClonable.hh:20
JOscProbFunction(const JFunction_t &function)
Constructor.
double getOscProb(const JOscChannel &channel, const double energy, const double costh) const override
Get oscillation probability for given oscillation channel.
then for APP in event gandalf start energy
Definition: JMuonMCEvt.sh:44
double getOscProb(const JOscChannel &channel, const double energy, const double costh) const override
Get oscillation probability for given oscillation channel.
JOscProbFunction(pOscProb pFunction)
Constructor.