evtgen is hosted by Hepforge, IPPP Durham
EvtGen  2.0.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
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"
25 #include "EvtGenBase/EvtPatches.hh"
27 
28 #include <stdlib.h>
29 #include <string>
30 #include <vector>
31 class EvtParticle;
32 class EvtSpinType;
33 
34 class EvtDecayBase {
35  public:
36  //These pure virtual methods has to be implemented
37  //by any derived class
38  virtual std::string getName() = 0;
39  virtual void decay( EvtParticle* p ) = 0;
40  virtual void makeDecay( EvtParticle* p, bool recursive = true ) = 0;
41  virtual EvtDecayBase* clone() = 0;
42 
43  //These virtual methods can be implemented by the
44  //derived class to implement nontrivial functionality.
45  virtual void init();
46  virtual void initProbMax();
47  virtual std::string commandName();
48  virtual void command( std::string cmd );
49 
50  virtual std::string getParamName( int i );
51  virtual std::string getParamDefault( int i );
52 
53  double getProbMax( double prob );
54  double resetProbMax( double prob );
55 
56  EvtDecayBase();
57  virtual ~EvtDecayBase() = default;
58 
59  virtual bool matchingDecay( const EvtDecayBase& other ) const;
60 
61  EvtId getParentId() const { return _parent; }
62  double getBranchingFraction() const { return _brfr; }
63  void disableCheckQ() { _chkCharge = 0; };
64  void checkQ();
65  int getNDaug() const { return _ndaug; }
66  EvtId* getDaugs() { return _daug.data(); }
67  EvtId getDaug( int i ) const { return _daug[i]; }
68  int getNArg() const { return _narg; }
69  int getPHOTOS() const { return _photos; }
70  void setPHOTOS() { _photos = 1; }
71  void setVerbose() { _verbose = 1; }
72  void setSummary() { _summary = 1; }
73  double* getArgs();
74  std::string* getArgsStr() { return _args.data(); }
75  double getArg( unsigned int j );
76  double getStoredArg( int j ) const { return _storedArgs.at( j ); }
77  double getNStoredArg() const { return _storedArgs.size(); }
78  std::string getArgStr( int j ) const { return _args[j]; }
79  std::string getModelName() const { return _modelname; }
80  int getDSum() const { return _dsum; }
81  int summary() const { return _summary; }
82  int verbose() const { return _verbose; }
83 
84  void saveDecayInfo( EvtId ipar, int ndaug, EvtId* daug, int narg,
85  std::vector<std::string>& args, std::string name,
86  double brfr );
87  void printSummary() const;
88  void printInfo() const;
89 
90  //Does not really belong here but I don't have a better place.
91  static void findMasses( EvtParticle* p, int ndaugs, EvtId daugs[10],
92  double masses[10] );
93  static void findMass( EvtParticle* p );
94  static double findMaxMass( EvtParticle* p );
95 
96  //Methods to set the maximum probability.
97  void setProbMax( double prbmx );
98  void noProbMax();
99 
100  void checkNArg( int a1, int a2 = -1, int a3 = -1, int a4 = -1 );
101  void checkNDaug( int d1, int d2 = -1 );
102 
104  void checkSpinDaughter( int d1, EvtSpinType::spintype sp );
105 
106  // lange - some models can take more daughters
107  // than they really have to fool aliases (VSSBMIX for example)
108  virtual int nRealDaughters() { return _ndaug; }
109 
110  protected:
113 
114  private:
115  int _photos;
116  int _ndaug;
118  int _narg;
119  std::vector<double> _storedArgs;
120  std::vector<EvtId> _daug;
121  std::vector<double> _argsD;
122  std::vector<std::string> _args;
123  std::string _modelname;
124  double _brfr;
125  int _dsum;
126  int _summary;
127  int _verbose;
128 
130  double probmax;
132 
133  //Should charge conservation be checked when model is
134  //created? 1=yes 0 no.
136 
137  //These are used for gathering statistics.
138  double sum_prob;
139  double max_prob;
140 };
141 
142 #endif
static void findMass(EvtParticle *p)
double * getArgs()
double getProbMax(double prob)
virtual ~EvtDecayBase()=default
virtual int nRealDaughters()
void printInfo() const
virtual std::string commandName()
double getStoredArg(int j) const
Definition: EvtDecayBase.hh:76
std::vector< std::string > _args
double getArg(unsigned int j)
virtual std::string getParamDefault(int i)
std::string getArgStr(int j) const
Definition: EvtDecayBase.hh:78
void setPHOTOS()
Definition: EvtDecayBase.hh:70
virtual std::string getParamName(int i)
virtual void initProbMax()
const double a3
virtual void init()
const double a2
std::vector< double > _storedArgs
std::string * getArgsStr()
Definition: EvtDecayBase.hh:74
int summary() const
Definition: EvtDecayBase.hh:81
std::vector< double > _argsD
double resetProbMax(double prob)
const double a1
EvtId * getDaugs()
Definition: EvtDecayBase.hh:66
void setProbMax(double prbmx)
void printSummary() const
void disableCheckQ()
Definition: EvtDecayBase.hh:63
Definition: EvtId.hh:27
bool _daugsDecayedByParentModel
int getPHOTOS() const
Definition: EvtDecayBase.hh:69
EvtId getParentId() const
Definition: EvtDecayBase.hh:61
virtual void makeDecay(EvtParticle *p, bool recursive=true)=0
int getDSum() const
Definition: EvtDecayBase.hh:80
void saveDecayInfo(EvtId ipar, int ndaug, EvtId *daug, int narg, std::vector< std::string > &args, std::string name, double brfr)
double getBranchingFraction() const
Definition: EvtDecayBase.hh:62
const double a4
void checkNDaug(int d1, int d2=-1)
static double findMaxMass(EvtParticle *p)
void checkSpinParent(EvtSpinType::spintype sp)
void checkNArg(int a1, int a2=-1, int a3=-1, int a4=-1)
std::string getModelName() const
Definition: EvtDecayBase.hh:79
std::string _modelname
virtual std::string getName()=0
void checkSpinDaughter(int d1, EvtSpinType::spintype sp)
int getNDaug() const
Definition: EvtDecayBase.hh:65
virtual void decay(EvtParticle *p)=0
virtual EvtDecayBase * clone()=0
int verbose() const
Definition: EvtDecayBase.hh:82
virtual void command(std::string cmd)
void setVerbose()
Definition: EvtDecayBase.hh:71
std::vector< EvtId > _daug
static void findMasses(EvtParticle *p, int ndaugs, EvtId daugs[10], double masses[10])
virtual bool matchingDecay(const EvtDecayBase &other) const
void setSummary()
Definition: EvtDecayBase.hh:72
int getNArg() const
Definition: EvtDecayBase.hh:68
bool daugsDecayedByParentModel()
Index other(Index i, Index j)
Definition: EvtCyclic3.cpp:156
double getNStoredArg() const
Definition: EvtDecayBase.hh:77
EvtId getDaug(int i) const
Definition: EvtDecayBase.hh:67