diff --git a/include/HEJ/Unweighter.hh b/include/HEJ/Unweighter.hh index 0ab3217..61d6f8c 100644 --- a/include/HEJ/Unweighter.hh +++ b/include/HEJ/Unweighter.hh @@ -1,82 +1,75 @@ /** * \authors The HEJ collaboration (see AUTHORS for details) * \date 2019 * \copyright GPLv2 or later */ #pragma once #include <functional> #include <vector> #include "HEJ/optional.hh" namespace HEJ { class Event; class RNG; class Unweighter { public: Unweighter(double cut = -1.): cut_{cut}{} //! explicitly set cut void set_cut(double max_weight){ cut_ = max_weight; } //! set cut as max(weight) of events void set_cut_to_maxwt(std::vector<Event> const & events){ set_cut_to_maxwt(events.cbegin(), events.cend()); } //! iterator version of set_max() template<class ConstIt> void set_cut_to_maxwt(ConstIt begin, ConstIt end); //! estimate some reasonable cut for partial unweighting /** * @param max_dev standard derivation to include above mean weight - * @param min_unweight_pt minimum pt of jets for an event to be considered - * - * @note Events with softer jets than the *resummation* jet threshold will - * have a spurious large weight, although they hardly contribute after - * resummation. This destroys the unweighting efficiency. By setting - * min_unweight_pt to the same threshold, we can exclude these events - * from unweighting. */ void set_cut_to_peakwt( std::vector<Event> const & events, double max_dev){ set_cut_to_peakwt(events.cbegin(), events.cend(), max_dev); } - //! iterator version of set_middle() + //! iterator version of set_cut_to_peakwt() template<class ConstIt> void set_cut_to_peakwt(ConstIt begin, ConstIt end, double max_dev); //! return current value of the cut double get_cut() const { return cut_; } //! unweight one event, returns original event if weight > get_cut() optional<Event> unweight(Event ev, RNG & ran) const; //! unweight for multiple events at once std::vector<Event> unweight( std::vector<Event> events, RNG & ran ) const; //! @brief iterator implementation of unweight(), /** * usage similar to std::remove(), i.e. use with erase() * * @return beginning of "discarded" range */ template<class Iterator> Iterator unweight( Iterator begin, Iterator end, RNG & ran ) const; private: double cut_; //! returns true if element can be removed/gets discarded //! directly corrects weight if is accepted (not removed) bool discard(RNG & ran, Event & ev) const; }; } // implementation of template functions #include "HEJ/detail/Unweighter_impl.hh"