ATLAS Offline Software
CaloClusterMatchLinkAlg.cxx
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 // CaloClusterMatchLinkAlg.cxx
8 // Implementation file for class CaloClusterMatchLinkAlg
9 // Author: S.Binet<binet@cern.ch>
11 
12 // CaloClusterMatching includes
14 
15 // STL includes
16 
17 // FrameWork includes
18 #include "Gaudi/Property.h"
20 
21 
22 namespace ClusterMatching {
23 
24  // Destructor
27  = default;
28 
29  // Athena Algorithm's Hooks
32  {
33  ATH_MSG_INFO ("Initializing " << name() << "...");
34 
36 
37  m_elementLinkName = m_clusterKey.key() + ".constituentClusterLinks";
38  ATH_CHECK( m_elementLinkName.initialize() );
39 
40  ATH_CHECK( m_clusterMatch.retrieve() );
41 
42  if(m_clusterSortMethod<0 || m_clusterSortMethod>ClusterMatching::MatchedEFrac) {
43  ATH_MSG_ERROR("Invalid configuration of cluster sortin method");
44  return StatusCode::FAILURE;
45  }
46 
47  return StatusCode::SUCCESS;
48  }
49 
51  {
52  ATH_MSG_INFO ("Finalizing " << name() << "...");
53 
54  return StatusCode::SUCCESS;
55  }
56 
57  StatusCode CaloClusterMatchLinkAlg::execute(const EventContext& ctx) const
58  {
59  ATH_MSG_DEBUG ("Executing " << name() << "...");
60 
62 
63  TopoClusterMap tcmap;
64  ATH_CHECK( m_clusterMatch->fillClusterMap(ctx,tcmap) );
65 
66  bool (*gtrthan)(const tcmatch_pair& a, const tcmatch_pair& b)=nullptr;
67  switch(m_clusterSortMethod) {
68  case ClusterE: gtrthan = ClusterMatching::gtrClusterE;
69  break;
70  case MatchedE: gtrthan = ClusterMatching::gtrMatchedE;
71  break;
72  case MatchedEFrac: gtrthan = ClusterMatching::gtrMatchedEFrac;
73  break;
74  default:
75  ATH_MSG_WARNING("Invalid cluster sorting method configured!");
76  return StatusCode::SUCCESS;
77  }
78 
80  for(const auto *const cl : *clustersToDecorate) {
81  ATH_CHECK( m_clusterMatch->linkMatchedClusters(elementLinkDec, *cl, tcmap, m_useLeadCellEtaPhi, gtrthan) );
82  }
83 
84  return StatusCode::SUCCESS;
85  }
86 
87 }
ClusterMatching::ClusterE
@ ClusterE
Definition: ICaloClusterMatchingTool.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
ClusterMatching::MatchedE
@ MatchedE
Definition: ICaloClusterMatchingTool.h:35
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
ClusterMatching::CaloClusterMatchLinkAlg::m_clusterMatch
ToolHandle< ICaloClusterMatchingTool > m_clusterMatch
Definition: CaloClusterMatchLinkAlg.h:50
ClusterMatching::CaloClusterMatchLinkAlg::m_clusterSortMethod
Gaudi::Property< int > m_clusterSortMethod
Definition: CaloClusterMatchLinkAlg.h:49
ClusterMatching::CaloClusterMatchLinkAlg::initialize
virtual StatusCode initialize()
Definition: CaloClusterMatchLinkAlg.cxx:31
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ClusterMatching::tcmatch_pair
std::pair< const xAOD::CaloCluster *, float > tcmatch_pair
Definition: ICaloClusterMatchingTool.h:27
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:99
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
ClusterMatching
Definition: ICaloClusterMatchingTool.h:26
TopoClusterMap.h
ClusterMatching::CaloClusterMatchLinkAlg::~CaloClusterMatchLinkAlg
virtual ~CaloClusterMatchLinkAlg()
Destructor:
ClusterMatching::CaloClusterMatchLinkAlg::finalize
virtual StatusCode finalize()
Definition: CaloClusterMatchLinkAlg.cxx:50
TopoClusterMap
Definition: TopoClusterMap.h:11
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
ClusterMatching::CaloClusterMatchLinkAlg::execute
virtual StatusCode execute(const EventContext &ctx) const
Definition: CaloClusterMatchLinkAlg.cxx:57
a
TList * a
Definition: liststreamerinfos.cxx:10
ClusterMatching::CaloClusterMatchLinkAlg::m_elementLinkName
SG::WriteDecorHandleKey< xAOD::CaloClusterContainer > m_elementLinkName
Definition: CaloClusterMatchLinkAlg.h:53
ClusterMatching::CaloClusterMatchLinkAlg::m_clusterKey
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_clusterKey
Definition: CaloClusterMatchLinkAlg.h:47
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
ClusterMatching::CaloClusterMatchLinkAlg::m_useLeadCellEtaPhi
Gaudi::Property< bool > m_useLeadCellEtaPhi
Definition: CaloClusterMatchLinkAlg.h:48
CaloClusterMatchLinkAlg.h
xAOD::bool
setBGCode setTAP setLVL2ErrorBits bool
Definition: TrigDecision_v1.cxx:60
dq_make_web_display.cl
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
Definition: dq_make_web_display.py:26
ClusterMatching::MatchedEFrac
@ MatchedEFrac
Definition: ICaloClusterMatchingTool.h:36