herwig is hosted by Hepforge, IPPP Durham
Herwig 7.3.0
stat.h
1// -*- C++ -*-
2//
3// stat.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_Stat_H
10#define HERWIG_Stat_H
11
12namespace Herwig{
13
18struct Stat {
19
21 Stat() : attempted(0), accepted(0), sumw(0.0), maxXSec(CrossSection()),
22 totsum(0.0) {}
23
25 Stat(long att, long acc, double w, CrossSection x, double sumw)
26 : attempted(att), accepted(acc), sumw(w), maxXSec(x),
27 totsum(sumw) {}
28
32 inline CrossSection xSec() const {
33 return totsum >0.0? maxXSec*sumw/totsum: maxXSec;
34 }
35
41 double sumw;
43 CrossSection maxXSec;
45 double totsum;
46
48 const Stat & operator+= (const Stat & s) {
49 attempted += s.attempted;
50 accepted += s.accepted;
51 sumw += s.sumw;
52 totsum = max(totsum, s.totsum);
53 if ( totsum > 0.0 )
54 maxXSec = max(maxXSec, s.maxXSec);
55 else
56 maxXSec += s.maxXSec;
57 return *this;
58 }
59};
60}
61#endif
-*- C++ -*-
Documentation for the statistics struct.
Definition: stat.h:18
double sumw
Sum of weights.
Definition: stat.h:41
long attempted
Store the number of attempts.
Definition: stat.h:37
CrossSection xSec() const
Calculation of the cross section.
Definition: stat.h:32
Stat()
Standard constructor.
Definition: stat.h:21
const Stat & operator+=(const Stat &s)
Overloaded += operator.
Definition: stat.h:48
CrossSection maxXSec
Maximal cross section.
Definition: stat.h:43
Stat(long att, long acc, double w, CrossSection x, double sumw)
Constructor with arguments.
Definition: stat.h:25
double totsum
Maximal weights.
Definition: stat.h:45
long accepted
Store the number of accepted ones.
Definition: stat.h:39