Jpp  18.1.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JOscProbHelper.hh
Go to the documentation of this file.
1 #ifndef __JOSCPROB__JOSCPROBHELPER__
2 #define __JOSCPROB__JOSCPROBHELPER__
3 
4 #include "JLang/JException.hh"
6 
7 #include "JOscProb/JOscProb.hh"
9 
10 
11 /**
12  * \author bjung
13  */
14 
15 namespace JOSCPROB {
16 
19 
20 
21  /**
22  * Helper class for oscillation probabilities.
23  */
24  struct JOscProbHelper :
25  public JSharedPointer<JOscProb>
26  {
28 
29  /**
30  * Default constructor.
31  */
33  {}
34 
35 
36  /**
37  * Constructor.
38  *
39  * \param oscProb oscillation probability function
40  */
41  JOscProbHelper(const JOscProb& oscProb)
42  {
43  configure(oscProb);
44  }
45 
46 
47  /**
48  * Configure oscillation probability function.
49  *
50  * \param oscProb oscillation probability function
51  */
52  virtual void configure(const JOscProb& oscProb)
53  {
54  reset(oscProb.clone());
55  }
56 
57 
58  /**
59  * Get oscillation probability corresponding to given oscillation channel,
60  * neutrino energy and zenith angle.
61  *
62  * \param oscChannel oscillation channel
63  * \param energy neutrino energy [GeV]
64  * \param costh cosine zenith angle
65  * \return oscillation probability
66  */
67  virtual double getOscProb(const JOscChannel& oscChannel,
68  const double energy,
69  const double costh) const
70  {
71  if (is_valid()) {
72  return get()->getOscProb(oscChannel, energy, costh);
73  } else {
74  THROW(JNullPointerException, "JOscProbHelper::getOscProb(): Unspecified oscillation probability function.");
75  }
76  }
77  };
78 }
79 
80 #endif
Exceptions.
Low-level interface for retrieving the oscillation probability corresponding to a given oscillation c...
Definition: JOscProb.hh:22
Neutrino oscillation channel.
Definition: JOscChannel.hh:110
virtual double getOscProb(const JOscChannel &oscChannel, const double energy, const double costh) const
Get oscillation probability corresponding to given oscillation channel, neutrino energy and zenith an...
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
Helper class for oscillation probabilities.
bool is_valid() const
Check validity of pointer.
JOscProbHelper()
Default constructor.
virtual clone_type clone() const override
Get clone of this object.
Definition: JClonable.hh:69
The template JSharedPointer class can be used to share a pointer to an object.
Exception for null pointer operation.
Definition: JException.hh:232
then for APP in event gandalf start energy
Definition: JMuonMCEvt.sh:44
JOscProbHelper(const JOscProb &oscProb)
Constructor.
virtual void reset() override
Reset pointer.
virtual void configure(const JOscProb &oscProb)
Configure oscillation probability function.