ATLAS Offline Software
Loading...
Searching...
No Matches
FakeBkgCalculatorAlg.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
9
10namespace CP {
11
32
34
35 static const SG::Decorator<char> dec_lepton_tight("TightForFakeBkgCalculation");
36 static const SG::Accessor<char> flagAcc("TightForFakeBkgCalculation");
37
38 ANA_MSG_DEBUG(" ----> FakeBkgCalculatorAlg::execute()");
39 for (const auto &sys : m_systematicsList.systematicsVector()) {
40 const xAOD::EventInfo *evtInfo = nullptr;
41 const xAOD::ElectronContainer *electrons = nullptr;
42 const xAOD::MuonContainer *muons = nullptr;
43
44 ANA_CHECK(m_eventInfoHandle.retrieve(evtInfo, sys));
45
46 m_fakeToolOutput.set(*evtInfo, -1, sys); // default value
47 if ( m_preselection && !m_preselection.getBool(*evtInfo, sys)) continue;
48
49 ANA_CHECK(m_electronsHandle.retrieve(electrons, sys));
50 ANA_CHECK(m_muonsHandle.retrieve(muons, sys));
51
53 for (const xAOD::Electron *t : *electrons) {
54 if( m_electronSelection && !m_electronSelection.getBool(*t, sys)) continue;
55 leptons.push_back(t);
56 dec_lepton_tight(*leptons.back()) = m_electronSelectionTarget.getBool(*t, sys);
57 }
58 for (const xAOD::Muon *t : *muons) {
59 if( m_muonSelection && !m_muonSelection.getBool(*t, sys)) continue;
60 leptons.push_back(t);
61 dec_lepton_tight(*leptons.back()) = m_muonSelectionTarget.getBool(*t, sys);
62 }
63
64 for (const xAOD::IParticle *t : leptons)
65 ANA_MSG_DEBUG("lepton type = "<<t->type()<<", pt = "<<t->pt()<<" , eta = "<<t->eta()<<", tight = "<<bool(flagAcc(*t)));
66
67 ANA_CHECK(m_fakeTool->addEvent(leptons));
68 float asmWgt = 0.;
69 ANA_CHECK(m_fakeTool->applySystematicVariation({})); // the nominal MM weight is computed
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
virtual StatusCode execute() 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.
Helper class to provide type-safe access to aux data.
Helper class to provide type-safe access to aux data.
Definition Decorator.h:59
Class providing the definition of the 4-vector interface.
Select isolated Photons, Electrons and Muons.
@ 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".