1 //--------------------------------------------------------------------------
4 // This software is part of the EvtGen package developed jointly
5 // for the BaBar and CLEO collaborations. If you use all or part
6 // of it, please give an appropriate acknowledgement.
8 // Copyright Information: See EvtGen/COPYRIGHT
9 // Copyright (C) 1998 Caltech, UCSB
11 // Module: EvtGen/EvtDecayBase.hh
15 // Modification history:
17 // DJL/RYD August 11, 1998 Module created
19 //------------------------------------------------------------------------
21 #ifndef EVTDECAYBASE_HH
22 #define EVTDECAYBASE_HH
24 #include "EvtGenBase/EvtPatches.hh"
25 #include "EvtGenBase/EvtId.hh"
27 #include "EvtGenBase/EvtSpinType.hh"
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;
44 //These virtual methods can be implemented by the
45 //derived class to implement nontrivial functionality.
47 virtual void initProbMax();
48 virtual std::string commandName();
49 virtual void command(std::string cmd);
51 virtual std::string getParamName(int i);
52 virtual std::string getParamDefault(int i);
54 double getProbMax( double prob );
55 double resetProbMax( double prob );
58 virtual ~EvtDecayBase();
60 virtual bool matchingDecay(const EvtDecayBase &other) const;
62 EvtId getParentId() const {return _parent;}
63 double getBranchingFraction() const {return _brfr;}
64 void disableCheckQ() {_chkCharge=0;};
66 int getNDaug() const {return _ndaug;}
67 EvtId* getDaugs() {return _daug;}
68 EvtId getDaug(int i) const {return _daug[i];}
69 int getNArg() const {return _narg;}
70 int getPHOTOS() const {return _photos;}
71 void setPHOTOS() {_photos=1;}
72 void setVerbose() {_verbose=1;}
73 void setSummary() {_summary=1;}
75 std::string* getArgsStr() {return _args;}
76 double getArg(unsigned int j) ;
77 double getStoredArg(int j) const {return _storedArgs.at(j);}
78 double getNStoredArg() const {return _storedArgs.size();}
79 std::string getArgStr(int j) const {return _args[j];}
80 std::string getModelName() const {return _modelname; }
81 int getDSum() const {return _dsum; }
82 int summary() const {return _summary; }
83 int verbose() const {return _verbose; }
85 void saveDecayInfo(EvtId ipar, int ndaug,EvtId *daug,
86 int narg, std::vector<std::string>& args,
87 std::string name, double brfr);
88 void printSummary() const ;
89 void printInfo() const ;
92 //Does not really belong here but I don't have a better place.
93 static void findMasses(EvtParticle *p, int ndaugs,
94 EvtId daugs[10], double masses[10]);
95 static void findMass(EvtParticle *p);
96 static double findMaxMass(EvtParticle *p);
98 //Methods to set the maximum probability.
99 void setProbMax(double prbmx);
102 void checkNArg(int a1, int a2=-1, int a3=-1, int a4=-1);
103 void checkNDaug(int d1, int d2=-1);
105 void checkSpinParent(EvtSpinType::spintype sp);
106 void checkSpinDaughter(int d1, EvtSpinType::spintype sp);
108 // lange - some models can take more daughters
109 // than they really have to fool aliases (VSSBMIX for example)
110 virtual int nRealDaughters() { return _ndaug;}
115 bool _daugsDecayedByParentModel;
116 bool daugsDecayedByParentModel() {return _daugsDecayedByParentModel;}
125 std::vector<double> _storedArgs;
129 std::string _modelname;
140 //Should charge conservation be checked when model is
141 //created? 1=yes 0 no.
145 //These are used for gathering statistics.