ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
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 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)
 
void setBits (const SG::AuxElement &element, SelectionType selection, const CP::SystematicSet &sys) const
 set the selection decoration More...
 
void setBool (const SG::AuxElement &element, bool selection, const CP::SystematicSet &sys) const
 set the selection decoration More...
 
std::string getLabel () const
 get the name/label of the decoration More...
 
const std::string & getSelection () const
 get the actual selection string 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< ISelectionWriteAccessorm_accessor
 the accessor we use More...
 
std::function< MsgStream &()> m_msg
 the message stream we use More...
 

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  }

◆ 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  }

◆ 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  }

◆ 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  }

◆ 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::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.

◆ 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:
asg::AsgMessagingForward::m_msg
std::function< MsgStream &()> m_msg
the message stream we use
Definition: AsgMessagingForward.h:77
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
CP::makeSelectionWriteAccessor
StatusCode makeSelectionWriteAccessor(const std::string &name, std::unique_ptr< ISelectionWriteAccessor > &accessor, bool defaultToChar)
Produces a simple ISelectionWriteAccessor accessing the given decoration.
Definition: ISelectionAccessor.cxx:170
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::SysWriteSelectionHandle::empty
virtual bool empty() const noexcept override
Definition: SysWriteSelectionHandle.cxx:68
CP::SysWriteSelectionHandle::m_objectHandle
const ISysHandleBase * m_objectHandle
the object handle we use
Definition: SysWriteSelectionHandle.h:103
CP::SysWriteSelectionHandle::m_selection
std::string m_selection
the selection we use
Definition: SysWriteSelectionHandle.h:99
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
CP::SysWriteSelectionHandle::m_accessor
std::unique_ptr< ISelectionWriteAccessor > m_accessor
the accessor we use
Definition: SysWriteSelectionHandle.h:107
CP::ISysHandleBase::getNamePattern
virtual std::string getNamePattern() const =0
get the name pattern before substitution
CP::SysWriteSelectionHandle::initialize
StatusCode initialize(SysListHandle &sysListHandle, const ISysHandleBase &objectHandle)
initialize the accessor
Definition: SysWriteSelectionHandle.cxx:34