Hammer  1.0.0
Helicity Amplitude Module for Matrix Element Reweighting
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SchemeDefinitions.hh
Go to the documentation of this file.
1 ///
2 /// @file SchemeDefinitions.hh
3 /// @brief Container class for Scheme Definitions
4 ///
5 
6 //**** This file is a part of the HAMMER library
7 //**** Copyright (C) 2016 - 2020 The HAMMER Collaboration
8 //**** HAMMER is licensed under version 3 of the GPL; see COPYING for details
9 //**** Please note the MCnet academic guidelines; see GUIDELINES for details
10 
11 // -*- C++ -*-
12 #ifndef HAMMER_SCHEMEDEFINITIONS_HH
13 #define HAMMER_SCHEMEDEFINITIONS_HH
14 
15 #include <complex>
16 #include <map>
17 #include <set>
18 #include <string>
19 #include <utility>
20 #include <vector>
21 #include <type_traits>
22 
23 #include <boost/variant.hpp>
24 
25 #include "Hammer/IndexTypes.hh"
27 #include "Hammer/Tools/Logging.hh"
28 #include "Hammer/Tools/Pdg.fhh"
29 
30 #include "yaml-cpp/yaml.h"
31 
32 namespace Hammer {
33 
34  class Log;
35 
36  /// @brief Hammer settings manager class
37  ///
38  /// Stores Hammer options, provides facilities for saving and reading option files,
39  /// provides option query interface. It also provide a repository of other run-wide
40  /// information, such as the bibliography associated to the specific run, the list
41  /// of files being processed
42  ///
43  /// @ingroup Handlers
45 
46  public:
47  /// @name Constructors
48  //@{
49 
50  /// default constructor
52  }
53 
54  SchemeDefinitions(const SchemeDefinitions& other) = delete;
55  SchemeDefinitions& operator=(const SchemeDefinitions& other) = delete;
56  SchemeDefinitions(SchemeDefinitions&& other) = default;
57  SchemeDefinitions& operator=(SchemeDefinitions&& other) = default;
58  virtual ~SchemeDefinitions() noexcept = default;
59  //@}
60 
61  protected:
62  /// @brief logging facility
63  /// @return stream to be used for logging
64  Log& getLog() const;
65 
66  public:
67  void write(flatbuffers::FlatBufferBuilder* msgwriter,
68  std::vector<flatbuffers::Offset<Serial::FBFFScheme>>* msgs) const;
69 
70  bool read(const Serial::FBHeader* msgreader, bool merge);
71 
72  public:
73 
74  /// @brief
75  /// @param[in] schemeName
76  /// @param[in] schemes
77  void addFFScheme(const std::string& schemeName, const std::map<std::string, std::string>& schemes);
78 
79  /// @brief
80  /// @param[in] schemeName
81  void removeFFScheme(const std::string& schemeName);
82 
83  /// @brief
84  /// @return
86 
87  /// @brief
88  /// @param[in] schemes
89  void setFFInputScheme(const std::map<std::string, std::string>& schemes);
90 
91  using NewLabelsByGroup = std::map<std::string, std::vector<std::string>>;
92 
93  /// @brief
94  /// @return
96 
97  protected:
98 
99  /// @brief
100  /// @param[in] schemeName
101  /// @return
102  const HadronicIdDict<std::string> getScheme(const std::string& schemeName = "") const;
103 
104  public:
105 
106  /// @brief
107  /// @return
108  virtual const SchemeDict<ProcIdDict<FFIndex>>& getSchemeDefs() const;
109 
110  /// @brief
111  /// @param[in] id
112  /// @return
114 
115  /// @brief
116  /// @param[in] processId
117  /// @return
118  virtual std::set<FFIndex> getFormFactorIndices(HadronicUID processId) const;
119 
120  /// @brief
121  /// @param[in] processId
122  /// @return
123  virtual FFIndex getDenominatorFormFactor(HadronicUID processId) const;
124 
125  void init(std::map<HashId, std::vector<std::string>> formFactGroups);
126 
127  private:
128  friend struct YAML::convert<::Hammer::SchemeDefinitions>;
129 
130  private:
131 
132  /// the Hammer numerator form factor schemes
133  SchemeDict<std::map<std::string, std::string>> _formFactorSchemeNames;
134 
135  /// the Hammer denominator form factor scheme
136  std::map<std::string, std::string> _formFactorBase;
137 
138 
139  /// @brief Selected formfactors by subprocess
140  /// @details This container provides an identifier, FFIndex, for each FF parametrization in each subprocess: A
141  /// map {name of an FF scheme, map {each subprocess FF HashId (taken from _formFactors), FFIndex}}. FFIndex is
142  /// the ordered position of the parametrization in the list of chosen FF parametrizations.
144 
145 
146  };
147 
148  YAML::Emitter& operator<<(YAML::Emitter& out, const SchemeDefinitions& s);
149 
150 } // namespace Hammer
151 
152 namespace YAML {
153 
154  template <>
155  struct convert<::Hammer::SchemeDefinitions> {
156 
157  static Node encode(const ::Hammer::SchemeDefinitions& value);
158 
159  static bool decode(const Node& node, ::Hammer::SchemeDefinitions& value);
160  };
161 
162 } // namespace YAML
163 
164 #endif
Forward declaration of serialization related typedefs and includes.
Hammer data types declarations.
virtual SchemeDict< FFIndex > getFFSchemesForProcess(HadronicUID id) const
size_t FFIndex
Definition: IndexTypes.hh:69
virtual FFIndex getDenominatorFormFactor(HadronicUID processId) const
HashId HadronicUID
Definition: IndexTypes.hh:36
bool read(const Serial::FBHeader *msgreader, bool merge)
virtual std::set< FFIndex > getFormFactorIndices(HadronicUID processId) const
virtual const SchemeDict< ProcIdDict< FFIndex > > & getSchemeDefs() const
void addFFScheme(const std::string &schemeName, const std::map< std::string, std::string > &schemes)
std::map< HadronicUID, T > HadronicIdDict
Definition: IndexTypes.hh:38
Message logging routines.
SchemeDict< std::map< std::string, std::string > > _formFactorSchemeNames
the Hammer numerator form factor schemes
Pdg forward declarations.
const HadronicIdDict< std::string > getScheme(const std::string &schemeName="") const
SchemeDict< ProcIdDict< FFIndex > > _formFactorSchemes
Selected formfactors by subprocess.
Logging class.
Definition: Logging.hh:33
void write(flatbuffers::FlatBufferBuilder *msgwriter, std::vector< flatbuffers::Offset< Serial::FBFFScheme >> *msgs) const
void setFFInputScheme(const std::map< std::string, std::string > &schemes)
void removeFFScheme(const std::string &schemeName)
SchemeDefinitions & operator=(const SchemeDefinitions &other)=delete
std::map< ProcessUID, T > ProcIdDict
Definition: IndexTypes.hh:51
std::vector< SchemeName > SchemeNameList
Definition: IndexTypes.hh:62
std::map< std::string, std::string > _formFactorBase
the Hammer denominator form factor scheme
std::map< SchemeName, T > SchemeDict
Definition: IndexTypes.hh:64
HadronicIdDict< NewLabelsByGroup > getFFDuplicates() const
size_t HashId
Definition: IndexTypes.hh:31
virtual ~SchemeDefinitions() noexcept=default
Main class.
Definition: Hammer.hh:45
void init(std::map< HashId, std::vector< std::string >> formFactGroups)
SchemeNameList getFFSchemeNames() const
SchemeDefinitions()
default constructor
Hammer settings manager class.
Log & getLog() const
logging facility
std::map< std::string, std::vector< std::string >> NewLabelsByGroup