ATLAS Offline Software
Loading...
Searching...
No Matches
PlotsDefinitionSvc.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
10
12#include "PlotsDefinitionSvc.h"
13
14
19 const std::string& name, ISvcLocator* pSvcLocator ) :
20 base_class( name, pSvcLocator ),
22{
23}
24
25
30
31 ATH_MSG_DEBUG( "Initialising " << name() );
32
33 ATH_CHECK( m_plotsDefReadTool.retrieve() );
34
36 for( const IDTPM::SinglePlotDefinition& plotDef :
37 m_plotsDefReadTool->getPlotsDefinitions() ) {
38 ATH_CHECK( update( plotDef ) );
39 }
40
41 ATH_MSG_DEBUG( "Number of plots being booked = " << m_plotsDefMap.size() );
42
44 bool allDefsOk( true );
45 for( const auto& p : m_plotsDefMap ) {
46 if( not p.second.isValid() ) {
47 ATH_MSG_WARNING( "Invalid plot definition: " << p.second.plotDigest() );
48 allDefsOk = false;
49 }
50 }
51 if( not allDefsOk ) {
52 ATH_MSG_WARNING( "Some plots definitions were bad" );
53 return StatusCode::RECOVERABLE;
54 }
55
56 return StatusCode::SUCCESS;
57}
58
59
64 ATH_MSG_DEBUG( "Finalized " << name() );
65 return StatusCode::SUCCESS;
66}
67
68
73 const std::string& identifier ) const
74{
75 plotsDefMap_t::const_iterator map_it = m_plotsDefMap.find( identifier );
76 if( map_it != m_plotsDefMap.end() ) return map_it->second;
77 return m_nullDef; // null plot definition
78}
79
80
86{
87 ATH_MSG_DEBUG( "Adding new plot definition: " << def.identifier() );
88
89 std::pair< plotsDefMap_t::iterator, bool > result =
90 m_plotsDefMap.insert( plotsDefMap_t::value_type( def.identifier(), def ) );
91
92 if( not result.second ) {
93 ATH_MSG_DEBUG( "Plot definition is already in map. Not added" );
94 }
95
96 return StatusCode::SUCCESS;
97}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
Service interface to hold (and propagate) the definition of the monitoring plots in this package (bas...
const std::string & identifier() const
ToolHandle< IDTPM::IPlotsDefReadTool > m_plotsDefReadTool
virtual const IDTPM::SinglePlotDefinition & definition(const std::string &identifier) const override
Get the plot definition.
virtual StatusCode finalize() override
finalize
virtual StatusCode initialize() override
initialize
PlotsDefinitionSvc(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
IDTPM::SinglePlotDefinition m_nullDef
plotsDefMap_t m_plotsDefMap
StatusCode update(const IDTPM::SinglePlotDefinition &def)
Update the map with a new entry.