Herwig 7.3.0
|
A (weighted) counter. More...
#include <Counter.h>
Public Member Functions | |
Counter () | |
Construct a new counter. | |
virtual | ~Counter () |
Destruct a counter. | |
void | initialize () |
Initialize this counter. | |
void | reset () |
Reset this counter. | |
void | finalize () |
Finalize this counter. | |
void | open (size_t id) |
Open the counter for the next event of the given id. | |
void | close () |
Close the counter and update the overall statistics. | |
void | count (double weight, size_t id) |
Book a contribution to the current event. | |
Counter & | operator+= (const Counter &other) |
Add a counter to this counter. | |
Counter & | operator-= (const Counter &other) |
Subtract a counter from this counter. | |
double | sumOfWeights () const |
Return the sum of weights. | |
double | sumOfSquaredWeights () const |
Return the sum of squared weights. | |
double | sumOfEventWeights () const |
Return the sum of weights before the next event occured. | |
size_t | eventId () const |
Return the current event id. | |
bool | isOpen () const |
Return true, if this counter is open. | |
bool | isClosed () const |
Return true, if this counter is closed. | |
double | average (double nPoints) const |
Given a number of sampled points, return the average of this counter. | |
double | varianceOfAverage (double nPoints) const |
Given a number of sampled points, return the variance of the average of this counter. | |
void | fromXML (const XML::Element &) |
Fill counter data from an XML element. | |
XML::Element | toXML () const |
Return an XML element for the data of this counter. | |
Private Attributes | |
double | theSumOfWeights |
The sum of weights counted. | |
double | theSumOfSquaredWeights |
The sum of squared weights counted. | |
double | theSumOfEventWeights |
The sum of weights counted before the next event occured; within one event, all weights are considered to be 100% correlated. | |
size_t | theEventId |
The current event id. | |
void Statistics::Counter::count | ( | double | weight, |
size_t | id | ||
) |
Book a contribution to the current event.
Implies close() and open(id) if the id is different from the currently considered event id.
|
inline |
Return the current event id.
Definition at line 101 of file Counter.h.
References theEventId.
Referenced by isOpen().
|
inline |
|
inline |
|
inline |
|
inline |
Return true, if this counter is open.
Definition at line 106 of file Counter.h.
References eventId().
Referenced by finalize(), and isClosed().
|
inline |
|
inline |
Return the sum of weights before the next event occured.
Definition at line 96 of file Counter.h.
References theSumOfEventWeights.
|
inline |
Return the sum of squared weights.
Definition at line 91 of file Counter.h.
References theSumOfSquaredWeights.
|
inline |
|
private |
|
private |
The sum of weights counted before the next event occured; within one event, all weights are considered to be 100% correlated.
Definition at line 156 of file Counter.h.
Referenced by sumOfEventWeights().
|
private |
The sum of squared weights counted.
Definition at line 149 of file Counter.h.
Referenced by sumOfSquaredWeights().
|
private |