MaCh3 2.2.1
Reference Guide
Loading...
Searching...
No Matches
Functions
Parameter Handler Getters

Functions

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

Detailed Description

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

Function Documentation

◆ GetAdaptiveHandler()

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

Get pointer for AdaptiveHandler.

Definition at line 344 of file ParameterHandlerBase.h.

344 {
345 if (!use_adaptive) {
346 MACH3LOG_ERROR("Am not running in Adaptive mode");
347 throw MaCh3Exception(__FILE__ , __LINE__ );
348 }
349 return AdaptiveHandler.get();
350 }
#define MACH3LOG_ERROR
Definition: MaCh3Logger.h:25
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 340 of file ParameterHandlerBase.h.

340{ 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 1218 of file ParameterHandlerBase.cpp.

1218 {
1219// ********************************************
1220 TH2D* hMatrix = new TH2D(GetName().c_str(), GetName().c_str(), _fNumPar, 0.0, _fNumPar, _fNumPar, 0.0, _fNumPar);
1221
1222 for(int i = 0; i < _fNumPar; i++)
1223 {
1224 hMatrix->SetBinContent(i+1, i+1, 1.);
1225 hMatrix->GetXaxis()->SetBinLabel(i+1, GetParFancyName(i).c_str());
1226 hMatrix->GetYaxis()->SetBinLabel(i+1, GetParFancyName(i).c_str());
1227 }
1228
1229 #ifdef MULTITHREAD
1230 #pragma omp parallel for
1231 #endif
1232 for(int i = 0; i < _fNumPar; i++)
1233 {
1234 for(int j = 0; j <= i; j++)
1235 {
1236 const double Corr = (*covMatrix)(i,j) / ( GetDiagonalError(i) * GetDiagonalError(j));
1237 hMatrix->SetBinContent(i+1, j+1, Corr);
1238 hMatrix->SetBinContent(j+1, i+1, Corr);
1239 }
1240 }
1241 return hMatrix;
1242}
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 149 of file ParameterHandlerBase.h.

149{ 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 138 of file ParameterHandlerBase.h.

138{ 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 179 of file ParameterHandlerBase.h.

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

◆ GetDoAdaption()

bool ParameterHandlerBase::GetDoAdaption ( ) const
inline

Do we adapt or not.

Definition at line 197 of file ParameterHandlerBase.h.

197{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 176 of file PCAHandler.h.

176 {
177 return eigen_values;
178 }
TVectorD eigen_values
Eigen value only of particles which are being decomposed.
Definition: PCAHandler.h:220

◆ 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 181 of file PCAHandler.h.

181 {
182 return eigen_values_master;
183 }
std::vector< double > eigen_values_master
Eigen values which have dimension equal to _fNumParPCA, and can be used in CorrelateSteps.
Definition: PCAHandler.h:224

◆ GetEigenVectors()

const TMatrixD PCAHandler::GetEigenVectors ( ) const
inline

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

Definition at line 124 of file PCAHandler.h.

124 {
125 return eigen_vectors;
126 }
TMatrixD eigen_vectors
Eigen vectors only of params which are being decomposed.
Definition: PCAHandler.h:222

◆ GetError()

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

Get the error for the ith parameter.

Parameters
iParameter index

Definition at line 183 of file ParameterHandlerBase.h.

183{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 154 of file ParameterHandlerBase.h.

154{ 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// ********************************************
344 return GetTypeParamsFromSampleName(_fSystToGlobalSystIndexMap[SystType::kFunc], FuncParams, SampleName);
345}
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 277 of file ParameterHandlerBase.h.

277{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 274 of file ParameterHandlerBase.h.

274{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 174 of file ParameterHandlerBase.h.

174{ 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 141 of file ParameterHandlerBase.h.

141{ 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 144 of file ParameterHandlerBase.h.

144{ 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 798 of file ParameterHandlerBase.cpp.

798 {
799// ********************************************
800 // Default behaviour is to reject negative values + do std llh calculation
801 const int NOutside = CheckBounds();
802
803 if(NOutside > 0) return NOutside*M3::_LARGE_LOGL_;
804
805 return CalcLikelihood();
806}
double CalcLikelihood() const _noexcept_
Calc penalty term based on inverted covariance matrix.
int CheckBounds() const _noexcept_
Check if parameters were proposed outside physical boundary.
static constexpr 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:70

◆ 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 270 of file ParameterHandlerBase.h.

270{ 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 158 of file ParameterHandlerBase.h.

158{ 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// ********************************************
351 return GetTypeParamsFromSampleName(_fSystToGlobalSystIndexMap[SystType::kNorm], NormParams, SampleName);
352}
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 281 of file ParameterHandlerBase.h.

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

◆ GetNumParams()

int ParameterHandlerBase::GetNumParams ( ) const
inline

Get total number of parameters.

Definition at line 244 of file ParameterHandlerBase.h.

244{return _fNumPar;}

◆ GetNumParamsFromSampleName()

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

DB Grab the number of parameters for the relevant SampleName.

Parameters
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 719 of file ParameterHandlerGeneric.cpp.

719 {
720// ********************************************
721 int Counter = 0;
722 for (int i = 0; i < _fNumPar; i++) {
723 if(IsParFromGroup(i, Group)) Counter++;
724 }
725 return Counter;
726}
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 730 of file ParameterHandlerGeneric.cpp.

730 {
731// ********************************************
732 std::vector<const double*> returnVec;
733 for (const auto& pair : _fSystToGlobalSystIndexMap[SystType::kOsc]) {
734 const auto& globalIndex = pair.second;
735 if (AppliesToSample(globalIndex, SampleName)) {
736 returnVec.push_back(RetPointer(globalIndex));
737 }
738 }
739 return returnVec;
740}
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 119 of file AdaptiveMCMCHandler.h.

119 {
120 return output_file_name;
121 }
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 113 of file AdaptiveMCMCHandler.h.

113 {
114 return par_means;
115 }
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 258 of file ParameterHandlerBase.h.

258{ 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 164 of file PCAHandler.h.

164 {
165 return _fParCurrPCA(i);
166 }
TVectorD _fParCurrPCA
CW: Proposed parameter value in PCA base.
Definition: PCAHandler.h:207

◆ GetParFancyName()

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

Get fancy name of the Parameter.

Parameters
iParameter index

Definition at line 171 of file ParameterHandlerBase.h.

171{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 879 of file ParameterHandlerBase.cpp.

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

◆ GetParInit()

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

Get prior parameter value.

Parameters
iParameter index

Definition at line 262 of file ParameterHandlerBase.h.

262{ 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 162 of file ParameterHandlerBase.h.

162{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 254 of file ParameterHandlerBase.h.

254{ 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 150 of file PCAHandler.h.

150 {
151 return _fParPropPCA(i);
152 }
TVectorD _fParPropPCA
CW: Current parameter value in PCA base.
Definition: PCAHandler.h:205

◆ 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
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
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 157 of file PCAHandler.h.

157 {
158 return _fPreFitValuePCA[i];
159 }
std::vector< double > _fPreFitValuePCA
Prefit value for PCA params.
Definition: PCAHandler.h:203

◆ GetPreFitValues()

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

Get the pre-fit values of the parameters.

Definition at line 247 of file ParameterHandlerBase.h.

247{return _fPreFitValue;}

◆ GetProposed()

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

Get vector of all proposed parameter values.

Definition at line 442 of file ParameterHandlerBase.cpp.

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

◆ 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}

◆ 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// ********************************************
358 return GetTypeParamsFromSampleName(_fSystToGlobalSystIndexMap[SystType::kSpline], SplineParams, SampleName);
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
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 211 of file ParameterHandlerBase.h.

211{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 214 of file ParameterHandlerBase.h.

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

◆ GetThrowMatrix_CholDecomp()

TMatrixD * ParameterHandlerBase::GetThrowMatrix_CholDecomp ( ) const
inline

Get the Cholesky decomposition of the throw matrix.

Definition at line 217 of file ParameterHandlerBase.h.

TMatrixD * throwMatrix_CholDecomp
Matrix which we use for step proposal after Cholesky decomposition.

◆ GetTransferMatrix()

const TMatrixD PCAHandler::GetTransferMatrix ( ) const
inline

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

Definition at line 170 of file PCAHandler.h.

170 {
171 return TransferMat;
172 }
TMatrixD TransferMat
Matrix used to converting from PCA base to normal base.
Definition: PCAHandler.h:216

◆ 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 266 of file ParameterHandlerBase.h.

266{ 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 188 of file PCAHandler.h.

188 {
189 if(isDecomposedPCA[i] >= 0) return false;
190 else return true;
191 }
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:211

◆ IsParameterFixedPCA()

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

Is parameter fixed in PCA base or not.

Parameters
iParameter index

Definition at line 117 of file PCAHandler.h.

117 {
118 if (_fErrorPCA[i] < 0) { return true; }
119 else { return false; }
120 }
std::vector< double > _fErrorPCA
Tells if parameter is fixed in PCA base or not.
Definition: PCAHandler.h:209

◆ 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 706 of file ParameterHandlerGeneric.cpp.

706 {
707// ********************************************
708 std::string groupLower = Group;
709 std::string paramGroupLower = _ParameterGroup[i];
710
711 // KS: Convert both strings to lowercase, this way comparison will be case insensitive
712 std::transform(groupLower.begin(), groupLower.end(), groupLower.begin(), ::tolower);
713 std::transform(paramGroupLower.begin(), paramGroupLower.end(), paramGroupLower.begin(), ::tolower);
714
715 return groupLower == paramGroupLower;
716}
std::vector< std::string > _ParameterGroup
KS: Allow to group parameters for example to affect only cross-section or only flux etc.