#include <TriggerExpressionPrescaler.h>
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) | |
Private Attributes | |
unsigned int | m_counter |
unsigned int | m_prescale |
Definition at line 9 of file TriggerExpressionPrescaler.h.
triggerExpression::Prescaler::Prescaler | ( | Evaluator * | arg, |
unsigned int | prescale | ||
) | [inline] |
Definition at line 11 of file TriggerExpressionPrescaler.h.
: UnaryOperator(arg), m_prescale(prescale), m_counter() { }
void triggerExpression::Prescaler::dump | ( | std::ostream & | out | ) | const [inline, virtual] |
Implements triggerExpression::Evaluator.
Definition at line 21 of file TriggerExpressionPrescaler.h.
References m_prescale.
{ out << "(" << (*m_arg) << " / " << m_prescale << ")"; }
void triggerExpression::Prescaler::init | ( | const Data & | data | ) | [virtual] |
Reimplemented from triggerExpression::UnaryOperator.
Definition at line 22 of file TriggerExpressionPrescaler.cc.
References triggerExpression::Data::eventNumber(), and m_counter.
{ // initialize the depending modules UnaryOperator::init(data); // initialize the counter to the first event number seen, // in order to avoid all prescalers on different FUs to be syncronous m_counter = data.eventNumber(); }
bool triggerExpression::Prescaler::operator() | ( | const Data & | data | ) | const [virtual] |
Implements triggerExpression::Evaluator.
Definition at line 5 of file TriggerExpressionPrescaler.cc.
References runTheMatrix::data, m_counter, m_prescale, and query::result.
{ // if the prescale factor is 0, we never need to run any dependent module, // so we can safely skip the rest of the processing if (m_prescale == 0) return false; bool result = ((*m_arg)(data)); if (not result) return false; // if the prescale factor is 1, we do not need to keep track of the event counter if (m_prescale == 1) return true; return (++m_counter % m_prescale) == 0; }
unsigned int triggerExpression::Prescaler::m_counter [mutable, private] |
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()().