hej
is hosted by
Hepforge
,
IPPP Durham
HEJ
2.1.4
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
private
:
82
std::map<event_type::EventType, XSWithError<double>> xs_;
83
XSWithError<double>
total_;
84
};
85
87
std::ostream&
operator<<
(std::ostream& os,
const
CrossSectionAccumulator
& xs);
88
89
// ------------ Implementation ------------
90
91
template
<
class
ConstIt>
92
void
CrossSectionAccumulator::fill_correlated
(ConstIt begin, ConstIt end){
93
if
(std::distance(
begin
,
end
) < 2){
// only one event
94
fill
(*
begin
);
95
return
;
96
}
97
double
sum = 0.;
98
double
sum2 = 0.;
99
const
auto
type =
begin
->type();
100
for
(;
begin
!=
end
; ++
begin
){
101
double
const
wt =
begin
->central().weight;
102
sum += wt;
103
sum2 += wt*wt;
104
}
105
fill_correlated
(sum, sum2, type);
106
}
107
}
// 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::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:47
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