CMS 3D CMS Logo

Public Member Functions | Private Attributes

smartSelector Class Reference

#include <smartSelector.h>

List of all members.

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

Detailed Description

Definition at line 13 of file smartSelector.h.


Constructor & Destructor Documentation

smartSelector::smartSelector ( int  smallestPart = 0) [inline]

ctor

Definition at line 18 of file smartSelector.h.

                                         : 
      m_smallestPart (smallestPart) {}

Member Function Documentation

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 ;          
      }

Member Data Documentation

Definition at line 51 of file smartSelector.h.

Referenced by accept(), and setSmallestPart().