49 if (
file->IsZombie()) {
57 for (std::string LLHType : {
"sample",
"penalty",
"total"})
74 MACH3LOG_DEBUG(
"###### Deleting InputFile Object holding file ######");
130 std::vector<std::string>
132 std::unordered_map<std::string, bool>
135 std::unordered_map<std::string, std::unordered_map<std::string, std::shared_ptr<TGraph>>>
138 std::unordered_map<std::string, std::unordered_map<std::string, bool>>
151 std::unordered_map<std::string, std::unordered_map<std::string, std::shared_ptr<TGraph>>>
154 std::unordered_map<std::string, std::unordered_map<std::string, bool>>
161 std::vector<std::string>
163 std::unordered_map<std::string, std::unordered_map<std::string, double>>
166 std::unordered_map<std::string, std::unordered_map<std::string, double>>
225 "__PARAM_NAME_NOT_FOUND__";
231 InputManager(
const std::string &translationConfigName,
const std::vector<std::string>& _fileNames);
235 void addFile(
const std::string &fileName);
275 return "UNKNOWN_FILE_TYPE";
282 void print(
const std::string &printLevel =
"summary")
const;
291 std::vector<std::vector<double>>
getLLHScan(
const int fileNum,
const std::string& paramName,
const std::string& LLHType)
const {
294 MACH3LOG_WARN(
"file at index {} does not have LLH scan for parameter {}", fileNum, paramName);
296 return std::vector<std::vector<double>>(2);
315 MACH3LOG_TRACE(
"Getting entry {} in MCMC tree for file at index {}", entry, fileNum);
327 MACH3LOG_WARN(
"file at index {} does not have an MCMC entry for parameter {}", fileNum, paramName);
332 return *
_fileVec[fileNum].MCMCstepParamsMap.at(paramName);
339 std::vector<std::vector<double>>
get1dPosterior(
const int fileNum,
const std::string& paramName)
const {
342 MACH3LOG_WARN(
"file at index {} does not have a 1d posterior for parameter {}", fileNum, paramName);
344 return std::vector<std::vector<double>>(2);
352 return _fileVec[fileNum].nMCMCentries;
362 inline TGraph
getLLHScan_TGraph(
const int fileNum,
const std::string& paramName,
const std::string& LLHType)
const {
365 MACH3LOG_WARN(
"file at index {} does not have LLH scan for parameter {}", fileNum, paramName);
369 return *
_fileVec[fileNum].LLHScans_map.at(LLHType).at(paramName);
372 inline TH1D
getLLHScan_TH1D(
const int fileNum,
const std::string& paramName,
const std::string& LLHType)
const {
375 MACH3LOG_WARN(
"file at index {} does not have LLH scan for parameter {}", fileNum, paramName);
388 std::vector<std::vector<double>>
getSampleSpecificLLHScan(
const int fileNum,
const std::string& paramName,
const std::string& sample)
const {
391 MACH3LOG_WARN(
"file at index {} does not have LLH scan for sample {} for parameter {}", fileNum, sample, paramName);
393 return std::vector<std::vector<double>>(2);
399 const std::string& sample)
const {
402 MACH3LOG_WARN(
"file at index {} does not have LLH scan for sample {} for parameter {}", fileNum, sample, paramName);
406 return *
_fileVec[fileNum].LLHScansBySample_map.at(sample).at(paramName);
412 MACH3LOG_WARN(
"file at index {} does not have LLH scan for sample {} for parameter {}", fileNum, sample, paramName);
425 const std::string& LLHType =
"total")
const {
426 return _fileVec[fileNum].availableParams_map_LLH.at(LLHType).at(paramName);
435 inline bool getEnabledLLHBySample(
const int fileNum,
const std::string& paramName,
const std::string& sample)
const {
436 return _fileVec[fileNum].availableParams_map_LLHBySample.at(sample).at(paramName);
444 return _fileVec[fileNum].availableParams_map_MCMCchain.at(paramName);
452 return _fileVec[fileNum].availableParams_map_1dPosteriors.at(paramName);
462 double getPostFitError(
const int fileNum,
const std::string ¶mName, std::string errorType =
"")
const;
471 double getPostFitValue(
const int fileNum,
const std::string ¶mName, std::string errorType =
"")
const;
486 inline std::vector<std::string>
getTaggedParameters(
const std::vector<std::string> &tags, std::string checkType =
"all")
const {
497 inline std::vector<std::string>
getTaggedSamples(
const std::vector<std::string> &tags, std::string checkType =
"all")
const {
509 return _fileVec[fileId].availableParams_LLH;
512 return _fileVec[fileId].availableSamples_LLH;
515 return _fileVec[fileId].availableParams_postFitErrors;
518 return _fileVec[fileId].availableParams_MCMCchain;
521 return _fileVec[fileId].availableParams_1dPosteriors;
529 std::vector<std::string>
getTaggedValues(
const std::vector<std::string> &values,
530 const std::unordered_map<std::string,
531 std::vector<std::string>> &tagMap,
532 const std::vector<std::string> &tags, std::string checkType)
const;
540 std::vector<std::string>
parseLocation(
const std::string &locationString, std::string &fitter,
541 fileTypeEnum fileType,
const std::string ¶meter =
"",
542 const std::string &sample =
"",
const std::string ¶meter2 =
"")
const;
549 std::shared_ptr<TObject>
findRootObject(
const InputFile &fileDef,
const std::vector<std::string> &locationVec)
const;
554 const std::string &errorType,
const bool setInputFileError =
false);
559 const std::string &sample,
bool setInputFileScan =
false);
562 bool findRawChainSteps(
InputFile &inputFileDef,
const std::string ¶meter, std::string &fitter,
bool setInputBranch =
false )
const ;
565 bool find1dPosterior(
InputFile &inputFileDef,
const std::string ¶meter, std::string &fitter,
bool setFileData =
false)
const ;
574 template <
typename T>
575 inline bool getFitterSpecificOption(
const std::string &fitter,
const std::string &option, T &ret,
const std::string ¶meter,
576 YAML::Node subConfig)
const{
577 if (subConfig[parameter])
580 YAML::Node paramTranslation = subConfig[parameter];
582 if (paramTranslation[fitter])
585 YAML::Node fitterParamTranslation = paramTranslation[fitter];
587 if (fitterParamTranslation[option])
589 ret = fitterParamTranslation[option].as<T>();
598 template <
typename T>
600 const std::string ¶meter)
const {
601 return getFitterSpecificOption<T>(fitter, option, ret, parameter,
_parametersConfig);
605 template <
typename T>
607 std::string parameter)
const {
608 return getFitterSpecificOption<T>(fitter, option, ret, parameter,
_samplesConfig);
614 const std::string ¶meter)
const {
615 std::string specificName;
617 specificName, parameter))
628 const std::string &sample)
const {
629 std::string specificName;
631 specificName, sample))
643 inline bool strEndsWith(
const std::string& str,
const std::string& ending)
const {
644 if (str.size() >= ending.size()) {
645 return str.compare(str.size() - ending.size(), ending.size(), ending) == 0;
Defines the custom exception class used throughout MaCh3.
MaCh3 Logging utilities built on top of SPDLOG.
Utility functions for handling YAML nodes.
Custom exception class used throughout MaCh3.
std::vector< std::vector< double > > TGraphToVector(const TGraph &graph)
This handy little function lets you interpret a TGraph as a vector containing the same data.
fileTypeEnum
Types of possible file that can be read.
@ kSigmaVar
Sigma variations.
@ kNFileTypes
Number of types of file.
@ kLLH
Log Likelihood scan.
@ kPostFit
Processed post fit errors.
TH1D TGraphToTH1D(const TGraph &graph, const std::string &newName, const std::string &newTitle)
This handy little function lets you interpret a TGraph as a TH1D.
Main namespace for MaCh3 software.
constexpr static const double _BAD_DOUBLE_
Default value used for double initialisation.