ATLAS Offline Software
R3MatchingTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRIGGERMATCHINGTOOL_R3MATCHINGTOOL_H
6 #define TRIGGERMATCHINGTOOL_R3MATCHINGTOOL_H
7 
8 #include "AsgTools/AsgTool.h"
9 #include "AsgTools/ToolHandle.h"
14 
15 #include <mutex>
16 
17 namespace Trig
18 {
19  class R3MatchingTool : public asg::AsgTool, virtual public IMatchingTool
20  {
22  public:
23  using multInfo_t = std::vector<std::size_t>;
24  using typeInfo_t = std::vector<xAODType::ObjectType>;
25  using chainInfo_t = std::pair<multInfo_t, typeInfo_t>;
26 
27  R3MatchingTool(const std::string &name);
29 
30  virtual StatusCode initialize() override;
31 
32  virtual bool match(
33  const std::vector<const xAOD::IParticle *> &recoObjects,
34  const std::string &chain,
35  double matchThreshold,
36  bool rerun) const override;
37 
38  virtual bool match(
39  const xAOD::IParticle &recoObject,
40  const std::string &chain,
41  double matchThreshold,
42  bool rerun) const override;
43 
44  private:
45  ToolHandle<TrigDecisionTool> m_trigDecTool;
46  ToolHandle<Trig::IMatchScoringTool> m_scoreTool{
47  this, "ScoringTool", "Trig::DRScoringTool","Tool to score pairs of particles"};
48  bool matchObjects(
49  const xAOD::IParticle *reco,
50  const ElementLink<xAOD::IParticleContainer> &onlineLink,
51  xAODType::ObjectType onlineType,
52  std::map<std::pair<uint32_t, uint32_t>, bool> &cache,
53  double drThreshold) const;
54 
55 
56 
57  // Keep a cache of the interpreted chain information
58  mutable std::map<std::string, chainInfo_t> m_chainInfoCache ATLAS_THREAD_SAFE;
59  mutable std::mutex m_chainInfoMutex ATLAS_THREAD_SAFE;
60  const chainInfo_t &getChainInfo(const std::string &chain) const;
61 
62 
63  // Internal functions
65  virtual MatchingImplementation *impl() const override { return nullptr; }
66 
67  }; //> end class R3MatchingTool
68 } // namespace Trig
69 
70 #endif //> !TRIGGERMATCHINGTOOL_R3MATCHINGTOOL_H
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
runLayerRecalibration.chain
chain
Definition: runLayerRecalibration.py:175
Trig
The common trigger namespace for trigger analysis tools.
Definition: CaloTowerVecMon.h:44
Trig::R3MatchingTool::ATLAS_THREAD_SAFE
std::map< std::string, chainInfo_t > m_chainInfoCache ATLAS_THREAD_SAFE
Definition: R3MatchingTool.h:58
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
Trig::R3MatchingTool::m_trigDecTool
ToolHandle< TrigDecisionTool > m_trigDecTool
Definition: R3MatchingTool.h:45
TrigDecisionTool.h
Trig::R3MatchingTool::multInfo_t
std::vector< std::size_t > multInfo_t
Definition: R3MatchingTool.h:23
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:40
Trig::R3MatchingTool::ATLAS_THREAD_SAFE
std::mutex m_chainInfoMutex ATLAS_THREAD_SAFE
Definition: R3MatchingTool.h:59
Trig::MatchingImplementation
Definition: MatchingImplementation.h:33
Trig::R3MatchingTool::impl
virtual MatchingImplementation * impl() const override
Inherited from the interface but does nothing.
Definition: R3MatchingTool.h:65
Trig::R3MatchingTool::match
virtual bool match(const std::vector< const xAOD::IParticle * > &recoObjects, const std::string &chain, double matchThreshold, bool rerun) const override
multi-object trigger matching
Definition: R3MatchingTool.cxx:31
Trig::R3MatchingTool::getChainInfo
const chainInfo_t & getChainInfo(const std::string &chain) const
Definition: R3MatchingTool.cxx:178
IMatchScoringTool.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Trig::R3MatchingTool::matchObjects
bool matchObjects(const xAOD::IParticle *reco, const ElementLink< xAOD::IParticleContainer > &onlineLink, xAODType::ObjectType onlineType, std::map< std::pair< uint32_t, uint32_t >, bool > &cache, double drThreshold) const
Definition: R3MatchingTool.cxx:137
Trig::R3MatchingTool::R3MatchingTool
R3MatchingTool(const std::string &name)
Definition: R3MatchingTool.cxx:16
Trig::R3MatchingTool::m_scoreTool
ToolHandle< Trig::IMatchScoringTool > m_scoreTool
Definition: R3MatchingTool.h:46
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
Trig::R3MatchingTool::~R3MatchingTool
~R3MatchingTool()
Definition: R3MatchingTool.cxx:22
IMatchingTool.h
ASG_TOOL_CLASS
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Definition: AsgToolMacros.h:68
Trig::R3MatchingTool
Definition: R3MatchingTool.h:20
ToolHandle.h
Trig::R3MatchingTool::typeInfo_t
std::vector< xAODType::ObjectType > typeInfo_t
Definition: R3MatchingTool.h:24
AsgTool.h
xAODType::ObjectType
ObjectType
Type of objects that have a representation in the xAOD EDM.
Definition: ObjectType.h:32
checker_macros.h
Define macros for attributes used to control the static checker.
Trig::R3MatchingTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: R3MatchingTool.cxx:24
MuonSegmentReaderConfig.reco
reco
Definition: MuonSegmentReaderConfig.py:133
Trig::R3MatchingTool::chainInfo_t
std::pair< multInfo_t, typeInfo_t > chainInfo_t
Definition: R3MatchingTool.h:25
Trig::IMatchingTool
Definition: IMatchingTool.h:24