ComPWA
Common Partial-Wave-Analysis Framework
Functions.hpp
Go to the documentation of this file.
1 // Copyright (c) 2013, 2017 The ComPWA Team.
2 // This file is part of the ComPWA framework, check
3 // https://github.com/ComPWA/ComPWA/license.txt for details.
4 
12 
13 #ifndef COMPWA_FUNCTIONS_HPP_
14 #define COMPWA_FUNCTIONS_HPP_
15 
16 #include <complex>
17 #include <math.h>
18 #include <vector>
19 
20 #include "Core/Exceptions.hpp"
23 
24 namespace ComPWA {
25 namespace FunctionTree {
30 class Strategy {
31 public:
32  Strategy(ParType out, std::string name) : checkType(out), Name(name){};
33 
34  virtual ~Strategy() = default;
35 
37  virtual const ParType OutType() const { return checkType; }
38 
40  virtual void execute(ParameterList &paras,
41  std::shared_ptr<Parameter> &out) = 0;
42 
43  std::string str() const { return Name; }
44 
45  friend std::ostream &operator<<(std::ostream &out,
46  std::shared_ptr<Strategy> b) {
47  return out << b->str();
48  }
49 
50  friend std::ostream &operator<<(std::ostream &out, const Strategy &b) {
51  return out << b.str();
52  }
53 
54 protected:
56  const std::string Name;
57 };
58 
63 class Inverse : public Strategy {
64 public:
65  Inverse(ParType out) : Strategy(out, "Inv"){};
66 
67  virtual ~Inverse(){};
68 
69  virtual void execute(ParameterList &paras, std::shared_ptr<Parameter> &out);
70 };
71 
77 class SquareRoot : public Strategy {
78 public:
79  SquareRoot(ParType out) : Strategy(out, "Sqrt"){};
80 
81  virtual ~SquareRoot() {}
82 
83  virtual void execute(ParameterList &paras, std::shared_ptr<Parameter> &out);
84 };
85 
91 class AddAll : public Strategy {
92 public:
93  AddAll(ParType out) : Strategy(out, "AddAll"){};
94 
95  virtual ~AddAll() {}
96 
104  virtual void execute(ParameterList &paras, std::shared_ptr<Parameter> &out);
105 };
106 
107 class MultAll : public Strategy {
108 public:
109  MultAll(ParType out) : Strategy(out, "MultAll"){};
110 
111  virtual ~MultAll() {}
112 
113  virtual void execute(ParameterList &paras, std::shared_ptr<Parameter> &out);
114 };
115 
116 class LogOf : public Strategy {
117 public:
118  LogOf(ParType out) : Strategy(out, "LogOf"){};
119 
120  virtual ~LogOf(){};
121 
122  virtual void execute(ParameterList &paras, std::shared_ptr<Parameter> &out);
123 };
124 
125 class Exp : public Strategy {
126 public:
127  Exp(ParType out) : Strategy(out, "Exp"){};
128 
129  virtual ~Exp(){};
130 
131  virtual void execute(ParameterList &paras, std::shared_ptr<Parameter> &out);
132 };
133 
134 class Pow : public Strategy {
135  int power;
136 
137 public:
138  Pow(ParType out, int power_) : Strategy(out, "Pow"), power(power_){};
139 
140  virtual ~Pow(){};
141 
142  virtual void execute(ParameterList &paras, std::shared_ptr<Parameter> &out);
143 };
144 
145 class Complexify : public Strategy {
146 public:
147  Complexify(ParType out) : Strategy(out, "Complexify"){};
148 
149  virtual ~Complexify() {}
150 
151  virtual void execute(ParameterList &paras, std::shared_ptr<Parameter> &out);
152 };
153 
154 class ComplexConjugate : public Strategy {
155 public:
156  ComplexConjugate(ParType out) : Strategy(out, "ComplexConjugate"){};
157 
158  virtual ~ComplexConjugate() {}
159 
160  virtual void execute(ParameterList &paras, std::shared_ptr<Parameter> &out);
161 };
162 
163 class AbsSquare : public Strategy {
164 public:
165  AbsSquare(ParType out) : Strategy(out, "AbsSquare"){};
166 
167  virtual ~AbsSquare() {}
168 
169  virtual void execute(ParameterList &paras, std::shared_ptr<Parameter> &out);
170 };
171 
172 } // namespace FunctionTree
173 } // namespace ComPWA
174 
175 #endif
virtual const ParType OutType() const
Return parameter type.
Definition: Functions.hpp:37
Implementations of Parameter for various data types.
ComPWA exceptions.
Strategy(ParType out, std::string name)
Definition: Functions.hpp:32
ParameterList class.
friend std::ostream & operator<<(std::ostream &out, const Strategy &b)
Definition: Functions.hpp:50
Calculates the inverse of input double values and double parameters.
Definition: Functions.hpp:63
virtual void execute(ParameterList &paras, std::shared_ptr< Parameter > &out)=0
Strategy execution.
Pow(ParType out, int power_)
Definition: Functions.hpp:138
friend std::ostream & operator<<(std::ostream &out, std::shared_ptr< Strategy > b)
Definition: Functions.hpp:45
Calculates the square root of input double values and double parameters.
Definition: Functions.hpp:77
std::string str() const
Definition: Functions.hpp:43
ParType
Enums for the type of the parameter, should be extended if an new parameter type is added...
Definition: Parameter.hpp:34
Virtual base class for operations of FunctionTree nodes.
Definition: Functions.hpp:30
This class provides a list of parameters and values of different types.
Calculates the square root of input double values and double parameters.
Definition: Functions.hpp:91