![]() |
MaCh3
2.6.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 <Utils/Plotting/InputManager.h>
Public Member Functions | |
| InputManager (const std::string &translationConfigName, const std::vector< std::string > &_fileNames) | |
| 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, const std::string ¶mName) 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, const 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 |
| std::vector< std::string > | TryToFindDefaultParamNames (const std::string &fileNames) 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 222 of file InputManager.h.
| M3::Plotting::InputManager::InputManager | ( | const std::string & | translationConfigName, |
| const std::vector< std::string > & | _fileNames | ||
| ) |
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 239 of file InputManager.h.
|
delete |
|
default |
| void M3::Plotting::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 76 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 261 of file InputManager.h.
|
private |
Definition at line 790 of file InputManager.cpp.
|
private |
plotApp [options] fileName1;fileType;fitterName and only try to auto-detect it if it's not specified. this would save some time and would also be very helpful in situations where we can't auto-detect e.g. if there is some kind of overlap in the file structure between two fitters Definition at line 515 of file InputManager.cpp.
|
private |
Definition at line 438 of file InputManager.cpp.
|
private |
Definition at line 350 of file InputManager.cpp.
|
private |
Definition at line 465 of file InputManager.cpp.
|
private |
Definition at line 397 of file InputManager.cpp.
|
private |
Definition at line 294 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 339 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 451 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 424 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 435 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 443 of file InputManager.h.
|
inline |
Definition at line 504 of file InputManager.h.
|
inlineprivate |
Definition at line 575 of file InputManager.h.
|
inlineprivate |
Definition at line 613 of file InputManager.h.
|
inlineprivate |
Definition at line 599 of file InputManager.h.
|
inlineprivate |
Definition at line 627 of file InputManager.h.
|
inlineprivate |
Definition at line 606 of file InputManager.h.
|
inline |
Definition at line 520 of file InputManager.h.
|
inline |
Definition at line 508 of file InputManager.h.
|
inline |
Definition at line 511 of file InputManager.h.
|
inline |
Definition at line 517 of file InputManager.h.
|
inline |
Definition at line 475 of file InputManager.h.
|
inline |
Definition at line 514 of file InputManager.h.
|
inline |
Definition at line 476 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 291 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 362 of file InputManager.h.
|
inline |
Definition at line 372 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 304 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 324 of file InputManager.h.
|
inline |
Definition at line 477 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 351 of file InputManager.h.
| double M3::Plotting::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 116 of file InputManager.cpp.
| double M3::Plotting::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 144 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 388 of file InputManager.h.
|
inline |
Definition at line 398 of file InputManager.h.
|
inline |
Definition at line 409 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 486 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 497 of file InputManager.h.
|
private |
Definition at line 177 of file InputManager.cpp.
|
private |
Definition at line 236 of file InputManager.cpp.
| void M3::Plotting::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 89 of file InputManager.cpp.
|
inlineprivate |
Definition at line 643 of file InputManager.h.
|
inline |
Definition at line 505 of file InputManager.h.
|
private |
Definition at line 894 of file InputManager.cpp.
|
private |
Definition at line 675 of file InputManager.h.
|
private |
Definition at line 670 of file InputManager.h.
|
private |
Definition at line 660 of file InputManager.h.
|
private |
Definition at line 653 of file InputManager.h.
|
private |
Definition at line 657 of file InputManager.h.
|
private |
Definition at line 671 of file InputManager.h.
|
private |
Definition at line 663 of file InputManager.h.
|
private |
Definition at line 672 of file InputManager.h.
|
private |
Definition at line 665 of file InputManager.h.
|
private |
Definition at line 669 of file InputManager.h.
| const std::string M3::Plotting::InputManager::NOT_FOUND_STR |
the default string to return if something can't be found
Definition at line 224 of file InputManager.h.