Changeset View
Changeset View
Standalone View
Standalone View
EvtGenBase/EvtAmpAmpPdf.hh
Show All 38 Lines | |||||
}; | }; | ||||
template <class T> | template <class T> | ||||
class EvtAmpAmpPdf : public EvtPdf<T> { | class EvtAmpAmpPdf : public EvtPdf<T> { | ||||
public: | public: | ||||
EvtAmpAmpPdf() {} | EvtAmpAmpPdf() {} | ||||
EvtAmpAmpPdf( int type, const EvtAmplitude<T>& amp1, | EvtAmpAmpPdf( int type, const EvtAmplitude<T>& amp1, | ||||
const EvtAmplitude<T>& amp2 ) : | const EvtAmplitude<T>& amp2 ) : | ||||
EvtPdf<T>(), _type( type ), _amp1( amp1.clone() ), _amp2( amp2.clone() ) | EvtPdf<T>(), m_type( type ), m_amp1( amp1.clone() ), m_amp2( amp2.clone() ) | ||||
{ | { | ||||
} | } | ||||
EvtAmpAmpPdf( const EvtAmpAmpPdf<T>& other ) : | EvtAmpAmpPdf( const EvtAmpAmpPdf<T>& other ) : | ||||
EvtPdf<T>( other ), | EvtPdf<T>( other ), | ||||
_type( other._type ), | m_type( other.m_type ), | ||||
COPY_PTR( _amp1 ), | COPY_PTR( m_amp1 ), | ||||
COPY_PTR( _amp2 ) | COPY_PTR( m_amp2 ) | ||||
{ | { | ||||
} | } | ||||
virtual ~EvtAmpAmpPdf() | virtual ~EvtAmpAmpPdf() | ||||
{ | { | ||||
delete _amp1; | delete m_amp1; | ||||
delete _amp2; | delete m_amp2; | ||||
} | } | ||||
virtual EvtAmpAmpPdf<T>* clone() const { return new EvtAmpAmpPdf( *this ); } | virtual EvtAmpAmpPdf<T>* clone() const { return new EvtAmpAmpPdf( *this ); } | ||||
virtual double pdf( const T& p ) const | virtual double pdf( const T& p ) const | ||||
{ | { | ||||
EvtComplex amp1 = _amp1->evaluate( p ); | EvtComplex amp1 = m_amp1->evaluate( p ); | ||||
EvtComplex amp2 = _amp2->evaluate( p ); | EvtComplex amp2 = m_amp2->evaluate( p ); | ||||
EvtComplex pr = amp1 * conj( amp2 ); | EvtComplex pr = amp1 * conj( amp2 ); | ||||
if ( _type == POSRE ) | if ( m_type == POSRE ) | ||||
return real( pr ) > 0 ? real( pr ) : 0.; | return real( pr ) > 0 ? real( pr ) : 0.; | ||||
if ( _type == NEGRE ) | if ( m_type == NEGRE ) | ||||
return real( pr ) < 0 ? -real( pr ) : 0.; | return real( pr ) < 0 ? -real( pr ) : 0.; | ||||
if ( _type == POSIM ) | if ( m_type == POSIM ) | ||||
return imag( pr ) > 0 ? imag( pr ) : 0.; | return imag( pr ) > 0 ? imag( pr ) : 0.; | ||||
if ( _type == NEGIM ) | if ( m_type == NEGIM ) | ||||
return imag( pr ) < 0 ? -imag( pr ) : 0.; | return imag( pr ) < 0 ? -imag( pr ) : 0.; | ||||
assert( 0 ); | assert( 0 ); | ||||
} | } | ||||
private: | private: | ||||
int _type; | int m_type; | ||||
EvtAmplitude<T>* _amp1; | EvtAmplitude<T>* m_amp1; | ||||
EvtAmplitude<T>* _amp2; | EvtAmplitude<T>* m_amp2; | ||||
}; | }; | ||||
#endif | #endif |