17 auto names = Get<std::vector<std::string>>(
config[
"MaCh3Modes"], __FILE__, __LINE__);
19 for(
size_t i = 0; i < names.size(); i++)
22 Get<std::string>(
config[names[i]][
"Name"], __FILE__, __LINE__),
23 Get<int>(
config[names[i]][
"PlotColor"], __FILE__, __LINE__),
24 Get<std::vector<int>>(
config[names[i]][
"GeneratorMaping"], __FILE__, __LINE__),
25 Get<bool>(
config[names[i]][
"IsNC"], __FILE__, __LINE__),
26 Get<std::string>(
config[names[i]][
"SplineSuffix"], __FILE__, __LINE__));
28 if (!Get<bool>(
config[names[i]][
"IsNC"], __FILE__, __LINE__)) {
52 MACH3LOG_INFO(
"========================================================================");
53 MACH3LOG_INFO(
"{:<5} {:2} {:<20} {:2} {:<20} {:2} {:<30}",
"#",
"|",
"Name",
"|",
"FancyName",
"|",
Generator+
" Modes");
54 MACH3LOG_INFO(
"------------------------------------------------------------------------");
55 for(
int i = 0; i <
NModes; ++i) {
56 auto Name =
fMode[i].Name;
57 auto FancyName =
fMode[i].FancyName;
58 auto Values =
fMode[i].GeneratorMaping;
60 std::string generatorModes;
61 for (
const int& element : Values) {
62 generatorModes += std::to_string(element) +
" ";
64 MACH3LOG_INFO(
"{:<5} {:2} {:<20} {:2} {:<20} {:2} {:<30}", i,
"|", Name,
"|", FancyName,
"|", generatorModes);
66 MACH3LOG_INFO(
"========================================================================");
71 for (
size_t i = 0; i <
ModeMap.size(); ++i) {
80 if (
Mode.count(name)) {
90 std::string
const &fancyname,
92 std::vector<int>
const &GenMap,
94 std::string SplineSuffix) {
106 fMode.emplace(index, newinfo);
114 for(
int i = 0; i <
NModes; ++i) {
115 for(
size_t j = 0; j <
fMode[i].GeneratorMaping.size(); j++) {
116 maxElement = std::max(maxElement,
fMode[i].GeneratorMaping[j]);
121 for(
int m = 0; m <
NModes; ++m) {
122 for(
size_t i = 0; i <
fMode[m].GeneratorMaping.size(); ++i) {
123 if(
fMode[m].GeneratorMaping[i] < 0) {
149 return fMode[Index].Name;
164 return fMode[Index].IsNC;
180 return fMode[Index].FancyName;
186 if (
Mode.count(name)) {
201 if(Index >=
static_cast<int>(
ModeMap.size()))
222 return fMode[Index].PlotColor;
237 return fMode[Index].SplineSuffix;
#define MACH3LOG_CRITICAL
int MaCh3Modes_t
Enumerator of MaCh3Mode.
Type Get(const YAML::Node &node, const std::string File, const int Line)
Get content of config file.
#define M3OpenConfig(filename)
Macro to simplify calling LoadYaml with file and line info.
Custom exception class for MaCh3 errors.
std::map< std::string, MaCh3Modes_t > Mode
KS: Handy map which helps find mode number based on string.
int nCCModes
DB: Number of CC modes.
void DeclareNewMode(std::string const &name, std::string const &fancyname, int PlotColor, std::vector< int > const &GenMap, bool IsNC, std::string SplineSuffix)
KS: Add new mode.
std::string GetMaCh3ModeFancyName(const int Index)
KS: Get fancy name of mode, if mode not known you will get UNKNOWN_BAD.
MaCh3Modes(std::string const &filename)
KS: Initialise MaCh3 modes.
MaCh3Modes_t GetMode(const std::string &name)
KS: Get mode number based on name, if mode not known you will get UNKNOWN_BAD.
int NModes
KS: Number of modes, keep in mind actual number is +1 greater due to unknown category.
std::vector< int > ModeMap
KS: Handy map helping us find MaCh3 mode based on Generator mode value.
void Print()
KS: Print info about initialised modes.
std::string Generator
KS: Name of generator like NEUT, NuWro etc. this is to make stuff fancy.
std::string GetSplineSuffixFromMaCh3Mode(const int Index)
DB: Get binned spline mode suffic from MaCh3 Mode.
std::string Title
KS: Name of loaded modes.
MaCh3Modes_t EnsureModeNameRegistered(std::string const &name)
KS: Make sure we don't have two modes with the same name.
int GetMaCh3ModePlotColor(const int Index)
KS: Get normal name of mode, if mode not known you will get UNKNOWN_BAD.
std::string GetMaCh3ModeName(const int Index)
KS: Get normal name of mode, if mode not known you will get UNKNOWN_BAD.
bool IsMaCh3ModeNC(const int Index)
DB: Get IsNC (a check whether the given MaCh3 corresponds to a Neutral Current mode)
void PrepareMap()
KS: Fill ModeMap.
MaCh3Modes_t GetModeFromGenerator(const int Index)
KS: Get MaCh3 mode from generator mode.
std::map< MaCh3Modes_t, MaCh3ModeInfo > fMode
KS: Main map storing info about used modes.
KS: Class containing information for a single MaCh3Mode.
std::vector< int > GeneratorMaping
Mapping between mode and generator integers.
std::string SplineSuffix
Spline suffix.
std::string FancyName
Mode fancy name.
std::string Name
Mode name.
int PlotColor
Mode color for plotting purposes.