ATLAS Offline Software
Loading...
Searching...
No Matches
LeptonSFCalculatorAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6
8
9namespace CP {
10
35
37 for (const auto& syst : m_systematicsList.systematicsVector()) {
38 const xAOD::EventInfo *evtInfo {nullptr};
39 ANA_CHECK(m_eventInfoHandle.retrieve(evtInfo, syst));
40
41 const xAOD::ElectronContainer *electrons {nullptr};
42 if (m_electronsHandle) ANA_CHECK(m_electronsHandle.retrieve(electrons, syst));
43
44 const xAOD::MuonContainer *muons {nullptr};
45 if (m_muonsHandle) ANA_CHECK(m_muonsHandle.retrieve(muons, syst));
46
47 const xAOD::PhotonContainer *photons {nullptr};
48 if (m_photonsHandle) ANA_CHECK(m_photonsHandle.retrieve(photons, syst));
49
50 const xAOD::TauJetContainer *taus {nullptr};
51 if (m_tausHandle) ANA_CHECK(m_tausHandle.retrieve(taus, syst));
52
53 double leptonSF {1.};
55 for (const xAOD::Electron *el : *electrons) {
56 if (m_electronSelection.getBool(*el, syst)) {
57 for (size_t i{}; i < m_electronSFs.size(); i++) {
58 leptonSF *= m_electronSFs.at(i).get(*el, syst);
59 }
60 }
61 }
62 }
63 if (m_muonsHandle){
64 for (const xAOD::Muon *mu : *muons) {
65 if (m_muonSelection.getBool(*mu, syst)) {
66 for (size_t i{}; i < m_muonSFs.size(); i++) {
67 leptonSF *= m_muonSFs.at(i).get(*mu, syst);
68 }
69 }
70 }
71 }
72 if (m_photonsHandle){
73 for (const xAOD::Photon *ph : *photons) {
74 if (m_photonSelection.getBool(*ph, syst)) {
75 for (size_t i{}; i < m_photonSFs.size(); i++) {
76 leptonSF *= m_photonSFs.at(i).get(*ph, syst);
77 }
78 }
79 }
80 }
81 if (m_tausHandle){
82 for (const xAOD::TauJet *tau : *taus) {
83 if (m_tauSelection.getBool(*tau, syst)) {
84 for (size_t i{}; i < m_tauSFs.size(); i++) {
85 leptonSF *= m_tauSFs.at(i).get(*tau, syst);
86 }
87 }
88 }
89 }
90
91 m_event_leptonSF.set(*evtInfo, leptonSF, syst);
92 }
93 return StatusCode::SUCCESS;
94 }
95
96} // namespace
#define ANA_CHECK(EXP)
check whether the given expression was successful
static Double_t taus
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
virtual StatusCode execute() final
CP::SysReadHandle< xAOD::EventInfo > m_eventInfoHandle
Select isolated Photons, Electrons and Muons.
PhotonContainer_v1 PhotonContainer
Definition of the current "photon container version".
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
EventInfo_v1 EventInfo
Definition of the latest event info version.
TauJet_v3 TauJet
Definition of the current "tau version".
Muon_v1 Muon
Reference the current persistent version:
Photon_v1 Photon
Definition of the current "egamma version".
TauJetContainer_v3 TauJetContainer
Definition of the current "taujet container version".
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
Electron_v1 Electron
Definition of the current "egamma version".