Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-09-08 23:05:18

0001 #include "HLTrigger/HLTcore/interface/TriggerExpressionPrescaler.h"
0002 #include "HLTrigger/HLTcore/interface/TriggerExpressionData.h"
0003 
0004 namespace triggerExpression {
0005 
0006   bool Prescaler::operator()(const Data& data) const {
0007     // if the prescale factor is 0, we never need to run any dependent module,
0008     // so we can safely skip the rest of the processing
0009     if (m_prescale == 0)
0010       return false;
0011 
0012     bool result = ((*m_arg)(data));
0013     if (not result)
0014       return false;
0015 
0016     // if the prescale factor is 1, we do not need to keep track of the event counter
0017     if (m_prescale == 1)
0018       return true;
0019 
0020     return (++m_counter % m_prescale) == 0;
0021   }
0022 
0023   void Prescaler::init(const Data& data) {
0024     // initialize the depending modules
0025     UnaryOperator::init(data);
0026 
0027     // initialize the counter to the first event number seen,
0028     // in order to avoid all prescalers on different FUs to be synchronous
0029     m_counter = data.eventNumber();
0030   }
0031 
0032 }  // namespace triggerExpression