ATLAS Offline Software
Loading...
Searching...
No Matches
OutOfValidityHelper.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 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
15#include <xAODBase/IParticle.h>
16#include <memory>
17
18class StatusCode;
19
20namespace CP
21{
22 class CorrectionCode;
23
24
33
35 {
45
52
59 };
60
61
62
70
72 {
74 public:
75 template<typename T>
76 OutOfValidityHelper (T *owner, const std::string& propertyName = "outOfValidity",
77 const std::string& propertyDescription = "how to handle out of validity results");
78
79
81 public:
82 ::StatusCode initialize ();
83
85 public:
86 ::StatusCode check (const xAOD::IParticle& particle,
87 const CP::CorrectionCode& code,
88 const char *context) const;
89
91 public:
92 bool get (const xAOD::IParticle& particle) const;
93
95 private:
97
99 private:
100 std::unique_ptr<ISelectionWriteAccessor> m_write_accessor;
101 std::unique_ptr<ISelectionReadAccessor> m_read_accessor;
102
104 private:
105 std::string m_decorationName;
106
112 private:
113 bool m_isInitialized = false;
114 };
115
116
117
118 template<typename T> OutOfValidityHelper ::
119 OutOfValidityHelper (T *owner, const std::string& propertyName,
120 const std::string& propertyDescription)
121 : asg::AsgMessagingForward (owner)
122 {
123 owner->declareProperty (propertyName, m_action,
124 propertyDescription);
125 owner->declareProperty (propertyName + "Deco", m_decorationName,
126 "decoration to set alongside action described by " + propertyName);
127 }
128}
129
131#define ANA_CHECK_CORRECTION(helper,object,expr) \
132 { if ((helper).check ((object), (expr), #expr).isFailure()) [[unlikely]] \
133 return StatusCode::FAILURE; }
134
135#endif
Base class for elements of a container that can have aux data.
Return value from object correction CP tools.
bool get(const xAOD::IParticle &particle) const
retrieve the OutOfValidity decision, where true = particle passes validity check
OutOfValidityHelper(T *owner, const std::string &propertyName="outOfValidity", const std::string &propertyDescription="how to handle out of validity results")
standard constructor
::StatusCode initialize()
standard initialize
std::string m_decorationName
the decoration name we use (if we have one)
::StatusCode check(const xAOD::IParticle &particle, const CP::CorrectionCode &code, const char *context) const
check the correction code and do the proper thing
std::unique_ptr< ISelectionWriteAccessor > m_write_accessor
the accessor if we apply one
unsigned m_action
the action to take
bool m_isInitialized
whether we have been initialized
std::unique_ptr< ISelectionReadAccessor > m_read_accessor
base class to forward messages to another class
AsgMessagingForward(T *owner)
forwarding constructor
Class providing the definition of the 4-vector interface.
Select isolated Photons, Electrons and Muons.
OutOfValidityAction
the action to perform on encountering an OutOfValidityRange in OutOfValidityHelper
@ WARNING
print a warning message and return a success status code.
@ SILENT
don't print anything and return success
@ ABORT
print an error message and return a failure status code (triggering an abort)
::StatusCode StatusCode
StatusCode definition for legacy code.