![]() |
MaCh3
2.8.0
Reference Guide
|
Helper class for configuring and evaluating multicanonical umbrella weights. More...
#include <Fitters/Algorithms/MulticanonicalMCMCHandler.h>
Public Member Functions | |
| MulticanonicalMCMCHandler () | |
| Constructor. More... | |
| virtual | ~MulticanonicalMCMCHandler () |
| Destructor. More... | |
| void | FindOscCovParams (const std::vector< ParameterHandlerBase * > &systematics) |
| Locate the systematic object which contains the parameters used by the handler. Stores the parameter indices. More... | |
| void | AdjustUmbrellaStepScale (const std::vector< ParameterHandlerBase * > &systematics) |
| Adjust the parameter-of-interest's step scale according to the width of the umbrella bias function. More... | |
| void | InitializeMulticanonicalHandlerConfig (Manager *fitMan, std::vector< ParameterHandlerBase * > &systematics) |
| Read multicanonical configuration from the yaml via manager and initialise handler state. More... | |
| void | InitializeMulticanonicalParams (std::vector< ParameterHandlerBase * > &systematics) |
| Initialise the starting values used by the multicanonical parameter handling. More... | |
| double | GetMulticanonicalWeight () const |
| Compute the multicanonical penalty for the configured bias mode. More... | |
| double | GetMulticanonicalWeightSpline (double deltacp, double delm23) const |
| Compute the multicanonical penalty using a spline. More... | |
| double | GetMulticanonicalWeightGaussian (double deltacp) const |
| Compute a Gaussian multicanonical penalty. More... | |
| double | GetMulticanonicalWeightTripleGaussian (double deltacp) const |
| Compute a triple-Gaussian multicanonical penalty. More... | |
| double | GetMulticanonicalWeightVonMises (double deltacp) const |
| Compute a von Mises multicanonical penalty. More... | |
| double | GetMulticanonicalWeightGenGaussian (double deltacp) const |
| Compute a generalised-Gaussian multicanonical penalty. More... | |
| double | circularDistance (double x, double mean) const |
| Compute the circular distance between two angles. More... | |
| double | generalisedGaussian2 (double x, double mean, double width) const |
| Wraps the generalised gaussian function for a given x, mean, and width. Required to handle the wrapping of the parameter space at 2pi. More... | |
Public Attributes | |
| int | oscCovVar |
| Index of the oscillation-covariance systematic in the current fit. More... | |
| std::string | multicanonicalVarName |
| Parameter name used for the multicanonical weight, most often delta_cp. More... | |
| int | multicanonicalVar |
| Parameter index used for the multicanonical weight, most often delta_cp. More... | |
| int | multicanonicalVar_dm23 |
| Parameter index used for the multicanonical delm2_23 weight. More... | |
| const M3::float_t * | multicanonicalVarValue |
| Pointer to value of parameter vale used for multicanonical weight, most often delta_cp. More... | |
| const M3::float_t * | multicanonicalVar_dm23_value |
| Pointer to value of delm2_23 weight used for multicanonical weight. More... | |
| M3::BiasFunction | umbrellaBiasFunction |
| Selected bias function for multicanonical weights. More... | |
| std::string | umbrellaBiasFunctionName |
| Configured bias function name for logging. More... | |
| bool | multicanonicalSpline |
| Toggle for spline-based multicanonical weights. More... | |
Protected Attributes | |
| double | multicanonicalBeta |
| Global scale factor applied to the multicanonical penalty. 1 is full strength, 0 is no penalty. More... | |
| TSpline3 * | dcp_spline_IO |
| Spline for the IO branch, if spline mode is enabled. More... | |
| TSpline3 * | dcp_spline_NO |
| Spline for the NO branch, if spline mode is enabled. More... | |
| double | umbrellaMean |
| Umbrella centre used for the current configuration. More... | |
| double | umbrellaWidth |
| Umbrella width used for the current configuration. More... | |
| int | umbrellaNumber |
| Number of total umbrellas used for the current configuration. More... | |
| bool | umbrellaOverlapMode |
| Toggle for deriving umbrella widths from a desired # of sigma overlaps between umbrellas. More... | |
| double | umbrellaSigmaOverlap |
| Requested overlap for evenly spaced umbrellas. More... | |
| bool | umbrellaAdjustStepScale |
| Toggle for rescaling the step size based on the umbrella width. More... | |
| double | umbrellaStepScaleFactor |
| Additional scale factor applied when rescaling the step size. This is for fine tuning. More... | |
| bool | flipWindow |
| Optional flip-window control. More... | |
| double | vonMises_kappa |
| Von Mises kappa parameter. Analogue of sigma for a gaussian. More... | |
| double | vonMises_I0_kappa |
| Cached I0(kappa) value for the von Mises form. More... | |
Helper class for configuring and evaluating multicanonical umbrella weights.
this method is used to bias the MCMC sampling of chains to particular regions of the parameter space The method relies on a bias function defined via a yaml configuration file in experimental specific code With a bias function defined chains run as normal and are combined after the fact using the information stored in the chains saved yaml configuration file.
The method is visualised below:
/// ///
Definition at line 72 of file MulticanonicalMCMCHandler.h.
| MulticanonicalMCMCHandler::MulticanonicalMCMCHandler | ( | ) |
Constructor.
Definition at line 11 of file MulticanonicalMCMCHandler.cpp.
|
virtual |
| void MulticanonicalMCMCHandler::AdjustUmbrellaStepScale | ( | const std::vector< ParameterHandlerBase * > & | systematics | ) |
Adjust the parameter-of-interest's step scale according to the width of the umbrella bias function.
This is used to adjust the step scale of the parameter to keep the size of the step scale relative to the new biased space the chain sees the same. Current assumes that your are sampling delta cp (ie circular on 2pi)
Definition at line 180 of file MulticanonicalMCMCHandler.cpp.
| double MulticanonicalMCMCHandler::circularDistance | ( | double | x, |
| double | mean | ||
| ) | const |
Compute the circular distance between two angles.
This is used to calculate the distance between two angles in a circular space, such as delta_cp. It returns the shortest distance between the two angles, taking into account the wrapping at 2pi.
Definition at line 265 of file MulticanonicalMCMCHandler.cpp.
| void MulticanonicalMCMCHandler::FindOscCovParams | ( | const std::vector< ParameterHandlerBase * > & | systematics | ) |
Locate the systematic object which contains the parameters used by the handler. Stores the parameter indices.
Definition at line 33 of file MulticanonicalMCMCHandler.cpp.
| double MulticanonicalMCMCHandler::generalisedGaussian2 | ( | double | x, |
| double | mean, | ||
| double | width | ||
| ) | const |
Wraps the generalised gaussian function for a given x, mean, and width. Required to handle the wrapping of the parameter space at 2pi.
Definition at line 257 of file MulticanonicalMCMCHandler.cpp.
| double MulticanonicalMCMCHandler::GetMulticanonicalWeight | ( | ) | const |
Compute the multicanonical penalty for the configured bias mode.
This wraps the various bias function implementations and returns the appropriate penalty
Definition at line 221 of file MulticanonicalMCMCHandler.cpp.
| double MulticanonicalMCMCHandler::GetMulticanonicalWeightGaussian | ( | double | deltacp | ) | const |
Compute a Gaussian multicanonical penalty.
Definition at line 250 of file MulticanonicalMCMCHandler.cpp.
| double MulticanonicalMCMCHandler::GetMulticanonicalWeightGenGaussian | ( | double | deltacp | ) | const |
Compute a generalised-Gaussian multicanonical penalty.
the generalised gaussian is like a gaussian with an extra factor of n on the exponent of the gaussian. This allows for a stronger constraint in the tails of the distribution, more like a tophat function. The normalisation is a little ugly and uses gamma functions, so for now it is hardcoded to n=2. This is the current recommended configuration for umbrella sampling.
implement the wrapping with circular distance function to avoid the need to calculate the weight multiple times for each parameter to ensure it receives a bias even when it jumps the boundary
implement the normalisation for n != 2, and allow n to be set in the yaml configuration file
Definition at line 269 of file MulticanonicalMCMCHandler.cpp.
| double MulticanonicalMCMCHandler::GetMulticanonicalWeightSpline | ( | double | deltacp, |
| double | delm23 | ||
| ) | const |
Compute the multicanonical penalty using a spline.
Definition at line 240 of file MulticanonicalMCMCHandler.cpp.
| double MulticanonicalMCMCHandler::GetMulticanonicalWeightTripleGaussian | ( | double | deltacp | ) | const |
Compute a triple-Gaussian multicanonical penalty.
This was mostly for testing the first implementation, probably not used anymore.
delta_cp_log_likelihood = -TMath::Log(TMath::Gaus(deltacp,TMath::Pi(),1,kTRUE)+TMath::Gaus(deltacp,0,1,kTRUE)+TMath::Gaus(deltacp,-TMath::Pi(),1,kTRUE));
Definition at line 281 of file MulticanonicalMCMCHandler.cpp.
| double MulticanonicalMCMCHandler::GetMulticanonicalWeightVonMises | ( | double | deltacp | ) | const |
Compute a von Mises multicanonical penalty.
This is the circular analogue of a gaussian, meaning it handles the wrapping of the parameter space at 2pi automatically this avoids the need to calculate the weight multiple times for each parameter to ensure it receives a bias even when it jumps the boundary the normalisation grows extremely quickly, widths of less that 0.05 should not be used until properly tested.
Definition at line 212 of file MulticanonicalMCMCHandler.cpp.
| void MulticanonicalMCMCHandler::InitializeMulticanonicalHandlerConfig | ( | Manager * | fitMan, |
| std::vector< ParameterHandlerBase * > & | systematics | ||
| ) |
Read multicanonical configuration from the yaml via manager and initialise handler state.
Definition at line 71 of file MulticanonicalMCMCHandler.cpp.
| void MulticanonicalMCMCHandler::InitializeMulticanonicalParams | ( | std::vector< ParameterHandlerBase * > & | systematics | ) |
Initialise the starting values used by the multicanonical parameter handling.
This moves the starting point of the chain to the centre of the umbrella bias function. Only affects the parameter of interest.
Definition at line 193 of file MulticanonicalMCMCHandler.cpp.
|
protected |
Spline for the IO branch, if spline mode is enabled.
Definition at line 164 of file MulticanonicalMCMCHandler.h.
|
protected |
Spline for the NO branch, if spline mode is enabled.
Definition at line 166 of file MulticanonicalMCMCHandler.h.
|
protected |
Optional flip-window control.
briefly tested feature to mirror windows about their centres. Not tested but may be useful in the future. Currently disabled and not used.
Definition at line 185 of file MulticanonicalMCMCHandler.h.
|
protected |
Global scale factor applied to the multicanonical penalty. 1 is full strength, 0 is no penalty.
Definition at line 161 of file MulticanonicalMCMCHandler.h.
| bool MulticanonicalMCMCHandler::multicanonicalSpline |
Toggle for spline-based multicanonical weights.
Definition at line 157 of file MulticanonicalMCMCHandler.h.
| int MulticanonicalMCMCHandler::multicanonicalVar |
Parameter index used for the multicanonical weight, most often delta_cp.
Definition at line 141 of file MulticanonicalMCMCHandler.h.
| int MulticanonicalMCMCHandler::multicanonicalVar_dm23 |
Parameter index used for the multicanonical delm2_23 weight.
Definition at line 143 of file MulticanonicalMCMCHandler.h.
| const M3::float_t* MulticanonicalMCMCHandler::multicanonicalVar_dm23_value |
Pointer to value of delm2_23 weight used for multicanonical weight.
Definition at line 148 of file MulticanonicalMCMCHandler.h.
| std::string MulticanonicalMCMCHandler::multicanonicalVarName |
Parameter name used for the multicanonical weight, most often delta_cp.
Definition at line 139 of file MulticanonicalMCMCHandler.h.
| const M3::float_t* MulticanonicalMCMCHandler::multicanonicalVarValue |
Pointer to value of parameter vale used for multicanonical weight, most often delta_cp.
Definition at line 146 of file MulticanonicalMCMCHandler.h.
| int MulticanonicalMCMCHandler::oscCovVar |
Index of the oscillation-covariance systematic in the current fit.
Definition at line 137 of file MulticanonicalMCMCHandler.h.
|
protected |
Toggle for rescaling the step size based on the umbrella width.
Definition at line 180 of file MulticanonicalMCMCHandler.h.
| M3::BiasFunction MulticanonicalMCMCHandler::umbrellaBiasFunction |
Selected bias function for multicanonical weights.
Definition at line 151 of file MulticanonicalMCMCHandler.h.
| std::string MulticanonicalMCMCHandler::umbrellaBiasFunctionName |
Configured bias function name for logging.
Definition at line 154 of file MulticanonicalMCMCHandler.h.
|
protected |
Umbrella centre used for the current configuration.
Definition at line 169 of file MulticanonicalMCMCHandler.h.
|
protected |
Number of total umbrellas used for the current configuration.
Currently only used when auto-overlap mode is enabled. This is not fully tested.
Definition at line 174 of file MulticanonicalMCMCHandler.h.
|
protected |
Toggle for deriving umbrella widths from a desired # of sigma overlaps between umbrellas.
Definition at line 176 of file MulticanonicalMCMCHandler.h.
|
protected |
Requested overlap for evenly spaced umbrellas.
Definition at line 178 of file MulticanonicalMCMCHandler.h.
|
protected |
Additional scale factor applied when rescaling the step size. This is for fine tuning.
Definition at line 182 of file MulticanonicalMCMCHandler.h.
|
protected |
Umbrella width used for the current configuration.
Definition at line 171 of file MulticanonicalMCMCHandler.h.
|
protected |
Cached I0(kappa) value for the von Mises form.
Definition at line 190 of file MulticanonicalMCMCHandler.h.
|
protected |
Von Mises kappa parameter. Analogue of sigma for a gaussian.
Definition at line 188 of file MulticanonicalMCMCHandler.h.