Loading [MathJax]/extensions/tex2jax.js
hej is hosted by Hepforge, IPPP Durham
HEJ  2.3.0
High energy resummation for hadron colliders
Unweighter.hh
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <functional>
9 #include <optional>
10 #include <vector>
11 
12 namespace HEJ {
13  class Event;
14  struct RNG;
15 
21  class Unweighter {
22  public:
25  Unweighter(double cut):
26  cut_(cut){}
27  Unweighter() = default;
28 
30  void set_cut(double max_weight){
31  cut_ = max_weight;
32  }
34  void set_cut_to_maxwt(std::vector<Event> const & events){
35  set_cut_to_maxwt(events.cbegin(), events.cend());
36  }
38  template<class ConstIt>
39  void set_cut_to_maxwt(ConstIt begin, ConstIt end);
40 
42 
46  void set_cut_to_peakwt(std::vector<Event> const & events, double max_dev){
47  set_cut_to_peakwt(events.cbegin(), events.cend(), max_dev);
48  }
50  template<class ConstIt>
51  void set_cut_to_peakwt(ConstIt begin, ConstIt end, double max_dev);
52 
54  double get_cut() const {
55  return cut_;
56  }
57 
59  std::optional<Event> unweight(Event ev, RNG & ran) const;
61  std::vector<Event> unweight(
62  std::vector<Event> events, RNG & ran
63  ) const;
65 
70  template<class Iterator>
71  Iterator unweight(
72  Iterator begin, Iterator end, RNG & ran
73  ) const;
74 
75  private:
76  double cut_{-1};
79  bool discard(RNG & ran, Event & ev) const;
80  };
81 } // namespace HEJ
82 
83 // implementation of template functions
Unweighter Class Implementation for template functions.
An event with clustered jets.
Definition: Event.hh:51
Unweight events.
Definition: Unweighter.hh:21
Unweighter(double cut)
Definition: Unweighter.hh:25
Unweighter()=default
void set_cut_to_maxwt(std::vector< Event > const &events)
Set cut as max(weight) of events.
Definition: Unweighter.hh:34
void set_cut(double max_weight)
Explicitly set cut.
Definition: Unweighter.hh:30
std::vector< Event > unweight(std::vector< Event > events, RNG &ran) const
Unweight for multiple events at once.
std::optional< Event > unweight(Event ev, RNG &ran) const
Unweight one event, returns original event if weight > get_cut()
void set_cut_to_peakwt(std::vector< Event > const &events, double max_dev)
Estimate some reasonable cut for partial unweighting.
Definition: Unweighter.hh:46
double get_cut() const
Returns current value of the cut.
Definition: Unweighter.hh:54
Main HEJ 2 Namespace.
Definition: mainpage.dox:1
Interface for random number generator.
Definition: RNG.hh:22