Commit 94045bef authored by Andrea Valassi's avatar Andrea Valassi Committed by Sebastien Ponce
Browse files

New interface for using Gaudi counters (LHCBPS-1758)

parent 45c3eac0
......@@ -6,7 +6,10 @@
// from STL
// ============================================================================
#include <algorithm>
#include <functional>
#include <list>
#include <map>
#include <mutex>
#include <string>
#include <vector>
// ============================================================================
......@@ -28,17 +31,6 @@
#include "GaudiKernel/StatEntity.h"
#include "GaudiKernel/StatusCode.h"
#include "GaudiKernel/System.h"
// ============================================================================
// TBB
// ============================================================================
#if defined( __GNUC__ ) && __GNUC__ >= 5
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsuggest-override"
#endif
#include "tbb/concurrent_unordered_map.h"
#if defined( __GNUC__ ) && __GNUC__ >= 5
#pragma GCC diagnostic pop
#endif
#ifdef __CLING__
#define WARN_UNUSED
......@@ -129,7 +121,8 @@ protected: // definitions
protected: // few actual data types
// ==========================================================================
/// the actual type of general counters
typedef tbb::concurrent_unordered_map<std::string, StatEntity> Statistics;
typedef std::list<StatEntity> StatisticsOwn;
typedef std::map<std::string, std::reference_wrapper<StatEntity>> Statistics;
/// the actual type error/warning counter
typedef std::map<std::string, unsigned int> Counter;
/// storage for active tools
......@@ -493,7 +486,7 @@ public:
public:
// ==========================================================================
/// accessor to all counters
inline const Statistics& counters() const { return m_counters; }
inline const Statistics counters() const { return m_counters; }
/** accessor to certain counter by name
*
* @code
......@@ -512,7 +505,26 @@ public:
* @param tag counter name
* @return the counter itself
*/
inline StatEntity& counter( const std::string& tag ) const { return m_counters[tag]; }
[[deprecated( "see LHCBPS-1758" )]] inline StatEntity& counter( const std::string& tag ) const
{
return const_cast<GaudiCommon<PBASE>*>( this )->counter( tag );
}
inline StatEntity& counter( const std::string& tag )
{
std::lock_guard<std::mutex> lock( m_countersMutex );
// Return referenced StatEntity if it already exists, else create it
auto p = m_counters.find( tag );
if ( p == end( m_counters ) ) {
m_countersOwn.emplace_back();
p = m_counters.emplace( tag, m_countersOwn.back() ).first;
}
return p->second;
}
inline void registerCounter( const std::string& tag, StatEntity& r )
{
std::lock_guard<std::mutex> lock( m_countersMutex );
m_counters.emplace( tag, r );
}
// ==========================================================================
public:
/// Insert the actual C++ type of the algorithm/tool in the messages ?
......@@ -762,7 +774,10 @@ private:
/// Counter of exceptions
mutable Counter m_exceptions;
/// General counters
mutable Statistics m_counters;
StatisticsOwn m_countersOwn;
Statistics m_counters;
/// The counters mutex
std::mutex m_countersMutex;
// ==========================================================================
/// Pointer to the Update Manager Service instance
mutable IUpdateManagerSvc* m_updMgrSvc = nullptr;
......
......@@ -210,7 +210,7 @@ StatusCode GaudiCommon<PBASE>::
StatusCode sc = StatusCode::SUCCESS;
// print the general information about statistical counters
if ( this->msgLevel( MSG::DEBUG ) || ( statPrint() && !counters().empty() ) ) {
if ( this->msgLevel( MSG::DEBUG ) || ( statPrint() && !m_counters.empty() ) ) {
// print general statistical counters
printStat( statPrint() ? MSG::ALWAYS : MSG::DEBUG );
}
......@@ -221,7 +221,7 @@ StatusCode GaudiCommon<PBASE>::
Gaudi::Utils::RegEx::matchList statList{m_statEntityList.value()};
Gaudi::Utils::RegEx::matchList counterList{m_counterList.value()};
std::map<std::string, StatEntity> ordered_counters{begin( this->counters() ), end( this->counters() )};
std::map<std::string, StatEntity&> ordered_counters{begin( this->m_counters ), end( this->m_counters )};
for ( const auto& i : ordered_counters ) {
if ( statList.Or( i.first ) )
m_counterSummarySvc->addCounter( this->name(), i.first, i.second, Gaudi::CounterSummary::SaveStatEntity );
......@@ -264,7 +264,8 @@ StatusCode GaudiCommon<PBASE>::
}
// clear *ALL* counters explicitly
m_counters.clear();
m_counters.clear(); // delete pointers first
m_countersOwn.clear(); // then delete any owned counters
m_exceptions.clear();
m_infos.clear();
m_warnings.clear();
......@@ -519,18 +520,18 @@ template <class PBASE>
long GaudiCommon<PBASE>::printStat( const MSG::Level level ) const
{
// print statistics
if ( counters().empty() ) {
if ( m_counters.empty() ) {
return 0;
}
MsgStream& msg = this->msgStream( level );
//
msg << "Number of counters : " << counters().size();
msg << "Number of counters : " << m_counters.size();
//
if ( !counters().empty() ) {
if ( !m_counters.empty() ) {
msg << std::endl << m_header.value();
}
//
std::map<std::string, StatEntity> ordered_counters{begin( counters() ), end( counters() )};
std::map<std::string, StatEntity&> ordered_counters{begin( m_counters ), end( m_counters )};
for ( const auto& entry : ordered_counters ) {
msg << std::endl
<< Gaudi::Utils::formatAsTableRow( entry.first, entry.second, m_useEffFormat, m_format1, m_format2 );
......@@ -538,7 +539,7 @@ long GaudiCommon<PBASE>::printStat( const MSG::Level level ) const
//
msg << endmsg;
//
return counters().size();
return m_counters.size();
}
// ============================================================================
......
// ============================================================================
/** @file
* configuration file to run "CounterNewEx" : example showing the usage
* of the new 'counter' facilities from the GaudiAlgorithm base class
* @see CounterNewAlg
* @see GaudiAlgorithm
* @author Vanya BELYAEV Ivan.Belyaev@lapp.in2p3.fr
* @date 2005-08-06
* @author Andrea Valassi
* @date 2018-02-13
*/
ApplicationMgr.ExtSvc += { "RndmGenSvc" } ;
ApplicationMgr.TopAlg = { "CounterNewAlg/Counter" } ;
// Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
MessageSvc.OutputLevel = 3;
ApplicationMgr.EvtMax = 5400 ;
ApplicationMgr.EvtSel = "NONE" ;
// ============================================================================
//
// ============================================================================
// The END
// ============================================================================
// ============================================================================
// Include files
// ============================================================================
// GaudiKernel
// ============================================================================
#include "GaudiKernel/RndmGenerators.h"
// ============================================================================
// GaudiAlg
// ============================================================================
#include "GaudiAlg/Producer.h"
// ============================================================================
// ============================================================================
/** @file
* Simple example showing the usage of the new 'counter' facilities
* (with a simple 'producer' type of functional algorithm)
*
* @see GaudiAlgorithm
* @see StatEntity
*
* @author Vanya BELYAEV Ivan.Belyaev@lapp.in2p3.fr
* @date 2008-08-06
*
* @author Andrea Valassi
* @date 2018-02-13
*/
// ============================================================================
// ============================================================================
/** @class CounterNewAlg
*
* Simple example showing the usage of the new 'counter' facilities
* (with a simple 'producer' type of functional algorithm)
*
* @see GaudiAlgorithm
* @see StatEntity
*
* @author Vanya BELYAEV Ivan.Belyaev@lapp.in2p3.fr
* @date 2008-08-06
*
* @author Andrea Valassi
* @date 2018-02-13
*/
// ============================================================================
class CounterNewAlg : public Gaudi::Functional::Producer<int()>
{
public:
int operator()() const override;
CounterNewAlg( const std::string& name, ISvcLocator* pSvc )
: Producer( name, pSvc, KeyValue( "OutputLocation", "dummy" ) )
{
setProperty( "StatPrint", "true" ).ignore();
}
// copy constructor is disabled
CounterNewAlg( const CounterNewAlg& ) = delete;
// assignement operator is disabled
CounterNewAlg& operator=( const CounterNewAlg& ) = delete;
private:
// counters
StatEntity m_assign_counter{this, "assign"};
StatEntity m_eff_counter{this, "eff"};
StatEntity m_executed_counter{this, "executed"};
StatEntity m_G_counter{this, "G"};
StatEntity m_g2_counter{this, "g2"};
StatEntity m_gauss_counter{this, "gauss"};
StatEntity m_Gneg_counter{this, "Gneg"};
StatEntity m_Gpos_counter{this, "Gpos"};
StatEntity m_NG_counter{this, "NG"};
};
// ============================================================================
// ============================================================================
DECLARE_COMPONENT( CounterNewAlg )
// ============================================================================
// ============================================================================
int CounterNewAlg::operator()() const
{
// count overall number of executions:
++m_executed_counter;
Rndm::Numbers gauss( randSvc(), Rndm::Gauss( 0.0, 1.0 ) );
Rndm::Numbers poisson( randSvc(), Rndm::Poisson( 5.0 ) );
// 'accumulate' gauss
const double value = gauss();
m_gauss_counter += value;
m_g2_counter += value * value;
( 0 < value ) ? ++m_Gpos_counter : ++m_Gneg_counter;
const StatEntity& stat1 = m_NG_counter;
const StatEntity& stat2 = m_G_counter;
const int num = (int)poisson();
for ( int i = 0; i < num; ++i ) {
stat1++;
stat2 += gauss();
}
// assignement
m_assign_counter = value;
// counter of efficiency
m_eff_counter += ( 0 < value );
// print the statistics every 1000 events
const StatEntity& executed = m_executed_counter;
const int print = (int)executed.flag();
if ( 0 == print % 1000 ) {
info() << " Event number " << print << endmsg;
printStat();
info() << " Efficiency (binomial counter: \"eff\"): (" << m_eff_counter.eff() * 100.0 << " +- "
<< m_eff_counter.effErr() * 100.0 << ")%" << endmsg;
}
return 42;
}
// ============================================================================
<?xml version="1.0" ?><!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'>
<extension class="GaudiTest.GaudiExeTest" kind="test">
<argument name="args"><set><text>$GAUDIEXAMPLESROOT/options/CounterNewEx.opts</text></set></argument>
<argument name="use_temp_dir"><enumeral>true</enumeral></argument>
<argument name="reference"><text>refs/CounterNewEx.ref</text></argument>
</extension>
JobOptionsSvc INFO
//GP:================================================================================
//GP: include "../options/CounterNewEx.opts" (0,0)
ApplicationMgr.ExtSvc += [ "RndmGenSvc" ] ; //GP: (1,1)
ApplicationMgr.TopAlg = [ "CounterAlg/Counter" ] ; //GP: (1,1)
MessageSvc.OutputLevel = 3; //GP: (1,1)
ApplicationMgr.EvtMax = 5400; //GP: (1,1)
ApplicationMgr.EvtSel = "NONE"; //GP: (1,1)
//GP: end "../options/CounterNewEx.opts" (27,1)
//GP:================================================================================
JobOptionsSvc INFO Job options successfully read in from ../options/CounterNewEx.opts
ApplicationMgr SUCCESS
====================================================================================================================================
Welcome to ApplicationMgr $Revision: 1.31 $
running on pclhcb55.cern.ch on Wed Jun 4 15:23:35 2008
====================================================================================================================================
ApplicationMgr INFO Application Manager Configured successfully
RndmGenSvc.Engine INFO Generator engine type:CLHEP::RanluxEngine
RndmGenSvc.Engine INFO Current Seed:1234567 Luxury:3
RndmGenSvc INFO Using Random engine:HepRndm::Engine<CLHEP::RanluxEngine>
EventLoopMgr WARNING Unable to locate service "EventSelector"
EventLoopMgr WARNING No events will be processed from external input.
HistogramPersis...WARNING Histograms saving not required.
ApplicationMgr INFO Application Manager Initialized successfully
ApplicationMgr INFO Application Manager Started successfully
Counter INFO Event number 1000
Counter SUCCESS Number of counters : 9
| Counter | # | sum | mean/eff^* | rms/err^* | min | max |
| "G" | 4887 | -82.31362 | -0.016843 | 0.97934 | -3.8263 | 3.4606 |
| "Gneg" | 502 | 502 | 1.0000 | 0.0000 | 1.0000 | 1.0000 |
| "Gpos" | 498 | 498 | 1.0000 | 0.0000 | 1.0000 | 1.0000 |
| "NG" | 4887 | 4887 | 1.0000 | 0.0000 | 1.0000 | 1.0000 |
| "assign" | 1 | -0.4383993 | -0.43840 | 0.0000 | -0.43840 | -0.43840 |
|*"eff" | 1000 | 498 |( 49.8000 +- 1.58113 )%| ------- | ------- |
| "executed" | 1000 | 1000 | 1.0000 | 0.0000 | 1.0000 | 1.0000 |
| "g2" | 1000 | 994.1202 | 0.99412 | 1.4171 | 1.1641e-05 | 12.305 |
| "gauss" | 1000 | -24.66952 | -0.024670 | 0.99675 | -3.1296 | 3.5079 |
Counter INFO Efficiency (binomial counter: "eff"): (49.8 +- 1.58113)%
Counter INFO Event number 2000
Counter SUCCESS Number of counters : 9
| Counter | # | sum | mean/eff^* | rms/err^* | min | max |
| "G" | 9802 | -137.399 | -0.014017 | 0.99570 | -3.8836 | 3.7179 |
| "Gneg" | 998 | 998 | 1.0000 | 0.0000 | 1.0000 | 1.0000 |
| "Gpos" | 1002 | 1002 | 1.0000 | 0.0000 | 1.0000 | 1.0000 |
| "NG" | 9802 | 9802 | 1.0000 | 0.0000 | 1.0000 | 1.0000 |
| "assign" | 1 | 0.2301197 | 0.23012 | 0.0000 | 0.23012 | 0.23012 |
|*"eff" | 2000 | 1002 |( 50.1000 +- 1.11803 )%| ------- | ------- |
| "executed" | 2000 | 2000 | 1.0000 | 0.0000 | 1.0000 | 1.0000 |
| "g2" | 2000 | 1915.24 | 0.95762 | 1.3824 | 2.8347e-06 | 12.305 |
| "gauss" | 2000 | 17.20366 | 0.0086018 | 0.97854 | -3.1296 | 3.5079 |
Counter INFO Efficiency (binomial counter: "eff"): (50.1 +- 1.11803)%
Counter INFO Event number 3000
Counter SUCCESS Number of counters : 9
| Counter | # | sum | mean/eff^* | rms/err^* | min | max |
| "G" | 14691 | -162.8489 | -0.011085 | 0.99656 | -3.8836 | 3.7179 |
| "Gneg" | 1487 | 1487 | 1.0000 | 0.0000 | 1.0000 | 1.0000 |
| "Gpos" | 1513 | 1513 | 1.0000 | 0.0000 | 1.0000 | 1.0000 |
| "NG" | 14691 | 14691 | 1.0000 | 0.0000 | 1.0000 | 1.0000 |
| "assign" | 1 | 0.8796986 | 0.87970 | 0.0000 | 0.87970 | 0.87970 |
|*"eff" | 3000 | 1513 |( 50.4333 +- 0.912837 )%| ------- | ------- |
| "executed" | 3000 | 3000 | 1.0000 | 0.0000 | 1.0000 | 1.0000 |
| "g2" | 3000 | 2899.71 | 0.96657 | 1.3626 | 1.8914e-06 | 12.305 |
| "gauss" | 3000 | 28.98501 | 0.0096617 | 0.98310 | -3.1296 | 3.5079 |
Counter INFO Efficiency (binomial counter: "eff"): (50.4333 +- 0.912837)%
Counter INFO Event number 4000
Counter SUCCESS Number of counters : 9
| Counter | # | sum | mean/eff^* | rms/err^* | min | max |
| "G" | 19545 | -200.3068 | -0.010248 | 0.99889 | -3.8836 | 3.7179 |
| "Gneg" | 2003 | 2003 | 1.0000 | 0.0000 | 1.0000 | 1.0000 |
| "Gpos" | 1997 | 1997 | 1.0000 | 0.0000 | 1.0000 | 1.0000 |
| "NG" | 19545 | 19545 | 1.0000 | 0.0000 | 1.0000 | 1.0000 |
| "assign" | 1 | 1.087542 | 1.0875 | 0.0000 | 1.0875 | 1.0875 |
|*"eff" | 4000 | 1997 |( 49.9250 +- 0.790569 )%| ------- | ------- |
| "executed" | 4000 | 4000 | 1.0000 | 0.0000 | 1.0000 | 1.0000 |
| "g2" | 4000 | 3946.969 | 0.98674 | 1.3657 | 1.8914e-06 | 12.305 |
| "gauss" | 4000 | -11.09144 | -0.0027729 | 0.99335 | -3.1296 | 3.5079 |
Counter INFO Efficiency (binomial counter: "eff"): (49.925 +- 0.790569)%
Counter INFO Event number 5000
Counter SUCCESS Number of counters : 9
| Counter | # | sum | mean/eff^* | rms/err^* | min | max |
| "G" | 24446 | -236.0763 | -0.0096571 | 0.99432 | -3.8836 | 3.8273 |
| "Gneg" | 2506 | 2506 | 1.0000 | 0.0000 | 1.0000 | 1.0000 |
| "Gpos" | 2494 | 2494 | 1.0000 | 0.0000 | 1.0000 | 1.0000 |
| "NG" | 24446 | 24446 | 1.0000 | 0.0000 | 1.0000 | 1.0000 |
| "assign" | 1 | 1.826941 | 1.8269 | 0.0000 | 1.8269 | 1.8269 |
|*"eff" | 5000 | 2494 |( 49.8800 +- 0.707105 )%| ------- | ------- |
| "executed" | 5000 | 5000 | 1.0000 | 0.0000 | 1.0000 | 1.0000 |
| "g2" | 5000 | 4962.283 | 0.99246 | 1.3638 | 1.8914e-06 | 13.130 |
| "gauss" | 5000 | -4.027803 |-0.00080556 | 0.99622 | -3.6235 | 3.5079 |
Counter INFO Efficiency (binomial counter: "eff"): (49.88 +- 0.707105)%
ApplicationMgr INFO Application Manager Stopped successfully
Counter SUCCESS Number of counters : 9
| Counter | # | sum | mean/eff^* | rms/err^* | min | max |
| "G" | 26490 | -326.309 | -0.012318 | 0.99484 | -3.8836 | 3.8273 |
| "Gneg" | 2712 | 2712 | 1.0000 | 0.0000 | 1.0000 | 1.0000 |
| "Gpos" | 2688 | 2688 | 1.0000 | 0.0000 | 1.0000 | 1.0000 |
| "NG" | 26490 | 26490 | 1.0000 | 0.0000 | 1.0000 | 1.0000 |
| "assign" | 1 | 0.2275352 | 0.22754 | 0.0000 | 0.22754 | 0.22754 |
|*"eff" | 5400 | 2688 |( 49.7778 +- 0.680407 )%| ------- | ------- |
| "executed" | 5400 | 5400 | 1.0000 | 0.0000 | 1.0000 | 1.0000 |
| "g2" | 5400 | 5341.386 | 0.98915 | 1.3535 | 1.8914e-06 | 13.130 |
| "gauss" | 5400 | -8.611384 | -0.0015947 | 0.99456 | -3.6235 | 3.5079 |
EventLoopMgr INFO Histograms converted successfully according to request.
ApplicationMgr INFO Application Manager Finalized successfully
ApplicationMgr INFO Application Manager Terminated successfully
......@@ -68,6 +68,12 @@ public:
// ==========================================================================
/// the default constructor
StatEntity() = default;
/// the constructor with automatic registration in the owner's counter map
template <class OWNER>
StatEntity( OWNER* o, const std::string& tag ) : StatEntity()
{
o->registerCounter( tag, *this );
}
/* The full constructor from all important values:
* @attention it need to be coherent with
* the actual structure of the class
......@@ -204,7 +210,7 @@ public:
*
* @param f counter increment
*/
StatEntity& operator+=( const double f )
const StatEntity& operator+=( const double f ) const
{
addFlag( f );
return *this;
......@@ -226,7 +232,7 @@ public:
*
* @endcode
*/
StatEntity& operator++() { return ( *this ) += 1; }
const StatEntity& operator++() const { return ( *this ) += 1; }
/** Post-increment operator for the flag.
* Actually it is the same as pre-increment.
* Could be used for easy manipulation with StatEntity object:
......@@ -245,7 +251,7 @@ public:
*
* @endcode
*/
StatEntity& operator++( int ) { return ++( *this ); }
const StatEntity& operator++(int)const { return ++( *this ); }
/** General decrement operator for the flag
* Could be used for easy manipulation with StatEntity object:
*
......@@ -265,7 +271,7 @@ public:
*
* @param f counter increment
*/
StatEntity& operator-=( const double f )
const StatEntity& operator-=( const double f ) const
{
addFlag( -f );
return *this;
......@@ -287,7 +293,7 @@ public:
*
* @endcode
*/
StatEntity& operator--() { return ( *this ) -= 1; }
const StatEntity& operator--() const { return ( *this ) -= 1; }
/** Post-decrement operator for the flag
* Could be used for easy manipulation with StatEntity object:
*
......@@ -305,7 +311,7 @@ public:
*
* @endcode
*/
StatEntity& operator--( int ) { return --( *this ); }
const StatEntity& operator--(int)const { return --( *this ); }
/** Assignment from the flag
* The action: reset and the general increment
* Such case could be useful for statistical monitoring
......@@ -323,7 +329,7 @@ public:
* @param f new value of the counter
* @return self-reference
*/
StatEntity& operator=( const double f )
const StatEntity& operator=( const double f ) const
{
// reset the statistics
reset(); ///< reset the statistics
......@@ -345,7 +351,7 @@ public:
* @param other counter to be added
* @return self-reference
*/
StatEntity& operator+=( const StatEntity& other );
const StatEntity& operator+=( const StatEntity& other ) const;
// ==========================================================================
public:
// ==========================================================================
......@@ -355,9 +361,9 @@ public:
* @param Flag value to be added
* @return number of entries
*/
unsigned long add( const double Flag );
unsigned long add( const double Flag ) const;
/// reset the counters
void reset();
void reset() const;
/// DR specify number of entry before reset
void setnEntriesBeforeReset( unsigned long nEntriesBeforeReset );
/// representation as string
......@@ -410,7 +416,7 @@ public: // some legacy methods, to be removed ...
* @param Flag value to be added
* @return number of entries
*/
inline unsigned long addFlag( const double Flag ) { return add( Flag ); }
inline unsigned long addFlag( const double Flag ) const { return add( Flag ); }
// ==========================================================================
public:
// ==========================================================================
......@@ -443,7 +449,7 @@ public:
// ============================================================================
private:
// ==========================================================================
struct se {
mutable struct se {
/// number of calls
unsigned long nEntries = 0;
/// accumulated flag
......@@ -480,7 +486,7 @@ private:
};
} m_se = {};
// Mutex to protect calls of add/reset/operator++, i.e. all _writes_ to (but not reads from!) m_se;
std::mutex m_mutex;
mutable std::mutex m_mutex;
// ==========================================================================
};
namespace Gaudi
......
......@@ -187,7 +187,7 @@ double StatEntity::se::efficiencyErr() const
// ============================================================================
// increment with other entity
// ============================================================================
StatEntity& StatEntity::operator+=( const StatEntity& other )
const StatEntity& StatEntity::operator+=( const StatEntity& other ) const
{
std::lock_guard<std::mutex> guard( m_mutex );
m_se += other.m_se;
......@@ -196,7 +196,7 @@ StatEntity& StatEntity::operator+=( const StatEntity& other )
// ============================================================================
// increment a flag
// ============================================================================
unsigned long StatEntity::add( const double flag )
unsigned long StatEntity::add( const double flag ) const
{
std::lock_guard<std::mutex> guard( m_mutex );
return m_se.add( flag );
......@@ -204,7 +204,7 @@ unsigned long StatEntity::add( const double flag )
// ============================================================================
// reset all quantities
// ============================================================================
void StatEntity::reset()
void StatEntity::reset() const
{
std::lock_guard<std::mutex> guard( m_mutex );
m_se = {};
......
......@@ -19,6 +19,12 @@
// ============================================================================
#include "GaudiPython/AlgDecorators.h"
// ============================================================================
// Disable warnings on gcc
// ============================================================================
#if defined( __GNUC__ )
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
// ============================================================================
/** @file
* Implementation file for "Decorators"
* @author Vanya BELYAEV Ivan.Belyaev@lapp.in2p3.fr
......@@ -77,10 +83,10 @@ size_t GaudiPython::AlgDecorator::_counters_a_( const GaudiAlgorithm* alg, std::
return 0;
} // RETURN
//
std::map<std::string, StatEntity> ordered_counters{begin( alg->counters() ), end( alg->counters() )};
std::map<std::string, StatEntity&> ordered_counters{begin( alg->counters() ), end( alg->counters() )};
for ( const auto& cnt : ordered_counters ) {
names.push_back( cnt.first );
out.push_back( &cnt.second );
out.push_back( &( cnt.second ) );
}
return out.size();
}
......@@ -96,10 +102,10 @@ size_t GaudiPython::AlgDecorator::_counters_t_( const GaudiTool* alg, std::vecto
return 0;
} // RETURN
//
std::map<std::string, StatEntity> ordered_counters{begin( alg->counters() ), end( alg->counters() )};
std::map<std::string, StatEntity&> ordered_counters{begin( alg->counters() ), end( alg->counters() )};
for ( const auto& cnt : ordered_counters ) {
names.push_back( cnt.first );
out.push_back( &cnt.second );
out.push_back( &( cnt.second ) );
}
return out.size();
}
......@@ -210,6 +216,12 @@ DataObject* GaudiPython::AlgDecorator::get_( const GaudiAlgorithm* alg, const st
{
return alg ? alg->get<DataObject>( alg->evtSvc(), location, useRootInTes ) : nullptr;
}
// ============================================================================
// Re-enable warnings on gcc
// ============================================================================
#if defined( __GNUC__ )
#pragma GCC diagnostic pop
#endif
// ============================================================================
// The END
......
Supports