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
std::vector< std::string > patterns () const override
 
 UnaryOperator (Evaluator *arg)
 
- Public Member Functions inherited from triggerExpression::Evaluator
 Evaluator ()=default
 
virtual ~Evaluator ()=default
 

Private Attributes

unsigned int m_counter
 
unsigned int m_prescale
 

Additional Inherited Members

- Protected Attributes inherited from triggerExpression::UnaryOperator
std::unique_ptr< Evaluatorm_arg
 

Detailed Description

Definition at line 9 of file TriggerExpressionPrescaler.h.

Constructor & Destructor Documentation

◆ Prescaler()

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

Member Function Documentation

◆ dump()

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

◆ init()

void triggerExpression::Prescaler::init ( const Data data)
overridevirtual

Reimplemented from triggerExpression::UnaryOperator.

Definition at line 22 of file TriggerExpressionPrescaler.cc.

References data, triggerExpression::UnaryOperator::init(), and m_counter.

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:79

◆ operator()()

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.

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:79

Member Data Documentation

◆ m_counter

unsigned int triggerExpression::Prescaler::m_counter
mutableprivate

Definition at line 21 of file TriggerExpressionPrescaler.h.

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

◆ m_prescale

unsigned int triggerExpression::Prescaler::m_prescale
private

Definition at line 20 of file TriggerExpressionPrescaler.h.

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