MaCh3  2.2.3
Reference Guide
Functions
Parameter Handler Setters

Functions

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

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:235
int NumParPCA
Number of parameters in PCA base.
Definition: PCAHandler.h:243
TVectorD _fParCurrPCA
CW: Proposed parameter value in PCA base.
Definition: PCAHandler.h:237

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

845  {
846 // ********************************************
847  // loop over parameters and set a branch
848  for (int i = 0; i < _fNumPar; ++i) {
849  tree.Branch(_fNames[i].c_str(), &_fCurrVal[i], Form("%s/D", _fNames[i].c_str()));
850  }
851  // When running PCA, also save PCA parameters
852  if (pca) {
853  PCAObj->SetBranches(tree, SaveProposal, _fNames);
854  }
855  if(SaveProposal)
856  {
857  // loop over parameters and set a branch
858  for (int i = 0; i < _fNumPar; ++i) {
859  tree.Branch(Form("%s_Prop", _fNames[i].c_str()), &_fPropVal[i], Form("%s_Prop/D", _fNames[i].c_str()));
860  }
861  }
862 }
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 367 of file ParameterHandlerBase.cpp.

367  {
368 // ********************************************
369  if (cov == nullptr) {
370  MACH3LOG_ERROR("Could not find covariance matrix you provided to {}", __func__ );
371  throw MaCh3Exception(__FILE__ , __LINE__ );
372  }
373  covMatrix = cov;
374 
375  invCovMatrix = static_cast<TMatrixDSym *>(cov->Clone());
376  invCovMatrix->Invert();
377  //KS: ROOT has bad memory management, using standard double means we can decrease most operation by factor 2 simply due to cache hits
378  for (int i = 0; i < _fNumPar; i++)
379  {
380  for (int j = 0; j < _fNumPar; ++j)
381  {
382  InvertCovMatrix[i][j] = (*invCovMatrix)(i,j);
383  }
384  }
385 
386  SetThrowMatrix(cov);
387 }
#define MACH3LOG_ERROR
Definition: MaCh3Logger.h:27
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 948 of file ParameterHandlerBase.cpp.

948  {
949 // ********************************************
950  if (i > _fNumPar) {
951  MACH3LOG_INFO("Can't {} for Cov={}/Param={} because size of Covariance = {}", __func__, GetName(), i, _fNumPar);
952  MACH3LOG_ERROR("Fix this in your config file please!");
953  throw MaCh3Exception(__FILE__ , __LINE__ );
954  } else {
955  if(eL){
956  MACH3LOG_INFO("Setting {} (parameter {}) to flat prior", GetParName(i), i);
957  }
958  else{
959  // HW :: This is useful
960  MACH3LOG_INFO("Setting {} (parameter {}) to non-flat prior", GetParName(i), i);
961  }
962  _fFlatPrior[i] = eL;
963  }
964 }
#define MACH3LOG_INFO
Definition: MaCh3Logger.h:25
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 @ParameterHandlerBase::SetParameters

Definition at line 690 of file ParameterHandlerGeneric.cpp.

690  {
691 // ********************************************
692  // If empty, set the proposed to prior
693  if (Pars.empty()) {
694  for (int i = 0; i < _fNumPar; i++) {
695  if(IsParFromGroup(i, Group)) _fPropVal[i] = _fPreFitValue[i];
696  }
697  } else{
698  const size_t ExpectedSize = static_cast<size_t>(GetNumParFromGroup(Group));
699  if (Pars.size() != ExpectedSize) {
700  MACH3LOG_ERROR("Number of param in group {} is {}, while you passed {}", Group, ExpectedSize, Pars.size());
701  throw MaCh3Exception(__FILE__, __LINE__);
702  }
703  int Counter = 0;
704  for (int i = 0; i < _fNumPar; i++) {
705  // If belongs to group set value from parsed vector, otherwise use propose value
706  if(IsParFromGroup(i, Group)){
707  _fPropVal[i] = Pars[Counter];
708  Counter++;
709  }
710  }
711  }
712  // And if pca make the transfer
713  if (pca) {
714  PCAObj->TransferToPCA();
715  PCAObj->TransferToParam();
716  }
717 }
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
Groupsvector of group names, like Xsec or Flux

Definition at line 681 of file ParameterHandlerGeneric.cpp.

681  {
682 // ********************************************
683  for(size_t i = 0; i < Groups.size(); i++){
684  SetGroupOnlyParameters(Groups[i]);
685  }
686 }
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 107 of file ParameterHandlerBase.h.

107 { _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 967 of file ParameterHandlerBase.cpp.

967  {
968 // ********************************************
969  if (int(stepscale.size()) != _fNumPar)
970  {
971  MACH3LOG_WARN("Stepscale vector not equal to number of parameters. Quitting..");
972  MACH3LOG_WARN("Size of argument vector: {}", stepscale.size());
973  MACH3LOG_WARN("Expected size: {}", _fNumPar);
974  return;
975  }
976 
977  for (int iParam = 0 ; iParam < _fNumPar; iParam++) {
978  _fIndivStepScale[iParam] = stepscale[iParam];
979  }
981 }
#define MACH3LOG_WARN
Definition: MaCh3Logger.h:26
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 205 of file ParameterHandlerBase.h.

205  {
206  AdaptiveHandler->SetTotalSteps(nsteps);
207  if(AdaptiveHandler->AdaptionUpdate()) ResetIndivStepScale();
208  }
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 427 of file ParameterHandlerBase.cpp.

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

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

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

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

131  {
132  if (int(pars.size()) != NumParPCA) {
133  MACH3LOG_ERROR("Parameter arrays of incompatible size! Not changing parameters! has size {} but was expecting {}", pars.size(), NumParPCA);
134  throw MaCh3Exception(__FILE__ , __LINE__ );
135  }
136  int parsSize = int(pars.size());
137  for (int i = 0; i < parsSize; i++) {
138  _fParPropPCA(i) = pars[i];
139  }
140  //KS: Transfer to normal base
141  TransferToParam();
142  }
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 171 of file PCAHandler.h.

171  {
172  _fParCurrPCA(i) = value;
173  // And then transfer back to the parameter basis
174  TransferToParam();
175  }

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

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

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

162  {
163  _fParPropPCA(i) = value;
164  // And then transfer back to the parameter basis
165  TransferToParam();
166  }

◆ SetPrintLength()

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

KS: In case someone really want to change this.

Definition at line 114 of file ParameterHandlerBase.h.

114 { 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 541 of file ParameterHandlerBase.cpp.

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

◆ SetStepScale()

void ParameterHandlerBase::SetStepScale ( const double  scale,
const bool  verbose = true 
)

Set global step scale for covariance object.

Parameters
scaleValue of global step scale
verbosePrint that we've changed scale + use warnings [default: true] [22]

Definition at line 865 of file ParameterHandlerBase.cpp.

865  {
866 // ********************************************
867  if(scale <= 0) {
868  MACH3LOG_ERROR("You are trying so set StepScale to 0 or negative this will not work");
869  throw MaCh3Exception(__FILE__ , __LINE__ );
870  }
871 
872  if(verbose){
873  MACH3LOG_INFO("{} setStepScale() = {}", GetName(), scale);
874  const double SuggestedScale = 2.38*2.38/_fNumPar;
875  if(std::fabs(scale - SuggestedScale)/SuggestedScale > 1) {
876  MACH3LOG_WARN("Defined Global StepScale is {}, while suggested suggested {}", scale, SuggestedScale);
877  }
878  }
879  _fGlobalStepScale = scale;
880 }
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 1019 of file ParameterHandlerBase.cpp.

1019  {
1020 // ********************************************
1021  if (cov == nullptr) {
1022  MACH3LOG_ERROR("Could not find covariance matrix you provided to {}", __func__);
1023  throw MaCh3Exception(__FILE__ , __LINE__ );
1024  }
1025 
1026  if (covMatrix->GetNrows() != cov->GetNrows()) {
1027  MACH3LOG_ERROR("Matrix given for throw Matrix is not the same size as the covariance matrix stored in object!");
1028  MACH3LOG_ERROR("Stored covariance matrix size: {}", covMatrix->GetNrows());
1029  MACH3LOG_ERROR("Given matrix size: {}", cov->GetNrows());
1030  throw MaCh3Exception(__FILE__ , __LINE__ );
1031  }
1032 
1033  throwMatrix = static_cast<TMatrixDSym*>(cov->Clone());
1034  if(use_adaptive && AdaptiveHandler->AdaptionUpdate()) MakeClosestPosDef(throwMatrix);
1035  else MakePosDef(throwMatrix);
1036 
1037  auto throwMatrix_CholDecomp = M3::GetCholeskyDecomposedMatrix(*throwMatrix, matrixName);
1038 
1039  //KS: ROOT has bad memory management, using standard double means we can decrease most operation by factor 2 simply due to cache hits
1040  #ifdef MULTITHREAD
1041  #pragma omp parallel for collapse(2)
1042  #endif
1043  for (int i = 0; i < _fNumPar; ++i)
1044  {
1045  for (int j = 0; j < _fNumPar; ++j)
1046  {
1047  throwMatrixCholDecomp[i][j] = throwMatrix_CholDecomp[i][j];
1048  }
1049  }
1050 }
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...
void MakePosDef(TMatrixDSym *cov=nullptr)
Make matrix positive definite by adding small values to diagonal, necessary for inverting matrix.
std::vector< std::vector< double > > GetCholeskyDecomposedMatrix(const TMatrixDSym &matrix, const std::string &matrixName)
Computes Cholesky decomposition of a symmetric positive definite matrix using custom function which c...

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

1275  {
1276 // ********************************************
1277  if(Tunes == nullptr) {
1278  MACH3LOG_ERROR("Tunes haven't been initialised, which are being loaded from YAML, have you used some deprecated constructor");
1279  throw MaCh3Exception(__FILE__, __LINE__);
1280  }
1281  auto Values = Tunes->GetTune(TuneName);
1282 
1283  SetParameters(Values);
1284 }
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:239

◆ 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:241
std::vector< double > * _pCurrVal
Pointer to current value of the parameter.
Definition: PCAHandler.h:266