ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
SelectionHelpers
Root
SelectionNameSvc.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
7
8
//
9
// includes
10
//
11
12
#include <
SelectionHelpers/SelectionNameSvc.h
>
13
14
#include <
AsgMessaging/MessageCheck.h
>
15
#include <
PATInterfaces/MakeSystematicsVector.h
>
16
#include <cassert>
17
#include <cmath>
18
#include <regex>
19
#include <functional>
20
21
//
22
// method implementations
23
//
24
25
namespace
CP
26
{
27
28
StatusCode SelectionNameSvc ::
29
initialize ()
30
{
31
ANA_CHECK
(
m_sysSvc
.retrieve());
32
return
StatusCode::SUCCESS;
33
}
34
35
36
37
StatusCode SelectionNameSvc ::
38
addAcceptInfo (
const
std::string& objectName,
const
std::string& decorName,
39
const
asg::AcceptInfo
& acceptInfo)
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
}
56
57
58
59
const
asg::AcceptInfo
* SelectionNameSvc ::
60
getAcceptInfo (
const
std::string& objectName,
61
const
std::string& decorName)
const
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
}
80
}
MessageCheck.h
macros for messaging and checking status codes
ANA_MSG_ERROR
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:294
ANA_MSG_DEBUG
#define ANA_MSG_DEBUG(xmsg)
Macro printing debug messages.
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:288
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
MakeSystematicsVector.h
SelectionNameSvc.h
CP::SelectionNameSvc::m_acceptInfoMap
std::unordered_map< std::string, std::unordered_map< std::string, asg::AcceptInfo > > m_acceptInfoMap
the map of AcceptInfo objects
Definition
SelectionNameSvc.h:55
CP::SelectionNameSvc::m_sysSvc
ServiceHandle< ISystematicsSvc > m_sysSvc
the ISystematicsSvc we use
Definition
SelectionNameSvc.h:52
CP::SelectionNameSvc::getAcceptInfo
virtual const asg::AcceptInfo * getAcceptInfo(const std::string &objectName, const std::string &decorName) const override
Definition
SelectionNameSvc.cxx:60
asg::AcceptInfo
Definition
AcceptInfo.h:28
CP
Select isolated Photons, Electrons and Muons.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:27
Generated on
for ATLAS Offline Software by
1.17.0