ATLAS Offline Software
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 
11 #include "PlotsDefinitionSvc.h"
13 
14 
19  const std::string& name, ISvcLocator* pSvcLocator ) :
20  base_class( name, pSvcLocator ),
21  m_plotsDefMap{}, m_nullDef()
22 {
23 }
24 
25 
30 
31  ATH_MSG_DEBUG( "Initialising " << name() );
32 
33  ATH_CHECK( m_plotsDefReadTool.retrieve() );
34 
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 
85  const IDTPM::SinglePlotDefinition& def )
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 }
get_generator_info.result
result
Definition: get_generator_info.py:21
IDTPM::SinglePlotDefinition
Definition: SinglePlotDefinition.h:25
PlotsDefinitionSvc::update
StatusCode update(const IDTPM::SinglePlotDefinition &def)
Update the map with a new entry.
Definition: PlotsDefinitionSvc.cxx:84
plotBeamSpotVert.plotDef
dictionary plotDef
Definition: plotBeamSpotVert.py:55
xAOD::identifier
identifier
Definition: UncalibratedMeasurement_v1.cxx:15
IDTPM::SinglePlotDefinition::identifier
const std::string & identifier() const
Definition: SinglePlotDefinition.h:81
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
PlotsDefinitionSvc::initialize
virtual StatusCode initialize() override
initialize
Definition: PlotsDefinitionSvc.cxx:29
PlotsDefinitionSvc::PlotsDefinitionSvc
PlotsDefinitionSvc(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition: PlotsDefinitionSvc.cxx:18
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
PlotsDefinitionSvc::definition
virtual const IDTPM::SinglePlotDefinition & definition(const std::string &identifier) const override
Get the plot definition.
Definition: PlotsDefinitionSvc.cxx:72
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
PlotsDefinitionSvc.h
Service interface to hold (and propagate) the definition of the monitoring plots in this package (bas...
PlotsDefinitionSvc::m_nullDef
IDTPM::SinglePlotDefinition m_nullDef
Definition: PlotsDefinitionSvc.h:57
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
PlotsDefinitionSvc::finalize
virtual StatusCode finalize() override
finalize
Definition: PlotsDefinitionSvc.cxx:63
PlotsDefinitionSvc::m_plotsDefReadTool
ToolHandle< IDTPM::IPlotsDefReadTool > m_plotsDefReadTool
Definition: PlotsDefinitionSvc.h:59
PlotsDefinitionSvc::m_plotsDefMap
plotsDefMap_t m_plotsDefMap
Definition: PlotsDefinitionSvc.h:55