ATLAS Offline Software
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 
9 namespace CP {
10 
12 
18 
23 
28 
30 
32 
33  return StatusCode::SUCCESS;
34  }
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};
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};
49 
50  const xAOD::TauJetContainer *taus {nullptr};
51  if (m_tausHandle) ANA_CHECK(m_tausHandle.retrieve(taus, syst));
52 
53  double leptonSF {1.};
54  if (m_electronsHandle){
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
CP::SysWriteDecorHandle::set
void set(const SG::AuxElement &object, const T &value, const CP::SystematicSet &sys) const
set the object decoration for the given systematic
CP::LeptonSFCalculatorAlg::m_tausHandle
CP::SysReadHandle< xAOD::TauJetContainer > m_tausHandle
Definition: LeptonSFCalculatorAlg.h:55
CP::LeptonSFCalculatorAlg::m_electronSFs
CP::SysReadDecorHandleArray< float > m_electronSFs
Definition: LeptonSFCalculatorAlg.h:66
CP::LeptonSFCalculatorAlg::m_electronSelection
CP::SysReadSelectionHandle m_electronSelection
Definition: LeptonSFCalculatorAlg.h:37
CP::LeptonSFCalculatorAlg::m_event_leptonSF
CP::SysWriteDecorHandle< float > m_event_leptonSF
Definition: LeptonSFCalculatorAlg.h:82
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
CP::LeptonSFCalculatorAlg::m_muonSelection
CP::SysReadSelectionHandle m_muonSelection
Definition: LeptonSFCalculatorAlg.h:44
CP::SysReadHandle::retrieve
::StatusCode retrieve(const T *&object, const CP::SystematicSet &sys) const
retrieve the object for the given name
CP::SysListHandle::systematicsVector
const std::vector< CP::SystematicSet > & systematicsVector() const
the list of systematics to loop over
Definition: SysListHandle.cxx:96
CP::LeptonSFCalculatorAlg::m_photonsHandle
CP::SysReadHandle< xAOD::PhotonContainer > m_photonsHandle
Definition: LeptonSFCalculatorAlg.h:48
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:49
xAOD::Muon_v1
Class describing a Muon.
Definition: Muon_v1.h:38
CP::LeptonSFCalculatorAlg::m_eventInfoHandle
CP::SysReadHandle< xAOD::EventInfo > m_eventInfoHandle
Definition: LeptonSFCalculatorAlg.h:62
CP::LeptonSFCalculatorAlg::m_muonSFs
CP::SysReadDecorHandleArray< float > m_muonSFs
Definition: LeptonSFCalculatorAlg.h:70
CP::SysReadHandle::initialize
StatusCode initialize(SysListHandle &sysListHandle)
initialize this handle
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::LeptonSFCalculatorAlg::initialize
virtual StatusCode initialize() final
Definition: LeptonSFCalculatorAlg.cxx:11
lumiFormat.i
int i
Definition: lumiFormat.py:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CP::SysWriteDecorHandle::initialize
StatusCode initialize(SysListHandle &sysListHandle, const ISysHandleBase &objectHandle)
initialize this handle
xAOD::TauJet_v3
Class describing a tau jet.
Definition: TauJet_v3.h:41
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
CP::LeptonSFCalculatorAlg::m_tauSFs
CP::SysReadDecorHandleArray< float > m_tauSFs
Definition: LeptonSFCalculatorAlg.h:78
CP::LeptonSFCalculatorAlg::m_tauSelection
CP::SysReadSelectionHandle m_tauSelection
Definition: LeptonSFCalculatorAlg.h:58
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
CP::LeptonSFCalculatorAlg::execute
virtual StatusCode execute() final
Definition: LeptonSFCalculatorAlg.cxx:36
CP::LeptonSFCalculatorAlg::m_electronsHandle
CP::SysReadHandle< xAOD::ElectronContainer > m_electronsHandle
Definition: LeptonSFCalculatorAlg.h:34
CP::LeptonSFCalculatorAlg::m_systematicsList
CP::SysListHandle m_systematicsList
Definition: LeptonSFCalculatorAlg.h:32
CP::LeptonSFCalculatorAlg::m_photonSFs
CP::SysReadDecorHandleArray< float > m_photonSFs
Definition: LeptonSFCalculatorAlg.h:74
xAOD::Electron_v1
Definition: Electron_v1.h:34
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
CP::LeptonSFCalculatorAlg::m_photonSelection
CP::SysReadSelectionHandle m_photonSelection
Definition: LeptonSFCalculatorAlg.h:51
xAOD::Photon_v1
Definition: Photon_v1.h:37
CP::SysReadSelectionHandle::initialize
StatusCode initialize(SysListHandle &sysListHandle, const ISysHandleBase &objectHandle)
initialize the accessor
Definition: SysReadSelectionHandle.cxx:34
CP::LeptonSFCalculatorAlg::m_muonsHandle
CP::SysReadHandle< xAOD::MuonContainer > m_muonsHandle
Definition: LeptonSFCalculatorAlg.h:41
CaloNoise_fillDB.mu
mu
Definition: CaloNoise_fillDB.py:51
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30
LeptonSFCalculatorAlg.h
InDetDD::electrons
@ electrons
Definition: InDetDD_Defs.h:17