Changeset View
Changeset View
Standalone View
Standalone View
src/EvtGenBase/EvtDalitzFlatPdf.cpp
Show All 17 Lines | |||||
* along with EvtGen. If not, see <https://www.gnu.org/licenses/>. * | * along with EvtGen. If not, see <https://www.gnu.org/licenses/>. * | ||||
***********************************************************************/ | ***********************************************************************/ | ||||
#include "EvtGenBase/EvtDalitzFlatPdf.hh" | #include "EvtGenBase/EvtDalitzFlatPdf.hh" | ||||
#include "EvtGenBase/EvtPatches.hh" | #include "EvtGenBase/EvtPatches.hh" | ||||
EvtDalitzFlatPdf::EvtDalitzFlatPdf( const EvtDalitzPlot& dp ) : | EvtDalitzFlatPdf::EvtDalitzFlatPdf( const EvtDalitzPlot& dp ) : | ||||
EvtPdf<EvtDalitzPoint>(), _dp( dp ) | EvtPdf<EvtDalitzPoint>(), m_dp( dp ) | ||||
{ | { | ||||
} | } | ||||
EvtDalitzFlatPdf::EvtDalitzFlatPdf( const EvtDalitzFlatPdf& other ) : | EvtDalitzFlatPdf::EvtDalitzFlatPdf( const EvtDalitzFlatPdf& other ) : | ||||
EvtPdf<EvtDalitzPoint>( other ), _dp( other._dp ) | EvtPdf<EvtDalitzPoint>( other ), m_dp( other.m_dp ) | ||||
{ | { | ||||
} | } | ||||
EvtPdf<EvtDalitzPoint>* EvtDalitzFlatPdf::clone() const | EvtPdf<EvtDalitzPoint>* EvtDalitzFlatPdf::clone() const | ||||
{ | { | ||||
return new EvtDalitzFlatPdf( *this ); | return new EvtDalitzFlatPdf( *this ); | ||||
} | } | ||||
double EvtDalitzFlatPdf::pdf( const EvtDalitzPoint& ) const | double EvtDalitzFlatPdf::pdf( const EvtDalitzPoint& ) const | ||||
{ | { | ||||
return 1.; | return 1.; | ||||
} | } | ||||
EvtValError EvtDalitzFlatPdf::compute_integral( int N ) const | EvtValError EvtDalitzFlatPdf::compute_integral( int N ) const | ||||
{ | { | ||||
return EvtValError( _dp.getArea( N ), 0. ); | return EvtValError( m_dp.getArea( N ), 0. ); | ||||
} | } | ||||
EvtDalitzPoint EvtDalitzFlatPdf::randomPoint() | EvtDalitzPoint EvtDalitzFlatPdf::randomPoint() | ||||
{ | { | ||||
// To obtain a uniform distribution generate | // To obtain a uniform distribution generate | ||||
// in terms of q's. Generate in a box that circumscribes the | // in terms of q's. Generate in a box that circumscribes the | ||||
// Dalitz plot. Accept points inside. If there are two | // Dalitz plot. Accept points inside. If there are two | ||||
// many unsuccessful attempts it's a hint that the Dalitz plot | // many unsuccessful attempts it's a hint that the Dalitz plot | ||||
// area is tiny compared to the box. It's a pathological | // area is tiny compared to the box. It's a pathological | ||||
// case. Abort. | // case. Abort. | ||||
EvtCyclic3::Pair pair1 = EvtCyclic3::BC; | EvtCyclic3::Pair pair1 = EvtCyclic3::BC; | ||||
EvtCyclic3::Pair pair2 = EvtCyclic3::CA; | EvtCyclic3::Pair pair2 = EvtCyclic3::CA; | ||||
int n = 0; | int n = 0; | ||||
int maxTries = 1000; | int maxTries = 1000; | ||||
while ( n++ < maxTries ) { | while ( n++ < maxTries ) { | ||||
double q1 = EvtRandom::Flat( _dp.qAbsMin( pair1 ), _dp.qAbsMax( pair2 ) ); | double q1 = EvtRandom::Flat( m_dp.qAbsMin( pair1 ), | ||||
double q2 = EvtRandom::Flat( _dp.qAbsMin( pair2 ), _dp.qAbsMax( pair2 ) ); | m_dp.qAbsMax( pair2 ) ); | ||||
double q2 = EvtRandom::Flat( m_dp.qAbsMin( pair2 ), | |||||
m_dp.qAbsMax( pair2 ) ); | |||||
EvtDalitzCoord point( pair1, q1, pair2, q2 ); | EvtDalitzCoord point( pair1, q1, pair2, q2 ); | ||||
EvtDalitzPoint x( _dp, point ); | EvtDalitzPoint x( m_dp, point ); | ||||
if ( x.isValid() ) | if ( x.isValid() ) | ||||
return x; | return x; | ||||
} | } | ||||
printf( "No point generated for dalitz plot after %d tries\n", maxTries ); | printf( "No point generated for dalitz plot after %d tries\n", maxTries ); | ||||
return EvtDalitzPoint(); | return EvtDalitzPoint(); | ||||
} | } |