MaCh3  2.6.1
Reference Guide
MulticanonicalMCMCHandler.h
Go to the documentation of this file.
1 #pragma once
2 #include <ostream>
3 #include <string>
4 #include <vector>
5 
7 #include "Manager/Manager.h"
8 
10 #include "TSpline.h"
12 
13 
14 namespace M3 {
15  enum class BiasFunction {
16  kGaussian,
17  kVonMises,
19  };
20 
27  constexpr double UmbrellaGaussianNormFactor = 0.906402477055;
28 }
29 
39 public:
44 
45  #ifdef MACH3_DEBUG
47  void setDebugStream(std::ostream* os, bool enabled);
48  #endif
49 
51  void FindOscCovParams(const std::vector<ParameterHandlerBase*>& systematics);
52 
57  void AdjustUmbrellaStepScale(const std::vector<ParameterHandlerBase*>& systematics);
58 
60  void InitializeMulticanonicalHandlerConfig(Manager* fitMan, std::vector<ParameterHandlerBase*>& systematics);
61 
64  void InitializeMulticanonicalParams(std::vector<ParameterHandlerBase*>& systematics);
65 
69  double GetMulticanonicalWeight(double deltacp, double delm23_value);
70 
72  double GetMulticanonicalWeightSpline(double deltacp, double delm23_value);
73 
75  double GetMulticanonicalWeightGaussian(double deltacp);
76 
79  double GetMulticanonicalWeightTripleGaussian(double deltacp);
80 
85  double GetMulticanonicalWeightVonMises(double deltacp);
86 
93  double GetMulticanonicalWeightGenGaussian(double deltacp);
94 
97  double circularDistance(double x, double mean);
98 
100  double generalisedGaussian2(double x, double mean, double width);
101 
108 
111 
114 
117 
118 protected:
121 
125  double delm23_value;
126 
128  TSpline3* dcp_spline_IO;
130  TSpline3* dcp_spline_NO;
131 
133  double umbrellaMean;
150 
155 
156 #ifdef MACH3_DEBUG
157  std::ostream* debugStream = nullptr;
158  bool debugEnabled = false;
159 #endif
160 };
#define _MaCh3_Safe_Include_Start_
KS: Avoiding warning checking for headers.
Definition: Core.h:126
#define _MaCh3_Safe_Include_End_
The manager class is responsible for managing configurations and settings.
Definition: Manager.h:16
Helper class for configuring and evaluating multicanonical umbrella weights.
double vonMises_I0_kappa
Cached I0(kappa) value for the von Mises form.
double umbrellaSigmaOverlap
Requested overlap for evenly spaced umbrellas.
void InitializeMulticanonicalParams(std::vector< ParameterHandlerBase * > &systematics)
Initialise the starting values used by the multicanonical parameter handling.
void InitializeMulticanonicalHandlerConfig(Manager *fitMan, std::vector< ParameterHandlerBase * > &systematics)
Read multicanonical configuration from the yaml via manager and initialise handler state.
double delm23_value
delm2_23 value used during proposal evaluation.
double umbrellaWidth
Umbrella width used for the current configuration.
TSpline3 * dcp_spline_IO
Spline for the IO branch, if spline mode is enabled.
void AdjustUmbrellaStepScale(const std::vector< ParameterHandlerBase * > &systematics)
Adjust the parameter-of-interest's step scale according to the width of the umbrella bias function.
int multicanonicalVar_dm23
Parameter index used for the multicanonical delm2_23 weight.
M3::BiasFunction umbrellaBiasFunction
Selected bias function for multicanonical weights.
double GetMulticanonicalWeightVonMises(double deltacp)
Compute a von Mises multicanonical penalty.
TSpline3 * dcp_spline_NO
Spline for the NO branch, if spline mode is enabled.
bool multicanonicalSpline
Toggle for spline-based multicanonical weights.
bool umbrellaOverlapMode
Toggle for deriving umbrella widths from a desired # of sigma overlaps between umbrellas.
void FindOscCovParams(const std::vector< ParameterHandlerBase * > &systematics)
Locate the systematic object which contains the parameters used by the handler. Stores the parameter ...
double vonMises_kappa
Von Mises kappa parameter. Analogue of sigma for a gaussian.
bool flipWindow
Optional flip-window control.
double delta_cp_value
delta_cp value used during proposal evaluation.
double GetMulticanonicalWeight(double deltacp, double delm23_value)
Compute the multicanonical penalty for the configured bias mode.
std::string umbrellaBiasFunctionName
Configured bias function name for logging.
double GetMulticanonicalWeightSpline(double deltacp, double delm23_value)
Compute the multicanonical penalty using a spline.
double umbrellaMean
Umbrella centre used for the current configuration.
virtual ~MulticanonicalMCMCHandler()
Destructor.
double GetMulticanonicalWeightTripleGaussian(double deltacp)
Compute a triple-Gaussian multicanonical penalty.
double umbrellaStepScaleFactor
Additional scale factor applied when rescaling the step size. This is for fine tuning.
int oscCovVar
Index of the oscillation-covariance systematic in the current fit.
int multicanonicalVar
Parameter index used for the multicanonical delta_cp weight.
int umbrellaNumber
Number of total umbrellas used for the current configuration.
double generalisedGaussian2(double x, double mean, double width)
Wraps the generalised gaussian function for a given x, mean, and width. Required to handle the wrappi...
double GetMulticanonicalWeightGenGaussian(double deltacp)
Compute a generalised-Gaussian multicanonical penalty.
bool umbrellaAdjustStepScale
Toggle for rescaling the step size based on the umbrella width.
double GetMulticanonicalWeightGaussian(double deltacp)
Compute a Gaussian multicanonical penalty.
double multicanonicalBeta
Global scale factor applied to the multicanonical penalty. 1 is full strength, 0 is no penalty.
double circularDistance(double x, double mean)
Compute the circular distance between two angles.
Main namespace for MaCh3 software.
constexpr double UmbrellaGaussianNormFactor
@ kGaussian
Assumes gaussian prior.