ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
MuonID
MuonIDAnalysis
MuonEfficiencyCorrections
src
MuonCloseJetDecorationAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3
*/
4
// Local include(s):
5
#include "
MuonCloseJetDecorationAlg.h
"
6
#include "
PATInterfaces/SystematicsTool.h
"
7
#include <cmath>
8
9
#include "
xAODMuon/MuonContainer.h
"
10
#include "
xAODJet/JetContainer.h
"
11
#include "
FourMomUtils/xAODP4Helpers.h
"
12
namespace
ADD_CMODE(CP) {
13
MuonCloseJetDecorationAlg::MuonCloseJetDecorationAlg(
const
std::string& name, ISvcLocator* svcLoc) :
14
AthAlgorithm
(name, svcLoc),
15
m_muon_container(
"Muons"
),
16
m_jet_container(
"AntiKt4EMTopoJets"
),
17
m_jet_dr_decoration(
"dRJet"
),
18
m_dummy_value(-1.),
19
m_jet_pt_cut(20.e3),
20
m_decorator(
nullptr
) {
21
declareProperty(
"MuonContainer"
, m_muon_container);
22
declareProperty(
"JetContainer"
, m_jet_container);
23
declareProperty(
"dRDecoration"
, m_jet_dr_decoration);
24
declareProperty(
"DefaultValue"
, m_dummy_value);
25
declareProperty(
"MinJetPt"
, m_jet_pt_cut);
26
}
27
StatusCode MuonCloseJetDecorationAlg::initialize() {
28
if
(m_muon_container.empty()){
29
ATH_MSG_FATAL
(
"Please provide a suitable muon container"
);
30
return
StatusCode::FAILURE;
31
}
32
if
(m_jet_container.empty()){
33
ATH_MSG_FATAL
(
"Please provide a suitable jet container"
);
34
return
StatusCode::FAILURE;
35
}
36
if
(m_jet_dr_decoration.empty()){
37
ATH_MSG_FATAL
(
"What's the decoration to apply to the muon"
);
38
return
StatusCode::FAILURE;
39
}
40
m_decorator = std::make_unique<SG::Decorator<float>>(m_jet_dr_decoration);
41
ATH_MSG_INFO
(
"Decorator the jet dR between "
<<m_muon_container<<
" and "
<<m_jet_container<<
" to "
42
<<m_jet_dr_decoration<<
". If no jet is found the following dummy value is assigned: "
<<m_dummy_value);
43
return
StatusCode::SUCCESS;
44
}
45
46
StatusCode MuonCloseJetDecorationAlg::execute(
const
EventContext&
/*ctx*/
) {
47
48
const
xAOD::MuonContainer
* muons =
nullptr
;
49
ATH_CHECK
(evtStore()->retrieve(muons, m_muon_container));
50
51
const
xAOD::JetContainer
* jets =
nullptr
;
52
ATH_CHECK
(evtStore()->retrieve(jets, m_jet_container));
53
for
(
const
xAOD::Muon
* mu : *muons){
54
const
xAOD::Jet
* closest_jet =
nullptr
;
55
for
(
const
xAOD::Jet
*
jet
: *jets){
56
if
(
jet
->pt() < m_jet_pt_cut)
continue
;
57
if
(closest_jet ==
nullptr
||
xAOD::P4Helpers::deltaR2
(
jet
,mu) <
xAOD::P4Helpers::deltaR2
(closest_jet,mu)) closest_jet =
jet
;
58
}
59
(*m_decorator)(*mu) = closest_jet?
xAOD::P4Helpers::deltaR
(closest_jet,mu) : m_dummy_value;
60
}
61
return
StatusCode::SUCCESS;
62
}
63
64
}
// namespace ADD_CMODE(CP)
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_INFO
#define ATH_MSG_INFO(x,...)
Definition
AthMsgStreamMacros.h:45
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x,...)
Definition
AthMsgStreamMacros.h:48
JetContainer.h
MuonCloseJetDecorationAlg.h
MuonContainer.h
SystematicsTool.h
AthAlgorithm
Base class from which non-reentrant (not thread-safe) Athena algorithm classes should be derived.
Definition
AthAlgorithm.h:27
jet
Definition
JetCalibTools_PlotJESFactors.cxx:23
xAOD::P4Helpers::deltaR
double deltaR(double rapidity1, double phi1, double rapidity2, double phi2)
from bare bare rapidity,phi
Definition
xAODP4Helpers.h:150
xAOD::P4Helpers::deltaR2
double deltaR2(double rapidity1, double phi1, double rapidity2, double phi2)
from bare rapidity,phi
Definition
xAODP4Helpers.h:111
xAOD::Jet
Jet_v1 Jet
Definition of the current "jet version".
Definition
Event/xAOD/xAODJet/xAODJet/Jet.h:17
xAOD::Muon
Muon_v1 Muon
Reference the current persistent version:
Definition
Muon.h:13
xAOD::JetContainer
JetContainer_v1 JetContainer
Definition of the current "jet container version".
Definition
JetContainer.h:17
xAOD::MuonContainer
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
Definition
MuonContainer.h:14
xAODP4Helpers.h
Generated on
for ATLAS Offline Software by
1.17.0