hej is hosted by Hepforge, IPPP Durham
HEJ 2.2.2
High energy resummation for hadron colliders
Loading...
Searching...
No Matches
Parameters.hh
Go to the documentation of this file.
1
8#pragma once
9
10#include <cstddef>
11#include <memory>
12#include <string>
13#include <utility>
14#include <vector>
15
16#include "HEJ/exceptions.hh"
17
18namespace HEJ {
20
25 template<class T>
26 struct Parameters {
28 std::vector<T> variations;
29
30 template<class T_ext>
32 Parameters<T>& operator*=(double factor);
33 template<class T_ext>
35 Parameters<T>& operator/=(double factor);
36 template<class T_ext>
38 template<class T_ext>
40 };
41
42 template<class T1, class T2> inline
44 a*=b;
45 return a;
46 }
47 template<class T> inline
49 a*=b;
50 return a;
51 }
52 template<class T> inline
54 a*=b;
55 return a;
56 }
57 template<class T1, class T2> inline
59 a/=b;
60 return a;
61 }
62 template<class T> inline
64 a/=b;
65 return a;
66 }
67 template<class T1, class T2> inline
69 a+=b;
70 return a;
71 }
72 template<class T1, class T2> inline
74 a-=b;
75 return a;
76 }
77
80
84 std::string scale_name;
86 double mur_factor{};
88 double muf_factor{};
89
92 std::string scale_name, double mur_factor, double muf_factor
93 ):
94 scale_name{std::move(scale_name)},
96 {}
97 };
98
100 std::string to_string(ParameterDescription const & p);
101
105
108 double mur{};
109 double muf{};
110 double weight{};
112 std::shared_ptr<ParameterDescription> description = nullptr;
113
116 weight*=factor;
117 return *this;
118 }
121 weight/=factor;
122 return *this;
123 }
126 weight+=factor;
127 return *this;
128 }
131 weight-=factor;
132 return *this;
133 }
134 };
136 a*=b;
137 return a;
138 }
140 a*=b;
141 return a;
142 }
144 a/=b;
145 return a;
146 }
147
150 template<class T>
151 template<class T_ext>
153 if(other.variations.size() != variations.size()) {
154 throw std::invalid_argument{"Wrong number of Parameters"};
155 }
156 central *= other.central;
157 for(std::size_t i = 0; i < variations.size(); ++i) {
158 variations[i] *= other.variations[i];
159 }
160 return *this;
161 }
162
163 template<class T>
165 central *= factor;
166 for(auto & wt: variations) wt *= factor;
167 return *this;
168 }
169
170 template<class T>
171 template<class T_ext>
173 if(other.variations.size() != variations.size()) {
174 throw std::invalid_argument{"Wrong number of Parameters"};
175 }
176 central /= other.central;
177 for(std::size_t i = 0; i < variations.size(); ++i) {
178 variations[i] /= other.variations[i];
179 }
180 return *this;
181 }
182
183 template<class T>
185 central /= factor;
186 for(auto & wt: variations) wt /= factor;
187 return *this;
188 }
189
190 template<class T>
191 template<class T_ext>
193 if(other.variations.size() != variations.size()) {
194 throw std::invalid_argument{"Wrong number of Parameters"};
195 }
196 central += other.central;
197 for(std::size_t i = 0; i < variations.size(); ++i) {
198 variations[i] += other.variations[i];
199 }
200 return *this;
201 }
202
203 template<class T>
204 template<class T_ext>
206 if(other.variations.size() != variations.size()) {
207 throw std::invalid_argument{"Wrong number of Parameters"};
208 }
209 central -= other.central;
210 for(std::size_t i = 0; i < variations.size(); ++i) {
211 variations[i] -= other.variations[i];
212 }
213 return *this;
214 }
216} // namespace HEJ
Custom exception classes.
Main HEJ 2 Namespace.
Definition: mainpage.dox:1
Parameters< T1 > operator*(Parameters< T1 > a, Parameters< T2 > const &b)
Definition: Parameters.hh:43
Parameters< T1 > operator/(Parameters< T1 > a, Parameters< T2 > const &b)
Definition: Parameters.hh:58
std::string to_string(Event const &ev)
Parameters< T1 > operator+(Parameters< T1 > a, Parameters< T2 > const &b)
Definition: Parameters.hh:68
Parameters< T1 > operator-(Parameters< T1 > a, Parameters< T2 > const &b)
Definition: Parameters.hh:73
std::string to_simple_string(ParameterDescription const &p)
Event parameters.
Definition: Parameters.hh:107
EventParameters & operator*=(double factor)
multiply weight by factor
Definition: Parameters.hh:115
EventParameters & operator+=(double factor)
add number to weight
Definition: Parameters.hh:125
double mur
Definition: Parameters.hh:108
std::shared_ptr< ParameterDescription > description
Optional description.
Definition: Parameters.hh:112
double muf
Definition: Parameters.hh:109
EventParameters & operator/=(double factor)
divide weight by factor
Definition: Parameters.hh:120
double weight
Definition: Parameters.hh:110
EventParameters & operator-=(double factor)
add number to weight
Definition: Parameters.hh:130
Description of event parameters, see also EventParameters.
Definition: Parameters.hh:82
ParameterDescription(std::string scale_name, double mur_factor, double muf_factor)
Definition: Parameters.hh:91
double muf_factor
Actual factorisation scale divided by central scale.
Definition: Parameters.hh:88
std::string scale_name
Name of central scale choice (e.g. "H_T/2")
Definition: Parameters.hh:84
double mur_factor
Actual renormalisation scale divided by central scale.
Definition: Parameters.hh:86
Collection of parameters, e.g. Weights, assigned to a single event.
Definition: Parameters.hh:26
Parameters< T > & operator/=(Parameters< T_ext > const &other)
Definition: Parameters.hh:172
Parameters< T > & operator+=(Parameters< T_ext > const &other)
Definition: Parameters.hh:192
std::vector< T > variations
Definition: Parameters.hh:28
Parameters< T > & operator*=(Parameters< T_ext > const &other)
Definition: Parameters.hh:152
T central
Definition: Parameters.hh:27
Parameters< T > & operator-=(Parameters< T_ext > const &other)
Definition: Parameters.hh:205
Parameters< T > & operator*=(double factor)
Definition: Parameters.hh:164
Parameters< T > & operator/=(double factor)
Definition: Parameters.hh:184