![]() |
MaCh3
2.2.3
Reference Guide
|
This guy talks to the input files and is intended to smooth over the fact that our OA fitters use such a beautiful and diverse range of output file structures. More...
#include <Plotting/plottingUtils/inputManager.h>
Public Member Functions | |
InputManager (const std::string &translationConfigName) | |
Construct a new InputManager using specified fitter translation config file. More... | |
void | addFile (const std::string &fileName) |
Add a new InputFile object to this input manager. More... | |
~InputManager () | |
Destructor. More... | |
InputManager (const InputManager &)=delete | |
InputManager (InputManager &&)=default | |
void | print (const std::string &printLevel="summary") const |
Print out what this Inputmanager instance knows about. More... | |
std::vector< std::vector< double > > | getLLHScan (const int fileNum, const std::string ¶mName, const std::string &LLHType) const |
Get the log likelihood scan data for a particular parameter from a particular input file. More... | |
void | getMCMCentry (const int fileNum, const int entry) const |
Get the MCMC chain entry in an InputFile. More... | |
double | getMCMCvalue (int fileNum, std::string paramName) const |
Get the parameter value for the current step for a particular parameter from a particular input file. More... | |
std::vector< std::vector< double > > | get1dPosterior (const int fileNum, const std::string ¶mName) const |
Get the 1d posterior particular parameter from a particular input file. More... | |
int | getnMCMCentries (const int fileNum) const |
Get the number of entries in the MCMC chain in a particular file. More... | |
TGraph | getLLHScan_TGraph (const int fileNum, const std::string ¶mName, const std::string &LLHType) const |
Get the log likelihood scan for a particular parameter from a particular input file. More... | |
TH1D | getLLHScan_TH1D (const int fileNum, const std::string ¶mName, const std::string &LLHType) const |
std::vector< std::vector< double > > | getSampleSpecificLLHScan (const int fileNum, const std::string ¶mName, const std::string &sample) const |
Get the log likelihood scan for a particular parameter, for a specific sample, from a particular input file. More... | |
TGraph | getSampleSpecificLLHScan_TGraph (const int fileNum, const std::string ¶mName, const std::string &sample) const |
TH1D | getSampleSpecificLLHScan_TH1D (const int fileNum, const std::string ¶mName, const std::string &sample) const |
bool | getEnabledLLH (const int fileNum, const std::string ¶mName, std::string LLHType="total") const |
Get whether or not a particular parameter has an LLH scan in a particular input file. More... | |
bool | getEnabledLLHBySample (const int fileNum, const std::string ¶mName, const std::string &sample) const |
Get whether or not a particular parameter has an LLH scan in a particular input file for a particular sample. More... | |
bool | getEnabledMCMCchain (const int fileNum, const std::string ¶mName) const |
Get whether or not a particular parameter has MCMC chain entries in a particular input file. More... | |
bool | getEnabled1dPosteriors (const int fileNum, const std::string ¶mName) const |
Get whether or not a particular parameter has 1d posteriors in a particular input file. More... | |
double | getPostFitError (const int fileNum, const std::string ¶mName, std::string errorType="") const |
Get the post fit error for a particular parameter from a particular input file. More... | |
double | getPostFitValue (const int fileNum, const std::string ¶mName, std::string errorType="") const |
Get the post fit value for a particular parameter from a particular input file. More... | |
General Getters | |
const std::vector< std::string > & | getKnownParameters () const |
const std::vector< std::string > & | getKnownSamples () const |
size_t | getNInputFiles () const |
std::vector< std::string > | getTaggedParameters (const std::vector< std::string > &tags, std::string checkType="all") const |
Get all parameters which have some set of tags. More... | |
std::vector< std::string > | getTaggedSamples (const std::vector< std::string > &tags, std::string checkType="all") const |
Get all samples which have some set of tags. More... | |
File Specific Getters | |
InputFile const & | getFile (int fileId) const |
std::string | translateName (int fileId, fileTypeEnum fileType, std::string paramName) const |
const std::vector< std::string > & | getKnownLLHParameters (int fileId) const |
const std::vector< std::string > & | getKnownLLHSamples (int fileId) const |
const std::vector< std::string > & | getKnownPostFitParameters (int fileId) const |
const std::vector< std::string > & | getKnownMCMCParameters (int fileId) const |
const std::vector< std::string > & | getKnown1dPosteriorParameters (int fileId) const |
Static Public Member Functions | |
static const std::string | convertFileTypeNames (const fileTypeEnum fileType) |
Convert from fileTypeEnum to the name of the file type. More... | |
Public Attributes | |
const std::string | NOT_FOUND_STR |
the default string to return if something can't be found More... | |
Private Member Functions | |
std::vector< std::string > | getTaggedValues (const std::vector< std::string > &values, const std::unordered_map< std::string, std::vector< std::string >> &tagMap, const std::vector< std::string > &tags, std::string checkType) const |
std::vector< std::string > | parseLocation (const std::string &locationString, std::string &fitter, fileTypeEnum fileType, const std::string ¶meter="", const std::string &sample="", const std::string ¶meter2="") const |
std::shared_ptr< TObject > | findRootObject (const InputFile &fileDef, const std::vector< std::string > &locationVec) const |
bool | findPostFitParamError (InputFile &inputFileDef, const std::string ¶meter, std::string &fitter, const std::string &errorType, const bool setInputFileError=false) |
bool | findBySampleLLH (InputFile &inputFileDef, const std::string ¶meter, std::string &fitter, const std::string &sample, bool setInputFileScan=false) |
bool | findRawChainSteps (InputFile &inputFileDef, const std::string ¶meter, std::string &fitter, bool setInputBranch=false) const |
bool | find1dPosterior (InputFile &inputFileDef, const std::string ¶meter, std::string &fitter, bool setFileData=false) const |
void | fillFileInfo (InputFile &inputFileDef, const bool printThoughts=true) |
void | fillFileData (InputFile &inputFileDef, const bool printThoughts=true) |
template<typename T > | |
bool | getFitterSpecificOption (const std::string &fitter, const std::string &option, T &ret, const std::string ¶meter, YAML::Node subConfig) const |
template<typename T > | |
bool | getFitterSpecificParamOption (const std::string &fitter, const std::string &option, T &ret, const std::string ¶meter) const |
template<typename T > | |
bool | getFitterSpecificSampleOption (const std::string &fitter, std::string option, T &ret, std::string parameter) const |
std::string | getFitterSpecificParamName (const std::string &fitter, fileTypeEnum fileType, const std::string ¶meter) const |
std::string | getFitterSpecificSampleName (const std::string &fitter, fileTypeEnum fileType, const std::string &sample) const |
bool | strEndsWith (const std::string &str, const std::string &ending) const |
Private Attributes | |
std::vector< std::string > | _knownParameters |
std::vector< std::string > | _knownSamples |
std::vector< std::string > | _knownFitters |
std::unordered_map< std::string, std::vector< std::string > > | _paramToTagsMap |
std::unordered_map< std::string, std::vector< std::string > > | _sampleToTagsMap |
YAML::Node | _translatorConfig |
YAML::Node | _fitterSpecConfig |
YAML::Node | _parametersConfig |
YAML::Node | _samplesConfig |
std::vector< InputFile > | _fileVec |
This guy talks to the input files and is intended to smooth over the fact that our OA fitters use such a beautiful and diverse range of output file structures.
Intended use for this class is to be called from inside of a PlottingManager object which is what the user is intended to interact with, though in principle it should be strong and independent enough to be used all by itself. The interface to this object is intentionally pretty small as it is intended to deal with the complexities of the different input files pretty automatically. Usage should follow something like this:
A lot of string comparisons going on in the code for the post fit errors, would maybe be good to implement some kind of indexing for parameters and just have a map between the parameter names and this index to be used internally by the class.
Add code to read MCMC from input file
Add code to read Sigma variations. There are usually so many of these that we might not want to read them all into memory at once when adding the file but maybe just check to see what ones are in the file, then be able to read them on the fly later.
Add code to read in Violin plots from the postfit error output files.
Definition at line 218 of file inputManager.h.
MaCh3Plotting::InputManager::InputManager | ( | const std::string & | translationConfigName | ) |
Construct a new InputManager using specified fitter translation config file.
translationConfigName | The config file defining the fitter file structures, fit parameter, and what the parameters are called in each fitter. |
Definition at line 6 of file inputManager.cpp.
|
inline |
Destructor.
Close out all the files that the manager is responsible for
Definition at line 235 of file inputManager.h.
|
delete |
|
default |
void MaCh3Plotting::InputManager::addFile | ( | const std::string & | fileName | ) |
Add a new InputFile object to this input manager.
fileName | The name of the file to read. |
Open an input file and add to the manager, consists of:
Definition at line 69 of file inputManager.cpp.
|
inlinestatic |
Convert from fileTypeEnum to the name of the file type.
fileType | The file type ID to convert. |
Definition at line 257 of file inputManager.h.
|
private |
Definition at line 775 of file inputManager.cpp.
|
private |
Definition at line 502 of file inputManager.cpp.
|
private |
Definition at line 425 of file inputManager.cpp.
|
private |
Definition at line 343 of file inputManager.cpp.
|
private |
Definition at line 452 of file inputManager.cpp.
|
private |
Definition at line 390 of file inputManager.cpp.
|
private |
Definition at line 287 of file inputManager.cpp.
|
inline |
Get the 1d posterior particular parameter from a particular input file.
fileNum | The index of the file you want the data from. |
paramName | The parameter you want the information about. |
Definition at line 335 of file inputManager.h.
|
inline |
Get whether or not a particular parameter has 1d posteriors in a particular input file.
fileNum | The index of the file that you would like to know about. |
paramName | The name of the parameter whose 1d posterior you would like to check for. |
Definition at line 447 of file inputManager.h.
|
inline |
Get whether or not a particular parameter has an LLH scan in a particular input file.
fileNum | The index of the file that you would like to know about. |
paramName | The name of the parameter whose LLH scan you would like to check for. |
LLHType | The type of likelihood scan you would like to check for, e.h. total, prior etc. |
Definition at line 420 of file inputManager.h.
|
inline |
Get whether or not a particular parameter has an LLH scan in a particular input file for a particular sample.
fileNum | The index of the file that you would like to know about. |
paramName | The name of the parameter whose LLH scan you would like to check for. |
sample | The sample to check. |
Definition at line 431 of file inputManager.h.
|
inline |
Get whether or not a particular parameter has MCMC chain entries in a particular input file.
fileNum | The index of the file that you would like to know about. |
paramName | The name of the parameter whose LLH scan you would like to check for. |
Definition at line 439 of file inputManager.h.
|
inline |
Definition at line 500 of file inputManager.h.
|
inlineprivate |
Definition at line 571 of file inputManager.h.
|
inlineprivate |
Definition at line 609 of file inputManager.h.
|
inlineprivate |
Definition at line 595 of file inputManager.h.
|
inlineprivate |
Definition at line 623 of file inputManager.h.
|
inlineprivate |
Definition at line 602 of file inputManager.h.
|
inline |
Definition at line 516 of file inputManager.h.
|
inline |
Definition at line 504 of file inputManager.h.
|
inline |
Definition at line 507 of file inputManager.h.
|
inline |
Definition at line 513 of file inputManager.h.
|
inline |
Definition at line 471 of file inputManager.h.
|
inline |
Definition at line 510 of file inputManager.h.
|
inline |
Definition at line 472 of file inputManager.h.
|
inline |
Get the log likelihood scan data for a particular parameter from a particular input file.
fileNum | The index of the file you want the data from. |
paramName | The parameter you want the information about. |
LLHType | The type of log likelihood scan you want (e.g. total, penalty, etc.) |
Definition at line 287 of file inputManager.h.
|
inline |
Get the log likelihood scan for a particular parameter from a particular input file.
fileNum | The index of the file that you would like to get the scan from. |
paramName | The name of the parameter whose LLH scan you would like. |
LLHType | The type of likelihood scan you would like, e.h. total, prior etc. |
T | The type you would like your scan returned as, currently only TGraph and TH1D are supported |
Definition at line 358 of file inputManager.h.
|
inline |
Definition at line 368 of file inputManager.h.
|
inline |
Get the MCMC chain entry in an InputFile.
fileNum | The index of the file you want the data from. |
entry | The entry to get. |
Definition at line 300 of file inputManager.h.
|
inline |
Get the parameter value for the current step for a particular parameter from a particular input file.
fileNum | The index of the file you want the data from. |
paramName | The parameter you want the value of. |
Definition at line 320 of file inputManager.h.
|
inline |
Definition at line 473 of file inputManager.h.
|
inline |
Get the number of entries in the MCMC chain in a particular file.
fileNum | The index of the file you want the number of steps from. |
Definition at line 347 of file inputManager.h.
double MaCh3Plotting::InputManager::getPostFitError | ( | const int | fileNum, |
const std::string & | paramName, | ||
std::string | errorType = "" |
||
) | const |
Get the post fit error for a particular parameter from a particular input file.
fileNum | The index of the file that you would like to get the value from. |
paramName | The name of the parameter whose error you would like. |
errorType | The type of error to return, usually "prior" will be defined, but other possible types will be fitter dependent, e.g. "gauss" or "hpd" for MaCh3. If not specified, will use the default one, as specified in the fitter definition config. |
Definition at line 109 of file inputManager.cpp.
double MaCh3Plotting::InputManager::getPostFitValue | ( | const int | fileNum, |
const std::string & | paramName, | ||
std::string | errorType = "" |
||
) | const |
Get the post fit value for a particular parameter from a particular input file.
fileNum | The index of the file that you would like to get the value from. |
paramName | The name of the parameter whose value you would like. |
errorType | The type of error to return, usually "prior" will be defined, but other possible types will be fitter dependent, e.g. "gauss" or "hpd" for MaCh3. If not specified, will use the default one, as specified in the fitter definition config. |
Definition at line 137 of file inputManager.cpp.
|
inline |
Get the log likelihood scan for a particular parameter, for a specific sample, from a particular input file.
fileNum | The index of the file that you would like to get the scan from. |
paramName | The name of the parameter whose LLH scan you would like. |
sample | The sample that you would like the LLH scan for. |
Definition at line 384 of file inputManager.h.
|
inline |
Definition at line 394 of file inputManager.h.
|
inline |
Definition at line 405 of file inputManager.h.
|
inline |
Get all parameters which have some set of tags.
tags | The tags to check for |
checkType | The type of check to perform: checkType can be one of:
|
Definition at line 482 of file inputManager.h.
|
inline |
Get all samples which have some set of tags.
tags | The tags to check for |
checkType | The type of check to perform: checkType can be one of:
|
Definition at line 493 of file inputManager.h.
|
private |
Definition at line 170 of file inputManager.cpp.
|
private |
Definition at line 229 of file inputManager.cpp.
void MaCh3Plotting::InputManager::print | ( | const std::string & | printLevel = "summary" | ) | const |
Print out what this Inputmanager instance knows about.
printLevel | The level of detail to go into in the summary printout: options are "summary", and "dump". |
If printLevel is "summary", will loop through all the files known to this InputManager and call InputFile::Summarise(). If printLevel is "dump", will print all parameters known to this InputManager and then loop through all input files and call InputFile::Dump().
Definition at line 82 of file inputManager.cpp.
|
inlineprivate |
Definition at line 636 of file inputManager.h.
|
inline |
Definition at line 501 of file inputManager.h.
|
private |
Definition at line 668 of file inputManager.h.
|
private |
Definition at line 663 of file inputManager.h.
|
private |
Definition at line 653 of file inputManager.h.
|
private |
Definition at line 646 of file inputManager.h.
|
private |
Definition at line 650 of file inputManager.h.
|
private |
Definition at line 664 of file inputManager.h.
|
private |
Definition at line 656 of file inputManager.h.
|
private |
Definition at line 665 of file inputManager.h.
|
private |
Definition at line 658 of file inputManager.h.
|
private |
Definition at line 662 of file inputManager.h.
const std::string MaCh3Plotting::InputManager::NOT_FOUND_STR |
the default string to return if something can't be found
Definition at line 220 of file inputManager.h.