Hammer  1.0.0
Helicity Amplitude Module for Matrix Element Reweighting
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AmplitudeBase.hh
Go to the documentation of this file.
1 ///
2 /// @file AmplitudeBase.hh
3 /// @brief Hammer base amplitude 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_AMPLITUDE_BASE
13 #define HAMMER_AMPLITUDE_BASE
14 
15 #include <string>
16 #include <vector>
17 #include <memory>
18 
19 #include "Hammer/Particle.fhh"
20 #include "Hammer/IndexTypes.hh"
21 #include "Hammer/Math/Tensor.hh"
22 #include "Hammer/Tools/Logging.hh"
25 
26 namespace Hammer {
27 
28  class Log;
29 
30  /// @brief Base class for amplitudes
31  ///
32  /// Provides the amplitude contents as tensor...
33  ///
34  /// @ingroup Base
35  class AmplitudeBase : public ParticleData, public SettingsConsumer {
36 
37  public:
38  AmplitudeBase();
39 
40  AmplitudeBase(const AmplitudeBase& other) = delete;
41  AmplitudeBase& operator=(const AmplitudeBase& other) =delete;
42 
43  AmplitudeBase(AmplitudeBase&& other) = delete;
44  AmplitudeBase& operator=(AmplitudeBase&& other) = delete;
45  virtual ~AmplitudeBase() noexcept = default;
46 
47  public:
48  /// @brief method to evaluate the object on a specific particle set
49  /// @param[in] parent the parent Particle
50  /// @param[in] daughters the daughters (and grand-daughters, if necessary) Particle list
51  /// @param[in] references the parent Particle siblings (necessary e.g. for helicity amplitude phase conventions)
52  virtual void eval(const Particle& parent, const ParticleList& daughters,
53  const ParticleList& references) = 0;
54 
55  public:
56 
57  std::vector<std::complex<double>> getWCVectorFromDict(const std::map<std::string, std::complex<double>>& wcDict) const;
58  std::vector<std::complex<double>> getWCVectorFromSettings(WTerm what) const;
59 
60  void updateWCSettings(const std::vector<std::complex<double>>& values, WTerm what);
61  void updateWCSettings(const std::map<std::string, std::complex<double>>& values, WTerm what);
62 
63  /// @brief
64  /// @param[in] values
65  /// @param[in] data
66  /// @return
67  void updateWCTensor(std::vector<std::complex<double>> values, MultiDimensional::SharedTensorData& data) const;
68 
69  /// @brief
70  /// @return
71  std::pair<std::string, IndexLabel> getWCInfo() const;
72 
73  /// @brief initializes the amplitude (defines settings associated to this amplitude, etc.)
74  void init();
75 
76  /// @brief returns a reference to itself as a Tensor
77  /// @return itself
78  Tensor& getTensor();
79 
80  /// @brief returns a reference to itself as a Tensor
81  /// @return itself
82  const Tensor& getTensor() const;
83 
84  /// @brief select a specific signature to be the current signature
85  /// @param[in] idx the signature index
86  virtual bool setSignatureIndex(size_t idx = 0);
87 
88  /// @brief
89  /// @return
90  size_t multiplicityFactor() const;
91 
92  protected:
93 
94  virtual void preProcessWCValues(std::vector<std::complex<double>>& data) const;
95 
96  /// @brief defines new settings for this class
97  virtual void defineSettings() = 0;
98 
99  /// @brief adds the index labels for the amplitude tensor for a specific signature to the
100  /// index labels signature list. It will be selected by calling setSignatureIndex
101  /// @param[in] tensor the tensor indices labels
102  void addTensor(Tensor&& tensor);
103 
104  virtual void updateWilsonCeffLabelPrefix();
105 
106  protected:
107  /// @brief logging facility
108  /// @return stream to be used for logging
109  Log& getLog() const;
110 
111  protected:
112  std::vector<std::string> _WCNames;
113  std::string _WCPrefix;
115  std::vector<Tensor> _tensorList; ///< list of (list of) labels for the tensor indices (one for each signature)
117 
118  };
119 
120 } // namespace Hammer
121 
122 #endif
AmplitudeBase & operator=(const AmplitudeBase &other)=delete
Base class for amplitudes.
Hammer data types declarations.
virtual ~AmplitudeBase() noexcept=default
std::pair< std::string, IndexLabel > getWCInfo() const
std::vector< std::complex< double > > getWCVectorFromDict(const std::map< std::string, std::complex< double >> &wcDict) const
virtual void eval(const Particle &parent, const ParticleList &daughters, const ParticleList &references)=0
method to evaluate the object on a specific particle set
Hammer decay PDG code management.
Message logging routines.
virtual void defineSettings()=0
defines new settings for this class
std::vector< Tensor > _tensorList
list of (list of) labels for the tensor indices (one for each signature)
Base class to access the settings repository.
std::shared_ptr< IContainer > SharedTensorData
std::vector< std::complex< double > > getWCVectorFromSettings(WTerm what) const
std::vector< Particle > ParticleList
Definition: Particle.fhh:20
Logging class.
Definition: Logging.hh:33
Particle class.
Definition: Particle.hh:30
IndexLabel
label identifiers of tensor indices they are used to determine which indices can be contracted togeth...
Definition: IndexLabels.hh:27
virtual bool setSignatureIndex(size_t idx=0)
select a specific signature to be the current signature
Multidimensional tensor class with complex numbers as elements.
Definition: Tensor.hh:33
std::vector< std::string > _WCNames
Base class for accessing Hammer settings repository.
void updateWCTensor(std::vector< std::complex< double >> values, MultiDimensional::SharedTensorData &data) const
virtual void preProcessWCValues(std::vector< std::complex< double >> &data) const
virtual void updateWilsonCeffLabelPrefix()
Forward declarations for particle class.
void init()
initializes the amplitude (defines settings associated to this amplitude, etc.)
size_t multiplicityFactor() const
void updateWCSettings(const std::vector< std::complex< double >> &values, WTerm what)
void addTensor(Tensor &&tensor)
adds the index labels for the amplitude tensor for a specific signature to the index labels signature...
Log & getLog() const
logging facility
Tensor & getTensor()
returns a reference to itself as a Tensor
Hammer tensor class.
PDG code process signature class.
Definition: ParticleData.hh:33