Herwig 7.3.0
|
CellGridSampler samples XCombs bins using CellGrids. More...
#include <CellGridSampler.h>
Public Member Functions | |
Standard constructors and destructors. | |
CellGridSampler () | |
The default constructor. | |
virtual | ~CellGridSampler () |
The destructor. | |
Ptr< CellGridSampler >::ptr | cloneMe () const |
Clone this object. | |
virtual double | generate () |
Generate the next point; store the point in lastPoint() and its weight using select(); if noMaxInfo is true, do not throw NewMaximum or UpdateCrossSections exceptions. | |
virtual void | initialize (bool progress) |
Initialize this bin sampler. | |
virtual void | finalize (bool) |
Finalize this sampler. | |
virtual void | adapt () |
Adapt. | |
virtual bool | existsGrid () const |
Return true, if grid data exists for this sampler. | |
virtual void | saveGrid () const |
Save grid data. | |
const vector< int > & | pre_adaption_splits () const |
The splittings for each dimension befor adaption. | |
![]() | |
BinSampler () | |
The default constructor. | |
Ptr< BinSampler >::ptr | cloneMe () const |
Clone this object. | |
double | evaluate (vector< double > p, bool remap=true) |
Evaluate the cross section. | |
double | bias () const |
Return the bias with which this sampler is selected. | |
void | bias (double b) |
Set the bias with which this sampler is selected. | |
void | eventHandler (tStdEHPtr eh) |
Set the event handler. | |
tStdEHPtr | eventHandler () const |
Return the event handler. | |
void | sampler (Ptr< GeneralSampler >::tptr) |
Set the containing sampler. | |
Ptr< GeneralSampler >::tptr | sampler () const |
Get the containing sampler. | |
int | bin () const |
Return the bin. | |
void | bin (int b) |
Set the bin. | |
string | process () const |
Return a string describing the process handled by this sampler. | |
string | shortprocess () const |
Return a short string describing the process handled by this sampler. | |
string | id () const |
Return a string identifying the process handled by this sampler. | |
const vector< double > & | lastPoint () const |
Return the last generated point. | |
vector< double > & | lastPoint () |
Access the last generated point. | |
double | referenceWeight () const |
Return the reference weight to be used. | |
void | referenceWeight (double w) |
Set the reference weight to be used. | |
virtual bool | canUnweight () const |
Return true, if this sampler can provide unweighted events; if the proposal density is not an overestimate, weights larger than one can be generated, the handling of these points being subject to the GeneralSampler class. | |
virtual bool | adaptsOnTheFly () const |
Return true, if this sampler adapts on the fly while generating events. | |
virtual bool | compensating () const |
If this sampler features a compensation algorithm, return true if more events need to be generated to finish the compensation. | |
bool | weighted () const |
Return true, if weighted events should be generated. | |
void | doWeighted (bool yes=true) |
Indicate that weighted events should be generated. | |
virtual double | generate () |
Generate the next point and return its weight; store the point in lastPoint(). | |
void | fillRemappers (bool progress) |
Fill and finalize the remappers present. | |
void | saveRemappers () const |
Write remappers to grid file. | |
void | saveIntegrationData () const |
Write integration data to grid files. | |
virtual void | saveGrid () const |
Save grid data. | |
void | readIntegrationData () |
Read integration data from grid files. | |
void | setupRemappers (bool progress) |
Read remappers from grid file. | |
void | runIteration (unsigned long n, bool progress) |
Run a single iteration of n points, optionally printing a progress bar to cout. | |
virtual void | adapt () |
Adapt this sampler after an iteration has been run. | |
virtual void | initialize (bool progress) |
Initialize this bin sampler. | |
bool | initialized () const |
Return true, if this sampler has already been initialized. | |
void | isInitialized () |
Indicate that this sampler has already been initialized. | |
bool | integrated () const |
Return true, if integration has already been performed. | |
bool | remappersFilled () const |
Return true, if remappers have been set up. | |
virtual bool | existsGrid () const |
Return true, if grid data exists for this sampler. | |
bool | hasGrids () const |
Return true, if this sampler has already read grid data. | |
void | didReadGrids () |
Indicate that this sampler has already read grid data. | |
virtual void | finalize (bool) |
Finalize this sampler. | |
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. | |
int | dimension () const |
Return the dimension. | |
unsigned long | initialPoints () const |
Return the number of points to be used for initial integration. | |
void | initialPoints (unsigned long n) |
Set the number of points to be used for initial integration. | |
size_t | nIterations () const |
Return the number of iterations to be considered for initialization. | |
void | nIterations (size_t n) |
Set the number of iterations to be considered for initialization. | |
void | enhancementFactor (double f) |
Set the factor to enhance the number of points for the next iteration. | |
double | enhancementFactor () const |
Return the factor to enhance the number of points for the next iteration. | |
string | randomNumberString () const |
Return the folder for the random number plots. | |
double | kappa () const |
In the AlmostUnweighted mode we do not need to unweight the events to the reference weight. | |
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. | |
![]() | |
MultiIterationStatistics () | |
The default constructor. | |
virtual | ~MultiIterationStatistics () |
The destructor. | |
void | nextIteration () |
Indicate the start of a new iteration. | |
const vector< GeneralStatistics > & | iterations () const |
Return the iterations done so far. | |
vector< GeneralStatistics > & | iterations () |
Access the iterations done so far. | |
virtual double | chi2 () const |
Return the last calculated chi^2. | |
virtual double | averageWeight (bool useAll=false) const |
Return the average weight. | |
virtual double | averageAbsWeight (bool useAll=false) const |
Return the average absolute weight. | |
virtual double | averageWeightVariance (bool useAll=false) const |
Return the variance of the average weight. | |
virtual double | averageAbsWeightVariance (bool useAll=false) const |
Return the variance of the average absolute weight. | |
unsigned int | minIterationPoints () const |
Return the minimum number of events per iteration to take this iteration into account when calculating the total cross section. | |
void | minIterationPoints (unsigned int n) |
Set the minimum number of events per iteration to take this iteration into account when calculating the total cross section. | |
bool | useAllIterations () const |
Return true if integrals should be combined from all iterations. | |
void | doUseAllIterations (bool yes=true) |
Indicate that integrals should be combined from all iterations. | |
void | put (PersistentOStream &os) const |
Function used to write out object persistently. | |
void | get (PersistentIStream &is) |
Function used to read in object persistently. | |
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. | |
void | fromXML (const XML::Element &) |
Fill statistics data from an XML element. | |
XML::Element | toXML () const |
Return an XML element for the data of this statistics. | |
![]() | |
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 |
![]() | |
GeneralStatistics () | |
The default constructor. | |
virtual | ~GeneralStatistics () |
The destructor. | |
void | reset () |
Reset these statistics. | |
double | lastWeight () const |
Return the last weight encountered. | |
double | maxWeight () const |
Return the maximum absolute weight. | |
double | minWeight () const |
Return the minimum absolute weight. | |
void | maxWeight (double w) |
Set the maximum absolute weight. | |
void | minWeight (double w) |
Set the minimum absolute weight. | |
double | sumWeights () const |
Return the sum of weights. | |
double | sumSquaredWeights () const |
Return the sum of squared weights. | |
double | sumAbsWeights () const |
Return the sum of absolute weights. | |
unsigned long | selectedPoints () const |
Return the number of selected points. | |
unsigned long | acceptedPoints () const |
Return the nnumber of accepted points. | |
unsigned long | nanPoints () const |
Return the number of points where a nan or inf weight has been encountered. | |
unsigned long | allPoints () const |
Return the number of all points. | |
virtual double | averageWeight () const |
Return the average weight. | |
virtual double | averageAbsWeight () const |
Return the average absolute weight. | |
double | weightVariance () const |
Return the variance of weights. | |
double | absWeightVariance () const |
Return the variance of absolute weights. | |
virtual double | averageWeightVariance () const |
Return the variance of the average weight. | |
virtual double | averageAbsWeightVariance () const |
Return the variance of the average absolute weight. | |
virtual void | select (double weight, bool doIntegral=true) |
Select an event. | |
virtual void | accept () |
Accept an event. | |
virtual void | reject () |
Reject an event. | |
void | put (PersistentOStream &os) const |
Function used to write out object persistently. | |
void | get (PersistentIStream &is) |
Function used to read in object persistently. | |
void | fromXML (const XML::Element &) |
Fill statistics data from an XML element. | |
XML::Element | toXML () const |
Return an XML element for the data of this statistics. | |
Clone Methods. | |
size_t | theExplorationPoints |
The number of points used to explore a cell. | |
size_t | theExplorationSteps |
The number of exploration steps. | |
double | theGain |
The adaption threshold. | |
double | theEpsilon |
The adaption threshold. | |
double | theMinimumSelection |
The minimum probability for cell selection. | |
vector< int > | the_pre_adaption_splits |
The splittings for each dimension befor adaption. | |
int | theLuminositySplits |
The number of splits to put into parton luminiosity degrees of freedom. | |
int | theChannelSplits |
The number of splits to put into channel degrees of freedom. | |
bool | theAllChannelSplits |
Perform splits for all channels. | |
bool | theUnweightCells |
Perform unweighting in cells. | |
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. | |
CellGridSampler & | operator= (const CellGridSampler &)=delete |
The assignment operator is private and must never be called. | |
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 | |
![]() | |
typedef pair< string, size_t > | RandomNumberIndex |
![]() | |
enum | InitState |
![]() | |
typedef unsigned int | CounterType |
![]() | |
static void | Init () |
The standard Init function used to initialize the interfaces. | |
![]() | |
static void | Init () |
The standard Init function used to initialize the interfaces. | |
![]() | |
static void | Init () |
![]() | |
static void | Init () |
![]() | |
static void | Init () |
![]() | |
map< RandomNumberIndex, pair< RandomNumberHistogram, double > > | RandomNumberHistograms |
![]() | |
initializing | |
uninitialized | |
initialized | |
runready | |
![]() | |
const unsigned long | uniqueId |
![]() | |
![]() | |
![]() | |
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) |
![]() | |
SimpleCellGrid () | |
Default constructor. | |
SimpleCellGrid (const std::vector< double > &newLowerLeft, const std::vector< double > &newUpperRight, bool keepWeightInformation=true, double newWeight=0.0) | |
Construct given boundaries and a weight. | |
virtual CellGrid * | makeInstance () const |
Produce a new instance of a cell grid. | |
virtual CellGrid * | makeInstance (const std::vector< double > &newLowerLeft, const std::vector< double > &newUpperRight, double newWeight=0.0) const |
Produce a new instance of a cell grid. | |
virtual void | split (std::size_t newSplitDimension, double newSplitCoordinate) |
Split this cell grid in the given dimension and coordinate, if it is a leaf. | |
virtual void | splitter (size_t dim, int rat) |
const SimpleCellGrid & | firstChild () const |
Return the first child. | |
SimpleCellGrid & | firstChild () |
Access the first child. | |
const SimpleCellGrid & | secondChild () const |
Return the second child. | |
SimpleCellGrid & | secondChild () |
Access the second child. | |
const std::vector< std::pair< Counter, Counter > > & | weightInformation () const |
Return weight information for adaption steps. | |
std::vector< std::pair< Counter, Counter > > & | weightInformation () |
Access weight information for adaption steps. | |
virtual void | updateWeightInformation (const std::vector< double > &p, double w) |
Update the weight information for the given point. | |
void | adjustReferenceWeight (double w) |
Adjust the reference weight. | |
double | getReferenceWeight () const |
Return the reference weight. | |
virtual void | adapt (double gain, double epsilon, std::set< SimpleCellGrid * > &newCells) |
Perform a default adaption step, splitting along the dimension which shows up the largest difference in average weights; if this exceeds gain, perform the split. | |
virtual void | setWeights () |
Update the weights of the cells from information accumulated so far. | |
template<class RndGenerator > | |
void | sampleFlatPoint (std::vector< double > &p, RndGenerator &rnd) const |
Sample a point flat in this cell. | |
template<class RndGenerator > | |
void | sampleFlatPoint (std::vector< double > &p, const std::vector< bool > ¶meterFlags, RndGenerator &rnd) const |
Sample a point flat in this cell, keeping parameters fixed. | |
template<class RndGenerator , class Function > | |
void | explore (std::size_t nPoints, RndGenerator &rnd, Function &f, std::set< SimpleCellGrid * > &newCells, std::ostream &warn) |
Explore the cell grid, given a number of points to be sampled in each cell; the weights of the cell will contain the maximum weight encountered. | |
template<class RndGenerator > | |
SimpleCellGrid * | selectCell (RndGenerator &rnd) |
Select a cell. | |
template<class RndGenerator , class Function > | |
double | sample (RndGenerator &rnd, Function &f, std::vector< double > &p, bool unweight, bool adjustReference) |
Sample a point and return its weight. | |
template<class RndGenerator , class Function > | |
std::pair< double, double > | generate (RndGenerator &rnd, Function &f, std::vector< double > &p) |
Sample a point and return its weight. | |
template<class RndGenerator , class Function > | |
std::pair< double, double > | generate (RndGenerator &rnd, Function &f, std::vector< double > &p, const std::vector< bool > ¶meterFlags) |
Sample a point and return its weight. | |
virtual void | fromXML (const XML::Element &) |
Fill CellGrid data from an XML element. | |
virtual XML::Element | toXML () const |
Return an XML element for the data of this CellGrid. | |
![]() | |
CellGrid () | |
Default constructor. | |
CellGrid (const std::vector< double > &newLowerLeft, const std::vector< double > &newUpperRight, double newWeight=0.0) | |
Construct given boundaries and a weight. | |
virtual CellGrid * | makeInstance () const |
Produce a new instance of a cell grid. | |
virtual CellGrid * | makeInstance (const std::vector< double > &newLowerLeft, const std::vector< double > &newUpperRight, double newWeight=0.0) const |
Produce a new instance of a cell grid. | |
virtual | ~CellGrid () |
The destructor. | |
void | boundaries (const std::vector< double > &newLowerLeft, const std::vector< double > &newUpperRight) |
Set the boundaries. | |
const std::vector< double > & | lowerLeft () const |
Return the lower left corner of the cell grid. | |
const std::vector< double > & | upperRight () const |
Return the upper right corner of the cell grid. | |
const std::vector< bool > & | upperBoundInclusive () const |
Flag in which dimension this cell is upper bound inclusive. | |
double | volume (const std::vector< double > &lowerLeft, const std::vector< double > &upperRight) const |
Calculate a volume given upper and lower bound. | |
bool | isLeaf () const |
Return true, if this is a leaf in the tree. | |
std::size_t | depth () const |
Return the depth of this grid. | |
std::size_t | size () const |
Return the number of nodes contained in this grid. | |
virtual void | split (std::size_t newSplitDimension, double newSplitCoordinate) |
Split this cell grid in the given dimension and coordinate, if it is a leaf. | |
std::pair< std::size_t, double > | splitPoint () const |
Return the dimension and coordinate along which the first split of this grid occurs. | |
const CellGrid & | firstChild () const |
Return the first child. | |
CellGrid & | firstChild () |
Access the first child. | |
const CellGrid & | secondChild () const |
Return the second child. | |
CellGrid & | secondChild () |
Access the second child. | |
void | splitCoordinates (std::size_t, std::set< double > &) const |
Fill split coordinates along a given dimension. | |
bool | active () const |
Return true, if this grid is active with respect to the last parameter point passed. | |
double | volume () const |
Return the volume relevant for the last parameter point set. | |
double | integral () const |
Return the integral relevant for the last parameter point set. | |
double | weight () const |
Return the weight. | |
void | weight (double w) |
Set the weight. | |
void | updateIntegral () |
Update the integrals. | |
void | minimumSelection (double p=0.1) |
Ensure a minimum cell selection probability. | |
bool | contains (const std::vector< double > &point, const std::vector< bool > ¶meterFlags) const |
Return true, if this grid contains the given parameter point. | |
double | nonParametricVolume (const std::vector< double > &point, const std::vector< bool > ¶meterFlags) const |
Get the volume relevant for the dimensions not considered parameters. | |
void | updateIntegral (const std::vector< double > &point, const std::vector< bool > ¶meterFlags, std::vector< bool >::iterator hashPosition) |
Set a parameter point and flag which dimensions are considered parameters. | |
double | projectInterval (const std::pair< double, double > &interval, std::size_t dimension) const |
Return the projection to the given interval and dimension, provided the interval is not overlapping with more than one cell in the given dimension. | |
std::map< std::pair< double, double >, double > | project (std::pair< double, double > interval, std::size_t dimension) const |
Return the projection to the given interval and dimension. | |
virtual void | fromXML (const XML::Element &) |
Fill CellGrid data from an XML element. | |
virtual XML::Element | toXML () const |
Return an XML element for the data of this CellGrid. | |
template<class RndGenerator > | |
void | randomGrid (RndGenerator &rnd, std::size_t maxDepth, bool forceSplit=true) |
Generate a random grid of given maximum depth. | |
void | dumpToC (std::ostream &os, const std::string &name) const |
Write out C code corresponding to the cell grid function. | |
void | dumpPartToC (std::ostream &os, std::string prefix="") const |
Write out C code corresponding to the cell grid function. | |
CellGridSampler samples XCombs bins using CellGrids.
Definition at line 33 of file CellGridSampler.h.
|
virtual |
Adapt.
Reimplemented from Herwig::BinSampler.
|
protectedvirtual |
Make a simple clone of this object.
Reimplemented from Herwig::BinSampler.
Referenced by cloneMe().
|
inline |
|
virtual |
Return true, if grid data exists for this sampler.
Reimplemented from Herwig::BinSampler.
|
virtual |
Finalize this sampler.
Reimplemented from Herwig::BinSampler.
|
protectedvirtual |
Make a clone of this object, possibly modifying the cloned object to make it sane.
Reimplemented from Herwig::BinSampler.
|
virtual |
Generate the next point; store the point in lastPoint() and its weight using select(); if noMaxInfo is true, do not throw NewMaximum or UpdateCrossSections exceptions.
Reimplemented from Herwig::BinSampler.
|
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 this bin sampler.
This default version calls runIteration.
Reimplemented from Herwig::BinSampler.
|
privatedelete |
The assignment operator is private and must never be called.
In fact, it should not even be implemented.
void Herwig::CellGridSampler::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::CellGridSampler::persistentOutput | ( | PersistentOStream & | os | ) | const |
Function used to write out object persistently.
os | the persistent output stream written to. |
|
inline |
The splittings for each dimension befor adaption.
Definition at line 98 of file CellGridSampler.h.
References the_pre_adaption_splits.
|
virtual |
Save grid data.
Reimplemented from Herwig::BinSampler.
|
private |
The splittings for each dimension befor adaption.
Definition at line 183 of file CellGridSampler.h.
Referenced by pre_adaption_splits().
|
private |
Perform splits for all channels.
Definition at line 199 of file CellGridSampler.h.
|
private |
The number of splits to put into channel degrees of freedom.
Definition at line 194 of file CellGridSampler.h.
|
private |
The adaption threshold.
Definition at line 173 of file CellGridSampler.h.
|
private |
The number of points used to explore a cell.
Definition at line 158 of file CellGridSampler.h.
|
private |
The number of exploration steps.
Definition at line 163 of file CellGridSampler.h.
|
private |
The adaption threshold.
Definition at line 168 of file CellGridSampler.h.
|
private |
The number of splits to put into parton luminiosity degrees of freedom.
Definition at line 189 of file CellGridSampler.h.
|
private |
The minimum probability for cell selection.
Definition at line 178 of file CellGridSampler.h.
|
private |
Perform unweighting in cells.
Definition at line 204 of file CellGridSampler.h.