ATLAS Offline Software
Loading...
Searching...
No Matches
CP::SysWriteSelectionHandle Class Referencefinal

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

#include <SysWriteSelectionHandle.h>

Inheritance diagram for CP::SysWriteSelectionHandle:
Collaboration diagram for CP::SysWriteSelectionHandle:

Public Member Functions

template<typename T2>
 SysWriteSelectionHandle (T2 *owner, const std::string &propertyName, const std::string &propertyValue, const std::string &propertyDescription)
 standard constructor
 operator bool () const noexcept
 !empty()
StatusCode initialize (SysListHandle &sysListHandle, const ISysHandleBase &objectHandle)
 initialize the accessor
StatusCode initialize (SysListHandle &sysListHandle, const ISysHandleBase &objectHandle, SG::AllowEmptyEnum)
void setBits (const SG::AuxElement &element, SelectionType selection, const CP::SystematicSet &sys) const
 set the selection decoration
void setBool (const SG::AuxElement &element, bool selection, const CP::SystematicSet &sys) const
 set the selection decoration
std::string getLabel () const
 get the name/label of the decoration
const std::string & getSelection () const
 get the actual selection string
virtual bool empty () const noexcept override
virtual std::string getNamePattern () const override
 get the name pattern before substitution
virtual CP::SystematicSet getInputAffecting (const ISystematicsSvc &svc) const override
 get the affecting systematics if this is an input handle
virtual StatusCode fillSystematics (const ISystematicsSvc &svc, const CP::SystematicSet &fullAffecting, const std::vector< CP::SystematicSet > &sysList) override
 register and cache the systematics
bool msgLvl (const MSG::Level lvl) const
 Test the output level of the object.
MsgStream & msg () const
 The standard message stream.
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream.

Private Attributes

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

Detailed Description

a data handle for writing systematically varied selection properties from objects

Definition at line 30 of file SysWriteSelectionHandle.h.

Constructor & Destructor Documentation

◆ SysWriteSelectionHandle()

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

standard constructor

Member Function Documentation

◆ empty()

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

Inherited Members

Implements CP::ISysHandleBase.

Definition at line 67 of file SysWriteSelectionHandle.cxx.

69 {
70 return m_selection.empty();
71 }
std::string m_selection
the selection we use

◆ fillSystematics()

StatusCode CP::SysWriteSelectionHandle::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 109 of file SysWriteSelectionHandle.cxx.

113 {
114 ANA_CHECK (m_accessor->fillSystematics (svc, fullAffecting, sysList, m_objectHandle->getNamePattern()));
115 return StatusCode::SUCCESS;
116 }
#define ANA_CHECK(EXP)
check whether the given expression was successful
const ISysHandleBase * m_objectHandle
the object handle we use
std::unique_ptr< ISelectionWriteAccessor > m_accessor
the accessor we use

◆ getInputAffecting()

CP::SystematicSet CP::SysWriteSelectionHandle::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 101 of file SysWriteSelectionHandle.cxx.

103 {
104 return CP::SystematicSet ();
105 }

◆ getLabel()

std::string CP::SysWriteSelectionHandle::getLabel ( ) const

get the name/label of the decoration

Definition at line 75 of file SysWriteSelectionHandle.cxx.

77 {
78 return m_accessor->label();
79 }

◆ getNamePattern()

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

get the name pattern before substitution

Implements CP::ISysHandleBase.

Definition at line 91 of file SysWriteSelectionHandle.cxx.

93 {
94 // So far it is undefined what to return here. I'll fill this in
95 // once there is a reason for it to be one or the other.
96 return "";
97 }

◆ getSelection()

const std::string & CP::SysWriteSelectionHandle::getSelection ( ) const

get the actual selection string

Definition at line 83 of file SysWriteSelectionHandle.cxx.

85 {
86 return m_selection;
87 }

◆ initialize() [1/2]

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

initialize the accessor

Definition at line 33 of file SysWriteSelectionHandle.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 }
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
StatusCode makeSelectionWriteAccessor(const std::string &name, std::unique_ptr< ISelectionWriteAccessor > &accessor, bool defaultToChar)
Produces a simple ISelectionWriteAccessor accessing the given decoration.

◆ initialize() [2/2]

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

Definition at line 53 of file SysWriteSelectionHandle.cxx.

55 {
56 if (!empty())
57 return initialize (sysListHandle, objectHandle);
58 else
59 {
60 m_accessor = std::make_unique<SelectionWriteAccessorNull>();
61 return StatusCode::SUCCESS;
62 }
63 }
virtual bool empty() const noexcept override
void initialize()

◆ 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 }
std::function< MsgStream &()> m_msg
the message stream we use

◆ 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 }
MsgStream & msg() const
The standard message stream.

◆ 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::SysWriteSelectionHandle::operator bool ( ) const
explicitnoexcept

!empty()

Definition at line 25 of file SysWriteSelectionHandle.cxx.

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

◆ setBits()

void CP::SysWriteSelectionHandle::setBits ( const SG::AuxElement & element,
SelectionType selection,
const CP::SystematicSet & sys ) const

set the selection decoration

◆ setBool()

void CP::SysWriteSelectionHandle::setBool ( const SG::AuxElement & element,
bool selection,
const CP::SystematicSet & sys ) const

set the selection decoration

Member Data Documentation

◆ m_accessor

std::unique_ptr<ISelectionWriteAccessor> CP::SysWriteSelectionHandle::m_accessor
private

the accessor we use

Definition at line 107 of file SysWriteSelectionHandle.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::SysWriteSelectionHandle::m_objectHandle {nullptr}
private

the object handle we use

Definition at line 103 of file SysWriteSelectionHandle.h.

103{nullptr};

◆ m_selection

std::string CP::SysWriteSelectionHandle::m_selection
private

the selection we use

Definition at line 99 of file SysWriteSelectionHandle.h.


The documentation for this class was generated from the following files: