herwig is hosted by Hepforge, IPPP Durham
Herwig  7.2.1
Statistics::Counter Class Reference

A (weighted) counter. More...

#include <Counter.h>

Inheritance diagram for Statistics::Counter:

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. More...
 
Counteroperator+= (const Counter &other)
 Add a counter to this counter.
 
Counteroperator-= (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. More...
 

Detailed Description

A (weighted) counter.

Author
Simon Platzer

Definition at line 19 of file Counter.h.

Member Function Documentation

◆ count()

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.

Referenced by finalize().

Member Data Documentation

◆ theEventId

size_t Statistics::Counter::theEventId
private

The current event id.

The counter is closed if this is zero.

Definition at line 161 of file Counter.h.

Referenced by eventId().


The documentation for this class was generated from the following file: