ATLAS Offline Software
CaloClusterMatchingTool.h
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // CaloClusterMatchingTool.h
8 // Header file for class CaloClusterMatchingTool
9 // Author: T.J. Khoo<khoo@cern.ch>
11 #ifndef CALOCLUSTERMATCHING_CALOCLUSTERMATCHINGTOOL_H
12 #define CALOCLUSTERMATCHING_CALOCLUSTERMATCHINGTOOL_H 1
13 
14 // STL includes
15 #include <string>
16 
17 // FrameWork includes
18 #include "AsgTools/AsgTool.h"
20 
21 // CaloClusterMatching includes
24 
25 // xAOD includes
27 
28 // Forward declaration
29 
30 namespace ClusterMatching {
31 
33  : virtual public asg::AsgTool,
34  virtual public ::ICaloClusterMatchingTool
35  {
37 
38 
39  // Public methods:
41  public:
42 
45 
48 
49  // Athena algtool's Hooks
50  virtual StatusCode initialize() override;
51  virtual StatusCode finalize() override;
52 
54  // Const methods:
56 
57  StatusCode fillClusterMap(const EventContext& ctx, TopoClusterMap& tcmap) const override final;
58 
59  // return shared fraction of clustered cell energy
60  float getClusterSharedEfrac(const xAOD::CaloCluster& refCluster,
61  const xAOD::CaloCluster& testCluster) const override final;
62 
63  // return true if clusters share a given fraction of their cell energy
64  bool clustersAreMatched(const xAOD::CaloCluster& refCluster,
65  const xAOD::CaloCluster& testCluster) const override final;
66 
67  // fill a list of clusters from the testClusters container that match the reference cluster
68  // match criteria determined by calling clustersAreMatched
69  // return true if matchedClusters list is non-empty.
70  bool getMatchedClusters(const xAOD::CaloCluster& refCluster,
71  const std::vector<const xAOD::CaloCluster*>& testClusters,
72  std::vector<const xAOD::CaloCluster*>& matchedClusters) const override final;
73 
74  // fill a list of clusters from the configured cluster container that match the reference cluster
75  // match criteria determined by calling clustersAreMatched
76  // return true if matchedClusters list is non-empty
77  bool getMatchedClusters(const xAOD::CaloCluster& refCluster,
78  std::vector<const xAOD::CaloCluster*>& matchedClusters,
79  const TopoClusterMap& tcmap,
80  bool useLeadingCellEtaPhi) const override final;
81 
82  // fill a list of clusters from the testClusters container that match the reference cluster
83  // match criteria determined by calling clustersAreMatched
84  // return true if matchedClusters list is non-empty.
85  bool getMatchedClusters(const xAOD::CaloCluster& refCluster,
86  const std::vector<const xAOD::CaloCluster*>& testClusters,
87  std::vector<std::pair<const xAOD::CaloCluster*,float> >& matchedClusters) const override final;
88 
89  // fill a list of clusters from the configured cluster container that match the reference cluster
90  // match criteria determined by calling clustersAreMatched
91  // return true if matchedClusters list is non-empty
92  bool getMatchedClusters(const xAOD::CaloCluster& refCluster,
93  std::vector<std::pair<const xAOD::CaloCluster*, float> >& matchedClusters,
94  const TopoClusterMap& tcmap,
95  bool useLeadingCellEtaPhi) const override final;
96 
97  // set ElementLinks to clusters from the configured cluster container that match the reference cluster
98  // works via getMatchedClusters
99  // return true if matchedClusters list is non-empty
101  const xAOD::CaloCluster& refCluster,
102  const std::vector<const xAOD::CaloCluster*>& testClusters,
103  bool (*gtrthan)(const std::pair<const xAOD::CaloCluster*,float>& pair1,
104  const std::pair<const xAOD::CaloCluster*,float>& pair2)) const override final;
105 
106  // set ElementLinks to clusters from the configured cluster container that match the reference cluster
107  // works via getMatchedClusters
108  // return true if matchedClusters list is non-empty
110  const xAOD::CaloCluster& refCluster,
111  const TopoClusterMap& tcmap,
112  bool useLeadingCellEtaPhi,
113  bool (*gtrthan)(const std::pair<const xAOD::CaloCluster*,float>& pair1,
114  const std::pair<const xAOD::CaloCluster*,float>& pair2)) const override final;
115 
117  // Private data:
119  private:
120  Gaudi::Property<bool> m_reqPosE{ this, "RequirePositiveE", true };
121  Gaudi::Property<float> m_minSharedEfrac{ this, "MinSharedEfrac", 0.2 };
123  this,
124  "InputClusterCollection",
125  "CaloCalTopoClusters",
126  "The CaloCluster collection to match to "
127  };
128  };
129 }
130 
131 #endif //> !CALOCLUSTERMATCHING_CALOCLUSTERMATCHINGTOOL_H
ClusterMatching::CaloClusterMatchingTool::linkMatchedClusters
StatusCode linkMatchedClusters(elementLinkDecorHandle_t &elementLinkDec, const xAOD::CaloCluster &refCluster, const std::vector< const xAOD::CaloCluster * > &testClusters, bool(*gtrthan)(const std::pair< const xAOD::CaloCluster *, float > &pair1, const std::pair< const xAOD::CaloCluster *, float > &pair2)) const override final
Definition: CaloClusterMatchingTool.cxx:201
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
ClusterMatching::CaloClusterMatchingTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: CaloClusterMatchingTool.cxx:32
MuonSimDataDict::pair2
std::pair< HepMcParticleLink, CscMcData > pair2
Definition: MuonSimDataDict.h:15
SG::ReadHandleKey< xAOD::CaloClusterContainer >
asg::AsgTool::AsgTool
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition: AsgTool.cxx:58
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
ClusterMatching::CaloClusterMatchingTool::getMatchedClusters
bool getMatchedClusters(const xAOD::CaloCluster &refCluster, const std::vector< const xAOD::CaloCluster * > &testClusters, std::vector< const xAOD::CaloCluster * > &matchedClusters) const override final
Definition: CaloClusterMatchingTool.cxx:102
ClusterMatching::CaloClusterMatchingTool::m_clustersIn
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_clustersIn
Definition: CaloClusterMatchingTool.h:122
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:99
WriteDecorHandle.h
Handle class for adding a decoration to an object.
ClusterMatching::CaloClusterMatchingTool::m_reqPosE
Gaudi::Property< bool > m_reqPosE
Definition: CaloClusterMatchingTool.h:120
ClusterMatching
Definition: ICaloClusterMatchingTool.h:26
ICaloClusterMatchingTool
Definition: ICaloClusterMatchingTool.h:42
TopoClusterMap.h
ClusterMatching::CaloClusterMatchingTool::getClusterSharedEfrac
float getClusterSharedEfrac(const xAOD::CaloCluster &refCluster, const xAOD::CaloCluster &testCluster) const override final
Definition: CaloClusterMatchingTool.cxx:68
MuonSimDataDict::pair1
std::pair< HepMcParticleLink,MuonMCData > pair1
Definition: MuonSimDataDict.h:14
TopoClusterMap
Definition: TopoClusterMap.h:11
ClusterMatching::CaloClusterMatchingTool::finalize
virtual StatusCode finalize() override
Definition: CaloClusterMatchingTool.cxx:47
ClusterMatching::CaloClusterMatchingTool::m_minSharedEfrac
Gaudi::Property< float > m_minSharedEfrac
Definition: CaloClusterMatchingTool.h:121
ClusterMatching::CaloClusterMatchingTool
Definition: CaloClusterMatchingTool.h:35
ASG_TOOL_CLASS
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Definition: AsgToolMacros.h:68
CaloClusterContainer.h
ClusterMatching::CaloClusterMatchingTool::clustersAreMatched
bool clustersAreMatched(const xAOD::CaloCluster &refCluster, const xAOD::CaloCluster &testCluster) const override final
Definition: CaloClusterMatchingTool.cxx:93
ICaloClusterMatchingTool.h
ClusterMatching::CaloClusterMatchingTool::fillClusterMap
StatusCode fillClusterMap(const EventContext &ctx, TopoClusterMap &tcmap) const override final
Definition: CaloClusterMatchingTool.cxx:58
AsgTool.h
ClusterMatching::CaloClusterMatchingTool::~CaloClusterMatchingTool
virtual ~CaloClusterMatchingTool()
Destructor: