The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
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 = ApplicationMgr()
 
 counterAlg = 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() ) );
42 }
43 if ( counterCount == 20 && counterDeque.size() > 10 ) { counterDeque.pop_front(); }
44 for ( auto& c : counterDeque ) ++c;
45 }
46 }
Definition basic.py:1
Gaudi::Accumulators::MsgCounter< MSG::INFO > msg
Gaudi::Accumulators::AveragingCounter< double, Gaudi::Accumulators::atomicity::none > avg_noAto
std::deque< Gaudi::Accumulators::Counter<> > counterDeque
Gaudi::Accumulators::AveragingCounter avg
Gaudi::Accumulators::StatCounter stat
Gaudi::Accumulators::SigmaCounter sig
std::mutex counterDequeMutex
Gaudi::Accumulators::BinomialCounter binomial
Gaudi::Accumulators::AveragingCounter< unsigned int > avg_int

Member Data Documentation

◆ app

CounterAlg.app = ApplicationMgr()

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.

50{ this, "Average" };

◆ avg_int

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

Definition at line 57 of file CounterAlg.cpp.

57{ this, "AverageInteger" };

◆ avg_noAto

Initial value:
{
this, "AverageNonAtomic" }

Definition at line 58 of file CounterAlg.cpp.

58 {
59 this, "AverageNonAtomic" };

◆ basic

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

Definition at line 49 of file CounterAlg.cpp.

49{ this, "Basic" };

◆ binomial

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

Definition at line 53 of file CounterAlg.cpp.

53{ this, "Binomial" };

◆ counterAlg

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.

62{ 0 };

◆ 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.

54{ this, "Super nice message, max 5 times", 5 };

◆ sig

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

Definition at line 51 of file CounterAlg.cpp.

51{ this, "Sigma" };

◆ stat

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

Definition at line 52 of file CounterAlg.cpp.

52{ this, "Stat" };

◆ TopAlg

CounterAlg.TopAlg

Definition at line 18 of file CounterAlg.py.


The documentation for this struct was generated from the following files: