ATLAS Offline Software
ObjLinkOverlapTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // Local includes
7 
8 namespace
9 {
11  const float invGeV = 0.001;
12 }
13 
14 namespace ORUtils
15 {
16 
17  //---------------------------------------------------------------------------
18  // Constructor
19  //---------------------------------------------------------------------------
22  {
23  }
24 
25  //---------------------------------------------------------------------------
26  // Initialize
27  //---------------------------------------------------------------------------
29  {
30  return StatusCode::SUCCESS;
31  }
32 
33  //---------------------------------------------------------------------------
34  // Identify overlaps
35  //---------------------------------------------------------------------------
38  const xAOD::IParticleContainer& cont2) const
39  {
40  ATH_MSG_DEBUG("Removing overlaps");
41 
42  // Initialize output decoration if necessary
43  m_decHelper->initializeDecorations(cont1);
44  m_decHelper->initializeDecorations(cont2);
45 
46  // Loop over surviving input objects in cont1
47  for(const auto p1 : cont1){
48  if(m_decHelper->isSurvivingObject(*p1)){
49 
50  // Check for existence of an object link
51  auto linkParticle = m_objLinkHelper->getObjectLink(*p1);
52  if(linkParticle){
53 
54  // See if the link matches an input in cont2
55  if(linkParticle->container() == &cont2 &&
56  m_decHelper->isSurvivingObject(*linkParticle)){
57 
58  ATH_MSG_DEBUG(" Found overlap " << p1->type() <<
59  " pt " << p1->pt()*invGeV);
60  m_decHelper->setObjectFail(*p1);
61  }
62  }
63  }
64  }
65  return StatusCode::SUCCESS;
66  }
67 
68 } // namespace ORUtils
ORUtils::ObjLinkOverlapTool::initializeDerived
virtual StatusCode initializeDerived() override
Initialize the tool.
Definition: ObjLinkOverlapTool.cxx:28
ORUtils::ObjLinkOverlapTool::ObjLinkOverlapTool
ObjLinkOverlapTool(const std::string &name)
Create proper constructor for Athena.
Definition: ObjLinkOverlapTool.cxx:20
ORUtils
Definition: AltMuJetOverlapTool.h:20
ORUtils::ObjLinkOverlapTool::findOverlaps
virtual StatusCode findOverlaps(const xAOD::IParticleContainer &cont1, const xAOD::IParticleContainer &cont2) const override
Identify overlaps by ElementLink.
Definition: ObjLinkOverlapTool.cxx:37
ORUtils::BaseOverlapTool::m_objLinkHelper
std::unique_ptr< OverlapLinkHelper > m_objLinkHelper
Helper for linking overlap objects.
Definition: BaseOverlapTool.h:98
ObjLinkOverlapTool.h
ORUtils::BaseOverlapTool
Common base class tool for overlap tools.
Definition: BaseOverlapTool.h:38
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
ORUtils::BaseOverlapTool::m_decHelper
std::unique_ptr< OverlapDecorationHelper > m_decHelper
Helper for handling input/output decorations.
Definition: BaseOverlapTool.h:95
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
invGeV
constexpr float invGeV
Definition: PFTrackSelector.cxx:10