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  AsgService( name, pSvcLocator ),
21  m_plotsDefMap{}, m_nullDef()
22 {
23  declareServiceInterface< IPlotsDefinitionSvc >();
24 }
25 
26 
31 
32  ATH_MSG_DEBUG( "Initialising " << name() );
33 
34  ATH_CHECK( m_plotsDefReadTool.retrieve() );
35 
38  m_plotsDefReadTool->getPlotsDefinitions() ) {
39  ATH_CHECK( update( plotDef ) );
40  }
41 
42  ATH_MSG_DEBUG( "Number of plots being booked = " << m_plotsDefMap.size() );
43 
45  bool allDefsOk( true );
47  for( map_it = m_plotsDefMap.begin(); map_it != m_plotsDefMap.end(); map_it++ ) {
48  if( not map_it->second.isValid() ) {
49  ATH_MSG_WARNING( "Invalid plot definition: " << map_it->second.plotDigest() );
50  allDefsOk = false;
51  }
52  }
53  if( not allDefsOk ) {
54  ATH_MSG_WARNING( "Some plots definitions were bad" );
55  return StatusCode::RECOVERABLE;
56  }
57 
58  return StatusCode::SUCCESS;
59 }
60 
61 
66  ATH_MSG_DEBUG( "Finalized " << name() );
67  return StatusCode::SUCCESS;
68 }
69 
70 
75  const std::string& identifier ) const
76 {
77  plotsDefMap_t::const_iterator map_it = m_plotsDefMap.find( identifier );
78  if( map_it != m_plotsDefMap.end() ) return map_it->second;
79  return m_nullDef; // null plot definition
80 }
81 
82 
87  const IDTPM::SinglePlotDefinition& def )
88 {
89  ATH_MSG_DEBUG( "Adding new plot definition: " << def.identifier() );
90 
91  std::pair< plotsDefMap_t::iterator, bool > result =
92  m_plotsDefMap.insert( plotsDefMap_t::value_type( def.identifier(), def ) );
93 
94  if( not result.second ) {
95  ATH_MSG_DEBUG( "Plot definition is already in map. Not added" );
96  }
97 
98  return StatusCode::SUCCESS;
99 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
get_generator_info.result
result
Definition: get_generator_info.py:21
IDTPM::SinglePlotDefinition
Definition: SinglePlotDefinition.h:24
PlotsDefinitionSvc::update
StatusCode update(const IDTPM::SinglePlotDefinition &def)
Update the map with a new entry.
Definition: PlotsDefinitionSvc.cxx:86
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:68
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:30
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:74
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
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:58
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
PlotsDefinitionSvc::finalize
virtual StatusCode finalize() override
finalize
Definition: PlotsDefinitionSvc.cxx:65
PlotsDefinitionSvc::m_plotsDefReadTool
ToolHandle< IDTPM::IPlotsDefReadTool > m_plotsDefReadTool
Definition: PlotsDefinitionSvc.h:60
PlotsDefinitionSvc::m_plotsDefMap
plotsDefMap_t m_plotsDefMap
Definition: PlotsDefinitionSvc.h:56