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

Functions

void ParameterHandlerBase::SetCovMatrix (TMatrixDSym *cov)
 Set covariance matrix.
 
void ParameterHandlerBase::SetName (const std::string &name)
 Set matrix name.
 
void ParameterHandlerBase::SetParName (const int i, const std::string &name)
 change parameter name
 
void ParameterHandlerBase::SetSingleParameter (const int parNo, const double parVal)
 Set value of single param to a given value.
 
void ParameterHandlerBase::SetPar (const int i, const double val)
 Set all the covariance matrix parameters to a user-defined value.
 
void ParameterHandlerBase::SetParCurrProp (const int i, const double val)
 Set current parameter value.
 
void ParameterHandlerBase::SetParProp (const int i, const double val)
 Set proposed parameter value.
 
void ParameterHandlerBase::SetParameters (const std::vector< double > &pars={})
 Set parameter values using vector, it has to have same size as covariance class.
 
void ParameterHandlerBase::SetFlatPrior (const int i, const bool eL)
 Set if parameter should have flat prior or not.
 
void ParameterHandlerBase::SetRandomThrow (const int i, const double rand)
 Set random value useful for debugging/CI.
 
void ParameterHandlerBase::SetBranches (TTree &tree, const bool SaveProposal=false)
 set branches for output file
 
void ParameterHandlerBase::SetStepScale (const double scale)
 Set global step scale for covariance object.
 
void ParameterHandlerBase::SetIndivStepScale (const int ParameterIndex, const double StepScale)
 DB Function to set fIndivStepScale from a vector (Can be used from execs and inside covariance constructors)
 
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)
 
void ParameterHandlerBase::SetPrintLength (const unsigned int PriLen)
 KS: In case someone really want to change this.
 
void ParameterHandlerBase::SetThrowMatrix (TMatrixDSym *cov)
 Use new throw matrix, used in adaptive MCMC.
 
void ParameterHandlerBase::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.
 
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.
 
void ParameterHandlerGeneric::SetGroupOnlyParameters (const std::string &Group, const std::vector< double > &Pars={})
 KS Function to set to prior parameters of a given group or values from vector.
 
void ParameterHandlerGeneric::SetGroupOnlyParameters (const std::vector< std::string > &Groups)
 KS Function to set to prior parameters of a given groups or values from vector.
 
void PCAHandler::SetBranches (TTree &tree, bool SaveProposal, const std::vector< std::string > &Names)
 set branches for output file
 
void PCAHandler::ToggleFixAllParameters ()
 fix parameters at prior values
 
void PCAHandler::ToggleFixParameter (const int i, const std::vector< std::string > &Names)
 fix parameters at prior values
 
void PCAHandler::SetParametersPCA (const std::vector< double > &pars)
 Set values for PCA parameters in PCA base.
 
void PCAHandler::SetParPropPCA (const int i, const double value)
 Set proposed value for parameter in PCA base.
 
void PCAHandler::SetParCurrPCA (const int i, const double value)
 Set current value for parameter in PCA base.
 

Detailed Description

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

Function Documentation

◆ SetBranches() [1/2]

void PCAHandler::SetBranches ( TTree &  tree,
bool  SaveProposal,
const std::vector< std::string > &  Names 
)

set branches for output file

Definition at line 312 of file PCAHandler.cpp.

312 {
313// ********************************************
314 for (int i = 0; i < NumParPCA; ++i) {
315 tree.Branch(Form("%s_PCA", Names[i].c_str()), &_fParCurrPCA.GetMatrixArray()[i], Form("%s_PCA/D", Names[i].c_str()));
316 }
317
318 if(SaveProposal)
319 {
320 for (int i = 0; i < NumParPCA; ++i) {
321 tree.Branch(Form("%s_PCA_Prop", Names[i].c_str()), &_fParPropPCA.GetMatrixArray()[i], Form("%s_PCA_Prop/D", Names[i].c_str()));
322 }
323 }
324}
TVectorD _fParPropPCA
CW: Current parameter value in PCA base.
Definition: PCAHandler.h:205
int NumParPCA
Number of parameters in PCA base.
Definition: PCAHandler.h:213
TVectorD _fParCurrPCA
CW: Proposed parameter value in PCA base.
Definition: PCAHandler.h:207

◆ SetBranches() [2/2]

void ParameterHandlerBase::SetBranches ( TTree &  tree,
const bool  SaveProposal = false 
)

set branches for output file

Parameters
treeTree to which we will save branches
SaveProposalNormally 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 843 of file ParameterHandlerBase.cpp.

843 {
844// ********************************************
845 // loop over parameters and set a branch
846 for (int i = 0; i < _fNumPar; ++i) {
847 tree.Branch(_fNames[i].c_str(), &_fCurrVal[i], Form("%s/D", _fNames[i].c_str()));
848 }
849 // When running PCA, also save PCA parameters
850 if (pca) {
851 PCAObj->SetBranches(tree, SaveProposal, _fNames);
852 }
853 if(SaveProposal)
854 {
855 // loop over parameters and set a branch
856 for (int i = 0; i < _fNumPar; ++i) {
857 tree.Branch(Form("%s_Prop", _fNames[i].c_str()), &_fPropVal[i], Form("%s_Prop/D", _fNames[i].c_str()));
858 }
859 }
860}
std::unique_ptr< PCAHandler > PCAObj
Struct containing information about PCA.
int _fNumPar
Number of systematic parameters.
std::vector< double > _fCurrVal
Current value of the parameter.
std::vector< std::string > _fNames
ETA _fNames is set automatically in the covariance class to be something like xsec_i,...
bool pca
perform PCA or not
std::vector< double > _fPropVal
Proposed value of the parameter.

◆ SetCovMatrix()

void ParameterHandlerBase::SetCovMatrix ( TMatrixDSym *  cov)

Set covariance matrix.

Parameters
covCovariance matrix which we set and will be used later for evaluation of penalty term

Definition at line 368 of file ParameterHandlerBase.cpp.

368 {
369// ********************************************
370 if (cov == nullptr) {
371 MACH3LOG_ERROR("Could not find covariance matrix you provided to {}", __func__ );
372 throw MaCh3Exception(__FILE__ , __LINE__ );
373 }
374 covMatrix = cov;
375
376 invCovMatrix = static_cast<TMatrixDSym *>(cov->Clone());
377 invCovMatrix->Invert();
378 //KS: ROOT has bad memory management, using standard double means we can decrease most operation by factor 2 simply due to cache hits
379 for (int i = 0; i < _fNumPar; i++)
380 {
381 for (int j = 0; j < _fNumPar; ++j)
382 {
383 InvertCovMatrix[i][j] = (*invCovMatrix)(i,j);
384 }
385 }
386
387 SetThrowMatrix(cov);
388}
#define MACH3LOG_ERROR
Definition: MaCh3Logger.h:25
Custom exception class for MaCh3 errors.
TMatrixDSym * invCovMatrix
The inverse covariance matrix.
std::vector< std::vector< double > > InvertCovMatrix
KS: Same as above but much faster as TMatrixDSym cache miss.
TMatrixDSym * covMatrix
The covariance matrix.
void SetThrowMatrix(TMatrixDSym *cov)
Use new throw matrix, used in adaptive MCMC.

◆ SetFlatPrior()

void ParameterHandlerBase::SetFlatPrior ( const int  i,
const bool  eL 
)

Set if parameter should have flat prior or not.

Parameters
iParameter index
eLbool telling if it will be flat or not

Definition at line 944 of file ParameterHandlerBase.cpp.

944 {
945// ********************************************
946 if (i > _fNumPar) {
947 MACH3LOG_INFO("Can't {} for Cov={}/Param={} because size of Covariance = {}", __func__, GetName(), i, _fNumPar);
948 MACH3LOG_ERROR("Fix this in your config file please!");
949 throw MaCh3Exception(__FILE__ , __LINE__ );
950 } else {
951 if(eL){
952 MACH3LOG_INFO("Setting {} (parameter {}) to flat prior", GetParName(i), i);
953 }
954 else{
955 // HW :: This is useful
956 MACH3LOG_INFO("Setting {} (parameter {}) to non-flat prior", GetParName(i), i);
957 }
958 _fFlatPrior[i] = eL;
959 }
960}
#define MACH3LOG_INFO
Definition: MaCh3Logger.h:23
std::vector< bool > _fFlatPrior
Whether to apply flat prior or not.
std::string GetParName(const int i) const
Get name of parameter.
std::string GetName() const
Get name of covariance.

◆ SetGroupOnlyParameters() [1/2]

void ParameterHandlerGeneric::SetGroupOnlyParameters ( const std::string &  Group,
const std::vector< double > &  Pars = {} 
)

KS Function to set to prior parameters of a given group or values from vector.

Parameters
Groupname of group, like Xsec or Flux
ParsValues which will overwrite proposed step
Note
this mimic functionality of @ParameterHandlerBaseSetParameters

Definition at line 675 of file ParameterHandlerGeneric.cpp.

675 {
676// ********************************************
677 // If empty, set the proposed to prior
678 if (Pars.empty()) {
679 for (int i = 0; i < _fNumPar; i++) {
680 if(IsParFromGroup(i, Group)) _fPropVal[i] = _fPreFitValue[i];
681 }
682 } else{
683 const size_t ExpectedSize = static_cast<size_t>(GetNumParFromGroup(Group));
684 if (Pars.size() != ExpectedSize) {
685 MACH3LOG_ERROR("Number of param in group {} is {}, while you passed {}", Group, ExpectedSize, Pars.size());
686 throw MaCh3Exception(__FILE__, __LINE__);
687 }
688 int Counter = 0;
689 for (int i = 0; i < _fNumPar; i++) {
690 // If belongs to group set value from parsed vector, otherwise use propose value
691 if(IsParFromGroup(i, Group)){
692 _fPropVal[i] = Pars[Counter];
693 Counter++;
694 }
695 }
696 }
697 // And if pca make the transfer
698 if (pca) {
699 PCAObj->TransferToPCA();
700 PCAObj->TransferToParam();
701 }
702}
std::vector< double > _fPreFitValue
Parameter value dictated by the prior model. Based on it penalty term is calculated.
bool IsParFromGroup(const int i, const std::string &Group) const
Checks if parameter belongs to a given group.
int GetNumParFromGroup(const std::string &Group) const
KS: Check how many parameters are associated with given group.

◆ SetGroupOnlyParameters() [2/2]

void ParameterHandlerGeneric::SetGroupOnlyParameters ( const std::vector< std::string > &  Groups)

KS Function to set to prior parameters of a given groups or values from vector.

Parameters
Groupvector of group names, like Xsec or Flux

Definition at line 666 of file ParameterHandlerGeneric.cpp.

666 {
667// ********************************************
668 for(size_t i = 0; i < Groups.size(); i++){
669 SetGroupOnlyParameters(Groups[i]);
670 }
671}
void SetGroupOnlyParameters(const std::string &Group, const std::vector< double > &Pars={})
KS Function to set to prior parameters of a given group or values from vector.

◆ SetIndivStepScale() [1/2]

void ParameterHandlerBase::SetIndivStepScale ( const int  ParameterIndex,
const double  StepScale 
)
inline

DB Function to set fIndivStepScale from a vector (Can be used from execs and inside covariance constructors)

Parameters
ParameterIndexParameter Index
StepScaleValue of individual step scale

Definition at line 106 of file ParameterHandlerBase.h.

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

◆ SetIndivStepScale() [2/2]

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)

Parameters
stepscaleVector of individual step scale, should have same

Definition at line 963 of file ParameterHandlerBase.cpp.

963 {
964// ********************************************
965 if (int(stepscale.size()) != _fNumPar)
966 {
967 MACH3LOG_WARN("Stepscale vector not equal to number of parameters. Quitting..");
968 MACH3LOG_WARN("Size of argument vector: {}", stepscale.size());
969 MACH3LOG_WARN("Expected size: {}", _fNumPar);
970 return;
971 }
972
973 for (int iParam = 0 ; iParam < _fNumPar; iParam++) {
974 _fIndivStepScale[iParam] = stepscale[iParam];
975 }
977}
#define MACH3LOG_WARN
Definition: MaCh3Logger.h:24
void PrintIndivStepScale() const
Print step scale for each parameter.

◆ SetName()

void ParameterHandlerBase::SetName ( const std::string &  name)
inline

Set matrix name.

Definition at line 45 of file ParameterHandlerBase.h.

45{ matrixName = name; }
std::string matrixName
Name of cov matrix.

◆ SetNumberOfSteps()

void ParameterHandlerBase::SetNumberOfSteps ( const int  nsteps)
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 204 of file ParameterHandlerBase.h.

204 {
205 AdaptiveHandler->SetTotalSteps(nsteps);
206 if(AdaptiveHandler->AdaptionUpdate()) ResetIndivStepScale();
207 }
std::unique_ptr< adaptive_mcmc::AdaptiveMCMCHandler > AdaptiveHandler
Struct containing information about adaption.
void ResetIndivStepScale()
Adaptive Step Tuning Stuff.

◆ SetPar()

void ParameterHandlerBase::SetPar ( const int  i,
const double  val 
)

Set all the covariance matrix parameters to a user-defined value.

Parameters
iParameter index
valnew value which will be set

Definition at line 428 of file ParameterHandlerBase.cpp.

428 {
429// ********************************************
430 MACH3LOG_INFO("Over-riding {}: ", GetParName(i));
431 MACH3LOG_INFO("_fPropVal ({}), _fCurrVal ({}), _fPreFitValue ({}) to ({})", _fPropVal[i], _fCurrVal[i], _fPreFitValue[i], val);
432
433 _fPropVal[i] = val;
434 _fCurrVal[i] = val;
435 _fPreFitValue[i] = val;
436
437 // Transfer the parameter values to the PCA basis
438 if (pca) PCAObj->TransferToPCA();
439}

◆ SetParameters()

void ParameterHandlerBase::SetParameters ( const std::vector< double > &  pars = {})

Set parameter values using vector, it has to have same size as covariance class.

Parameters
parsVector holding new values for every parameter

Definition at line 810 of file ParameterHandlerBase.cpp.

810 {
811// ********************************************
812 // If empty, set the proposed to prior
813 if (pars.empty()) {
814 // For xsec this means setting to the prior (because prior is the prior)
815 for (int i = 0; i < _fNumPar; i++) {
816 _fPropVal[i] = _fPreFitValue[i];
817 }
818 // If not empty, set the parameters to the specified
819 } else {
820 if (pars.size() != size_t(_fNumPar)) {
821 MACH3LOG_ERROR("Parameter arrays of incompatible size! Not changing parameters! {} has size {} but was expecting {}", matrixName, pars.size(), _fNumPar);
822 throw MaCh3Exception(__FILE__ , __LINE__ );
823 }
824 int parsSize = int(pars.size());
825 for (int i = 0; i < parsSize; i++) {
826 //Make sure that you are actually passing a number to set the parameter to
827 if(std::isnan(pars[i])) {
828 MACH3LOG_ERROR("Trying to set parameter value to a nan for parameter {} in matrix {}. This will not go well!", GetParName(i), matrixName);
829 throw MaCh3Exception(__FILE__ , __LINE__ );
830 } else {
831 _fPropVal[i] = pars[i];
832 }
833 }
834 }
835 // And if pca make the transfer
836 if (pca) {
837 PCAObj->TransferToPCA();
838 PCAObj->TransferToParam();
839 }
840}

◆ SetParametersPCA()

void PCAHandler::SetParametersPCA ( const std::vector< double > &  pars)
inline

Set values for PCA parameters in PCA base.

Parameters
parsvector with new values of PCA params

Definition at line 101 of file PCAHandler.h.

101 {
102 if (int(pars.size()) != NumParPCA) {
103 MACH3LOG_ERROR("Parameter arrays of incompatible size! Not changing parameters! has size {} but was expecting {}", pars.size(), NumParPCA);
104 throw MaCh3Exception(__FILE__ , __LINE__ );
105 }
106 int parsSize = int(pars.size());
107 for (int i = 0; i < parsSize; i++) {
108 _fParPropPCA(i) = pars[i];
109 }
110 //KS: Transfer to normal base
112 }
void TransferToParam()
Transfer param values from PCA base to normal base.
Definition: PCAHandler.cpp:264

◆ SetParCurrPCA()

void PCAHandler::SetParCurrPCA ( const int  i,
const double  value 
)
inline

Set current value for parameter in PCA base.

Parameters
iParameter index
valuenew value

Definition at line 141 of file PCAHandler.h.

141 {
142 _fParCurrPCA(i) = value;
143 // And then transfer back to the parameter basis
145 }

◆ SetParCurrProp()

void ParameterHandlerBase::SetParCurrProp ( const int  i,
const double  val 
)

Set current parameter value.

Parameters
iParameter index
valnew value which will be set

Definition at line 551 of file ParameterHandlerBase.cpp.

551 {
552// ********************************************
553 _fPropVal[parNo] = parVal;
554 _fCurrVal[parNo] = parVal;
555 MACH3LOG_DEBUG("Setting {} (parameter {}) to {})", GetParName(parNo), parNo, parVal);
556 if (pca) PCAObj->TransferToPCA();
557}
#define MACH3LOG_DEBUG
Definition: MaCh3Logger.h:22

◆ SetParName()

void ParameterHandlerBase::SetParName ( const int  i,
const std::string &  name 
)
inline

change parameter name

Parameters
iParameter index
namenew name which will be set

Definition at line 50 of file ParameterHandlerBase.h.

50{ _fNames.at(i) = name; }

◆ SetParProp()

void ParameterHandlerBase::SetParProp ( const int  i,
const double  val 
)
inline

Set proposed parameter value.

Parameters
iParameter index
valnew value which will be set

Definition at line 68 of file ParameterHandlerBase.h.

68 {
69 _fPropVal[i] = val;
70 if (pca) PCAObj->TransferToPCA();
71 }

◆ SetParPropPCA()

void PCAHandler::SetParPropPCA ( const int  i,
const double  value 
)
inline

Set proposed value for parameter in PCA base.

Parameters
iParameter index
valuenew value

Definition at line 132 of file PCAHandler.h.

132 {
133 _fParPropPCA(i) = value;
134 // And then transfer back to the parameter basis
136 }

◆ SetPrintLength()

void ParameterHandlerBase::SetPrintLength ( const unsigned int  PriLen)
inline

KS: In case someone really want to change this.

Definition at line 113 of file ParameterHandlerBase.h.

113{ PrintLength = PriLen; }
int PrintLength
KS: This is used when printing parameters, sometimes we have super long parameters name,...

◆ SetRandomThrow()

void ParameterHandlerBase::SetRandomThrow ( const int  i,
const double  rand 
)
inline

Set random value useful for debugging/CI.

Parameters
iParameter index
randNew value for random number

Definition at line 86 of file ParameterHandlerBase.h.

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

◆ SetSingleParameter()

void ParameterHandlerBase::SetSingleParameter ( const int  parNo,
const double  parVal 
)

Set value of single param to a given value.

Definition at line 542 of file ParameterHandlerBase.cpp.

542 {
543// *************************************
544 _fPropVal[parNo] = parVal;
545 _fCurrVal[parNo] = parVal;
546 MACH3LOG_DEBUG("Setting {} (parameter {}) to {})", GetParName(parNo), parNo, parVal);
547 if (pca) PCAObj->TransferToPCA();
548}

◆ SetStepScale()

void ParameterHandlerBase::SetStepScale ( const double  scale)

Set global step scale for covariance object.

Parameters
scaleValue of global step scale [20]

Definition at line 863 of file ParameterHandlerBase.cpp.

863 {
864// ********************************************
865 if(scale <= 0) {
866 MACH3LOG_ERROR("You are trying so set StepScale to 0 or negative this will not work");
867 throw MaCh3Exception(__FILE__ , __LINE__ );
868 }
869 MACH3LOG_INFO("{} setStepScale() = {}", GetName(), scale);
870 const double SuggestedScale = 2.38*2.38/_fNumPar;
871 if(std::fabs(scale - SuggestedScale)/SuggestedScale > 1) {
872 MACH3LOG_WARN("Defined Global StepScale is {}, while suggested suggested {}", scale, SuggestedScale);
873 }
874
875 _fGlobalStepScale = scale;
876}
double _fGlobalStepScale
Global step scale applied to all params in this class.

◆ SetThrowMatrix()

void ParameterHandlerBase::SetThrowMatrix ( TMatrixDSym *  cov)

Use new throw matrix, used in adaptive MCMC.

Definition at line 1050 of file ParameterHandlerBase.cpp.

1050 {
1051// ********************************************
1052 if (cov == nullptr) {
1053 MACH3LOG_ERROR("Could not find covariance matrix you provided to {}", __func__);
1054 throw MaCh3Exception(__FILE__ , __LINE__ );
1055 }
1056
1057 if (covMatrix->GetNrows() != cov->GetNrows()) {
1058 MACH3LOG_ERROR("Matrix given for throw Matrix is not the same size as the covariance matrix stored in object!");
1059 MACH3LOG_ERROR("Stored covariance matrix size: {}", covMatrix->GetNrows());
1060 MACH3LOG_ERROR("Given matrix size: {}", cov->GetNrows());
1061 throw MaCh3Exception(__FILE__ , __LINE__ );
1062 }
1063
1064 throwMatrix = static_cast<TMatrixDSym*>(cov->Clone());
1066 else MakePosDef(throwMatrix);
1067
1068 TDecompChol TDecompChol_throwMatrix(*throwMatrix);
1069
1070 if(!TDecompChol_throwMatrix.Decompose()) {
1071 MACH3LOG_ERROR("Cholesky decomposition failed for {} trying to make positive definite", matrixName);
1072 throw MaCh3Exception(__FILE__ , __LINE__ );
1073 }
1074
1075 throwMatrix_CholDecomp = new TMatrixD(TDecompChol_throwMatrix.GetU());
1077
1078 //KS: ROOT has bad memory management, using standard double means we can decrease most operation by factor 2 simply due to cache hits
1079 #ifdef MULTITHREAD
1080 #pragma omp parallel for collapse(2)
1081 #endif
1082 for (int i = 0; i < _fNumPar; ++i)
1083 {
1084 for (int j = 0; j < _fNumPar; ++j)
1085 {
1086 throwMatrixCholDecomp[i][j] = (*throwMatrix_CholDecomp)(i,j);
1087 }
1088 }
1089}
bool use_adaptive
Are we using AMCMC?
double ** throwMatrixCholDecomp
Throw matrix that is being used in the fit, much faster as TMatrixDSym cache miss.
TMatrixDSym * throwMatrix
Matrix which we use for step proposal before Cholesky decomposition (not actually used for step propo...
void MakeClosestPosDef(TMatrixDSym *cov)
HW: Finds closest possible positive definite matrix in Frobenius Norm ||.||_frob Where ||X||_frob=sqr...
TMatrixD * throwMatrix_CholDecomp
Matrix which we use for step proposal after Cholesky decomposition.
void MakePosDef(TMatrixDSym *cov=nullptr)
Make matrix positive definite by adding small values to diagonal, necessary for inverting matrix.

◆ SetTune()

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 1311 of file ParameterHandlerBase.cpp.

1311 {
1312// ********************************************
1313 if(Tunes == nullptr) {
1314 MACH3LOG_ERROR("Tunes haven't been initialised, which are being loaded from YAML, have you used some deprecated constructor");
1315 throw MaCh3Exception(__FILE__, __LINE__);
1316 }
1317 auto Values = Tunes->GetTune(TuneName);
1318
1319 SetParameters(Values);
1320}
std::unique_ptr< ParameterTunes > Tunes
Struct containing information about adaption.
void SetParameters(const std::vector< double > &pars={})
Set parameter values using vector, it has to have same size as covariance class.

◆ ToggleFixAllParameters()

void PCAHandler::ToggleFixAllParameters ( )

fix parameters at prior values

Definition at line 327 of file PCAHandler.cpp.

327 {
328// ********************************************
329 for (int i = 0; i < NumParPCA; i++) {
330 _fErrorPCA[i] *= -1.0;
331 }
332}
std::vector< double > _fErrorPCA
Tells if parameter is fixed in PCA base or not.
Definition: PCAHandler.h:209

◆ ToggleFixParameter()

void PCAHandler::ToggleFixParameter ( const int  i,
const std::vector< std::string > &  Names 
)

fix parameters at prior values

Definition at line 335 of file PCAHandler.cpp.

335 {
336// ********************************************
337 int isDecom = -1;
338 for (int im = 0; im < NumParPCA; ++im) {
339 if(isDecomposedPCA[im] == i) {isDecom = im;}
340 }
341 if(isDecom < 0) {
342 MACH3LOG_ERROR("Parameter {} is PCA decomposed can't fix this", Names[i]);
343 //throw MaCh3Exception(__FILE__ , __LINE__ );
344 } else {
345 _fErrorPCA[isDecom] *= -1.0;
346 MACH3LOG_INFO("Setting un-decomposed {}(parameter {}/{} in PCA base) to fixed at {}", Names[i], i, isDecom, (*_pCurrVal)[i]);
347 }
348}
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
std::vector< double > * _pCurrVal
Pointer to current value of the parameter.
Definition: PCAHandler.h:236