]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TEvtGen/EvtGenBase/EvtDecayBase.hh
AliDecayer realisation for the EvtGen code and EvtGen itself.
[u/mrichter/AliRoot.git] / TEvtGen / EvtGenBase / EvtDecayBase.hh
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 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
52   double getProbMax( double prob );
53   double resetProbMax( double prob );
54
55   EvtDecayBase();
56   virtual ~EvtDecayBase();
57
58   virtual bool matchingDecay(const EvtDecayBase &other) const;
59
60   EvtId getParentId() const {return _parent;}
61   double getBranchingFraction() const {return _brfr;}
62   void disableCheckQ() {_chkCharge=0;};
63   void checkQ();
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;}
72   double* getArgs();
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; }
82
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 ;
88
89   
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);
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
103   void checkSpinParent(EvtSpinType::spintype sp);
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
111 protected:
112
113   bool _daugsDecayedByParentModel;
114   bool daugsDecayedByParentModel() {return _daugsDecayedByParentModel;}
115
116 private:
117
118
119   int _photos;
120   int _ndaug;
121   EvtId _parent;
122   int _narg;
123   std::vector<double> _storedArgs;
124   EvtId *_daug;
125   double *_argsD;
126   std::string *_args;
127   std::string _modelname;
128   double _brfr;
129   int _dsum;
130   int _summary;
131   int _verbose;
132
133
134   int defaultprobmax;
135   double probmax;
136   int ntimes_prob;
137
138   //Should charge conservation be checked when model is 
139   //created? 1=yes 0 no.
140   int _chkCharge;
141
142
143   //These are used for gathering statistics.
144   double sum_prob;
145   double max_prob;
146
147
148 };
149
150 #endif
151