herwig
is hosted by
Hepforge
,
IPPP Durham
Herwig
7.3.0
Sampling
exsample
statistics.h
1
// -*- C++ -*-
2
//
3
// statistics.h is part of ExSample -- A Library for Sampling Sudakov-Type Distributions
4
//
5
// Copyright (C) 2008-2019 Simon Platzer -- simon.plaetzer@desy.de, The Herwig Collaboration
6
//
7
// ExSample is licenced under version 3 of the GPL, see COPYING for details.
8
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
9
//
10
//
11
#ifndef EXSAMPLE_statistics_h_included
12
#define EXSAMPLE_statistics_h_included
13
14
#include "utility.h"
15
16
namespace
exsample {
17
20
class
statistics
{
21
22
public
:
23
25
statistics
();
26
29
void
presampled
(
double
weight);
30
33
void
select
(
double
weight,
34
bool
calculate_integral =
true
);
35
37
void
accept
(
double
weight) {
38
++
accepted_
;
39
if
(weight < 0) ++
accepted_negative_
;
40
}
41
43
void
reject
(
double
weight) {
44
--
accepted_
;
45
if
(weight < 0) --
accepted_negative_
;
46
}
47
49
void
reset
();
50
53
std::pair<double,double>
current
()
const
;
54
56
double
average_weight
()
const
{
57
return
(
n_iterations_
== 0 ? 0. :
average_weight_
/
n_iterations_
);
58
}
59
61
double
average_abs_weight
()
const
{
62
return
(
n_iterations_
== 0 ? 0. :
average_abs_weight_
/
n_iterations_
);
63
}
64
66
double
average_weight_variance
()
const
{
67
return
(
n_iterations_
== 0 ? 0. :
average_weight_variance_
/
n_iterations_
);
68
}
69
71
unsigned
long
iteration_points
()
const
{
return
iteration_points_
; }
72
74
unsigned
long
n_iterations
()
const
{
return
n_iterations_
; }
75
77
unsigned
long
attempted
()
const
{
return
attempted_
; }
78
80
unsigned
long
accepted
()
const
{
return
accepted_
; }
81
83
unsigned
long
accepted_negative
()
const
{
return
accepted_negative_
; }
84
86
double
sum_weights
()
const
{
return
sum_weights_
; }
87
89
double
sum_abs_weights
()
const
{
return
sum_abs_weights_
; }
90
92
double
sum_weights_squared
()
const
{
return
sum_weights_squared_
; }
93
95
double
max_weight
()
const
{
return
max_weight_
; }
96
97
public
:
98
100
template
<
class
OStream>
101
void
put
(OStream& os)
const
;
102
104
template
<
class
IStream>
105
void
get
(IStream& is);
106
107
private
:
108
110
double
average_weight_
;
111
113
double
average_abs_weight_
;
114
116
double
average_weight_variance_
;
117
119
unsigned
long
iteration_points_
;
120
122
unsigned
long
attempted_
;
123
125
unsigned
long
accepted_
;
126
128
unsigned
long
accepted_negative_
;
129
131
double
sum_weights_
;
132
134
double
sum_abs_weights_
;
135
137
double
sum_weights_squared_
;
138
140
double
max_weight_
;
141
143
unsigned
long
n_iterations_
;
144
145
};
146
147
}
148
149
#include "statistics.icc"
150
151
#endif
// EXSAMPLE_statistics_h_included
exsample::statistics
statistics is a helper class for keeping track of event generation statistics.
Definition:
statistics.h:20
exsample::statistics::max_weight
double max_weight() const
the maximum weight
Definition:
statistics.h:95
exsample::statistics::average_weight_variance_
double average_weight_variance_
the variance of the weight
Definition:
statistics.h:116
exsample::statistics::sum_abs_weights
double sum_abs_weights() const
the sum of absolute values of the weights
Definition:
statistics.h:89
exsample::statistics::sum_abs_weights_
double sum_abs_weights_
the sum of absolute values of the weights
Definition:
statistics.h:134
exsample::statistics::select
void select(double weight, bool calculate_integral=true)
indicate that a weight has been selected; optionally preven the weight from entering the caluclation ...
exsample::statistics::accepted_negative_
unsigned long accepted_negative_
the total number of acceptet events with negative weights
Definition:
statistics.h:128
exsample::statistics::accepted_
unsigned long accepted_
the total number of finally accepted events in this bin
Definition:
statistics.h:125
exsample::statistics::average_abs_weight
double average_abs_weight() const
the average absolute weight
Definition:
statistics.h:61
exsample::statistics::average_weight_variance
double average_weight_variance() const
the variance of the weight
Definition:
statistics.h:66
exsample::statistics::average_weight
double average_weight() const
the average weight
Definition:
statistics.h:56
exsample::statistics::get
void get(IStream &is)
get from istream
exsample::statistics::accepted_negative
unsigned long accepted_negative() const
the total number of acceptet events with negative weights
Definition:
statistics.h:83
exsample::statistics::sum_weights_squared_
double sum_weights_squared_
the sum of weights squared
Definition:
statistics.h:137
exsample::statistics::accepted
unsigned long accepted() const
the total number of finally accepted events in this bin
Definition:
statistics.h:80
exsample::statistics::attempted
unsigned long attempted() const
the total number of attempted in this bin
Definition:
statistics.h:77
exsample::statistics::presampled
void presampled(double weight)
update the statistics for a weight encountered during presampling
exsample::statistics::statistics
statistics()
default constructor
exsample::statistics::max_weight_
double max_weight_
the maximum weight
Definition:
statistics.h:140
exsample::statistics::put
void put(OStream &os) const
put ostream
exsample::statistics::attempted_
unsigned long attempted_
the total number of attempted in this bin
Definition:
statistics.h:122
exsample::statistics::average_abs_weight_
double average_abs_weight_
the average absolute weight
Definition:
statistics.h:113
exsample::statistics::n_iterations
unsigned long n_iterations() const
the number of iterations
Definition:
statistics.h:74
exsample::statistics::sum_weights_squared
double sum_weights_squared() const
the sum of weights squared
Definition:
statistics.h:92
exsample::statistics::reset
void reset()
reset the statistics object
exsample::statistics::iteration_points_
unsigned long iteration_points_
the number of points in this iteration
Definition:
statistics.h:119
exsample::statistics::iteration_points
unsigned long iteration_points() const
the number of points in this iteration
Definition:
statistics.h:71
exsample::statistics::n_iterations_
unsigned long n_iterations_
the number of iterations used to calculate the integral
Definition:
statistics.h:143
exsample::statistics::accept
void accept(double weight)
indicate that a point has been accepted
Definition:
statistics.h:37
exsample::statistics::average_weight_
double average_weight_
the average weight
Definition:
statistics.h:110
exsample::statistics::sum_weights
double sum_weights() const
the sum of weights
Definition:
statistics.h:86
exsample::statistics::reject
void reject(double weight)
reject a prviously accepted event
Definition:
statistics.h:43
exsample::statistics::sum_weights_
double sum_weights_
the sum of weights
Definition:
statistics.h:131
exsample::statistics::current
std::pair< double, double > current() const
return the integral's estimate and its uncertainty at the currently accumulated statistics
Generated on Thu Jun 20 2024 17:50:53 for Herwig by
1.9.6