102 if ( !
m_itg.valueKnown() )
108 if ( !
m_itg.valueKnown() )
115 printf(
"Analytic integration of PDF is not defined\n" );
133 double factor = 1. );
138 virtual double pdf(
const T& )
const = 0;
181 return ( random <= m_pdf->evaluate( p ) );
186 template <
class InputIterator>
187 void compute_max( InputIterator it, InputIterator end,
double factor = 1. )
192 while ( !( it == end ) ) {
194 double val =
m_pdf->evaluate( pp ) * factor;
219 double ret =
m_pdf->evaluate( p );
246 double pdf(
const T& p )
const override
248 double num =
m_num->evaluate( p );
249 double den =
m_den->evaluate( p );
272 assert( N > 0 || nFindMax > 0 );
275 for ( i = 0; i < N; i++ )
296 while ( !( begin == end ) ) {
297 double value = pdfdiv.
evaluate( *begin++ );
299 sum2 += value * value;
304 double av = sum / ( (double)N );
306 double dev2 = ( sum2 - av * av * N ) / ( (
double)( N - 1 ) );
310 double error = sqrt( dev2 / ( (
double)N ) );
322 printf(
"Function defined for analytic PDFs only\n" );
EvtPdf< T > * clone() const override
double pdf(const T &p) const override
EvtPdfDiv(const EvtPdfDiv< T > &other)
EvtPdfDiv(const EvtPdf< T > &theNum, const EvtPdf< T > &theDen)
EvtPdfGen(const EvtPdf< T > &pdf)
EvtPdfGen(const EvtPdfGen< T > &other)
result_type operator()(argument_type p)
void compute_max(InputIterator it, InputIterator end, double factor=1.)
void setMax(const EvtPdfMax< T > &max)
EvtPdfPred(const EvtPdf< T > &thePdf)
EvtPdfMax< T > getMax() const
EvtPdfPred(const EvtPdfPred &other)
EvtPdfUnary(const EvtPdf< T > &thePdf)
result_type operator()(argument_type p)
EvtPdfUnary(const EvtPdfUnary &other)
virtual EvtPdf< T > * clone() const =0
virtual EvtValError compute_integral(int) const
EvtPredGen< EvtPdfGen< T >, EvtPdfPred< T > > accRejGen(const EvtPdf< T > &pc, int nMax, double factor=1.)
virtual EvtValError compute_integral() const
void setItg(EvtValError itg)
EvtValError getItg(int N) const
virtual double pdf(const T &) const =0
EvtValError findGenEff(const EvtPdf< T > &pc, int N, int nFindMax)
EvtValError compute_mc_integral(const EvtPdf< T > &pc, int N)
double evaluate(const T &p) const
EvtPdfMax< T > findMax(const EvtPdf< T > &pc, int N)
EvtPdf(const EvtPdf &other)
EvtValError getItg() const