ATLAS Offline Software
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 
14 namespace
15 {
17  const float GeV = 1e3;
18 }
19 
20 namespace ORUtils
21 {
22 
23  //---------------------------------------------------------------------------
24  // Constructor
25  //---------------------------------------------------------------------------
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);
47 
48  return StatusCode::SUCCESS;
49  }
50 
51  //---------------------------------------------------------------------------
52  // Identify overlaps
53  //---------------------------------------------------------------------------
56  const xAOD::IParticleContainer& cont2) const
57  {
58  // Check the container types
59  if(typeid(cont1) != typeid(xAOD::TauJetContainer) &&
60  typeid(cont1) != typeid(ConstDataVector<xAOD::TauJetContainer>)) {
61  ATH_MSG_ERROR("First container arg is not of type TauJetContainer!");
62  return StatusCode::FAILURE;
63  }
64  if(typeid(cont2) != typeid(xAOD::MuonContainer) &&
65  typeid(cont2) != typeid(ConstDataVector<xAOD::MuonContainer>)) {
66  ATH_MSG_ERROR("Second container arg is not of type MuonContainer!");
67  return StatusCode::FAILURE;
68  }
69  ATH_CHECK( findOverlaps(static_cast<const xAOD::TauJetContainer&>(cont1),
70  static_cast<const xAOD::MuonContainer&>(cont2)) );
71  return StatusCode::SUCCESS;
72  }
73 
74  //---------------------------------------------------------------------------
75  // Identify overlaps
76  //---------------------------------------------------------------------------
79  const xAOD::MuonContainer& muons) const
80  {
81  ATH_MSG_DEBUG("Removing taus from loose muons");
82 
83  // Initialize output decorations if necessary
84  m_decHelper->initializeDecorations(taus);
85  m_decHelper->initializeDecorations(muons);
86 
87  // Loop over loose surviving muons
88  for(auto muon : muons){
89 
90  // It's not obvious that I should be skipping objects that were
91  // flagged as overlap. Perhaps this deserves more thought/study.
92  if(m_decHelper->isRejectedObject(*muon)) continue;
93  if(muon->pt() < m_minMuPt) continue;
94  bool isCombined = (muon->muonType() == xAOD::Muon::Combined);
95 
96  // Loop over surviving taus
97  for(auto tau : taus){
98  if(!m_decHelper->isSurvivingObject(*tau)) continue;
99 
100  // High-PT taus are only compared to combined muons
101  if((tau->pt() > m_minTauPtMuComb) && !isCombined) continue;
102 
103  // Test for overlap
104  if(m_dRMatcher->objectsMatch(*muon, *tau)){
105  ATH_CHECK( handleOverlap(tau, muon) );
106  }
107  }
108  }
109 
110  return StatusCode::SUCCESS;
111  }
112 
113 } // namespace ORUtils
ORUtils::TauLooseMuOverlapTool::m_minTauPtMuComb
float m_minTauPtMuComb
Tau PT threshold to compare to combined muons only.
Definition: TauLooseMuOverlapTool.h:76
xAOD::muon
@ muon
Definition: TrackingPrimitives.h:195
ORUtils::TauLooseMuOverlapTool::m_maxDR
float m_maxDR
Maximum dR for objects flagged as overlap.
Definition: TauLooseMuOverlapTool.h:69
ORUtils::TauLooseMuOverlapTool::findOverlaps
virtual StatusCode findOverlaps(const xAOD::IParticleContainer &cont1, const xAOD::IParticleContainer &cont2) const override
Identify overlapping taus and loose muons.
Definition: TauLooseMuOverlapTool.cxx:55
ConstDataVector.h
DataVector adapter that acts like it holds const pointers.
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
ORUtils::TauLooseMuOverlapTool::initializeDerived
virtual StatusCode initializeDerived() override
Initialize the tool.
Definition: TauLooseMuOverlapTool.cxx:42
ORUtils::TauLooseMuOverlapTool::m_dRMatcher
std::unique_ptr< DeltaRMatcher > m_dRMatcher
Delta-R matcher.
Definition: TauLooseMuOverlapTool.h:83
ORUtils
Definition: AltMuJetOverlapTool.h:20
TauLooseMuOverlapTool.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
CheckAppliedSFs.e3
e3
Definition: CheckAppliedSFs.py:264
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
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
Trk::Combined
@ Combined
Definition: TrackSummaryTool.h:32
ORUtils::TauLooseMuOverlapTool::m_minMuPt
float m_minMuPt
Minimum muon PT to reject a tau.
Definition: TauLooseMuOverlapTool.h:74
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
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
ConstDataVector
DataVector adapter that acts like it holds const pointers.
Definition: ConstDataVector.h:76
ORUtils::TauLooseMuOverlapTool::m_useRapidity
bool m_useRapidity
Calculate delta-R using rapidity.
Definition: TauLooseMuOverlapTool.h:71
GeV
#define GeV
Definition: CaloTransverseBalanceVecMon.cxx:30
ORUtils::TauLooseMuOverlapTool::TauLooseMuOverlapTool
TauLooseMuOverlapTool(const std::string &name)
Create proper constructor for Athena.
Definition: TauLooseMuOverlapTool.cxx:26