MaCh3  2.2.3
Reference Guide
Functions
Parameter Handler Getters

Functions

int adaptive_mcmc::AdaptiveMCMCHandler::GetNumParams () const
 Get the current values of the parameters. More...
 
int adaptive_mcmc::AdaptiveMCMCHandler::GetTotalSteps () const
 Get Total Number of Steps. More...
 
TMatrixDSym * adaptive_mcmc::AdaptiveMCMCHandler::GetAdaptiveCovariance () const
 Increase by one number of total steps. More...
 
std::vector< double > adaptive_mcmc::AdaptiveMCMCHandler::GetParameterMeans () const
 Get the parameter means used in the adaptive handler. More...
 
std::string adaptive_mcmc::AdaptiveMCMCHandler::GetOutFileName () const
 Get Name of Output File. More...
 
double ParameterHandlerBase::GetRandomThrow (const int i) const
 Get random value useful for debugging/CI. More...
 
virtual double ParameterHandlerBase::GetLikelihood ()
 Return CalcLikelihood if some params were thrown out of boundary return LARGE_LOGL More...
 
TMatrixDSym * ParameterHandlerBase::GetCovMatrix () const
 Return covariance matrix. More...
 
TMatrixDSym * ParameterHandlerBase::GetInvCovMatrix () const
 Return inverted covariance matrix. More...
 
double ParameterHandlerBase::GetInvCovMatrix (const int i, const int j) const
 Return inverted covariance matrix. More...
 
double ParameterHandlerBase::GetCorrThrows (const int i) const
 Return correlated throws. More...
 
bool ParameterHandlerBase::GetFlatPrior (const int i) const
 Get if param has flat prior or not. More...
 
std::string ParameterHandlerBase::GetName () const
 Get name of covariance. More...
 
std::string ParameterHandlerBase::GetParName (const int i) const
 Get name of parameter. More...
 
int ParameterHandlerBase::GetParIndex (const std::string &name) const
 Get index based on name. More...
 
std::string ParameterHandlerBase::GetParFancyName (const int i) const
 Get fancy name of the Parameter. More...
 
std::string ParameterHandlerBase::GetInputFile () const
 Get name of input file. More...
 
double ParameterHandlerBase::GetDiagonalError (const int i) const
 Get diagonal error for ith parameter. More...
 
double ParameterHandlerBase::GetError (const int i) const
 Get the error for the ith parameter. More...
 
bool ParameterHandlerBase::GetDoAdaption () const
 Do we adapt or not. More...
 
TMatrixDSym * ParameterHandlerBase::GetThrowMatrix () const
 Get matrix used for step proposal. More...
 
double ParameterHandlerBase::GetThrowMatrix (const int i, const int j) const
 Get matrix used for step proposal. More...
 
TH2D * ParameterHandlerBase::GetCorrelationMatrix ()
 KS: Convert covariance matrix to correlation matrix and return TH2D which can be used for fancy plotting. More...
 
int ParameterHandlerBase::GetNumParams () const
 Get total number of parameters. More...
 
std::vector< double > ParameterHandlerBase::GetPreFitValues () const
 Get the pre-fit values of the parameters. More...
 
std::vector< double > ParameterHandlerBase::GetProposed () const
 Get vector of all proposed parameter values. More...
 
double ParameterHandlerBase::GetParProp (const int i) const
 Get proposed parameter value. More...
 
double ParameterHandlerBase::GetParCurr (const int i) const
 Get current parameter value. More...
 
const std::vector< double > & ParameterHandlerBase::GetParCurrVec () const
 Get vector of current parameter values. More...
 
double ParameterHandlerBase::GetParInit (const int i) const
 Get prior parameter value. More...
 
double ParameterHandlerBase::GetUpperBound (const int i) const
 Get upper parameter bound in which it is physically valid. More...
 
double ParameterHandlerBase::GetLowerBound (const int i) const
 Get lower parameter bound in which it is physically valid. More...
 
double ParameterHandlerBase::GetIndivStepScale (const int ParameterIndex) const
 Get individual step scale for selected parameter. More...
 
double ParameterHandlerBase::GetGlobalStepScale () const
 Get global step scale for covariance object. More...
 
int ParameterHandlerBase::GetNParameters () const
 Get number of params which will be different depending if using Eigen decomposition or not. More...
 
YAML::Node ParameterHandlerBase::GetConfig () const
 Getter to return a copy of the YAML node. More...
 
adaptive_mcmc::AdaptiveMCMCHandlerParameterHandlerBase::GetAdaptiveHandler () const
 Get pointer for AdaptiveHandler. More...
 
std::vector< std::string > ParameterHandlerGeneric::GetParSampleID (const int i) const
 ETA - just return the int of the SampleName, this can be removed to do a string comp at some point. More...
 
std::string ParameterHandlerGeneric::GetParamTypeString (const int i) const
 ETA - just return a string of "spline", "norm" or "functional". More...
 
SystType ParameterHandlerGeneric::GetParamType (const int i) const
 Returns enum describing our param type. More...
 
const std::vector< SplineInterpolationParameterHandlerGeneric::GetSplineInterpolationFromSampleName (const std::string &SampleName)
 Get the interpolation types for splines affecting a particular SampleName. More...
 
std::string ParameterHandlerGeneric::GetParSplineName (const int i) const
 Get the name of the spline associated with the spline at index i. More...
 
const std::vector< int > ParameterHandlerGeneric::GetGlobalSystIndexFromSampleName (const std::string &SampleName, const SystType Type)
 DB Get spline parameters depending on given SampleName. More...
 
double ParameterHandlerGeneric::GetParSplineKnotUpperBound (const int i) const
 EM: value at which we cap spline knot weight. More...
 
double ParameterHandlerGeneric::GetParSplineKnotLowerBound (const int i) const
 EM: value at which we cap spline knot weight. More...
 
int ParameterHandlerGeneric::GetNumParamsFromSampleName (const std::string &SampleName, const SystType Type)
 DB Grab the number of parameters for the relevant SampleName. More...
 
const std::vector< std::string > ParameterHandlerGeneric::GetParsNamesFromSampleName (const std::string &SampleName, const SystType Type)
 DB Grab the parameter names for the relevant SampleName. More...
 
const std::vector< int > ParameterHandlerGeneric::GetParsIndexFromSampleName (const std::string &SampleName, const SystType Type)
 DB Grab the parameter indices for the relevant SampleName. More...
 
const std::vector< std::string > ParameterHandlerGeneric::GetSplineParsNamesFromSampleName (const std::string &SampleName)
 DB Get spline parameters depending on given SampleName. More...
 
const std::vector< std::string > ParameterHandlerGeneric::GetSplineFileParsNamesFromSampleName (const std::string &SampleName)
 DB Get spline parameters depending on given SampleName. More...
 
const std::vector< std::vector< int > > ParameterHandlerGeneric::GetSplineModeVecFromSampleName (const std::string &SampleName)
 DB Grab the Spline Modes for the relevant SampleName. More...
 
const std::vector< int > ParameterHandlerGeneric::GetSystIndexFromSampleName (const std::string &SampleName, const SystType Type) const
 Grab the index of the syst relative to global numbering. More...
 
const std::vector< NormParameterParameterHandlerGeneric::GetNormParsFromSampleName (const std::string &SampleName) const
 DB Get norm/func parameters depending on given SampleName. More...
 
const std::vector< FunctionalParameterParameterHandlerGeneric::GetFunctionalParametersFromSampleName (const std::string &SampleName) const
 HH Get functional parameters for the relevant SampleName. More...
 
const std::vector< SplineParameterParameterHandlerGeneric::GetSplineParsFromSampleName (const std::string &SampleName) const
 KS: Grab the Spline parameters for the relevant SampleName. More...
 
bool ParameterHandlerGeneric::IsParFromGroup (const int i, const std::string &Group) const
 Checks if parameter belongs to a given group. More...
 
int ParameterHandlerGeneric::GetNumParFromGroup (const std::string &Group) const
 KS: Check how many parameters are associated with given group. More...
 
std::vector< std::string > ParameterHandlerGeneric::GetUniqueParameterGroups ()
 KS: Get names of all unique parameter groups. More...
 
std::vector< const double * > ParameterHandlerGeneric::GetOscParsFromSampleName (const std::string &SampleName)
 Get pointers to Osc params from Sample name. More...
 
bool PCAHandler::IsParameterFixedPCA (const int i) const
 Is parameter fixed in PCA base or not. More...
 
const TMatrixD PCAHandler::GetEigenVectors () const
 Get eigen vectors of covariance matrix, only works with PCA. More...
 
double PCAHandler::GetParPropPCA (const int i) const
 Get current parameter value using PCA. More...
 
double PCAHandler::GetPreFitValuePCA (const int i) const
 Get current parameter value using PCA. More...
 
double PCAHandler::GetParCurrPCA (const int i) const
 Get current parameter value using PCA. More...
 
const TMatrixD PCAHandler::GetTransferMatrix () const
 Get transfer matrix allowing to go from PCA base to normal base. More...
 
const TVectorD PCAHandler::GetEigenValues () const
 Get eigen values for all parameters, if you want for decomposed only parameters use GetEigenValuesMaster. More...
 
const std::vector< double > PCAHandler::GetEigenValuesMaster () const
 Get eigen value of only decomposed parameters, if you want for all parameters use GetEigenValues. More...
 
bool PCAHandler::IsParameterDecomposed (const int i) const
 Check if parameter in PCA base is decomposed or not. More...
 

Detailed Description

Group of functions to get various parameters, names, and values.

Function Documentation

◆ GetAdaptiveCovariance()

TMatrixDSym* adaptive_mcmc::AdaptiveMCMCHandler::GetAdaptiveCovariance ( ) const
inline

Increase by one number of total steps.

Definition at line 115 of file AdaptiveMCMCHandler.h.

115  {
116  return adaptive_covariance;
117  }
TMatrixDSym * adaptive_covariance
Full adaptive covariance matrix.

◆ GetAdaptiveHandler()

adaptive_mcmc::AdaptiveMCMCHandler* ParameterHandlerBase::GetAdaptiveHandler ( ) const
inline

Get pointer for AdaptiveHandler.

Definition at line 345 of file ParameterHandlerBase.h.

345  {
346  if (!use_adaptive) {
347  MACH3LOG_ERROR("Am not running in Adaptive mode");
348  throw MaCh3Exception(__FILE__ , __LINE__ );
349  }
350  return AdaptiveHandler.get();
351  }
#define MACH3LOG_ERROR
Definition: MaCh3Logger.h:27
Custom exception class for MaCh3 errors.
bool use_adaptive
Are we using AMCMC?
std::unique_ptr< adaptive_mcmc::AdaptiveMCMCHandler > AdaptiveHandler
Struct containing information about adaption.

◆ GetConfig()

YAML::Node ParameterHandlerBase::GetConfig ( ) const
inline

Getter to return a copy of the YAML node.

Definition at line 341 of file ParameterHandlerBase.h.

341 { return _fYAMLDoc; }
YAML::Node _fYAMLDoc
Stores config describing systematics.

◆ GetCorrelationMatrix()

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.

Returns
A pointer to a TH2D object representing the correlation matrix

Definition at line 1182 of file ParameterHandlerBase.cpp.

1182  {
1183 // ********************************************
1184  TH2D* hMatrix = new TH2D(GetName().c_str(), GetName().c_str(), _fNumPar, 0.0, _fNumPar, _fNumPar, 0.0, _fNumPar);
1185  hMatrix->SetDirectory(nullptr);
1186  for(int i = 0; i < _fNumPar; i++)
1187  {
1188  hMatrix->SetBinContent(i+1, i+1, 1.);
1189  hMatrix->GetXaxis()->SetBinLabel(i+1, GetParFancyName(i).c_str());
1190  hMatrix->GetYaxis()->SetBinLabel(i+1, GetParFancyName(i).c_str());
1191  }
1192 
1193  #ifdef MULTITHREAD
1194  #pragma omp parallel for
1195  #endif
1196  for(int i = 0; i < _fNumPar; i++)
1197  {
1198  for(int j = 0; j <= i; j++)
1199  {
1200  const double Corr = (*covMatrix)(i,j) / ( GetDiagonalError(i) * GetDiagonalError(j));
1201  hMatrix->SetBinContent(i+1, j+1, Corr);
1202  hMatrix->SetBinContent(j+1, i+1, Corr);
1203  }
1204  }
1205  return hMatrix;
1206 }
int _fNumPar
Number of systematic parameters.
std::string GetParFancyName(const int i) const
Get fancy name of the Parameter.
std::string GetName() const
Get name of covariance.
double GetDiagonalError(const int i) const
Get diagonal error for ith parameter.

◆ GetCorrThrows()

double ParameterHandlerBase::GetCorrThrows ( const int  i) const
inline

Return correlated throws.

Parameters
iParameter index

Definition at line 150 of file ParameterHandlerBase.h.

150 { return corr_throw[i]; }
double * corr_throw
Result of multiplication of Cholesky matrix and randParams.

◆ GetCovMatrix()

TMatrixDSym* ParameterHandlerBase::GetCovMatrix ( ) const
inline

Return covariance matrix.

Definition at line 139 of file ParameterHandlerBase.h.

139 { return covMatrix; }
TMatrixDSym * covMatrix
The covariance matrix.

◆ GetDiagonalError()

double ParameterHandlerBase::GetDiagonalError ( const int  i) const
inline

Get diagonal error for ith parameter.

Parameters
iParameter index

Definition at line 180 of file ParameterHandlerBase.h.

180 { return std::sqrt((*covMatrix)(i,i)); }

◆ GetDoAdaption()

bool ParameterHandlerBase::GetDoAdaption ( ) const
inline

Do we adapt or not.

Definition at line 198 of file ParameterHandlerBase.h.

198 {return use_adaptive;}

◆ GetEigenValues()

const TVectorD PCAHandler::GetEigenValues ( ) const
inline

Get eigen values for all parameters, if you want for decomposed only parameters use GetEigenValuesMaster.

Definition at line 206 of file PCAHandler.h.

206  {
207  return eigen_values;
208  }
TVectorD eigen_values
Eigen value only of particles which are being decomposed.
Definition: PCAHandler.h:250

◆ GetEigenValuesMaster()

const std::vector<double> PCAHandler::GetEigenValuesMaster ( ) const
inline

Get eigen value of only decomposed parameters, if you want for all parameters use GetEigenValues.

Definition at line 211 of file PCAHandler.h.

211  {
212  return eigen_values_master;
213  }
std::vector< double > eigen_values_master
Eigen values which have dimension equal to _fNumParPCA, and can be used in CorrelateSteps.
Definition: PCAHandler.h:254

◆ GetEigenVectors()

const TMatrixD PCAHandler::GetEigenVectors ( ) const
inline

Get eigen vectors of covariance matrix, only works with PCA.

Definition at line 154 of file PCAHandler.h.

154  {
155  return eigen_vectors;
156  }
TMatrixD eigen_vectors
Eigen vectors only of params which are being decomposed.
Definition: PCAHandler.h:252

◆ GetError()

double ParameterHandlerBase::GetError ( const int  i) const
inline

Get the error for the ith parameter.

Parameters
iParameter index

Definition at line 184 of file ParameterHandlerBase.h.

184 {return _fError[i];}
std::vector< double > _fError
Prior error on the parameter.

◆ GetFlatPrior()

bool ParameterHandlerBase::GetFlatPrior ( const int  i) const
inline

Get if param has flat prior or not.

Parameters
iParameter index

Definition at line 155 of file ParameterHandlerBase.h.

155 { return _fFlatPrior[i]; }
std::vector< bool > _fFlatPrior
Whether to apply flat prior or not.

◆ GetFunctionalParametersFromSampleName()

const std::vector< FunctionalParameter > ParameterHandlerGeneric::GetFunctionalParametersFromSampleName ( const std::string &  SampleName) const

HH Get functional parameters for the relevant SampleName.

Definition at line 342 of file ParameterHandlerGeneric.cpp.

342  {
343 // ********************************************
345 }
@ kFunc
For functional parameters.
std::vector< std::map< int, int > > _fSystToGlobalSystIndexMap
Map between number of given parameter type with global parameter numbering. For example 2nd norm para...
std::vector< ParamT > GetTypeParamsFromSampleName(const std::map< int, int > &indexMap, const std::vector< ParamT > &params, const std::string &SampleName) const
Retrieve parameters that apply to a given sample name.
std::vector< FunctionalParameter > FuncParams
Vector containing info for functional systematics.

◆ GetGlobalStepScale()

double ParameterHandlerBase::GetGlobalStepScale ( ) const
inline

Get global step scale for covariance object.

Definition at line 279 of file ParameterHandlerBase.h.

279 {return _fGlobalStepScale; }
double _fGlobalStepScale
Global step scale applied to all params in this class.

◆ GetGlobalSystIndexFromSampleName()

const std::vector< int > ParameterHandlerGeneric::GetGlobalSystIndexFromSampleName ( const std::string &  SampleName,
const SystType  Type 
)

DB Get spline parameters depending on given SampleName.

Definition at line 233 of file ParameterHandlerGeneric.cpp.

233  {
234 // ********************************************
235  std::vector<int> returnVec;
236  for (auto &pair : _fSystToGlobalSystIndexMap[Type]) {
237  auto &SystIndex = pair.second;
238  if (AppliesToSample(SystIndex, SampleName)) { //If parameter applies to required SampleID
239  returnVec.push_back(SystIndex);
240  }
241  }
242  return returnVec;
243 }
bool AppliesToSample(const int SystIndex, const std::string &SampleName) const
Check if parameter is affecting given sample name.

◆ GetIndivStepScale()

double ParameterHandlerBase::GetIndivStepScale ( const int  ParameterIndex) const
inline

Get individual step scale for selected parameter.

Parameters
ParameterIndexParameter index

Definition at line 276 of file ParameterHandlerBase.h.

276 {return _fIndivStepScale.at(ParameterIndex); }
std::vector< double > _fIndivStepScale
Individual step scale used by MCMC algorithm.

◆ GetInputFile()

std::string ParameterHandlerBase::GetInputFile ( ) const
inline

Get name of input file.

Definition at line 175 of file ParameterHandlerBase.h.

175 { return inputFile; }
const std::string inputFile
The input root file we read in.

◆ GetInvCovMatrix() [1/2]

TMatrixDSym* ParameterHandlerBase::GetInvCovMatrix ( ) const
inline

Return inverted covariance matrix.

Definition at line 142 of file ParameterHandlerBase.h.

142 { return invCovMatrix; }
TMatrixDSym * invCovMatrix
The inverse covariance matrix.

◆ GetInvCovMatrix() [2/2]

double ParameterHandlerBase::GetInvCovMatrix ( const int  i,
const int  j 
) const
inline

Return inverted covariance matrix.

Definition at line 145 of file ParameterHandlerBase.h.

145 { return InvertCovMatrix[i][j]; }
std::vector< std::vector< double > > InvertCovMatrix
KS: Same as above but much faster as TMatrixDSym cache miss.

◆ GetLikelihood()

double ParameterHandlerBase::GetLikelihood ( )
virtual

Return CalcLikelihood if some params were thrown out of boundary return LARGE_LOGL

Reimplemented in PyParameterHandlerBase.

Definition at line 800 of file ParameterHandlerBase.cpp.

800  {
801 // ********************************************
802  // Default behaviour is to reject negative values + do std llh calculation
803  const int NOutside = CheckBounds();
804 
805  if(NOutside > 0) return NOutside*M3::_LARGE_LOGL_;
806 
807  return CalcLikelihood();
808 }
double CalcLikelihood() const _noexcept_
Calc penalty term based on inverted covariance matrix.
int CheckBounds() const _noexcept_
Check if parameters were proposed outside physical boundary.
constexpr static const double _LARGE_LOGL_
Large Likelihood is used it parameter go out of physical boundary, this indicates in MCMC that such s...
Definition: Core.h:73

◆ GetLowerBound()

double ParameterHandlerBase::GetLowerBound ( const int  i) const
inline

Get lower parameter bound in which it is physically valid.

Parameters
iParameter index

Definition at line 272 of file ParameterHandlerBase.h.

272 { return _fLowBound[i]; }
std::vector< double > _fLowBound
Lowest physical bound, parameter will not be able to go beyond it.

◆ GetName()

std::string ParameterHandlerBase::GetName ( ) const
inline

Get name of covariance.

Definition at line 159 of file ParameterHandlerBase.h.

159 { return matrixName; }
std::string matrixName
Name of cov matrix.

◆ GetNormParsFromSampleName()

const std::vector< NormParameter > ParameterHandlerGeneric::GetNormParsFromSampleName ( const std::string &  SampleName) const

DB Get norm/func parameters depending on given SampleName.

Definition at line 349 of file ParameterHandlerGeneric.cpp.

349  {
350 // ********************************************
352 }
@ kNorm
For normalisation parameters.
std::vector< NormParameter > NormParams
Vector containing info for normalisation systematics.

◆ GetNParameters()

int ParameterHandlerBase::GetNParameters ( ) const
inline

Get number of params which will be different depending if using Eigen decomposition or not.

Definition at line 283 of file ParameterHandlerBase.h.

283  {
284  if (pca) return PCAObj->GetNumberPCAedParameters();
285  else return _fNumPar;
286  }
std::unique_ptr< PCAHandler > PCAObj
Struct containing information about PCA.
bool pca
perform PCA or not

◆ GetNumParams() [1/2]

int adaptive_mcmc::AdaptiveMCMCHandler::GetNumParams ( ) const
inline

Get the current values of the parameters.

Definition at line 82 of file AdaptiveMCMCHandler.h.

82  {
83  return static_cast<int>(_fCurrVal->size());
84  }
const std::vector< double > * _fCurrVal
Current values of parameters.

◆ GetNumParams() [2/2]

int ParameterHandlerBase::GetNumParams ( ) const
inline

Get total number of parameters.

Definition at line 242 of file ParameterHandlerBase.h.

242 {return _fNumPar;}

◆ GetNumParamsFromSampleName()

int ParameterHandlerGeneric::GetNumParamsFromSampleName ( const std::string &  SampleName,
const SystType  Type 
)

DB Grab the number of parameters for the relevant SampleName.

Parameters
SampleNameproperty of SampleHandler class based on which we select whether to apply uncertainties or not
TypeType of syst, for example kNorm, kSpline etc

Definition at line 378 of file ParameterHandlerGeneric.cpp.

378  {
379 // ********************************************
380  int returnVal = 0;
381  IterateOverParams(SampleName,
382  [&](int i) { return GetParamType(i) == Type; }, // Filter condition
383  [&](int) { returnVal += 1; } // Action to perform if filter passes
384  );
385  return returnVal;
386 }
void IterateOverParams(const std::string &SampleName, FilterFunc filter, ActionFunc action)
Iterates over parameters and applies a filter and action function.
SystType GetParamType(const int i) const
Returns enum describing our param type.

◆ GetNumParFromGroup()

int ParameterHandlerGeneric::GetNumParFromGroup ( const std::string &  Group) const

KS: Check how many parameters are associated with given group.

Definition at line 734 of file ParameterHandlerGeneric.cpp.

734  {
735 // ********************************************
736  int Counter = 0;
737  for (int i = 0; i < _fNumPar; i++) {
738  if(IsParFromGroup(i, Group)) Counter++;
739  }
740  return Counter;
741 }
bool IsParFromGroup(const int i, const std::string &Group) const
Checks if parameter belongs to a given group.

◆ GetOscParsFromSampleName()

std::vector< const double * > ParameterHandlerGeneric::GetOscParsFromSampleName ( const std::string &  SampleName)

Get pointers to Osc params from Sample name.

Definition at line 745 of file ParameterHandlerGeneric.cpp.

745  {
746 // ********************************************
747  std::vector<const double*> returnVec;
748  for (const auto& pair : _fSystToGlobalSystIndexMap[SystType::kOsc]) {
749  const auto& globalIndex = pair.second;
750  if (AppliesToSample(globalIndex, SampleName)) {
751  returnVec.push_back(RetPointer(globalIndex));
752  }
753  }
754  return returnVec;
755 }
@ kOsc
For oscillation parameters.
const double * RetPointer(const int iParam)
DB Pointer return to param position.

◆ GetOutFileName()

std::string adaptive_mcmc::AdaptiveMCMCHandler::GetOutFileName ( ) const
inline

Get Name of Output File.

Definition at line 127 of file AdaptiveMCMCHandler.h.

127  {
128  return output_file_name;
129  }
std::string output_file_name
Name of the file to save the adaptive matrices into.

◆ GetParameterMeans()

std::vector<double> adaptive_mcmc::AdaptiveMCMCHandler::GetParameterMeans ( ) const
inline

Get the parameter means used in the adaptive handler.

Definition at line 121 of file AdaptiveMCMCHandler.h.

121  {
122  return par_means;
123  }
std::vector< double > par_means
Mean values for all parameters.

◆ GetParamType()

SystType ParameterHandlerGeneric::GetParamType ( const int  i) const
inline

Returns enum describing our param type.

Parameters
iparameter index

Definition at line 36 of file ParameterHandlerGeneric.h.

36 {return _fParamType[i];}
std::vector< SystType > _fParamType
Type of parameter like norm, spline etc.

◆ GetParamTypeString()

std::string ParameterHandlerGeneric::GetParamTypeString ( const int  i) const
inline

ETA - just return a string of "spline", "norm" or "functional".

Parameters
iparameter index

Definition at line 32 of file ParameterHandlerGeneric.h.

32 { return SystType_ToString(_fParamType[i]); }
std::string SystType_ToString(const SystType i)
Convert a Syst type type to a string.

◆ GetParCurr()

double ParameterHandlerBase::GetParCurr ( const int  i) const
inline

Get current parameter value.

Parameters
iParameter index

Definition at line 256 of file ParameterHandlerBase.h.

256 { return _fCurrVal[i]; }
std::vector< double > _fCurrVal
Current value of the parameter.

◆ GetParCurrPCA()

double PCAHandler::GetParCurrPCA ( const int  i) const
inline

Get current parameter value using PCA.

Parameters
iParameter index

Definition at line 194 of file PCAHandler.h.

194  {
195  return _fParCurrPCA(i);
196  }
TVectorD _fParCurrPCA
CW: Proposed parameter value in PCA base.
Definition: PCAHandler.h:237

◆ GetParCurrVec()

const std::vector<double>& ParameterHandlerBase::GetParCurrVec ( ) const
inline

Get vector of current parameter values.

Definition at line 259 of file ParameterHandlerBase.h.

259 { return _fCurrVal; }

◆ GetParFancyName()

std::string ParameterHandlerBase::GetParFancyName ( const int  i) const
inline

Get fancy name of the Parameter.

Parameters
iParameter index

Definition at line 172 of file ParameterHandlerBase.h.

172 {return _fFancyNames[i];}
std::vector< std::string > _fFancyNames
Fancy name for example rather than xsec_0 it is MAQE, useful for human reading.

◆ GetParIndex()

int ParameterHandlerBase::GetParIndex ( const std::string &  name) const

Get index based on name.

Definition at line 883 of file ParameterHandlerBase.cpp.

883  {
884 // ********************************************
885  int Index = M3::_BAD_INT_;
886  for (int i = 0; i <_fNumPar; ++i) {
887  if(name == _fFancyNames[i]) {
888  Index = i;
889  break;
890  }
891  }
892  return Index;
893 }
constexpr static const int _BAD_INT_
Default value used for int initialisation.
Definition: Core.h:48

◆ GetParInit()

double ParameterHandlerBase::GetParInit ( const int  i) const
inline

Get prior parameter value.

Parameters
iParameter index

Definition at line 264 of file ParameterHandlerBase.h.

264 { return _fPreFitValue[i]; }
std::vector< double > _fPreFitValue
Parameter value dictated by the prior model. Based on it penalty term is calculated.

◆ GetParName()

std::string ParameterHandlerBase::GetParName ( const int  i) const
inline

Get name of parameter.

Parameters
iParameter index

Definition at line 163 of file ParameterHandlerBase.h.

163 {return _fNames[i];}
std::vector< std::string > _fNames
ETA _fNames is set automatically in the covariance class to be something like xsec_i,...

◆ GetParProp()

double ParameterHandlerBase::GetParProp ( const int  i) const
inline

Get proposed parameter value.

Parameters
iParameter index

Definition at line 252 of file ParameterHandlerBase.h.

252 { return _fPropVal[i]; }
std::vector< double > _fPropVal
Proposed value of the parameter.

◆ GetParPropPCA()

double PCAHandler::GetParPropPCA ( const int  i) const
inline

Get current parameter value using PCA.

Parameters
iParameter index

Definition at line 180 of file PCAHandler.h.

180  {
181  return _fParPropPCA(i);
182  }
TVectorD _fParPropPCA
CW: Current parameter value in PCA base.
Definition: PCAHandler.h:235

◆ GetParSampleID()

std::vector<std::string> ParameterHandlerGeneric::GetParSampleID ( const int  i) const
inline

ETA - just return the int of the SampleName, this can be removed to do a string comp at some point.

Parameters
iparameter index

Definition at line 28 of file ParameterHandlerGeneric.h.

28 { return _fSampleNames[i];};
std::vector< std::vector< std::string > > _fSampleNames
Tells to which samples object param should be applied.

◆ GetParsIndexFromSampleName()

const std::vector< int > ParameterHandlerGeneric::GetParsIndexFromSampleName ( const std::string &  SampleName,
const SystType  Type 
)

DB Grab the parameter indices for the relevant SampleName.

Parameters
SampleNameproperty of SampleHandler class based on which we select whether to apply uncertainties or not
TypeType of syst, for example kNorm, kSpline etc

Definition at line 402 of file ParameterHandlerGeneric.cpp.

402  {
403 // ********************************************
404  std::vector<int> returnVec;
405  IterateOverParams(SampleName,
406  [&](int i) { return GetParamType(i) == Type; }, // Filter condition
407  [&](int i) { returnVec.push_back(i); } // Action to perform if filter passes
408  );
409  return returnVec;
410 }

◆ GetParsNamesFromSampleName()

const std::vector< std::string > ParameterHandlerGeneric::GetParsNamesFromSampleName ( const std::string &  SampleName,
const SystType  Type 
)

DB Grab the parameter names for the relevant SampleName.

Parameters
SampleNameproperty of SampleHandler class based on which we select whether to apply uncertainties or not
TypeType of syst, for example kNorm, kSpline etc

Definition at line 390 of file ParameterHandlerGeneric.cpp.

390  {
391 // ********************************************
392  std::vector<std::string> returnVec;
393  IterateOverParams(SampleName,
394  [&](int i) { return GetParamType(i) == Type; }, // Filter condition
395  [&](int i) { returnVec.push_back(GetParFancyName(i)); } // Action to perform if filter passes
396  );
397  return returnVec;
398 }

◆ GetParSplineKnotLowerBound()

double ParameterHandlerGeneric::GetParSplineKnotLowerBound ( const int  i) const
inline

EM: value at which we cap spline knot weight.

Parameters
ispline parameter index, not confuse with global index

Definition at line 59 of file ParameterHandlerGeneric.h.

59 {return SplineParams.at(i)._SplineKnotLowBound;}
std::vector< SplineParameter > SplineParams
Vector containing info for normalisation systematics.

◆ GetParSplineKnotUpperBound()

double ParameterHandlerGeneric::GetParSplineKnotUpperBound ( const int  i) const
inline

EM: value at which we cap spline knot weight.

Parameters
ispline parameter index, not confuse with global index

Definition at line 55 of file ParameterHandlerGeneric.h.

55 {return SplineParams.at(i)._SplineKnotUpBound;}

◆ GetParSplineName()

std::string ParameterHandlerGeneric::GetParSplineName ( const int  i) const
inline

Get the name of the spline associated with the spline at index i.

Parameters
ispline parameter index, not to be confused with global index

Definition at line 47 of file ParameterHandlerGeneric.h.

47 {return _fSplineNames[i];}
std::vector< std::string > _fSplineNames
Name of spline in TTree (TBranch),.

◆ GetPreFitValuePCA()

double PCAHandler::GetPreFitValuePCA ( const int  i) const
inline

Get current parameter value using PCA.

Parameters
iParameter index

Definition at line 187 of file PCAHandler.h.

187  {
188  return _fPreFitValuePCA[i];
189  }
std::vector< double > _fPreFitValuePCA
Prefit value for PCA params.
Definition: PCAHandler.h:233

◆ GetPreFitValues()

std::vector<double> ParameterHandlerBase::GetPreFitValues ( ) const
inline

Get the pre-fit values of the parameters.

Definition at line 245 of file ParameterHandlerBase.h.

245 {return _fPreFitValue;}

◆ GetProposed()

std::vector< double > ParameterHandlerBase::GetProposed ( ) const

Get vector of all proposed parameter values.

Definition at line 441 of file ParameterHandlerBase.cpp.

441  {
442 // ********************************************
443  std::vector<double> props(_fNumPar);
444  for (int i = 0; i < _fNumPar; ++i) props[i] = _fPropVal[i];
445  return props;
446 }

◆ GetRandomThrow()

double ParameterHandlerBase::GetRandomThrow ( const int  i) const
inline

Get random value useful for debugging/CI.

Parameters
iParameter index

Definition at line 90 of file ParameterHandlerBase.h.

90 { return randParams[i];}
double * randParams
Random number taken from gaussian around prior error used for corr_throw.

◆ GetSplineFileParsNamesFromSampleName()

const std::vector<std::string> ParameterHandlerGeneric::GetSplineFileParsNamesFromSampleName ( const std::string &  SampleName)

DB Get spline parameters depending on given SampleName.

◆ GetSplineInterpolationFromSampleName()

const std::vector< SplineInterpolation > ParameterHandlerGeneric::GetSplineInterpolationFromSampleName ( const std::string &  SampleName)

Get the interpolation types for splines affecting a particular SampleName.

Definition at line 129 of file ParameterHandlerGeneric.cpp.

129  {
130 // ********************************************
131  std::vector<SplineInterpolation> returnVec;
132  for (auto &pair : _fSystToGlobalSystIndexMap[SystType::kSpline]) {
133  auto &SplineIndex = pair.first;
134  auto &SystIndex = pair.second;
135 
136  if (AppliesToSample(SystIndex, SampleName)) { //If parameter applies to required SampleID
137  returnVec.push_back(SplineParams.at(SplineIndex)._SplineInterpolationType);
138  }
139  }
140  return returnVec;
141 }
@ kSpline
For splined parameters (1D)

◆ GetSplineModeVecFromSampleName()

const std::vector< std::vector< int > > ParameterHandlerGeneric::GetSplineModeVecFromSampleName ( const std::string &  SampleName)

DB Grab the Spline Modes for the relevant SampleName.

Definition at line 145 of file ParameterHandlerGeneric.cpp.

145  {
146 // ********************************************
147  std::vector< std::vector<int> > returnVec;
148  //Need a counter or something to correctly get the index in _fSplineModes since it's not of length nPars
149  //Should probably just make a std::map<std::string, int> for param name to FD spline index
150  for (auto &pair : _fSystToGlobalSystIndexMap[SystType::kSpline]) {
151  auto &SplineIndex = pair.first;
152  auto &SystIndex = pair.second;
153  if (AppliesToSample(SystIndex, SampleName)) { //If parameter applies to required SampleID
154  returnVec.push_back(SplineParams.at(SplineIndex)._fSplineModes);
155  }
156  }
157  return returnVec;
158 }

◆ GetSplineParsFromSampleName()

const std::vector< SplineParameter > ParameterHandlerGeneric::GetSplineParsFromSampleName ( const std::string &  SampleName) const

KS: Grab the Spline parameters for the relevant SampleName.

Definition at line 356 of file ParameterHandlerGeneric.cpp.

356  {
357 // ********************************************
359 }

◆ GetSplineParsNamesFromSampleName()

const std::vector< std::string > ParameterHandlerGeneric::GetSplineParsNamesFromSampleName ( const std::string &  SampleName)

DB Get spline parameters depending on given SampleName.

Definition at line 115 of file ParameterHandlerGeneric.cpp.

115  {
116 // ********************************************
117  std::vector<std::string> returnVec;
118  for (auto &pair : _fSystToGlobalSystIndexMap[SystType::kSpline]) {
119  auto &SplineIndex = pair.first;
120  auto &SystIndex = pair.second;
121  if (AppliesToSample(SystIndex, SampleName)) { //If parameter applies to required Sample
122  returnVec.push_back(_fSplineNames.at(SplineIndex));
123  }
124  }
125  return returnVec;
126 }

◆ GetSystIndexFromSampleName()

const std::vector< int > ParameterHandlerGeneric::GetSystIndexFromSampleName ( const std::string &  SampleName,
const SystType  Type 
) const

Grab the index of the syst relative to global numbering.

Parameters
SampleNameproperty of SampleHandler class based on which we select whether to apply uncertainties or not
TypeType of syst, for example kNorm, kSpline etc

Definition at line 248 of file ParameterHandlerGeneric.cpp.

248  {
249 // ********************************************
250  std::vector<int> returnVec;
251  for (auto &pair : _fSystToGlobalSystIndexMap[Type]) {
252  auto &SplineIndex = pair.first;
253  auto &systIndex = pair.second;
254  if (AppliesToSample(systIndex, SampleName)) { //If parameter applies to required SampleID
255  returnVec.push_back(SplineIndex);
256  }
257  }
258  return returnVec;
259 }

◆ GetThrowMatrix() [1/2]

TMatrixDSym* ParameterHandlerBase::GetThrowMatrix ( ) const
inline

Get matrix used for step proposal.

Definition at line 212 of file ParameterHandlerBase.h.

212 {return throwMatrix;}
TMatrixDSym * throwMatrix
Matrix which we use for step proposal before Cholesky decomposition (not actually used for step propo...

◆ GetThrowMatrix() [2/2]

double ParameterHandlerBase::GetThrowMatrix ( const int  i,
const int  j 
) const
inline

Get matrix used for step proposal.

Definition at line 215 of file ParameterHandlerBase.h.

215 { return throwMatrixCholDecomp[i][j];}
double ** throwMatrixCholDecomp
Throw matrix that is being used in the fit, much faster as TMatrixDSym cache miss.

◆ GetTotalSteps()

int adaptive_mcmc::AdaptiveMCMCHandler::GetTotalSteps ( ) const
inline

Get Total Number of Steps.

Definition at line 99 of file AdaptiveMCMCHandler.h.

99  {
100  return total_steps;
101  }
int total_steps
Total number of MCMC steps.

◆ GetTransferMatrix()

const TMatrixD PCAHandler::GetTransferMatrix ( ) const
inline

Get transfer matrix allowing to go from PCA base to normal base.

Definition at line 200 of file PCAHandler.h.

200  {
201  return TransferMat;
202  }
TMatrixD TransferMat
Matrix used to converting from PCA base to normal base.
Definition: PCAHandler.h:246

◆ GetUniqueParameterGroups()

std::vector< std::string > ParameterHandlerGeneric::GetUniqueParameterGroups ( )

KS: Get names of all unique parameter groups.

Definition at line 642 of file ParameterHandlerGeneric.cpp.

642  {
643 // ********************************************
644  std::unordered_set<std::string> uniqueGroups;
645 
646  // Fill the set with unique values
647  for (const auto& param : _ParameterGroup) {
648  uniqueGroups.insert(param);
649  }
650 
651  // Convert to vector and return
652  std::vector<std::string> result(uniqueGroups.begin(), uniqueGroups.end());
653  return result;
654 }
std::vector< std::string > _ParameterGroup
KS: Allow to group parameters for example to affect only cross-section or only flux etc.

◆ GetUpperBound()

double ParameterHandlerBase::GetUpperBound ( const int  i) const
inline

Get upper parameter bound in which it is physically valid.

Parameters
iParameter index

Definition at line 268 of file ParameterHandlerBase.h.

268 { return _fUpBound[i];}
std::vector< double > _fUpBound
Upper physical bound, parameter will not be able to go beyond it.

◆ IsParameterDecomposed()

bool PCAHandler::IsParameterDecomposed ( const int  i) const
inline

Check if parameter in PCA base is decomposed or not.

Parameters
iParameter index

Definition at line 218 of file PCAHandler.h.

218  {
219  if(isDecomposedPCA[i] >= 0) return false;
220  else return true;
221  }
std::vector< int > isDecomposedPCA
If param is decomposed this will return -1, if not this will return enumerator to param in normal bas...
Definition: PCAHandler.h:241

◆ IsParameterFixedPCA()

bool PCAHandler::IsParameterFixedPCA ( const int  i) const
inline

Is parameter fixed in PCA base or not.

Parameters
iParameter index

Definition at line 147 of file PCAHandler.h.

147  {
148  if (_fErrorPCA[i] < 0) { return true; }
149  else { return false; }
150  }
std::vector< double > _fErrorPCA
Tells if parameter is fixed in PCA base or not.
Definition: PCAHandler.h:239

◆ IsParFromGroup()

bool ParameterHandlerGeneric::IsParFromGroup ( const int  i,
const std::string &  Group 
) const

Checks if parameter belongs to a given group.

Parameters
iparameter index
Groupname of group, like Xsec or Flux
Returns
bool telling whether param is part of group

Definition at line 721 of file ParameterHandlerGeneric.cpp.

721  {
722 // ********************************************
723  std::string groupLower = Group;
724  std::string paramGroupLower = _ParameterGroup[i];
725 
726  // KS: Convert both strings to lowercase, this way comparison will be case insensitive
727  std::transform(groupLower.begin(), groupLower.end(), groupLower.begin(), ::tolower);
728  std::transform(paramGroupLower.begin(), paramGroupLower.end(), paramGroupLower.begin(), ::tolower);
729 
730  return groupLower == paramGroupLower;
731 }