Hammer  1.0.0
Helicity Amplitude Module for Matrix Element Reweighting
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RateBase.hh
Go to the documentation of this file.
1 ///
2 /// @file RateBase.hh
3 /// @brief Hammer base rate 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_RATE_BASE
13 #define HAMMER_RATE_BASE
14 
15 #include <string>
16 #include <vector>
17 
18 #include "Hammer/Particle.fhh"
20 #include "Hammer/Math/Tensor.hh"
23 #include "Hammer/Tools/Logging.hh"
24 
25 namespace Hammer {
26 
27  class Integrator;
28 
29  /// @brief Base class for rates
30  ///
31  /// Provides the rate of a decay process as a N+1-dimensional tensor, whose last index is the
32  /// is the \f$ d\Gamma/dq^2 \f$ (up to wilson coefficients and form factors) evaluated at different \f$ q^2 \f$
33  /// values, so that the \f$ q^2 \f$ integration can be expressed as \f$ \mbox{Tr} (R \cdot w \cdot FF) \f$,
34  /// where \f$ R \f$ is the rate tensor, \f$ FF \f$ the (outer) squared form factor tensor evaluated at the same \f$ q^2 \f$
35  /// points and \f$ W \f$ is a diagonal matrix encoding the weights for the gaussian quadrature integration.
36  /// Internally, rate units are always in GeV (same as Pdg class partial widths etc).
37  ///
38  /// @ingroup Base
39  class RateBase : public ParticleData, public SettingsConsumer {
40 
41  public:
42 
43  RateBase();
44 
45  RateBase(const RateBase& other) = delete;
46  RateBase& operator=(const RateBase& other) = delete;
47 
48  RateBase(RateBase&& other) = delete;
49  RateBase& operator=(RateBase&& other) = delete;
50  virtual ~RateBase() noexcept = default;
51 
52  private:
53  /// @brief method to evaluate the object on a specific particle set. Implementation necessary from ParticleData,
54  /// but empty for rates because they are pre-computed in the init method
55  /// @param[in] parent the parent Particle
56  /// @param[in] daughters the daughters (and grand-daughters, if necessary) Particle list
57  /// @param[in] references the parent Particle siblings (necessary e.g. for helicity amplitude phase conventions)
58  virtual void eval(const Particle& parent, const ParticleList& daughters,
59  const ParticleList& references);
60 
61  public:
62  /// @brief initializes the rate (defines settings associated to this rate, computes the rate tensor)
63  void init();
64 
65  /// @brief returns string of pdg ids in the process
66  /// @return string
67  const std::string getPdgIdString();
68 
69  /// @brief returns a reference to itself as a Tensor
70  /// @return itself
71  Tensor& getTensor();
72 
73  /// @brief returns a reference to itself as a Tensor
74  /// @return itself
75  const Tensor& getTensor() const;
76 
77  /// @brief return the physical range of \f$ Q^2 \f$ for this process (to be used set the integration limits)
78  /// @return \f$ [Q^2_{min}, Q^2_{max}] \f$
80 
81  const EvaluationGrid& getEvaluationPoints() const;
82 
83  /// @brief evaluates the rate by computing the (rank N) rate tensor at different \f$ q^2 \f$ points
84  /// using evalAtPSPoint on the integration points determined by Integrator and creating a rank N+1
85  /// tensor.
86  void calcTensor();
87 
88  protected:
89  /// @brief logging facility
90  /// @return stream to be used for logging
91  Log& getLog() const;
92 
93  /// @brief defines new settings for this class
94  virtual void defineSettings();
95 
96  /// @brief evaluates the rate at a specific point in \f$ q^2 \f$ as a rank N Tensor
97  /// @param[in] point the \f$ q^2 \f$ value
98  /// @return the rate tensor
99  virtual Tensor evalAtPSPoint(const std::vector<double>& point) = 0;
100 
101  /// @brief adds the \f$ q^2 \f$ integration limits for a specific signature to the
102  /// \f$ q^2 \f$ range list. It will be selected by calling setSignatureIndex
103  /// @param[in] boundaries \f$ q_{min} \f$
104  void addIntegrationBoundaries(const IntegrationBoundaries& boundaries);
105 
106  /// @brief adds the index labels for the amplitude tensor for a specific signature to the
107  /// index labels signature list. It will be selected by calling setSignatureIndex
108  /// @param[in] tensor the tensor indices labels
109  void addTensor(Tensor&& tensor);
110 
111 
112  protected:
113 
115  std::vector<IntegrationBoundaries> _PSRanges; ///< list of \f$ q^2 \f$ integration limits (one for each signature)
116  IndexType _nPoints; ///< number of \f$ q^2 \f$ points used for the numerical integration
117  std::vector<Tensor> _tensorList; ///< list of (list of) labels for the tensor indices (one for each signature)
118  };
119 
120  namespace PS {
121 
122  inline BoundaryFunction makeQ2Function(double qmin, double qmax) {
123  return ([qmin, qmax](const std::vector<double>&) -> std::pair<double, double> {
124  return std::make_pair(pow(qmin, 2.), pow(qmax, 2.));
125  });
126  }
127  } // namespace PS
128 
129 } // namespace Hammer
130 
131 #endif
virtual Tensor evalAtPSPoint(const std::vector< double > &point)=0
evaluates the rate at a specific point in as a rank N Tensor
Hammer decay PDG code management.
IndexType _nPoints
number of points used for the numerical integration
Definition: RateBase.hh:116
std::function< std::pair< double, double >(const std::vector< double > &)> BoundaryFunction
Definition: Integrator.fhh:24
Message logging routines.
uint16_t IndexType
virtual void eval(const Particle &parent, const ParticleList &daughters, const ParticleList &references)
method to evaluate the object on a specific particle set.
Definition: RateBase.cc:86
void addIntegrationBoundaries(const IntegrationBoundaries &boundaries)
adds the integration limits for a specific signature to the range list.
Definition: RateBase.cc:81
std::vector< BoundaryFunction > IntegrationBoundaries
Definition: Integrator.fhh:25
void calcTensor()
evaluates the rate by computing the (rank N) rate tensor at different points using evalAtPSPoint on ...
Definition: RateBase.cc:96
void init()
initializes the rate (defines settings associated to this rate, computes the rate tensor) ...
Definition: RateBase.cc:55
Base class to access the settings repository.
void addTensor(Tensor &&tensor)
adds the index labels for the amplitude tensor for a specific signature to the index labels signature...
Definition: RateBase.cc:109
std::vector< Particle > ParticleList
Definition: Particle.fhh:20
std::vector< IntegrationBoundaries > _PSRanges
list of integration limits (one for each signature)
Definition: RateBase.hh:115
Logging class.
Definition: Logging.hh:33
virtual ~RateBase() noexcept=default
Particle class.
Definition: Particle.hh:30
Multidimensional tensor class with complex numbers as elements.
Definition: Tensor.hh:33
Tensor & getTensor()
returns a reference to itself as a Tensor
Definition: RateBase.cc:60
Base class for accessing Hammer settings repository.
Hammer numerical integration classes.
const IntegrationBoundaries & getIntegrationBoundaries() const
return the physical range of for this process (to be used set the integration limits) ...
Definition: RateBase.cc:77
virtual void defineSettings()
defines new settings for this class
Definition: RateBase.cc:89
Integrator _integ
Definition: RateBase.hh:114
const std::string getPdgIdString()
returns string of pdg ids in the process
Definition: RateBase.cc:64
Forward declarations for particle class.
BoundaryFunction makeQ2Function(double qmin, double qmax)
Definition: RateBase.hh:122
const EvaluationGrid & getEvaluationPoints() const
Definition: RateBase.cc:92
RateBase & operator=(const RateBase &other)=delete
std::vector< std::vector< double >> EvaluationGrid
Definition: Integrator.fhh:26
Hammer tensor class.
Log & getLog() const
logging facility
Definition: RateBase.cc:113
Base class for rates.
Definition: RateBase.hh:39
Tensor integration class.
Definition: Integrator.hh:35
PDG code process signature class.
Definition: ParticleData.hh:33
std::vector< Tensor > _tensorList
list of (list of) labels for the tensor indices (one for each signature)
Definition: RateBase.hh:117