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);
52 double getProbMax( double prob );
53 double resetProbMax( double prob );
56 virtual ~EvtDecayBase();
58 virtual bool matchingDecay(const EvtDecayBase &other) const;
60 EvtId getParentId() const {return _parent;}
61 double getBranchingFraction() const {return _brfr;}
62 void disableCheckQ() {_chkCharge=0;};
64 int getNDaug() const {return _ndaug;}
65 EvtId* getDaugs() {return _daug;}
66 EvtId getDaug(int i) const {return _daug[i];}
67 int getNArg() const {return _narg;}
68 int getPHOTOS() const {return _photos;}
69 void setPHOTOS() {_photos=1;}
70 void setVerbose() {_verbose=1;}
71 void setSummary() {_summary=1;}
73 std::string* getArgsStr() {return _args;}
74 double getArg(unsigned int j) ;
75 double getStoredArg(int j) const {return _storedArgs.at(j);}
76 double getNStoredArg() const {return _storedArgs.size();}
77 std::string getArgStr(int j) const {return _args[j];}
78 std::string getModelName() const {return _modelname; }
79 int getDSum() const {return _dsum; }
80 int summary() const {return _summary; }
81 int verbose() const {return _verbose; }
83 void saveDecayInfo(EvtId ipar, int ndaug,EvtId *daug,
84 int narg, std::vector<std::string>& args,
85 std::string name, double brfr);
86 void printSummary() const ;
87 void printInfo() const ;
90 //Does not really belong here but I don't have a better place.
91 static void findMasses(EvtParticle *p, int ndaugs,
92 EvtId daugs[10], double masses[10]);
93 static void findMass(EvtParticle *p);
94 static double findMaxMass(EvtParticle *p);
96 //Methods to set the maximum probability.
97 void setProbMax(double prbmx);
100 void checkNArg(int a1, int a2=-1, int a3=-1, int a4=-1);
101 void checkNDaug(int d1, int d2=-1);
103 void checkSpinParent(EvtSpinType::spintype sp);
104 void checkSpinDaughter(int d1, EvtSpinType::spintype sp);
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;}
113 bool _daugsDecayedByParentModel;
114 bool daugsDecayedByParentModel() {return _daugsDecayedByParentModel;}
123 std::vector<double> _storedArgs;
127 std::string _modelname;
138 //Should charge conservation be checked when model is
139 //created? 1=yes 0 no.
143 //These are used for gathering statistics.