EvtGen 2.2.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
Loading...
Searching...
No Matches
EvtDecayBase.hh
Go to the documentation of this file.
1
2/***********************************************************************
3* Copyright 1998-2020 CERN for the benefit of the EvtGen authors *
4* *
5* This file is part of EvtGen. *
6* *
7* EvtGen is free software: you can redistribute it and/or modify *
8* it under the terms of the GNU General Public License as published by *
9* the Free Software Foundation, either version 3 of the License, or *
10* (at your option) any later version. *
11* *
12* EvtGen is distributed in the hope that it will be useful, *
13* but WITHOUT ANY WARRANTY; without even the implied warranty of *
14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15* GNU General Public License for more details. *
16* *
17* You should have received a copy of the GNU General Public License *
18* along with EvtGen. If not, see <https://www.gnu.org/licenses/>. *
19***********************************************************************/
20
21#ifndef EVTDECAYBASE_HH
22#define EVTDECAYBASE_HH
23
24#include "EvtGenBase/EvtId.hh"
26
27#include <stdlib.h>
28#include <string>
29#include <vector>
30class EvtParticle;
31class EvtSpinType;
32
34 public:
35 //These pure virtual methods has to be implemented
36 //by any derived class
37 virtual std::string getName() const = 0;
38 virtual void decay( EvtParticle* p ) = 0;
39 virtual void makeDecay( EvtParticle* p, bool recursive = true ) = 0;
40 virtual EvtDecayBase* clone() const = 0;
41
42 //These virtual methods can be implemented by the
43 //derived class to implement nontrivial functionality.
44 virtual void init();
45 virtual void initProbMax();
46 virtual std::string commandName();
47 virtual void command( std::string cmd );
48
49 virtual std::string getParamName( int i );
50 virtual std::string getParamDefault( int i );
51
52 double getProbMax( double prob );
53 double resetProbMax( double prob );
54
55 EvtDecayBase() = default;
56 virtual ~EvtDecayBase() = default;
57
58 virtual bool matchingDecay( const EvtDecayBase& other ) const;
59
60 EvtId getParentId() const { return m_parent; }
61 double getBranchingFraction() const { return m_brfr; }
62 void disableCheckQ() { m_chkCharge = false; };
63 void checkQ();
64 int getNDaug() const { return m_ndaug; }
65 const EvtId* getDaugs() const { return m_daug.data(); }
66 EvtId getDaug( int i ) const { return m_daug[i]; }
67 int getNArg() const { return m_narg; }
68 bool getFSR() const { return m_fsr; }
69 void setFSR() { m_fsr = true; }
70 void setVerbose() { m_verbose = true; }
71 void setSummary() { m_summary = true; }
72 double* getArgs();
73 std::string* getArgsStr() { return m_args.data(); }
74 double getArg( unsigned int j );
75 double getStoredArg( int j ) const { return m_storedArgs.at( j ); }
76 double getNStoredArg() const { return m_storedArgs.size(); }
77 std::string getArgStr( int j ) const { return m_args[j]; }
78 std::string getModelName() const { return m_modelname; }
79 int getDSum() const { return m_dsum; }
80 bool summary() const { return m_summary; }
81 bool verbose() const { return m_verbose; }
82
83 void saveDecayInfo( EvtId ipar, int ndaug, const EvtId* daug, int narg,
84 std::vector<std::string>& args, std::string name,
85 double brfr );
86 void printSummary() const;
87 void printInfo() const;
88
89 //Does not really belong here but I don't have a better place.
90 static void findMasses( EvtParticle* p, int ndaugs, const EvtId daugs[10],
91 double masses[10] );
92 static void findMass( EvtParticle* p );
93 static double findMaxMass( EvtParticle* p );
94
95 //Methods to set the maximum probability.
96 void setProbMax( double prbmx );
97 void noProbMax();
98
99 void checkNArg( int a1, int a2 = -1, int a3 = -1, int a4 = -1 );
100 void checkNDaug( int d1, int d2 = -1 );
101
103 void checkSpinDaughter( int d1, EvtSpinType::spintype sp );
104
105 // lange - some models can take more daughters
106 // than they really have to fool aliases (VSSBMIX for example)
107 virtual int nRealDaughters() const { return m_ndaug; }
108
109 protected:
112 {
114 }
115
116 private:
117 std::vector<double> m_storedArgs;
118 std::vector<EvtId> m_daug;
119 std::vector<double> m_argsD;
120 std::vector<std::string> m_args;
121
122 std::string m_modelname = "**********";
123
124 EvtId m_parent = EvtId( -1, -1 );
125 int m_ndaug = 0;
126 int m_narg = 0;
127 double m_brfr = 0;
128 int m_dsum = 0;
129
130 bool m_fsr = false;
131 bool m_summary = false;
132 bool m_verbose = false;
133
134 // The default is that the user module does _not_ set any probmax.
135 bool m_defaultprobmax = true;
137 double m_probmax = 0.0;
138
139 //Should charge conservation be checked when model is created?
140 //Default is to check that charge is conserved
141 bool m_chkCharge = true;
142
143 //These are used for gathering statistics.
144 double m_sum_prob = 0.0;
145 double m_max_prob = 0.0;
146};
147
148#endif
const double a4
const double a3
const double a2
const double a1
bool getFSR() const
void checkSpinDaughter(int d1, EvtSpinType::spintype sp)
EvtDecayBase()=default
int getNDaug() const
void checkSpinParent(EvtSpinType::spintype sp)
virtual void decay(EvtParticle *p)=0
int getNArg() const
double getArg(unsigned int j)
void printInfo() const
void saveDecayInfo(EvtId ipar, int ndaug, const EvtId *daug, int narg, std::vector< std::string > &args, std::string name, double brfr)
std::string * getArgsStr()
virtual void makeDecay(EvtParticle *p, bool recursive=true)=0
double resetProbMax(double prob)
double getStoredArg(int j) const
void setProbMax(double prbmx)
static void findMasses(EvtParticle *p, int ndaugs, const EvtId daugs[10], double masses[10])
std::string getArgStr(int j) const
virtual std::string getParamName(int i)
virtual void init()
virtual std::string getName() const =0
static void findMass(EvtParticle *p)
virtual bool matchingDecay(const EvtDecayBase &other) const
EvtId getParentId() const
int getDSum() const
void disableCheckQ()
std::string getModelName() const
virtual int nRealDaughters() const
static double findMaxMass(EvtParticle *p)
bool verbose() const
bool daugsDecayedByParentModel() const
bool m_daugsDecayedByParentModel
EvtId getDaug(int i) const
virtual void command(std::string cmd)
double * getArgs()
double getProbMax(double prob)
virtual ~EvtDecayBase()=default
virtual std::string getParamDefault(int i)
void checkNDaug(int d1, int d2=-1)
std::vector< EvtId > m_daug
double getNStoredArg() const
std::string m_modelname
double getBranchingFraction() const
bool summary() const
std::vector< double > m_storedArgs
virtual EvtDecayBase * clone() const =0
void checkNArg(int a1, int a2=-1, int a3=-1, int a4=-1)
virtual void initProbMax()
std::vector< std::string > m_args
virtual std::string commandName()
void setSummary()
const EvtId * getDaugs() const
std::vector< double > m_argsD
void printSummary() const
void setVerbose()
Definition EvtId.hh:27