hej
is hosted by
Hepforge
,
IPPP Durham
HEJ
2.2.2
High energy resummation for hadron colliders
Loading...
Searching...
No Matches
include
HEJ
CrossSectionAccumulator.hh
Go to the documentation of this file.
1
6
#pragma once
7
8
#include <iterator>
9
#include <map>
10
#include <ostream>
11
#include <vector>
12
13
#include "
HEJ/event_types.hh
"
14
15
namespace
HEJ
{
16
class
Event;
17
19
template
<
typename
T>
20
struct
XSWithError
{
21
T
value
= T{};
22
T
error
= T{};
23
};
24
28
class
CrossSectionAccumulator
{
29
public
:
32
void
fill
(
Event
const
& ev);
35
void
fill
(
double
wt,
event_type::EventType
type);
38
void
fill
(
double
wt,
double
err,
event_type::EventType
type);
39
53
void
fill_correlated
(std::vector<Event>
const
& evts);
55
template
<
class
ConstIt>
56
void
fill_correlated
(ConstIt
begin
, ConstIt
end
);
58
void
fill_correlated
(
double
sum,
double
sum2,
event_type::EventType
type);
59
61
auto
begin
()
const
{
62
return
std::begin(xs_);
63
}
65
auto
end
()
const
{
66
return
std::end(xs_);
67
}
69
XSWithError<double>
const
&
total
()
const
{
70
return
total_;
71
}
73
XSWithError<double>
const
&
at
(
event_type::EventType
type)
const
{
74
return
xs_.at(type);
75
}
77
XSWithError<double>
const
&
operator[]
(
event_type::EventType
type)
const
{
78
return
at
(type);
79
}
80
81
// method to scale total_ and xs_ after they have been filled
82
void
scale
(
double
xsscale);
83
84
private
:
85
std::map<event_type::EventType, XSWithError<double>> xs_;
86
XSWithError<double>
total_;
87
};
88
90
std::ostream&
operator<<
(std::ostream& os,
const
CrossSectionAccumulator
& xs);
91
92
// ------------ Implementation ------------
93
94
template
<
class
ConstIt>
95
void
CrossSectionAccumulator::fill_correlated
(ConstIt begin, ConstIt end){
96
if
(std::distance(
begin
,
end
) < 2){
// only one event
97
fill
(*
begin
);
98
return
;
99
}
100
double
sum = 0.;
101
double
sum2 = 0.;
102
const
auto
type =
begin
->type();
103
for
(;
begin
!=
end
; ++
begin
){
104
double
const
wt =
begin
->central().weight;
105
sum += wt;
106
sum2 += wt*wt;
107
}
108
fill_correlated
(sum, sum2, type);
109
}
110
}
// namespace HEJ
HEJ::CrossSectionAccumulator
Sum of Cross Section for different subproccess.
Definition:
CrossSectionAccumulator.hh:28
HEJ::CrossSectionAccumulator::fill_correlated
void fill_correlated(std::vector< Event > const &evts)
Fill with multiple correlated weights.
HEJ::CrossSectionAccumulator::end
auto end() const
end of Cross Section and error for subprocesses
Definition:
CrossSectionAccumulator.hh:65
HEJ::CrossSectionAccumulator::fill
void fill(double wt, event_type::EventType type)
HEJ::CrossSectionAccumulator::begin
auto begin() const
begin of Cross Section and error for subprocesses
Definition:
CrossSectionAccumulator.hh:61
HEJ::CrossSectionAccumulator::scale
void scale(double xsscale)
HEJ::CrossSectionAccumulator::total
XSWithError< double > const & total() const
total Cross Section and error
Definition:
CrossSectionAccumulator.hh:69
HEJ::CrossSectionAccumulator::operator[]
XSWithError< double > const & operator[](event_type::EventType type) const
Cross Section and error of specific type.
Definition:
CrossSectionAccumulator.hh:77
HEJ::CrossSectionAccumulator::at
XSWithError< double > const & at(event_type::EventType type) const
Cross Section and error of specific type.
Definition:
CrossSectionAccumulator.hh:73
HEJ::CrossSectionAccumulator::fill
void fill(double wt, double err, event_type::EventType type)
HEJ::CrossSectionAccumulator::fill_correlated
void fill_correlated(double sum, double sum2, event_type::EventType type)
explicit version of fill_correlated() by giving sum(wt) and sum(wt^2)
HEJ::CrossSectionAccumulator::fill
void fill(Event const &ev)
HEJ::Event
An event with clustered jets.
Definition:
Event.hh:51
event_types.hh
Define different types of events.
HEJ::event_type::EventType
EventType
Possible event types.
Definition:
event_types.hh:19
HEJ
Main HEJ 2 Namespace.
Definition:
mainpage.dox:1
HEJ::operator<<
std::ostream & operator<<(std::ostream &os, const CrossSectionAccumulator &xs)
Print CrossSectionAccumulator to stream.
HEJ::XSWithError
Collection of Cross Section with its uncertainty.
Definition:
CrossSectionAccumulator.hh:20
HEJ::XSWithError::error
T error
Squared error (Variance)
Definition:
CrossSectionAccumulator.hh:22
HEJ::XSWithError::value
T value
Cross Section.
Definition:
CrossSectionAccumulator.hh:21
Generated by
1.9.5