hej is hosted by Hepforge, IPPP Durham
HEJ  2.1.4
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 <vector>
10 
11 #include "HEJ/optional.hh"
12 
13 namespace HEJ {
14  class Event;
15  struct RNG;
16 
22  class Unweighter {
23  public:
26  Unweighter(double cut):
27  cut_(cut){}
28  Unweighter() = default;
29 
31  void set_cut(double max_weight){
32  cut_ = max_weight;
33  }
35  void set_cut_to_maxwt(std::vector<Event> const & events){
36  set_cut_to_maxwt(events.cbegin(), events.cend());
37  }
39  template<class ConstIt>
40  void set_cut_to_maxwt(ConstIt begin, ConstIt end);
41 
43 
47  void set_cut_to_peakwt(std::vector<Event> const & events, double max_dev){
48  set_cut_to_peakwt(events.cbegin(), events.cend(), max_dev);
49  }
51  template<class ConstIt>
52  void set_cut_to_peakwt(ConstIt begin, ConstIt end, double max_dev);
53 
55  double get_cut() const {
56  return cut_;
57  }
58 
60  optional<Event> unweight(Event ev, RNG & ran) const;
62  std::vector<Event> unweight(
63  std::vector<Event> events, RNG & ran
64  ) const;
66 
71  template<class Iterator>
72  Iterator unweight(
73  Iterator begin, Iterator end, RNG & ran
74  ) const;
75 
76  private:
77  double cut_{-1};
80  bool discard(RNG & ran, Event & ev) const;
81  };
82 } // namespace HEJ
83 
84 // implementation of template functions
Unweighter Class Implementation for template functions.
An event with clustered jets.
Definition: Event.hh:47
Unweight events.
Definition: Unweighter.hh:22
Unweighter(double cut)
Definition: Unweighter.hh:26
Unweighter()=default
void set_cut_to_maxwt(std::vector< Event > const &events)
Set cut as max(weight) of events.
Definition: Unweighter.hh:35
void set_cut(double max_weight)
Explicitly set cut.
Definition: Unweighter.hh:31
optional< Event > unweight(Event ev, RNG &ran) const
Unweight one event, returns original event if weight > get_cut()
std::vector< Event > unweight(std::vector< Event > events, RNG &ran) const
Unweight for multiple events at once.
void set_cut_to_peakwt(std::vector< Event > const &events, double max_dev)
Estimate some reasonable cut for partial unweighting.
Definition: Unweighter.hh:47
double get_cut() const
Returns current value of the cut.
Definition: Unweighter.hh:55
Main HEJ 2 Namespace.
Definition: mainpage.dox:1
boost::optional< T > optional
Definition: optional.hh:23
Defines the optional type.
Interface for random number generator.
Definition: RNG.hh:19