Jpp  18.2.1-ARCA-DF-PATCH
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 namespace JPP { using namespace JOSCPROB; }
17 
18 namespace JOSCPROB {
19 
22 
23 
24  /**
25  * Helper class for oscillation probabilities.
26  */
27  struct JOscProbHelper :
28  public JSharedPointer<JOscProb>
29  {
31 
32  /**
33  * Default constructor.
34  */
36  {}
37 
38 
39  /**
40  * Constructor.
41  *
42  * \param oscProb oscillation probability function
43  */
44  JOscProbHelper(const JOscProb& oscProb)
45  {
46  configure(oscProb);
47  }
48 
49 
50  /**
51  * Configure oscillation probability function.
52  *
53  * \param oscProb oscillation probability function
54  */
55  virtual void configure(const JOscProb& oscProb)
56  {
57  reset(oscProb.clone());
58  }
59 
60 
61  /**
62  * Get oscillation probability corresponding to given oscillation channel,
63  * neutrino energy and zenith angle.
64  *
65  * \param oscChannel oscillation channel
66  * \param energy neutrino energy [GeV]
67  * \param costh cosine zenith angle
68  * \return oscillation probability
69  */
70  virtual double getOscProb(const JOscChannel& oscChannel,
71  const double energy,
72  const double costh) const
73  {
74  if (is_valid()) {
75  return get()->getOscProb(oscChannel, energy, costh);
76  } else {
77  THROW(JNullPointerException, "JOscProbHelper::getOscProb(): Unspecified oscillation probability function.");
78  }
79  }
80  };
81 }
82 
83 #endif
Exceptions.
Low-level interface for retrieving the oscillation probability corresponding to a given oscillation c...
Definition: JOscProb.hh:25
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.