![]() |
MaCh3 2.2.1
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. | |
void | addFile (const std::string &fileName) |
Add a new InputFile object to this input manager. | |
~InputManager () | |
Destructor. | |
InputManager (const InputManager &)=delete | |
InputManager (InputManager &&)=default | |
void | print (const std::string &printLevel="summary") const |
Print out what this Inputmanager instance knows about. | |
std::vector< std::vector< double > > | getLLHScan (int fileNum, std::string paramName, std::string LLHType) const |
Get the log likelihood scan data for a particular parameter from a particular input file. | |
void | getMCMCentry (int fileNum, int entry) const |
Get the MCMC chain entry in an InputFile. | |
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. | |
std::vector< std::vector< double > > | get1dPosterior (int fileNum, std::string paramName) const |
Get the 1d posterior particular parameter from a particular input file. | |
int | getnMCMCentries (int fileNum) const |
Get the number of entries in the MCMC chain in a particular file. | |
TGraph | getLLHScan_TGraph (int fileNum, std::string paramName, std::string LLHType) const |
Get the log likelihood scan for a particular parameter from a particular input file. | |
TH1D | getLLHScan_TH1D (int fileNum, std::string paramName, std::string LLHType) const |
std::vector< std::vector< double > > | getSampleSpecificLLHScan (int fileNum, std::string paramName, std::string sample) const |
Get the log likelihood scan for a particular parameter, for a specific sample, from a particular input file. | |
TGraph | getSampleSpecificLLHScan_TGraph (int fileNum, std::string paramName, std::string sample) const |
TH1D | getSampleSpecificLLHScan_TH1D (int fileNum, std::string paramName, std::string sample) const |
bool | getEnabledLLH (int fileNum, std::string paramName, std::string LLHType="total") const |
Get whether or not a particular parameter has an LLH scan in a particular input file. | |
bool | getEnabledLLHBySample (int fileNum, std::string paramName, std::string sample) const |
Get whether or not a particular parameter has an LLH scan in a particular input file for a particular sample. | |
bool | getEnabledMCMCchain (int fileNum, std::string paramName) const |
Get whether or not a particular parameter has MCMC chain entries in a particular input file. | |
bool | getEnabled1dPosteriors (int fileNum, std::string paramName) const |
Get whether or not a particular parameter has 1d posteriors in a particular input file. | |
double | getPostFitError (int fileNum, const std::string ¶mName, std::string errorType="") const |
Get the post fit error for a particular parameter from a particular input file. | |
double | getPostFitValue (int fileNum, const std::string ¶mName, std::string errorType="") const |
Get the post fit value for a particular parameter from a particular input file. | |
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. | |
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. | |
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 (fileTypeEnum fileType) |
Convert from fileTypeEnum to the name of the file type. | |
Public Attributes | |
const std::string | NOT_FOUND_STR |
the default string to return if something can't be found | |
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, 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, bool printThoughts=true) |
void | fillFileData (InputFile &inputFileDef, 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 214 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 231 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 255 of file inputManager.h.
|
private |
Definition at line 778 of file inputManager.cpp.
|
private |
Definition at line 505 of file inputManager.cpp.
|
private |
Definition at line 427 of file inputManager.cpp.
|
private |
Definition at line 343 of file inputManager.cpp.
|
private |
Definition at line 454 of file inputManager.cpp.
|
private |
Definition at line 392 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 333 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 445 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 418 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 429 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 437 of file inputManager.h.
|
inline |
Definition at line 498 of file inputManager.h.
|
inlineprivate |
Definition at line 569 of file inputManager.h.
|
inlineprivate |
Definition at line 607 of file inputManager.h.
|
inlineprivate |
Definition at line 593 of file inputManager.h.
|
inlineprivate |
Definition at line 621 of file inputManager.h.
|
inlineprivate |
Definition at line 600 of file inputManager.h.
|
inline |
Definition at line 514 of file inputManager.h.
|
inline |
Definition at line 502 of file inputManager.h.
|
inline |
Definition at line 505 of file inputManager.h.
|
inline |
Definition at line 511 of file inputManager.h.
|
inline |
Definition at line 469 of file inputManager.h.
|
inline |
Definition at line 508 of file inputManager.h.
|
inline |
Definition at line 470 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 285 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 356 of file inputManager.h.
|
inline |
Definition at line 366 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 298 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 318 of file inputManager.h.
|
inline |
Definition at line 471 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 345 of file inputManager.h.
double MaCh3Plotting::InputManager::getPostFitError | ( | 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 | ( | 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 382 of file inputManager.h.
|
inline |
Definition at line 392 of file inputManager.h.
|
inline |
Definition at line 403 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 480 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 491 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 634 of file inputManager.h.
|
inline |
Definition at line 499 of file inputManager.h.
|
private |
Definition at line 666 of file inputManager.h.
|
private |
Definition at line 661 of file inputManager.h.
|
private |
Definition at line 651 of file inputManager.h.
|
private |
Definition at line 644 of file inputManager.h.
|
private |
Definition at line 648 of file inputManager.h.
|
private |
Definition at line 662 of file inputManager.h.
|
private |
Definition at line 654 of file inputManager.h.
|
private |
Definition at line 663 of file inputManager.h.
|
private |
Definition at line 656 of file inputManager.h.
|
private |
Definition at line 660 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 216 of file inputManager.h.