herwig is hosted by Hepforge, IPPP Durham
Herwig  7.1.5
MultiIterationStatistics.h
1 // -*- C++ -*-
2 //
3 // MultiIterationStatictis.h is a part of Herwig - A multi-purpose Monte Carlo event generator
4 // Copyright (C) 2002-2017 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 
18 namespace Herwig {
19 
20 using namespace ThePEG;
21 
28 
29 public:
30 
37 
41  virtual ~MultiIterationStatistics();
43 
44 public:
45 
49  void nextIteration() {
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 
115 public:
116 
123  void put(PersistentOStream & os) const;
124 
130  void get(PersistentIStream & is);
131 
136  void persistentOutput(PersistentOStream & os) const;
137 
143  void persistentInput(PersistentIStream & is, int version);
145 
149  void fromXML(const XML::Element&);
150 
154  XML::Element toXML() const;
155 
162  static void Init();
163 
164 protected:
165 
172  virtual IBPtr clone() const;
173 
178  virtual IBPtr fullclone() const;
180 
181 private:
182 
186  vector<GeneralStatistics> theIterations;
187 
192  unsigned int theMinIterationPoints;
193 
198 
199 };
200 
202  s.put(os); return os;
203 }
204 
206  s.get(is); return is;
207 }
208 
209 }
210 
211 #endif /* Herwig_MultiIterationStatistics_H */
void put(PersistentOStream &os) const
Function used to write out object persistently.
const vector< GeneralStatistics > & iterations() const
Return the iterations done so far.
unsigned int minIterationPoints() const
Return the minimum number of events per iteration to take this iteration into account when calculatin...
ThePEG::Ptr< InterfacedBase >::pointer IBPtr
void get(PersistentIStream &is)
Function used to read in object persistently.
General Monte Carlo statistics.
void reset()
Reset these statistics.
ostream & operator<<(ostream &, const DecayIntegrator &)
Output information on the DecayIntegrator for debugging purposes.
vector< GeneralStatistics > & iterations()
Access the iterations done so far.
Monte Carlo statistics for multiple iterations.
vector< T > & operator>>(vector< T > &tv, U &u)
void minIterationPoints(unsigned int n)
Set the minimum number of events per iteration to take this iteration into account when calculating t...
void nextIteration()
Indicate the start of a new iteration.
void doUseAllIterations(bool yes=true)
Indicate that integrals should be combined from all iterations.
Element represents a (tree of) XML elements.
Definition: Element.h:56
-*- C++ -*-
bool useAllIterations() const
Return true if integrals should be combined from all iterations.
bool theUseAllIterations
True if integrals should be combined from all iterations.
unsigned int theMinIterationPoints
The minimum number of events per iteration to take this iteration into account when calculating the t...
vector< GeneralStatistics > theIterations
The currently accumulated iterations.