File: MultiIterationStatistics.h

package info (click to toggle)
herwig%2B%2B 2.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 27,128 kB
  • ctags: 24,739
  • sloc: cpp: 188,949; fortran: 23,193; sh: 11,365; python: 5,069; ansic: 3,539; makefile: 1,865; perl: 2
file content (129 lines) | stat: -rw-r--r-- 2,758 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
// -*- C++ -*-
//
// MultiIterationStatictis.h is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2012 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef Herwig_MultiIterationStatistics_H
#define Herwig_MultiIterationStatistics_H
//
// This is the declaration of the MultiIterationStatistics class.
//

#include "GeneralStatistics.h"

namespace Herwig {

using namespace ThePEG;

/**
 * \ingroup Matchbox
 * \author Simon Platzer
 * \brief Monte Carlo statistics for multiple iterations
 */
class MultiIterationStatistics: public Herwig::GeneralStatistics {

public:

  /** @name Standard constructors and destructors. */
  //@{
  /**
   * The default constructor.
   */
  MultiIterationStatistics();

  /**
   * The destructor.
   */
  virtual ~MultiIterationStatistics();
  //@}

public:

  /**
   * Indicate the start of a new iteration
   */
  void nextIteration() {
    iterations().push_back(GeneralStatistics(*this));
    reset();
  }

  /**
   * Return the iterations done so far.
   */
  const vector<GeneralStatistics>& iterations() const {
    return theIterations;
  }

  /**
   * Access the iterations done so far.
   */
  vector<GeneralStatistics>& iterations() {
    return theIterations;
  }

  /**
   * Return the last calculated chi^2.
   */
  virtual double chi2() const;

  /**
   * Return the average weight.
   */
  virtual double averageWeight() const;

  /**
   * Return the average absolute weight.
   */
  virtual double averageAbsWeight() const;

  /**
   * Return the variance of the average weight.
   */
  virtual double averageWeightVariance() const;

  /**
   * Return the variance of the average absolute weight.
   */
  virtual double averageAbsWeightVariance() const;

public:

  /** @name Functions used by the persistent I/O system. */
  //@{
  /**
   * Function used to write out object persistently.
   * @param os the persistent output stream written to.
   */
  void put(PersistentOStream & os) const;

  /**
   * Function used to read in object persistently.
   * @param is the persistent input stream read from.
   * @param version the version number of the object when written.
   */
  void get(PersistentIStream & is);
  //@}

private:

  /**
   * The currently accumulated iterations.
   */
  vector<GeneralStatistics> theIterations;

};

inline PersistentOStream& operator<<(PersistentOStream& os, const MultiIterationStatistics& s) {
  s.put(os); return os;
}

inline PersistentIStream& operator>>(PersistentIStream& is, MultiIterationStatistics& s) {
  s.get(is); return is;
}

}

#endif /* Herwig_MultiIterationStatistics_H */