#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() : normalisation(1.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 normalisation; } /** * 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] : normalisation); } /** * Set event-weight normalisation factor. * Note: the set-value should be *multiplied* in order to normalise the event-weight * * \param normalisation event-weight normalisation factor. */ virtual void setNormalisation(const double normalisation) override { this->normalisation = normalisation; } protected: double normalisation; //!< Event-weight normalisation }; } #endif