#ifndef __JAANET__JDIFFUSEFLUXHELPER__ #define __JAANET__JDIFFUSEFLUXHELPER__ #include "km3net-dataformat/offline/Evt.hh" #include "JAAnet/JEvtWeightFactor.hh" #include "JAAnet/JDiffuseFlux.hh" #include "JAAnet/JEvtWeightFactorHelper.hh" #include "JAAnet/JFluxHelper.hh" /** * \author bjung */ namespace JAANET {} namespace JPP { using namespace JAANET; } namespace JAANET { /** * Helper class for diffuse flux factor. */ struct JDiffuseFluxHelper : public JFluxHelper { typedef typename JFluxHelper::pointer_type pointer_type; /** * Default constructor. */ JDiffuseFluxHelper() {} /** * Constructor. * * \param flux diffuse flux */ JDiffuseFluxHelper(const pointer_type& flux) : JFluxHelper(flux) {} /** * Constructor. * * \param flux diffuse flux */ JDiffuseFluxHelper(const JDiffuseFlux& flux) { configure(flux); } /** * Get reference to diffuse flux function. * * \return reference to diffuse flux function. */ JDiffuseFlux& getDiffuseFlux() const { using namespace JPP; JEvtWeightFactor& factor = JEvtWeightFactorHelper::getFactor(); JDiffuseFlux* p = dynamic_cast(&factor); if (p != NULL) { return *p; } else { THROW(JNullPointerException, "JDiffuseFluxHelper::getDiffuseFlux(): Cannot convert event-weight factor to diffuse flux function."); } } /** * Get flux for given particle PDG-identifier, energy and zenith-angle. * * \param type PDG particle type * \param log10E logarithmic neutrino energy [GeV] * \param costh cosine zenith angle * \return diffuse flux [GeV^-1 * m^-2 * sr^-1 * s^-1] */ double getFactor(const int type, const double log10E, const double costh) const { const JDiffuseFlux& flux = getDiffuseFlux(); return flux(type, log10E, costh); } /** * Get flux for given particle PDG-identifier, energy and zenith-angle. * * \param type PDG particle type * \param log10E logarithmic neutrino energy [GeV] * \param costh cosine zenith angle * \return diffuse flux [GeV^-1 * m^-2 * sr^-1 * s^-1] */ double getFlux(const int type, const double log10E, const double costh) const { return getFactor(type, log10E, costh); } /** * Get flux for given particle PDG-identifier, energy and zenith-angle. * * \param type PDG particle type * \param log10E logarithmic neutrino energy [GeV] * \param costh cosine zenith angle * \return diffuse flux [GeV^-1 * m^-2 * sr^-1 * s^-1] */ double operator()(const int type, const double log10E, const double costh) const { return getFactor(type, log10E, costh); } }; } #endif