ATLAS Offline Software
ICaloClusterMatchingTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
7 // ICaloClusterMatchingTool.h
8 // Header file for class ICaloClusterMatchingTool
9 // Author: S.Binet<binet@cern.ch>
11 #ifndef CALOCLUSTERMATCHING_ICALOCLUSTERMATCHINGTOOL_H
12 #define CALOCLUSTERMATCHING_ICALOCLUSTERMATCHINGTOOL_H 1
13 
14 // STL includes
15 
16 // FrameWork includes
17 #include "AsgTools/IAsgTool.h"
19 
20 // Forward declaration
21 
22 // xAOD includes
25 
26 namespace ClusterMatching {
27  typedef std::pair<const xAOD::CaloCluster*,float> tcmatch_pair;
28 
29  inline static bool gtrClusterE(const tcmatch_pair& a, const tcmatch_pair& b) {return a.first->e()>b.first->e();}
30  inline static bool gtrMatchedE(const tcmatch_pair& a, const tcmatch_pair& b) {return a.second*a.first->e()>b.second*b.first->e();}
31  inline static bool gtrMatchedEFrac(const tcmatch_pair& a, const tcmatch_pair& b) {return a.second>b.second;}
32 
37  };
38 }
39 
41  : virtual public asg::IAsgTool
42 {
44 
45 
46 public:
48 
49 
50  // Prime the map before starting to match
51  virtual StatusCode fillClusterMap(const EventContext& ctx, TopoClusterMap& tcmap) const = 0;
52 
53  // return shared fraction of clustered cell energy (wrt testCluster)
54  virtual float getClusterSharedEfrac(const xAOD::CaloCluster& refCluster,
55  const xAOD::CaloCluster& testCluster) const = 0;
56 
57  // return true if clusters share a given fraction of their cell energy
58  virtual bool clustersAreMatched(const xAOD::CaloCluster& refCluster,
59  const xAOD::CaloCluster& testCluster) const = 0;
60 
61  // fill a list of clusters from the testClusters container that match the reference cluster
62  // match criteria determined by calling clustersAreMatched
63  // return true if matchedClusters list is non-empty
64  virtual bool getMatchedClusters(const xAOD::CaloCluster& refCluster,
65  const std::vector<const xAOD::CaloCluster*>& testClusters,
66  std::vector<const xAOD::CaloCluster*>& matchedClusters) const = 0;
67 
68  // fill a list of clusters from the configured cluster container that match the reference cluster
69  // match criteria determined by calling clustersAreMatched
70  // return true if matchedClusters list is non-empty
71  virtual bool getMatchedClusters(const xAOD::CaloCluster& refCluster,
72  std::vector<const xAOD::CaloCluster*>& matchedClusters,
73  const TopoClusterMap& tcmap,
74  bool useLeadingCellEtaPhi=false) const = 0;
75 
76  // fill a list of clusters from the testClusters container that match the reference cluster
77  // match criteria determined by calling clustersAreMatched
78  // return true if matchedClusters list is non-empty
79  virtual bool getMatchedClusters(const xAOD::CaloCluster& refCluster,
80  const std::vector<const xAOD::CaloCluster*>& testClusters,
81  std::vector<std::pair<const xAOD::CaloCluster*, float> >& matchedClustersAndE) const = 0;
82 
83  // fill a list of clusters from the configured cluster container that match the reference cluster
84  // match criteria determined by calling clustersAreMatched
85  // return true if matchedClusters list is non-empty
86  virtual bool getMatchedClusters(const xAOD::CaloCluster& refCluster,
87  std::vector<std::pair<const xAOD::CaloCluster*, float> >& matchedClustersAndE,
88  const TopoClusterMap& tcmap,
89  bool useLeadingCellEtaPhi=false) const = 0;
90 
91  // set ElementLinks to clusters from the configured cluster container that match the reference cluster
92  // works via getMatchedClusters
93  // return true if matchedClusters list is non-empty
95  const xAOD::CaloCluster& refCluster,
96  const std::vector<const xAOD::CaloCluster*>& testClusters,
97  bool (*gtrthan)(const std::pair<const xAOD::CaloCluster*,float>& pair1,
98  const std::pair<const xAOD::CaloCluster*,float>& pair2) = ClusterMatching::gtrMatchedE) const = 0;
99 
100  // set ElementLinks to clusters from the configured cluster container that match the reference cluster
101  // works via getMatchedClusters
102  // return true if matchedClusters list is non-empty
104  const xAOD::CaloCluster& refCluster,
105  const TopoClusterMap& tcmap,
106  bool useLeadingCellEtaPhi=false,
107  bool (*gtrthan)(const std::pair<const xAOD::CaloCluster*,float>& pair1,
108  const std::pair<const xAOD::CaloCluster*,float>& pair2) = ClusterMatching::gtrMatchedE) const = 0;
109 };
110 
111 #endif //> !CALOCLUSTERMATCHING_ICALOCLUSTERMATCHINGTOOL_H
ICaloClusterMatchingTool::clustersAreMatched
virtual bool clustersAreMatched(const xAOD::CaloCluster &refCluster, const xAOD::CaloCluster &testCluster) const =0
ClusterMatching::ClusterE
@ ClusterE
Definition: ICaloClusterMatchingTool.h:34
ICaloClusterMatchingTool::getMatchedClusters
virtual bool getMatchedClusters(const xAOD::CaloCluster &refCluster, std::vector< const xAOD::CaloCluster * > &matchedClusters, const TopoClusterMap &tcmap, bool useLeadingCellEtaPhi=false) const =0
ClusterMatching::MatchedE
@ MatchedE
Definition: ICaloClusterMatchingTool.h:35
asg::IAsgTool
Base class for the dual-use tool interface classes.
Definition: IAsgTool.h:41
ICaloClusterMatchingTool::linkMatchedClusters
virtual 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)=ClusterMatching::gtrMatchedE) const =0
ICaloClusterMatchingTool::getMatchedClusters
virtual bool getMatchedClusters(const xAOD::CaloCluster &refCluster, const std::vector< const xAOD::CaloCluster * > &testClusters, std::vector< std::pair< const xAOD::CaloCluster *, float > > &matchedClustersAndE) const =0
MuonSimDataDict::pair2
std::pair< HepMcParticleLink, CscMcData > pair2
Definition: MuonSimDataDict.h:15
ClusterMatching::ClusterSortMethod
ClusterSortMethod
Definition: ICaloClusterMatchingTool.h:33
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
ClusterMatching::tcmatch_pair
std::pair< const xAOD::CaloCluster *, float > tcmatch_pair
Definition: ICaloClusterMatchingTool.h:27
ICaloClusterMatchingTool::getMatchedClusters
virtual bool getMatchedClusters(const xAOD::CaloCluster &refCluster, std::vector< std::pair< const xAOD::CaloCluster *, float > > &matchedClustersAndE, const TopoClusterMap &tcmap, bool useLeadingCellEtaPhi=false) const =0
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:100
ICaloClusterMatchingTool::getMatchedClusters
virtual bool getMatchedClusters(const xAOD::CaloCluster &refCluster, const std::vector< const xAOD::CaloCluster * > &testClusters, std::vector< const xAOD::CaloCluster * > &matchedClusters) const =0
WriteDecorHandle.h
Handle class for adding a decoration to an object.
ASG_TOOL_INTERFACE
#define ASG_TOOL_INTERFACE(CLASSNAME)
Definition: AsgToolMacros.h:40
IAsgTool.h
ClusterMatching
Definition: ICaloClusterMatchingTool.h:26
ICaloClusterMatchingTool
Definition: ICaloClusterMatchingTool.h:42
ICaloClusterMatchingTool::fillClusterMap
virtual StatusCode fillClusterMap(const EventContext &ctx, TopoClusterMap &tcmap) const =0
TopoClusterMap.h
MuonSimDataDict::pair1
std::pair< HepMcParticleLink,MuonMCData > pair1
Definition: MuonSimDataDict.h:14
TopoClusterMap
Definition: TopoClusterMap.h:11
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
a
TList * a
Definition: liststreamerinfos.cxx:10
ICaloClusterMatchingTool::linkMatchedClusters
virtual StatusCode linkMatchedClusters(elementLinkDecorHandle_t &elementLinkDec, const xAOD::CaloCluster &refCluster, const TopoClusterMap &tcmap, bool useLeadingCellEtaPhi=false, bool(*gtrthan)(const std::pair< const xAOD::CaloCluster *, float > &pair1, const std::pair< const xAOD::CaloCluster *, float > &pair2)=ClusterMatching::gtrMatchedE) const =0
CaloClusterContainer.h
ICaloClusterMatchingTool::getClusterSharedEfrac
virtual float getClusterSharedEfrac(const xAOD::CaloCluster &refCluster, const xAOD::CaloCluster &testCluster) const =0
ClusterMatching::MatchedEFrac
@ MatchedEFrac
Definition: ICaloClusterMatchingTool.h:36