00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef EVT_AMP_AMP_PDF_HH
00011 #define EVT_AMP_AMP_PDF_HH
00012
00013
00014
00015
00016 #include <assert.h>
00017 #include "EvtGenBase/EvtMacros.hh"
00018 #include "EvtGenBase/EvtAmplitude.hh"
00019 #include "EvtGenBase/EvtPdf.hh"
00020
00021 enum {POSRE=0,NEGRE,POSIM,NEGIM};
00022
00023 template <class T>
00024 class EvtAmpAmpPdf : public EvtPdf<T> {
00025 public:
00026
00027 EvtAmpAmpPdf() {}
00028 EvtAmpAmpPdf(int type, const EvtAmplitude<T>& amp1, const EvtAmplitude<T>& amp2)
00029 : EvtPdf<T>(), _type(type), _amp1(amp1.clone()), _amp2(amp2.clone())
00030 {}
00031 EvtAmpAmpPdf(const EvtAmpAmpPdf<T>& other)
00032 : EvtPdf<T>(other), _type(other._type), COPY_PTR(_amp1), COPY_PTR(_amp2)
00033 {}
00034 virtual ~EvtAmpAmpPdf()
00035 {
00036 delete _amp1;
00037 delete _amp2;
00038 }
00039
00040 virtual EvtAmpAmpPdf<T>* clone() const { return new EvtAmpAmpPdf(*this); }
00041
00042 virtual double pdf(const T& p) const
00043 {
00044 EvtComplex amp1 = _amp1->evaluate(p);
00045 EvtComplex amp2 = _amp2->evaluate(p);
00046 EvtComplex pr = amp1 * conj(amp2);
00047
00048 if(_type == POSRE) return real(pr) > 0 ? real(pr) : 0.;
00049 if(_type == NEGRE) return real(pr) < 0 ? -real(pr) : 0.;
00050 if(_type == POSIM) return imag(pr) > 0 ? imag(pr) : 0.;
00051 if(_type == NEGIM) return imag(pr) < 0 ? -imag(pr) : 0.;
00052
00053 assert(0);
00054 }
00055
00056 private:
00057
00058 int _type;
00059 EvtAmplitude<T>* _amp1;
00060 EvtAmplitude<T>* _amp2;
00061 };
00062
00063 #endif
00064