AmpGen 2.1
Loading...
Searching...
No Matches
Lineshapes.h
Go to the documentation of this file.
1#ifndef AMPGEN_LINESHAPES_H
2#define AMPGEN_LINESHAPES_H
3
4#include <map>
5#include <string>
6#include <utility>
7#include <vector>
8
9#include "AmpGen/Expression.h"
10#include "AmpGen/Factory.h"
11#include "AmpGen/MsgService.h"
12#include "AmpGen/Tensor.h"
13#include "AmpGen/Particle.h"
14
43
44#define DECLARE_LINESHAPE(X) \
45 class X : public AmpGen::Lineshape::Base { \
46 static std::string _id; \
47 \
48 public: \
49 X() { DEBUG("Constructing lineshape"); } \
50 AmpGen::Expression get(const AmpGen::Expression &s, const AmpGen::Expression &s1, const AmpGen::Expression &s2, const std::string &particleName, \
51 const unsigned int &L, const std::string &lineshapeModifier, AmpGen::DebugSymbols *dbexpressions = 0) const override; \
52 AmpGen::Expression get(const AmpGen::Particle &p, const std::string &lineshapeModifier, AmpGen::DebugSymbols *dbexpressions = nullptr) const override; \
53 }
54
55#define DEFINE_LINESHAPE(X) \
56 REGISTER_WITH_KEY(Lineshape::Base, Lineshape::X, #X, std::string); \
57 AmpGen::Expression Lineshape::X::get(const AmpGen::Particle &p, const std::string &lineshapeModifier, AmpGen::DebugSymbols *dbexpressions) const { \
58 return get(p.massSq(), p.daughter(0)->massSq(), p.daughter(1)->massSq(), p.name(), p.L(), lineshapeModifier, dbexpressions); \
59 } \
60 AmpGen::Expression Lineshape::X::get(const AmpGen::Expression &s, const AmpGen::Expression &s1, const AmpGen::Expression &s2, \
61 const std::string &particleName, const unsigned int &L, const std::string &lineshapeModifier, \
62 AmpGen::DebugSymbols *dbexpressions) const
63
64#define DEFINE_GENERIC_SHAPE(X) \
65 REGISTER_WITH_KEY(Lineshape::Base, Lineshape::X, #X, std::string); \
66 AmpGen::Expression Lineshape::X::get(const AmpGen::Expression &s, const AmpGen::Expression &s1, const AmpGen::Expression &s2, \
67 const std::string &particleName, const unsigned int &L, const std::string &lineshapeModifier, \
68 AmpGen::DebugSymbols *dbexpressions) const { \
69 return 0; \
70 } \
71 AmpGen::Expression Lineshape::X::get(const AmpGen::Particle &p, const std::string &lineshapeModifier, AmpGen::DebugSymbols *dbexpressions) const
72
73namespace AmpGen {
74 class Particle; // forward definitions
75
80
81 namespace Lineshape {
82 class Base {
83 public:
84 virtual ~Base() = default;
85 virtual Expression get(const Expression &s, const Expression &s1, const Expression &s2, const std::string &particleName, const unsigned &L,
86 const std::string &lineshapeModifier, DebugSymbols *dbexpressions = nullptr) const
87 = 0;
88 virtual Expression get(const AmpGen::Particle &p, const std::string &lineshapeModifier, AmpGen::DebugSymbols *dbexpressions = nullptr) const = 0;
89 Base *create() { return this; }
90 };
91
92 class Factory : public AmpGen::Factory<Lineshape::Base> {
93 public:
94 static Expression get(const std::string &lineshape, const Expression &s, const Expression &s1, const Expression &s2, const std::string &particleName,
95 const unsigned &L, std::vector<std::pair<std::string, Expression>> *dbexpressions = nullptr);
96 static Expression get(const std::string &lineshape, const Particle &p, AmpGen::DebugSymbols *dbexpressions);
97 static bool isLineshape(const std::string &lineshape);
98 };
99
101
129
145
156
185
276
303
306
308
324
330
336
342
346
352
369
377
382
395
407
409 } // namespace Lineshape
410
411 Expression Q2(const Expression &Msq, const Expression &M1sq, const Expression &M2sq);
412
413 Expression kFactor(const Expression &mass, const Expression &width, std::vector<std::pair<std::string, Expression>> *dbexpressions = nullptr);
414 Expression BlattWeisskopf_Norm(const Expression &z, const Expression &z0, unsigned int L);
415
416 Expression BL(const Expression &s, const Expression &s0, const Expression &s1, const Expression &s2, const Expression &radius, const unsigned int &L);
417
418 Expression BlattWeisskopf(const Expression &z, unsigned int L);
419
420 Expression pol(const AmpGen::Expression &X, const std::vector<Expression> &p);
421
422 std::vector<Expression> parameterVector(const std::string &name, const size_t &nParam);
423
424 Expression width(const Expression &s, const Expression &s1, const Expression &s2, const Expression &mass, const Expression &width, const Expression &radius,
425 unsigned int L, DebugSymbols *dbexpressions = nullptr);
426} // namespace AmpGen
427#endif
#define DECLARE_LINESHAPE(X)
Definition Lineshapes.h:44
Wrapper class for shared_ptrs to virtual expressions for use in conjunction with operators to build e...
Definition Expression.h:135
Static factory to construct classes from a hierarchy based on a key (normally std::string).
Definition Factory.h:18
virtual ~Base()=default
virtual Expression get(const Expression &s, const Expression &s1, const Expression &s2, const std::string &particleName, const unsigned &L, const std::string &lineshapeModifier, DebugSymbols *dbexpressions=nullptr) const =0
virtual Expression get(const AmpGen::Particle &p, const std::string &lineshapeModifier, AmpGen::DebugSymbols *dbexpressions=nullptr) const =0
static Expression get(const std::string &lineshape, const Particle &p, AmpGen::DebugSymbols *dbexpressions)
static Expression get(const std::string &lineshape, const Expression &s, const Expression &s1, const Expression &s2, const std::string &particleName, const unsigned &L, std::vector< std::pair< std::string, Expression > > *dbexpressions=nullptr)
static bool isLineshape(const std::string &lineshape)
Describes a particle, its decay process and subsequent decay products, which are also Particles.
Definition Particle.h:103
Expression Q2(const Expression &Msq, const Expression &M1sq, const Expression &M2sq)
Expression kFactor(const Expression &mass, const Expression &width, std::vector< std::pair< std::string, Expression > > *dbexpressions=nullptr)
Expression BL(const Expression &s, const Expression &s0, const Expression &s1, const Expression &s2, const Expression &radius, const unsigned int &L)
Expression width(const Expression &s, const Expression &s1, const Expression &s2, const Expression &mass, const Expression &width, const Expression &radius, unsigned int L, DebugSymbols *dbexpressions=nullptr)
Expression BlattWeisskopf(const Expression &z, unsigned int L)
std::vector< DebugSymbol > DebugSymbols
Definition Expression.h:111
Expression pol(const AmpGen::Expression &X, const std::vector< Expression > &p)
Expression BlattWeisskopf_Norm(const Expression &z, const Expression &z0, unsigned int L)
std::vector< Expression > parameterVector(const std::string &name, const size_t &nParam)