8 double threshold,
int FirstPCA,
int LastPCA) {
10 MACH3LOG_INFO(
"Constructing instance of ParameterHandler using");
18 for(
unsigned int i = 0; i < YAMLFile.size(); i++)
24 if (threshold < 0 || threshold >= 1) {
25 MACH3LOG_INFO(
"Principal component analysis but given the threshold for the principal components to be less than 0, or greater than (or equal to) 1. This will not work");
28 MACH3LOG_INFO(
"Am instead calling the usual non-PCA constructor...");
46 std::map<std::pair<int,int>, std::unique_ptr<TMatrixDSym>>& ThrowSubMatrixOverrides) {
48 int running_num_file_pars = 0;
50 _fYAMLDoc[
"Systematics"] = YAML::Node(YAML::NodeType::Sequence);
51 for(
unsigned int i = 0; i < YAMLFile.size(); i++)
55 if (YAMLDocTemp[
"ThrowMatrixOverride"]) {
62 YAMLDocTemp[
"ThrowMatrixOverride"][
"file"].as<std::string>();
63 TFile *submatrix_file = TFile::Open(filename.c_str());
66 YAMLDocTemp[
"ThrowMatrixOverride"][
"matrix"].as<std::string>();
67 std::unique_ptr<TMatrixDSym> submatrix{
68 submatrix_file->Get<TMatrixDSym>(matrixname.c_str())};
71 matrixname, filename);
74 auto numrows = submatrix->GetNrows();
78 ThrowSubMatrixOverrides[{running_num_file_pars,
79 running_num_file_pars + (numrows - 1)}] = std::move(submatrix);
83 if (!
bool(YAMLDocTemp[
"ThrowMatrixOverride"][
"check_names"]) ||
84 YAMLDocTemp[
"ThrowMatrixOverride"][
"check_names"].as<bool>()) {
85 auto nametree = submatrix_file->Get<TTree>(
"param_names");
88 "ThrowMatrixOverride: {{ check_names: False }} to "
89 "disable this check.",
93 std::string *param_name =
nullptr;
94 nametree->SetBranchAddress(
"name", ¶m_name);
96 if (nametree->GetEntries() !=
int(YAMLDocTemp[
"Systematics"].size())) {
98 "the corresponding yaml file only declares {} "
99 "parameters. Set ThrowMatrixOverride: {{ "
100 "check_names: False }} to disable this check.",
101 filename, nametree->GetEntries(),
102 YAMLDocTemp[
"Systematics"].size());
107 for (
const auto ¶m : YAMLDocTemp[
"Systematics"]) {
108 nametree->GetEntry(pit++);
109 auto yaml_pname = Get<std::string>(
110 param[
"Systematic"][
"Names"][
"FancyName"], __FILE__, __LINE__);
111 if ((*param_name) != yaml_pname) {
113 "TTree param_names in file: {} at entry {} has parameter {}, "
115 "the corresponding yaml parameter is named {}. Set "
116 "ThrowMatrixOverride: {{ "
117 "check_names: False }} to disable this check.",
118 filename, pit, (*param_name), yaml_pname);
123 submatrix_file->Close();
126 for (
const auto& item : YAMLDocTemp[
"Systematics"]) {
127 _fYAMLDoc[
"Systematics"].push_back(item);
128 running_num_file_pars++;
135 std::map<std::string, int>& CorrNamesMap) {
139 TMatrixDSym* _fCovMatrix =
new TMatrixDSym(
_fNumPar);
143 for (
auto const& pair : Correlations[j]) {
144 auto const& key = pair.first;
145 auto const& val = pair.second;
148 if (CorrNamesMap.find(key) != CorrNamesMap.end()) {
149 index = CorrNamesMap[key];
151 MACH3LOG_ERROR(
"Parameter {} not in list! Check your spelling?", key);
156 if(Correlations[index].find(
_fFancyNames[j]) != Correlations[index].end()) {
159 constexpr
double tolerance = 1e-6;
160 if(std::abs(Corr2 - Corr1) > tolerance) {
169 (*_fCovMatrix)(j, index)= (*_fCovMatrix)(index, j) = Corr1*
_fError[j]*
_fError[index];
183 std::map<std::pair<int, int>, std::unique_ptr<TMatrixDSym>> ThrowSubMatrixOverrides;
192 std::vector<std::map<std::string,double>> Correlations(
_fNumPar);
193 std::map<std::string, int> CorrNamesMap;
195 std::vector<PendingFunctionalFlipProposal> PendingFunctionalFlipParameters;
199 for (
auto const ¶m :
_fYAMLDoc[
"Systematics"])
201 _fFancyNames[i] = Get<std::string>(param[
"Systematic"][
"Names"][
"FancyName"], __FILE__ , __LINE__);
202 _fPreFitValue[i] = Get<double>(param[
"Systematic"][
"ParameterValues"][
"PreFitValue"], __FILE__ , __LINE__);
203 _fIndivStepScale[i] = Get<double>(param[
"Systematic"][
"StepScale"], __FILE__ , __LINE__);
204 _fError[i] = Get<double>(param[
"Systematic"][
"Error"], __FILE__ , __LINE__);
210 auto TempBoundsVec =
GetBounds(param[
"Systematic"][
"ParameterBounds"]);
215 _fFlatPrior[i] = GetFromManager<bool>(param[
"Systematic"][
"FlatPrior"],
false, __FILE__ , __LINE__);
218 if(GetFromManager<bool>(param[
"Systematic"][
"FixParam"],
false, __FILE__ , __LINE__)) {
222 if(param[
"Systematic"][
"SpecialProposal"]) {
227 CorrNamesMap[param[
"Systematic"][
"Names"][
"FancyName"].as<std::string>()]=i;
230 if(param[
"Systematic"][
"Correlations"]) {
231 for(
unsigned int Corr_i = 0; Corr_i < param[
"Systematic"][
"Correlations"].size(); ++Corr_i){
232 for (YAML::const_iterator it = param[
"Systematic"][
"Correlations"][Corr_i].begin(); it!=param[
"Systematic"][
"Correlations"][Corr_i].end();++it) {
233 Correlations[i][it->first.as<std::string>()] = it->second.as<
double>();
253 for(
auto const & matovr : ThrowSubMatrixOverrides){
257 Tunes = std::make_unique<ParameterTunes>(
_fYAMLDoc[
"Systematics"]);
260 for(
const auto &file : YAMLFile){
288 for (
auto const ¶m :
_fYAMLDoc[
"Systematics"])
290 _ParameterGroup[i] = Get<std::string>(param[
"Systematic"][
"ParameterGroup"], __FILE__ , __LINE__);
291 _fSampleNames[i] = GetFromManager<std::vector<std::string>>(param[
"Systematic"][
"SampleNames"], {}, __FILE__, __LINE__);
294 auto ParamType = Get<std::string>(param[
"Systematic"][
"Type"], __FILE__ , __LINE__);
323 MACH3LOG_ERROR(
"Given unrecognised systematic type: {}", ParamType);
324 std::string expectedTypes =
"Expecting ";
326 if (s > 0) expectedTypes +=
", ";
329 expectedTypes +=
".";
353 std::vector<std::string> returnVec;
356 auto &SystIndex = pair.second;
367 std::vector<SplineInterpolation> returnVec;
370 auto &SystIndex = pair.second;
383 std::vector< std::vector<int> > returnVec;
388 auto &SystIndex = pair.second;
406 norm.
modes = GetFromManager<std::vector<int>>(param[
"Mode"], {}, __FILE__ , __LINE__);
407 norm.
pdgs = GetFromManager<std::vector<int>>(param[
"NeutrinoFlavour"], {}, __FILE__ , __LINE__);
408 norm.
preoscpdgs = GetFromManager<std::vector<int>>(param[
"NeutrinoFlavourUnosc"], {}, __FILE__ , __LINE__);
409 norm.
targets = GetFromManager<std::vector<int>>(param[
"TargetNuclei"], {}, __FILE__ , __LINE__);
412 MACH3LOG_ERROR(
"Normalisation Parameter {} ({}), has lower parameters bound which can go below 0 and is equal {}",
414 MACH3LOG_ERROR(
"Normalisation parameters can't go bellow 0 as this is unphysical");
428 Parameter.
index = Index;
430 int NumKinematicCuts = 0;
431 if(param[
"KinematicCuts"]) {
432 NumKinematicCuts = int(param[
"KinematicCuts"].size());
434 std::vector<std::string> TempKinematicStrings;
435 std::vector<std::vector<std::vector<double>>> TempKinematicBounds;
437 for(
int KinVar_i = 0 ; KinVar_i < NumKinematicCuts ; ++KinVar_i) {
439 for (YAML::const_iterator it = param[
"KinematicCuts"][KinVar_i].begin();it!=param[
"KinematicCuts"][KinVar_i].end();++it) {
440 TempKinematicStrings.push_back(it->first.as<std::string>());
441 TempKinematicBounds.push_back(
Get2DBounds(it->second));
443 if(TempKinematicStrings.size() == 0) {
444 MACH3LOG_ERROR(
"Received a KinematicCuts node but couldn't read the contents (it's a list of single-element dictionaries (python) = map of pairs (C++))");
450 Parameter.
Selection = TempKinematicBounds;
455 bool HasKinBounds =
false;
468 std::vector<int> returnVec;
470 auto &SystIndex = pair.second;
472 returnVec.push_back(SystIndex);
483 std::vector<int> returnVec;
486 auto &systIndex = pair.second;
501 auto& SplinePar = param[
"SplineInformation"];
503 if (SplinePar[
"InterpolationType"]) {
512 Spline.
_fSplineNames = Get<std::string>(SplinePar[
"SplineName"], __FILE__ , __LINE__);
517 MACH3LOG_WARN(
"Spline knot capping enabled with bounds [{}, {}]. For reliable fits, consider modifying the input generation instead.",
533 if (SampleName.find(
'*') != std::string::npos) {
534 MACH3LOG_ERROR(
"Wildcards ('*') are not supported in sample name: '{}'", SampleName);
547 func.
modes = GetFromManager<std::vector<int>>(param[
"Mode"], std::vector<int>(), __FILE__ , __LINE__);
558 OscParamInfo.
NuOscName = Get<std::string>(param[
"NuOscName"], __FILE__ , __LINE__);
592 template<
typename ParamT>
594 const std::vector<ParamT>& params,
const std::string& SampleName)
const {
596 std::vector<ParamT> returnVec;
597 for (
const auto& pair : indexMap) {
598 const auto& localIndex = pair.first;
599 const auto& globalIndex = pair.second;
601 returnVec.push_back(params[localIndex]);
614 [&](int) { returnVal += 1; }
623 std::vector<std::string> returnVec;
635 std::vector<int> returnVec;
638 [&](
int i) { returnVec.push_back(i); }
644 template <
typename FilterFunc,
typename ActionFunc>
647 for (
int i = 0; i <
_fNumPar; ++i) {
657 for (
int i = 0; i <
_fNumPar; ++i) {
659 _fNames[i] =
"param_"+std::to_string(i);
671 #pragma GCC diagnostic push
672 #pragma GCC diagnostic ignored "-Wuseless-cast"
676 #pragma GCC diagnostic pop
681 PCAObj->SetInitialParameters();
689 MACH3LOG_INFO(
"#################################################");
705 MACH3LOG_INFO(
"#################################################");
724 const std::string errorString = fmt::format(
"{:.2f}",
_fError[i]);
730 "+/- " + errorString,
738 for (
const auto& line : table.Render()) {
757 bool have_parameter_with_kin_bounds =
false;
759 for (std::size_t i = 0; i <
NormParams.size(); ++i) {
767 if(
NormParams[i].hasKinBounds) have_parameter_with_kin_bounds =
true;
770 for (
const auto& line : table.Render()) {
773 if(have_parameter_with_kin_bounds) {
774 MACH3LOG_INFO(
"Normalisation parameters KinematicCuts information");
782 for (std::size_t i = 0; i <
NormParams.size(); ++i) {
786 const std::size_t ncuts =
NormParams[i].KinematicVarStr.size();
788 for(std::size_t icut = 0; icut < ncuts; ++icut) {
789 std::string kinematicCutValueString;
791 for(
const auto& value :
NormParams[i].Selection[icut]) {
792 for (
const auto& v : value) {
793 kinematicCutValueString += fmt::format(
"{:.2f} ", v);
802 kinematicCutValueString);
809 kinematicCutValueString);
814 for (
const auto& line : kinTable.Render()) {
819 MACH3LOG_INFO(
"No normalisation parameters have KinematicCuts defined");
837 const auto& GlobalIndex = pair.second;
847 for (
const auto& line : table.Render()) {
863 const auto& FuncIndex = pair.first;
864 const auto& GlobalIndex = pair.second;
871 for (
const auto& line : table.Render()) {
888 const auto& OscIndex = pair.first;
889 const auto& GlobalIndex = pair.second;
897 for (
const auto& line : table.Render()){
906 std::unordered_map<std::string, int> paramCounts;
909 [¶mCounts](
const std::string& param) {
910 paramCounts[param]++;
915 for (
const auto& pair : paramCounts) {
916 MACH3LOG_INFO(
"Found {}: {} params", pair.second, pair.first);
923 std::unordered_set<std::string> uniqueGroups;
927 uniqueGroups.insert(param);
931 std::vector<std::string> result(uniqueGroups.begin(), uniqueGroups.end());
940 auto CheckForDuplicates = [](
const std::vector<std::string>& names,
const std::string& nameType,
bool Warning) {
941 std::unordered_map<std::string, size_t> seenStrings;
942 for (
size_t i = 0; i < names.size(); ++i) {
943 const auto& name = names[i];
944 if (seenStrings.find(name) != seenStrings.end()) {
945 size_t firstIndex = seenStrings[name];
947 MACH3LOG_WARN(
"There are two systematics with the same {} '{}', first at index {}, and again at index {}", nameType, name, firstIndex, i);
951 MACH3LOG_CRITICAL(
"There are two systematics with the same {} '{}', first at index {}, and again at index {}", nameType, name, firstIndex, i);
955 seenStrings[name] = i;
958 std::vector<std::string> SplineNameTemp(
SplineParams.size());
963 CheckForDuplicates(
_fFancyNames,
"_fFancyNames",
false);
964 CheckForDuplicates(SplineNameTemp,
"_fSplineNames",
true);
971 for(
size_t i = 0; i < Groups.size(); i++){
980 #pragma GCC diagnostic push
981 #pragma GCC diagnostic ignored "-Wuseless-cast"
984 for (
int i = 0; i <
_fNumPar; i++) {
989 if (Pars.size() != ExpectedSize) {
990 MACH3LOG_ERROR(
"Number of param in group {} is {}, while you passed {}", Group, ExpectedSize, Pars.size());
994 for (
int i = 0; i <
_fNumPar; i++) {
1005 PCAObj->TransferToParam();
1007 #pragma GCC diagnostic pop
1022 for(
size_t i = 0; i < Groups.size(); i++)
1038 for(
size_t i = 0; i < Groups.size(); i++)
1046 std::string groupLower = Group;
1050 std::transform(groupLower.begin(), groupLower.end(), groupLower.begin(), ::tolower);
1051 std::transform(paramGroupLower.begin(), paramGroupLower.end(), paramGroupLower.begin(), ::tolower);
1053 return groupLower == paramGroupLower;
1060 for (
int i = 0; i <
_fNumPar; i++) {
#define MACH3LOG_CRITICAL
std::string SplineInterpolation_ToString(const SplineInterpolation i)
Convert a LLH type to a string.
SplineInterpolation
Make an enum of the spline interpolation type.
@ kTSpline3
Default TSpline3 interpolation .
@ kSplineInterpolations
This only enumerates.
std::string SystType_ToString(const SystType i)
Convert a Syst type type to a string.
@ kNorm
For normalisation parameters.
@ kSpline
For splined parameters (1D)
@ kSystTypes
This only enumerates.
@ kOsc
For oscillation parameters.
@ kFunc
For functional parameters.
#define Get2DBounds(filename)
Type GetFromManager(const YAML::Node &node, const Type defval, const std::string &File, const int Line)
Get content of config file if node is not found take default value specified.
#define M3OpenConfig(filename)
Macro to simplify calling LoadYaml with file and line info.
#define GetBounds(filename)
Creates fancy formatted text tables for terminal output.
void AddRow(Args &&... args)
Add a row to the table.
Custom exception class used throughout MaCh3.
int GetNumParams() const
Get total number of parameters.
bool use_adaptive
Are we using AMCMC?
void EnableSpecialProposal(const YAML::Node ¶m, const int Index, std::vector< PendingFunctionalFlipProposal > &PendingFunctionalFlipParameters)
Enable special proposal.
std::string inputFile
The input root file we read in.
TH2D * GetCorrelationMatrix() const
KS: Convert covariance matrix to correlation matrix and return TH2D which can be used for fancy plott...
void SetCovMatrix(TMatrixDSym *cov)
Set covariance matrix.
std::vector< M3::float_t > _fPropVal
Proposed value of the parameter.
std::unique_ptr< ParameterTunes > Tunes
Struct containing information about adaption.
void ReserveMemory(const int size)
Initialise vectors with parameters information.
std::vector< std::string > _fFancyNames
Fancy name for example rather than param_0 it is MAQE, useful for human reading.
bool doSpecialStepProposal
Check if any of special step proposal were enabled.
std::vector< bool > _fFlatPrior
Whether to apply flat prior or not.
std::string matrixName
Name of cov matrix.
std::string GetParFancyName(const int i) const
Get fancy name of the Parameter.
std::vector< double > _fError
Prior error on the parameter.
void SetFixParameter(const int i)
Set parameter to be fixed at prior value.
YAML::Node _fYAMLDoc
Stores config describing systematics.
std::unique_ptr< PCAHandler > PCAObj
Struct containing information about PCA.
int _fNumPar
Number of systematic parameters.
void ConstructPCA(const double eigen_threshold, int FirstPCAdpar, int LastPCAdpar)
CW: Calculate eigen values, prepare transition matrices and remove param based on defined threshold.
std::vector< double > _fLowBound
Lowest physical bound, parameter will not be able to go beyond it.
std::vector< double > _fCurrVal
Current value of the parameter.
TMatrixDSym * covMatrix
The covariance matrix.
std::vector< double > _fPreFitValue
Parameter value dictated by the prior model. Based on it penalty term is calculated.
void Randomize() _noexcept_
"Randomize" the parameters in the covariance class for the proposed step. Used the proposal kernel an...
std::vector< std::string > _fNames
ETA _fNames is set automatically in the covariance class to be something like param_i,...
void ResolveFunctionalFlips(std::vector< PendingFunctionalFlipProposal > &PendingFunctionalFlipParameters)
Resolve queued functional flips after parameter names are known.
void SetFreeParameter(const int i)
Set parameter to be treated as free.
std::vector< double > _fUpBound
Upper physical bound, parameter will not be able to go beyond it.
void SetSubThrowMatrix(int first_index, int last_index, TMatrixDSym const &subcov)
bool pca
perform PCA or not
std::vector< double > _fIndivStepScale
Individual step scale used by MCMC algorithm.
void MakePosDef(TMatrixDSym *cov=nullptr, bool verbose=true)
Make matrix positive definite by adding small values to diagonal, necessary for inverting matrix.
void PrintGlobablInfo() const
Prints general information about the ParameterHandler object.
void Print() const
Print information about the whole object once it is set.
std::vector< SplineParameter > SplineParams
Vector containing info for normalisation systematics.
FunctionalParameter GetFunctionalParameters(const YAML::Node ¶m, const int Index) const
Get Func params.
const std::vector< NormParameter > GetNormParsFromSampleName(const std::string &SampleName) const
DB Get norm/func parameters depending on given SampleName.
std::vector< std::string > GetUniqueParameterGroups() const
KS: Get names of all unique parameter groups.
ParameterHandlerGeneric(const std::vector< std::string > &FileNames, std::string name="xsec_cov", double threshold=-1, int FirstPCAdpar=-999, int LastPCAdpar=-999)
Constructor.
void PrintSplineParams() const
Prints spline parameters.
void IterateOverParams(const std::string &SampleName, FilterFunc filter, ActionFunc action) const
Iterates over parameters and applies a filter and action function.
const std::vector< int > GetParsIndexFromSampleName(const std::string &SampleName, const SystType Type) const
DB Grab the parameter indices for the relevant SampleName.
SplineParameter GetSplineParameter(const YAML::Node ¶m, const int Index) const
Get Spline params.
SystType GetParamType(const int i) const
Returns enum describing our param type.
const std::vector< int > GetSystIndexFromSampleName(const std::string &SampleName, const SystType Type) const
Grab the index of the syst relative to global numbering.
const std::vector< OscillationParameter > GetOscParsFromSampleName(const std::string &SampleName) const
KS Grab the Osc parameters for the relevant SampleName.
void GetBaseParameter(const YAML::Node ¶m, const int Index, TypeParameterBase &Parameter) const
Fill base parameters.
std::vector< NormParameter > NormParams
Vector containing info for normalisation systematics.
double GetParSplineKnotUpperBound(const int i) const
EM: value at which we cap spline knot weight.
std::vector< std::map< int, int > > _fSystToGlobalSystIndexMap
Map between number of given parameter type with global parameter numbering. For example 2nd norm para...
void LoadCorrelationFromConfig(std::vector< std::map< std::string, double >> &Correlations, std::map< std::string, int > &CorrNamesMap)
Load correlation from yaml config.
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.
std::vector< SystType > _fParamType
Type of parameter like norm, spline etc.
const std::vector< SplineParameter > GetSplineParsFromSampleName(const std::string &SampleName) const
KS: Grab the Spline parameters for the relevant SampleName.
void PrintOscillationParams() const
Prints oscillation parameters.
const std::vector< FunctionalParameter > GetFunctionalParametersFromSampleName(const std::string &SampleName) const
HH Get functional parameters for the relevant SampleName.
void SetFreeGroupOnlyParameters(const std::string &Group)
TN Method to set parameters within a group to be treated as free.
void InitParametersTypeFromConfig()
Parses the YAML configuration to set up cross-section parameters. The YAML file defines the types of ...
std::vector< std::vector< std::string > > _fSampleNames
Tells to which samples object param should be applied.
std::vector< ParamT > GetTypeParamsFromSampleName(const std::map< int, int > &indexMap, const std::vector< ParamT > ¶ms, const std::string &SampleName) const
Retrieve parameters that apply to a given sample name.
std::vector< FunctionalParameter > FuncParams
Vector containing info for functional systematics.
int GetNumParamsFromSampleName(const std::string &SampleName, const SystType Type) const
DB Grab the number of parameters for the relevant SampleName.
void PrintFunctionalParams() const
Prints functional parameters.
const std::vector< std::string > GetParsNamesFromSampleName(const std::string &SampleName, const SystType Type) const
DB Grab the parameter names for the relevant SampleName.
std::vector< OscillationParameter > OscParams
Vector containing info for functional systematics.
void DumpMatrixToFile(const std::string &Name)
Dump Matrix to ROOT file, useful when we need to pass matrix info to another fitting group.
const std::vector< std::string > GetSplineParsNamesFromSampleName(const std::string &SampleName) const
DB Get spline parameters depending on given SampleName.
SplineInterpolation GetParSplineInterpolation(const int i) const
Get interpolation type for a given parameter.
void InitParameters()
Initializes the systematic parameters from the configuration file. This function loads parameters lik...
const std::vector< int > GetGlobalSystIndexFromSampleName(const std::string &SampleName, const SystType Type) const
DB Get spline parameters depending on given SampleName.
OscillationParameter GetOscillationParameters(const YAML::Node ¶m, const int Index) const
Get Osc params.
NormParameter GetNormParameter(const YAML::Node ¶m, const int Index) const
Get Norm params.
bool AppliesToSample(const int SystIndex, const std::string &SampleName) const
Check if parameter is affecting given sample name.
const std::vector< SplineInterpolation > GetSplineInterpolationFromSampleName(const std::string &SampleName) const
Get the interpolation types for splines affecting a particular SampleName.
bool IsParFromGroup(const int i, const std::string &Group) const
Checks if parameter belongs to a given group.
void CheckCorrectInitialisation() const
KS: Check if matrix is correctly initialised.
void InitialiseFromConfig(const std::vector< std::string > &YAMLFile)
Initialisation of the class using config.
void SetFixGroupOnlyParameters(const std::string &Group)
TN Method to set parameters within a group to be fixed to their prior values.
std::vector< std::string > _ParameterGroup
KS: Allow to group parameters for example to affect only cross-section or only flux etc.
void LoadAndMergeYAML(const std::vector< std::string > &YAMLFile, std::map< std::pair< int, int >, std::unique_ptr< TMatrixDSym >> &overrides)
Initialise single yaml based on several yaml files.
double GetParSplineKnotLowerBound(const int i) const
EM: value at which we cap spline knot weight.
void PrintNormParams() const
Prints normalization parameters.
int GetNumParFromGroup(const std::string &Group) const
KS: Check how many parameters are associated with given group.
const std::vector< std::vector< int > > GetSplineModeVecFromSampleName(const std::string &SampleName) const
DB Grab the Spline Modes for the relevant SampleName.
void PrintParameterGroups() const
Prints groups of parameters.
~ParameterHandlerGeneric()
Destructor.
static std::string Cell(T &&value, std::string_view format)
Format a value using a runtime fmt format string.
std::string join(const Container &values, std::string_view separator=" ")
Join all values in a container into a single string.
@ Right
Align text to the right.
@ Left
Align text to the left.
constexpr static const double DefSplineKnotUpBound
Default value for spline knot capping, default mean not capping is being applied.
constexpr static const double DefSplineKnotLowBound
Default value for spline knot capping, default mean not capping is being applied.
void DumpParamHandlerToFile(const int _fNumPar, const std::vector< double > &_fPreFitValue, const std::vector< double > &_fError, const std::vector< double > &_fLowBound, const std::vector< double > &_fUpBound, const std::vector< double > &_fIndivStepScale, const std::vector< std::string > &_fFancyNames, const std::vector< bool > &_fFlatPrior, const std::vector< SplineParameter > &SplineParams, TMatrixDSym *covMatrix, TH2D *CorrMatrix, const std::string &Name)
Dump Matrix to ROOT file, useful when we need to pass matrix info to another fitting group.
bool CaseInsensitiveMatchAny(std::string Text, const std::vector< std::string > &Patterns)
Matches a string against a simple wildcard Pattern using regex. Is not case sensitive.
HH - Functional parameters Carrier for whether you want to apply a systematic to an event or not.
std::vector< int > modes
Mode which parameter applies to.
ETA - Normalisations for cross-section parameters Carrier for whether you want to apply a systematic ...
std::vector< int > preoscpdgs
Preosc PDG which parameter applies to.
std::vector< int > modes
Mode which parameter applies to.
std::vector< int > pdgs
PDG which parameter applies to.
std::vector< int > targets
Targets which parameter applies to.
KS: Struct holding info about oscillation Systematics.
std::string NuOscName
Parameter name in NuOscillator.
Flat representation of a spline index entry.
KS: Struct holding info about Spline Systematics.
SplineInterpolation _SplineInterpolationType
Spline interpolation vector.
double _SplineKnotUpBound
EM: Cap spline knot higher value.
double _SplineKnotLowBound
EM: Cap spline knot lower value.
std::vector< int > _fSplineModes
Modes to which spline applies (valid only for binned splines)
std::string _fSplineNames
Name of spline in TTree (TBranch),.
Base class storing info for parameters types, helping unify codebase.
int index
Parameter number of this normalisation in current systematic model.
bool hasKinBounds
Does this parameter have kinematic bounds.
std::string name
Name of parameters.
std::vector< std::string > KinematicVarStr
std::vector< std::vector< std::vector< double > > > Selection