CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
smartSelector Class Reference

#include <smartSelector.h>

Public Member Functions

int accept (int eventNb, const int numberOfFractions) const
 actual selector More...
 
int setSmallestPart (int smallestPart)
 set the smallest part only if was set to 0 More...
 
 smartSelector (int smallestPart=0)
 ctor More...
 

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.

18  :
19  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.

Referenced by python.Vispa.Gui.BoxContentDialog.BoxContentDialog::apply(), and python.Vispa.Plugins.ConfigEditor.ToolDialog.ToolDialog::apply().

34  {
35  if (!m_smallestPart) return 1 ;
36  if (m_smallestPart == numberOfFractions) return 1 ;
37  int position = eventNb % m_smallestPart ;
38  int sum = 0 ;
39  for (int i=1 ; i<numberOfFractions ; i *= 2) sum += i ;
40 // std::cout << "debug f_" << numberOfFractions
41 // << " " << sum
42 // << " " << sum+numberOfFractions << "\n" ;
43  if (position >= sum &&
44  position < sum + numberOfFractions)
45  return 1 ;
46  return 0 ;
47  }
int i
Definition: DBlmapReader.cc:9
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
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.

23  {
24  if (!m_smallestPart)
25  {
26  m_smallestPart = smallestPart ;
27  return 0 ;
28  }
29  else return 1 ;
30  }

Member Data Documentation

int smartSelector::m_smallestPart
private

Definition at line 51 of file smartSelector.h.

Referenced by accept(), and setSmallestPart().