ATLAS Offline Software
Loading...
Searching...
No Matches
OutOfValidityHelper.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
13
17
18//
19// method implementations
20//
21
22namespace CP
23{
24 ::StatusCode OutOfValidityHelper ::
25 initialize ()
26 {
27 if (!m_decorationName.empty())
28 {
31 }
32
33 m_isInitialized = true;
34 return StatusCode::SUCCESS;
35 }
36
37
38 ::StatusCode OutOfValidityHelper ::
39 check (const xAOD::IParticle& particle,
40 const CP::CorrectionCode& code,
41 const char *context) const
42 {
43 assert (m_isInitialized);
44
45 switch (code)
46 {
48 if (m_write_accessor) m_write_accessor->setBool (particle, true);
49 return StatusCode::SUCCESS;
51 return StatusCode::FAILURE;
53 if (m_write_accessor) m_write_accessor->setBool (particle, false);
55 {
57 ANA_MSG_ERROR ("encountered OutOfValidity: " << context);
58 return StatusCode::FAILURE;
60 ANA_MSG_WARNING ("encountered OutOfValidity: " << context);
61 return StatusCode::SUCCESS;
63 return StatusCode::SUCCESS;
64 }
65 }
66 ANA_MSG_ERROR (__FILE__ << ":" << __LINE__ << ": invalid enum value encountered " << code << " " << int (m_action));
67 return StatusCode::FAILURE;
68 }
69
70 bool OutOfValidityHelper ::
71 get (const xAOD::IParticle& particle) const {
72 return m_read_accessor->getBool(particle);
73 }
74
75
76}
macros for messaging and checking status codes
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
#define ANA_MSG_WARNING(xmsg)
Macro printing warning messages.
#define ANA_CHECK(EXP)
check whether the given expression was successful
Return value from object correction CP tools.
@ Error
Some error happened during the object correction.
@ OutOfValidityRange
Input object is out of validity range.
@ Ok
The correction was done successfully.
std::string m_decorationName
the decoration name we use (if we have one)
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
Class providing the definition of the 4-vector interface.
Select isolated Photons, Electrons and Muons.
StatusCode makeSelectionWriteAccessor(const std::string &name, std::unique_ptr< ISelectionWriteAccessor > &accessor, bool defaultToChar)
Produces a simple ISelectionWriteAccessor accessing the given decoration.
StatusCode makeSelectionReadAccessor(const std::string &expr, std::unique_ptr< ISelectionReadAccessor > &accessor, bool defaultToChar)
make the ISelectionReadAccessor for the given name
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)