52 for (std::string LLHType : {
"sample",
"penalty",
"total"})
69 MACH3LOG_DEBUG(
"###### Deleting InputFile Object holding file ######");
125 std::vector<std::string>
127 std::unordered_map<std::string, bool>
130 std::unordered_map<std::string, std::unordered_map<std::string, std::shared_ptr<TGraph>>>
133 std::unordered_map<std::string, std::unordered_map<std::string, bool>>
146 std::unordered_map<std::string, std::unordered_map<std::string, std::shared_ptr<TGraph>>>
149 std::unordered_map<std::string, std::unordered_map<std::string, bool>>
156 std::vector<std::string>
158 std::unordered_map<std::string, std::unordered_map<std::string, double>>
161 std::unordered_map<std::string, std::unordered_map<std::string, double>>
217 "__PARAM_NAME_NOT_FOUND__";
227 void addFile(
const std::string &fileName);
269 return "UNKNOWN_FILE_TYPE";
276 void print(
const std::string &printLevel =
"summary")
const;
285 std::vector<std::vector<double>>
getLLHScan(
int fileNum, std::string paramName, std::string LLHType)
const {
288 MACH3LOG_WARN(
"file at index {} does not have LLH scan for parameter {}", fileNum, paramName);
290 return std::vector<std::vector<double>>(2);
309 MACH3LOG_TRACE(
"Getting entry {} in MCMC tree for file at index {}", entry, fileNum);
321 MACH3LOG_WARN(
"file at index {} does not have an MCMC entry for parameter {}", fileNum, paramName);
326 return *
_fileVec[fileNum].MCMCstepParamsMap.at(paramName);
333 std::vector<std::vector<double>>
get1dPosterior(
int fileNum, std::string paramName)
const {
336 MACH3LOG_WARN(
"file at index {} does not have a 1d posterior for parameter {}", fileNum, paramName);
338 return std::vector<std::vector<double>>(2);
346 return _fileVec[fileNum].nMCMCentries;
356 inline TGraph
getLLHScan_TGraph(
int fileNum, std::string paramName, std::string LLHType)
const {
359 MACH3LOG_WARN(
"file at index {} does not have LLH scan for parameter {}", fileNum, paramName);
363 return *
_fileVec[fileNum].LLHScans_map.at(LLHType).at(paramName);
366 inline TH1D
getLLHScan_TH1D(
int fileNum, std::string paramName, std::string LLHType)
const {
369 MACH3LOG_WARN(
"file at index {} does not have LLH scan for parameter {}", fileNum, paramName);
385 MACH3LOG_WARN(
"file at index {} does not have LLH scan for sample {} for parameter {}", fileNum, sample, paramName);
387 return std::vector<std::vector<double>>(2);
393 std::string sample)
const {
396 MACH3LOG_WARN(
"file at index {} does not have LLH scan for sample {} for parameter {}", fileNum, sample, paramName);
400 return *
_fileVec[fileNum].LLHScansBySample_map.at(sample).at(paramName);
406 MACH3LOG_WARN(
"file at index {} does not have LLH scan for sample {} for parameter {}", fileNum, sample, paramName);
419 std::string LLHType =
"total")
const {
420 return _fileVec[fileNum].availableParams_map_LLH.at(LLHType).at(paramName);
430 return _fileVec[fileNum].availableParams_map_LLHBySample.at(sample).at(paramName);
438 return _fileVec[fileNum].availableParams_map_MCMCchain.at(paramName);
446 return _fileVec[fileNum].availableParams_map_1dPosteriors.at(paramName);
456 double getPostFitError(
int fileNum,
const std::string ¶mName, std::string errorType =
"")
const;
465 double getPostFitValue(
int fileNum,
const std::string ¶mName, std::string errorType =
"")
const;
480 inline std::vector<std::string>
getTaggedParameters(
const std::vector<std::string> &tags, std::string checkType =
"all")
const {
491 inline std::vector<std::string>
getTaggedSamples(
const std::vector<std::string> &tags, std::string checkType =
"all")
const {
503 return _fileVec[fileId].availableParams_LLH;
506 return _fileVec[fileId].availableSamples_LLH;
509 return _fileVec[fileId].availableParams_postFitErrors;
512 return _fileVec[fileId].availableParams_MCMCchain;
515 return _fileVec[fileId].availableParams_1dPosteriors;
523 std::vector<std::string>
getTaggedValues(
const std::vector<std::string> &values,
524 const std::unordered_map<std::string,
525 std::vector<std::string>> &tagMap,
526 const std::vector<std::string> &tags, std::string checkType)
const;
534 std::vector<std::string>
parseLocation(
const std::string &locationString, std::string &fitter,
535 fileTypeEnum fileType,
const std::string ¶meter =
"",
536 const std::string &sample =
"",
const std::string ¶meter2 =
"")
const;
543 std::shared_ptr<TObject>
findRootObject(
const InputFile &fileDef,
const std::vector<std::string> &locationVec)
const;
548 const std::string &errorType,
bool setInputFileError =
false);
553 const std::string &sample,
bool setInputFileScan =
false);
556 bool findRawChainSteps(
InputFile &inputFileDef,
const std::string ¶meter, std::string &fitter,
bool setInputBranch =
false )
const ;
559 bool find1dPosterior(
InputFile &inputFileDef,
const std::string ¶meter, std::string &fitter,
bool setFileData =
false)
const ;
568 template <
typename T>
569 inline bool getFitterSpecificOption(
const std::string &fitter,
const std::string &option, T &ret,
const std::string ¶meter,
570 YAML::Node subConfig)
const{
571 if (subConfig[parameter])
574 YAML::Node paramTranslation = subConfig[parameter];
576 if (paramTranslation[fitter])
579 YAML::Node fitterParamTranslation = paramTranslation[fitter];
581 if (fitterParamTranslation[option])
583 ret = fitterParamTranslation[option].as<T>();
592 template <
typename T>
594 const std::string ¶meter)
const {
595 return getFitterSpecificOption<T>(fitter, option, ret, parameter,
_parametersConfig);
599 template <
typename T>
601 std::string parameter)
const {
602 return getFitterSpecificOption<T>(fitter, option, ret, parameter,
_samplesConfig);
608 const std::string ¶meter)
const {
609 std::string specificName;
611 specificName, parameter))
622 const std::string &sample)
const {
623 std::string specificName;
625 specificName, sample))
634 inline bool strEndsWith(
const std::string& str,
const std::string& ending)
const {
635 if (str.size() >= ending.size()) {
636 return str.compare(str.size() - ending.size(), ending.size(), ending) == 0;
KS: Based on this https://github.com/gabime/spdlog/blob/a2b4262090fd3f005c2315dcb5be2f0f1774a005/incl...
Utility functions for handling YAML nodes.
Class responsible for processing MCMC chains, performing diagnostics, generating plots,...
std::vector< std::vector< double > > TGraphToVector(TGraph graph)
This handy little function lets you interpret a TGraph as a vector containing the same data.
TH1D TGraphToTH1D(TGraph graph, std::string newName, std::string newTitle)
This handy little function lets you interpret a TGraph as a TH1D.
static constexpr const double _BAD_DOUBLE_
Default value used for double initialisation.
fileTypeEnum
Types of possible file that can be read.
@ kNFileTypes
Number of types of file.
@ kPostFit
Processed post fit errors.
@ kLLH
Log Likelihood scan.
@ kSigmaVar
Sigma variations.