ATLAS Offline Software
Loading...
Searching...
No Matches
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
14
15//
16// method implementations
17//
18
19namespace CP
20{
21
22 StatusCode MuonCalibrationAndSmearingAlg ::
23 initialize ()
24 {
30 {
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));
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 {
66 }
67 else
68 {
70 }
71 }
72 }
73 }
74 return StatusCode::SUCCESS;
75 }
76}
#define ANA_CHECK(EXP)
check whether the given expression was successful
#define ANA_CHECK_CORRECTION(helper, object, expr)
a helper check macro to work with OutOfValidityHelper
SysListHandle m_systematicsList
the systematics list we run
SysCopyHandle< xAOD::MuonContainer > m_muonHandle
the muon collection we run on
Gaudi::Property< int > m_zeroPixMuonType
the muonType value used for the ZeroPix calibration tool
SysReadSelectionHandle m_preselection
the preselection we apply to our input
Gaudi::Property< bool > m_skipNominal
whether to skip the nominal correction (for PHYSLITE)
OutOfValidityHelper m_outOfValidity
the helper for OutOfValidity results
ToolHandle< IMuonCalibrationAndSmearingTool > m_calibrationAndSmearingTool
the smearing tool
ToolHandle< IMuonCalibrationAndSmearingTool > m_calibrationAndSmearingTool_ZeroPix
an optional calibration tool applied only to ZeroPixelHit muons.
Select isolated Photons, Electrons and Muons.
Muon_v1 Muon
Reference the current persistent version:
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".