Hammer  1.0.0
Helicity Amplitude Module for Matrix Element Reweighting
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IndexTypes.hh
Go to the documentation of this file.
1 ///
2 /// @file IndexTypes.hh
3 /// @brief Hammer data types declarations
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_IndexTypes_HH
13 #define HAMMER_IndexTypes_HH
14 
15 #include <vector>
16 #include <set>
17 #include <map>
18 #include <string>
19 
20 #include "Hammer/Exceptions.hh"
21 #include "Hammer/Tools/Utils.hh"
22 
23 namespace Hammer {
24 
25  enum class WTerm { COMMON, NUMERATOR, DENOMINATOR };
26 
27  using ParticleIndex = size_t;
28  using ParticleIndices = std::vector<ParticleIndex>;
29  using UniqueParticleIndices = std::set<ParticleIndex>;
30 
31  using HashId = size_t;
32 
34  template <typename T>
35  using AmplitudeIdDict = std::map<AmplitudeUID, T>;
37  template <typename T>
38  using HadronicIdDict = std::map<HadronicUID, T>;
39 
40  using VertexUID = HashId;
41  template <typename T>
42  using VertexIdDict = std::map<VertexUID, T>;
43  using VertexUIDSet = std::set<VertexUID>;
44  template <typename T>
45  using VertexDict = std::map<ParticleIndex, T>;
46  using VertexName = std::string;
47 
48 
49  using ProcessUID = HashId;
50  template <typename T>
51  using ProcIdDict = std::map<ProcessUID, T>;
52 
53  using EventUID = std::set<ProcessUID>;
54  template <typename T>
56  using EventUIDGroup = std::set<EventUID>;
57  template <typename T>
59 
60 
61  using SchemeName = std::string;
62  using SchemeNameList = std::vector<SchemeName>;
63  template<typename T>
64  using SchemeDict = std::map<SchemeName, T>;
65 
66  template <typename T>
67  using WCPrefixDict = std::map<std::string, T>;
68 
69  using FFIndex = size_t;
70  template <typename T>
71  using FFIndexDict = std::map<FFIndex, T>;
72 
73  struct FFPrefixGroup {
74  std::string prefix;
75  std::string group;
76  std::string get() const {
77  return prefix + group;
78  }
79  bool operator<(const FFPrefixGroup& r) const {
80  return (prefix < r.prefix) || ( (prefix == r.prefix) && (group < r.group));
81  }
82  bool operator==(const FFPrefixGroup& r) const {
83  return (prefix == r.prefix) && (group == r.group);
84  }
85  };
86  template <typename T>
87  using FFPrefixGroupDict = std::map<FFPrefixGroup, T>;
88 
89  template <typename T>
90  struct NumDenPair {
91 
94 
95  T& get(WTerm what) {
96  switch(what) {
97  case WTerm::NUMERATOR:
98  return numerator;
99  case WTerm::DENOMINATOR:
100  return denominator;
101  case WTerm::COMMON:
102  throw Error("Invalid option");
103  }
104  throw Error("Invalid option");
105  }
106 
107  const T& get(WTerm what) const {
108  switch (what) {
109  case WTerm::NUMERATOR:
110  return numerator;
111  case WTerm::DENOMINATOR:
112  return denominator;
113  case WTerm::COMMON:
114  throw Error("Invalid option");
115  }
116  throw Error("Invalid option");
117  }
118  };
119 
120 }
121 
122 #endif
std::set< ProcessUID > EventUID
Definition: IndexTypes.hh:53
HashId ProcessUID
Definition: IndexTypes.hh:49
std::string VertexName
Definition: IndexTypes.hh:46
std::unordered_map< K, V, boost::hash< K >> UMap
Definition: Tools/Utils.hh:104
std::string prefix
Definition: IndexTypes.hh:74
std::string SchemeName
Definition: IndexTypes.hh:61
size_t FFIndex
Definition: IndexTypes.hh:69
HashId HadronicUID
Definition: IndexTypes.hh:36
HashId VertexUID
Definition: IndexTypes.hh:40
HashId AmplitudeUID
Definition: IndexTypes.hh:33
std::set< EventUID > EventUIDGroup
Definition: IndexTypes.hh:56
std::map< FFIndex, T > FFIndexDict
Definition: IndexTypes.hh:71
std::map< HadronicUID, T > HadronicIdDict
Definition: IndexTypes.hh:38
std::map< VertexUID, T > VertexIdDict
Definition: IndexTypes.hh:42
std::map< std::string, T > WCPrefixDict
Definition: IndexTypes.hh:67
std::set< VertexUID > VertexUIDSet
Definition: IndexTypes.hh:43
Hammer exception definitions.
bool operator<(const FFPrefixGroup &r) const
Definition: IndexTypes.hh:79
UMap< EventUIDGroup, T > EventIdGroupDict
Definition: IndexTypes.hh:58
Generic error class.
Definition: Exceptions.hh:23
std::map< FFPrefixGroup, T > FFPrefixGroupDict
Definition: IndexTypes.hh:87
std::map< ParticleIndex, T > VertexDict
Definition: IndexTypes.hh:45
std::vector< ParticleIndex > ParticleIndices
Definition: IndexTypes.hh:28
std::map< ProcessUID, T > ProcIdDict
Definition: IndexTypes.hh:51
std::vector< SchemeName > SchemeNameList
Definition: IndexTypes.hh:62
UMap< EventUID, T > EventIdDict
Definition: IndexTypes.hh:55
size_t ParticleIndex
Definition: IndexTypes.hh:27
std::map< SchemeName, T > SchemeDict
Definition: IndexTypes.hh:64
std::set< ParticleIndex > UniqueParticleIndices
Definition: IndexTypes.hh:29
size_t HashId
Definition: IndexTypes.hh:31
bool operator==(const FFPrefixGroup &r) const
Definition: IndexTypes.hh:82
std::map< AmplitudeUID, T > AmplitudeIdDict
Definition: IndexTypes.hh:35