Line data Source code
1 : //--------------------------------------------------------------------------
2 : //
3 : // Environment:
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.
7 : //
8 : // Copyright Information: See EvtGen/COPYRIGHT
9 : // Copyright (C) 1998 Caltech, UCSB
10 : //
11 : // Module: EvtGen/EvtDecayBase.hh
12 : //
13 : // Description:
14 : //
15 : // Modification history:
16 : //
17 : // DJL/RYD August 11, 1998 Module created
18 : //
19 : //------------------------------------------------------------------------
20 :
21 : #ifndef EVTDECAYBASE_HH
22 : #define EVTDECAYBASE_HH
23 :
24 : #include "EvtGenBase/EvtPatches.hh"
25 : #include "EvtGenBase/EvtId.hh"
26 : #include <string>
27 : #include "EvtGenBase/EvtSpinType.hh"
28 : #include <stdlib.h>
29 : #include <vector>
30 : class EvtParticle;
31 : class EvtSpinType;
32 :
33 0 : class EvtDecayBase{
34 : public:
35 :
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 :
44 : //These virtual methods can be implemented by the
45 : //derived class to implement nontrivial functionality.
46 : virtual void init();
47 : virtual void initProbMax();
48 : virtual std::string commandName();
49 : virtual void command(std::string cmd);
50 :
51 : virtual std::string getParamName(int i);
52 : virtual std::string getParamDefault(int i);
53 :
54 : double getProbMax( double prob );
55 : double resetProbMax( double prob );
56 :
57 : EvtDecayBase();
58 : virtual ~EvtDecayBase();
59 :
60 : virtual bool matchingDecay(const EvtDecayBase &other) const;
61 :
62 0 : EvtId getParentId() const {return _parent;}
63 0 : double getBranchingFraction() const {return _brfr;}
64 0 : void disableCheckQ() {_chkCharge=0;};
65 : void checkQ();
66 0 : int getNDaug() const {return _ndaug;}
67 0 : EvtId* getDaugs() {return _daug;}
68 0 : EvtId getDaug(int i) const {return _daug[i];}
69 0 : int getNArg() const {return _narg;}
70 0 : int getPHOTOS() const {return _photos;}
71 0 : void setPHOTOS() {_photos=1;}
72 0 : void setVerbose() {_verbose=1;}
73 0 : void setSummary() {_summary=1;}
74 : double* getArgs();
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 0 : std::string getArgStr(int j) const {return _args[j];}
80 0 : std::string getModelName() const {return _modelname; }
81 0 : int getDSum() const {return _dsum; }
82 0 : int summary() const {return _summary; }
83 0 : int verbose() const {return _verbose; }
84 :
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 ;
90 :
91 :
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);
97 :
98 : //Methods to set the maximum probability.
99 : void setProbMax(double prbmx);
100 : void noProbMax();
101 :
102 : void checkNArg(int a1, int a2=-1, int a3=-1, int a4=-1);
103 : void checkNDaug(int d1, int d2=-1);
104 :
105 : void checkSpinParent(EvtSpinType::spintype sp);
106 : void checkSpinDaughter(int d1, EvtSpinType::spintype sp);
107 :
108 : // lange - some models can take more daughters
109 : // than they really have to fool aliases (VSSBMIX for example)
110 0 : virtual int nRealDaughters() { return _ndaug;}
111 :
112 :
113 : protected:
114 :
115 : bool _daugsDecayedByParentModel;
116 0 : bool daugsDecayedByParentModel() {return _daugsDecayedByParentModel;}
117 :
118 : private:
119 :
120 :
121 : int _photos;
122 : int _ndaug;
123 : EvtId _parent;
124 : int _narg;
125 : std::vector<double> _storedArgs;
126 : EvtId *_daug;
127 : double *_argsD;
128 : std::string *_args;
129 : std::string _modelname;
130 : double _brfr;
131 : int _dsum;
132 : int _summary;
133 : int _verbose;
134 :
135 :
136 : int defaultprobmax;
137 : double probmax;
138 : int ntimes_prob;
139 :
140 : //Should charge conservation be checked when model is
141 : //created? 1=yes 0 no.
142 : int _chkCharge;
143 :
144 :
145 : //These are used for gathering statistics.
146 : double sum_prob;
147 : double max_prob;
148 :
149 :
150 : };
151 :
152 : #endif
153 :
|