ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
SelectionHelpers
SelectionHelpers
OutOfValidityHelper.h
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
#ifndef SELECTION_HELPERS__OUT_OF_VALIDITY_HELPER_H
9
#define SELECTION_HELPERS__OUT_OF_VALIDITY_HELPER_H
10
11
#include <
AsgMessaging/AsgMessagingForward.h
>
12
#include <
AthContainers/AuxElement.h
>
13
#include <
CxxUtils/AthUnlikelyMacros.h
>
14
#include <
SelectionHelpers/ISelectionWriteAccessor.h
>
15
#include <
SelectionHelpers/ISelectionReadAccessor.h
>
16
#include <
xAODBase/IParticle.h
>
17
#include <memory>
18
19
class
StatusCode
;
20
21
namespace
CP
22
{
23
class
CorrectionCode
;
24
25
34
35
enum class
OutOfValidityAction
36
{
45
ABORT
,
46
52
WARNING
,
53
59
SILENT
60
};
61
62
63
71
72
class
OutOfValidityHelper
final :
public
asg::AsgMessagingForward
73
{
75
public
:
76
template
<
typename
T>
77
OutOfValidityHelper
(T *owner,
const
std::string& propertyName =
"outOfValidity"
,
78
const
std::string& propertyDescription =
"how to handle out of validity results"
);
79
80
82
public
:
83
::StatusCode
initialize
();
84
86
public
:
87
::StatusCode
check
(
const
xAOD::IParticle
& particle,
88
const
CP::CorrectionCode
& code,
89
const
char
*context)
const
;
90
92
public
:
93
bool
get
(
const
xAOD::IParticle
& particle)
const
;
94
96
private
:
97
unsigned
m_action
{
unsigned
(
OutOfValidityAction::ABORT
)};
98
100
private
:
101
std::unique_ptr<ISelectionWriteAccessor>
m_write_accessor
;
102
std::unique_ptr<ISelectionReadAccessor>
m_read_accessor
;
103
105
private
:
106
std::string
m_decorationName
;
107
113
private
:
114
bool
m_isInitialized
=
false
;
115
};
116
117
118
119
template
<
typename
T> OutOfValidityHelper ::
120
OutOfValidityHelper (T *owner,
const
std::string& propertyName,
121
const
std::string& propertyDescription)
122
:
asg
::
AsgMessagingForward
(owner)
123
{
124
owner->declareProperty (propertyName,
m_action
,
125
propertyDescription);
126
owner->declareProperty (propertyName +
"Deco"
,
m_decorationName
,
127
"decoration to set alongside action described by "
+ propertyName);
128
}
129
}
130
132
#define ANA_CHECK_CORRECTION(helper,object,expr) \
133
{ if (ATH_UNLIKELY((helper).check ((object), (expr), #expr).isFailure())) \
134
return StatusCode::FAILURE; }
135
136
#endif
AsgMessagingForward.h
AthUnlikelyMacros.h
AuxElement.h
Base class for elements of a container that can have aux data.
IParticle.h
ISelectionReadAccessor.h
ISelectionWriteAccessor.h
CP::CorrectionCode
Return value from object correction CP tools.
Definition
CorrectionCode.h:31
CP::OutOfValidityHelper::get
bool get(const xAOD::IParticle &particle) const
retrieve the OutOfValidity decision, where true = particle passes validity check
Definition
OutOfValidityHelper.cxx:71
CP::OutOfValidityHelper::OutOfValidityHelper
OutOfValidityHelper(T *owner, const std::string &propertyName="outOfValidity", const std::string &propertyDescription="how to handle out of validity results")
standard constructor
Definition
OutOfValidityHelper.h:120
CP::OutOfValidityHelper::initialize
::StatusCode initialize()
standard initialize
Definition
OutOfValidityHelper.cxx:25
CP::OutOfValidityHelper::m_decorationName
std::string m_decorationName
the decoration name we use (if we have one)
Definition
OutOfValidityHelper.h:106
CP::OutOfValidityHelper::check
::StatusCode check(const xAOD::IParticle &particle, const CP::CorrectionCode &code, const char *context) const
check the correction code and do the proper thing
Definition
OutOfValidityHelper.cxx:39
CP::OutOfValidityHelper::m_write_accessor
std::unique_ptr< ISelectionWriteAccessor > m_write_accessor
the accessor if we apply one
Definition
OutOfValidityHelper.h:101
CP::OutOfValidityHelper::m_action
unsigned m_action
the action to take
Definition
OutOfValidityHelper.h:97
CP::OutOfValidityHelper::m_isInitialized
bool m_isInitialized
whether we have been initialized
Definition
OutOfValidityHelper.h:114
CP::OutOfValidityHelper::m_read_accessor
std::unique_ptr< ISelectionReadAccessor > m_read_accessor
Definition
OutOfValidityHelper.h:102
asg::AsgMessagingForward
base class to forward messages to another class
Definition
AsgMessagingForward.h:29
asg::AsgMessagingForward::AsgMessagingForward
AsgMessagingForward(T *owner)
forwarding constructor
Definition
AsgMessagingForward.h:83
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition
Event/xAOD/xAODBase/xAODBase/IParticle.h:41
CP
Select isolated Photons, Electrons and Muons.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:27
CP::OutOfValidityAction
OutOfValidityAction
the action to perform on encountering an OutOfValidityRange in OutOfValidityHelper
Definition
OutOfValidityHelper.h:36
CP::OutOfValidityAction::WARNING
@ WARNING
print a warning message and return a success status code.
Definition
OutOfValidityHelper.h:52
CP::OutOfValidityAction::SILENT
@ SILENT
don't print anything and return success
Definition
OutOfValidityHelper.h:59
CP::OutOfValidityAction::ABORT
@ ABORT
print an error message and return a failure status code (triggering an abort)
Definition
OutOfValidityHelper.h:45
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
asg
Definition
DataHandleTestTool.h:28
xAOD::unsigned
unsigned
Definition
RingSetConf_v1.cxx:656
Generated on
for ATLAS Offline Software by
1.17.0