ATLAS Offline Software
PeriodicScaler.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /**********************************************************************************
6  * @Project: HLT Steering
7  * @Package: TrigSteering
8  * @Class : PeriodicScaler
9  *
10  * @brief periodic prescale/FA engine
11  *
12  * @author Nicolas Berger <Nicolas.Berger@cern.ch> - CERN
13  * @author Tomasz Bold <Tomasz.Bold@cern.ch> - UST-AGH changed to float prescale factor (enjoy understanding how it works)
14  *
15  * File and Version Information:
16  * $Id: PeriodicScaler.cxx,v 1.3 2008-05-06 09:19:19 tbold Exp $
17  **********************************************************************************/
18 
19 #include "./PeriodicScaler.h"
20 
21 
23  reset();
24 }
25 
26 bool LVL1::PeriodicScaler::decision(float factor) {
27  m_counter++;
28  unsigned N = static_cast<unsigned>(m_counter/factor);
29  if ( m_last != N ) {
30  m_last = N;
31  return true;
32  }
33  return false;
34 }
35 
37  m_counter = 0;
38  m_last = 0;
39 }
40 
41 
43  reset();
44 }
45 
47  m_counter++;
48  unsigned offset = static_cast<unsigned>(factor)-1;
49  unsigned N = static_cast<unsigned>((m_counter+offset)/factor);
50  if ( m_last != N ) {
51  m_last = N;
52  return true;
53  }
54  return false;
55 }
56 
LVL1::PeriodicScaler::decision
virtual bool decision(float factor)
make decision based on given factor
Definition: PeriodicScaler.cxx:26
LVL1::PeriodicScaler::PeriodicScaler
PeriodicScaler()
Definition: PeriodicScaler.cxx:22
JetTiledMap::N
@ N
Definition: TiledEtaPhiMap.h:44
LVL1::PeriodicScalerTake1st::decision
virtual bool decision(float factor) override
make decision based on given factor (but always take first event)
Definition: PeriodicScaler.cxx:46
PeriodicScaler.h
LVL1::PeriodicScaler::reset
void reset()
Reset scaler to initial state.
Definition: PeriodicScaler.cxx:36
LVL1::PeriodicScalerTake1st::PeriodicScalerTake1st
PeriodicScalerTake1st()
Definition: PeriodicScaler.cxx:42
CxxUtils::reset
constexpr std::enable_if_t< is_bitmask_v< E >, E & > reset(E &lhs, E rhs)
Convenience function to clear bits in a class enum bitmask.
Definition: bitmask.h:251
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71