ATLAS Offline Software
Loading...
Searching...
No Matches
ORUtils::ToolBox Class Reference

A container and helper class for overlap removal tools. More...

#include <ToolBox.h>

Inheritance diagram for ORUtils::ToolBox:
Collaboration diagram for ORUtils::ToolBox:

Public Types

using parentType_t = INamedInterface
 Aliases.
using MasterHandle_t = asg::AnaToolHandle<IOverlapRemovalTool>
using OverlapHandle_t = asg::AnaToolHandle<IOverlapTool>

Public Member Functions

 ToolBox (const std::string &name="ORToolBox", parentType_t *theParent=nullptr)
 Basic constructor with name and parent.
StatusCode initialize ()
 Attach and initialize all tools.
std::vector< OverlapHandle_t * > getOverlapTools ()
 Get a list of all handles to loop over.
template<class T>
StatusCode setGlobalProperty (const std::string &property, const T &value)
 Apply a global property to all tools.
parentType_tparent ()
 Pointer to the parent component for the tool handles.
void setLevel (MSG::Level lvl)
 Change the current logging level.
Functions providing the same interface as AthMessaging
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.

Public Attributes

MasterHandle_t masterTool
 Master overlap removal tool handle.
overlap tool handles
OverlapHandle_t muPFJetORT
OverlapHandle_t eleEleORT
OverlapHandle_t eleMuORT
OverlapHandle_t eleJetORT
OverlapHandle_t muJetORT
OverlapHandle_t tauEleORT
OverlapHandle_t tauMuORT
OverlapHandle_t tauJetORT
OverlapHandle_t phoEleORT
OverlapHandle_t phoMuORT
OverlapHandle_t phoJetORT
OverlapHandle_t eleFatJetORT
OverlapHandle_t jetFatJetORT

Private Member Functions

StatusCode initTool (OverlapHandle_t &handle, const std::string &key)
 Initialize and attach one overlap tool.
StatusCode initMaster ()
 Initialize master tool.
void initMessaging () const
 Initialize our message level and MessageSvc.

Private Attributes

parentType_tm_parent
 Pointer to the parent component for the tool handles.
std::string m_nm
 Message source name.
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels)
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer.
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level.
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging)

Detailed Description

A container and helper class for overlap removal tools.

This implementation uses AnaToolHandles to setup, manage, and configure the overlap tools and a master overlap removal tool.

Todo
Add some more usage details.
Author
Steve Farrell Steve.nosp@m.n.Fa.nosp@m.rrell.nosp@m.@cer.nosp@m.n.ch

Definition at line 38 of file ToolBox.h.

Member Typedef Documentation

◆ MasterHandle_t

◆ OverlapHandle_t

◆ parentType_t

using ORUtils::ToolBox::parentType_t = INamedInterface

Aliases.

Definition at line 44 of file ToolBox.h.

Constructor & Destructor Documentation

◆ ToolBox()

ORUtils::ToolBox::ToolBox ( const std::string & name = "ORToolBox",
parentType_t * theParent = nullptr )

Basic constructor with name and parent.

Definition at line 14 of file ToolBox.cxx.

15 : asg::AsgMessaging(name),
16 masterTool("", theParent),
17 eleEleORT("", theParent),
18 eleMuORT("", theParent),
19 eleJetORT("", theParent),
20 muJetORT("", theParent),
21 tauEleORT("", theParent),
22 tauMuORT("", theParent),
23 tauJetORT("", theParent),
24 phoEleORT("", theParent),
25 phoMuORT("", theParent),
26 phoJetORT("", theParent),
27 eleFatJetORT("", theParent),
28 jetFatJetORT("", theParent),
29 m_parent(theParent)
30 {}
OverlapHandle_t phoEleORT
Definition ToolBox.h:76
OverlapHandle_t eleJetORT
Definition ToolBox.h:71
OverlapHandle_t eleFatJetORT
Definition ToolBox.h:79
OverlapHandle_t phoJetORT
Definition ToolBox.h:78
OverlapHandle_t jetFatJetORT
Definition ToolBox.h:80
MasterHandle_t masterTool
Master overlap removal tool handle.
Definition ToolBox.h:64
OverlapHandle_t eleEleORT
Definition ToolBox.h:69
OverlapHandle_t muJetORT
Definition ToolBox.h:72
OverlapHandle_t eleMuORT
Definition ToolBox.h:70
OverlapHandle_t phoMuORT
Definition ToolBox.h:77
OverlapHandle_t tauMuORT
Definition ToolBox.h:74
OverlapHandle_t tauJetORT
Definition ToolBox.h:75
OverlapHandle_t tauEleORT
Definition ToolBox.h:73
parentType_t * m_parent
Pointer to the parent component for the tool handles.
Definition ToolBox.h:95

Member Function Documentation

◆ getOverlapTools()

std::vector< ToolBox::OverlapHandle_t * > ORUtils::ToolBox::getOverlapTools ( )

Get a list of all handles to loop over.

Definition at line 71 of file ToolBox.cxx.

72 {
73 // This is somewhat error prone, but better than not having it.
74 std::vector<OverlapHandle_t*> tools;
75 tools.reserve(13);
76 if(!eleEleORT.empty()) tools.push_back(&eleEleORT);
77 if(!eleMuORT.empty()) tools.push_back(&eleMuORT);
78 if(!eleJetORT.empty()) tools.push_back(&eleJetORT);
79 if(!muJetORT.empty()) tools.push_back(&muJetORT);
80 if(!tauEleORT.empty()) tools.push_back(&tauEleORT);
81 if(!tauMuORT.empty()) tools.push_back(&tauMuORT);
82 if(!tauJetORT.empty()) tools.push_back(&tauJetORT);
83 if(!phoEleORT.empty()) tools.push_back(&phoEleORT);
84 if(!phoMuORT.empty()) tools.push_back(&phoMuORT);
85 if(!phoJetORT.empty()) tools.push_back(&phoJetORT);
86 if(!eleFatJetORT.empty()) tools.push_back(&eleFatJetORT);
87 if(!jetFatJetORT.empty()) tools.push_back(&jetFatJetORT);
88 return tools;
89 }

◆ initialize()

StatusCode ORUtils::ToolBox::initialize ( )

Attach and initialize all tools.

Definition at line 35 of file ToolBox.cxx.

36 {
37
38#ifndef XAOD_STANDALONE
39 // For now, in Athena, things only work with private tools.
40 // See ATLASG-957 for more details.
41 if(!m_parent) {
42 ATH_MSG_ERROR("For now, if you want to use the ToolBox in Athena, " <<
43 "the tools must be private to some algorithm, tool, etc.");
44 return StatusCode::FAILURE;
45 }
46#endif
47
48 // Initialize the overlap tools
49 ATH_CHECK( initTool(eleEleORT, "EleEleORT") );
50 ATH_CHECK( initTool(eleMuORT, "EleMuORT") );
51 ATH_CHECK( initTool(eleJetORT, "EleJetORT") );
52 ATH_CHECK( initTool(muJetORT, "MuJetORT") );
53 ATH_CHECK( initTool(tauEleORT, "TauEleORT") );
54 ATH_CHECK( initTool(tauMuORT, "TauMuORT") );
55 ATH_CHECK( initTool(tauJetORT, "TauJetORT") );
56 ATH_CHECK( initTool(phoEleORT, "PhoEleORT") );
57 ATH_CHECK( initTool(phoMuORT, "PhoMuORT") );
58 ATH_CHECK( initTool(phoJetORT, "PhoJetORT") );
59 ATH_CHECK( initTool(eleFatJetORT, "EleFatJetORT") );
60 ATH_CHECK( initTool(jetFatJetORT, "JetFatJetORT") );
61
62 // Initialize the master tool
64
65 return StatusCode::SUCCESS;
66 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
StatusCode initMaster()
Initialize master tool.
Definition ToolBox.cxx:120
StatusCode initTool(OverlapHandle_t &handle, const std::string &key)
Initialize and attach one overlap tool.
Definition ToolBox.cxx:94

◆ initMaster()

StatusCode ORUtils::ToolBox::initMaster ( )
private

Initialize master tool.

Definition at line 120 of file ToolBox.cxx.

121 {
122 // For now, we look for a non-empty "type"
123 if(!masterTool.empty()) {
124 ATH_MSG_DEBUG("Initializing master " << masterTool.name());
125 ATH_MSG_DEBUG(" type " << masterTool.type());
126 ATH_MSG_DEBUG(" isInitialized " << masterTool.isInitialized());
127 if(!masterTool.isInitialized()) {
128 ATH_CHECK( masterTool.initialize() );
129 }
130 }
131 return StatusCode::SUCCESS;
132 }
#define ATH_MSG_DEBUG(x)

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40{
42 // If user did not set an explicit level, set a default
43 if (m_lvl == MSG::NIL) {
44 m_lvl = m_imsg ?
45 static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
46 MSG::INFO;
47 }
48}
std::string m_nm
Message source name.
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
std::atomic< MSG::Level > m_lvl
Current logging level.
IMessageSvc * getMessageSvc(bool quiet=false)

◆ initTool()

StatusCode ORUtils::ToolBox::initTool ( OverlapHandle_t & handle,
const std::string & key )
private

Initialize and attach one overlap tool.

Definition at line 94 of file ToolBox.cxx.

95 {
96 // Handle must be non-empty
97 if(!handle.empty()) {
98 ATH_MSG_DEBUG("Initializing " << handle.name());
99 ATH_MSG_DEBUG(" type " << handle.type());
100 ATH_MSG_DEBUG(" isInitialized " << handle.isInitialized());
101
102 // Initialize the handle - WB: NO DON'T DO THIS ...
103 // the naming of the tool implies it's a subtool, so it mustn't be created before
104 // the parent tool is, because otherwise the parent tool doesn't get configured properly
105 // if the configuration has been done on the C++ side (the state of the joboptionsvc hasn't
106 // been updated yet) ... triggering the initialization would trigger the creation of the master tool
107 // because it's deemed to be a parent by the naming convention parent.child
108
109 // Add it to the master tool
110 if(!masterTool.empty()) {
111 ATH_CHECK( masterTool.setProperty(key, handle) );
112 }
113 }
114 return StatusCode::SUCCESS;
115 }

◆ msg() [1/2]

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

The standard message stream.

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

Definition at line 49 of file AsgMessaging.cxx.

49 {
50#ifndef XAOD_STANDALONE
51 return ::AthMessaging::msg();
52#else // not XAOD_STANDALONE
53 return m_msg;
54#endif // not XAOD_STANDALONE
55 }

◆ msg() [2/2]

MsgStream & asg::AsgMessaging::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 57 of file AsgMessaging.cxx.

57 {
58#ifndef XAOD_STANDALONE
59 return ::AthMessaging::msg( lvl );
60#else // not XAOD_STANDALONE
61 m_msg << lvl;
62 return m_msg;
63#endif // not XAOD_STANDALONE
64 }

◆ msgLvl()

bool asg::AsgMessaging::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 41 of file AsgMessaging.cxx.

41 {
42#ifndef XAOD_STANDALONE
43 return ::AthMessaging::msgLvl( lvl );
44#else // not XAOD_STANDALONE
45 return m_msg.msgLevel( lvl );
46#endif // not XAOD_STANDALONE
47 }

◆ parent()

parentType_t * ORUtils::ToolBox::parent ( )
inline

Pointer to the parent component for the tool handles.

Definition at line 84 of file ToolBox.h.

84{ return m_parent; }

◆ setGlobalProperty()

template<class T>
StatusCode ORUtils::ToolBox::setGlobalProperty ( const std::string & property,
const T & value )

Apply a global property to all tools.

Definition at line 104 of file ToolBox.h.

105 {
106 // Handle the overlap tools
107 for(auto handlePtr : getOverlapTools()) {
108 ATH_CHECK( handlePtr->setProperty(property, value) );
109 }
110 // Handle the master tool
111 if(!masterTool.empty()) ATH_CHECK( masterTool.setProperty(property, value) );
112 return StatusCode::SUCCESS;
113 }
std::vector< OverlapHandle_t * > getOverlapTools()
Get a list of all handles to loop over.
Definition ToolBox.cxx:71

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29{
30 m_lvl = lvl;
31}

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ eleEleORT

OverlapHandle_t ORUtils::ToolBox::eleEleORT

Definition at line 69 of file ToolBox.h.

◆ eleFatJetORT

OverlapHandle_t ORUtils::ToolBox::eleFatJetORT

Definition at line 79 of file ToolBox.h.

◆ eleJetORT

OverlapHandle_t ORUtils::ToolBox::eleJetORT

Definition at line 71 of file ToolBox.h.

◆ eleMuORT

OverlapHandle_t ORUtils::ToolBox::eleMuORT

Definition at line 70 of file ToolBox.h.

◆ jetFatJetORT

OverlapHandle_t ORUtils::ToolBox::jetFatJetORT

Definition at line 80 of file ToolBox.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

135{ nullptr };

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

138{ MSG::NIL };

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels)

Definition at line 132 of file AthMessaging.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_parent

parentType_t* ORUtils::ToolBox::m_parent
private

Pointer to the parent component for the tool handles.

Definition at line 95 of file ToolBox.h.

◆ masterTool

MasterHandle_t ORUtils::ToolBox::masterTool

Master overlap removal tool handle.

Definition at line 64 of file ToolBox.h.

◆ muJetORT

OverlapHandle_t ORUtils::ToolBox::muJetORT

Definition at line 72 of file ToolBox.h.

◆ muPFJetORT

OverlapHandle_t ORUtils::ToolBox::muPFJetORT

Definition at line 68 of file ToolBox.h.

◆ phoEleORT

OverlapHandle_t ORUtils::ToolBox::phoEleORT

Definition at line 76 of file ToolBox.h.

◆ phoJetORT

OverlapHandle_t ORUtils::ToolBox::phoJetORT

Definition at line 78 of file ToolBox.h.

◆ phoMuORT

OverlapHandle_t ORUtils::ToolBox::phoMuORT

Definition at line 77 of file ToolBox.h.

◆ tauEleORT

OverlapHandle_t ORUtils::ToolBox::tauEleORT

Definition at line 73 of file ToolBox.h.

◆ tauJetORT

OverlapHandle_t ORUtils::ToolBox::tauJetORT

Definition at line 75 of file ToolBox.h.

◆ tauMuORT

OverlapHandle_t ORUtils::ToolBox::tauMuORT

Definition at line 74 of file ToolBox.h.


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