File indexing completed on 2026-08-06 09:24:27
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef HERWIG_Stat_H
0010 #define HERWIG_Stat_H
0011
0012 namespace Herwig{
0013
0014
0015
0016
0017
0018 struct Stat {
0019
0020
0021 Stat() : attempted(0), accepted(0), sumw(0.0), maxXSec(CrossSection()),
0022 totsum(0.0) {}
0023
0024
0025 Stat(long att, long acc, double w, CrossSection x, double sumw)
0026 : attempted(att), accepted(acc), sumw(w), maxXSec(x),
0027 totsum(sumw) {}
0028
0029
0030
0031
0032 inline CrossSection xSec() const {
0033 return totsum >0.0? maxXSec*sumw/totsum: maxXSec;
0034 }
0035
0036
0037 long attempted;
0038
0039 long accepted;
0040
0041 double sumw;
0042
0043 CrossSection maxXSec;
0044
0045 double totsum;
0046
0047
0048 const Stat & operator+= (const Stat & s) {
0049 attempted += s.attempted;
0050 accepted += s.accepted;
0051 sumw += s.sumw;
0052 totsum = max(totsum, s.totsum);
0053 if ( totsum > 0.0 )
0054 maxXSec = max(maxXSec, s.maxXSec);
0055 else
0056 maxXSec += s.maxXSec;
0057 return *this;
0058 }
0059 };
0060 }
0061 #endif