Hammer  1.0.0
Helicity Amplitude Module for Matrix Element Reweighting
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ProcGraph.hh
Go to the documentation of this file.
1 ///
2 /// @file ProcGraph.hh
3 /// @brief Container class for process tree structure and its amplitudes associations
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_PROCESSGRAPH_HH
13 #define HAMMER_PROCESSGRAPH_HH
14 
15 #include <map>
16 #include <string>
17 #include <vector>
18 #include <tuple>
19 
20 #include "Hammer/ProcGraph.fhh"
21 #include "Hammer/Particle.hh"
22 
23 namespace Hammer {
24 
25  class Log;
26  class Process;
27  class DictionaryManager;
28 
29  template<typename T>
30  using EdgeWeightDict = std::map<size_t, T, std::less<size_t>>;
31 
32  template <typename T>
33  using DepthLevelDict = std::map<size_t, T, std::greater<size_t>>;
34 
35 
36  class AmplTriplet {
37  public:
38  AmplEntry resolvePurePS(bool parentPS, bool daughterPS) const;
39 
43 
44  private:
45  /// @brief logging facility
46  /// @return stream to be used for logging
47  Log& getLog() const;
48  };
49 
50  struct EdgeEntry {
56  };
57 
58  struct VertexEntry {
62  };
63 
64  /// @brief Decay process class
65  ///
66  /// Contains the amplitudes, weights and info associated to a decay, ...
67  ///
68  /// @ingroup Core
69  class ProcGraph {
70 
71  public:
72  ProcGraph();
73 
74  ProcGraph(const ProcGraph& other) = delete;
75  ProcGraph& operator=(const ProcGraph& other) = delete;
76  ProcGraph(ProcGraph&& other) = delete;
77  ProcGraph& operator=(ProcGraph&& other) = delete;
78 
79  ~ProcGraph() noexcept = default;
80 
81  public:
83  using VertexListType = std::vector<VertexEntry>;
85 
86  public:
87  /// @brief
88  /// @param[in] dictionaries
89  /// @param[in] inputs
90  void initialize(const DictionaryManager* dictionaries, const Process* inputs);
91 
92  /// @brief
93  /// @param[in] ampltype
94  /// @param[in] parent
95  /// @param[in] daughter
96  std::tuple<Particle, ParticleList, ParticleList> getParticleVectors(AmplType ampltype, ParticleIndex parent,
97  ParticleIndex daughter) const;
98 
99  ///@brief
100  /// @param[in] ampl
101  /// @param[in] ancestorAmpl
102  /// @param[in] isAncestorGrandparent
103  double getMultFactor(AmplEntry ampl, AmplEntry ancestorAmpl, bool isAncestorGrandparent) const;
104 
105  ///@brief
106  /// @param[in] ampl
107  /// @param[in] parent
108  /// @param[in] daughter
109  double getMassFactor(AmplEntry ampl, ParticleIndex parent, ParticleIndex daughter) const;
110 
111  const SelAmplitudeDict& selectedAmplitudes() const;
113 
114  protected:
115  /// @brief logging facility
116  /// @return stream to be used for logging
117  Log& getLog() const;
118 
119  /// @brief
120  void makeDepthMap(ParticleIndex parent, size_t seed);
121 
122  void makeVertexEdgeTrees();
123 
124  void selectEdgeVertices();
125 
126  bool isAssignedVertex(ParticleIndex index) const;
127 
128  private:
132 
135 
136  const Process* _inputs;
138  };
139 
140 } // namespace Hammer
141 
142 #endif
double getMassFactor(AmplEntry ampl, ParticleIndex parent, ParticleIndex daughter) const
Definition: ProcGraph.cc:207
std::vector< VertexEntry > VertexListType
Definition: ProcGraph.hh:83
NumDenPair< bool > parentPSFlags
Definition: ProcGraph.hh:54
AmplitudeBase * edge
Definition: ProcGraph.hh:42
Base class for amplitudes.
const DictionaryManager * _dictionaries
Definition: ProcGraph.hh:137
std::tuple< Particle, ParticleList, ParticleList > getParticleVectors(AmplType ampltype, ParticleIndex parent, ParticleIndex daughter) const
Definition: ProcGraph.cc:175
AmplitudeBase * amplitude
Definition: ProcGraph.hh:60
ProcGraph & operator=(const ProcGraph &other)=delete
UniqueParticleIndices _assignedVertices
Definition: ProcGraph.hh:134
void makeVertexEdgeTrees()
Definition: ProcGraph.cc:89
Decay process class.
Definition: Process.hh:34
ParticleIndex parentIdx
Definition: ProcGraph.hh:51
double getMultFactor(AmplEntry ampl, AmplEntry ancestorAmpl, bool isAncestorGrandparent) const
Definition: ProcGraph.cc:240
void initialize(const DictionaryManager *dictionaries, const Process *inputs)
Definition: ProcGraph.cc:61
NumDenPair< bool > parentPSFlags
Definition: ProcGraph.hh:61
AmplTriplet amplitudes
Definition: ProcGraph.hh:53
const UniqueParticleIndices & assignedVertices() const
Definition: ProcGraph.cc:72
void selectEdgeVertices()
Definition: ProcGraph.cc:144
SelAmplitudeDict _selectedAmplitudes
Definition: ProcGraph.hh:133
Logging class.
Definition: Logging.hh:33
ParticleIndex parentIdx
Definition: ProcGraph.hh:59
AmplitudeBase * daughter
Definition: ProcGraph.hh:41
const SelAmplitudeDict & selectedAmplitudes() const
Definition: ProcGraph.cc:69
std::map< size_t, T, std::greater< size_t >> DepthLevelDict
Definition: ProcGraph.hh:33
AmplitudeBase * parent
Definition: ProcGraph.hh:40
std::map< size_t, T, std::less< size_t >> EdgeWeightDict
Definition: ProcGraph.hh:30
EdgeDictType _implementedEdges
Definition: ProcGraph.hh:130
VertexDict< SelectedAmplEntry > SelAmplitudeDict
Definition: ProcGraph.hh:84
~ProcGraph() noexcept=default
void makeDepthMap(ParticleIndex parent, size_t seed)
Definition: ProcGraph.cc:76
std::map< ParticleIndex, T > VertexDict
Definition: IndexTypes.hh:45
AmplEntry resolvePurePS(bool parentPS, bool daughterPS) const
Definition: ProcGraph.cc:27
ParticleIndex daughterIdx
Definition: ProcGraph.hh:52
bool isAssignedVertex(ParticleIndex index) const
Definition: ProcGraph.cc:140
size_t ParticleIndex
Definition: IndexTypes.hh:27
Decay process class.
Definition: ProcGraph.hh:69
VertexListType _implementedVertices
Definition: ProcGraph.hh:131
Hammer particle class.
std::set< ParticleIndex > UniqueParticleIndices
Definition: IndexTypes.hh:29
Declarations of process graph data structures.
const Process * _inputs
Definition: ProcGraph.hh:136
VertexDict< size_t > _depthMap
Definition: ProcGraph.hh:129
Log & getLog() const
logging facility
Definition: ProcGraph.cc:258
NumDenPair< bool > daughterPSFlags
Definition: ProcGraph.hh:55
Log & getLog() const
logging facility
Definition: ProcGraph.cc:54
EdgeWeightDict< DepthLevelDict< std::vector< EdgeEntry >>> EdgeDictType
Definition: ProcGraph.hh:82