ATLAS Offline Software
Loading...
Searching...
No Matches
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
16#include <xAODBase/IParticle.h>
17#include <memory>
18
19class StatusCode;
20
21namespace CP
22{
23 class CorrectionCode;
24
25
34
36 {
46
53
60 };
61
62
63
71
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:
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
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)