ATLAS Offline Software
Loading...
Searching...
No Matches
CP::SelectionNameSvc Class Referencefinal

the canonical implementation of ISelectionNameSvc More...

#include <SelectionNameSvc.h>

Inheritance diagram for CP::SelectionNameSvc:
Collaboration diagram for CP::SelectionNameSvc:

Public Member Functions

virtual StatusCode initialize () override
virtual StatusCode addAcceptInfo (const std::string &objectName, const std::string &decorName, const asg::AcceptInfo &acceptInfo) override
virtual const asg::AcceptInfogetAcceptInfo (const std::string &objectName, const std::string &decorName) const override

Private Attributes

ServiceHandle< ISystematicsSvcm_sysSvc {"SystematicsSvc", "SelectionNameSvc"}
 the ISystematicsSvc we use
std::unordered_map< std::string, std::unordered_map< std::string, asg::AcceptInfo > > m_acceptInfoMap
 the map of AcceptInfo objects

Detailed Description

the canonical implementation of ISelectionNameSvc

Definition at line 25 of file SelectionNameSvc.h.

Member Function Documentation

◆ addAcceptInfo()

StatusCode CP::SelectionNameSvc::addAcceptInfo ( const std::string & objectName,
const std::string & decorName,
const asg::AcceptInfo & acceptInfo )
overridevirtual

Definition at line 37 of file SelectionNameSvc.cxx.

40 {
41 ANA_MSG_DEBUG ("adding selection " << decorName << " for object " << objectName);
42 auto& subMap = m_acceptInfoMap[decorName];
43 if (subMap.find (objectName) != subMap.end())
44 {
45 ANA_MSG_ERROR ("object " << objectName << " already has a selection named " << decorName);
46 return StatusCode::FAILURE;
47 }
48 subMap[objectName] = acceptInfo;
49 if (getAcceptInfo(objectName, decorName) == nullptr)
50 {
51 ANA_MSG_ERROR ("failed to add selection " << decorName << " for object " << objectName);
52 return StatusCode::FAILURE;
53 }
54 return StatusCode::SUCCESS;
55 }
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
#define ANA_MSG_DEBUG(xmsg)
Macro printing debug messages.
std::unordered_map< std::string, std::unordered_map< std::string, asg::AcceptInfo > > m_acceptInfoMap
the map of AcceptInfo objects
virtual const asg::AcceptInfo * getAcceptInfo(const std::string &objectName, const std::string &decorName) const override

◆ getAcceptInfo()

const asg::AcceptInfo * CP::SelectionNameSvc::getAcceptInfo ( const std::string & objectName,
const std::string & decorName ) const
overridevirtual

Definition at line 59 of file SelectionNameSvc.cxx.

62 {
63 ANA_MSG_DEBUG ("querying selection " << decorName << " for object " << objectName);
64 auto subMap = m_acceptInfoMap.find (decorName);
65 if (subMap == m_acceptInfoMap.end())
66 return nullptr;
67 std::string myObjectName = objectName;
68 while (!myObjectName.empty())
69 {
70 auto result = subMap->second.find (myObjectName);
71 if (result != subMap->second.end())
72 {
73 ANA_MSG_DEBUG ("found selection " << decorName << " for object " << objectName << " using name " << myObjectName);
74 return &result->second;
75 }
76 myObjectName = m_sysSvc->getCopySource (myObjectName);
77 }
78 return nullptr;
79 }
ServiceHandle< ISystematicsSvc > m_sysSvc
the ISystematicsSvc we use

◆ initialize()

StatusCode CP::SelectionNameSvc::initialize ( )
overridevirtual

Definition at line 28 of file SelectionNameSvc.cxx.

30 {
31 ANA_CHECK (m_sysSvc.retrieve());
32 return StatusCode::SUCCESS;
33 }
#define ANA_CHECK(EXP)
check whether the given expression was successful

Member Data Documentation

◆ m_acceptInfoMap

std::unordered_map<std::string, std::unordered_map<std::string, asg::AcceptInfo> > CP::SelectionNameSvc::m_acceptInfoMap
private

the map of AcceptInfo objects

Definition at line 55 of file SelectionNameSvc.h.

◆ m_sysSvc

ServiceHandle<ISystematicsSvc> CP::SelectionNameSvc::m_sysSvc {"SystematicsSvc", "SelectionNameSvc"}
private

the ISystematicsSvc we use

This is needed to look up the source objects of object copies

Definition at line 52 of file SelectionNameSvc.h.

52{"SystematicsSvc", "SelectionNameSvc"};

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