thepeg is hosted by Hepforge, IPPP Durham
ThePEG 2.3.0
ThePEG::XSecStat Class Reference

XSecStat is a concrete helper class used to collect statistics about the cross section for a specific process or group of processes. More...

#include <XSecStat.h>

Public Types

enum  { plainWeights = 0 , plainVetoedWeights , reweightedWeights , reweightedVetoedWeights }
 Enumerate the different weight classes. More...
 

Public Member Functions

Standard constructors, destructor and assignment operator.
 XSecStat ()
 The default constructor.
 
 XSecStat (CrossSection xsecmax)
 Constructor taking the overestimated cross section, xsecmax, as argument.
 
XSecStatoperator= (const XSecStat &x)=default
 The assignment operator.
 
XSecStatoperator+= (const XSecStat &x)
 Add the contents of another XSecStat.
 
void reset ()
 Reset the statistics.
 
Simple access functions
void accept ()
 An event of the corresponding class has been accepted.
 
void select (double weight)
 An event of the corresponding class has been attempted.
 
void reweight (double oldWeight, double newWeight)
 Reweight a selected and accepted event.
 
void reject (double weight=1.0)
 Reject the event which was last accepted with accept() or selected with select(double).
 
CrossSection maxXSec () const
 The overestimated cross section.
 
double sumWeights () const
 The sum of the weights so far.
 
double sumWeights2 () const
 The sum of the squared weights so far.
 
double sumWeightsNoReweight () const
 The sum of the weights so far, excluding reweighting.
 
double sumWeights2NoReweight () const
 The sum of the squared weights so far, excluding reweighting.
 
CrossSection xSec (double att=0) const
 The current estimate of the cross section for the corresponding class of events.
 
CrossSection xSecErr (double att=0) const
 The current estimate of the error in the cross section for the corresponding class of events.
 
CrossSection xSecNoReweight (double att=0) const
 The current estimate of the cross section for the corresponding class of events, excluding reweighting.
 
CrossSection xSecErrNoReweight (double att=0) const
 The current estimate of the error in the cross section for the corresponding class of events, excluding reweighting.
 
double attempts () const
 Number of attempts so far.
 
double accepted () const
 Number of accepts so far.
 
double vetoed () const
 Number of vetoes so far.
 
void maxXSec (CrossSection x)
 Set the overestimated cross section.
 

I/O functions

CrossSection theMaxXSec
 The overestimated cross section.
 
double theAttempts
 Number of attempts so far.
 
double theAccepted
 Number of accepted events so far.
 
double theVetoed
 Number of events vetoed after being accepted.
 
array< double, 4 > theSumWeights
 The sum of the weights so far.
 
array< double, 4 > theSumWeights2
 The sum of the squared weights so far.
 
double theLastWeight
 The last selected weight, ignoring reweighting.
 
void output (PersistentOStream &os) const
 Output to a persistent stream.
 
void input (PersistentIStream &is)
 Input from a persistent stream.
 

Detailed Description

XSecStat is a concrete helper class used to collect statistics about the cross section for a specific process or group of processes.

It contains an overestimated cross section and information about the number of times the process has been used to generate an event and how many times this event has been accepted.

An object of this class must initially be given an overestimated cross section in the constructor or with the maxXSec(CrossSection) function. Each time the corresponding process is selected (according to maxXSec()), the select(double) function should be called giving the weight with which the event will be accepted as argument. If the event is then accepted, the accept() function should be called. If an event is later vetoed, the reject() function should be called.

Definition at line 36 of file XSecStat.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Enumerate the different weight classes.

Definition at line 43 of file XSecStat.h.

Constructor & Destructor Documentation

◆ XSecStat() [1/2]

ThePEG::XSecStat::XSecStat ( )
inline

The default constructor.

Definition at line 55 of file XSecStat.h.

◆ XSecStat() [2/2]

ThePEG::XSecStat::XSecStat ( CrossSection  xsecmax)
inlineexplicit

Constructor taking the overestimated cross section, xsecmax, as argument.

Definition at line 64 of file XSecStat.h.

Member Function Documentation

◆ accept()

void ThePEG::XSecStat::accept ( )
inline

An event of the corresponding class has been accepted.

The select() method must have been called before.

Definition at line 109 of file XSecStat.h.

References theAccepted.

Referenced by ThePEG::StandardXComb::accept(), and ThePEG::LesHouchesReader::accept().

◆ accepted()

double ThePEG::XSecStat::accepted ( ) const
inline

Number of accepts so far.

Definition at line 240 of file XSecStat.h.

References theAccepted, and theVetoed.

Referenced by ThePEG::MadGraphReader::dofinish().

◆ attempts()

double ThePEG::XSecStat::attempts ( ) const
inline

Number of attempts so far.

Definition at line 235 of file XSecStat.h.

References theAttempts.

Referenced by xSec(), xSecErr(), xSecErrNoReweight(), and xSecNoReweight().

◆ maxXSec() [1/2]

CrossSection ThePEG::XSecStat::maxXSec ( ) const
inline

The overestimated cross section.

Definition at line 153 of file XSecStat.h.

References theMaxXSec.

Referenced by xSec(), xSecErr(), xSecErrNoReweight(), and xSecNoReweight().

◆ maxXSec() [2/2]

void ThePEG::XSecStat::maxXSec ( CrossSection  x)
inline

Set the overestimated cross section.

Definition at line 250 of file XSecStat.h.

References theMaxXSec.

◆ operator+=()

XSecStat & ThePEG::XSecStat::operator+= ( const XSecStat x)
inline

Add the contents of another XSecStat.

Definition at line 77 of file XSecStat.h.

References theAccepted, theAttempts, theLastWeight, theSumWeights, theSumWeights2, and theVetoed.

◆ reject()

void ThePEG::XSecStat::reject ( double  weight = 1.0)
inline

Reject the event which was last accepted with accept() or selected with select(double).

The weight should be set to the value, \(w\), used in the previous call to select(double), except if the event has been accepted with the probability \(w\), in which case weight should be set to \(sign(1, w)\).

Definition at line 142 of file XSecStat.h.

References ThePEG::sqr(), theLastWeight, theSumWeights, theSumWeights2, and theVetoed.

Referenced by ThePEG::LesHouchesReader::reject(), and ThePEG::StandardXComb::reject().

◆ reset()

void ThePEG::XSecStat::reset ( )
inline

Reset the statistics.

Definition at line 92 of file XSecStat.h.

References theAccepted, theAttempts, theLastWeight, theSumWeights, theSumWeights2, and theVetoed.

Referenced by ThePEG::StandardXComb::reset().

◆ reweight()

void ThePEG::XSecStat::reweight ( double  oldWeight,
double  newWeight 
)
inline

Reweight a selected and accepted event.

Definition at line 129 of file XSecStat.h.

References ThePEG::sqr(), theSumWeights, and theSumWeights2.

Referenced by ThePEG::StandardXComb::reweight().

◆ select()

void ThePEG::XSecStat::select ( double  weight)
inline

An event of the corresponding class has been attempted.

It will subsequently be accepted with the given weight.

Definition at line 117 of file XSecStat.h.

References ThePEG::sqr(), theAttempts, theLastWeight, theSumWeights, and theSumWeights2.

Referenced by ThePEG::StandardXComb::select(), and ThePEG::LesHouchesReader::select().

◆ sumWeights()

double ThePEG::XSecStat::sumWeights ( ) const
inline

The sum of the weights so far.

Definition at line 158 of file XSecStat.h.

References theSumWeights.

Referenced by xSec(), and xSecErr().

◆ sumWeights2()

double ThePEG::XSecStat::sumWeights2 ( ) const
inline

The sum of the squared weights so far.

Definition at line 165 of file XSecStat.h.

References theSumWeights2.

Referenced by xSecErr().

◆ sumWeights2NoReweight()

double ThePEG::XSecStat::sumWeights2NoReweight ( ) const
inline

The sum of the squared weights so far, excluding reweighting.

Definition at line 179 of file XSecStat.h.

References theSumWeights2.

Referenced by xSecErrNoReweight().

◆ sumWeightsNoReweight()

double ThePEG::XSecStat::sumWeightsNoReweight ( ) const
inline

The sum of the weights so far, excluding reweighting.

Definition at line 172 of file XSecStat.h.

References theSumWeights.

Referenced by xSecErrNoReweight(), and xSecNoReweight().

◆ vetoed()

double ThePEG::XSecStat::vetoed ( ) const
inline

Number of vetoes so far.

Definition at line 245 of file XSecStat.h.

References theVetoed.

◆ xSec()

CrossSection ThePEG::XSecStat::xSec ( double  att = 0) const
inline

The current estimate of the cross section for the corresponding class of events.

If no events have been generated, maxXSec() will be returned.

Definition at line 188 of file XSecStat.h.

References attempts(), maxXSec(), and sumWeights().

◆ xSecErr()

CrossSection ThePEG::XSecStat::xSecErr ( double  att = 0) const
inline

The current estimate of the error in the cross section for the corresponding class of events.

If no events have been generated, maxXSec() will be returned.

Definition at line 198 of file XSecStat.h.

References attempts(), maxXSec(), ThePEG::sqr(), sumWeights(), and sumWeights2().

◆ xSecErrNoReweight()

CrossSection ThePEG::XSecStat::xSecErrNoReweight ( double  att = 0) const
inline

The current estimate of the error in the cross section for the corresponding class of events, excluding reweighting.

If no events have been generated, maxXSec() will be returned.

Definition at line 222 of file XSecStat.h.

References attempts(), maxXSec(), ThePEG::sqr(), sumWeights2NoReweight(), and sumWeightsNoReweight().

◆ xSecNoReweight()

CrossSection ThePEG::XSecStat::xSecNoReweight ( double  att = 0) const
inline

The current estimate of the cross section for the corresponding class of events, excluding reweighting.

If no events have been generated, maxXSec() will be returned.

Definition at line 212 of file XSecStat.h.

References attempts(), maxXSec(), and sumWeightsNoReweight().

Member Data Documentation

◆ theAccepted

double ThePEG::XSecStat::theAccepted
private

Number of accepted events so far.

Definition at line 283 of file XSecStat.h.

Referenced by accept(), accepted(), operator+=(), and reset().

◆ theAttempts

double ThePEG::XSecStat::theAttempts
private

Number of attempts so far.

Definition at line 278 of file XSecStat.h.

Referenced by attempts(), operator+=(), reset(), and select().

◆ theLastWeight

double ThePEG::XSecStat::theLastWeight
private

The last selected weight, ignoring reweighting.

Definition at line 303 of file XSecStat.h.

Referenced by operator+=(), reject(), reset(), and select().

◆ theMaxXSec

CrossSection ThePEG::XSecStat::theMaxXSec
private

The overestimated cross section.

Definition at line 273 of file XSecStat.h.

Referenced by maxXSec().

◆ theSumWeights

array<double,4> ThePEG::XSecStat::theSumWeights
private

The sum of the weights so far.

Definition at line 293 of file XSecStat.h.

Referenced by operator+=(), reject(), reset(), reweight(), select(), sumWeights(), and sumWeightsNoReweight().

◆ theSumWeights2

array<double,4> ThePEG::XSecStat::theSumWeights2
private

The sum of the squared weights so far.

Definition at line 298 of file XSecStat.h.

Referenced by operator+=(), reject(), reset(), reweight(), select(), sumWeights2(), and sumWeights2NoReweight().

◆ theVetoed

double ThePEG::XSecStat::theVetoed
private

Number of events vetoed after being accepted.

Definition at line 288 of file XSecStat.h.

Referenced by accepted(), operator+=(), reject(), reset(), and vetoed().


The documentation for this class was generated from the following file: