herwig is hosted by Hepforge, IPPP Durham
Herwig 7.3.0
MultiIterationStatistics.h
1// -*- C++ -*-
2//
3// MultiIterationStatictis.h is a part of Herwig - A multi-purpose Monte Carlo event generator
4// Copyright (C) 2002-2019 The Herwig Collaboration
5//
6// Herwig is licenced under version 3 of the GPL, see COPYING for details.
7// Please respect the MCnet academic guidelines, see GUIDELINES for details.
8//
9#ifndef Herwig_MultiIterationStatistics_H
10#define Herwig_MultiIterationStatistics_H
11//
12// This is the declaration of the MultiIterationStatistics class.
13//
14
15#include "ThePEG/Interface/Interfaced.h"
16#include "GeneralStatistics.h"
17
18namespace Herwig {
19
20using namespace ThePEG;
21
28
29public:
30
37
43
44public:
45
50 iterations().push_back(GeneralStatistics(*this));
52 }
53
57 const vector<GeneralStatistics>& iterations() const {
58 return theIterations;
59 }
60
64 vector<GeneralStatistics>& iterations() {
65 return theIterations;
66 }
67
71 virtual double chi2() const;
72
76 virtual double averageWeight(bool useAll = false) const;
77
81 virtual double averageAbsWeight(bool useAll = false) const;
82
86 virtual double averageWeightVariance(bool useAll = false) const;
87
91 virtual double averageAbsWeightVariance(bool useAll = false) const;
92
97 unsigned int minIterationPoints() const { return theMinIterationPoints; }
98
103 void minIterationPoints(unsigned int n) { theMinIterationPoints = n; }
104
108 bool useAllIterations() const { return theUseAllIterations; }
109
113 void doUseAllIterations(bool yes = true) { theUseAllIterations = yes; };
114
115public:
116
123 void put(PersistentOStream & os) const;
124
131
137
143 void persistentInput(PersistentIStream & is, int version);
145
149 void fromXML(const XML::Element&);
150
155
162 static void Init();
163
164protected:
165
172 virtual IBPtr clone() const;
173
178 virtual IBPtr fullclone() const;
180
181private:
182
186 vector<GeneralStatistics> theIterations;
187
193
198
199};
200
202 s.put(os); return os;
203}
204
205inline PersistentIStream& operator>>(PersistentIStream& is, MultiIterationStatistics& s) {
206 s.get(is); return is;
207}
208
209}
210
211#endif /* Herwig_MultiIterationStatistics_H */
General Monte Carlo statistics.
void reset()
Reset these statistics.
GeneralStatistics()
The default constructor.
Monte Carlo statistics for multiple iterations.
static void Init()
The standard Init function used to initialize the interfaces.
XML::Element toXML() const
Return an XML element for the data of this statistics.
void get(PersistentIStream &is)
Function used to read in object persistently.
virtual double averageAbsWeightVariance(bool useAll=false) const
Return the variance of the average absolute weight.
void put(PersistentOStream &os) const
Function used to write out object persistently.
void nextIteration()
Indicate the start of a new iteration.
void persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
unsigned int theMinIterationPoints
The minimum number of events per iteration to take this iteration into account when calculating the t...
virtual double chi2() const
Return the last calculated chi^2.
virtual IBPtr clone() const
Make a simple clone of this object.
void doUseAllIterations(bool yes=true)
Indicate that integrals should be combined from all iterations.
bool theUseAllIterations
True if integrals should be combined from all iterations.
vector< GeneralStatistics > theIterations
The currently accumulated iterations.
void minIterationPoints(unsigned int n)
Set the minimum number of events per iteration to take this iteration into account when calculating t...
virtual IBPtr fullclone() const
Make a clone of this object, possibly modifying the cloned object to make it sane.
virtual double averageAbsWeight(bool useAll=false) const
Return the average absolute weight.
virtual double averageWeight(bool useAll=false) const
Return the average weight.
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
vector< GeneralStatistics > & iterations()
Access the iterations done so far.
virtual ~MultiIterationStatistics()
The destructor.
MultiIterationStatistics()
The default constructor.
const vector< GeneralStatistics > & iterations() const
Return the iterations done so far.
void fromXML(const XML::Element &)
Fill statistics data from an XML element.
bool useAllIterations() const
Return true if integrals should be combined from all iterations.
unsigned int minIterationPoints() const
Return the minimum number of events per iteration to take this iteration into account when calculatin...
virtual double averageWeightVariance(bool useAll=false) const
Return the variance of the average weight.
Element represents a (tree of) XML elements.
Definition: Element.h:56
-*- C++ -*-
PersistentIStream & operator>>(PersistentIStream &is, HandlerGroup< HDLR > &hg)
ThePEG::Ptr< InterfacedBase >::pointer IBPtr
ostream & operator<<(ostream &, const Collision &)