ATLAS Offline Software
Loading...
Searching...
No Matches
LeptonSFCalculatorAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6
8
9namespace CP {
10
35
36 StatusCode LeptonSFCalculatorAlg::execute(const EventContext& ctx) {
37 for (const auto& syst : m_systematicsList.systematicsVector()) {
38 const xAOD::EventInfo *evtInfo {nullptr};
39 ANA_CHECK(m_eventInfoHandle.retrieve(evtInfo, syst, ctx));
40
41 double leptonSF {1.};
42 auto accumulateSFs = [&]<typename T>(CP::SysReadHandle<T>& handle,
44 CP::SysReadDecorHandleArray<float>& sfs) -> StatusCode {
45 if (!handle) return StatusCode::SUCCESS;
46 const T *particles {nullptr};
47 ANA_CHECK(handle.retrieve(particles, syst, ctx));
48 for (const auto *particle : *particles) {
49 if (selection.getBool(*particle, syst)) {
50 for (size_t i{}; i < sfs.size(); i++) {
51 leptonSF *= sfs.at(i).get(*particle, syst);
52 }
53 }
54 }
55 return StatusCode::SUCCESS;
56 };
61
62 m_event_leptonSF.set(*evtInfo, leptonSF, syst);
63 }
64 return StatusCode::SUCCESS;
65 }
66
67} // namespace
#define ANA_CHECK(EXP)
check whether the given expression was successful
CP::SysReadHandle< xAOD::TauJetContainer > m_tausHandle
CP::SysReadDecorHandleArray< float > m_photonSFs
CP::SysReadHandle< xAOD::MuonContainer > m_muonsHandle
virtual StatusCode initialize() final
CP::SysReadHandle< xAOD::ElectronContainer > m_electronsHandle
CP::SysReadSelectionHandle m_photonSelection
CP::SysReadDecorHandleArray< float > m_tauSFs
CP::SysWriteDecorHandle< float > m_event_leptonSF
CP::SysReadSelectionHandle m_muonSelection
CP::SysReadHandle< xAOD::PhotonContainer > m_photonsHandle
CP::SysReadDecorHandleArray< float > m_electronSFs
CP::SysReadSelectionHandle m_electronSelection
CP::SysReadSelectionHandle m_tauSelection
CP::SysReadDecorHandleArray< float > m_muonSFs
CP::SysReadHandle< xAOD::EventInfo > m_eventInfoHandle
a data handle for reading systematics varied input data
a data handle for reading systematically varied selection properties from objects
void handle(const Incident &inc)
receive the given incident
virtual::StatusCode execute()
execute this algorithm
const std::string selection
Select isolated Photons, Electrons and Muons.
SysHandleArray< SysReadDecorHandle< T > > SysReadDecorHandleArray
EventInfo_v1 EventInfo
Definition of the latest event info version.