BOSS 7.1.1
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtPredGen< Generator, Predicate > Class Template Reference

#include <EvtPredGen.hh>

Public Types

typedef Generator::result_type result_type
 

Public Member Functions

 EvtPredGen ()
 
 EvtPredGen (Generator gen, Predicate pred)
 
 EvtPredGen (const EvtPredGen &other)
 
 ~EvtPredGen ()
 
result_type operator() ()
 
int getTried () const
 
int getPassed () const
 

Protected Attributes

Generator itsGen
 
Predicate itsPred
 
int itsTried
 
int itsPassed
 

Detailed Description

template<class Generator, class Predicate>
class EvtPredGen< Generator, Predicate >

Definition at line 22 of file EvtPredGen.hh.

Member Typedef Documentation

◆ result_type

template<class Generator , class Predicate >
Generator::result_type EvtPredGen< Generator, Predicate >::result_type

Definition at line 26 of file EvtPredGen.hh.

Constructor & Destructor Documentation

◆ EvtPredGen() [1/3]

template<class Generator , class Predicate >
EvtPredGen< Generator, Predicate >::EvtPredGen ( )
inline

Definition at line 28 of file EvtPredGen.hh.

29 : itsTried(0), itsPassed(0)
30 {}

◆ EvtPredGen() [2/3]

template<class Generator , class Predicate >
EvtPredGen< Generator, Predicate >::EvtPredGen ( Generator gen,
Predicate pred )
inline

Definition at line 32 of file EvtPredGen.hh.

33 : itsGen(gen), itsPred(pred), itsTried(0), itsPassed(0)
34 {}
Predicate itsPred
Definition EvtPredGen.hh:70
Generator itsGen
Definition EvtPredGen.hh:69

◆ EvtPredGen() [3/3]

template<class Generator , class Predicate >
EvtPredGen< Generator, Predicate >::EvtPredGen ( const EvtPredGen< Generator, Predicate > & other)
inline

Definition at line 36 of file EvtPredGen.hh.

37 : itsGen(other.itsGen), itsPred(other.itsPred),
38 itsTried(other.itsTried), itsPassed(other.itsPassed)
39 {}
Index other(Index i, Index j)

◆ ~EvtPredGen()

template<class Generator , class Predicate >
EvtPredGen< Generator, Predicate >::~EvtPredGen ( )
inline

Definition at line 41 of file EvtPredGen.hh.

42 {}

Member Function Documentation

◆ getPassed()

template<class Generator , class Predicate >
int EvtPredGen< Generator, Predicate >::getPassed ( ) const
inline

Definition at line 65 of file EvtPredGen.hh.

65{ return itsPassed; }

Referenced by EvtPdf< T >::findGenEff().

◆ getTried()

template<class Generator , class Predicate >
int EvtPredGen< Generator, Predicate >::getTried ( ) const
inline

Definition at line 64 of file EvtPredGen.hh.

64{ return itsTried; }

Referenced by EvtPdf< T >::findGenEff().

◆ operator()()

template<class Generator , class Predicate >
result_type EvtPredGen< Generator, Predicate >::operator() ( )
inline

Definition at line 44 of file EvtPredGen.hh.

44 {
45
46 int i = 0;
47 int MAX = 10000;
48 while(i++ < MAX) {
49
50 itsTried++;
51 result_type point = itsGen();
52 if(itsPred(point)) {
53 itsPassed++;
54 return point;
55 }
56 }
57
58 printf("No random point generated after %d attempts\n",MAX);
59 printf("Sharp peak? Consider using pole compensation.\n");
60 printf("I will now pick a point at random to return.\n");
61 return itsGen();
62 }
Generator::result_type result_type
Definition EvtPredGen.hh:26

Member Data Documentation

◆ itsGen

template<class Generator , class Predicate >
Generator EvtPredGen< Generator, Predicate >::itsGen
protected

Definition at line 69 of file EvtPredGen.hh.

Referenced by EvtPredGen< Generator, Predicate >::operator()().

◆ itsPassed

template<class Generator , class Predicate >
int EvtPredGen< Generator, Predicate >::itsPassed
protected

◆ itsPred

template<class Generator , class Predicate >
Predicate EvtPredGen< Generator, Predicate >::itsPred
protected

Definition at line 70 of file EvtPredGen.hh.

Referenced by EvtPredGen< Generator, Predicate >::operator()().

◆ itsTried

template<class Generator , class Predicate >
int EvtPredGen< Generator, Predicate >::itsTried
protected

The documentation for this class was generated from the following file: