![]() |
MaCh3
2.6.1
Reference Guide
|
The main class to be used in plotting scripts. More...
#include <Utils/Plotting/PlottingManager.h>
Public Member Functions | |
| PlottingManager () | |
| Construct a new PlottingManager using default plottingConfig config. More... | |
| PlottingManager (const std::string &PlottingConfigName) | |
| Construct a new PlottingManager using specified plottingConfig config. More... | |
| void | initialise () |
| initalise this PlottingManager. More... | |
| ~PlottingManager () | |
| void | parseInputs (int argc, char *const *argv) |
| Parse command line arguments. More... | |
| void | parseInputsVec (const std::vector< std::string > &argv) |
| Parse vector of command line arguments. More... | |
| void | addUserOption () |
| Describe an option you want to add to the PlottingManager which can be read in from the command line and retrieved later with getOption(). This should be done before calling parseInputs(). More... | |
| std::string | getUserOption (const std::string &option) |
| Retrieve a command line option you specified using addOption. More... | |
| void | usage () const |
| Print a usage message for the current executable. More... | |
| void | parseFileLabels (std::string labelString, std::vector< std::string > &labelVec) |
| Parse string of labels into a vector of strings. More... | |
| void | setOutFileName (const std::string &fileName) |
| Parse and set the output file name, if extension specified, check its one root supports, if not, default to pdf. More... | |
| void | setExec (const std::string &execName) |
| Internally set the name of the executable that manager is being used in. More... | |
| template<typename T > | |
| T | getOption (const std::string &option) |
| Get a specific option from the config for this executable. More... | |
| YAML::Node | getOption (const std::string &option) const |
| const StyleManager & | style () const |
| Get the StyleManager contained within this PlottingManager, for doing style related things. More... | |
| const InputManager & | input () const |
| Get the InputManager contained within this PlottingManager, for doing input related things. More... | |
General getters | |
| const std::string | getFileName (int i) const |
| const std::string | getFileLabel (int i) const |
| const std::string | getDrawOptions () const |
| const std::string | getOutputName () |
| Get the straight up output file name with no bells or whistles, just the file extension. More... | |
| const std::string | getOutputName (const std::string &suffix) |
| Get the output name but can specify a suffix to add to the name, before the file extension. More... | |
| const std::vector< std::string > | getFileNames () const |
| const std::vector< std::string > | getFileLabels () const |
| size_t | getNFiles () const |
| bool | getSplitBySample () const |
| bool | getPlotRatios () const |
| bool | getDrawGrid () const |
Public Attributes | |
| const std::string | DEFAULT_TRANSLATION_CONFIG |
| const std::string | DEFAULT_STYLE_CONFIG |
| const std::string | DEFAULT_PLOTTING_CONFIG |
Private Attributes | |
| std::string | _configFileName = std::string(std::getenv("MACH3")) + "/plotting/PlottingConfig.yaml" |
| YAML::Node | _plottingConfig |
| YAML::Node | _execOptions |
| std::vector< std::string > | _fileNames |
| std::vector< std::string > | _fileLabels |
| std::vector< std::string > | _defaultFileLabels |
| std::string | _outputName = "Plot.pdf" |
| std::string | _extraDrawOptions = "" |
| bool | _splitBySample = false |
| bool | _plotRatios = false |
| bool | _drawGrid = false |
| std::unique_ptr< StyleManager > | _styleMan |
| std::unique_ptr< InputManager > | _inputMan |
The main class to be used in plotting scripts.
When it comes to plotting, this guys in charge, the main man, the head honcho, the big cheese. If it's a plot you need, this is the guy you call. You just call him in your scripts and let him and his goons StyleManager, and InputManager worry about the details, no questions asked. This class handles all the command line inputs and manages the other managers. Intention with this class is that you should be able to create one from your custom plotting script, then from that, be able to get all manner of inputs from the InputManager contained within, and set any style options you like from the StyleManager. Also a hopefully not too distant dream is to wrap this up in python so it is usable in .py scripts to take advantage of nice existing plotting libraries for e.g. MCMC plotting.
Definition at line 36 of file PlottingManager.h.
| M3::Plotting::PlottingManager::PlottingManager | ( | ) |
Construct a new PlottingManager using default plottingConfig config.
Definition at line 7 of file PlottingManager.cpp.
| M3::Plotting::PlottingManager::PlottingManager | ( | const std::string & | PlottingConfigName | ) |
Construct a new PlottingManager using specified plottingConfig config.
| PlottingConfigName | The config file file defining executables specific options, and other minor manager related options. |
Definition at line 13 of file PlottingManager.cpp.
|
inline |
Definition at line 67 of file PlottingManager.h.
| void M3::Plotting::PlottingManager::addUserOption | ( | ) |
Describe an option you want to add to the PlottingManager which can be read in from the command line and retrieved later with getOption(). This should be done before calling parseInputs().
Would be good to add functionality to this to allow user to add their own options.
The way I can think to do this would be have fn addUserOption() to set the options, defining the cmd line option (e.g. -x), the name of the option, and maybe some description of the option to be used in the help message
can then store these options in some map or something to be retrieved later by getUserOption()
Definition at line 188 of file PlottingManager.cpp.
|
inline |
Definition at line 154 of file PlottingManager.h.
|
inline |
Definition at line 131 of file PlottingManager.h.
|
inline |
Definition at line 129 of file PlottingManager.h.
|
inline |
Definition at line 146 of file PlottingManager.h.
|
inline |
Definition at line 127 of file PlottingManager.h.
|
inline |
Definition at line 144 of file PlottingManager.h.
|
inline |
Definition at line 148 of file PlottingManager.h.
|
inline |
Get a specific option from the config for this executable.
| T | the type of parameter expected for this option, e.g. std::string. |
| option | The option that you want from the config. |
Definition at line 121 of file PlottingManager.h.
|
inline |
Definition at line 122 of file PlottingManager.h.
|
inline |
Get the straight up output file name with no bells or whistles, just the file extension.
Definition at line 136 of file PlottingManager.h.
| const std::string M3::Plotting::PlottingManager::getOutputName | ( | const std::string & | suffix | ) |
Get the output name but can specify a suffix to add to the name, before the file extension.
| suffix | The suffix to add to the file name. |
Output file name, including the file extension will be returned, but with specified suffix after the name but before the extension. This is useful for e.g. saving multiple LLH scan types to separate files: can specify suffix "_PriotLLH" will return OutputName_PriorLLH.ext
Definition at line 252 of file PlottingManager.cpp.
|
inline |
Definition at line 152 of file PlottingManager.h.
|
inline |
Definition at line 150 of file PlottingManager.h.
| std::string M3::Plotting::PlottingManager::getUserOption | ( | const std::string & | option | ) |
Retrieve a command line option you specified using addOption.
Definition at line 192 of file PlottingManager.cpp.
| void M3::Plotting::PlottingManager::initialise | ( | ) |
initalise this PlottingManager.
Definition at line 27 of file PlottingManager.cpp.
|
inline |
Get the InputManager contained within this PlottingManager, for doing input related things.
Definition at line 165 of file PlottingManager.h.
| void M3::Plotting::PlottingManager::parseFileLabels | ( | std::string | labelString, |
| std::vector< std::string > & | labelVec | ||
| ) |
Parse string of labels into a vector of strings.
| labelString | string of labels of the form "label1;label2;...". |
| labelVec | vector that the individual label strings will be placed into. |
Definition at line 271 of file PlottingManager.cpp.
| void M3::Plotting::PlottingManager::parseInputs | ( | int | argc, |
| char *const * | argv | ||
| ) |
Parse command line arguments.
| argc | The number of command line arguments. |
| argv | The arguments themselves. |
Takes in c style command line arguments and parses particular general ones that are useful for a wide variety of plotting scripts.
Please also keep these options in mind and use them in your own plotting scripts.
General cmd line interface for a plotting script will look like:
Definition at line 90 of file PlottingManager.cpp.
|
inline |
Parse vector of command line arguments.
This mainly just exists for the sake of the python binding.
| argv | The arguments to parse. |
Definition at line 80 of file PlottingManager.h.
| void M3::Plotting::PlottingManager::setExec | ( | const std::string & | execName | ) |
Internally set the name of the executable that manager is being used in.
| execName | Name of the current executable, will also need to be defined in the plotting config file. |
This is used by e.g. getOption() so the PlottingManager knows where to look for the option in the plotting config file.
Definition at line 264 of file PlottingManager.cpp.
| void M3::Plotting::PlottingManager::setOutFileName | ( | const std::string & | saveName | ) |
Parse and set the output file name, if extension specified, check its one root supports, if not, default to pdf.
| fileName | the name of the output file. |
Will check the provided saveName for file extensions, if it is one of .pdf or .eps, then just use the provided string as the full output name. If no file extension is specified, append .pdf so plots will be saved as pdf. if some other file extension is specified, replace with .pdf as only .pdf and .eps support printing multiple plots to one file in root.
Definition at line 230 of file PlottingManager.cpp.
|
inline |
Get the StyleManager contained within this PlottingManager, for doing style related things.
Definition at line 161 of file PlottingManager.h.
| void M3::Plotting::PlottingManager::usage | ( | ) | const |
Print a usage message for the current executable.
Definition at line 198 of file PlottingManager.cpp.
|
private |
Definition at line 169 of file PlottingManager.h.
|
private |
Definition at line 178 of file PlottingManager.h.
|
private |
Definition at line 187 of file PlottingManager.h.
|
private |
Definition at line 173 of file PlottingManager.h.
|
private |
Definition at line 182 of file PlottingManager.h.
|
private |
Definition at line 177 of file PlottingManager.h.
|
private |
Definition at line 176 of file PlottingManager.h.
|
private |
Definition at line 191 of file PlottingManager.h.
|
private |
Definition at line 181 of file PlottingManager.h.
|
private |
Definition at line 186 of file PlottingManager.h.
|
private |
Definition at line 171 of file PlottingManager.h.
|
private |
Definition at line 185 of file PlottingManager.h.
|
private |
Definition at line 190 of file PlottingManager.h.
| const std::string M3::Plotting::PlottingManager::DEFAULT_PLOTTING_CONFIG |
The default plotting config config to use when instantiating new PlottingManager objects.
Definition at line 49 of file PlottingManager.h.
| const std::string M3::Plotting::PlottingManager::DEFAULT_STYLE_CONFIG |
The default style config config to be used by PlottingManager instances when instantiating the StyleManager.
Definition at line 44 of file PlottingManager.h.
| const std::string M3::Plotting::PlottingManager::DEFAULT_TRANSLATION_CONFIG |
The default translation config to be used by PlottingManager instances when instantiating the InputManager.
Definition at line 39 of file PlottingManager.h.