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

Definition at line 11 of file TriggerExpressionPrescaler.h.

Member Function Documentation

◆ dump()

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

Implements triggerExpression::Evaluator.

Definition at line 17 of file TriggerExpressionPrescaler.h.

17 { out << "(" << (*m_arg) << " / " << m_prescale << ")"; }

References m_prescale, and MillePedeFileConverter_cfg::out.

◆ init()

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

Reimplemented from triggerExpression::UnaryOperator.

Definition at line 22 of file TriggerExpressionPrescaler.cc.

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  }

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

◆ operator()()

bool triggerExpression::Prescaler::operator() ( const Data data) const
overridevirtual

Implements triggerExpression::Evaluator.

Definition at line 5 of file TriggerExpressionPrescaler.cc.

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  }

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

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

triggerExpression::Prescaler::m_prescale
unsigned int m_prescale
Definition: TriggerExpressionPrescaler.h:20
triggerExpression::UnaryOperator::init
void init(const Data &data) override
Definition: TriggerExpressionOperators.h:15
triggerExpression::Prescaler::m_counter
unsigned int m_counter
Definition: TriggerExpressionPrescaler.h:21
prescale
Definition: PrescaleEventFilter.cc:32
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
funct::arg
A arg
Definition: Factorize.h:31
mps_fire.result
result
Definition: mps_fire.py:311
triggerExpression::UnaryOperator::UnaryOperator
UnaryOperator(Evaluator *arg)
Definition: TriggerExpressionOperators.h:12