ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
MuonAnalysisAlgorithms
Root
MuonCalibrationAndSmearingAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
7
8
9
//
10
// includes
11
//
12
13
#include <
MuonAnalysisAlgorithms/MuonCalibrationAndSmearingAlg.h
>
14
15
//
16
// method implementations
17
//
18
19
namespace
CP
20
{
21
22
StatusCode MuonCalibrationAndSmearingAlg ::
23
initialize ()
24
{
25
ANA_CHECK
(
m_calibrationAndSmearingTool
.retrieve());
26
ANA_CHECK
(
m_muonHandle
.initialize (
m_systematicsList
));
27
ANA_CHECK
(
m_preselection
.initialize (
m_systematicsList
,
m_muonHandle
,
SG::AllowEmpty
));
28
ANA_CHECK
(
m_systematicsList
.addSystematics (*
m_calibrationAndSmearingTool
));
29
if
(!
m_calibrationAndSmearingTool_ZeroPix
.empty())
30
{
31
ANA_CHECK
(
m_calibrationAndSmearingTool_ZeroPix
.retrieve());
32
ANA_CHECK
(
m_systematicsList
.addSystematics (*
m_calibrationAndSmearingTool_ZeroPix
));
33
}
34
ANA_CHECK
(
m_systematicsList
.initialize());
35
ANA_CHECK
(
m_outOfValidity
.initialize());
36
return
StatusCode::SUCCESS;
37
}
38
39
40
41
StatusCode MuonCalibrationAndSmearingAlg ::
42
execute (
const
EventContext& ctx)
43
{
44
for
(
const
auto
& sys :
m_systematicsList
.systematicsVector())
45
{
46
// always need to call `getCopy` first to ensure that the shallow copies
47
// are all there if requested
48
xAOD::MuonContainer
*muons =
nullptr
;
49
ANA_CHECK
(
m_muonHandle
.getCopy (muons, sys, ctx));
50
51
if
(sys.empty() &&
m_skipNominal
.value())
52
continue
;
53
54
ANA_CHECK
(
m_calibrationAndSmearingTool
->applySystematicVariation (sys));
55
if
(!
m_calibrationAndSmearingTool_ZeroPix
.empty())
56
ANA_CHECK
(
m_calibrationAndSmearingTool_ZeroPix
->applySystematicVariation (sys));
57
58
for
(
xAOD::Muon
*
muon
: *muons)
59
{
60
if
(
m_preselection
.getBool (*
muon
, sys))
61
{
62
// Apply MS-only calibration if ZPH muons are used
63
if
(!
m_calibrationAndSmearingTool_ZeroPix
.empty() &&
muon
->muonType() ==
m_zeroPixMuonType
.value())
64
{
65
ANA_CHECK_CORRECTION
(
m_outOfValidity
, *
muon
,
m_calibrationAndSmearingTool_ZeroPix
->applyCorrection (*
muon
));
66
}
67
else
68
{
69
ANA_CHECK_CORRECTION
(
m_outOfValidity
, *
muon
,
m_calibrationAndSmearingTool
->applyCorrection (*
muon
));
70
}
71
}
72
}
73
}
74
return
StatusCode::SUCCESS;
75
}
76
}
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
MuonCalibrationAndSmearingAlg.h
ANA_CHECK_CORRECTION
#define ANA_CHECK_CORRECTION(helper, object, expr)
a helper check macro to work with OutOfValidityHelper
Definition
OutOfValidityHelper.h:132
CP::MuonCalibrationAndSmearingAlg::m_systematicsList
SysListHandle m_systematicsList
the systematics list we run
Definition
MuonCalibrationAndSmearingAlg.h:55
CP::MuonCalibrationAndSmearingAlg::m_muonHandle
SysCopyHandle< xAOD::MuonContainer > m_muonHandle
the muon collection we run on
Definition
MuonCalibrationAndSmearingAlg.h:59
CP::MuonCalibrationAndSmearingAlg::m_zeroPixMuonType
Gaudi::Property< int > m_zeroPixMuonType
the muonType value used for the ZeroPix calibration tool
Definition
MuonCalibrationAndSmearingAlg.h:46
CP::MuonCalibrationAndSmearingAlg::m_preselection
SysReadSelectionHandle m_preselection
the preselection we apply to our input
Definition
MuonCalibrationAndSmearingAlg.h:64
CP::MuonCalibrationAndSmearingAlg::m_skipNominal
Gaudi::Property< bool > m_skipNominal
whether to skip the nominal correction (for PHYSLITE)
Definition
MuonCalibrationAndSmearingAlg.h:50
CP::MuonCalibrationAndSmearingAlg::m_outOfValidity
OutOfValidityHelper m_outOfValidity
the helper for OutOfValidity results
Definition
MuonCalibrationAndSmearingAlg.h:69
CP::MuonCalibrationAndSmearingAlg::m_calibrationAndSmearingTool
ToolHandle< IMuonCalibrationAndSmearingTool > m_calibrationAndSmearingTool
the smearing tool
Definition
MuonCalibrationAndSmearingAlg.h:37
CP::MuonCalibrationAndSmearingAlg::m_calibrationAndSmearingTool_ZeroPix
ToolHandle< IMuonCalibrationAndSmearingTool > m_calibrationAndSmearingTool_ZeroPix
an optional calibration tool applied only to ZeroPixelHit muons.
Definition
MuonCalibrationAndSmearingAlg.h:42
CP
Select isolated Photons, Electrons and Muons.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:27
SG::AllowEmpty
@ AllowEmpty
Definition
StoreGate/StoreGate/VarHandleKey.h:27
xAOD::Muon
Muon_v1 Muon
Reference the current persistent version:
Definition
Event/xAOD/xAODMuon/xAODMuon/Muon.h:13
xAOD::muon
@ muon
Definition
TrackingPrimitives.h:196
xAOD::MuonContainer
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
Definition
Event/xAOD/xAODMuon/xAODMuon/MuonContainer.h:14
Generated on
for ATLAS Offline Software by
1.17.0