ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
CP::SysReadSelectionHandle Class Referencefinal

a data handle for reading systematically varied selection properties from objects More...

#include <SysReadSelectionHandle.h>

Inheritance diagram for CP::SysReadSelectionHandle:
Collaboration diagram for CP::SysReadSelectionHandle:

Public Member Functions

template<typename T2 >
 SysReadSelectionHandle (T2 *owner, const std::string &propertyName, const std::string &propertyValue, const std::string &propertyDescription)
 Standard constructor. More...
 
template<typename T2 >
 SysReadSelectionHandle (const std::string &selection, T2 *owner)
 Construct the handle directly without declaring a property. More...
 
 operator bool () const noexcept
 !empty() More...
 
StatusCode initialize (SysListHandle &sysListHandle, const ISysHandleBase &objectHandle)
 initialize the accessor More...
 
StatusCode initialize (SysListHandle &sysListHandle, const ISysHandleBase &objectHandle, SG::AllowEmptyEnum)
 
bool getBool (const SG::AuxElement &element, const CP::SystematicSet &sys) const
 get the selection as a bool More...
 
const std::string & getSelectionName () const
 get the name of the selection More...
 
virtual bool empty () const noexcept override
 
virtual std::string getNamePattern () const override
 get the name pattern before substitution More...
 
virtual CP::SystematicSet getInputAffecting (const ISystematicsSvc &svc) const override
 get the affecting systematics if this is an input handle More...
 
virtual StatusCode fillSystematics (const ISystematicsSvc &svc, const CP::SystematicSet &fullAffecting, const std::vector< CP::SystematicSet > &sysList) override
 register and cache the systematics More...
 
bool msgLvl (const MSG::Level lvl) const
 Test the output level of the object. More...
 
MsgStream & msg () const
 The standard message stream. More...
 
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream. More...
 

Private Attributes

std::string m_selection
 the selection we use More...
 
const ISysHandleBasem_objectHandle {nullptr}
 the object handle we use More...
 
std::unique_ptr< ISelectionReadAccessorm_accessor
 the accessor we use More...
 
std::function< MsgStream &()> m_msg
 the message stream we use More...
 

Detailed Description

a data handle for reading systematically varied selection properties from objects

Definition at line 30 of file SysReadSelectionHandle.h.

Constructor & Destructor Documentation

◆ SysReadSelectionHandle() [1/2]

template<typename T2 >
CP::SysReadSelectionHandle::SysReadSelectionHandle ( T2 *  owner,
const std::string &  propertyName,
const std::string &  propertyValue,
const std::string &  propertyDescription 
)

Standard constructor.

Template Parameters
T2The type of the owner
Parameters
ownerUsed to declare the property and for its messaging
propertyNameThe name of the property to declare
propertyValueThe default value for the property
propertyDescriptionThe description of the property

This version of the constructor declares a property on the parent object and should usually be preferred when the selection to be read should be configurable

◆ SysReadSelectionHandle() [2/2]

template<typename T2 >
CP::SysReadSelectionHandle::SysReadSelectionHandle ( const std::string &  selection,
T2 *  owner 
)

Construct the handle directly without declaring a property.

Member Function Documentation

◆ empty()

bool CP::SysReadSelectionHandle::empty ( ) const
overridevirtualnoexcept

Inherited Members

Implements CP::ISysHandleBase.

Definition at line 67 of file SysReadSelectionHandle.cxx.

69  {
70  return m_selection.empty();
71  }

◆ fillSystematics()

StatusCode CP::SysReadSelectionHandle::fillSystematics ( const ISystematicsSvc svc,
const CP::SystematicSet fullAffecting,
const std::vector< CP::SystematicSet > &  sysList 
)
overridevirtual

register and cache the systematics

Implements CP::ISysHandleBase.

Definition at line 98 of file SysReadSelectionHandle.cxx.

102  {
103  ANA_CHECK (m_accessor->fillSystematics (svc, sysList, m_objectHandle->getNamePattern()));
104  return StatusCode::SUCCESS;
105  }

◆ getBool()

bool CP::SysReadSelectionHandle::getBool ( const SG::AuxElement element,
const CP::SystematicSet sys 
) const

get the selection as a bool

◆ getInputAffecting()

CP::SystematicSet CP::SysReadSelectionHandle::getInputAffecting ( const ISystematicsSvc svc) const
overridevirtual

get the affecting systematics if this is an input handle

This returns the empty set if this is either not an input handle, or if the input handle is not affected by systematics.

Implements CP::ISysHandleBase.

Definition at line 90 of file SysReadSelectionHandle.cxx.

92  {
93  return m_accessor->getInputAffecting (svc, m_objectHandle->getNamePattern());
94  }

◆ getNamePattern()

std::string CP::SysReadSelectionHandle::getNamePattern ( ) const
overridevirtual

get the name pattern before substitution

Implements CP::ISysHandleBase.

Definition at line 75 of file SysReadSelectionHandle.cxx.

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  }

◆ getSelectionName()

const std::string & CP::SysReadSelectionHandle::getSelectionName ( ) const

get the name of the selection

Definition at line 83 of file SysReadSelectionHandle.cxx.

85  {
86  return m_selection;
87  }

◆ initialize() [1/2]

StatusCode CP::SysReadSelectionHandle::initialize ( SysListHandle sysListHandle,
const ISysHandleBase objectHandle 
)

initialize the accessor

Definition at line 33 of file SysReadSelectionHandle.cxx.

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  }

◆ initialize() [2/2]

StatusCode CP::SysReadSelectionHandle::initialize ( SysListHandle sysListHandle,
const ISysHandleBase objectHandle,
SG::AllowEmptyEnum   
)

Definition at line 53 of file SysReadSelectionHandle.cxx.

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  }

◆ msg() [1/2]

MsgStream & asg::AsgMessagingForward::msg ( ) const
inherited

The standard message stream.

Returns
A reference to the default message stream of this object.

Definition at line 24 of file AsgMessagingForward.cxx.

25  {
26  return m_msg();
27  }

◆ msg() [2/2]

MsgStream & asg::AsgMessagingForward::msg ( const MSG::Level  lvl) const
inherited

The standard message stream.

Parameters
lvlThe message level to set the stream to
Returns
A reference to the default message stream, set to level "lvl"

Definition at line 29 of file AsgMessagingForward.cxx.

30  {
31  MsgStream& msg = m_msg ();
32  msg << lvl;
33  return msg;
34  }

◆ msgLvl()

bool asg::AsgMessagingForward::msgLvl ( const MSG::Level  lvl) const
inherited

Test the output level of the object.

Parameters
lvlThe message level to test against
Returns
boolean Indicting if messages at given level will be printed
true If messages at level "lvl" will be printed

Definition at line 11 of file AsgMessagingForward.cxx.

12  {
13  MsgStream& msg = m_msg();
14  if (msg.level() <= lvl)
15  {
16  msg << lvl;
17  return true;
18  } else
19  {
20  return false;
21  }
22  }

◆ operator bool()

CP::SysReadSelectionHandle::operator bool ( ) const
explicitnoexcept

!empty()

Definition at line 25 of file SysReadSelectionHandle.cxx.

27  {
28  return !m_selection.empty();
29  }

Member Data Documentation

◆ m_accessor

std::unique_ptr<ISelectionReadAccessor> CP::SysReadSelectionHandle::m_accessor
private

the accessor we use

Definition at line 109 of file SysReadSelectionHandle.h.

◆ m_msg

std::function<MsgStream& ()> asg::AsgMessagingForward::m_msg
privateinherited

the message stream we use

This used to be a simple pointer to the MsgStream itself, but in AthenaMT the actual object used is local to the thread. So instead of pointing to it directly we are now using a function to look it up, which will get the thread-local object.

Definition at line 77 of file AsgMessagingForward.h.

◆ m_objectHandle

const ISysHandleBase* CP::SysReadSelectionHandle::m_objectHandle {nullptr}
private

the object handle we use

Definition at line 105 of file SysReadSelectionHandle.h.

◆ m_selection

std::string CP::SysReadSelectionHandle::m_selection
private

the selection we use

Definition at line 101 of file SysReadSelectionHandle.h.


The documentation for this class was generated from the following files:
asg::AsgMessagingForward::m_msg
std::function< MsgStream &()> m_msg
the message stream we use
Definition: AsgMessagingForward.h:77
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
asg::AsgMessagingForward::msg
MsgStream & msg() const
The standard message stream.
Definition: AsgMessagingForward.cxx:24
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
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::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
CP::SysReadSelectionHandle::m_accessor
std::unique_ptr< ISelectionReadAccessor > m_accessor
the accessor we use
Definition: SysReadSelectionHandle.h:109
CP::SysReadSelectionHandle::m_selection
std::string m_selection
the selection we use
Definition: SysReadSelectionHandle.h:101