#ifndef __JAANET__JFLUXHELPER__ #define __JAANET__JFLUXHELPER__ #include "km3net-dataformat/offline/Evt.hh" #include "JAAnet/JEvtWeightFactorHelper.hh" #include "JAAnet/JFlux.hh" /** * \author bjung */ namespace JAANET {} namespace JPP { using namespace JAANET; } namespace JAANET { /** * Helper class for flux function. */ struct JFluxHelper : public JEvtWeightFactorHelper { typedef typename JEvtWeightFactorHelper::pointer_type pointer_type; /** * Default constructor. */ JFluxHelper() {} /** * Constructor. * * \param flux flux function */ JFluxHelper(const pointer_type& flux) : JEvtWeightFactorHelper(flux) {} /** * Constructor. * * \param flux flux function */ JFluxHelper(const JFlux& flux) { configure(flux); } /** * Get reference to flux function. * * \return reference to flux function */ JFlux& getFlux() const { using namespace JPP; JEvtWeightFactor& factor = this->getFactor(); JFlux* p = dynamic_cast(&factor); if (p != NULL) { return *p; } else { THROW(JNullPointerException, "JFluxHelper::getFlux(): Cannot convert event-weight factor to flux function."); } } /** * Get flux of given event. * * \param evt event * \return flux [GeV^-1 * m^-2 * sr^-1 * s^-1] */ double getFlux(const Evt& evt) const { return getFactor(evt); } }; } #endif