38 std::string translationConfig = managerOptions[
"translationConfig"].as<std::string>();
39 if (translationConfig ==
"")
42 MACH3LOG_DEBUG(
"PlottingManager: Using default translation config file name");
45 MACH3LOG_DEBUG(
"PlottingManager: Using translation config file: {}", translationConfig);
47 std::string styleConfig = managerOptions[
"styleConfig"].as<std::string>();
48 if (styleConfig ==
"")
51 MACH3LOG_DEBUG(
"PlottingManager: Using default style config file name");
54 MACH3LOG_DEBUG(
"PlottingManager: Using style config file: {}", styleConfig);
57 _styleMan = std::make_unique<StyleManager>(styleConfig);
100 while ((c = getopt(argc, argv,
"o:l:d:c:srgh")) != -1)
153 for (; optind < argc; optind++)
165 MACH3LOG_ERROR(
"you specified -r <_plotRatios> = true but didn't specify any files to compare against, was this a mistake?");
170 MACH3LOG_INFO(
"No file labels specified, will just use the file names");
207 MACH3LOG_INFO(
" <input files> One or more input files (positional args)");
212 MACH3LOG_INFO(
" -l <labels> Comma/space-separated file labels");
231 std::filesystem::path path(saveName);
232 if (!path.has_extension()) {
233 path.replace_extension(
".pdf");
238 std::string ext = path.extension().string();
239 if (ext ==
".pdf" || ext ==
".ps" || ext ==
".eps") {
244 MACH3LOG_WARN(
"file extension '{}' that you provided doesnt support multiple plots in one file", ext);
245 MACH3LOG_WARN(
"should be one of .pdf, .eps .ps, will use pdf");
255 std::string ext = path.extension().string();
257 std::string stem = path.stem().string();
259 return stem + suffix + ext;
275 size_t end = labelString.find(
";");
276 while (end != std::string::npos)
278 labelVec.push_back(labelString.substr(0, end));
279 labelString.erase(labelString.begin(), labelString.begin() + end + 1);
280 end = labelString.find(
";");
282 labelVec.push_back(labelString.substr(0, end));
#define M3OpenConfig(filename)
Macro to simplify calling LoadYaml with file and line info.
void setExec(const std::string &execName)
Internally set the name of the executable that manager is being used in.
void initialise()
initalise this PlottingManager.
std::vector< std::string > _fileNames
YAML::Node _plottingConfig
const std::string getOutputName()
Get the straight up output file name with no bells or whistles, just the file extension.
std::vector< std::string > _defaultFileLabels
const std::string DEFAULT_PLOTTING_CONFIG
const std::string DEFAULT_TRANSLATION_CONFIG
std::string getUserOption(const std::string &option)
Retrieve a command line option you specified using addOption.
PlottingManager()
Construct a new PlottingManager using default plottingConfig config.
void addUserOption()
Describe an option you want to add to the PlottingManager which can be read in from the command line ...
const std::string DEFAULT_STYLE_CONFIG
std::unique_ptr< InputManager > _inputMan
std::vector< std::string > _fileLabels
std::string _configFileName
std::string _extraDrawOptions
void parseInputs(int argc, char *const *argv)
Parse command line arguments.
void parseFileLabels(std::string labelString, std::vector< std::string > &labelVec)
Parse string of labels into a vector of strings.
void setOutFileName(const std::string &fileName)
Parse and set the output file name, if extension specified, check its one root supports,...
void usage() const
Print a usage message for the current executable.
std::unique_ptr< StyleManager > _styleMan
Custom exception class used throughout MaCh3.
Main namespace for MaCh3 software.