ThePEG::CompSelector< T, WeightType > Class Template Reference The CompSelector class works like the Selector class in that it can be used to randomly select objects according to associated probabilities. More...
Inheritance diagram for ThePEG::CompSelector< T, WeightType >:
Detailed Descriptiontemplate<typename T, typename WeightType = double>


inline 
The default constructor.
The optional argument gives the margin used to get a new overestimated probability for an object when entering compensation mode.
Definition at line 58 of file CompSelector.h.

inline 
Insert an object given a probability for this object.
If the probability is zero or negative, the object will not be inserted and the probability itself is returned. Otherwise the sum of probabilities so far is returned. Note that if selection has already started and this CompSelector is in compensating mode, it will immediately leave this mode and the selection procedure will start from scratch.
Definition at line 75 of file CompSelector.h.

inline 
Report the weight associated with the last selected object.
Returns the zero if weight was below unity, otherwise the compensation mode will be entered and the new overestimated probabilty for the last selected object will be returned.
Definition at line 105 of file CompSelector.h.

inline 
Selct an object randomly.
Given a random number generator which generates flat random numbers in the interval ]0,1[ with the operator()()
function, select an object according to the individual probabilities specified when they were inserted. If the generated number is outside the allowed range or the Selector is empty, a range_error will be thrown. The generator should have a push_back function which will be used push back a uniform random number in the interval ]0,1[ calculated from the fraction of rnd which was in the range of the selected object.
Definition at line 93 of file CompSelector.h.

inline 
Return the sum of probabilities of the objects inserted.
Note that probabilities specified when objects are inserted are rescaled with this number to give unit probability for 'select()'.
Definition at line 193 of file CompSelector.h.