CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
edm::RunningAverage Class Reference

#include <RunningAverage.h>

Public Member Functions

int mean () const
 
 RunningAverage (unsigned int k=4)
 
void update (unsigned int q)
 
int upper () const
 

Static Public Attributes

static constexpr int N = 16
 

Private Member Functions

friend int ::test_average::running_average::test ()
 

Private Attributes

std::array< std::atomic< int >, Nm_buffer
 
std::atomic< int > m_curr
 
std::atomic< int > m_mean
 

Detailed Description

Definition at line 17 of file RunningAverage.h.

Constructor & Destructor Documentation

◆ RunningAverage()

edm::RunningAverage::RunningAverage ( unsigned int  k = 4)
inlineexplicit

Definition at line 23 of file RunningAverage.h.

23  : m_mean(N * k), m_curr(0) {
24  for (auto& i : m_buffer)
25  i = k;
26  }

References mps_fire::i, dqmdumpme::k, and m_buffer.

Member Function Documentation

◆ int ::test_average::running_average::test()

edm::RunningAverage::int ::test_average::running_average::test ( )
private

◆ mean()

int edm::RunningAverage::mean ( ) const
inline

Definition at line 28 of file RunningAverage.h.

28 { return m_mean / N; }

References m_mean, and N.

Referenced by upper().

◆ update()

void edm::RunningAverage::update ( unsigned int  q)
inline

◆ upper()

int edm::RunningAverage::upper ( ) const
inline

Member Data Documentation

◆ m_buffer

std::array<std::atomic<int>, N> edm::RunningAverage::m_buffer
private

Definition at line 47 of file RunningAverage.h.

Referenced by RunningAverage(), update(), and upper().

◆ m_curr

std::atomic<int> edm::RunningAverage::m_curr
private

Definition at line 49 of file RunningAverage.h.

Referenced by update().

◆ m_mean

std::atomic<int> edm::RunningAverage::m_mean
private

Definition at line 48 of file RunningAverage.h.

Referenced by mean(), and update().

◆ N

constexpr int edm::RunningAverage::N = 16
staticconstexpr

Definition at line 22 of file RunningAverage.h.

Referenced by mean(), update(), and upper().

mps_fire.i
i
Definition: mps_fire.py:355
edm::RunningAverage::m_curr
std::atomic< int > m_curr
Definition: RunningAverage.h:49
data-class-funcs.q
q
Definition: data-class-funcs.py:169
edm::RunningAverage::N
static constexpr int N
Definition: RunningAverage.h:22
dqmdumpme.k
k
Definition: dqmdumpme.py:60
edm::RunningAverage::mean
int mean() const
Definition: RunningAverage.h:28
edm::RunningAverage::m_mean
std::atomic< int > m_mean
Definition: RunningAverage.h:48
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::RunningAverage::m_buffer
std::array< std::atomic< int >, N > m_buffer
Definition: RunningAverage.h:47
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37