ATLAS Offline Software
ToolBox.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ASSOCIATIONUTILS_TOOLBOX_H
6 #define ASSOCIATIONUTILS_TOOLBOX_H
7 
8 // Framework includes
10 #include "AsgTools/AnaToolHandle.h"
11 
12 // Local includes
15 
16 // STL includes
17 #include <string>
18 
19 // Forward declarations
20 class INamedInterface;
21 namespace asg {
22  class AsgTool;
23 }
24 
25 namespace ORUtils
26 {
27 
38  class ToolBox : public asg::AsgMessaging
39  {
40 
41  public:
42 
44  using parentType_t = INamedInterface;
47 
48 
50  ToolBox(const std::string& name = "ORToolBox",
51  parentType_t* theParent = nullptr);
52 
55 
57  std::vector<OverlapHandle_t*> getOverlapTools();
58 
60  template<class T> StatusCode
61  setGlobalProperty(const std::string& property, const T& value);
62 
65 
82 
84  parentType_t* parent() { return m_parent; }
85 
86  private:
87 
89  StatusCode initTool(OverlapHandle_t& handle, const std::string& key);
90 
93 
96 
97  };
98 
99 
100  //---------------------------------------------------------------------------
101  // Implementation method to set a property on all tools.
102  //---------------------------------------------------------------------------
103  template<class T> StatusCode
104  ToolBox::setGlobalProperty(const std::string& property, const T& value)
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  }
114 
115 } // namespace ORUtils
116 
117 #endif
ORUtils::ToolBox::m_parent
parentType_t * m_parent
Pointer to the parent component for the tool handles.
Definition: ToolBox.h:95
ORUtils::ToolBox::muPFJetORT
OverlapHandle_t muPFJetORT
Definition: ToolBox.h:68
asg::AnaToolHandle< IOverlapRemovalTool >
ORUtils::ToolBox::eleMuORT
OverlapHandle_t eleMuORT
Definition: ToolBox.h:70
ORUtils::ToolBox::ToolBox
ToolBox(const std::string &name="ORToolBox", parentType_t *theParent=nullptr)
Basic constructor with name and parent.
Definition: ToolBox.cxx:14
asg
Definition: DataHandleTestTool.h:28
athena.value
value
Definition: athena.py:124
ORUtils::ToolBox::eleFatJetORT
OverlapHandle_t eleFatJetORT
Definition: ToolBox.h:79
asg::AnaToolHandle::setProperty
StatusCode setProperty(const std::string &property, const T2 &value)
set the given property of the tool.
ORUtils
Definition: AltMuJetOverlapTool.h:20
ORUtils::ToolBox::parentType_t
INamedInterface parentType_t
Aliases.
Definition: ToolBox.h:44
ORUtils::ToolBox::setGlobalProperty
StatusCode setGlobalProperty(const std::string &property, const T &value)
Apply a global property to all tools.
Definition: ToolBox.h:104
ORUtils::ToolBox::muJetORT
OverlapHandle_t muJetORT
Definition: ToolBox.h:72
AsgMessaging.h
ORUtils::ToolBox::parent
parentType_t * parent()
Pointer to the parent component for the tool handles.
Definition: ToolBox.h:84
ORUtils::ToolBox::eleJetORT
OverlapHandle_t eleJetORT
Definition: ToolBox.h:71
ORUtils::ToolBox::getOverlapTools
std::vector< OverlapHandle_t * > getOverlapTools()
Get a list of all handles to loop over.
Definition: ToolBox.cxx:71
ORUtils::ToolBox::tauEleORT
OverlapHandle_t tauEleORT
Definition: ToolBox.h:73
ORUtils::ToolBox::jetFatJetORT
OverlapHandle_t jetFatJetORT
Definition: ToolBox.h:80
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ORUtils::ToolBox::tauMuORT
OverlapHandle_t tauMuORT
Definition: ToolBox.h:74
ORUtils::ToolBox::initialize
StatusCode initialize()
Attach and initialize all tools.
Definition: ToolBox.cxx:35
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ORUtils::ToolBox::tauJetORT
OverlapHandle_t tauJetORT
Definition: ToolBox.h:75
ORUtils::ToolBox::initTool
StatusCode initTool(OverlapHandle_t &handle, const std::string &key)
Initialize and attach one overlap tool.
Definition: ToolBox.cxx:94
AnaToolHandle.h
ORUtils::ToolBox::phoMuORT
OverlapHandle_t phoMuORT
Definition: ToolBox.h:77
ORUtils::ToolBox::phoEleORT
OverlapHandle_t phoEleORT
Definition: ToolBox.h:76
IOverlapRemovalTool.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
asg::AsgMessaging
Class mimicking the AthMessaging class from the offline software.
Definition: AsgMessaging.h:40
ORUtils::ToolBox::eleEleORT
OverlapHandle_t eleEleORT
Definition: ToolBox.h:69
ORUtils::ToolBox::masterTool
MasterHandle_t masterTool
Master overlap removal tool handle.
Definition: ToolBox.h:64
ORUtils::ToolBox::phoJetORT
OverlapHandle_t phoJetORT
Definition: ToolBox.h:78
ORUtils::ToolBox
A container and helper class for overlap removal tools.
Definition: ToolBox.h:39
ORUtils::ToolBox::OverlapHandle_t
asg::AnaToolHandle< IOverlapTool > OverlapHandle_t
Definition: ToolBox.h:46
asg::AnaToolHandle::empty
bool empty() const
whether this ToolHandle is completely empty, i.e.
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
IOverlapTool.h
ORUtils::ToolBox::initMaster
StatusCode initMaster()
Initialize master tool.
Definition: ToolBox.cxx:120