Hammer  1.0.0
Helicity Amplitude Module for Matrix Element Reweighting
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Event.hh
Go to the documentation of this file.
1 ///
2 /// @file Event.hh
3 /// @brief Hammer event class
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_EVENT_HH
13 #define HAMMER_EVENT_HH
14 
15 #include <map>
16 #include <string>
17 #include <vector>
18 
19 #include "Hammer/Histos.fhh"
20 #include "Hammer/IndexTypes.hh"
21 #include "Hammer/Math/Tensor.hh"
22 #include "Hammer/ProcManager.hh"
25 
26 namespace Hammer {
27 
28  class Log;
29  class Process;
30  class DictionaryManager;
31 
32  /// @brief Event container class
33  ///
34  /// Contains the decay processes within an event, ...
35  ///
36  /// @ingroup Core
37  class Event : public SettingsConsumer {
38 
39  public:
40  /// @brief
41  /// @param[in] histograms
42  /// @param[in] dict
43  Event(Histos* histograms = nullptr, DictionaryManager* dict = nullptr);
44 
45  Event(const Event& other) = delete;
46  Event& operator=(const Event& other) = delete;
47  Event(Event&& other) = delete;
48  Event& operator=(Event&& other) = delete;
49 
50  ~Event() noexcept;
51 
52  public:
53  /// @brief
54  /// @param[in] p
55  /// @return
57 
58  /// @brief
59  /// @param[in] id
60  void removeProcess(ProcessUID id);
61 
62  void setEventBaseWeight(double weight);
63 
64  double getEventBaseWeight() const;
65 
66  /// @brief
67  void clear();
68 
69  /// @brief
70  void init();
71 
72  const EventUID& getEventId() const;
73 
74  /// @brief
75  /// @param[in] process
76  /// @param[in] what
77  /// @return
78  const Tensor& getAmplitude(ProcessUID process, WTerm what = WTerm::NUMERATOR) const;
79 
80  /// @brief
81  /// @param[in] what
82  /// @return
84 
85  /// @brief
86  /// @param[in] process
87  /// @param[in] what
88  /// @return
89  const Tensor& getSquaredAmplitude(ProcessUID process, WTerm what = WTerm::NUMERATOR) const;
90 
92 
93  /// @brief
94  /// @param[in] schemeName
95  /// @param[in] process
96  /// @return
97  std::vector<std::reference_wrapper<const Tensor>> getProcessFormFactors(const std::string& schemeName,
98  ProcessUID process) const;
99 
100  /// @brief
101  /// @param[in] schemeName
102  /// @return
104 
105  /// @brief
106  /// @param[in] schemeName
107  /// @param[in] process
108  /// @return
109  const Tensor& getTensorWeight(const std::string& schemeName, ProcessUID process) const;
110 
111  /// @brief
112  /// @param[in] schemeName
113  /// @return
114  ProcIdDict<std::reference_wrapper<const Tensor>> getTensorWeights(const std::string& schemeName) const;
115 
116  /// @brief
117  /// @param[in] schemeName
118  /// @param[in] process
119  /// @return
120  double getWeight(const std::string& schemeName, ProcessUID process) const;
121 
122  /// @brief
123  /// @param[in] schemeName
124  /// @return
125  ProcIdDict<double> getWeights(const std::string& schemeName) const;
126 
127  public:
128  /// @brief
129  void calc();
130 
131  public:
132  /// @brief
133  /// @param[in] label
134  /// @param[in] indices
135  void setHistogramBin(const std::string& label, const IndexList indices);
136 
137  /// @brief
138  void fillHistograms();
139 
140  public:
141  /// @brief
142  /// @param[out] msgwriter
143  void write(flatbuffers::FlatBufferBuilder* msgwriter) const;
144 
145  /// @brief
146  /// @param[in] msgreader
147  /// @param[in] merge
148  bool read(const Serial::FBEvent* msgreader, bool merge);
149 
150  protected:
151  /// @brief logging facility
152  /// @return stream to be used for logging
153  Log& getLog() const;
154 
155  /// @brief
156  void defineSettings();
157 
158  /// @brief
159  /// @param[in] id
160  /// @return
161  const ProcManager& getProcManager(ProcessUID id) const;
162 
163  /// @brief
164  /// @param[in] id
165  /// @return
167 
169 
170  private:
173 
175 
179 
180  double _eventWeight;
181  };
182 
183 } // namespace Hammer
184 
185 #endif
void init()
Definition: Event.cc:97
std::set< ProcessUID > EventUID
Definition: IndexTypes.hh:53
HashId ProcessUID
Definition: IndexTypes.hh:49
void setHistogramBin(const std::string &label, const IndexList indices)
Definition: Event.cc:111
Forward declaration of serialization related typedefs and includes.
Hammer data types declarations.
void write(flatbuffers::FlatBufferBuilder *msgwriter) const
Definition: Event.cc:153
ProcIdDict< std::reference_wrapper< const Tensor > > getTensorWeights(const std::string &schemeName) const
Definition: Event.cc:264
double _eventWeight
Definition: Event.hh:180
double getEventBaseWeight() const
Definition: Event.cc:52
DictionaryManager * _dictionaries
Definition: Event.hh:178
Decay process class.
Definition: Process.hh:34
const Tensor & getSquaredAmplitude(ProcessUID process, WTerm what=WTerm::NUMERATOR) const
Definition: Event.cc:226
ProcessUID addProcess(Process &p)
Definition: Event.cc:56
void setEventBaseWeight(double weight)
Definition: Event.cc:48
ProcIdDict< std::reference_wrapper< const Tensor > > getSquaredAmplitudes(WTerm what=WTerm::NUMERATOR) const
Definition: Event.cc:239
Event & operator=(const Event &other)=delete
Event(Histos *histograms=nullptr, DictionaryManager *dict=nullptr)
Definition: Event.cc:29
Hammer histogram manager class.
Definition: Histos.hh:43
void fillHistograms()
Definition: Event.cc:120
std::map< std::string, T > HistoNameDict
Definition: Histos.fhh:21
ProcIdDict< double > getWeights(const std::string &schemeName) const
Definition: Event.cc:284
ProcessUID addProcManager(ProcManager &&pm)
Definition: Event.cc:65
Base class to access the settings repository.
void clear()
Definition: Event.cc:41
ProcIdDict< std::reference_wrapper< const Tensor > > getAmplitudes(WTerm what=WTerm::NUMERATOR) const
Definition: Event.cc:230
Forward declarations for histogram manager class.
EventUID _eventId
Definition: Event.hh:172
HistoNameDict< IndexList > _histogramBins
Definition: Event.hh:176
std::vector< IndexType > IndexList
Decay process class.
Definition: ProcManager.hh:42
Logging class.
Definition: Logging.hh:33
bool read(const Serial::FBEvent *msgreader, bool merge)
Definition: Event.cc:177
ProcIdDict< ProcManager > _processes
Definition: Event.hh:171
Log & getLog() const
logging facility
Definition: Event.cc:214
void removeProcess(ProcessUID id)
Definition: Event.cc:78
ProcIdDict< std::vector< std::reference_wrapper< const Tensor > > > getFormFactors(const std::string &schemeName) const
Definition: Event.cc:252
Multidimensional tensor class with complex numbers as elements.
Definition: Tensor.hh:33
Base class for accessing Hammer settings repository.
Container class for all process related data structures.
~Event() noexcept
Definition: Event.cc:35
Event container class.
Definition: Event.hh:37
const Tensor & getAmplitude(ProcessUID process, WTerm what=WTerm::NUMERATOR) const
Definition: Event.cc:222
std::map< ProcessUID, T > ProcIdDict
Definition: IndexTypes.hh:51
std::vector< SchemeName > SchemeNameList
Definition: IndexTypes.hh:62
const Tensor & getTensorWeight(const std::string &schemeName, ProcessUID process) const
Definition: Event.cc:260
const ProcManager & getProcManager(ProcessUID id) const
Definition: Event.cc:89
void defineSettings()
purely virtual function for a class to define new settings
Definition: Event.cc:218
void calc()
Definition: Event.cc:104
SchemeNameList _schemes
Definition: Event.hh:174
double getWeight(const std::string &schemeName, ProcessUID process) const
Definition: Event.cc:273
Hammer tensor class.
std::vector< std::reference_wrapper< const Tensor > > getProcessFormFactors(const std::string &schemeName, ProcessUID process) const
Definition: Event.cc:248
const EventUID & getEventId() const
Definition: Event.cc:149
Histos * _histograms
Definition: Event.hh:177