ATLAS Offline Software
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 #include <RootCoreUtils/Assert.h>
16 
17 //
18 // method implementations
19 //
20 
21 namespace CP
22 {
23 
25  initialize ()
26  {
33  return StatusCode::SUCCESS;
34  }
35 
36 
37 
39  execute ()
40  {
41  for (const auto& sys : m_systematicsList.systematicsVector())
42  {
43  // always need to call `getCopy` first to ensure that the shallow copies
44  // are all there if requested
45  xAOD::MuonContainer *muons = nullptr;
46  ANA_CHECK (m_muonHandle.getCopy (muons, sys));
47 
48  if (sys.empty() && m_skipNominal.value())
49  continue;
50 
51  ANA_CHECK (m_calibrationAndSmearingTool->applySystematicVariation (sys));
52  for (xAOD::Muon *muon : *muons)
53  {
55  {
57  }
58  }
59  }
60  return StatusCode::SUCCESS;
61  }
62 }
CP::MuonCalibrationAndSmearingAlg::m_skipNominal
Gaudi::Property< bool > m_skipNominal
whether to skip the nominal correction (for PHYSLITE)
Definition: MuonCalibrationAndSmearingAlg.h:41
CP::MuonCalibrationAndSmearingAlg::execute
StatusCode execute() override
Definition: MuonCalibrationAndSmearingAlg.cxx:39
xAOD::muon
@ muon
Definition: TrackingPrimitives.h:195
CP::MuonCalibrationAndSmearingAlg::m_muonHandle
SysCopyHandle< xAOD::MuonContainer > m_muonHandle
the muon collection we run on
Definition: MuonCalibrationAndSmearingAlg.h:50
CP::SysListHandle::addSystematics
StatusCode addSystematics(const CP::SystematicSet &recommended, const CP::SystematicSet &affecting)
register a set of affecting variables for the current algorithm (usually obtained from an CP::ISystem...
Definition: SysListHandle.cxx:48
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
CP::MuonCalibrationAndSmearingAlg::m_calibrationAndSmearingTool
ToolHandle< IMuonCalibrationAndSmearingTool > m_calibrationAndSmearingTool
the smearing tool
Definition: MuonCalibrationAndSmearingAlg.h:37
CP::SysListHandle::systematicsVector
const std::vector< CP::SystematicSet > & systematicsVector() const
the list of systematics to loop over
Definition: SysListHandle.cxx:96
Assert.h
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
xAOD::Muon_v1
Class describing a Muon.
Definition: Muon_v1.h:38
CP::SysListHandle::initialize
::StatusCode initialize()
intialize this property
Definition: SysListHandle.cxx:69
CP::SysReadSelectionHandle::getBool
bool getBool(const SG::AuxElement &element, const CP::SystematicSet &sys) const
get the selection as a bool
CP::MuonCalibrationAndSmearingAlg::m_outOfValidity
OutOfValidityHelper m_outOfValidity
the helper for OutOfValidity results
Definition: MuonCalibrationAndSmearingAlg.h:60
MuonCalibrationAndSmearingAlg.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CP::MuonCalibrationAndSmearingAlg::m_preselection
SysReadSelectionHandle m_preselection
the preselection we apply to our input
Definition: MuonCalibrationAndSmearingAlg.h:55
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
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:46
CP::OutOfValidityHelper::initialize
::StatusCode initialize()
standard initialize
Definition: OutOfValidityHelper.cxx:25
CP::SysReadSelectionHandle::initialize
StatusCode initialize(SysListHandle &sysListHandle, const ISysHandleBase &objectHandle)
initialize the accessor
Definition: SysReadSelectionHandle.cxx:34
CP::MuonCalibrationAndSmearingAlg::initialize
StatusCode initialize() override
Definition: MuonCalibrationAndSmearingAlg.cxx:25
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30