The Gaudi Framework  master (37c0b60a)
CounterAlg Struct Reference

Simple algorithm illustrating the usage of different "counters". More...

Inheritance diagram for CounterAlg:
Collaboration diagram for CounterAlg:

Public Member Functions

void operator() () const override
 

Public Attributes

 app
 
 counterAlg
 
 TopAlg
 
 EvtMax
 
 EvtSel
 
 HistogramPersistency
 
Gaudi::Accumulators::Counter basic { this, "Basic" }
 
Gaudi::Accumulators::AveragingCounter avg { this, "Average" }
 
Gaudi::Accumulators::SigmaCounter sig { this, "Sigma" }
 
Gaudi::Accumulators::StatCounter stat { this, "Stat" }
 
Gaudi::Accumulators::BinomialCounter binomial { this, "Binomial" }
 
Gaudi::Accumulators::MsgCounter< MSG::INFOmsg { this, "Super nice message, max 5 times", 5 }
 
Gaudi::Accumulators::AveragingCounter< unsigned int > avg_int { this, "AverageInteger" }
 
Gaudi::Accumulators::AveragingCounter< double, Gaudi::Accumulators::atomicity::noneavg_noAto
 
int counterCount { 0 }
 
std::deque< Gaudi::Accumulators::Counter<> > counterDeque
 
std::mutex counterDequeMutex
 

Detailed Description

Simple algorithm illustrating the usage of different "counters".

Definition at line 19 of file CounterAlg.cpp.

Member Function Documentation

◆ operator()()

void CounterAlg::operator() ( ) const
inlineoverride

Definition at line 23 of file CounterAlg.cpp.

23  {
24  // update all counters by some fixed values
25  ++basic;
26  avg += 1.5;
27  sig += 2.5;
28  stat += 3.5;
29  binomial += true;
30  ++msg;
31  avg_int += 1;
32  avg_noAto += 1.5;
33  // update counters in the deque, creating new ones for the first 20 events
34  // and dropping first 10 in the next 10 events
35  {
36  // needs to be protected by a mutex in case of multithreaded usage as the
37  // deque is not thread safe
38  std::scoped_lock lock( counterDequeMutex );
39  if ( counterCount < 20 ) {
40  counterDeque.emplace_back( this, fmt::format( "DQCounter{}", counterDeque.size() ) );
41  ++counterCount;
42  }
43  if ( counterCount == 20 && counterDeque.size() > 10 ) { counterDeque.pop_front(); }
44  for ( auto& c : counterDeque ) ++c;
45  }
46  }

Member Data Documentation

◆ app

CounterAlg.app

Definition at line 16 of file CounterAlg.py.

◆ avg

Gaudi::Accumulators::AveragingCounter CounterAlg::avg { this, "Average" }
mutable

Definition at line 50 of file CounterAlg.cpp.

◆ avg_int

Gaudi::Accumulators::AveragingCounter<unsigned int> CounterAlg::avg_int { this, "AverageInteger" }
mutable

Definition at line 57 of file CounterAlg.cpp.

◆ avg_noAto

Initial value:
{
this, "AverageNonAtomic" }

Definition at line 58 of file CounterAlg.cpp.

◆ basic

Gaudi::Accumulators::Counter CounterAlg::basic { this, "Basic" }
mutable

Definition at line 49 of file CounterAlg.cpp.

◆ binomial

Gaudi::Accumulators::BinomialCounter CounterAlg::binomial { this, "Binomial" }
mutable

Definition at line 53 of file CounterAlg.cpp.

◆ counterAlg

CounterAlg.counterAlg

Definition at line 17 of file CounterAlg.py.

◆ counterCount

int CounterAlg::counterCount { 0 }
mutable

Definition at line 62 of file CounterAlg.cpp.

◆ counterDeque

std::deque<Gaudi::Accumulators::Counter<> > CounterAlg::counterDeque
mutable

Definition at line 63 of file CounterAlg.cpp.

◆ counterDequeMutex

std::mutex CounterAlg::counterDequeMutex
mutable

Definition at line 64 of file CounterAlg.cpp.

◆ EvtMax

CounterAlg.EvtMax

Definition at line 19 of file CounterAlg.py.

◆ EvtSel

CounterAlg.EvtSel

Definition at line 20 of file CounterAlg.py.

◆ HistogramPersistency

CounterAlg.HistogramPersistency

Definition at line 21 of file CounterAlg.py.

◆ msg

Gaudi::Accumulators::MsgCounter<MSG::INFO> CounterAlg::msg { this, "Super nice message, max 5 times", 5 }
mutable

Definition at line 54 of file CounterAlg.cpp.

◆ sig

Gaudi::Accumulators::SigmaCounter CounterAlg::sig { this, "Sigma" }
mutable

Definition at line 51 of file CounterAlg.cpp.

◆ stat

Gaudi::Accumulators::StatCounter CounterAlg::stat { this, "Stat" }
mutable

Definition at line 52 of file CounterAlg.cpp.

◆ TopAlg

CounterAlg.TopAlg

Definition at line 18 of file CounterAlg.py.


The documentation for this struct was generated from the following files:
std::lock
T lock(T... args)
std::deque::pop_front
T pop_front(T... args)
CounterAlg::counterCount
int counterCount
Definition: CounterAlg.cpp:62
std::deque::size
T size(T... args)
CounterAlg::avg
Gaudi::Accumulators::AveragingCounter avg
Definition: CounterAlg.cpp:50
CounterAlg::avg_noAto
Gaudi::Accumulators::AveragingCounter< double, Gaudi::Accumulators::atomicity::none > avg_noAto
Definition: CounterAlg.cpp:58
gaudirun.c
c
Definition: gaudirun.py:525
CounterAlg::stat
Gaudi::Accumulators::StatCounter stat
Definition: CounterAlg.cpp:52
CounterAlg::binomial
Gaudi::Accumulators::BinomialCounter binomial
Definition: CounterAlg.cpp:53
CounterAlg::avg_int
Gaudi::Accumulators::AveragingCounter< unsigned int > avg_int
Definition: CounterAlg.cpp:57
CounterAlg::basic
Gaudi::Accumulators::Counter basic
Definition: CounterAlg.cpp:49
CounterAlg::sig
Gaudi::Accumulators::SigmaCounter sig
Definition: CounterAlg.cpp:51
CounterAlg::counterDeque
std::deque< Gaudi::Accumulators::Counter<> > counterDeque
Definition: CounterAlg.cpp:63
format
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:119
std::deque::emplace_back
T emplace_back(T... args)
CounterAlg::msg
Gaudi::Accumulators::MsgCounter< MSG::INFO > msg
Definition: CounterAlg.cpp:54
CounterAlg::counterDequeMutex
std::mutex counterDequeMutex
Definition: CounterAlg.cpp:64