ATLAS Offline Software
MatchFromCompositeTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TriggerMatchingTool_MatchFromCompositeTool_H
6 #define TriggerMatchingTool_MatchFromCompositeTool_H
7 
8 // Framework includes
9 #include "AsgTools/AsgTool.h"
11 #include "AthLinks/ElementLink.h"
14 #include "CxxUtils/sgkey_t.h"
15 
16 // Package includes
18 
19 
20 namespace Trig {
26  class MatchFromCompositeTool final : public virtual IMatchingTool,
27  public asg::AsgTool
28  {
30  public:
32  MatchFromCompositeTool(const std::string& name);
33 
35  ~MatchFromCompositeTool() override;
36 
38  StatusCode initialize() override;
39 
50  bool match(
51  const xAOD::IParticle& recoObject,
52  const std::string& chain,
53  double=0.1, bool=false) const override;
54 
65  bool match(
66  const std::vector<const xAOD::IParticle*>& recoObject,
67  const std::string& chain,
68  double=0.1, bool=false) const override;
69 
70  protected:
72  template <typename T>
74  template <typename T>
76  template <typename T>
77  using vecLink_t = std::vector<ElementLink<T>>;
78 
79  // Properties
81  bool m_matchShallow = true;
82 
85  float m_drThreshold = -1;
86 
88  std::string m_inputPrefix;
89 
90 #ifdef XAOD_STANDALONE
91  bool m_remapBrokenLinks = false;
93 
95  std::vector<std::string> m_remapContainers{
96  "Electrons", "Photons", "Muons", "TauJets"};
98  std::vector<CLID> m_remapCLIDs{
99  1087532415, 1105575213, 1178459224, 1177172564};
100 #endif
101 
102  // Internal functions
104  virtual MatchingImplementation* impl() const override { return nullptr; }
105 
112  bool testCombination(
113  const vecLink_t<xAOD::IParticleContainer>& onlineLinks,
114  const std::vector<const xAOD::IParticle*>& offline) const;
115 
117  bool areTheSame(
118  const xAOD::IParticle& lhs,
119  const xAOD::IParticle& rhs) const;
120 
121  std::map<SG::sgkey_t, SG::sgkey_t> m_keyRemap;
122  }; //> end class MatchFromCompositeTool
123 } //> end namespace Trig
124 
125 #endif //> TriggerMatchingTool_MatchFromCompositeTool_H
Trig::MatchFromCompositeTool::m_inputPrefix
std::string m_inputPrefix
The prefix to expect at the front of the trig composite container name.
Definition: MatchFromCompositeTool.h:88
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
Trig::MatchFromCompositeTool::m_keyRemap
std::map< SG::sgkey_t, SG::sgkey_t > m_keyRemap
Definition: MatchFromCompositeTool.h:121
runLayerRecalibration.chain
chain
Definition: runLayerRecalibration.py:175
Trig::MatchFromCompositeTool::MatchFromCompositeTool
MatchFromCompositeTool(const std::string &name)
Standard constructor.
Definition: MatchFromCompositeTool.cxx:21
Trig
The common trigger namespace for trigger analysis tools.
Definition: LArCellMonAlg.h:33
Trig::MatchFromCompositeTool::~MatchFromCompositeTool
~MatchFromCompositeTool() override
Default destructor.
Definition: MatchFromCompositeTool.cxx:42
Trig::MatchFromCompositeTool::areTheSame
bool areTheSame(const xAOD::IParticle &lhs, const xAOD::IParticle &rhs) const
Check if two particles are the same.
Definition: MatchFromCompositeTool.cxx:151
Trig::MatchFromCompositeTool
Tool to perform matching to selected offline particles using the list of candidates created by the De...
Definition: MatchFromCompositeTool.h:28
offline
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
Trig::MatchFromCompositeTool::vecLink_t
std::vector< ElementLink< T > > vecLink_t
Definition: MatchFromCompositeTool.h:77
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:41
Trig::MatchFromCompositeTool::m_drThreshold
float m_drThreshold
If greater than 0 then will skip the above check and just check that DR between the two particles is ...
Definition: MatchFromCompositeTool.h:85
Trig::MatchFromCompositeTool::testCombination
bool testCombination(const vecLink_t< xAOD::IParticleContainer > &onlineLinks, const std::vector< const xAOD::IParticle * > &offline) const
Test a combination of offline objects against a combination of online objects.
Definition: MatchFromCompositeTool.cxx:105
Trig::MatchingImplementation
Definition: MatchingImplementation.h:33
Trig::MatchFromCompositeTool::m_matchShallow
bool m_matchShallow
Allow matching shallow copy to shallow copy.
Definition: MatchFromCompositeTool.h:81
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition: Decorator.h:59
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
IParticleContainer.h
TrigCompositeContainer.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
Trig::MatchFromCompositeTool::match
bool match(const xAOD::IParticle &recoObject, const std::string &chain, double=0.1, bool=false) const override
Match a single object.
Definition: MatchFromCompositeTool.cxx:70
IMatchingTool.h
sgkey_t.h
Define the type used for hashed StoreGate key+CLID pairs.
Trig::MatchFromCompositeTool::impl
virtual MatchingImplementation * impl() const override
Inherited from the interface but does nothing.
Definition: MatchFromCompositeTool.h:104
ASG_TOOL_CLASS
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Definition: AsgToolMacros.h:68
AsgTool.h
AuxElement.h
Base class for elements of a container that can have aux data.
Trig::MatchFromCompositeTool::initialize
StatusCode initialize() override
Initialise the tool.
Definition: MatchFromCompositeTool.cxx:44
Trig::IMatchingTool
Definition: IMatchingTool.h:24