ATLAS Offline Software
Loading...
Searching...
No Matches
TauLooseMuOverlapTool.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
13
14namespace
15{
17 const float GeV = 1e3;
18}
19
20namespace ORUtils
21{
22
23 //---------------------------------------------------------------------------
24 // Constructor
25 //---------------------------------------------------------------------------
27 : BaseOverlapTool(name)
28 {
29 declareProperty("DR", m_maxDR = 0.2,
30 "Delta-R cone for flagging overlaps");
31 declareProperty("UseRapidity", m_useRapidity = true,
32 "Calculate delta-R using rapidity");
33 declareProperty("MinMuonPt", m_minMuPt = 2.*GeV,
34 "Minimum muon PT for rejecting taus");
35 declareProperty("MinTauPtCombinedMuon", m_minTauPtMuComb = 50.*GeV,
36 "Tau PT threshold to compare to combined muons only");
37 }
38
39 //---------------------------------------------------------------------------
40 // Initialize
41 //---------------------------------------------------------------------------
43 {
44
45 // Initialize the dR matcher
46 m_dRMatcher = std::make_unique<DeltaRMatcher> (m_maxDR, m_useRapidity);
48 addSubtool(*m_dRMatcher);
49
50 return StatusCode::SUCCESS;
51 }
52
53 //---------------------------------------------------------------------------
54 // Identify overlaps
55 //---------------------------------------------------------------------------
59 columnar::EventContextId /*eventContext*/) const
60 {
61 // Check the container types
62 ATH_CHECK( checkForXAODContainer<xAOD::TauJetContainer>(cont1, "First container arg is not of type TauJetContainer!") );
63 ATH_CHECK( checkForXAODContainer<xAOD::MuonContainer>(cont2, "Second container arg is not of type MuonContainer!") );
64
65 ATH_CHECK( internalFindOverlaps(cont1, cont2) );
66 return StatusCode::SUCCESS;
67 }
68
69 //---------------------------------------------------------------------------
70 // Identify overlaps
71 //---------------------------------------------------------------------------
74 columnar::Particle2Range muons) const
75 {
76 ATH_MSG_DEBUG("Removing taus from loose muons");
77 auto& acc = *m_accessors;
78
79 // Initialize output decorations if necessary
82
83 // Loop over loose surviving muons
84 for(auto muon : muons){
85
86 // It's not obvious that I should be skipping objects that were
87 // flagged as overlap. Perhaps this deserves more thought/study.
88 if(isRejectedObject(muon)) continue;
89 if(muon(acc.m_muPtAcc) < m_minMuPt) continue;
90 bool isCombined = (muon(acc.m_muonTypeAcc) == xAOD::Muon::Combined);
91
92 // Loop over surviving taus
93 for(auto tau : taus){
94 if(!isSurvivingObject(tau)) continue;
95
96 // High-PT taus are only compared to combined muons
97 if((tau(acc.m_tauPtAcc) > m_minTauPtMuComb) && !isCombined) continue;
98
99 // Test for overlap
100 if(m_dRMatcher->objectsMatch(muon, tau)){
101 ATH_CHECK( handleOverlap(tau, muon) );
102 }
103 }
104 }
105
106 return StatusCode::SUCCESS;
107 }
108
109} // 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 isRejectedObject(columnar::Particle1Id obj) const
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
bool m_useRapidity
Calculate delta-R using rapidity.
virtual StatusCode internalFindOverlaps(columnar::Particle1Range taus, columnar::Particle2Range muons) const
Identify overlapping taus and loose muons.
float m_minTauPtMuComb
Tau PT threshold to compare to combined muons only.
std::unique_ptr< Accessors > m_accessors
virtual StatusCode findOverlaps(columnar::Particle1Range cont1, columnar::Particle2Range cont2, columnar::EventContextId eventContext) const override
Identify overlapping taus and loose muons.
std::unique_ptr< DeltaRMatcher > m_dRMatcher
Delta-R matcher.
TauLooseMuOverlapTool(const std::string &name)
Create proper constructor for Athena.
float m_maxDR
Maximum dR for objects flagged as overlap.
float m_minMuPt
Minimum muon PT to reject a tau.
virtual StatusCode initializeDerived() override
Initialize the tool.
ObjectId< ContainerId::eventContext > EventContextId
ObjectRange< ContainerId::particle2 > Particle2Range
Definition ParticleDef.h:53
ObjectRange< ContainerId::particle1 > Particle1Range
Definition ParticleDef.h:47
@ Muon
The object is a muon.
Definition ObjectType.h:48
@ Tau
The object is a tau (jet)
Definition ObjectType.h:49