![]() |
MaCh3 2.2.1
Reference Guide
|
The main class to be used in plotting scripts. More...
#include <Plotting/plottingUtils/plottingManager.h>
Public Member Functions | |
PlottingManager () | |
Construct a new PlottingManager using default plottingConfig config. | |
PlottingManager (const std::string &PlottingConfigName) | |
Construct a new PlottingManager using specified plottingConfig config. | |
void | initialise () |
initalise this PlottingManager. | |
~PlottingManager () | |
void | parseInputs (int argc, char *const *argv) |
Parse command line arguments. | |
void | parseInputsVec (std::vector< std::string > argv) |
Parse vector of command line arguments. | |
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(). | |
std::string | getUserOption (std::string option) |
Retrieve a command line option you specified using addOption. | |
void | usage () |
Print a usage message for the current executable. | |
void | parseFileLabels (std::string labelString, std::vector< std::string > &labelVec) |
Parse string of labels into a vector of strings. | |
void | setOutFileName (std::string fileName) |
Parse and set the output file name, if extension specified, check its one root supports, if not, default to pdf. | |
void | setExec (std::string execName) |
Internally set the name of the executable that manager is being used in. | |
template<typename T > | |
T | getOption (std::string option) |
Get a specific option from the config for this executable. | |
YAML::Node | getOption (std::string option) |
const StyleManager & | style () |
Get the StyleManager contained within this PlottingManager, for doing style related things. | |
const InputManager & | input () |
Get the InputManager contained within this PlottingManager, for doing input related things. | |
General getters | |
const std::string | getFileName (int i) |
const std::string | getFileLabel (int i) |
const std::string | getDrawOptions () |
const std::string | getOutputName () |
Get the straight up output file name with no bells or whistles, just the file extension. | |
const std::string | getOutputName (const std::string &suffix) |
Get the output name but can specify a siffix to add to the name, before the file extension. | |
const std::vector< std::string > | getFileNames () |
const std::vector< std::string > | getFileLabels () |
size_t | getNFiles () |
bool | getSplitBySample () |
bool | getPlotRatios () |
bool | getDrawGrid () |
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 33 of file plottingManager.h.
MaCh3Plotting::PlottingManager::PlottingManager | ( | ) |
Construct a new PlottingManager using default plottingConfig config.
Definition at line 5 of file plottingManager.cpp.
MaCh3Plotting::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 11 of file plottingManager.cpp.
|
inline |
Definition at line 64 of file plottingManager.h.
void MaCh3Plotting::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 176 of file plottingManager.cpp.
|
inline |
Definition at line 151 of file plottingManager.h.
|
inline |
Definition at line 128 of file plottingManager.h.
|
inline |
Definition at line 126 of file plottingManager.h.
|
inline |
Definition at line 143 of file plottingManager.h.
|
inline |
Definition at line 124 of file plottingManager.h.
|
inline |
Definition at line 141 of file plottingManager.h.
|
inline |
Definition at line 145 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 118 of file plottingManager.h.
|
inline |
Definition at line 119 of file plottingManager.h.
|
inline |
Get the straight up output file name with no bells or whistles, just the file extension.
Definition at line 133 of file plottingManager.h.
const std::string MaCh3Plotting::PlottingManager::getOutputName | ( | const std::string & | suffix | ) |
Get the output name but can specify a siffix 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 223 of file plottingManager.cpp.
|
inline |
Definition at line 149 of file plottingManager.h.
|
inline |
Definition at line 147 of file plottingManager.h.
std::string MaCh3Plotting::PlottingManager::getUserOption | ( | std::string | option | ) |
Retrieve a command line option you specified using addOption.
Definition at line 180 of file plottingManager.cpp.
void MaCh3Plotting::PlottingManager::initialise | ( | ) |
initalise this PlottingManager.
Definition at line 25 of file plottingManager.cpp.
|
inline |
Get the InputManager contained within this PlottingManager, for doing input related things.
Definition at line 162 of file plottingManager.h.
void MaCh3Plotting::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 247 of file plottingManager.cpp.
void MaCh3Plotting::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 92 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 77 of file plottingManager.h.
void MaCh3Plotting::PlottingManager::setExec | ( | 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 240 of file plottingManager.cpp.
void MaCh3Plotting::PlottingManager::setOutFileName | ( | 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 197 of file plottingManager.cpp.
|
inline |
Get the StyleManager contained within this PlottingManager, for doing style related things.
Definition at line 158 of file plottingManager.h.
void MaCh3Plotting::PlottingManager::usage | ( | ) |
Print a usage message for the current executable.
Definition at line 186 of file plottingManager.cpp.
|
private |
Definition at line 166 of file plottingManager.h.
|
private |
Definition at line 175 of file plottingManager.h.
|
private |
Definition at line 184 of file plottingManager.h.
|
private |
Definition at line 170 of file plottingManager.h.
|
private |
Definition at line 179 of file plottingManager.h.
|
private |
Definition at line 174 of file plottingManager.h.
|
private |
Definition at line 173 of file plottingManager.h.
|
private |
Definition at line 188 of file plottingManager.h.
|
private |
Definition at line 178 of file plottingManager.h.
|
private |
Definition at line 183 of file plottingManager.h.
|
private |
Definition at line 168 of file plottingManager.h.
|
private |
Definition at line 182 of file plottingManager.h.
|
private |
Definition at line 187 of file plottingManager.h.
const std::string MaCh3Plotting::PlottingManager::DEFAULT_PLOTTING_CONFIG |
The default plotting config config to use when instantiating new PlottingManager objects.
Definition at line 46 of file plottingManager.h.
const std::string MaCh3Plotting::PlottingManager::DEFAULT_STYLE_CONFIG |
The default style config config to be used by PlottingManager instances when instantiating the StyleManager.
Definition at line 41 of file plottingManager.h.
const std::string MaCh3Plotting::PlottingManager::DEFAULT_TRANSLATION_CONFIG |
The default translation config to be used by PlottingManager instances when instantiating the InputManager.
Definition at line 36 of file plottingManager.h.