Herwig 7.3.0
|
A GeneralSampler class. More...
#include <GeneralSampler.h>
Public Member Functions | |
Standard constructors and destructors. | |
GeneralSampler () | |
The default constructor. | |
virtual | ~GeneralSampler () |
The destructor. | |
![]() | |
void | setEventHandler (tStdEHPtr eh) |
virtual void | initialize ()=0 |
virtual void | prepare () |
virtual double | generate ()=0 |
virtual void | rejectLast ()=0 |
const vector< double > & | lastPoint () const |
virtual int | lastBin () const |
virtual CrossSection | integratedXSec () const=0 |
virtual CrossSection | integratedXSecErr () const=0 |
virtual CrossSection | maxXSec () const |
virtual double | attempts () const |
virtual double | sumWeights () const=0 |
virtual double | sumWeights2 () const=0 |
virtual bool | almostUnweighted () const |
void | integrationList (const string &newIntegrationList) |
const string & | integrationList () const |
void | persistentOutput (PersistentOStream &os) const |
void | persistentInput (PersistentIStream &is, int version) |
void | setEventHandler (tStdEHPtr eh) |
virtual void | initialize ()=0 |
virtual void | prepare () |
virtual double | generate ()=0 |
virtual void | rejectLast ()=0 |
const vector< double > & | lastPoint () const |
virtual int | lastBin () const |
virtual CrossSection | integratedXSec () const=0 |
virtual CrossSection | integratedXSecErr () const=0 |
virtual CrossSection | maxXSec () const |
virtual double | attempts () const |
virtual double | sumWeights () const=0 |
virtual double | sumWeights2 () const=0 |
virtual bool | almostUnweighted () const |
![]() | |
virtual bool | defaultInit () |
PPtr | getParticle (PID) const |
PDPtr | getParticleData (PID) const |
bool | used () const |
void | useMe () const |
tEGPtr | generator () const |
void | persistentOutput (PersistentOStream &os) const |
void | persistentInput (PersistentIStream &is, int version) |
PPtr | getParticle (PID) const |
PDPtr | getParticleData (PID) const |
bool | used () const |
void | useMe () const |
tEGPtr | generator () const |
![]() | |
string | fullName () const |
string | name () const |
string | path () const |
string | comment () const |
void | setup (istream &is) |
void | update () |
void | init () |
virtual bool | preInitialize () const |
void | initrun () |
void | finish () |
void | touch () |
void | reset () |
void | clear () |
InitState | state () const |
bool | locked () const |
bool | touched () const |
virtual IBPtr | fullclone () const |
void | persistentOutput (PersistentOStream &os) const |
void | persistentInput (PersistentIStream &is, int version) |
virtual void | debugme () const |
void | update () |
void | init () |
virtual bool | preInitialize () const |
void | initrun () |
void | finish () |
void | touch () |
void | reset () |
void | clear () |
InitState | state () const |
bool | locked () const |
bool | touched () const |
virtual IBPtr | fullclone () const |
![]() | |
void | debug () const |
virtual void | debugme () const |
![]() | |
CounterType | referenceCount () const |
![]() | |
Named (const string &newName=string()) | |
Named (const Named &)=default | |
const string & | name () const |
bool | operator== (const Named &other) const |
bool | operator< (const Named &other) const |
Clone Methods. | |
bool | theVerbose |
Whether or not additional information should be printed to cout. | |
XML::Element | theGrids |
The XML element containing the grids. | |
Ptr< BinSampler >::ptr | theBinSampler |
The bin sampler to use. | |
map< double, Ptr< BinSampler >::ptr > | theSamplers |
The selector map for the bin samplers. | |
Ptr< BinSampler >::tptr | theLastSampler |
The last selected bin sampler. | |
CrossSection | theIntegratedXSec |
The integrated cross section. | |
CrossSection | theIntegratedXSecErr |
The integrated cross section error. | |
size_t | theUpdateAfter |
The number of events after which cross sections should truly be updated. | |
size_t | crossSectionCalls |
The number of calls to currentCrossSections since the last update. | |
bool | gotCrossSections |
True, if currentCrossSections has been called since the last call to generate. | |
double | theSumWeights |
The sum of weights. | |
double | theSumWeights2 |
The sum of weights squared. | |
double | theAttempts |
The number of attempts. | |
double | theAccepts |
The number of accepts. | |
double | theMaxWeight |
The maximum weight encountered. | |
bool | theAddUpSamplers |
True, if cross sections are to be combined from each sampler individually. | |
bool | theGlobalMaximumWeight |
True, if the global maximum weight should be used as reference. | |
bool | theFlatSubprocesses |
True, if subprocesses should be selected flat. | |
bool | isSampling |
True, if we are generating events. | |
double | theMinSelection |
A minimum selection probability for each sampler. | |
bool | runCombinationData |
True, if information for combining unnormalized runs should be printed out. | |
bool | theAlmostUnweighted |
True, if we should perform an almost unweighted sampling. | |
unsigned long | maximumExceeds |
Number of points which exceeded the maximum. | |
double | maximumExceededBy |
The average relative deviation from the maximum weight. | |
double | correctWeights |
The correct cross section as one would exspect with almostUnweighted. | |
double | theMaxEnhancement |
Enhancement factor to the maximum weight. | |
bool | didReadGrids |
True, if grids have already been read. | |
bool | theParallelIntegration |
True, if parallel subprocess integration should be enabled. | |
unsigned int | theIntegratePerJob |
The number of subprocesses to integrate per job. | |
unsigned int | theIntegrationJobs |
The maximum number of integration jobs to be created. | |
unsigned int | theIntegrationJobsCreated |
The number of integration jobs which were actually created. | |
bool | justAfterIntegrate |
Indicate that initialization is only reading a grid. | |
bool | theWriteGridsOnFinish |
True, if grids should be written at the end of a run. | |
virtual IBPtr | clone () const |
Make a simple clone of this object. | |
virtual IBPtr | fullclone () const |
Make a clone of this object, possibly modifying the cloned object to make it sane. | |
virtual void | doinit () |
Initialize this object after the setup phase before saving an EventGenerator to disk. | |
virtual void | doinitrun () |
Initialize this object. | |
virtual void | dofinish () |
Finalize this object. | |
virtual void | rebind (const TranslationMap &trans) |
Rebind pointer to other Interfaced objects. | |
virtual IVector | getReferences () |
Return a vector of all pointers to Interfaced objects used in this object. | |
GeneralSampler & | operator= (const GeneralSampler &)=delete |
The assignment operator is private and must never be called. | |
Virtual functions from SamplerBase. | |
virtual void | initialize () |
Initialize the the sampler, possibly doing presampling of the phase space. | |
virtual double | generate () |
Generarate a new phase space point and return a weight associated with it. | |
virtual void | rejectLast () |
Reject the last chosen phase space point. | |
virtual int | lastBin () const |
If the sampler is able to sample several different functions separately, this function should return the last chosen function. | |
virtual CrossSection | integratedXSec () const |
Return the total integrated cross section determined from the Monte Carlo sampling so far. | |
virtual CrossSection | integratedXSecErr () const |
Return the error on the total integrated cross section determined from the Monte Carlo sampling so far. | |
virtual CrossSection | maxXSec () const |
Return the overestimated integrated cross section. | |
virtual double | sumWeights () const |
Return the sum of the weights returned by generate() so far (of the events that were not rejeted). | |
virtual double | sumWeights2 () const |
Return the sum of the weights squaredreturned by generate() so far (of the events that were not rejeted). | |
virtual double | attempts () const |
Return the number of attempts. | |
double | accepts () const |
Return the number of accepts. | |
const map< double, Ptr< BinSampler >::ptr > & | samplers () const |
Return the samplers. | |
Ptr< BinSampler >::ptr | binSampler () const |
Return the bin sampler. | |
Ptr< BinSampler >::tptr | lastSampler () const |
Return the last selected bin sampler. | |
bool | weighted () const |
True if we should do weighted events. | |
virtual bool | almostUnweighted () const |
Return true if this sampler is generating almost unweighted events. | |
const XML::Element & | grids () const |
Return the XML element containing the grids. | |
XML::Element & | grids () |
Access the XML element containing the grids. | |
void | writeGrids () const |
Write out grids. | |
void | readGrids () |
Read in grids. | |
unsigned int | integrationJobsCreated () |
Return the number of integration jobs which were actually created. | |
virtual void | prepare () |
An external hook to prepare the sampler for generating events, e.g. | |
map< double, Ptr< BinSampler >::ptr > & | samplers () |
Access the samplers. | |
void | lastSampler (Ptr< BinSampler >::tptr s) |
Set the last selected bin sampler. | |
void | currentCrossSections () const |
Calculate cross sections from samplers at current state. | |
void | updateSamplers () |
Update the sampler selection. | |
Functions used by the persistent I/O system. | |
void | persistentOutput (PersistentOStream &os) const |
Function used to write out object persistently. | |
void | persistentInput (PersistentIStream &is, int version) |
Function used to read in object persistently. | |
static void | Init () |
The standard Init function used to initialize the interfaces. | |
Additional Inherited Members | |
![]() | |
enum | RunLevels |
![]() | |
enum | InitState |
![]() | |
typedef unsigned int | CounterType |
![]() | |
static int | runLevel () |
static void | setRunLevel (int level) |
static bool | hasSetupFile () |
static void | setupFileUsed (bool yes=true) |
static long | seed () |
static void | setSeed (long s) |
static unsigned int | integratePerJob () |
static void | setIntegratePerJob (unsigned int s) |
static unsigned int | integrationJobs () |
static void | setIntegrationJobs (unsigned int s) |
static void | Init () |
![]() | |
static void | Init () |
![]() | |
static void | Init () |
![]() | |
static void | Init () |
![]() | |
initializing | |
uninitialized | |
initialized | |
runready | |
![]() | |
const unsigned long | uniqueId |
![]() | |
vector< double > & | lastPoint () |
tStdEHPtr | eventHandler () const |
![]() | |
void | reporeg (IBPtr object, string name) const |
bool | setDefaultReference (PtrT &ptr, string classname, string objectname) |
Interfaced (const string &newName) | |
Interfaced (const Interfaced &i) | |
void | setGenerator (tEGPtr generator) |
![]() | |
virtual void | readSetup (istream &is) |
virtual void | doupdate () |
virtual void | doinit () |
virtual void | doinitrun () |
virtual void | dofinish () |
virtual IVector | getReferences () |
virtual void | rebind (const TranslationMap &) |
virtual IBPtr | clone () const=0 |
InterfacedBase (string newName) | |
InterfacedBase (const InterfacedBase &i) | |
virtual void | readSetup (istream &is) |
virtual void | doupdate () |
virtual void | doinit () |
virtual void | doinitrun () |
virtual void | dofinish () |
virtual IVector | getReferences () |
virtual void | rebind (const TranslationMap &) |
![]() | |
ReferenceCounted (const ReferenceCounted &) | |
ReferenceCounted & | operator= (const ReferenceCounted &) |
![]() | |
const Named & | operator= (const Named &other) |
const string & | name (const string &newName) |
![]() | |
static void | registerRepository (IBPtr) |
static void | registerRepository (IBPtr, string newName) |
A GeneralSampler class.
Definition at line 31 of file GeneralSampler.h.
|
inline |
Return the number of accepts.
Definition at line 127 of file GeneralSampler.h.
References theAccepts.
|
inlinevirtual |
Return true if this sampler is generating almost unweighted events.
Reimplemented from ThePEG::SamplerBase.
Definition at line 154 of file GeneralSampler.h.
References theAlmostUnweighted.
|
inlinevirtual |
Return the number of attempts.
Reimplemented from ThePEG::SamplerBase.
Definition at line 118 of file GeneralSampler.h.
References ThePEG::SamplerBase::attempts(), theAddUpSamplers, and theAttempts.
|
inline |
|
protectedvirtual |
Make a simple clone of this object.
Implements ThePEG::InterfacedBase.
|
protectedvirtual |
Finalize this object.
Called in the run phase just after a run has ended. Used eg. to write out statistics.
Reimplemented from ThePEG::InterfacedBase.
|
protectedvirtual |
Initialize this object after the setup phase before saving an EventGenerator to disk.
InitException | if object could not be initialized properly. |
Reimplemented from ThePEG::InterfacedBase.
|
protectedvirtual |
Initialize this object.
Called in the run phase just before a run begins.
Reimplemented from ThePEG::InterfacedBase.
|
protectedvirtual |
Make a clone of this object, possibly modifying the cloned object to make it sane.
Reimplemented from ThePEG::InterfacedBase.
|
virtual |
Generarate a new phase space point and return a weight associated with it.
This weight should preferably be 1.
Implements ThePEG::SamplerBase.
|
protectedvirtual |
Return a vector of all pointers to Interfaced objects used in this object.
Reimplemented from ThePEG::InterfacedBase.
|
inline |
Access the XML element containing the grids.
Definition at line 166 of file GeneralSampler.h.
References theGrids.
|
inline |
Return the XML element containing the grids.
Definition at line 161 of file GeneralSampler.h.
References theGrids.
|
static |
The standard Init function used to initialize the interfaces.
Called exactly once for each class by the class description system before the main function starts or when this class is dynamically loaded.
|
virtual |
Initialize the the sampler, possibly doing presampling of the phase space.
Implements ThePEG::SamplerBase.
|
inlinevirtual |
Return the total integrated cross section determined from the Monte Carlo sampling so far.
Implements ThePEG::SamplerBase.
Definition at line 80 of file GeneralSampler.h.
References currentCrossSections(), and theIntegratedXSec.
|
inlinevirtual |
Return the error on the total integrated cross section determined from the Monte Carlo sampling so far.
Implements ThePEG::SamplerBase.
Definition at line 89 of file GeneralSampler.h.
References currentCrossSections(), and theIntegratedXSecErr.
|
inline |
Return the number of integration jobs which were actually created.
Definition at line 181 of file GeneralSampler.h.
References theIntegrationJobsCreated.
|
inlinevirtual |
If the sampler is able to sample several different functions separately, this function should return the last chosen function.
This default version always returns 0.
Reimplemented from ThePEG::SamplerBase.
Definition at line 74 of file GeneralSampler.h.
References lastSampler().
|
inline |
Return the last selected bin sampler.
Definition at line 144 of file GeneralSampler.h.
References theLastSampler.
Referenced by lastBin().
|
inlineprotected |
Set the last selected bin sampler.
Definition at line 201 of file GeneralSampler.h.
References theLastSampler.
|
inlinevirtual |
Return the overestimated integrated cross section.
Reimplemented from ThePEG::SamplerBase.
Definition at line 97 of file GeneralSampler.h.
References ThePEG::SamplerBase::maxXSec(), theAddUpSamplers, and theMaxWeight.
|
privatedelete |
The assignment operator is private and must never be called.
In fact, it should not even be implemented.
void Herwig::GeneralSampler::persistentInput | ( | PersistentIStream & | is, |
int | version | ||
) |
Function used to read in object persistently.
is | the persistent input stream read from. |
version | the version number of the object when written. |
void Herwig::GeneralSampler::persistentOutput | ( | PersistentOStream & | os | ) | const |
Function used to write out object persistently.
os | the persistent output stream written to. |
|
virtual |
An external hook to prepare the sampler for generating events, e.g.
by combining grid files from parallel integration runs.
Reimplemented from ThePEG::SamplerBase.
|
protectedvirtual |
Rebind pointer to other Interfaced objects.
Called in the setup phase after all objects used in an EventGenerator has been cloned so that the pointers will refer to the cloned objects afterwards.
trans | a TranslationMap relating the original objects to their respective clones. |
RebindException | if no cloned object was found for a given pointer. |
Reimplemented from ThePEG::InterfacedBase.
|
virtual |
Reject the last chosen phase space point.
Implements ThePEG::SamplerBase.
|
inlineprotected |
|
inline |
|
inlinevirtual |
Return the sum of the weights returned by generate() so far (of the events that were not rejeted).
Implements ThePEG::SamplerBase.
Definition at line 107 of file GeneralSampler.h.
References theSumWeights.
|
inlinevirtual |
Return the sum of the weights squaredreturned by generate() so far (of the events that were not rejeted).
Implements ThePEG::SamplerBase.
Definition at line 113 of file GeneralSampler.h.
References theSumWeights2.
|
inline |
True if we should do weighted events.
Definition at line 149 of file GeneralSampler.h.
References ThePEG::SamplerBase::eventHandler().
|
private |
The correct cross section as one would exspect with almostUnweighted.
Definition at line 438 of file GeneralSampler.h.
|
mutableprivate |
The number of calls to currentCrossSections since the last update.
Definition at line 348 of file GeneralSampler.h.
|
private |
True, if grids have already been read.
Definition at line 450 of file GeneralSampler.h.
|
mutableprivate |
True, if currentCrossSections has been called since the last call to generate.
Definition at line 354 of file GeneralSampler.h.
|
private |
True, if we are generating events.
Definition at line 405 of file GeneralSampler.h.
|
private |
Indicate that initialization is only reading a grid.
Definition at line 475 of file GeneralSampler.h.
|
private |
The average relative deviation from the maximum weight.
Definition at line 431 of file GeneralSampler.h.
|
private |
Number of points which exceeded the maximum.
Definition at line 426 of file GeneralSampler.h.
|
private |
True, if information for combining unnormalized runs should be printed out.
Definition at line 416 of file GeneralSampler.h.
|
private |
|
private |
True, if cross sections are to be combined from each sampler individually.
Definition at line 385 of file GeneralSampler.h.
Referenced by attempts(), and maxXSec().
|
private |
True, if we should perform an almost unweighted sampling.
Definition at line 421 of file GeneralSampler.h.
Referenced by almostUnweighted().
|
private |
|
private |
The bin sampler to use.
Definition at line 315 of file GeneralSampler.h.
Referenced by binSampler().
|
private |
True, if subprocesses should be selected flat.
This is a debug flag, cross section information and distributions will not be correct.
Definition at line 400 of file GeneralSampler.h.
|
private |
True, if the global maximum weight should be used as reference.
If not, the maximum weights of individual samplers are used, and selection probabilities fro the samplers are adjusted accordingly.
Definition at line 393 of file GeneralSampler.h.
|
private |
The XML element containing the grids.
Definition at line 310 of file GeneralSampler.h.
Referenced by grids().
|
mutableprivate |
The integrated cross section.
Definition at line 330 of file GeneralSampler.h.
Referenced by integratedXSec().
|
mutableprivate |
The integrated cross section error.
Definition at line 335 of file GeneralSampler.h.
Referenced by integratedXSecErr().
|
private |
The number of subprocesses to integrate per job.
Definition at line 460 of file GeneralSampler.h.
|
private |
The maximum number of integration jobs to be created.
Definition at line 465 of file GeneralSampler.h.
|
private |
The number of integration jobs which were actually created.
Definition at line 470 of file GeneralSampler.h.
Referenced by integrationJobsCreated().
|
private |
The last selected bin sampler.
Definition at line 325 of file GeneralSampler.h.
Referenced by lastSampler().
|
private |
Enhancement factor to the maximum weight.
This is to get less maximumExceeds.
Definition at line 445 of file GeneralSampler.h.
|
private |
The maximum weight encountered.
Definition at line 379 of file GeneralSampler.h.
Referenced by maxXSec().
|
private |
A minimum selection probability for each sampler.
Definition at line 410 of file GeneralSampler.h.
|
private |
True, if parallel subprocess integration should be enabled.
Definition at line 455 of file GeneralSampler.h.
|
private |
The selector map for the bin samplers.
Definition at line 320 of file GeneralSampler.h.
Referenced by samplers().
|
private |
|
private |
The sum of weights squared.
Definition at line 364 of file GeneralSampler.h.
Referenced by sumWeights2().
|
private |
The number of events after which cross sections should truly be updated.
This is used to prevent exhaustive combination of statistics when HepMC events are written out.
Definition at line 342 of file GeneralSampler.h.
|
private |
Whether or not additional information should be printed to cout.
Definition at line 305 of file GeneralSampler.h.
|
private |
True, if grids should be written at the end of a run.
Definition at line 480 of file GeneralSampler.h.