CMS 3D CMS Logo

smartSelector.h
Go to the documentation of this file.
1 /*
2 */
3 
4 #ifndef smartSelector_h
5 #define smartSelector_h
6 
7 #include <iostream>
8 
10 {
11  public :
12 
14  smartSelector (int smallestPart = 0) :
15  m_smallestPart (smallestPart) {}
16 
18  int setSmallestPart (int smallestPart)
19  {
20  if (!m_smallestPart)
21  {
22  m_smallestPart = smallestPart ;
23  return 0 ;
24  }
25  else return 1 ;
26  }
27 
29  int accept (int eventNb, const int numberOfFractions) const
30  {
31  if (!m_smallestPart) return 1 ;
32  if (m_smallestPart == numberOfFractions) return 1 ;
33  int position = eventNb % m_smallestPart ;
34  int sum = 0 ;
35  for (int i=1 ; i<numberOfFractions ; i *= 2) sum += i ;
36 // std::cout << "debug f_" << numberOfFractions
37 // << " " << sum
38 // << " " << sum+numberOfFractions << "\n" ;
39  if (position >= sum &&
40  position < sum + numberOfFractions)
41  return 1 ;
42  return 0 ;
43  }
44 
45  private :
46 
48 
49 } ;
50 
51 
52 #endif
mps_fire.i
i
Definition: mps_fire.py:355
smartSelector::accept
int accept(int eventNb, const int numberOfFractions) const
actual selector
Definition: smartSelector.h:29
smartSelector::m_smallestPart
int m_smallestPart
Definition: smartSelector.h:47
smartSelector
Definition: smartSelector.h:9
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
smartSelector::setSmallestPart
int setSmallestPart(int smallestPart)
set the smallest part only if was set to 0
Definition: smartSelector.h:18
smartSelector::smartSelector
smartSelector(int smallestPart=0)
ctor
Definition: smartSelector.h:14