File indexing completed on 2026-08-06 09:20:01
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #ifndef EVT_AMP_AMP_PDF_HH
0022 #define EVT_AMP_AMP_PDF_HH
0023
0024
0025
0026
0027 #include "EvtGenBase/EvtAmplitude.hh"
0028 #include "EvtGenBase/EvtMacros.hh"
0029 #include "EvtGenBase/EvtPdf.hh"
0030
0031 #include <assert.h>
0032
0033 enum
0034 {
0035 POSRE = 0,
0036 NEGRE,
0037 POSIM,
0038 NEGIM
0039 };
0040
0041 template <class T>
0042 class EvtAmpAmpPdf : public EvtPdf<T> {
0043 public:
0044 EvtAmpAmpPdf() {}
0045 EvtAmpAmpPdf( int type, const EvtAmplitude<T>& amp1,
0046 const EvtAmplitude<T>& amp2 ) :
0047 EvtPdf<T>(), _type( type ), _amp1( amp1.clone() ), _amp2( amp2.clone() )
0048 {
0049 }
0050 EvtAmpAmpPdf( const EvtAmpAmpPdf<T>& other ) :
0051 EvtPdf<T>( other ),
0052 _type( other._type ),
0053 COPY_PTR( _amp1 ),
0054 COPY_PTR( _amp2 )
0055 {
0056 }
0057 virtual ~EvtAmpAmpPdf()
0058 {
0059 delete _amp1;
0060 delete _amp2;
0061 }
0062
0063 virtual EvtAmpAmpPdf<T>* clone() const { return new EvtAmpAmpPdf( *this ); }
0064
0065 virtual double pdf( const T& p ) const
0066 {
0067 EvtComplex amp1 = _amp1->evaluate( p );
0068 EvtComplex amp2 = _amp2->evaluate( p );
0069 EvtComplex pr = amp1 * conj( amp2 );
0070
0071 if ( _type == POSRE )
0072 return real( pr ) > 0 ? real( pr ) : 0.;
0073 if ( _type == NEGRE )
0074 return real( pr ) < 0 ? -real( pr ) : 0.;
0075 if ( _type == POSIM )
0076 return imag( pr ) > 0 ? imag( pr ) : 0.;
0077 if ( _type == NEGIM )
0078 return imag( pr ) < 0 ? -imag( pr ) : 0.;
0079
0080 assert( 0 );
0081 }
0082
0083 private:
0084 int _type;
0085 EvtAmplitude<T>* _amp1;
0086 EvtAmplitude<T>* _amp2;
0087 };
0088
0089 #endif