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, bool const ignoreMasks=false) 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
void mask (Evaluator const &arg) override
 
std::vector< std::string > patterns () const override
 
 UnaryOperator (Evaluator *arg)
 
- Public Member Functions inherited from triggerExpression::Evaluator
virtual void disableMasks ()
 
virtual void enableMasks ()
 
 Evaluator ()=default
 
virtual bool masksEnabled () const
 
virtual std::vector< std::pair< std::string, unsigned int > > triggers () const
 
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 8 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,
bool const  ignoreMasks = false 
) const
inlineoverridevirtual

Implements triggerExpression::Evaluator.

Definition at line 16 of file TriggerExpressionPrescaler.h.

References triggerExpression::UnaryOperator::m_arg, m_prescale, and MillePedeFileConverter_cfg::out.

16  {
17  out << '(';
18  m_arg->dump(out, ignoreMasks);
19  out << " / " << m_prescale << ')';
20  }

◆ init()

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

Reimplemented from triggerExpression::UnaryOperator.

Definition at line 23 of file TriggerExpressionPrescaler.cc.

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

23  {
24  // initialize the depending modules
26 
27  // initialize the counter to the first event number seen,
28  // in order to avoid all prescalers on different FUs to be synchronous
29  m_counter = data.eventNumber();
30  }
void init(const Data &data) override
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80

◆ operator()()

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

Implements triggerExpression::Evaluator.

Definition at line 6 of file TriggerExpressionPrescaler.cc.

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

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

Member Data Documentation

◆ m_counter

unsigned int triggerExpression::Prescaler::m_counter
mutableprivate

Definition at line 24 of file TriggerExpressionPrescaler.h.

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

◆ m_prescale

unsigned int triggerExpression::Prescaler::m_prescale
private

Definition at line 23 of file TriggerExpressionPrescaler.h.

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