CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/HLTrigger/HLTcore/src/TriggerExpressionPrescaler.cc

Go to the documentation of this file.
00001 #include "HLTrigger/HLTcore/interface/TriggerExpressionPrescaler.h"
00002 
00003 namespace triggerExpression {
00004 
00005 bool Prescaler::operator()(const Data & data) const {
00006   // if the prescale factor is 0, we never need to run any dependent module,
00007   // so we can safely skip the rest of the processing
00008   if (m_prescale == 0)
00009     return false;
00010 
00011   bool result = ((*m_arg)(data));
00012   if (not result)
00013     return false;
00014 
00015   // if the prescale factor is 1, we do not need to keep track of the event counter
00016   if (m_prescale == 1)
00017     return true;
00018 
00019   return (++m_counter % m_prescale) == 0;
00020 }
00021 
00022 void Prescaler::init(const Data & data) {
00023   // initialize the depending modules
00024   UnaryOperator::init(data);
00025 
00026   // initialize the counter to the first event number seen, 
00027   // in order to avoid all prescalers on different FUs to be syncronous
00028   m_counter = data.eventNumber();
00029 }
00030 
00031 } // namespace triggerExpression