15 #include <boost/algorithm/string.hpp>
35 #include "yaml-cpp/yaml.h"
41 namespace MD = MultiDimensional;
43 DictionaryManager::DictionaryManager()
46 _external{
new ExternalData{_providers.get()}},
47 _rates{
new ProcRates{_external.get()}},
48 _purePSDefs{
new PurePhaseSpaceDefs{}},
49 _procDefs{
new ProcessDefinitions{}} {
55 _rates->setSettingsHandler(sh);
135 vector<flatbuffers::Offset<Serial::FBFFScheme>> schemes;
136 vector<flatbuffers::Offset<Serial::FBPurePS>> pureps;
137 vector<flatbuffers::Offset<Serial::FBSetting>> settings;
143 auto serialschemes = msgwriter->CreateVector(schemes);
144 auto serialps = msgwriter->CreateVector(pureps);
145 auto serialsettings = msgwriter->CreateVector(settings);
146 Serial::FBHeaderBuilder serialheader{*msgwriter};
147 serialheader.add_ffschemes(serialschemes);
148 serialheader.add_settings(serialsettings);
149 serialheader.add_pureps(serialps);
150 serialheader.add_processdefs(procs);
151 auto headoffset = serialheader.Finish();
152 msgwriter->Finish(headoffset);
157 result &=
_procDefs->read(msgreader->processdefs(), merge);
168 YAML::Node config = YAML::Load(data);
173 YAML::Node config = YAML::LoadFile(name);
178 if (config.IsMap()) {
179 if (config[
"Processes"]) {
182 }
catch (YAML::Exception&) {
183 MSG_ERROR(
"Problem parsing process input. Beware missing spaces after inline ':'.");
186 if (config[
"FormFactors"]) {
189 }
catch (YAML::Exception&) {
190 MSG_ERROR(
"Problem parsing form factor input. Beware missing spaces after inline ':'.");
193 if (config[
"PurePSVertices"]) {
196 }
catch (YAML::Exception&) {
197 MSG_ERROR(
"Problem parsing pure PS input. Beware missing spaces after inline ':'.");
201 MSG_ERROR(
"Problem parsing input. Beware missing spaces after inline ':'.");
207 YAML::Emitter emitter(file);
208 file.open(name.c_str());
209 if (file.is_open()) {
210 emitter << YAML::Comment(
version() +
string(
" header card")) << YAML::Newline;
211 emitter << YAML::BeginMap;
212 emitter << YAML::Key <<
"Processes";
214 emitter << YAML::Key <<
"FormFactors";
216 auto purePSNode = YAML::convert<PurePhaseSpaceDefs>::encode(*
_purePSDefs);
217 if(!purePSNode.IsNull()){
218 emitter << YAML::Key <<
"PurePSVertices";
219 emitter << YAML::Value << purePSNode;
221 emitter << YAML::EndMap;
222 emitter << YAML::Newline;
virtual const PurePhaseSpaceDefs & purePSDefs() const
PDG codes to UID functions.
std::unique_ptr< ProcRates > _rates
void readDecays(const std::string &fileName)
read Hammer settings from a file
Hammer settings manager class.
std::unique_ptr< PurePhaseSpaceDefs > _purePSDefs
Container class for values of WC and FF vectors.
void write(flatbuffers::FlatBufferBuilder *msgwriter, std::vector< flatbuffers::Offset< Serial::FBSetting >> *msgs) const
Container class for storing included/forbidden process info.
Interface class for amplitudes, rates, FFs dictionary container.
void processDecays(const YAML::Node &input)
Message logging routines.
bool read(const Serial::FBHeader *msgreader, bool merge)
Hammer base amplitude class.
virtual const ProvidersRepo & providers() const
virtual void defineSettings()
purely virtual function for a class to define new settings
std::unique_ptr< ExternalData > _external
static Log & getLog(const std::string &name)
Get a logger with the given name.
virtual void setSettingsHandler(SettingsHandler &sh)
set link to settings repository handler.
Order-0 tensor data container.
virtual const ExternalData & externalData() const
void saveDecays(const std::string &fileName)
write current Hammer settings to a file
Hammer settings manager class.
Container class for pure phase space vertices definitions.
void write(flatbuffers::FlatBufferBuilder *msgwriter) const
virtual const ProcRates & rates() const
SettingsHandler * getSettingsHandler() const
provide the pointer to the repository handler
std::unique_ptr< ProvidersRepo > _providers
Container class for Scheme Definitions.
Hammer settings manager class.
virtual void setSettingsHandler(SettingsHandler &sh)
set link to settings repository handler.
std::unique_ptr< SchemeDefinitions > _schemeDefs
virtual const SchemeDefinitions & schemeDefs() const
Container class for process rate tensors.
Hammer available modules header.
virtual ~DictionaryManager() noexcept
Serialization related typedefs and includes.
Hammer settings manager class.
std::unique_ptr< ProcessDefinitions > _procDefs
virtual const ProcessDefinitions & processDefs() const
void parseDecays(const std::string &yamlData)
read Hammer settings from a string
Global container class for amplitudes, rates, FFs, data.