Hammer
1.0.0
Helicity Amplitude Module for Matrix Element Reweighting
|
Hammer settings manager class. More...
#include <SettingsHandler.hh>
Public Member Functions | |
void | reset () |
reset all the contents of SettingsHandler More... | |
void | write (flatbuffers::FlatBufferBuilder *msgwriter, std::vector< flatbuffers::Offset< Serial::FBSetting >> *msgs) const |
bool | read (const Serial::FBHeader *msgreader, bool merge) |
Constructors | |
SettingsHandler () | |
default constructor More... | |
SettingsHandler (const SettingsHandler &other)=delete | |
SettingsHandler & | operator= (const SettingsHandler &other)=delete |
SettingsHandler (SettingsHandler &&other)=delete | |
SettingsHandler & | operator= (SettingsHandler &&other)=delete |
~SettingsHandler () noexcept=default | |
Hammer options | |
std::set< std::string > | getSettings (const std::string &path="", WTerm group=WTerm::COMMON) const |
access the list of registered settings More... | |
template<typename T > | |
T * | getNamedSettingValue (const std::string &path, const std::string &name, WTerm group=WTerm::COMMON) |
access a specific setting value More... | |
template<typename T > | |
T * | getNamedSettingValue (const std::string &fullName, WTerm group=WTerm::COMMON) |
access a specific setting value More... | |
template<typename T > | |
Setting * | addSetting (const std::string &path, const std::string &name, const T &value, WTerm group=WTerm::COMMON) |
add a setting to the store More... | |
template<typename T > | |
Setting * | addSetting (const std::string &fullName, const T &value, WTerm group=WTerm::COMMON) |
add a setting to the store More... | |
Setting * | cloneSetting (const std::string &path, const std::string &name, const Setting &value, WTerm group=WTerm::COMMON) |
Setting * | cloneSetting (const std::string &fullName, const Setting &value, WTerm group=WTerm::COMMON) |
Setting * | resetSetting (const std::string &path, const std::string &name, WTerm group=WTerm::COMMON) |
Setting * | resetSetting (const std::string &fullName, WTerm group=WTerm::COMMON) |
Setting * | getEntry (const std::string &path, const std::string &name, WTerm group) |
void | removeSetting (const std::string &path, const std::string &name, WTerm group=WTerm::COMMON) |
void | removeSetting (const std::string &fullName, WTerm group=WTerm::COMMON) |
template<typename T > | |
Setting * | changeSetting (const std::string &path, const std::string &name, const T &value, WTerm group=WTerm::COMMON) |
change a setting value More... | |
template<typename T > | |
Setting * | changeSetting (const std::string &fullName, const T &value, WTerm group=WTerm::COMMON) |
change a setting value More... | |
void | readSettings (const std::string &fileName) |
read Hammer settings from a file More... | |
void | parseSettings (const std::string &data) |
read Hammer settings from a string More... | |
void | saveSettings (const std::string &name, bool useDefault=true) const |
write current Hammer settings to a file More... | |
Bibliography | |
void | saveReferences (const std::string &filename) const |
writes a BibTeX file containing the bibliography associated to current run More... | |
bool | checkReference (const std::string &bibkey) |
check a bibliographic reference to the current run More... | |
void | addReference (const std::string &bibkey, const std::string &bibtex) |
add a bibliographic reference to the current run More... | |
void | clearReferences () |
empties current run bibliography More... | |
Protected Member Functions | |
Log & | getLog () const |
logging facility More... | |
Private Types | |
template<typename T > | |
using | NamedDict = std::map< std::string, T > |
Private Member Functions | |
void | processSetting (const YAML::Node &setting, const std::string &path, const std::string &name, WTerm group=WTerm::COMMON) |
void | processSettings (const YAML::Node &input, WTerm group=WTerm::COMMON) |
std::string | groupToPrefix (WTerm option) const |
WTerm | prefixToGroup (const std::string &option) const |
void | writeSetting (YAML::Emitter &emitter, const Setting &val, bool useDefault) const |
bool | isMassWidth (const std::string &name) const |
void | processMassWidth (const std::string &path, const std::string &name, double value) const |
std::map< std::string, std::map< std::string, const Setting * > > | getEntriesByGroup (WTerm group) const |
std::string | buildName (const std::string &path, const std::string &name, WTerm group) const |
std::tuple< std::string, std::string, WTerm > | parseName (const std::string &fullName) const |
Private Attributes | |
std::map< WTerm, NamedDict < NamedDict< Setting > > > | _settings |
the Hammer options dictionary More... | |
std::map< std::string, std::string > | _references |
Hammer settings manager class.
Stores Hammer options, provides facilities for saving and reading option files, provides option query interface. It also provide a repository of other run-wide information, such as the bibliography associated to the specific run, the list of files being processed
Definition at line 49 of file SettingsHandler.hh.
|
private |
Definition at line 230 of file SettingsHandler.hh.
|
inline |
default constructor
Definition at line 56 of file SettingsHandler.hh.
|
delete |
|
delete |
|
defaultnoexcept |
void Hammer::SettingsHandler::addReference | ( | const std::string & | bibkey, |
const std::string & | bibtex | ||
) |
add a bibliographic reference to the current run
[in] | bibkey | the BibTeX key |
[in] | bibtex | the body of the citation in BibTeX format |
Definition at line 342 of file SettingsHandler.cc.
Setting * Hammer::SettingsHandler::addSetting | ( | const std::string & | path, |
const std::string & | name, | ||
const T & | value, | ||
WTerm | group = WTerm::COMMON |
||
) |
add a setting to the store
[in] | path | the class owning the settings |
[in] | name | the name of the setting |
[in] | value | the value (and default value) of the setting. If setting is already present only |
[in] | group | whether it applies to the numerator, denominator or both default value is changed |
Definition at line 42 of file SettingsHandlerDefs.hh.
Setting * Hammer::SettingsHandler::addSetting | ( | const std::string & | fullName, |
const T & | value, | ||
WTerm | group = WTerm::COMMON |
||
) |
add a setting to the store
[in] | fullName | the full name of the setting in the "<path>:<name>" format |
[in] | value | the value (and default value) of the setting |
[in] | group | whether it applies to the numerator, denominator or both |
Definition at line 58 of file SettingsHandlerDefs.hh.
|
private |
Definition at line 236 of file SettingsHandler.cc.
Setting * Hammer::SettingsHandler::changeSetting | ( | const std::string & | path, |
const std::string & | name, | ||
const T & | value, | ||
WTerm | group = WTerm::COMMON |
||
) |
change a setting value
[in] | path | the class owning the settings |
[in] | name | the name of the setting |
[in] | value | the new value of the setting |
[in] | group | whether it applies to the numerator, denominator or both |
nullptr
if the setting was not found Definition at line 66 of file SettingsHandlerDefs.hh.
Setting * Hammer::SettingsHandler::changeSetting | ( | const std::string & | fullName, |
const T & | value, | ||
WTerm | group = WTerm::COMMON |
||
) |
change a setting value
[in] | fullName | the full name of the setting in the "<path>:<name>" format |
[in] | value | the new value of the setting |
[in] | group | whether it applies to the numerator, denominator or both |
nullptr
if the setting was not found Definition at line 90 of file SettingsHandlerDefs.hh.
bool Hammer::SettingsHandler::checkReference | ( | const std::string & | bibkey | ) |
check a bibliographic reference to the current run
[in] | bibkey | the BibTeX key |
Definition at line 338 of file SettingsHandler.cc.
void Hammer::SettingsHandler::clearReferences | ( | ) |
empties current run bibliography
Definition at line 350 of file SettingsHandler.cc.
Setting * Hammer::SettingsHandler::cloneSetting | ( | const std::string & | path, |
const std::string & | name, | ||
const Setting & | value, | ||
WTerm | group = WTerm::COMMON |
||
) |
Definition at line 48 of file SettingsHandler.cc.
Setting * Hammer::SettingsHandler::cloneSetting | ( | const std::string & | fullName, |
const Setting & | value, | ||
WTerm | group = WTerm::COMMON |
||
) |
Definition at line 52 of file SettingsHandler.cc.
|
private |
Definition at line 192 of file SettingsHandler.cc.
Setting * Hammer::SettingsHandler::getEntry | ( | const std::string & | path, |
const std::string & | name, | ||
WTerm | group | ||
) |
Definition at line 59 of file SettingsHandler.cc.
|
protected |
logging facility
Definition at line 44 of file SettingsHandler.cc.
T * Hammer::SettingsHandler::getNamedSettingValue | ( | const std::string & | path, |
const std::string & | name, | ||
WTerm | group = WTerm::COMMON |
||
) |
access a specific setting value
[in] | path | the class owning the settings |
[in] | name | the name of the setting |
[in] | group | whether it applies to the numerator, denominator or both |
nullptr
if the setting is not found or the type does not match Definition at line 22 of file SettingsHandlerDefs.hh.
T * Hammer::SettingsHandler::getNamedSettingValue | ( | const std::string & | fullName, |
WTerm | group = WTerm::COMMON |
||
) |
access a specific setting value
[in] | fullName | the full name of the setting in the "<path>:<name>" format |
[in] | group | whether it applies to the numerator, denominator or both |
nullptr
if the setting is not found or the type does not match Definition at line 34 of file SettingsHandlerDefs.hh.
set< string > Hammer::SettingsHandler::getSettings | ( | const std::string & | path = "" , |
WTerm | group = WTerm::COMMON |
||
) | const |
access the list of registered settings
[in] | path | the class owning the settings. An empty string returns all the registered settings |
[in] | group | whether it applies to the numerator, denominator or both |
Definition at line 108 of file SettingsHandler.cc.
|
private |
Definition at line 303 of file SettingsHandler.cc.
|
private |
Definition at line 132 of file SettingsHandler.cc.
|
delete |
|
delete |
|
private |
Definition at line 240 of file SettingsHandler.cc.
void Hammer::SettingsHandler::parseSettings | ( | const std::string & | data | ) |
read Hammer settings from a string
[in] | data | the settings |
Definition at line 122 of file SettingsHandler.cc.
|
private |
Definition at line 315 of file SettingsHandler.cc.
|
private |
Definition at line 136 of file SettingsHandler.cc.
|
private |
[in] | setting | |
[in] | path | |
[in] | name | |
[in] | group | whether it applies to the numerator, denominator or both |
Definition at line 145 of file SettingsHandler.cc.
|
private |
[in] | input | |
[in] | group | whether it applies to the numerator, denominator or both |
Definition at line 168 of file SettingsHandler.cc.
bool Hammer::SettingsHandler::read | ( | const Serial::FBHeader * | msgreader, |
bool | merge | ||
) |
Definition at line 280 of file SettingsHandler.cc.
void Hammer::SettingsHandler::readSettings | ( | const std::string & | fileName | ) |
read Hammer settings from a file
[in] | fileName | the file name |
Definition at line 127 of file SettingsHandler.cc.
void Hammer::SettingsHandler::removeSetting | ( | const std::string & | path, |
const std::string & | name, | ||
WTerm | group = WTerm::COMMON |
||
) |
[in] | path | |
[in] | name | |
[in] | group | whether it applies to the numerator, denominator or both |
Definition at line 88 of file SettingsHandler.cc.
void Hammer::SettingsHandler::removeSetting | ( | const std::string & | fullName, |
WTerm | group = WTerm::COMMON |
||
) |
[in] | fullName | |
[in] | group | whether it applies to the numerator, denominator or both |
Definition at line 101 of file SettingsHandler.cc.
void Hammer::SettingsHandler::reset | ( | ) |
reset all the contents of SettingsHandler
Definition at line 34 of file SettingsHandler.cc.
Setting * Hammer::SettingsHandler::resetSetting | ( | const std::string & | path, |
const std::string & | name, | ||
WTerm | group = WTerm::COMMON |
||
) |
Definition at line 73 of file SettingsHandler.cc.
Setting * Hammer::SettingsHandler::resetSetting | ( | const std::string & | fullName, |
WTerm | group = WTerm::COMMON |
||
) |
Definition at line 81 of file SettingsHandler.cc.
void Hammer::SettingsHandler::saveReferences | ( | const std::string & | filename | ) | const |
writes a BibTeX file containing the bibliography associated to current run
[in] | filename | the name of the file |
Definition at line 328 of file SettingsHandler.cc.
void Hammer::SettingsHandler::saveSettings | ( | const std::string & | name, |
bool | useDefault = true |
||
) | const |
write current Hammer settings to a file
[in] | name | the file name |
[in] | useDefault | the file name |
Definition at line 207 of file SettingsHandler.cc.
void Hammer::SettingsHandler::write | ( | flatbuffers::FlatBufferBuilder * | msgwriter, |
std::vector< flatbuffers::Offset< Serial::FBSetting >> * | msgs | ||
) | const |
Definition at line 254 of file SettingsHandler.cc.
|
private |
|
private |
Definition at line 235 of file SettingsHandler.hh.
the Hammer options dictionary
Definition at line 233 of file SettingsHandler.hh.