![]() |
MaCh3
2.4.2
Reference Guide
|
Base class responsible for handling of systematic error parameters. Capable of using PCA or using adaptive throw matrix. More...
#include <Parameters/ParameterHandlerBase.h>
Public Member Functions | |
| ParameterHandlerBase (const std::vector< std::string > &YAMLFile, std::string name, double threshold=-1, int FirstPCAdpar=-999, int LastPCAdpar=-999) | |
| ETA - constructor for a YAML file. More... | |
| ParameterHandlerBase (std::string name, std::string file, double threshold=-1, int FirstPCAdpar=-999, int LastPCAdpar=-999) | |
| "Usual" constructors from root file More... | |
| virtual | ~ParameterHandlerBase () |
| Destructor. More... | |
| void | SetCovMatrix (TMatrixDSym *cov) |
| Set covariance matrix. More... | |
| void | SetName (const std::string &name) |
| Set matrix name. More... | |
| void | SetParName (const int i, const std::string &name) |
| change parameter name More... | |
| void | SetSingleParameter (const int parNo, const double parVal) |
| Set value of single param to a given value. More... | |
| void | SetPar (const int i, const double val) |
| Set all the covariance matrix parameters to a user-defined value. More... | |
| void | SetParCurrProp (const int i, const double val) |
| Set current parameter value. More... | |
| void | SetParProp (const int i, const double val) |
| Set proposed parameter value. More... | |
| void | SetParameters (const std::vector< double > &pars={}) |
| Set parameter values using vector, it has to have same size as covariance class. More... | |
| void | SetFlatPrior (const int i, const bool eL) |
| Set if parameter should have flat prior or not. More... | |
| void | SetRandomThrow (const int i, const double rand) |
| Set random value useful for debugging/CI. More... | |
| double | GetRandomThrow (const int i) const |
| Get random value useful for debugging/CI. More... | |
| void | SetBranches (TTree &tree, const bool SaveProposal=false) |
| set branches for output file More... | |
| void | SetStepScale (const double scale, const bool verbose=true) |
| Set global step scale for covariance object. More... | |
| void | SetIndivStepScale (const int ParameterIndex, const double StepScale) |
| DB Function to set fIndivStepScale from a vector (Can be used from execs and inside covariance constructors) More... | |
| void | SetIndivStepScale (const std::vector< double > &stepscale) |
| DB Function to set fIndivStepScale from a vector (Can be used from execs and inside covariance constructors) More... | |
| void | SetPrintLength (const unsigned int PriLen) |
| KS: In case someone really want to change this. More... | |
| void | SaveUpdatedMatrixConfig () |
| KS: After step scale, prefit etc. value were modified save this modified config. More... | |
| void | ThrowParameters () |
| Throw the parameters according to the covariance matrix. This shouldn't be used in MCMC code ase it can break Detailed Balance;. More... | |
| void | RandomConfiguration () |
| Randomly throw the parameters in their 1 sigma range. More... | |
| int | CheckBounds () const _noexcept_ |
| Check if parameters were proposed outside physical boundary. More... | |
| double | CalcLikelihood () const _noexcept_ |
| Calc penalty term based on inverted covariance matrix. More... | |
| virtual double | GetLikelihood () |
| Return CalcLikelihood if some params were thrown out of boundary return LARGE_LOGL More... | |
| TMatrixDSym * | GetCovMatrix () const |
| Return covariance matrix. More... | |
| TMatrixDSym * | GetInvCovMatrix () const |
| Return inverted covariance matrix. More... | |
| double | GetInvCovMatrix (const int i, const int j) const |
| Return inverted covariance matrix. More... | |
| double | GetCorrThrows (const int i) const |
| Return correlated throws. More... | |
| bool | GetFlatPrior (const int i) const |
| Get if param has flat prior or not. More... | |
| std::string | GetName () const |
| Get name of covariance. More... | |
| std::string | GetParName (const int i) const |
| Get name of parameter. More... | |
| int | GetParIndex (const std::string &name) const |
| Get index based on name. More... | |
| std::string | GetParFancyName (const int i) const |
| Get fancy name of the Parameter. More... | |
| std::string | GetInputFile () const |
| Get name of input file. More... | |
| double | GetDiagonalError (const int i) const |
| Get diagonal error for ith parameter. More... | |
| double | GetError (const int i) const |
| Get the error for the ith parameter. More... | |
| void | ResetIndivStepScale () |
| Adaptive Step Tuning Stuff. More... | |
| void | SetIndivStepScaleForSkippedAdaptParams () |
| Set individual step scale for parameters which are skipped during adaption to initial values. More... | |
| void | InitialiseAdaption (const YAML::Node &adapt_manager) |
| Initialise adaptive MCMC. More... | |
| void | SaveAdaptiveToFile (const std::string &outFileName, const std::string &systematicName) |
| Save adaptive throw matrix to file. More... | |
| bool | GetDoAdaption () const |
| Do we adapt or not. More... | |
| void | SetThrowMatrix (TMatrixDSym *cov) |
| Use new throw matrix, used in adaptive MCMC. More... | |
| void | SetSubThrowMatrix (int first_index, int last_index, TMatrixDSym const &subcov) |
| void | UpdateThrowMatrix (TMatrixDSym *cov) |
| Replaces old throw matrix with new one. More... | |
| void | SetNumberOfSteps (const int nsteps) |
| Set number of MCMC step, when running adaptive MCMC it is updated with given frequency. We need number of steps to determine frequency. More... | |
| TMatrixDSym * | GetThrowMatrix () const |
| Get matrix used for step proposal. More... | |
| double | GetThrowMatrix (const int i, const int j) const |
| Get matrix used for step proposal. More... | |
| TH2D * | GetCorrelationMatrix () |
| KS: Convert covariance matrix to correlation matrix and return TH2D which can be used for fancy plotting. More... | |
| const double * | RetPointer (const int iParam) |
| DB Pointer return to param position. More... | |
| const std::vector< double > & | GetParPropVec () |
| Get a reference to the proposed parameter values Can be useful if you want to track these without having to copy values using getProposed() More... | |
| int | GetNumParams () const |
| Get total number of parameters. More... | |
| std::vector< double > | GetPreFitValues () const |
| Get the pre-fit values of the parameters. More... | |
| std::vector< double > | GetProposed () const |
| Get vector of all proposed parameter values. More... | |
| double | GetParProp (const int i) const |
| Get proposed parameter value. More... | |
| double | GetParCurr (const int i) const |
| Get current parameter value. More... | |
| const std::vector< double > & | GetParCurrVec () const |
| Get vector of current parameter values. More... | |
| double | GetParInit (const int i) const |
| Get prior parameter value. More... | |
| double | GetUpperBound (const int i) const |
| Get upper parameter bound in which it is physically valid. More... | |
| double | GetLowerBound (const int i) const |
| Get lower parameter bound in which it is physically valid. More... | |
| double | GetIndivStepScale (const int ParameterIndex) const |
| Get individual step scale for selected parameter. More... | |
| double | GetGlobalStepScale () const |
| Get global step scale for covariance object. More... | |
| int | GetNParameters () const |
| Get number of params which will be different depending if using Eigen decomposition or not. More... | |
| void | PrintNominal () const |
| Print prior value for every parameter. More... | |
| void | PrintNominalCurrProp () const |
| Print prior, current and proposed value for each parameter. More... | |
| void | PrintParameters () const |
| void | PrintIndivStepScale () const |
| Print step scale for each parameter. More... | |
| virtual void | ProposeStep () |
| Generate a new proposed state. More... | |
| void | Randomize () _noexcept_ |
| "Randomize" the parameters in the covariance class for the proposed step. Used the proposal kernel and the current parameter value to set proposed step More... | |
| void | CorrelateSteps () _noexcept_ |
| Use Cholesky throw matrix for better step proposal. More... | |
| void | UpdateAdaptiveCovariance () |
| Method to update adaptive MCMC [13]. More... | |
| void | AcceptStep () _noexcept_ |
| Accepted this step. More... | |
| void | SetFixAllParameters () |
| Set all parameters to be fixed at prior values. More... | |
| void | SetFixParameter (const int i) |
| Set parameter to be fixed at prior value. More... | |
| void | SetFixParameter (const std::string &name) |
| Set parameter to be fixed at prior value. More... | |
| void | SetFreeAllParameters () |
| Set all parameters to be treated as free. More... | |
| void | SetFreeParameter (const int i) |
| Set parameter to be treated as free. More... | |
| void | SetFreeParameter (const std::string &name) |
| Set parameter to be treated as free. More... | |
| void | ToggleFixAllParameters () |
| Toggle fixing parameters at prior values. More... | |
| void | ToggleFixParameter (const int i) |
| Toggle fixing parameter at prior values. More... | |
| void | ToggleFixParameter (const std::string &name) |
| Toggle fixing parameter at prior values. More... | |
| bool | IsParameterFixed (const int i) const |
| Is parameter fixed or not. More... | |
| bool | IsParameterFixed (const std::string &name) const |
| Is parameter fixed or not. More... | |
| void | ConstructPCA (const double eigen_threshold, int FirstPCAdpar, int LastPCAdpar) |
| CW: Calculate eigen values, prepare transition matrices and remove param based on defined threshold. More... | |
| bool | IsPCA () const |
| is PCA, can use to query e.g. LLH scans More... | |
| YAML::Node | GetConfig () const |
| Getter to return a copy of the YAML node. More... | |
| adaptive_mcmc::AdaptiveMCMCHandler * | GetAdaptiveHandler () const |
| Get pointer for AdaptiveHandler. More... | |
| void | SetTune (const std::string &TuneName) |
| KS: Set proposed parameter values vector to be base on tune values, for example set proposed values to be of generated or maybe PostND. More... | |
| PCAHandler * | GetPCAHandler () const |
| Get pointer for PCAHandler. More... | |
| void | MatchMaCh3OutputBranches (TTree *PosteriorFile, std::vector< double > &BranchValues, std::vector< std::string > &BranchNames, const std::vector< std::string > &FancyNames={}) |
| Matches branches in a TTree to parameters in a systematic handler. More... | |
Protected Member Functions | |
| void | Init (const std::string &name, const std::string &file) |
| Initialisation of the class using matrix from root file. More... | |
| void | Init (const std::vector< std::string > &YAMLFile) |
| Initialisation of the class using config. More... | |
| void | ReserveMemory (const int size) |
| Initialise vectors with parameters information. More... | |
| void | MakePosDef (TMatrixDSym *cov=nullptr) |
| Make matrix positive definite by adding small values to diagonal, necessary for inverting matrix. More... | |
| void | MakeClosestPosDef (TMatrixDSym *cov) |
| HW: Finds closest possible positive definite matrix in Frobenius Norm ||.||_frob Where ||X||_frob=sqrt[sum_ij(x_ij^2)] (basically just turns an n,n matrix into vector in n^2 space then does Euclidean norm) More... | |
| void | SetThrowMatrixFromFile (const std::string &matrix_file_name, const std::string &matrix_name, const std::string &means_name) |
| sets throw matrix from a file More... | |
| bool | AppliesToSample (const int SystIndex, const std::string &SampleName) const |
| Check if parameter is affecting given sample name. More... | |
| void | FlipParameterValue (const int index, const double FlipPoint) |
| KS: Flip parameter around given value, for example mass ordering around 0. More... | |
| void | CircularParBounds (const int i, const double LowBound, const double UpBound) |
| HW :: This method is a tad hacky but modular arithmetic gives me a headache. More... | |
| void | EnableSpecialProposal (const YAML::Node ¶m, const int Index) |
| Enable special proposal. More... | |
| void | SpecialStepProposal () |
| Perform Special Step Proposal. More... | |
Protected Attributes | |
| bool | doSpecialStepProposal |
| Check if any of special step proposal were enabled. More... | |
| const std::string | inputFile |
| The input root file we read in. More... | |
| std::string | matrixName |
| Name of cov matrix. More... | |
| TMatrixDSym * | covMatrix |
| The covariance matrix. More... | |
| TMatrixDSym * | invCovMatrix |
| The inverse covariance matrix. More... | |
| std::vector< std::vector< double > > | InvertCovMatrix |
| KS: Same as above but much faster as TMatrixDSym cache miss. More... | |
| std::vector< std::unique_ptr< TRandom3 > > | random_number |
| KS: Set Random numbers for each thread so each thread has different seed. More... | |
| double * | randParams |
| Random number taken from gaussian around prior error used for corr_throw. More... | |
| double * | corr_throw |
| Result of multiplication of Cholesky matrix and randParams. More... | |
| double | _fGlobalStepScale |
| Global step scale applied to all params in this class. More... | |
| int | PrintLength |
| KS: This is used when printing parameters, sometimes we have super long parameters name, we want to flexibly adjust couts. More... | |
| std::vector< std::string > | _fNames |
| ETA _fNames is set automatically in the covariance class to be something like param_i, this is currently to make things compatible with the Diagnostic tools. More... | |
| std::vector< std::string > | _fFancyNames |
| Fancy name for example rather than param_0 it is MAQE, useful for human reading. More... | |
| YAML::Node | _fYAMLDoc |
| Stores config describing systematics. More... | |
| int | _fNumPar |
| Number of systematic parameters. More... | |
| std::vector< double > | _fPreFitValue |
| Parameter value dictated by the prior model. Based on it penalty term is calculated. More... | |
| std::vector< double > | _fCurrVal |
| Current value of the parameter. More... | |
| std::vector< double > | _fPropVal |
| Proposed value of the parameter. More... | |
| std::vector< double > | _fError |
| Prior error on the parameter. More... | |
| std::vector< double > | _fLowBound |
| Lowest physical bound, parameter will not be able to go beyond it. More... | |
| std::vector< double > | _fUpBound |
| Upper physical bound, parameter will not be able to go beyond it. More... | |
| std::vector< double > | _fIndivStepScale |
| Individual step scale used by MCMC algorithm. More... | |
| std::vector< bool > | _fFlatPrior |
| Whether to apply flat prior or not. More... | |
| std::vector< std::vector< std::string > > | _fSampleNames |
| Tells to which samples object param should be applied. More... | |
| std::vector< double > | _fIndivStepScaleInitial |
| Backup of _fIndivStepScale for parameters which are skipped during adaption. More... | |
| double | _fGlobalStepScaleInitial |
| Backup of _fGlobalStepScale for parameters which are skipped during adaption. More... | |
| std::vector< bool > | param_skip_adapt_flags |
| Flags telling if parameter should be skipped during adaption. More... | |
| TMatrixDSym * | throwMatrix |
| Matrix which we use for step proposal before Cholesky decomposition (not actually used for step proposal) More... | |
| double ** | throwMatrixCholDecomp |
| Throw matrix that is being used in the fit, much faster as TMatrixDSym cache miss. More... | |
| bool | pca |
| perform PCA or not More... | |
| bool | use_adaptive |
| Are we using AMCMC? More... | |
| std::unique_ptr< PCAHandler > | PCAObj |
| Struct containing information about PCA. More... | |
| std::unique_ptr< adaptive_mcmc::AdaptiveMCMCHandler > | AdaptiveHandler |
| Struct containing information about adaption. More... | |
| std::unique_ptr< ParameterTunes > | Tunes |
| Struct containing information about adaption. More... | |
| std::vector< int > | FlipParameterIndex |
| Indices of parameters with flip symmetry. More... | |
| std::vector< double > | FlipParameterPoint |
| Central points around which parameters are flipped. More... | |
| std::vector< int > | CircularBoundsIndex |
| Indices of parameters with circular bounds. More... | |
| std::vector< std::pair< double, double > > | CircularBoundsValues |
| Circular bounds for each parameter (lower, upper) More... | |
Base class responsible for handling of systematic error parameters. Capable of using PCA or using adaptive throw matrix.
Definition at line 15 of file ParameterHandlerBase.h.
| ParameterHandlerBase::ParameterHandlerBase | ( | const std::vector< std::string > & | YAMLFile, |
| std::string | name, | ||
| double | threshold = -1, |
||
| int | FirstPCAdpar = -999, |
||
| int | LastPCAdpar = -999 |
||
| ) |
ETA - constructor for a YAML file.
| YAMLFile | A vector of strings representing the YAML files used for initialisation of matrix |
| name | Matrix name |
| threshold | PCA threshold from 0 to 1. Default is -1 and means no PCA |
| FirstPCAdpar | First PCA parameter that will be decomposed. |
| LastPCAdpar | First PCA parameter that will be decomposed. |
Definition at line 27 of file ParameterHandlerBase.cpp.
| ParameterHandlerBase::ParameterHandlerBase | ( | std::string | name, |
| std::string | file, | ||
| double | threshold = -1, |
||
| int | FirstPCAdpar = -999, |
||
| int | LastPCAdpar = -999 |
||
| ) |
"Usual" constructors from root file
| name | Matrix name |
| file | Path to matrix root file |
Definition at line 8 of file ParameterHandlerBase.cpp.
|
virtual |
Destructor.
Definition at line 53 of file ParameterHandlerBase.cpp.
| void ParameterHandlerBase::AcceptStep | ( | ) |
Accepted this step.
Definition at line 748 of file ParameterHandlerBase.cpp.
|
protected |
Check if parameter is affecting given sample name.
| SystIndex | number of parameter |
| SampleName | The Sample name used to filter parameters. |
Definition at line 1452 of file ParameterHandlerBase.cpp.
| double ParameterHandlerBase::CalcLikelihood | ( | ) | const |
Calc penalty term based on inverted covariance matrix.
The log-likelihood is computed as:
\[ \log \mathcal{L} = \frac{1}{2} \sum_{i}^{\textrm{pars}} \sum_{j}^{\textrm{pars}} \Delta \vec{p}_i \left( V^{-1} \right)_{i,j} \Delta \vec{p}_j \]
where:
_fFlatPrior[i] is true, the parameter is excluded from the calculation. Definition at line 816 of file ParameterHandlerBase.cpp.
| int ParameterHandlerBase::CheckBounds | ( | ) | const |
Check if parameters were proposed outside physical boundary.
Definition at line 844 of file ParameterHandlerBase.cpp.
|
protected |
HW :: This method is a tad hacky but modular arithmetic gives me a headache.
Definition at line 769 of file ParameterHandlerBase.cpp.
| void ParameterHandlerBase::ConstructPCA | ( | const double | eigen_threshold, |
| int | FirstPCAdpar, | ||
| int | LastPCAdpar | ||
| ) |
CW: Calculate eigen values, prepare transition matrices and remove param based on defined threshold.
| eigen_threshold | PCA threshold from 0 to 1. Default is -1 and means no PCA |
| FirstPCAdpar | First PCA parameter that will be decomposed. |
| LastPCAdpar | First PCA parameter that will be decomposed. |
Definition at line 68 of file ParameterHandlerBase.cpp.
| void ParameterHandlerBase::CorrelateSteps | ( | ) |
Use Cholesky throw matrix for better step proposal.
Definition at line 726 of file ParameterHandlerBase.cpp.
|
protected |
Enable special proposal.
Definition at line 381 of file ParameterHandlerBase.cpp.
|
protected |
KS: Flip parameter around given value, for example mass ordering around 0.
| index | parameter index you want to flip |
| FlipPoint | Value around which flipping is done |
Definition at line 779 of file ParameterHandlerBase.cpp.
|
inline |
Get pointer for AdaptiveHandler.
Definition at line 320 of file ParameterHandlerBase.h.
|
inline |
Getter to return a copy of the YAML node.
Definition at line 317 of file ParameterHandlerBase.h.
| TH2D * ParameterHandlerBase::GetCorrelationMatrix | ( | ) |
KS: Convert covariance matrix to correlation matrix and return TH2D which can be used for fancy plotting.
This function converts the covariance matrix to a correlation matrix and returns a TH2D object, which can be used for advanced plotting purposes.
Definition at line 1399 of file ParameterHandlerBase.cpp.
|
inline |
Return correlated throws.
| i | Parameter index |
Definition at line 131 of file ParameterHandlerBase.h.
|
inline |
|
inline |
Get diagonal error for ith parameter.
| i | Parameter index |
Definition at line 154 of file ParameterHandlerBase.h.
|
inline |
|
inline |
Get the error for the ith parameter.
| i | Parameter index |
Definition at line 157 of file ParameterHandlerBase.h.
|
inline |
Get if param has flat prior or not.
| i | Parameter index |
Definition at line 135 of file ParameterHandlerBase.h.
|
inline |
|
inline |
Get individual step scale for selected parameter.
| ParameterIndex | Parameter index |
Definition at line 237 of file ParameterHandlerBase.h.
|
inline |
|
inline |
|
inline |
|
virtual |
Return CalcLikelihood if some params were thrown out of boundary return LARGE_LOGL
Reimplemented in PyParameterHandlerBase.
Definition at line 859 of file ParameterHandlerBase.cpp.
|
inline |
Get lower parameter bound in which it is physically valid.
| i | Parameter index |
Definition at line 234 of file ParameterHandlerBase.h.
|
inline |
|
inline |
Get number of params which will be different depending if using Eigen decomposition or not.
Definition at line 242 of file ParameterHandlerBase.h.
|
inline |
|
inline |
Get current parameter value.
| i | Parameter index |
Definition at line 222 of file ParameterHandlerBase.h.
|
inline |
|
inline |
Get fancy name of the Parameter.
| i | Parameter index |
Definition at line 148 of file ParameterHandlerBase.h.
| int ParameterHandlerBase::GetParIndex | ( | const std::string & | name | ) | const |
Get index based on name.
Definition at line 945 of file ParameterHandlerBase.cpp.
|
inline |
Get prior parameter value.
| i | Parameter index |
Definition at line 228 of file ParameterHandlerBase.h.
|
inline |
Get name of parameter.
| i | Parameter index |
Definition at line 141 of file ParameterHandlerBase.h.
|
inline |
Get proposed parameter value.
| i | Parameter index |
Definition at line 219 of file ParameterHandlerBase.h.
|
inline |
Get a reference to the proposed parameter values Can be useful if you want to track these without having to copy values using getProposed()
Definition at line 209 of file ParameterHandlerBase.h.
|
inline |
|
inline |
| std::vector< double > ParameterHandlerBase::GetProposed | ( | ) | const |
Get vector of all proposed parameter values.
Definition at line 526 of file ParameterHandlerBase.cpp.
|
inline |
Get random value useful for debugging/CI.
| i | Parameter index |
Definition at line 74 of file ParameterHandlerBase.h.
|
inline |
|
inline |
|
inline |
Get upper parameter bound in which it is physically valid.
| i | Parameter index |
Definition at line 231 of file ParameterHandlerBase.h.
|
protected |
Initialisation of the class using matrix from root file.
Definition at line 95 of file ParameterHandlerBase.cpp.
|
protected |
Initialisation of the class using config.
| YAMLFile | A vector of strings representing the YAML files used for initialisation of matrix |
Definition at line 156 of file ParameterHandlerBase.cpp.
| void ParameterHandlerBase::InitialiseAdaption | ( | const YAML::Node & | adapt_manager | ) |
Initialise adaptive MCMC.
| adapt_manager | Node having from which we load all adaptation options |
Definition at line 1210 of file ParameterHandlerBase.cpp.
|
inline |
Is parameter fixed or not.
| i | Parameter index |
Definition at line 298 of file ParameterHandlerBase.h.
| bool ParameterHandlerBase::IsParameterFixed | ( | const std::string & | name | ) | const |
Is parameter fixed or not.
| name | Name of parameter you want to check if is fixed |
Definition at line 1044 of file ParameterHandlerBase.cpp.
|
inline |
|
protected |
HW: Finds closest possible positive definite matrix in Frobenius Norm ||.||_frob Where ||X||_frob=sqrt[sum_ij(x_ij^2)] (basically just turns an n,n matrix into vector in n^2 space then does Euclidean norm)
Definition at line 1352 of file ParameterHandlerBase.cpp.
|
protected |
Make matrix positive definite by adding small values to diagonal, necessary for inverting matrix.
| cov | Matrix which we evaluate Positive Definitiveness |
Definition at line 1104 of file ParameterHandlerBase.cpp.
| void ParameterHandlerBase::MatchMaCh3OutputBranches | ( | TTree * | PosteriorFile, |
| std::vector< double > & | BranchValues, | ||
| std::vector< std::string > & | BranchNames, | ||
| const std::vector< std::string > & | FancyNames = {} |
||
| ) |
Matches branches in a TTree to parameters in a systematic handler.
| PosteriorFile | Pointer to the ROOT TTree from MaCh3 fit. |
| BranchValues | Vector to store the values of the branches (resized inside). |
| BranchNames | Vector to store the names of the branches (resized inside). |
| FancyNames | Optional vector of "fancy names" to match. If empty, all parameters are matched. |
FancyNames is provided, it matches only the parameters whose "fancy names" are in FancyNames. This is useful for studies where one performs ND fits and passes them to FD fits, which may have additional parameters (e.g., oscillations).FancyNames is empty, it matches all parameters in the systematic handler.| MaCh3Exception | if any parameter branch is uninitialized. |
Definition at line 1504 of file ParameterHandlerBase.cpp.
| void ParameterHandlerBase::PrintIndivStepScale | ( | ) | const |
Print step scale for each parameter.
Definition at line 1092 of file ParameterHandlerBase.cpp.
| void ParameterHandlerBase::PrintNominal | ( | ) | const |
Print prior value for every parameter.
Definition at line 788 of file ParameterHandlerBase.cpp.
| void ParameterHandlerBase::PrintNominalCurrProp | ( | ) | const |
Print prior, current and proposed value for each parameter.
Definition at line 798 of file ParameterHandlerBase.cpp.
|
inline |
Definition at line 253 of file ParameterHandlerBase.h.
|
virtual |
Generate a new proposed state.
Reimplemented in PyParameterHandlerBase.
Definition at line 652 of file ParameterHandlerBase.cpp.
| void ParameterHandlerBase::RandomConfiguration | ( | ) |
Randomly throw the parameters in their 1 sigma range.
Definition at line 593 of file ParameterHandlerBase.cpp.
| void ParameterHandlerBase::Randomize | ( | ) |
"Randomize" the parameters in the covariance class for the proposed step. Used the proposal kernel and the current parameter value to set proposed step
Definition at line 690 of file ParameterHandlerBase.cpp.
|
protected |
Initialise vectors with parameters information.
| size | integer telling size to which we will resize all vectors/allocate memory |
Definition at line 474 of file ParameterHandlerBase.cpp.
| void ParameterHandlerBase::ResetIndivStepScale | ( | ) |
Adaptive Step Tuning Stuff.
Definition at line 1115 of file ParameterHandlerBase.cpp.
|
inline |
DB Pointer return to param position.
| iParam | The index of the parameter in the vector. |
Definition at line 205 of file ParameterHandlerBase.h.
|
inline |
| void ParameterHandlerBase::SaveUpdatedMatrixConfig | ( | ) |
KS: After step scale, prefit etc. value were modified save this modified config.
Definition at line 1427 of file ParameterHandlerBase.cpp.
| void ParameterHandlerBase::SetBranches | ( | TTree & | tree, |
| const bool | SaveProposal = false |
||
| ) |
set branches for output file
| tree | Tree to which we will save branches |
| SaveProposal | Normally we only save parameter after is accepted, for debugging purpose it is helpful to see also proposed values. That's what this variable controls |
Definition at line 904 of file ParameterHandlerBase.cpp.
| void ParameterHandlerBase::SetCovMatrix | ( | TMatrixDSym * | cov | ) |
Set covariance matrix.
| cov | Covariance matrix which we set and will be used later for evaluation of penalty term |
Definition at line 452 of file ParameterHandlerBase.cpp.
| void ParameterHandlerBase::SetFixAllParameters | ( | ) |
Set all parameters to be fixed at prior values.
Definition at line 958 of file ParameterHandlerBase.cpp.
| void ParameterHandlerBase::SetFixParameter | ( | const int | i | ) |
Set parameter to be fixed at prior value.
| i | Parameter index |
Definition at line 966 of file ParameterHandlerBase.cpp.
| void ParameterHandlerBase::SetFixParameter | ( | const std::string & | name | ) |
Set parameter to be fixed at prior value.
| name | Name of the parameter to be fixed |
Definition at line 973 of file ParameterHandlerBase.cpp.
| void ParameterHandlerBase::SetFlatPrior | ( | const int | i, |
| const bool | eL | ||
| ) |
Set if parameter should have flat prior or not.
| i | Parameter index |
| eL | bool telling if it will be flat or not |
Definition at line 1056 of file ParameterHandlerBase.cpp.
| void ParameterHandlerBase::SetFreeAllParameters | ( | ) |
| void ParameterHandlerBase::SetFreeParameter | ( | const int | i | ) |
Set parameter to be treated as free.
| i | Parameter index |
Definition at line 988 of file ParameterHandlerBase.cpp.
| void ParameterHandlerBase::SetFreeParameter | ( | const std::string & | name | ) |
Set parameter to be treated as free.
| name | Name of the parameter to be treated as free |
Definition at line 995 of file ParameterHandlerBase.cpp.
|
inline |
DB Function to set fIndivStepScale from a vector (Can be used from execs and inside covariance constructors)
| ParameterIndex | Parameter Index |
| StepScale | Value of individual step scale |
Definition at line 88 of file ParameterHandlerBase.h.
| void ParameterHandlerBase::SetIndivStepScale | ( | const std::vector< double > & | stepscale | ) |
DB Function to set fIndivStepScale from a vector (Can be used from execs and inside covariance constructors)
| stepscale | Vector of individual step scale, should have same |
Definition at line 1075 of file ParameterHandlerBase.cpp.
| void ParameterHandlerBase::SetIndivStepScaleForSkippedAdaptParams | ( | ) |
Set individual step scale for parameters which are skipped during adaption to initial values.
Definition at line 1125 of file ParameterHandlerBase.cpp.
|
inline |
|
inline |
Set number of MCMC step, when running adaptive MCMC it is updated with given frequency. We need number of steps to determine frequency.
Definition at line 180 of file ParameterHandlerBase.h.
| void ParameterHandlerBase::SetPar | ( | const int | i, |
| const double | val | ||
| ) |
Set all the covariance matrix parameters to a user-defined value.
| i | Parameter index |
| val | new value which will be set |
Definition at line 512 of file ParameterHandlerBase.cpp.
| void ParameterHandlerBase::SetParameters | ( | const std::vector< double > & | pars = {} | ) |
Set parameter values using vector, it has to have same size as covariance class.
| pars | Vector holding new values for every parameter |
Definition at line 871 of file ParameterHandlerBase.cpp.
| void ParameterHandlerBase::SetParCurrProp | ( | const int | i, |
| const double | val | ||
| ) |
Set current parameter value.
| i | Parameter index |
| val | new value which will be set |
Definition at line 642 of file ParameterHandlerBase.cpp.
|
inline |
change parameter name
| i | Parameter index |
| name | new name which will be set |
Definition at line 42 of file ParameterHandlerBase.h.
|
inline |
Set proposed parameter value.
| i | Parameter index |
| val | new value which will be set |
Definition at line 56 of file ParameterHandlerBase.h.
|
inline |
KS: In case someone really want to change this.
Definition at line 93 of file ParameterHandlerBase.h.
|
inline |
Set random value useful for debugging/CI.
| i | Parameter index |
| rand | New value for random number |
Definition at line 71 of file ParameterHandlerBase.h.
| void ParameterHandlerBase::SetSingleParameter | ( | const int | parNo, |
| const double | parVal | ||
| ) |
Set value of single param to a given value.
Definition at line 633 of file ParameterHandlerBase.cpp.
| void ParameterHandlerBase::SetStepScale | ( | const double | scale, |
| const bool | verbose = true |
||
| ) |
Set global step scale for covariance object.
| scale | Value of global step scale |
| verbose | Print that we've changed scale + use warnings [default: true] [23] |
Definition at line 927 of file ParameterHandlerBase.cpp.
| void ParameterHandlerBase::SetSubThrowMatrix | ( | int | first_index, |
| int | last_index, | ||
| TMatrixDSym const & | subcov | ||
| ) |
Definition at line 1177 of file ParameterHandlerBase.cpp.
| void ParameterHandlerBase::SetThrowMatrix | ( | TMatrixDSym * | cov | ) |
Use new throw matrix, used in adaptive MCMC.
Definition at line 1143 of file ParameterHandlerBase.cpp.
|
protected |
sets throw matrix from a file
| matrix_file_name | name of file matrix lives in |
| matrix_name | name of matrix in file |
| means_name | name of means vec in file |
| void ParameterHandlerBase::SetTune | ( | const std::string & | TuneName | ) |
KS: Set proposed parameter values vector to be base on tune values, for example set proposed values to be of generated or maybe PostND.
Definition at line 1492 of file ParameterHandlerBase.cpp.
|
protected |
Perform Special Step Proposal.
Definition at line 667 of file ParameterHandlerBase.cpp.
| void ParameterHandlerBase::ThrowParameters | ( | ) |
Throw the parameters according to the covariance matrix. This shouldn't be used in MCMC code ase it can break Detailed Balance;.
Definition at line 536 of file ParameterHandlerBase.cpp.
| void ParameterHandlerBase::ToggleFixAllParameters | ( | ) |
| void ParameterHandlerBase::ToggleFixParameter | ( | const int | i | ) |
Toggle fixing parameter at prior values.
| i | Parameter index |
Definition at line 1010 of file ParameterHandlerBase.cpp.
| void ParameterHandlerBase::ToggleFixParameter | ( | const std::string & | name | ) |
Toggle fixing parameter at prior values.
| name | Name of parameter you want to fix |
Definition at line 1032 of file ParameterHandlerBase.cpp.
| void ParameterHandlerBase::UpdateAdaptiveCovariance | ( | ) |
Method to update adaptive MCMC [13].
Need to adjust the scale every step
Definition at line 1306 of file ParameterHandlerBase.cpp.
| void ParameterHandlerBase::UpdateThrowMatrix | ( | TMatrixDSym * | cov | ) |
|
protected |
Current value of the parameter.
Definition at line 441 of file ParameterHandlerBase.h.
|
protected |
Prior error on the parameter.
Definition at line 445 of file ParameterHandlerBase.h.
|
protected |
Fancy name for example rather than param_0 it is MAQE, useful for human reading.
Definition at line 433 of file ParameterHandlerBase.h.
|
protected |
Whether to apply flat prior or not.
Definition at line 453 of file ParameterHandlerBase.h.
|
protected |
Global step scale applied to all params in this class.
Definition at line 425 of file ParameterHandlerBase.h.
|
protected |
Backup of _fGlobalStepScale for parameters which are skipped during adaption.
Definition at line 461 of file ParameterHandlerBase.h.
|
protected |
Individual step scale used by MCMC algorithm.
Definition at line 451 of file ParameterHandlerBase.h.
|
protected |
Backup of _fIndivStepScale for parameters which are skipped during adaption.
Definition at line 458 of file ParameterHandlerBase.h.
|
protected |
Lowest physical bound, parameter will not be able to go beyond it.
Definition at line 447 of file ParameterHandlerBase.h.
|
protected |
ETA _fNames is set automatically in the covariance class to be something like param_i, this is currently to make things compatible with the Diagnostic tools.
Definition at line 431 of file ParameterHandlerBase.h.
|
protected |
Number of systematic parameters.
Definition at line 437 of file ParameterHandlerBase.h.
|
protected |
Parameter value dictated by the prior model. Based on it penalty term is calculated.
Definition at line 439 of file ParameterHandlerBase.h.
|
protected |
Proposed value of the parameter.
Definition at line 443 of file ParameterHandlerBase.h.
|
protected |
Tells to which samples object param should be applied.
Definition at line 455 of file ParameterHandlerBase.h.
|
protected |
Upper physical bound, parameter will not be able to go beyond it.
Definition at line 449 of file ParameterHandlerBase.h.
|
protected |
Stores config describing systematics.
Definition at line 435 of file ParameterHandlerBase.h.
|
protected |
Struct containing information about adaption.
Definition at line 479 of file ParameterHandlerBase.h.
|
protected |
Indices of parameters with circular bounds.
Definition at line 488 of file ParameterHandlerBase.h.
|
protected |
Circular bounds for each parameter (lower, upper)
Definition at line 490 of file ParameterHandlerBase.h.
|
protected |
Result of multiplication of Cholesky matrix and randParams.
Definition at line 423 of file ParameterHandlerBase.h.
|
protected |
The covariance matrix.
Definition at line 411 of file ParameterHandlerBase.h.
|
protected |
Check if any of special step proposal were enabled.
Definition at line 403 of file ParameterHandlerBase.h.
|
protected |
Indices of parameters with flip symmetry.
Definition at line 484 of file ParameterHandlerBase.h.
|
protected |
Central points around which parameters are flipped.
Definition at line 486 of file ParameterHandlerBase.h.
|
protected |
The input root file we read in.
Definition at line 406 of file ParameterHandlerBase.h.
|
protected |
The inverse covariance matrix.
Definition at line 413 of file ParameterHandlerBase.h.
|
protected |
KS: Same as above but much faster as TMatrixDSym cache miss.
Definition at line 415 of file ParameterHandlerBase.h.
|
protected |
Name of cov matrix.
Definition at line 409 of file ParameterHandlerBase.h.
|
protected |
Flags telling if parameter should be skipped during adaption.
Definition at line 464 of file ParameterHandlerBase.h.
|
protected |
perform PCA or not
Definition at line 472 of file ParameterHandlerBase.h.
|
protected |
Struct containing information about PCA.
Definition at line 477 of file ParameterHandlerBase.h.
|
protected |
KS: This is used when printing parameters, sometimes we have super long parameters name, we want to flexibly adjust couts.
Definition at line 428 of file ParameterHandlerBase.h.
|
protected |
KS: Set Random numbers for each thread so each thread has different seed.
Definition at line 418 of file ParameterHandlerBase.h.
|
protected |
Random number taken from gaussian around prior error used for corr_throw.
Definition at line 421 of file ParameterHandlerBase.h.
|
protected |
Matrix which we use for step proposal before Cholesky decomposition (not actually used for step proposal)
Definition at line 467 of file ParameterHandlerBase.h.
|
protected |
Throw matrix that is being used in the fit, much faster as TMatrixDSym cache miss.
Definition at line 469 of file ParameterHandlerBase.h.
|
protected |
Struct containing information about adaption.
Definition at line 481 of file ParameterHandlerBase.h.
|
protected |
Are we using AMCMC?
Definition at line 474 of file ParameterHandlerBase.h.