ATLAS Offline Software
Loading...
Searching...
No Matches
TauJetOverlapTool.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// System includes
6#include <typeinfo>
7
8// Framework includes
10
11// Local includes
14
15namespace ORUtils
16{
17
18 //---------------------------------------------------------------------------
19 // Constructor
20 //---------------------------------------------------------------------------
21 TauJetOverlapTool::TauJetOverlapTool(const std::string& name)
22 : BaseOverlapTool(name)
23 {
24 declareProperty("BJetLabel", m_bJetLabel = "",
25 "Input b-jet flag. Disabled by default.");
26 declareProperty("DR", m_dR = 0.2, "Maximum dR for overlap match");
27 declareProperty("UseRapidity", m_useRapidity = true,
28 "Calculate delta-R using rapidity");
29 }
30
31 //---------------------------------------------------------------------------
32 // Initialize
33 //---------------------------------------------------------------------------
35 {
36 // Initialize the b-jet helper
37 if(!m_bJetLabel.empty()) {
38 ATH_MSG_DEBUG("Configuring btag-aware OR with btag label: " << m_bJetLabel);
39 resetAccessor (m_accessors->m_bJetAcc, *m_accessors, m_bJetLabel);
40 }
41
42 // Initialize the dR matcher
43 m_dRMatcher = std::make_unique<DeltaRMatcher>(m_dR, m_useRapidity);
45 addSubtool(*m_dRMatcher);
46
47 return StatusCode::SUCCESS;
48 }
49
50 //---------------------------------------------------------------------------
51 // Identify overlaps
52 //---------------------------------------------------------------------------
56 columnar::EventContextId /*eventContext*/) const
57 {
58 // Check the container types
59 ATH_CHECK( checkForXAODContainer<xAOD::JetContainer>(cont1, "First container arg is not of type JetContainer!") );
60 ATH_CHECK( checkForXAODContainer<xAOD::TauJetContainer>(cont2, "Second container arg is not of type TauJetContainer!") );
61
62 ATH_CHECK( internalFindOverlaps(cont1, cont2) );
63 return StatusCode::SUCCESS;
64 }
65
66 //---------------------------------------------------------------------------
67 // Identify overlaps
68 //---------------------------------------------------------------------------
72 {
73 ATH_MSG_DEBUG("Removing overlapping taus and jets");
74 auto& acc = *m_accessors;
75
76 // Initialize output decorations if necessary
79
80 // TODO: add anti-tau support.
81
82 // Remove non-btagged jets that overlap with taus.
83 for(const auto tau : taus){
84 if(!isSurvivingObject(tau)) continue;
85 for(const auto jet : jets){
86 if(!isSurvivingObject(jet)) continue;
87
88 // Don't reject user-defined b-tagged jets
89 if(!m_bJetLabel.empty() && acc.m_bJetAcc(jet)) continue;
90
91 if(m_dRMatcher->objectsMatch(tau, jet)){
93 }
94 }
95 }
96
97 // Remove taus that overlap with remaining jets
98 for(const auto jet : jets){
99 if(!isSurvivingObject(jet)) continue;
100 for(const auto tau : taus){
101 if(!isSurvivingObject(tau)) continue;
102
103 if(m_dRMatcher->objectsMatch(jet, tau)) {
104 ATH_CHECK( handleOverlap(tau, jet) );
105 }
106 }
107 }
108
109 return StatusCode::SUCCESS;
110 }
111
112} // namespace ORUtils
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
DataVector adapter that acts like it holds const pointers.
static Double_t taus
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
void initializeDecorations(columnar::Particle1Range container) const
BaseOverlapTool(const std::string &name)
Create proper constructor for Athena.
StatusCode handleOverlap(const columnar::ObjectId< CI1, CM > &testParticle, const columnar::ObjectId< CI2, CM > &refParticle) const
Common helper method to handle an overlap result.
bool isSurvivingObject(columnar::Particle1Id obj) const
StatusCode checkForXAODContainer(columnar::ObjectRange< CI, CM > cont, std::string_view message) const
check whether the container is of the right type
virtual StatusCode findOverlaps(columnar::Particle1Range cont1, columnar::Particle2Range cont2, columnar::EventContextId eventContext) const override
Identify overlapping taus and jets.
float m_dR
Flat delta-R cone for matching objects.
bool m_useRapidity
Calculate deltaR using rapidity.
virtual StatusCode initializeDerived() override
Initialize the tool.
std::string m_bJetLabel
Input jet decoration which labels a bjet.
virtual StatusCode internalFindOverlaps(columnar::Particle1Range jets, columnar::Particle2Range taus) const
Identify overlapping taus and jets.
std::unique_ptr< Accessors > m_accessors
TauJetOverlapTool(const std::string &name)
Create proper constructor for Athena.
std::unique_ptr< IParticleAssociator > m_dRMatcher
Delta-R matcher.
ObjectId< ContainerId::eventContext > EventContextId
ObjectRange< ContainerId::particle2 > Particle2Range
Definition ParticleDef.h:53
ObjectRange< ContainerId::particle1 > Particle1Range
Definition ParticleDef.h:47
@ Jet
The object is a jet.
Definition ObjectType.h:40
@ Tau
The object is a tau (jet)
Definition ObjectType.h:49