Jpp  master_rocky-40-g5f0272dcd
the software that should make you happy
JDiffuseFluxHelper.hh
Go to the documentation of this file.
1 #ifndef __JAANET__JDIFFUSEFLUXHELPER__
2 #define __JAANET__JDIFFUSEFLUXHELPER__
3 
5 
7 #include "JAAnet/JDiffuseFlux.hh"
9 #include "JAAnet/JFluxHelper.hh"
10 
11 
12 /**
13  * \author bjung
14  */
15 
16 namespace JAANET {}
17 namespace JPP { using namespace JAANET; }
18 
19 namespace JAANET {
20 
21  /**
22  * Helper class for diffuse flux factor.
23  */
25  public JFluxHelper
26  {
28 
29 
30  /**
31  * Default constructor.
32  */
34  {}
35 
36 
37  /**
38  * Constructor.
39  *
40  * \param flux diffuse flux
41  */
44  {}
45 
46 
47  /**
48  * Constructor.
49  *
50  * \param flux diffuse flux
51  */
53  {
54  configure(flux);
55  }
56 
57 
58  /**
59  * Get reference to diffuse flux function.
60  *
61  * \return reference to diffuse flux function.
62  */
64  {
65  using namespace JPP;
66 
68 
69  JDiffuseFlux* p = dynamic_cast<JDiffuseFlux*>(&factor);
70 
71  if (p != NULL) {
72  return *p;
73  } else {
74  THROW(JNullPointerException, "JDiffuseFluxHelper::getDiffuseFlux(): Cannot convert event-weight factor to diffuse flux function.");
75  }
76  }
77 
78 
79  /**
80  * Get flux for given particle PDG-identifier, energy and zenith-angle.
81  *
82  * \param type PDG particle type
83  * \param log10E logarithmic neutrino energy [GeV]
84  * \param costh cosine zenith angle
85  * \return diffuse flux [GeV^-1 * m^-2 * sr^-1 * s^-1]
86  */
87  double getFactor(const int type,
88  const double log10E,
89  const double costh) const
90  {
91  const JDiffuseFlux& flux = getDiffuseFlux();
92 
93  return flux(type, log10E, costh);
94  }
95 
96 
97  /**
98  * Get flux for given particle PDG-identifier, energy and zenith-angle.
99  *
100  * \param type PDG particle type
101  * \param log10E logarithmic neutrino energy [GeV]
102  * \param costh cosine zenith angle
103  * \return diffuse flux [GeV^-1 * m^-2 * sr^-1 * s^-1]
104  */
105  double getFlux(const int type,
106  const double log10E,
107  const double costh) const
108  {
109  return getFactor(type, log10E, costh);
110  }
111 
112 
113  /**
114  * Get flux for given particle PDG-identifier, energy and zenith-angle.
115  *
116  * \param type PDG particle type
117  * \param log10E logarithmic neutrino energy [GeV]
118  * \param costh cosine zenith angle
119  * \return diffuse flux [GeV^-1 * m^-2 * sr^-1 * s^-1]
120  */
121  double operator()(const int type,
122  const double log10E,
123  const double costh) const
124  {
125  return getFactor(type, log10E, costh);
126  }
127  };
128 }
129 
130 #endif
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
Exception for null pointer operation.
Definition: JException.hh:234
Extensions to Evt data format.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Helper class for diffuse flux factor.
JDiffuseFlux & getDiffuseFlux() const
Get reference to diffuse flux function.
double operator()(const int type, const double log10E, const double costh) const
Get flux for given particle PDG-identifier, energy and zenith-angle.
double getFlux(const int type, const double log10E, const double costh) const
Get flux for given particle PDG-identifier, energy and zenith-angle.
JFluxHelper::pointer_type pointer_type
double getFactor(const int type, const double log10E, const double costh) const
Get flux for given particle PDG-identifier, energy and zenith-angle.
JDiffuseFluxHelper(const pointer_type &flux)
Constructor.
JDiffuseFluxHelper(const JDiffuseFlux &flux)
Constructor.
JDiffuseFluxHelper()
Default constructor.
Low-level interface for diffuse fluxes.
Definition: JDiffuseFlux.hh:30
void configure(const pointer_type &p)
Configure event-weight factor.
JEvtWeightFactor & getFactor() const
Get reference to event-weight factor.
Abstract base class for specifiable event-weight factors.
Helper class for flux function.
Definition: JFluxHelper.hh:25
JEvtWeightFactorHelper::pointer_type pointer_type
Definition: JFluxHelper.hh:26
Neutrino flux.
Definition: JHead.hh:906