BOSS 7.0.9
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
 
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
 
 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 bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtPredGen.hh.

Member Typedef Documentation

◆ result_type [1/2]

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

◆ result_type [2/2]

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

Constructor & Destructor Documentation

◆ EvtPredGen() [1/6]

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

◆ EvtPredGen() [2/6]

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

◆ EvtPredGen() [3/6]

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

Definition at line 36 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtPredGen.hh.

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

◆ ~EvtPredGen() [1/2]

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

◆ EvtPredGen() [4/6]

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

Definition at line 28 of file BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtPredGen.hh.

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

◆ EvtPredGen() [5/6]

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

Definition at line 32 of file BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtPredGen.hh.

33 : itsGen(gen), itsPred(pred), itsTried(0), itsPassed(0)
34 {}

◆ EvtPredGen() [6/6]

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

Definition at line 36 of file BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtPredGen.hh.

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

◆ ~EvtPredGen() [2/2]

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

Member Function Documentation

◆ getPassed() [1/2]

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

◆ getPassed() [2/2]

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

Definition at line 65 of file BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtPredGen.hh.

65{ return itsPassed; }

◆ getTried() [1/2]

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

Definition at line 64 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtPredGen.hh.

64{ return itsTried; }

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

◆ getTried() [2/2]

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

Definition at line 64 of file BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtPredGen.hh.

64{ return itsTried; }

◆ operator()() [1/2]

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

Definition at line 44 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/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 }

◆ operator()() [2/2]

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

Definition at line 44 of file BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/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 }

Member Data Documentation

◆ itsGen

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

◆ itsPassed

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

◆ itsPred

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

◆ itsTried

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

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