#ifndef __JAANET__JFLATFLUX__ #define __JAANET__JFLATFLUX__ #include "JAAnet/JEvtWeightFactorFunction.hh" /** * \author bjung */ namespace JAANET {} namespace JPP { using namespace JAANET; } namespace JAANET { /** * Function object for constant fluxes. */ struct JFlatFlux { /** * Default constructor. */ JFlatFlux() : flux(0.0) {} /** * Constructor. * * \param flux [GeV * m^-2 * sr^-1 * s^-1] */ JFlatFlux(const double flux) : flux(flux) {} /** * Get flux of given event. * * \param evt event * \return flux [GeV * m^-2 * sr^-1 * s^-1] */ double operator()(const Evt& evt) const { return flux; } /** * Stream input. * * \param in input stream * \param object uniform flux * \return input stream */ friend inline std::istream& operator>>(std::istream& in, JFlatFlux& object) { in >> object.flux; return in; } /** * Write flux to output stream. * * \param out output stream * \param object uniform * \return output stream */ friend inline std::ostream& operator<<(std::ostream& out, const JFlatFlux& object) { const JFormat format(out); out << FIXED(5,3) << object.flux; return out; } double flux; //!< flux [GeV * m^-2 * sr^-1 * s^-1] }; /** * Auxiliary method for creating an interface to a flat flux function. * * \param flux flux [GeV * m^-2 * sr^-1 * s^-1] */ inline JEvtWeightFactorFunction make_flatFluxFunction(const double flux) { const JFlatFlux flatFlux(flux); return make_fluxFunction(flatFlux); } } #endif