ATLAS Offline Software
SysReadSelectionHandle.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 
18 
19 //
20 // method implementations
21 //
22 
23 namespace CP
24 {
25  SysReadSelectionHandle ::
26  operator bool () const noexcept
27  {
28  return !m_selection.empty();
29  }
30 
31 
32 
34  initialize (SysListHandle& sysListHandle, const ISysHandleBase& objectHandle)
35  {
36  if (m_selection.empty())
37  {
38  ANA_MSG_ERROR ("trying to initialize empty handle");
39  return StatusCode::FAILURE;
40  }
41  if (m_objectHandle != nullptr)
42  {
43  ANA_MSG_ERROR ("trying to initialize handle twice");
44  return StatusCode::FAILURE;
45  }
46  m_objectHandle = &objectHandle;
48  return sysListHandle.addHandle (*this);
49  }
50 
51 
52 
54  initialize (SysListHandle& sysListHandle, const ISysHandleBase& objectHandle, SG::AllowEmptyEnum)
55  {
56  if (!empty())
57  return initialize (sysListHandle, objectHandle);
58  else
59  {
60  m_accessor = std::make_unique<SelectionReadAccessorNull>(true);
61  return StatusCode::SUCCESS;
62  }
63  }
64 
65 
66 
68  empty () const noexcept
69  {
70  return m_selection.empty();
71  }
72 
73 
74 
76  getNamePattern () const
77  {
78  // So far it is undefined what to return here. I'll fill this in
79  // once there is a reason for it to be one or the other.
80  return "";
81  }
82 
83  const std::string& SysReadSelectionHandle ::
84  getSelectionName () const
85  {
86  return m_selection;
87  }
88 
89 
92  {
93  return m_accessor->getInputAffecting (svc, m_objectHandle->getNamePattern());
94  }
95 
96 
97 
100  const CP::SystematicSet& /*fullAffecting*/,
101  const std::vector<CP::SystematicSet>& sysList)
102  {
103  ANA_CHECK (m_accessor->fillSystematics (svc, sysList, m_objectHandle->getNamePattern()));
104  return StatusCode::SUCCESS;
105  }
106 }
CP::SysListHandle::addHandle
StatusCode addHandle(ISysHandleBase &handle)
register an input handle we are using
Definition: SysListHandle.cxx:29
CP::SysListHandle
a class managing the property to configure the list of systematics to process
Definition: SysListHandle.h:33
CP::ISystematicsSvc
the interface for the central systematics service
Definition: ISystematicsSvc.h:25
SysListHandle.h
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
ANA_MSG_ERROR
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:294
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:562
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
CP::SysReadSelectionHandle::getNamePattern
virtual std::string getNamePattern() const override
get the name pattern before substitution
Definition: SysReadSelectionHandle.cxx:76
SG::AllowEmptyEnum
AllowEmptyEnum
Definition: StoreGate/StoreGate/VarHandleKey.h:29
CP::ISysHandleBase
a basic interface for all systematics handles
Definition: ISysHandleBase.h:28
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MessageCheck.h
macros for messaging and checking status codes
CP::SysReadSelectionHandle::m_objectHandle
const ISysHandleBase * m_objectHandle
the object handle we use
Definition: SysReadSelectionHandle.h:105
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
StatusCode.h
SysReadSelectionHandle.h
CP::makeSelectionReadAccessor
StatusCode makeSelectionReadAccessor(const std::string &expr, std::unique_ptr< ISelectionReadAccessor > &accessor, bool defaultToChar)
make the ISelectionReadAccessor for the given name
Definition: ISelectionAccessor.cxx:54
CP::SysReadSelectionHandle::getInputAffecting
virtual CP::SystematicSet getInputAffecting(const ISystematicsSvc &svc) const override
get the affecting systematics if this is an input handle
Definition: SysReadSelectionHandle.cxx:91
CP::SysReadSelectionHandle::fillSystematics
virtual StatusCode fillSystematics(const ISystematicsSvc &svc, const CP::SystematicSet &fullAffecting, const std::vector< CP::SystematicSet > &sysList) override
register and cache the systematics
Definition: SysReadSelectionHandle.cxx:99
CP::SysReadSelectionHandle::getSelectionName
const std::string & getSelectionName() const
get the name of the selection
Definition: SysReadSelectionHandle.cxx:84
CP::SysReadSelectionHandle::empty
virtual bool empty() const noexcept override
Definition: SysReadSelectionHandle.cxx:68
CP::SysReadSelectionHandle::initialize
StatusCode initialize(SysListHandle &sysListHandle, const ISysHandleBase &objectHandle)
initialize the accessor
Definition: SysReadSelectionHandle.cxx:34
CP::ISysHandleBase::getNamePattern
virtual std::string getNamePattern() const =0
get the name pattern before substitution
xAOD::bool
setBGCode setTAP setLVL2ErrorBits bool
Definition: TrigDecision_v1.cxx:60
CP::SysReadSelectionHandle::m_accessor
std::unique_ptr< ISelectionReadAccessor > m_accessor
the accessor we use
Definition: SysReadSelectionHandle.h:109
SelectionReadAccessorNull.h
CP::SysReadSelectionHandle::m_selection
std::string m_selection
the selection we use
Definition: SysReadSelectionHandle.h:101