#ifndef __JAANET__JEVTWEIGHT__ #define __JAANET__JEVTWEIGHT__ #include "km3net-dataformat/definitions/weightlist.hh" #include "km3net-dataformat/offline/Evt.hh" #include "JLang/JClonable.hh" #include "JAAnet/JEvtWeightInterface.hh" /** * \author mdejong, bjjung */ namespace JAANET {} namespace JPP { using namespace JAANET; } namespace JAANET { using JLANG::JClonable; /** * Abstract base class for event weighing. */ struct JEvtWeight : public JEvtWeightInterface, public JClonable { /** * Default constructor. */ JEvtWeight() : norm(0.0) {} /** * Virtual destructor. */ virtual ~JEvtWeight() {} /** * Get event-weight normalisation. * Note: the return-value should be *multiplied* in order to normalise the event-weight * * \return event-weight normalisation */ virtual double getNormalisation() const override { return norm; } /** * Get event-weight normalisation. * Note: the return-value should be *multiplied* in order to normalise the event-weight * * \param evt event * \return event-weight normalisation */ virtual double getNormalisation(const Evt& evt) const { return (evt.w.size() > WEIGHTLIST_NORMALISATION && evt.w[WEIGHTLIST_NORMALISATION] > 0.0 ? evt.w[WEIGHTLIST_NORMALISATION] : norm); } protected: double norm; //!< Event-weight normalisation }; } #endif