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
triggerExpression::Prescaler Class Reference

#include <TriggerExpressionPrescaler.h>

Inheritance diagram for triggerExpression::Prescaler:
triggerExpression::UnaryOperator triggerExpression::Evaluator

Public Member Functions

void dump (std::ostream &out) const
 
void init (const Data &data)
 
bool operator() (const Data &data) const
 
 Prescaler (Evaluator *arg, unsigned int prescale)
 
- Public Member Functions inherited from triggerExpression::UnaryOperator
 UnaryOperator (Evaluator *arg)
 
- Public Member Functions inherited from triggerExpression::Evaluator
 Evaluator ()
 
virtual ~Evaluator ()
 

Private Attributes

unsigned int m_counter
 
unsigned int m_prescale
 

Additional Inherited Members

- Protected Attributes inherited from triggerExpression::UnaryOperator
boost::scoped_ptr< Evaluatorm_arg
 

Detailed Description

Definition at line 9 of file TriggerExpressionPrescaler.h.

Constructor & Destructor Documentation

triggerExpression::Prescaler::Prescaler ( Evaluator arg,
unsigned int  prescale 
)
inline

Definition at line 11 of file TriggerExpressionPrescaler.h.

Member Function Documentation

void triggerExpression::Prescaler::dump ( std::ostream &  out) const
inlinevirtual

Implements triggerExpression::Evaluator.

Definition at line 21 of file TriggerExpressionPrescaler.h.

References m_prescale.

21  {
22  out << "(" << (*m_arg) << " / " << m_prescale << ")";
23  }
tuple out
Definition: dbtoconf.py:99
void triggerExpression::Prescaler::init ( const Data data)
virtual

Reimplemented from triggerExpression::UnaryOperator.

Definition at line 22 of file TriggerExpressionPrescaler.cc.

References triggerExpression::Data::eventNumber(), triggerExpression::UnaryOperator::init(), and m_counter.

22  {
23  // initialize the depending modules
24  UnaryOperator::init(data);
25 
26  // initialize the counter to the first event number seen,
27  // in order to avoid all prescalers on different FUs to be syncronous
28  m_counter = data.eventNumber();
29 }
bool triggerExpression::Prescaler::operator() ( const Data data) const
virtual

Implements triggerExpression::Evaluator.

Definition at line 5 of file TriggerExpressionPrescaler.cc.

References data, m_counter, m_prescale, and query::result.

5  {
6  // if the prescale factor is 0, we never need to run any dependent module,
7  // so we can safely skip the rest of the processing
8  if (m_prescale == 0)
9  return false;
10 
11  bool result = ((*m_arg)(data));
12  if (not result)
13  return false;
14 
15  // if the prescale factor is 1, we do not need to keep track of the event counter
16  if (m_prescale == 1)
17  return true;
18 
19  return (++m_counter % m_prescale) == 0;
20 }
tuple result
Definition: query.py:137
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82

Member Data Documentation

unsigned int triggerExpression::Prescaler::m_counter
mutableprivate

Definition at line 27 of file TriggerExpressionPrescaler.h.

Referenced by init(), and operator()().

unsigned int triggerExpression::Prescaler::m_prescale
private

Definition at line 26 of file TriggerExpressionPrescaler.h.

Referenced by dump(), and operator()().