#include <smartSelector.h>
Public Member Functions | |
int | accept (int eventNb, const int numberOfFractions) const |
actual selector | |
int | setSmallestPart (int smallestPart) |
set the smallest part only if was set to 0 | |
smartSelector (int smallestPart=0) | |
ctor | |
Private Attributes | |
int | m_smallestPart |
Definition at line 13 of file smartSelector.h.
smartSelector::smartSelector | ( | int | smallestPart = 0 | ) | [inline] |
int smartSelector::accept | ( | int | eventNb, |
const int | numberOfFractions | ||
) | const [inline] |
actual selector
Definition at line 33 of file smartSelector.h.
References i, m_smallestPart, and position.
{ if (!m_smallestPart) return 1 ; if (m_smallestPart == numberOfFractions) return 1 ; int position = eventNb % m_smallestPart ; int sum = 0 ; for (int i=1 ; i<numberOfFractions ; i *= 2) sum += i ; // std::cout << "debug f_" << numberOfFractions // << " " << sum // << " " << sum+numberOfFractions << "\n" ; if (position >= sum && position < sum + numberOfFractions) return 1 ; return 0 ; }
int smartSelector::setSmallestPart | ( | int | smallestPart | ) | [inline] |
set the smallest part only if was set to 0
Definition at line 22 of file smartSelector.h.
References m_smallestPart.
{ if (!m_smallestPart) { m_smallestPart = smallestPart ; return 0 ; } else return 1 ; }
int smartSelector::m_smallestPart [private] |
Definition at line 51 of file smartSelector.h.
Referenced by accept(), and setSmallestPart().