Herwig
7.2.1
|
A GeneralSampler class. More...
#include <GeneralSampler.h>
Public Member Functions | |
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. More... | |
Standard constructors and destructors. | |
GeneralSampler () | |
The default constructor. | |
virtual | ~GeneralSampler () |
The destructor. | |
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. More... | |
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. More... | |
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. | |
Functions used by the persistent I/O system. | |
void | persistentOutput (PersistentOStream &os) const |
Function used to write out object persistently. More... | |
void | persistentInput (PersistentIStream &is, int version) |
Function used to read in object persistently. More... | |
Public Member Functions inherited from ThePEG::SamplerBase | |
void | setEventHandler (tStdEHPtr eh) |
const vector< double > & | lastPoint () const |
void | persistentOutput (PersistentOStream &os) const |
void | persistentInput (PersistentIStream &is, int version) |
const vector< double > & | lastPoint () const |
void | integrationList (const string &newIntegrationList) |
const string & | integrationList () const |
void | persistentOutput (PersistentOStream &os) const |
void | persistentInput (PersistentIStream &is, int version) |
Public Member Functions inherited from ThePEG::Interfaced | |
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 |
void | persistentOutput (PersistentOStream &os) const |
void | persistentInput (PersistentIStream &is, int version) |
Public Member Functions inherited from ThePEG::InterfacedBase | |
string | fullName () const |
string | name () const |
string | path () const |
string | comment () const |
void | setup (istream &is) |
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 |
void | persistentOutput (PersistentOStream &os) const |
void | persistentInput (PersistentIStream &is, int version) |
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 |
void | persistentOutput (PersistentOStream &os) const |
void | persistentInput (PersistentIStream &is, int version) |
Public Member Functions inherited from ThePEG::Base | |
void | debug () const |
Public Member Functions inherited from ThePEG::Pointer::ReferenceCounted | |
CounterType | referenceCount () const |
Public Member Functions inherited from ThePEG::Named | |
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 |
Static Public Member Functions | |
static void | Init () |
The standard Init function used to initialize the interfaces. More... | |
Static Public Member Functions inherited from ThePEG::SamplerBase | |
static void | Init () |
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 Public Member Functions inherited from ThePEG::Interfaced | |
static void | Init () |
Static Public Member Functions inherited from ThePEG::InterfacedBase | |
static void | Init () |
Static Public Member Functions inherited from ThePEG::Base | |
static void | Init () |
Protected Member Functions | |
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. | |
virtual void | doinit () |
Initialize this object after the setup phase before saving an EventGenerator to disk. More... | |
virtual void | doinitrun () |
Initialize this object. More... | |
virtual void | dofinish () |
Finalize this object. More... | |
virtual void | rebind (const TranslationMap &trans) |
Rebind pointer to other Interfaced objects. More... | |
virtual IVector | getReferences () |
Return a vector of all pointers to Interfaced objects used in this object. More... | |
Clone Methods. | |
virtual IBPtr | clone () const |
Make a simple clone of this object. More... | |
virtual IBPtr | fullclone () const |
Make a clone of this object, possibly modifying the cloned object to make it sane. More... | |
Protected Member Functions inherited from ThePEG::SamplerBase | |
vector< double > & | lastPoint () |
tStdEHPtr | eventHandler () const |
Protected Member Functions inherited from ThePEG::Interfaced | |
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) |
Protected Member Functions inherited from ThePEG::InterfacedBase | |
InterfacedBase (string newName) | |
InterfacedBase (const InterfacedBase &i) | |
virtual void | readSetup (istream &is) |
virtual void | doupdate () |
virtual void | readSetup (istream &is) |
virtual void | doupdate () |
Protected Member Functions inherited from ThePEG::Pointer::ReferenceCounted | |
ReferenceCounted (const ReferenceCounted &) | |
ReferenceCounted & | operator= (const ReferenceCounted &) |
ReferenceCounted (const ReferenceCounted &) | |
ReferenceCounted & | operator= (const ReferenceCounted &) |
Protected Member Functions inherited from ThePEG::Named | |
const Named & | operator= (const Named &other) |
const string & | name (const string &newName) |
Private Member Functions | |
GeneralSampler & | operator= (const GeneralSampler &)=delete |
The assignment operator is private and must never be called. More... | |
Private Attributes | |
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. More... | |
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. More... | |
bool | theFlatSubprocesses |
True, if subprocesses should be selected flat. More... | |
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. More... | |
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. | |
Additional Inherited Members | |
Public Types inherited from ThePEG::SamplerBase | |
enum | RunLevels |
Public Types inherited from ThePEG::InterfacedBase | |
enum | InitState |
Public Types inherited from ThePEG::Pointer::ReferenceCounted | |
typedef unsigned int | CounterType |
Public Attributes inherited from ThePEG::InterfacedBase | |
initializing | |
uninitialized | |
initialized | |
runready | |
Public Attributes inherited from ThePEG::Pointer::ReferenceCounted | |
const unsigned long | uniqueId |
Static Protected Member Functions inherited from ThePEG::Interfaced | |
static void | registerRepository (IBPtr) |
static void | registerRepository (IBPtr, string newName) |
A GeneralSampler class.
Definition at line 31 of file GeneralSampler.h.
|
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.
|
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.
|
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.
|
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.
|
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 |
Enhancement factor to the maximum weight.
This is to get less maximumExceeds.
Definition at line 445 of file GeneralSampler.h.
|
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.