hej
is hosted by
Hepforge
,
IPPP Durham
HEJ
2.2.2
High energy resummation for hadron colliders
Loading...
Searching...
No Matches
include
HEJ
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
18
namespace
HEJ
{
20
25
template
<
class
T>
26
struct
Parameters
{
27
T
central
{};
28
std::vector<T>
variations
;
29
30
template
<
class
T_ext>
31
Parameters<T>
&
operator*=
(
Parameters<T_ext>
const
& other);
32
Parameters<T>
&
operator*=
(
double
factor);
33
template
<
class
T_ext>
34
Parameters<T>
&
operator/=
(
Parameters<T_ext>
const
& other);
35
Parameters<T>
&
operator/=
(
double
factor);
36
template
<
class
T_ext>
37
Parameters<T>
&
operator+=
(
Parameters<T_ext>
const
& other);
38
template
<
class
T_ext>
39
Parameters<T>
&
operator-=
(
Parameters<T_ext>
const
& other);
40
};
41
42
template
<
class
T1,
class
T2>
inline
43
Parameters<T1>
operator*
(
Parameters<T1>
a,
Parameters<T2>
const
& b) {
44
a*=b;
45
return
a;
46
}
47
template
<
class
T>
inline
48
Parameters<T>
operator*
(
Parameters<T>
a,
double
b) {
49
a*=b;
50
return
a;
51
}
52
template
<
class
T>
inline
53
Parameters<T>
operator*
(
double
b,
Parameters<T>
a) {
54
a*=b;
55
return
a;
56
}
57
template
<
class
T1,
class
T2>
inline
58
Parameters<T1>
operator/
(
Parameters<T1>
a,
Parameters<T2>
const
& b) {
59
a/=b;
60
return
a;
61
}
62
template
<
class
T>
inline
63
Parameters<T>
operator/
(
Parameters<T>
a,
double
b) {
64
a/=b;
65
return
a;
66
}
67
template
<
class
T1,
class
T2>
inline
68
Parameters<T1>
operator+
(
Parameters<T1>
a,
Parameters<T2>
const
& b) {
69
a+=b;
70
return
a;
71
}
72
template
<
class
T1,
class
T2>
inline
73
Parameters<T1>
operator-
(
Parameters<T1>
a,
Parameters<T2>
const
& b) {
74
a-=b;
75
return
a;
76
}
77
79
using
Weights
=
Parameters<double>
;
80
82
struct
ParameterDescription
{
84
std::string
scale_name
;
86
double
mur_factor
{};
88
double
muf_factor
{};
89
90
ParameterDescription
() =
default
;
91
ParameterDescription
(
92
std::string
scale_name
,
double
mur_factor
,
double
muf_factor
93
):
94
scale_name
{std::move(
scale_name
)},
95
mur_factor
{
mur_factor
},
muf_factor
{
muf_factor
}
96
{}
97
};
98
100
std::string
to_string
(
ParameterDescription
const
& p);
101
104
std::string
to_simple_string
(
ParameterDescription
const
& p);
105
107
struct
EventParameters
{
108
double
mur
{};
109
double
muf
{};
110
double
weight
{};
112
std::shared_ptr<ParameterDescription>
description
=
nullptr
;
113
115
EventParameters
&
operator*=
(
double
factor){
116
weight
*=factor;
117
return
*
this
;
118
}
120
EventParameters
&
operator/=
(
double
factor){
121
weight
/=factor;
122
return
*
this
;
123
}
125
EventParameters
&
operator+=
(
double
factor){
126
weight
+=factor;
127
return
*
this
;
128
}
130
EventParameters
&
operator-=
(
double
factor){
131
weight
-=factor;
132
return
*
this
;
133
}
134
};
135
inline
EventParameters
operator*
(
EventParameters
a,
double
b){
136
a*=b;
137
return
a;
138
}
139
inline
EventParameters
operator*
(
double
b,
EventParameters
a){
140
a*=b;
141
return
a;
142
}
143
inline
EventParameters
operator/
(
EventParameters
a,
double
b){
144
a/=b;
145
return
a;
146
}
147
150
template
<
class
T>
151
template
<
class
T_ext>
152
Parameters<T>
&
Parameters<T>::operator*=
(
Parameters<T_ext>
const
& other) {
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>
164
Parameters<T>
&
Parameters<T>::operator*=
(
double
factor) {
165
central *= factor;
166
for
(
auto
& wt: variations) wt *= factor;
167
return
*
this
;
168
}
169
170
template
<
class
T>
171
template
<
class
T_ext>
172
Parameters<T>
&
Parameters<T>::operator/=
(
Parameters<T_ext>
const
& other) {
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>
184
Parameters<T>
&
Parameters<T>::operator/=
(
double
factor) {
185
central /= factor;
186
for
(
auto
& wt: variations) wt /= factor;
187
return
*
this
;
188
}
189
190
template
<
class
T>
191
template
<
class
T_ext>
192
Parameters<T>
&
Parameters<T>::operator+=
(
Parameters<T_ext>
const
& other) {
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>
205
Parameters<T>
&
Parameters<T>::operator-=
(
Parameters<T_ext>
const
& other) {
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
exceptions.hh
Custom exception classes.
HEJ
Main HEJ 2 Namespace.
Definition:
mainpage.dox:1
HEJ::operator*
Parameters< T1 > operator*(Parameters< T1 > a, Parameters< T2 > const &b)
Definition:
Parameters.hh:43
HEJ::operator/
Parameters< T1 > operator/(Parameters< T1 > a, Parameters< T2 > const &b)
Definition:
Parameters.hh:58
HEJ::to_string
std::string to_string(Event const &ev)
HEJ::operator+
Parameters< T1 > operator+(Parameters< T1 > a, Parameters< T2 > const &b)
Definition:
Parameters.hh:68
HEJ::operator-
Parameters< T1 > operator-(Parameters< T1 > a, Parameters< T2 > const &b)
Definition:
Parameters.hh:73
HEJ::to_simple_string
std::string to_simple_string(ParameterDescription const &p)
HEJ::EventParameters
Event parameters.
Definition:
Parameters.hh:107
HEJ::EventParameters::operator*=
EventParameters & operator*=(double factor)
multiply weight by factor
Definition:
Parameters.hh:115
HEJ::EventParameters::operator+=
EventParameters & operator+=(double factor)
add number to weight
Definition:
Parameters.hh:125
HEJ::EventParameters::mur
double mur
Definition:
Parameters.hh:108
HEJ::EventParameters::description
std::shared_ptr< ParameterDescription > description
Optional description.
Definition:
Parameters.hh:112
HEJ::EventParameters::muf
double muf
Definition:
Parameters.hh:109
HEJ::EventParameters::operator/=
EventParameters & operator/=(double factor)
divide weight by factor
Definition:
Parameters.hh:120
HEJ::EventParameters::weight
double weight
Definition:
Parameters.hh:110
HEJ::EventParameters::operator-=
EventParameters & operator-=(double factor)
add number to weight
Definition:
Parameters.hh:130
HEJ::ParameterDescription
Description of event parameters, see also EventParameters.
Definition:
Parameters.hh:82
HEJ::ParameterDescription::ParameterDescription
ParameterDescription(std::string scale_name, double mur_factor, double muf_factor)
Definition:
Parameters.hh:91
HEJ::ParameterDescription::muf_factor
double muf_factor
Actual factorisation scale divided by central scale.
Definition:
Parameters.hh:88
HEJ::ParameterDescription::scale_name
std::string scale_name
Name of central scale choice (e.g. "H_T/2")
Definition:
Parameters.hh:84
HEJ::ParameterDescription::ParameterDescription
ParameterDescription()=default
HEJ::ParameterDescription::mur_factor
double mur_factor
Actual renormalisation scale divided by central scale.
Definition:
Parameters.hh:86
HEJ::Parameters
Collection of parameters, e.g. Weights, assigned to a single event.
Definition:
Parameters.hh:26
HEJ::Parameters::operator/=
Parameters< T > & operator/=(Parameters< T_ext > const &other)
Definition:
Parameters.hh:172
HEJ::Parameters::operator+=
Parameters< T > & operator+=(Parameters< T_ext > const &other)
Definition:
Parameters.hh:192
HEJ::Parameters::variations
std::vector< T > variations
Definition:
Parameters.hh:28
HEJ::Parameters::operator*=
Parameters< T > & operator*=(Parameters< T_ext > const &other)
Definition:
Parameters.hh:152
HEJ::Parameters::central
T central
Definition:
Parameters.hh:27
HEJ::Parameters::operator-=
Parameters< T > & operator-=(Parameters< T_ext > const &other)
Definition:
Parameters.hh:205
HEJ::Parameters::operator*=
Parameters< T > & operator*=(double factor)
Definition:
Parameters.hh:164
HEJ::Parameters::operator/=
Parameters< T > & operator/=(double factor)
Definition:
Parameters.hh:184
Generated by
1.9.5