herwig
is hosted by
Hepforge
,
IPPP Durham
Herwig
7.3.0
Utilities
Statistics
Run.h
1
// -*- C++ -*-
2
//
3
// Run.hpp is a part of myStatistics
4
// Copyright (C) 2012-2019 Simon Platzer, The Herwig Collaboration
5
//
6
// myStatistics is licenced under version 3 of the GPL, see COPYING for details.
7
//
8
#ifndef MYSTATISTICS_Run_hpp_included
9
#define MYSTATISTICS_Run_hpp_included
10
11
#include "Histogram.h"
12
13
namespace
Statistics {
14
19
class
Run
{
20
21
public
:
22
26
Run
();
27
31
explicit
Run
(
const
std::string& newName);
32
36
virtual
~Run
();
37
38
public
:
39
43
void
initialize
();
44
48
void
reset
();
49
53
void
finalize
(
size_t
newAttemptedPoints);
54
55
public
:
56
60
void
count
(
double
weight) {
61
theSumOfWeights
+= weight;
62
theSumOfSquaredWeights
+= weight*weight;
63
}
64
68
Histogram
&
addHistogram
(
const
std::string& newName,
69
const
std::vector<double>& newBoundaries);
70
74
Histogram
&
addHistogram
(
const
std::string& newName,
75
const
std::vector<double>& newBoundaries,
76
const
std::pair<double,double>& newPeriodicity);
77
81
Histogram
&
histogram
(
const
std::string& histoName);
82
86
const
Histogram
&
histogram
(
const
std::string& histoName)
const
;
87
91
const
std::map<std::string,Histogram>&
histograms
()
const
{
return
theHistograms
; }
92
96
const
std::string&
name
()
const
{
return
theName
; }
97
101
void
name
(
const
std::string& newName) {
theName
= newName; }
102
106
size_t
attemptedPoints
()
const
{
return
theAttemptedPoints
; }
107
111
double
sumOfWeights
()
const
{
return
theSumOfWeights
; }
112
116
double
sumOfSquaredWeights
()
const
{
return
theSumOfSquaredWeights
; }
117
118
public
:
119
123
Run
&
operator+=
(
const
Run
& other);
124
125
public
:
126
130
void
fromXML
(
const
XML::Element
&);
131
135
XML::Element
toXML
()
const
;
136
137
private
:
138
142
std::string
theName
;
143
147
size_t
theAttemptedPoints
;
148
152
double
theSumOfWeights
;
153
157
double
theSumOfSquaredWeights
;
158
162
std::map<std::string,Histogram>
theHistograms
;
163
164
165
};
166
167
}
168
169
#endif
// MYSTATISTICS_Run_hpp_included
Statistics::Histogram
A (one dimensional) histogram.
Definition:
Statistics/Histogram.h:25
Statistics::Run
A simulation run.
Definition:
Run.h:19
Statistics::Run::theName
std::string theName
The name of the run.
Definition:
Run.h:142
Statistics::Run::finalize
void finalize(size_t newAttemptedPoints)
Finalize this run.
Statistics::Run::sumOfWeights
double sumOfWeights() const
The sum of weights.
Definition:
Run.h:111
Statistics::Run::histogram
Histogram & histogram(const std::string &histoName)
Return a given histogram.
Statistics::Run::~Run
virtual ~Run()
Destructor.
Statistics::Run::sumOfSquaredWeights
double sumOfSquaredWeights() const
The sum of squared weights.
Definition:
Run.h:116
Statistics::Run::operator+=
Run & operator+=(const Run &other)
Add a run to this run.
Statistics::Run::theSumOfSquaredWeights
double theSumOfSquaredWeights
The sum of squared weights.
Definition:
Run.h:157
Statistics::Run::histograms
const std::map< std::string, Histogram > & histograms() const
Return the histograms.
Definition:
Run.h:91
Statistics::Run::reset
void reset()
Reset this run.
Statistics::Run::Run
Run()
Default constructor.
Statistics::Run::name
void name(const std::string &newName)
Set the name of the run.
Definition:
Run.h:101
Statistics::Run::theSumOfWeights
double theSumOfWeights
The sum of weights.
Definition:
Run.h:152
Statistics::Run::attemptedPoints
size_t attemptedPoints() const
Return the total number of attempted points.
Definition:
Run.h:106
Statistics::Run::toXML
XML::Element toXML() const
Return an XML element for the data of this run.
Statistics::Run::addHistogram
Histogram & addHistogram(const std::string &newName, const std::vector< double > &newBoundaries)
Add a histogram.
Statistics::Run::count
void count(double weight)
Add a point to this run.
Definition:
Run.h:60
Statistics::Run::histogram
const Histogram & histogram(const std::string &histoName) const
Return a given histogram.
Statistics::Run::name
const std::string & name() const
Return the name of the run.
Definition:
Run.h:96
Statistics::Run::initialize
void initialize()
Initialize this run.
Statistics::Run::Run
Run(const std::string &newName)
Construct giving a name and seed.
Statistics::Run::theHistograms
std::map< std::string, Histogram > theHistograms
The histograms.
Definition:
Run.h:162
Statistics::Run::addHistogram
Histogram & addHistogram(const std::string &newName, const std::vector< double > &newBoundaries, const std::pair< double, double > &newPeriodicity)
Add a histogram.
Statistics::Run::theAttemptedPoints
size_t theAttemptedPoints
The total number of attempted points.
Definition:
Run.h:147
Statistics::Run::fromXML
void fromXML(const XML::Element &)
Fill run data from an XML element.
XML::Element
Element represents a (tree of) XML elements.
Definition:
Element.h:56
Generated on Thu Jun 20 2024 17:50:53 for Herwig by
1.9.6