ATLAS Offline Software
BaseOverlapTool.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 = 1e-3;
12 }
13 
14 namespace ORUtils
15 {
16 
17  //---------------------------------------------------------------------------
18  // Constructor
19  //---------------------------------------------------------------------------
21  : asg::AsgTool(name)
22  {
23  declareProperty("InputLabel", m_inputLabel = "selected",
24  "Decoration which specifies input objects");
25  declareProperty("OutputLabel", m_outputLabel = "overlaps",
26  "Decoration given to objects that fail OR");
27  declareProperty("OutputPassValue", m_outputPassValue = false,
28  "Set the result assigned to objects that pass");
29  declareProperty("LinkOverlapObjects", m_linkOverlapObjects = false,
30  "Turn on overlap object link decorations");
31  declareProperty("EnableUserPriority", m_enableUserPrio = false,
32  "Turn on user priority score");
33  }
34 
35  //---------------------------------------------------------------------------
36  // Initialize
37  //---------------------------------------------------------------------------
39  {
40  ATH_MSG_DEBUG("Initializing " << name());
41  ATH_MSG_DEBUG("Base config options: InputLabel " << m_inputLabel <<
42  " OutputLabel " << m_outputLabel <<
43  " OutputPassValue " << m_outputPassValue <<
44  " UserPrio " << m_enableUserPrio);
45 
46  // Initialize the decoration helper
47  m_decHelper = std::make_unique<OverlapDecorationHelper>
49 
50  // Initialize the obj-link helper
52  m_objLinkHelper = std::make_unique<OverlapLinkHelper>("overlapObject");
53 
54  // Initialize the derived tool
56 
57  return StatusCode::SUCCESS;
58  }
59 
60  //---------------------------------------------------------------------------
61  // Handle overlap condition
62  //---------------------------------------------------------------------------
64  handleOverlap(const xAOD::IParticle* testParticle,
65  const xAOD::IParticle* refParticle) const
66  {
67  // Apply user-priority override
68  if(!m_enableUserPrio ||
69  m_decHelper->getObjectPriority(*testParticle) <=
70  m_decHelper->getObjectPriority(*refParticle))
71  {
72  ATH_MSG_DEBUG(" Found overlap " << testParticle->type() <<
73  " pt " << testParticle->pt()*invGeV);
74  m_decHelper->setObjectFail(*testParticle);
75  if(m_objLinkHelper) {
76  ATH_CHECK( m_objLinkHelper->addObjectLink(*testParticle, *refParticle) );
77  }
78  }
79  return StatusCode::SUCCESS;
80  }
81 
82 } // namespace ORUtils
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
asg
Definition: DataHandleTestTool.h:28
xAOD::IParticle::type
virtual Type::ObjectType type() const =0
The type of the object as a simple enumeration.
ORUtils::BaseOverlapTool::m_inputLabel
std::string m_inputLabel
Input object decoration which specifies which objects to look at.
Definition: BaseOverlapTool.h:74
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:40
ORUtils::BaseOverlapTool::m_enableUserPrio
bool m_enableUserPrio
Enable user-priority scoring.
Definition: BaseOverlapTool.h:86
ORUtils
Definition: AltMuJetOverlapTool.h:20
ORUtils::BaseOverlapTool::initialize
StatusCode initialize() override final
Initialize base class functionality.
Definition: BaseOverlapTool.cxx:38
ORUtils::BaseOverlapTool::m_objLinkHelper
std::unique_ptr< OverlapLinkHelper > m_objLinkHelper
Helper for linking overlap objects.
Definition: BaseOverlapTool.h:98
ORUtils::BaseOverlapTool::initializeDerived
virtual StatusCode initializeDerived()
Initialization for derived tools.
Definition: BaseOverlapTool.h:57
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_outputPassValue
bool m_outputPassValue
Toggle the output flag logic.
Definition: BaseOverlapTool.h:80
ORUtils::BaseOverlapTool::m_decHelper
std::unique_ptr< OverlapDecorationHelper > m_decHelper
Helper for handling input/output decorations.
Definition: BaseOverlapTool.h:95
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ORUtils::BaseOverlapTool::m_linkOverlapObjects
bool m_linkOverlapObjects
Flag to toggle overlap object links.
Definition: BaseOverlapTool.h:83
xAOD::IParticle::pt
virtual double pt() const =0
The transverse momentum ( ) of the particle.
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
ORUtils::BaseOverlapTool::BaseOverlapTool
BaseOverlapTool(const std::string &name)
Create proper constructor for Athena.
Definition: BaseOverlapTool.cxx:20
ORUtils::BaseOverlapTool::handleOverlap
virtual StatusCode handleOverlap(const xAOD::IParticle *testParticle, const xAOD::IParticle *refParticle) const
Common helper method to handle an overlap result.
Definition: BaseOverlapTool.cxx:64
ORUtils::BaseOverlapTool::m_outputLabel
std::string m_outputLabel
Output object decoration which specifies overlapping objects.
Definition: BaseOverlapTool.h:76
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
BaseOverlapTool.h
invGeV
constexpr float invGeV
Definition: PFTrackSelector.cxx:10