Hammer  1.0.0
Helicity Amplitude Module for Matrix Element Reweighting
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ProcessDefinitions.hh
Go to the documentation of this file.
1 ///
2 /// @file ProcessDefinitions.hh
3 /// @brief Container class for storing included/forbidden process info
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_PROCESSDEFINITIONS_HH
13 #define HAMMER_PROCESSDEFINITIONS_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  ProcessDefinitions(const ProcessDefinitions& other) = delete;
55  ProcessDefinitions& operator=(const ProcessDefinitions& other) = delete;
56  ProcessDefinitions(ProcessDefinitions&& other) = default;
58 
59  virtual ~ProcessDefinitions() noexcept = default;
60  //@}
61 
62  protected:
63  /// @brief logging facility
64  /// @return stream to be used for logging
65  Log& getLog() const;
66 
67  public:
68  void write(flatbuffers::FlatBufferBuilder* msgwriter,
69  flatbuffers::Offset<Serial::FBProcDefs>* msgs) const;
70 
71  bool read(const Serial::FBProcDefs* msgreader, bool merge);
72 
73  public:
74  /// @brief
75  /// @param[in] decay
76  void addIncludedDecay(const std::vector<VertexName>& decay);
77 
78  /// @brief
79  /// @param[in] decay
80  void addForbiddenDecay(const std::vector<VertexName>& decay);
81 
82  std::set<HashId> decayStringsToProcessIds(const std::vector<std::vector<VertexName>>& names) const;
83 
84  protected:
85 
86  /// @brief
87  /// @return
88  std::vector<std::set<HashId>> includedDecaySignatures() const;
89 
90  /// @brief
91  /// @return
92  std::vector<std::set<HashId>> forbiddenDecaySignatures() const;
93 
94  /// @brief
95  /// @param[in] container
96  /// @return
97  std::vector<std::set<HashId>> decaySignatures(const std::vector<std::vector<std::string>>& container) const;
98 
99  public:
100 
101  /// @brief
102  /// @param[in] subamplitudes
103  /// @param[in] processId
104  /// @return
105  virtual bool isProcessIncluded(std::set<HashId> subamplitudes, ProcessUID processId) const;
106 
107  /// @brief
108  /// @param[in] processId
109  virtual void forbidProcess(ProcessUID processId) const;
110 
111  void init();
112 
113  private:
114  friend struct YAML::convert<::Hammer::ProcessDefinitions>;
115 
116  private:
117  /// the Hammer included decays
118  std::vector<std::vector<std::string>> _includedDecays;
119 
120  /// the Hammer forbidden decays
121  std::vector<std::vector<std::string>> _forbiddenDecays;
122 
123  /// @brief Included amplitude combinations
124  /// @details A list of {the set of amplitude class HashIds} composing each included process specification
125  std::vector<std::set<HashId>> _includedDecayCombos;
126  /// @brief Forbidden amplitude combinations
127  /// @details A list of {the set of amplitude class HashIds} composing each forbidden process specification
128  std::vector<std::set<HashId>> _forbiddenDecayCombos;
129  /// @brief Included process HashIds
130  /// @details The set of {the full HashId} for each included process, generated from the HashIds of the process'
131  /// component amplitudes
133  /// @brief Forbidden process HashIds
134  /// @details The set of {the full HashId} for each forbidden process, generated from the HashIds of the process'
135  /// component amplitudes
136  mutable std::set<HashId> _forbiddenProcesses;
137 
138 
139  };
140 
141  YAML::Emitter& operator<<(YAML::Emitter& out, const ProcessDefinitions& s);
142 
143 } // namespace Hammer
144 
145 namespace YAML {
146 
147  template <>
148  struct convert<::Hammer::ProcessDefinitions> {
149 
150  static Node encode(const ::Hammer::ProcessDefinitions& value);
151 
152  static bool decode(const Node& node, ::Hammer::ProcessDefinitions& value);
153  };
154 
155 } // namespace YAML
156 
157 #endif
void addForbiddenDecay(const std::vector< VertexName > &decay)
HashId ProcessUID
Definition: IndexTypes.hh:49
std::string VertexName
Definition: IndexTypes.hh:46
virtual void forbidProcess(ProcessUID processId) const
Forward declaration of serialization related typedefs and includes.
std::vector< std::set< HashId > > _forbiddenDecayCombos
Forbidden amplitude combinations.
std::set< HashId > _forbiddenProcesses
Forbidden process HashIds.
Hammer data types declarations.
std::vector< std::set< HashId > > forbiddenDecaySignatures() const
virtual ~ProcessDefinitions() noexcept=default
Log & getLog() const
logging facility
std::vector< std::vector< std::string > > _forbiddenDecays
the Hammer forbidden decays
std::vector< std::set< HashId > > includedDecaySignatures() const
Message logging routines.
std::set< HashId > decayStringsToProcessIds(const std::vector< std::vector< VertexName >> &names) const
void addIncludedDecay(const std::vector< VertexName > &decay)
virtual bool isProcessIncluded(std::set< HashId > subamplitudes, ProcessUID processId) const
Pdg forward declarations.
Logging class.
Definition: Logging.hh:33
std::vector< std::vector< std::string > > _includedDecays
the Hammer included decays
ProcessDefinitions()
default constructor
std::vector< std::set< HashId > > _includedDecayCombos
Included amplitude combinations.
ProcIdDict< std::set< HashId > > _includedProcesses
Included process HashIds.
Hammer settings manager class.
std::vector< std::set< HashId > > decaySignatures(const std::vector< std::vector< std::string >> &container) const
void write(flatbuffers::FlatBufferBuilder *msgwriter, flatbuffers::Offset< Serial::FBProcDefs > *msgs) const
bool read(const Serial::FBProcDefs *msgreader, bool merge)
std::map< ProcessUID, T > ProcIdDict
Definition: IndexTypes.hh:51
size_t HashId
Definition: IndexTypes.hh:31
Main class.
Definition: Hammer.hh:45
ProcessDefinitions & operator=(const ProcessDefinitions &other)=delete