|
|
|||
File indexing completed on 2026-08-06 09:24:23
0001 // -*- C++ -*- 0002 // 0003 // MultiIterationStatictis.h is a part of Herwig - A multi-purpose Monte Carlo event generator 0004 // Copyright (C) 2002-2019 The Herwig Collaboration 0005 // 0006 // Herwig is licenced under version 3 of the GPL, see COPYING for details. 0007 // Please respect the MCnet academic guidelines, see GUIDELINES for details. 0008 // 0009 #ifndef Herwig_MultiIterationStatistics_H 0010 #define Herwig_MultiIterationStatistics_H 0011 // 0012 // This is the declaration of the MultiIterationStatistics class. 0013 // 0014 0015 #include "ThePEG/Interface/Interfaced.h" 0016 #include "GeneralStatistics.h" 0017 0018 namespace Herwig { 0019 0020 using namespace ThePEG; 0021 0022 /** 0023 * \ingroup Matchbox 0024 * \author Simon Platzer 0025 * \brief Monte Carlo statistics for multiple iterations 0026 */ 0027 class MultiIterationStatistics: public Interfaced, public Herwig::GeneralStatistics { 0028 0029 public: 0030 0031 /** @name Standard constructors and destructors. */ 0032 //@{ 0033 /** 0034 * The default constructor. 0035 */ 0036 MultiIterationStatistics(); 0037 0038 /** 0039 * The destructor. 0040 */ 0041 virtual ~MultiIterationStatistics(); 0042 //@} 0043 0044 public: 0045 0046 /** 0047 * Indicate the start of a new iteration 0048 */ 0049 void nextIteration() { 0050 iterations().push_back(GeneralStatistics(*this)); 0051 GeneralStatistics::reset(); 0052 } 0053 0054 /** 0055 * Return the iterations done so far. 0056 */ 0057 const vector<GeneralStatistics>& iterations() const { 0058 return theIterations; 0059 } 0060 0061 /** 0062 * Access the iterations done so far. 0063 */ 0064 vector<GeneralStatistics>& iterations() { 0065 return theIterations; 0066 } 0067 0068 /** 0069 * Return the last calculated chi^2. 0070 */ 0071 virtual double chi2() const; 0072 0073 /** 0074 * Return the average weight. 0075 */ 0076 virtual double averageWeight(bool useAll = false) const; 0077 0078 /** 0079 * Return the average absolute weight. 0080 */ 0081 virtual double averageAbsWeight(bool useAll = false) const; 0082 0083 /** 0084 * Return the variance of the average weight. 0085 */ 0086 virtual double averageWeightVariance(bool useAll = false) const; 0087 0088 /** 0089 * Return the variance of the average absolute weight. 0090 */ 0091 virtual double averageAbsWeightVariance(bool useAll = false) const; 0092 0093 /** 0094 * Return the minimum number of events per iteration to take this iteration 0095 * into account when calculating the total cross section 0096 */ 0097 unsigned int minIterationPoints() const { return theMinIterationPoints; } 0098 0099 /** 0100 * Set the minimum number of events per iteration to take this iteration 0101 * into account when calculating the total cross section 0102 */ 0103 void minIterationPoints(unsigned int n) { theMinIterationPoints = n; } 0104 0105 /** 0106 * Return true if integrals should be combined from all iterations 0107 */ 0108 bool useAllIterations() const { return theUseAllIterations; } 0109 0110 /** 0111 * Indicate that integrals should be combined from all iterations 0112 */ 0113 void doUseAllIterations(bool yes = true) { theUseAllIterations = yes; }; 0114 0115 public: 0116 0117 /** @name Functions used by the persistent I/O system. */ 0118 //@{ 0119 /** 0120 * Function used to write out object persistently. 0121 * @param os the persistent output stream written to. 0122 */ 0123 void put(PersistentOStream & os) const; 0124 0125 /** 0126 * Function used to read in object persistently. 0127 * @param is the persistent input stream read from. 0128 * @param version the version number of the object when written. 0129 */ 0130 void get(PersistentIStream & is); 0131 0132 /** 0133 * Function used to write out object persistently. 0134 * @param os the persistent output stream written to. 0135 */ 0136 void persistentOutput(PersistentOStream & os) const; 0137 0138 /** 0139 * Function used to read in object persistently. 0140 * @param is the persistent input stream read from. 0141 * @param version the version number of the object when written. 0142 */ 0143 void persistentInput(PersistentIStream & is, int version); 0144 //@} 0145 0146 /** 0147 * Fill statistics data from an XML element 0148 */ 0149 void fromXML(const XML::Element&); 0150 0151 /** 0152 * Return an XML element for the data of this statistics 0153 */ 0154 XML::Element toXML() const; 0155 0156 /** 0157 * The standard Init function used to initialize the interfaces. 0158 * Called exactly once for each class by the class description system 0159 * before the main function starts or 0160 * when this class is dynamically loaded. 0161 */ 0162 static void Init(); 0163 0164 protected: 0165 0166 /** @name Clone Methods. */ 0167 //@{ 0168 /** 0169 * Make a simple clone of this object. 0170 * @return a pointer to the new object. 0171 */ 0172 virtual IBPtr clone() const; 0173 0174 /** Make a clone of this object, possibly modifying the cloned object 0175 * to make it sane. 0176 * @return a pointer to the new object. 0177 */ 0178 virtual IBPtr fullclone() const; 0179 //@} 0180 0181 private: 0182 0183 /** 0184 * The currently accumulated iterations. 0185 */ 0186 vector<GeneralStatistics> theIterations; 0187 0188 /** 0189 * The minimum number of events per iteration to take this iteration 0190 * into account when calculating the total cross section 0191 */ 0192 unsigned int theMinIterationPoints; 0193 0194 /** 0195 * True if integrals should be combined from all iterations 0196 */ 0197 bool theUseAllIterations; 0198 0199 }; 0200 0201 inline PersistentOStream& operator<<(PersistentOStream& os, const MultiIterationStatistics& s) { 0202 s.put(os); return os; 0203 } 0204 0205 inline PersistentIStream& operator>>(PersistentIStream& is, MultiIterationStatistics& s) { 0206 s.get(is); return is; 0207 } 0208 0209 } 0210 0211 #endif /* Herwig_MultiIterationStatistics_H */
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|