ATLAS Offline Software
Loading...
Searching...
No Matches
FakeBkgCalculatorAlg.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
9
10namespace CP {
11
33
34 StatusCode FakeBkgCalculatorAlg::execute(const EventContext& ctx) {
35
36 static const SG::Decorator<char> dec_lepton_tight("TightForFakeBkgCalculation");
37 static const SG::Accessor<char> flagAcc("TightForFakeBkgCalculation");
38
39 ANA_MSG_DEBUG(" ----> FakeBkgCalculatorAlg::execute()");
40 for (const auto &sys : m_systematicsList.systematicsVector()) {
41 const xAOD::EventInfo *evtInfo = nullptr;
42 const xAOD::ElectronContainer *electrons = nullptr;
43 const xAOD::MuonContainer *muons = nullptr;
44
45 ANA_CHECK(m_eventInfoHandle.retrieve(evtInfo, sys, ctx));
46
47 m_fakeToolOutput.set(*evtInfo, -1, sys); // default value
48 if ( m_preselection && !m_preselection.getBool(*evtInfo, sys)) continue;
49
50 ANA_CHECK(m_electronsHandle.retrieve(electrons, sys, ctx));
51 ANA_CHECK(m_muonsHandle.retrieve(muons, sys, ctx));
52
54 for (const xAOD::Electron *t : *electrons) {
55 if( m_electronSelection && !m_electronSelection.getBool(*t, sys)) continue;
56 leptons.push_back(t);
57 dec_lepton_tight(*leptons.back()) = m_electronSelectionTarget.getBool(*t, sys);
58 }
59 for (const xAOD::Muon *t : *muons) {
60 if( m_muonSelection && !m_muonSelection.getBool(*t, sys)) continue;
61 leptons.push_back(t);
62 dec_lepton_tight(*leptons.back()) = m_muonSelectionTarget.getBool(*t, sys);
63 }
64
65 for (const xAOD::IParticle *t : leptons)
66 ANA_MSG_DEBUG("lepton type = "<<t->type()<<", pt = "<<t->pt()<<" , eta = "<<t->eta()<<", tight = "<<bool(flagAcc(*t)));
67
68 ANA_CHECK(m_fakeTool->addEvent(leptons));
69 float asmWgt = 0.;
70 ANA_CHECK(m_fakeTool->getEventWeight(asmWgt, m_definition, m_process));
71 ANA_MSG_DEBUG(" ----> asmWgt = "<<asmWgt);
72
73 m_fakeToolOutput.set(*evtInfo, asmWgt, sys);
74 }
75
76 return StatusCode::SUCCESS;
77 }
78
79} // namespace
DataVector adapter that acts like it holds const pointers.
#define ANA_MSG_DEBUG(xmsg,...)
Macro printing debug messages.
#define ANA_CHECK(EXP)
check whether the given expression was successful
CP::SysReadSelectionHandle m_muonSelectionTarget
CP::SysWriteDecorHandle< float > m_fakeToolOutput
CP::SysReadHandle< xAOD::ElectronContainer > m_electronsHandle
Gaudi::Property< std::string > m_definition
virtual StatusCode initialize() override
CP::SysReadSelectionHandle m_muonSelection
ToolHandle< ILinearFakeBkgTool > m_fakeTool
CP::SysReadSelectionHandle m_preselection
CP::SysReadHandle< xAOD::EventInfo > m_eventInfoHandle
CP::SysReadHandle< xAOD::MuonContainer > m_muonsHandle
CP::SysListHandle m_systematicsList
CP::SysReadSelectionHandle m_electronSelection
Gaudi::Property< std::string > m_process
CP::SysReadSelectionHandle m_electronSelectionTarget
DataVector adapter that acts like it holds const pointers.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
ElementProxy back()
Access the last element in the collection as an lvalue.
virtual::StatusCode execute()
execute this algorithm
Helper class to provide type-safe access to aux data.
Class providing the definition of the 4-vector interface.
Select isolated Photons, Electrons and Muons.
SG::Decorator< T, ALLOC > Decorator
Helper class to provide type-safe access to aux data, specialized for JaggedVecElt.
Definition AuxElement.h:576
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
EventInfo_v1 EventInfo
Definition of the latest event info version.
Muon_v1 Muon
Reference the current persistent version:
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
Electron_v1 Electron
Definition of the current "egamma version".