CMS 3D CMS Logo

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 override
 
void init (const Data &data) override
 
bool operator() (const Data &data) const override
 
 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

Member Function Documentation

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

Implements triggerExpression::Evaluator.

Definition at line 21 of file TriggerExpressionPrescaler.h.

References m_prescale.

21  {
22  out << "(" << (*m_arg) << " / " << m_prescale << ")";
23  }
void triggerExpression::Prescaler::init ( const Data data)
overridevirtual

Reimplemented from triggerExpression::UnaryOperator.

Definition at line 22 of file TriggerExpressionPrescaler.cc.

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

Referenced by Prescaler().

22  {
23  // initialize the depending modules
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 }
void init(const Data &data) override
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
bool triggerExpression::Prescaler::operator() ( const Data data) const
overridevirtual

Implements triggerExpression::Evaluator.

Definition at line 5 of file TriggerExpressionPrescaler.cc.

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

Referenced by Prescaler().

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 }
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()().