65 if ( p.isValid() )
return pdf( p );
94 printf(
"Analytic integration of PDF is not defined\n" );
108 double factor = 1. );
113 virtual double pdf(
const T& )
const = 0;
144 assert( itsPdfMax.valueKnown() );
147 return ( random <= itsPdf->evaluate( p ) );
152 template <
class InputIterator>
153 void compute_max( InputIterator it, InputIterator end,
double factor = 1. ) {
155 itsPdfMax =
EvtPdfMax<T>( p, itsPdf->evaluate( p ) * factor );
157 while ( !( it == end ) )
160 double val = itsPdf->evaluate( p ) * factor;
161 if ( val > itsPdfMax.value() ) itsPdfMax =
EvtPdfMax<T>( p, val );
182 double ret = itsPdf->evaluate( p );
203 virtual double pdf(
const T& p )
const {
204 double num = itsNum->evaluate( p );
205 double den = itsDen->evaluate( p );
225 assert( N > 0 || nFindMax > 0 );
228 for ( i = 0; i < N; i++ ) gen();
247 while ( !( begin == end ) )
250 double value = pdfdiv.
evaluate( *begin++ );
252 sum2 += value * value;
258 double av = sum / ( (double)N );
261 double dev2 = ( sum2 - av * av * N ) / ( (
double)( N - 1 ) );
263 if ( dev2 < 0. ) dev2 = 0.;
264 double error = sqrt( dev2 / ( (
double)N ) );
274 printf(
"Function defined for analytic PDFs only\n" );
virtual double pdf(const T &p) const
EvtPdfDiv(const EvtPdfDiv< T > &other)
EvtPdfDiv(const EvtPdf< T > &theNum, const EvtPdf< T > &theDen)
virtual EvtPdf< T > * clone() const
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 N) 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